diff --git a/dist/web3.js b/dist/web3.js index 65ecede96a4..74e66d7c3a9 100644 --- a/dist/web3.js +++ b/dist/web3.js @@ -20,19 +20,19 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } })(function () { var define, module, exports;return function () { - function e(t, n, r) { - function s(o, u) { - if (!n[o]) { - if (!t[o]) { - var a = typeof require == "function" && require;if (!u && a) return a(o, !0);if (i) return i(o, !0);var f = new Error("Cannot find module '" + o + "'");throw f.code = "MODULE_NOT_FOUND", f; - }var l = n[o] = { exports: {} };t[o][0].call(l.exports, function (e) { - var n = t[o][1][e];return s(n ? n : e); - }, l, l.exports, e, t, n, r); - }return n[o].exports; - }var i = typeof require == "function" && require;for (var o = 0; o < r.length; o++) { - s(r[o]); - }return s; - }return e; + function r(e, n, t) { + function o(i, f) { + if (!n[i]) { + if (!e[i]) { + var c = "function" == typeof require && require;if (!f && c) return c(i, !0);if (u) return u(i, !0);var a = new Error("Cannot find module '" + i + "'");throw a.code = "MODULE_NOT_FOUND", a; + }var p = n[i] = { exports: {} };e[i][0].call(p.exports, function (r) { + var n = e[i][1][r];return o(n || r); + }, p, p.exports, r, e, n, t); + }return n[i].exports; + }for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) { + o(t[i]); + }return o; + }return r; }()({ 1: [function (require, module, exports) { var asn1 = exports; @@ -99,7 +99,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol Entity.prototype.encode = function encode(data, enc, /* internal */reporter) { return this._getEncoder(enc).encode(data, reporter); }; - }, { "../asn1": 1, "inherits": 101, "vm": 161 }], 3: [function (require, module, exports) { + }, { "../asn1": 1, "inherits": 102, "vm": 169 }], 3: [function (require, module, exports) { var inherits = require('inherits'); var Reporter = require('../base').Reporter; var Buffer = require('buffer').Buffer; @@ -202,7 +202,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; }; - }, { "../base": 4, "buffer": 47, "inherits": 101 }], 4: [function (require, module, exports) { + }, { "../base": 4, "buffer": 47, "inherits": 102 }], 4: [function (require, module, exports) { var base = exports; base.Reporter = require('./reporter').Reporter; @@ -850,7 +850,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } return this; }; - }, { "inherits": 101 }], 7: [function (require, module, exports) { + }, { "inherits": 102 }], 7: [function (require, module, exports) { var constants = require('../constants'); exports.tagClass = { @@ -1187,7 +1187,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return len; } - }, { "../../asn1": 1, "inherits": 101 }], 10: [function (require, module, exports) { + }, { "../../asn1": 1, "inherits": 102 }], 10: [function (require, module, exports) { var decoders = exports; decoders.der = require('./der'); @@ -1237,7 +1237,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var input = new Buffer(base64, 'base64'); return DERDecoder.prototype.decode.call(this, input, options); }; - }, { "./der": 9, "buffer": 47, "inherits": 101 }], 12: [function (require, module, exports) { + }, { "./der": 9, "buffer": 47, "inherits": 102 }], 12: [function (require, module, exports) { var inherits = require('inherits'); var Buffer = require('buffer').Buffer; @@ -1479,7 +1479,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return res; } - }, { "../../asn1": 1, "buffer": 47, "inherits": 101 }], 13: [function (require, module, exports) { + }, { "../../asn1": 1, "buffer": 47, "inherits": 102 }], 13: [function (require, module, exports) { var encoders = exports; encoders.der = require('./der'); @@ -1506,7 +1506,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }out.push('-----END ' + options.label + '-----'); return out.join('\n'); }; - }, { "./der": 12, "inherits": 101 }], 15: [function (require, module, exports) { + }, { "./der": 12, "inherits": 102 }], 15: [function (require, module, exports) { 'use strict'; exports.byteLength = byteLength; @@ -1523,54 +1523,69 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol revLookup[code.charCodeAt(i)] = i; } + // Support decoding URL-safe base64 strings, as Node.js does. + // See: https://en.wikipedia.org/wiki/Base64#URL_applications revLookup['-'.charCodeAt(0)] = 62; revLookup['_'.charCodeAt(0)] = 63; - function placeHoldersCount(b64) { + function getLens(b64) { var len = b64.length; + if (len % 4 > 0) { throw new Error('Invalid string. Length must be a multiple of 4'); } - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0; + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('='); + if (validLen === -1) validLen = len; + + var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; + + return [validLen, placeHoldersLen]; } + // base64 is 4/3 + up to two characters of the original data function byteLength(b64) { - // base64 is 4/3 + up to two characters of the original data - return b64.length * 3 / 4 - placeHoldersCount(b64); + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; + return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; + } + + function _byteLength(b64, validLen, placeHoldersLen) { + return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; } function toByteArray(b64) { - var i, l, tmp, placeHolders, arr; - var len = b64.length; - placeHolders = placeHoldersCount(b64); + var tmp; + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; - arr = new Arr(len * 3 / 4 - placeHolders); + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); - // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? len - 4 : len; + var curByte = 0; - var L = 0; + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - for (i = 0; i < l; i += 4) { + for (var i = 0; i < len; i += 4) { tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; - arr[L++] = tmp >> 16 & 0xFF; - arr[L++] = tmp >> 8 & 0xFF; - arr[L++] = tmp & 0xFF; + arr[curByte++] = tmp >> 16 & 0xFF; + arr[curByte++] = tmp >> 8 & 0xFF; + arr[curByte++] = tmp & 0xFF; } - if (placeHolders === 2) { + if (placeHoldersLen === 2) { tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; - arr[L++] = tmp & 0xFF; - } else if (placeHolders === 1) { + arr[curByte++] = tmp & 0xFF; + } + + if (placeHoldersLen === 1) { tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; - arr[L++] = tmp >> 8 & 0xFF; - arr[L++] = tmp & 0xFF; + arr[curByte++] = tmp >> 8 & 0xFF; + arr[curByte++] = tmp & 0xFF; } return arr; @@ -1584,7 +1599,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var tmp; var output = []; for (var i = start; i < end; i += 3) { - tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2]; + tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); output.push(tripletToBase64(tmp)); } return output.join(''); @@ -1594,7 +1609,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var tmp; var len = uint8.length; var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes - var output = ''; var parts = []; var maxChunkLength = 16383; // must be multiple of 3 @@ -1606,19 +1620,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // pad the end with zeros, but make sure to not forget the extra bytes if (extraBytes === 1) { tmp = uint8[len - 1]; - output += lookup[tmp >> 2]; - output += lookup[tmp << 4 & 0x3F]; - output += '=='; + parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); } else if (extraBytes === 2) { tmp = (uint8[len - 2] << 8) + uint8[len - 1]; - output += lookup[tmp >> 10]; - output += lookup[tmp >> 4 & 0x3F]; - output += lookup[tmp << 2 & 0x3F]; - output += '='; + parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); } - parts.push(output); - return parts.join(''); } }, {}], 16: [function (require, module, exports) { @@ -1900,7 +1907,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports.AES = AES; - }, { "safe-buffer": 147 }], 19: [function (require, module, exports) { + }, { "safe-buffer": 149 }], 19: [function (require, module, exports) { var aes = require('./aes'); var Buffer = require('safe-buffer').Buffer; var Transform = require('cipher-base'); @@ -2018,7 +2025,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = StreamCipher; - }, { "./aes": 18, "./ghash": 23, "./incr32": 24, "buffer-xor": 46, "cipher-base": 48, "inherits": 101, "safe-buffer": 147 }], 20: [function (require, module, exports) { + }, { "./aes": 18, "./ghash": 23, "./incr32": 24, "buffer-xor": 46, "cipher-base": 49, "inherits": 102, "safe-buffer": 149 }], 20: [function (require, module, exports) { var ciphers = require('./encrypter'); var deciphers = require('./decrypter'); var modes = require('./modes/list.json'); @@ -2114,6 +2121,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol function unpad(last) { var padded = last[15]; + if (padded < 1 || padded > 16) { + throw new Error('unable to decrypt data'); + } var i = -1; while (++i < padded) { if (last[i + (16 - padded)] !== padded) { @@ -2154,7 +2164,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.createDecipher = createDecipher; exports.createDecipheriv = createDecipheriv; - }, { "./aes": 18, "./authCipher": 19, "./modes": 31, "./streamCipher": 34, "cipher-base": 48, "evp_bytestokey": 84, "inherits": 101, "safe-buffer": 147 }], 22: [function (require, module, exports) { + }, { "./aes": 18, "./authCipher": 19, "./modes": 31, "./streamCipher": 34, "cipher-base": 49, "evp_bytestokey": 84, "inherits": 102, "safe-buffer": 149 }], 22: [function (require, module, exports) { var MODES = require('./modes'); var AuthCipher = require('./authCipher'); var Buffer = require('safe-buffer').Buffer; @@ -2269,7 +2279,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.createCipheriv = createCipheriv; exports.createCipher = createCipher; - }, { "./aes": 18, "./authCipher": 19, "./modes": 31, "./streamCipher": 34, "cipher-base": 48, "evp_bytestokey": 84, "inherits": 101, "safe-buffer": 147 }], 23: [function (require, module, exports) { + }, { "./aes": 18, "./authCipher": 19, "./modes": 31, "./streamCipher": 34, "cipher-base": 49, "evp_bytestokey": 84, "inherits": 102, "safe-buffer": 149 }], 23: [function (require, module, exports) { var Buffer = require('safe-buffer').Buffer; var ZEROES = Buffer.alloc(16, 0); @@ -2354,7 +2364,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = GHASH; - }, { "safe-buffer": 147 }], 24: [function (require, module, exports) { + }, { "safe-buffer": 149 }], 24: [function (require, module, exports) { function incr32(iv) { var len = iv.length; var item; @@ -2422,7 +2432,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; }; - }, { "buffer-xor": 46, "safe-buffer": 147 }], 27: [function (require, module, exports) { + }, { "buffer-xor": 46, "safe-buffer": 149 }], 27: [function (require, module, exports) { var Buffer = require('safe-buffer').Buffer; function encryptByte(self, byteParam, decrypt) { @@ -2465,7 +2475,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; }; - }, { "safe-buffer": 147 }], 28: [function (require, module, exports) { + }, { "safe-buffer": 149 }], 28: [function (require, module, exports) { var Buffer = require('safe-buffer').Buffer; function encryptByte(self, byteParam, decrypt) { @@ -2488,7 +2498,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; }; - }, { "safe-buffer": 147 }], 29: [function (require, module, exports) { + }, { "safe-buffer": 149 }], 29: [function (require, module, exports) { var xor = require('buffer-xor'); var Buffer = require('safe-buffer').Buffer; var incr32 = require('../incr32'); @@ -2516,7 +2526,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol self._cache = self._cache.slice(chunk.length); return xor(chunk, pad); }; - }, { "../incr32": 24, "buffer-xor": 46, "safe-buffer": 147 }], 30: [function (require, module, exports) { + }, { "../incr32": 24, "buffer-xor": 46, "safe-buffer": 149 }], 30: [function (require, module, exports) { exports.encrypt = function (self, block) { return self._cipher.encryptBlock(block); }; @@ -2782,15 +2792,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = StreamCipher; - }, { "./aes": 18, "cipher-base": 48, "inherits": 101, "safe-buffer": 147 }], 35: [function (require, module, exports) { - var ebtk = require('evp_bytestokey'); - var aes = require('browserify-aes/browser'); + }, { "./aes": 18, "cipher-base": 49, "inherits": 102, "safe-buffer": 149 }], 35: [function (require, module, exports) { var DES = require('browserify-des'); - var desModes = require('browserify-des/modes'); + var aes = require('browserify-aes/browser'); var aesModes = require('browserify-aes/modes'); + var desModes = require('browserify-des/modes'); + var ebtk = require('evp_bytestokey'); + function createCipher(suite, password) { - var keyLen, ivLen; suite = suite.toLowerCase(); + + var keyLen, ivLen; if (aesModes[suite]) { keyLen = aesModes[suite].key; ivLen = aesModes[suite].iv; @@ -2800,12 +2812,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } else { throw new TypeError('invalid suite type'); } + var keys = ebtk(password, false, keyLen, ivLen); return createCipheriv(suite, keys.key, keys.iv); } + function createDecipher(suite, password) { - var keyLen, ivLen; suite = suite.toLowerCase(); + + var keyLen, ivLen; if (aesModes[suite]) { keyLen = aesModes[suite].key; ivLen = aesModes[suite].iv; @@ -2815,46 +2830,35 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } else { throw new TypeError('invalid suite type'); } + var keys = ebtk(password, false, keyLen, ivLen); return createDecipheriv(suite, keys.key, keys.iv); } function createCipheriv(suite, key, iv) { suite = suite.toLowerCase(); - if (aesModes[suite]) { - return aes.createCipheriv(suite, key, iv); - } else if (desModes[suite]) { - return new DES({ - key: key, - iv: iv, - mode: suite - }); - } else { - throw new TypeError('invalid suite type'); - } + if (aesModes[suite]) return aes.createCipheriv(suite, key, iv); + if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite }); + + throw new TypeError('invalid suite type'); } + function createDecipheriv(suite, key, iv) { suite = suite.toLowerCase(); - if (aesModes[suite]) { - return aes.createDecipheriv(suite, key, iv); - } else if (desModes[suite]) { - return new DES({ - key: key, - iv: iv, - mode: suite, - decrypt: true - }); - } else { - throw new TypeError('invalid suite type'); - } + if (aesModes[suite]) return aes.createDecipheriv(suite, key, iv); + if (desModes[suite]) return new DES({ key: key, iv: iv, mode: suite, decrypt: true }); + + throw new TypeError('invalid suite type'); + } + + function getCiphers() { + return Object.keys(desModes).concat(aes.getCiphers()); } + exports.createCipher = exports.Cipher = createCipher; exports.createCipheriv = exports.Cipheriv = createCipheriv; exports.createDecipher = exports.Decipher = createDecipher; exports.createDecipheriv = exports.Decipheriv = createDecipheriv; - function getCiphers() { - return Object.keys(desModes).concat(aes.getCiphers()); - } exports.listCiphers = exports.getCiphers = getCiphers; }, { "browserify-aes/browser": 20, "browserify-aes/modes": 31, "browserify-des": 36, "browserify-des/modes": 37, "evp_bytestokey": 84 }], 36: [function (require, module, exports) { (function (Buffer) { @@ -2902,7 +2906,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return new Buffer(this._des.final()); }; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "cipher-base": 48, "des.js": 57, "inherits": 101 }], 37: [function (require, module, exports) { + }, { "buffer": 47, "cipher-base": 49, "des.js": 57, "inherits": 102 }], 37: [function (require, module, exports) { exports['des-ecb'] = { key: 8, iv: 0 @@ -2969,7 +2973,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return r; } }).call(this, require("buffer").Buffer); - }, { "bn.js": "BN", "buffer": 47, "randombytes": 131 }], 39: [function (require, module, exports) { + }, { "bn.js": "BN", "buffer": 47, "randombytes": 132 }], 39: [function (require, module, exports) { module.exports = require('./browser/algorithms.json'); }, { "./browser/algorithms.json": 40 }], 40: [function (require, module, exports) { module.exports = { @@ -3227,7 +3231,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol createVerify: createVerify }; }).call(this, require("buffer").Buffer); - }, { "./algorithms.json": 40, "./sign": 43, "./verify": 44, "buffer": 47, "create-hash": 51, "inherits": 101, "stream": 156 }], 43: [function (require, module, exports) { + }, { "./algorithms.json": 40, "./sign": 43, "./verify": 44, "buffer": 47, "create-hash": 52, "inherits": 102, "stream": 158 }], 43: [function (require, module, exports) { (function (Buffer) { // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var createHmac = require('create-hmac'); @@ -3376,7 +3380,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports.getKey = getKey; module.exports.makeKey = makeKey; }).call(this, require("buffer").Buffer); - }, { "./curves.json": 41, "bn.js": "BN", "browserify-rsa": 38, "buffer": 47, "create-hmac": 54, "elliptic": 67, "parse-asn1": 113 }], 44: [function (require, module, exports) { + }, { "./curves.json": 41, "bn.js": "BN", "browserify-rsa": 38, "buffer": 47, "create-hmac": 54, "elliptic": 67, "parse-asn1": 114 }], 44: [function (require, module, exports) { (function (Buffer) { // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var BN = require('bn.js'); @@ -3458,7 +3462,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = verify; }).call(this, require("buffer").Buffer); - }, { "./curves.json": 41, "bn.js": "BN", "buffer": 47, "elliptic": 67, "parse-asn1": 113 }], 45: [function (require, module, exports) { + }, { "./curves.json": 41, "bn.js": "BN", "buffer": 47, "elliptic": 67, "parse-asn1": 114 }], 45: [function (require, module, exports) { arguments[4][17][0].apply(exports, arguments); }, { "dup": 17 }], 46: [function (require, module, exports) { (function (Buffer) { @@ -3527,6 +3531,24 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } + Object.defineProperty(Buffer.prototype, 'parent', { + get: function get() { + if (!(this instanceof Buffer)) { + return undefined; + } + return this.buffer; + } + }); + + Object.defineProperty(Buffer.prototype, 'offset', { + get: function get() { + if (!(this instanceof Buffer)) { + return undefined; + } + return this.byteOffset; + } + }); + function createBuffer(length) { if (length > K_MAX_LENGTH) { throw new RangeError('Invalid typed array length'); @@ -3575,7 +3597,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol throw new TypeError('"value" argument must not be a number'); } - if (isArrayBuffer(value)) { + if (isArrayBuffer(value) || value && isArrayBuffer(value.buffer)) { return fromArrayBuffer(value, encodingOrOffset, length); } @@ -3605,7 +3627,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol function assertSize(size) { if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number'); + throw new TypeError('"size" argument must be of type number'); } else if (size < 0) { throw new RangeError('"size" argument must not be negative'); } @@ -3657,7 +3679,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding'); + throw new TypeError('Unknown encoding: ' + encoding); } var length = byteLength(string, encoding) | 0; @@ -3686,11 +3708,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol function fromArrayBuffer(array, byteOffset, length) { if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds'); + throw new RangeError('"offset" is outside of buffer bounds'); } if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds'); + throw new RangeError('"length" is outside of buffer bounds'); } var buf; @@ -3721,7 +3743,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } if (obj) { - if (isArrayBufferView(obj) || 'length' in obj) { + if (ArrayBuffer.isView(obj) || 'length' in obj) { if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { return createBuffer(0); } @@ -3733,7 +3755,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.'); + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object.'); } function checked(length) { @@ -3820,6 +3842,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var pos = 0; for (i = 0; i < list.length; ++i) { var buf = list[i]; + if (ArrayBuffer.isView(buf)) { + buf = Buffer.from(buf); + } if (!Buffer.isBuffer(buf)) { throw new TypeError('"list" argument must be an Array of Buffers'); } @@ -3833,7 +3858,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (Buffer.isBuffer(string)) { return string.length; } - if (isArrayBufferView(string) || isArrayBuffer(string)) { + if (ArrayBuffer.isView(string) || isArrayBuffer(string)) { return string.byteLength; } if (typeof string !== 'string') { @@ -4001,6 +4026,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return slowToString.apply(this, arguments); }; + Buffer.prototype.toLocaleString = Buffer.prototype.toString; + Buffer.prototype.equals = function equals(b) { if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); if (this === b) return true; @@ -4218,9 +4245,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } - // must be an even number of digits var strLen = string.length; - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string'); if (length > strLen / 2) { length = strLen / 2; @@ -4893,6 +4918,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy(target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer'); if (!start) start = 0; if (!end && end !== 0) end = this.length; if (targetStart >= target.length) targetStart = target.length; @@ -4907,7 +4933,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (targetStart < 0) { throw new RangeError('targetStart out of bounds'); } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds'); + if (start < 0 || start >= this.length) throw new RangeError('Index out of range'); if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob? @@ -4917,20 +4943,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } var len = end - start; - var i; - if (this === target && start < targetStart && targetStart < end) { + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end); + } else if (this === target && start < targetStart && targetStart < end) { // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start]; - } - } else if (len < 1000) { - // ascending copy from start - for (i = 0; i < len; ++i) { + for (var i = len - 1; i >= 0; --i) { target[i + targetStart] = this[i + start]; } } else { - Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart); + Uint8Array.prototype.set.call(target, this.subarray(start, end), targetStart); } return len; @@ -4951,18 +4974,19 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol encoding = end; end = this.length; } - if (val.length === 1) { - var code = val.charCodeAt(0); - if (code < 256) { - val = code; - } - } if (encoding !== undefined && typeof encoding !== 'string') { throw new TypeError('encoding must be a string'); } if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { throw new TypeError('Unknown encoding: ' + encoding); } + if (val.length === 1) { + var code = val.charCodeAt(0); + if (encoding === 'utf8' && code < 128 || encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code; + } + } } else if (typeof val === 'number') { val = val & 255; } @@ -4989,6 +5013,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } else { var bytes = Buffer.isBuffer(val) ? val : new Buffer(val, encoding); var len = bytes.length; + if (len === 0) { + throw new TypeError('The value "' + val + '" is invalid for argument "value"'); + } for (i = 0; i < end - start; ++i) { this[i + start] = bytes[i % len]; } @@ -5003,6 +5030,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; function base64clean(str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0]; // Node strips out invalid characters like \n and \t from the string, base64-js does not str = str.trim().replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to '' @@ -5130,15 +5159,75 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return obj instanceof ArrayBuffer || obj != null && obj.constructor != null && obj.constructor.name === 'ArrayBuffer' && typeof obj.byteLength === 'number'; } - // Node 0.10 supports `ArrayBuffer` but lacks `ArrayBuffer.isView` - function isArrayBufferView(obj) { - return typeof ArrayBuffer.isView === 'function' && ArrayBuffer.isView(obj); - } - function numberIsNaN(obj) { return obj !== obj; // eslint-disable-line no-self-compare } - }, { "base64-js": 15, "ieee754": 99 }], 48: [function (require, module, exports) { + }, { "base64-js": 15, "ieee754": 100 }], 48: [function (require, module, exports) { + module.exports = { + "100": "Continue", + "101": "Switching Protocols", + "102": "Processing", + "200": "OK", + "201": "Created", + "202": "Accepted", + "203": "Non-Authoritative Information", + "204": "No Content", + "205": "Reset Content", + "206": "Partial Content", + "207": "Multi-Status", + "208": "Already Reported", + "226": "IM Used", + "300": "Multiple Choices", + "301": "Moved Permanently", + "302": "Found", + "303": "See Other", + "304": "Not Modified", + "305": "Use Proxy", + "307": "Temporary Redirect", + "308": "Permanent Redirect", + "400": "Bad Request", + "401": "Unauthorized", + "402": "Payment Required", + "403": "Forbidden", + "404": "Not Found", + "405": "Method Not Allowed", + "406": "Not Acceptable", + "407": "Proxy Authentication Required", + "408": "Request Timeout", + "409": "Conflict", + "410": "Gone", + "411": "Length Required", + "412": "Precondition Failed", + "413": "Payload Too Large", + "414": "URI Too Long", + "415": "Unsupported Media Type", + "416": "Range Not Satisfiable", + "417": "Expectation Failed", + "418": "I'm a teapot", + "421": "Misdirected Request", + "422": "Unprocessable Entity", + "423": "Locked", + "424": "Failed Dependency", + "425": "Unordered Collection", + "426": "Upgrade Required", + "428": "Precondition Required", + "429": "Too Many Requests", + "431": "Request Header Fields Too Large", + "451": "Unavailable For Legal Reasons", + "500": "Internal Server Error", + "501": "Not Implemented", + "502": "Bad Gateway", + "503": "Service Unavailable", + "504": "Gateway Timeout", + "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" + }; + }, {}], 49: [function (require, module, exports) { var Buffer = require('safe-buffer').Buffer; var Transform = require('stream').Transform; var StringDecoder = require('string_decoder').StringDecoder; @@ -5238,7 +5327,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = CipherBase; - }, { "inherits": 101, "safe-buffer": 147, "stream": 156, "string_decoder": 157 }], 49: [function (require, module, exports) { + }, { "inherits": 102, "safe-buffer": 149, "stream": 158, "string_decoder": 163 }], 50: [function (require, module, exports) { (function (Buffer) { // Copyright Joyent, Inc. and other Node contributors. // @@ -5344,7 +5433,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return Object.prototype.toString.call(o); } }).call(this, { "isBuffer": require("../../is-buffer/index.js") }); - }, { "../../is-buffer/index.js": 102 }], 50: [function (require, module, exports) { + }, { "../../is-buffer/index.js": 103 }], 51: [function (require, module, exports) { (function (Buffer) { var elliptic = require('elliptic'); var BN = require('bn.js'); @@ -5397,7 +5486,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol name: curve }; } - this.curve = new elliptic.ec(this.curveType.name); + this.curve = new elliptic.ec(this.curveType.name); // eslint-disable-line new-cap this.keys = void 0; } @@ -5446,8 +5535,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (!Buffer.isBuffer(priv)) { priv = new Buffer(priv, enc); } + var _priv = new BN(priv); _priv = _priv.toString(16); + this.keys = this.curve.genKeyPair(); this.keys._importPrivate(_priv); return this; }; @@ -5469,249 +5560,45 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } }).call(this, require("buffer").Buffer); - }, { "bn.js": "BN", "buffer": 47, "elliptic": 67 }], 51: [function (require, module, exports) { - (function (Buffer) { - 'use strict'; - - var inherits = require('inherits'); - var md5 = require('./md5'); - var RIPEMD160 = require('ripemd160'); - var sha = require('sha.js'); - - var Base = require('cipher-base'); - - function HashNoConstructor(hash) { - Base.call(this, 'digest'); - - this._hash = hash; - this.buffers = []; - } - - inherits(HashNoConstructor, Base); - - HashNoConstructor.prototype._update = function (data) { - this.buffers.push(data); - }; - - HashNoConstructor.prototype._final = function () { - var buf = Buffer.concat(this.buffers); - var r = this._hash(buf); - this.buffers = null; - - return r; - }; - - function Hash(hash) { - Base.call(this, 'digest'); - - this._hash = hash; - } - - inherits(Hash, Base); - - Hash.prototype._update = function (data) { - this._hash.update(data); - }; - - Hash.prototype._final = function () { - return this._hash.digest(); - }; - - module.exports = function createHash(alg) { - alg = alg.toLowerCase(); - if (alg === 'md5') return new HashNoConstructor(md5); - if (alg === 'rmd160' || alg === 'ripemd160') return new Hash(new RIPEMD160()); - - return new Hash(sha(alg)); - }; - }).call(this, require("buffer").Buffer); - }, { "./md5": 53, "buffer": 47, "cipher-base": 48, "inherits": 101, "ripemd160": 146, "sha.js": 149 }], 52: [function (require, module, exports) { - (function (Buffer) { - 'use strict'; - - var intSize = 4; - var zeroBuffer = new Buffer(intSize); - zeroBuffer.fill(0); - - var charSize = 8; - var hashSize = 16; - - function toArray(buf) { - if (buf.length % intSize !== 0) { - var len = buf.length + (intSize - buf.length % intSize); - buf = Buffer.concat([buf, zeroBuffer], len); - } - - var arr = new Array(buf.length >>> 2); - for (var i = 0, j = 0; i < buf.length; i += intSize, j++) { - arr[j] = buf.readInt32LE(i); - } - - return arr; - } - - module.exports = function hash(buf, fn) { - var arr = fn(toArray(buf), buf.length * charSize); - buf = new Buffer(hashSize); - for (var i = 0; i < arr.length; i++) { - buf.writeInt32LE(arr[i], i << 2, true); - } - return buf; - }; - }).call(this, require("buffer").Buffer); - }, { "buffer": 47 }], 53: [function (require, module, exports) { + }, { "bn.js": "BN", "buffer": 47, "elliptic": 67 }], 52: [function (require, module, exports) { 'use strict'; - /* - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for more info. - */ - - var makeHash = require('./make-hash'); - - /* - * Calculate the MD5 of an array of little-endian words, and a bit length - */ - function core_md5(x, len) { - /* append padding */ - x[len >> 5] |= 0x80 << len % 32; - x[(len + 64 >>> 9 << 4) + 14] = len; - - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - - for (var i = 0; i < x.length; i += 16) { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - - a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); - d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); - c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); - b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); - d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); - a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); - b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); - c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); - - a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); - d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); - b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); - a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); - d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); - c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); - b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); - a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); - d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); - b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); - c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); - a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); - d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); - a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); - b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); - d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); - c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); - b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); - a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); - d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); - c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); - b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); - - a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); - d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); - a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); - b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); - c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); - d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); - b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); - - a = safe_add(a, olda); - b = safe_add(b, oldb); - c = safe_add(c, oldc); - d = safe_add(d, oldd); - } - - return [a, b, c, d]; - } + var inherits = require('inherits'); + var MD5 = require('md5.js'); + var RIPEMD160 = require('ripemd160'); + var sha = require('sha.js'); + var Base = require('cipher-base'); - /* - * These functions implement the four basic operations the algorithm uses. - */ - function md5_cmn(q, a, b, x, s, t) { - return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); - } + function Hash(hash) { + Base.call(this, 'digest'); - function md5_ff(a, b, c, d, x, s, t) { - return md5_cmn(b & c | ~b & d, a, b, x, s, t); + this._hash = hash; } - function md5_gg(a, b, c, d, x, s, t) { - return md5_cmn(b & d | c & ~d, a, b, x, s, t); - } + inherits(Hash, Base); - function md5_hh(a, b, c, d, x, s, t) { - return md5_cmn(b ^ c ^ d, a, b, x, s, t); - } + Hash.prototype._update = function (data) { + this._hash.update(data); + }; - function md5_ii(a, b, c, d, x, s, t) { - return md5_cmn(c ^ (b | ~d), a, b, x, s, t); - } + Hash.prototype._final = function () { + return this._hash.digest(); + }; - /* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - function safe_add(x, y) { - var lsw = (x & 0xFFFF) + (y & 0xFFFF); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return msw << 16 | lsw & 0xFFFF; - } + module.exports = function createHash(alg) { + alg = alg.toLowerCase(); + if (alg === 'md5') return new MD5(); + if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160(); - /* - * Bitwise rotate a 32-bit number to the left. - */ - function bit_rol(num, cnt) { - return num << cnt | num >>> 32 - cnt; - } + return new Hash(sha(alg)); + }; + }, { "cipher-base": 49, "inherits": 102, "md5.js": 105, "ripemd160": 148, "sha.js": 151 }], 53: [function (require, module, exports) { + var MD5 = require('md5.js'); - module.exports = function md5(buf) { - return makeHash(buf, core_md5); + module.exports = function (buffer) { + return new MD5().update(buffer).digest(); }; - }, { "./make-hash": 52 }], 54: [function (require, module, exports) { + }, { "md5.js": 105 }], 54: [function (require, module, exports) { 'use strict'; var inherits = require('inherits'); @@ -5775,7 +5662,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } return new Hmac(alg, key); }; - }, { "./legacy": 55, "cipher-base": 48, "create-hash/md5": 53, "inherits": 101, "ripemd160": 146, "safe-buffer": 147, "sha.js": 149 }], 55: [function (require, module, exports) { + }, { "./legacy": 55, "cipher-base": 49, "create-hash/md5": 53, "inherits": 102, "ripemd160": 148, "safe-buffer": 149, "sha.js": 151 }], 55: [function (require, module, exports) { 'use strict'; var inherits = require('inherits'); @@ -5823,7 +5710,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return this._alg(Buffer.concat([this._opad, h])); }; module.exports = Hmac; - }, { "cipher-base": 48, "inherits": 101, "safe-buffer": 147 }], 56: [function (require, module, exports) { + }, { "cipher-base": 49, "inherits": 102, "safe-buffer": 149 }], 56: [function (require, module, exports) { 'use strict'; exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require('randombytes'); @@ -5917,7 +5804,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol 'POINT_CONVERSION_UNCOMPRESSED': 4, 'POINT_CONVERSION_HYBRID': 6 }; - }, { "browserify-cipher": 35, "browserify-sign": 42, "browserify-sign/algos": 39, "create-ecdh": 50, "create-hash": 51, "create-hmac": 54, "diffie-hellman": 63, "pbkdf2": 114, "public-encrypt": 121, "randombytes": 131, "randomfill": 132 }], 57: [function (require, module, exports) { + }, { "browserify-cipher": 35, "browserify-sign": 42, "browserify-sign/algos": 39, "create-ecdh": 51, "create-hash": 52, "create-hmac": 54, "diffie-hellman": 63, "pbkdf2": 115, "public-encrypt": 122, "randombytes": 132, "randomfill": 133 }], 57: [function (require, module, exports) { 'use strict'; exports.utils = require('./des/utils'); @@ -5992,7 +5879,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } }; - }, { "inherits": 101, "minimalistic-assert": 107 }], 59: [function (require, module, exports) { + }, { "inherits": 102, "minimalistic-assert": 107 }], 59: [function (require, module, exports) { 'use strict'; var assert = require('minimalistic-assert'); @@ -6254,7 +6141,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // Reverse Initial Permutation utils.rip(l, r, out, off); }; - }, { "../des": 57, "inherits": 101, "minimalistic-assert": 107 }], 61: [function (require, module, exports) { + }, { "../des": 57, "inherits": 102, "minimalistic-assert": 107 }], 61: [function (require, module, exports) { 'use strict'; var assert = require('minimalistic-assert'); @@ -6302,7 +6189,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol EDE.prototype._pad = DES.prototype._pad; EDE.prototype._unpad = DES.prototype._unpad; - }, { "../des": 57, "inherits": 101, "minimalistic-assert": 107 }], 62: [function (require, module, exports) { + }, { "../des": 57, "inherits": 102, "minimalistic-assert": 107 }], 62: [function (require, module, exports) { 'use strict'; exports.readUInt32BE = function readUInt32BE(bytes, off) { @@ -6716,7 +6603,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } }).call(this, require("buffer").Buffer); - }, { "./generatePrime": 65, "bn.js": "BN", "buffer": 47, "miller-rabin": 106, "randombytes": 131 }], 65: [function (require, module, exports) { + }, { "./generatePrime": 65, "bn.js": "BN", "buffer": 47, "miller-rabin": 106, "randombytes": 132 }], 65: [function (require, module, exports) { var randomBytes = require('randombytes'); module.exports = findPrime; findPrime.simpleSieve = simpleSieve; @@ -6814,7 +6701,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } } - }, { "bn.js": "BN", "miller-rabin": 106, "randombytes": 131 }], 66: [function (require, module, exports) { + }, { "bn.js": "BN", "miller-rabin": 106, "randombytes": 132 }], 66: [function (require, module, exports) { module.exports = { "modp1": { "gen": "02", @@ -7581,7 +7468,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // Compatibility with BaseCurve Point.prototype.toP = Point.prototype.normalize; Point.prototype.mixedAdd = Point.prototype.add; - }, { "../../elliptic": 67, "../curve": 70, "bn.js": "BN", "inherits": 101 }], 70: [function (require, module, exports) { + }, { "../../elliptic": 67, "../curve": 70, "bn.js": "BN", "inherits": 102 }], 70: [function (require, module, exports) { 'use strict'; var curve = exports; @@ -7766,7 +7653,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return this.x.fromRed(); }; - }, { "../../elliptic": 67, "../curve": 70, "bn.js": "BN", "inherits": 101 }], 72: [function (require, module, exports) { + }, { "../../elliptic": 67, "../curve": 70, "bn.js": "BN", "inherits": 102 }], 72: [function (require, module, exports) { 'use strict'; var curve = require('../curve'); @@ -8630,7 +8517,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // XXX This code assumes that zero is always zero in red return this.z.cmpn(0) === 0; }; - }, { "../../elliptic": 67, "../curve": 70, "bn.js": "BN", "inherits": 101 }], 73: [function (require, module, exports) { + }, { "../../elliptic": 67, "../curve": 70, "bn.js": "BN", "inherits": 102 }], 73: [function (require, module, exports) { 'use strict'; var curves = exports; @@ -9623,45 +9510,27 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol utils.intFromLE = intFromLE; }, { "bn.js": "BN", "minimalistic-assert": 107, "minimalistic-crypto-utils": 108 }], 82: [function (require, module, exports) { module.exports = { - "_args": [[{ - "raw": "elliptic@^6.0.0", - "scope": null, - "escapedName": "elliptic", - "name": "elliptic", - "rawSpec": "^6.0.0", - "spec": ">=6.0.0 <7.0.0", - "type": "range" - }, "/Users/frozeman/Sites/_ethereum/web3/node_modules/browserify-sign"]], - "_from": "elliptic@>=6.0.0 <7.0.0", + "_from": "elliptic@^6.0.0", "_id": "elliptic@6.4.0", - "_inCache": true, + "_inBundle": false, + "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "_location": "/elliptic", - "_nodeVersion": "7.0.0", - "_npmOperationalInternal": { - "host": "packages-18-east.internal.npmjs.com", - "tmp": "tmp/elliptic-6.4.0.tgz_1487798866428_0.30510620190761983" - }, - "_npmUser": { - "name": "indutny", - "email": "fedor@indutny.com" - }, - "_npmVersion": "3.10.8", "_phantomChildren": {}, "_requested": { + "type": "range", + "registry": true, "raw": "elliptic@^6.0.0", - "scope": null, - "escapedName": "elliptic", "name": "elliptic", + "escapedName": "elliptic", "rawSpec": "^6.0.0", - "spec": ">=6.0.0 <7.0.0", - "type": "range" + "saveSpec": null, + "fetchSpec": "^6.0.0" }, "_requiredBy": ["/browserify-sign", "/create-ecdh", "/secp256k1"], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", - "_shrinkwrap": null, "_spec": "elliptic@^6.0.0", - "_where": "/Users/frozeman/Sites/_ethereum/web3/node_modules/browserify-sign", + "_where": "/Users/sam/Development/foundation/web3.js/node_modules/browserify-sign", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" @@ -9669,6 +9538,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol "bugs": { "url": "https://github.com/indutny/elliptic/issues" }, + "bundleDependencies": false, "dependencies": { "bn.js": "^4.4.0", "brorand": "^1.0.1", @@ -9678,6 +9548,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol "minimalistic-assert": "^1.0.0", "minimalistic-crypto-utils": "^1.0.0" }, + "deprecated": false, "description": "EC cryptography", "devDependencies": { "brfs": "^1.4.3", @@ -9695,24 +9566,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol "jshint": "^2.6.0", "mocha": "^2.1.0" }, - "directories": {}, - "dist": { - "shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", - "tarball": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz" - }, "files": ["lib"], - "gitHead": "6b0d2b76caae91471649c8e21f0b1d3ba0f96090", "homepage": "https://github.com/indutny/elliptic", "keywords": ["EC", "Elliptic", "curve", "Cryptography"], "license": "MIT", "main": "lib/elliptic.js", - "maintainers": [{ - "name": "indutny", - "email": "fedor@indutny.com" - }], "name": "elliptic", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git+ssh://git@github.com/indutny/elliptic.git" @@ -10043,95 +9902,105 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } module.exports = EVP_BytesToKey; - }, { "md5.js": 104, "safe-buffer": 147 }], 85: [function (require, module, exports) { - (function (Buffer) { - 'use strict'; + }, { "md5.js": 105, "safe-buffer": 149 }], 85: [function (require, module, exports) { + 'use strict'; - var Transform = require('stream').Transform; - var inherits = require('inherits'); + var Buffer = require('safe-buffer').Buffer; + var Transform = require('stream').Transform; + var inherits = require('inherits'); - function HashBase(blockSize) { - Transform.call(this); + function throwIfNotStringOrBuffer(val, prefix) { + if (!Buffer.isBuffer(val) && typeof val !== 'string') { + throw new TypeError(prefix + ' must be a string or a buffer'); + } + } - this._block = new Buffer(blockSize); - this._blockSize = blockSize; - this._blockOffset = 0; - this._length = [0, 0, 0, 0]; + function HashBase(blockSize) { + Transform.call(this); - this._finalized = false; - } + this._block = Buffer.allocUnsafe(blockSize); + this._blockSize = blockSize; + this._blockOffset = 0; + this._length = [0, 0, 0, 0]; - inherits(HashBase, Transform); + this._finalized = false; + } - HashBase.prototype._transform = function (chunk, encoding, callback) { - var error = null; - try { - if (encoding !== 'buffer') chunk = new Buffer(chunk, encoding); - this.update(chunk); - } catch (err) { - error = err; - } + inherits(HashBase, Transform); - callback(error); - }; + HashBase.prototype._transform = function (chunk, encoding, callback) { + var error = null; + try { + this.update(chunk, encoding); + } catch (err) { + error = err; + } - HashBase.prototype._flush = function (callback) { - var error = null; - try { - this.push(this._digest()); - } catch (err) { - error = err; - } + callback(error); + }; - callback(error); - }; + HashBase.prototype._flush = function (callback) { + var error = null; + try { + this.push(this.digest()); + } catch (err) { + error = err; + } - HashBase.prototype.update = function (data, encoding) { - if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer'); - if (this._finalized) throw new Error('Digest already called'); - if (!Buffer.isBuffer(data)) data = new Buffer(data, encoding || 'binary'); + callback(error); + }; - // consume data - var block = this._block; - var offset = 0; - while (this._blockOffset + data.length - offset >= this._blockSize) { - for (var i = this._blockOffset; i < this._blockSize;) { - block[i++] = data[offset++]; - }this._update(); - this._blockOffset = 0; - } - while (offset < data.length) { - block[this._blockOffset++] = data[offset++]; - } // update length - for (var j = 0, carry = data.length * 8; carry > 0; ++j) { - this._length[j] += carry; - carry = this._length[j] / 0x0100000000 | 0; - if (carry > 0) this._length[j] -= 0x0100000000 * carry; - } + HashBase.prototype.update = function (data, encoding) { + throwIfNotStringOrBuffer(data, 'Data'); + if (this._finalized) throw new Error('Digest already called'); + if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding); - return this; - }; + // consume data + var block = this._block; + var offset = 0; + while (this._blockOffset + data.length - offset >= this._blockSize) { + for (var i = this._blockOffset; i < this._blockSize;) { + block[i++] = data[offset++]; + }this._update(); + this._blockOffset = 0; + } + while (offset < data.length) { + block[this._blockOffset++] = data[offset++]; + } // update length + for (var j = 0, carry = data.length * 8; carry > 0; ++j) { + this._length[j] += carry; + carry = this._length[j] / 0x0100000000 | 0; + if (carry > 0) this._length[j] -= 0x0100000000 * carry; + } - HashBase.prototype._update = function (data) { - throw new Error('_update is not implemented'); - }; + return this; + }; - HashBase.prototype.digest = function (encoding) { - if (this._finalized) throw new Error('Digest already called'); - this._finalized = true; + HashBase.prototype._update = function () { + throw new Error('_update is not implemented'); + }; - var digest = this._digest(); - if (encoding !== undefined) digest = digest.toString(encoding); - return digest; - }; + HashBase.prototype.digest = function (encoding) { + if (this._finalized) throw new Error('Digest already called'); + this._finalized = true; - HashBase.prototype._digest = function () { - throw new Error('_digest is not implemented'); - }; + var digest = this._digest(); + if (encoding !== undefined) digest = digest.toString(encoding); - module.exports = HashBase; - }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "inherits": 101, "stream": 156 }], 86: [function (require, module, exports) { + // reset state + this._block.fill(0); + this._blockOffset = 0; + for (var i = 0; i < 4; ++i) { + this._length[i] = 0; + }return digest; + }; + + HashBase.prototype._digest = function () { + throw new Error('_digest is not implemented'); + }; + + module.exports = HashBase; + }, { "inherits": 102, "safe-buffer": 149, "stream": 158 }], 86: [function (require, module, exports) { var hash = exports; hash.utils = require('./hash/utils'); @@ -11086,7 +10955,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return r >>> 0; } exports.shr64_lo = shr64_lo; - }, { "inherits": 101, "minimalistic-assert": 107 }], 98: [function (require, module, exports) { + }, { "inherits": 102, "minimalistic-assert": 107 }], 98: [function (require, module, exports) { 'use strict'; var hash = require('hash.js'); @@ -11189,6 +11058,38 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return utils.encode(res, enc); }; }, { "hash.js": 86, "minimalistic-assert": 107, "minimalistic-crypto-utils": 108 }], 99: [function (require, module, exports) { + var http = require('http'); + var url = require('url'); + + var https = module.exports; + + for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key]; + } + + https.request = function (params, cb) { + params = validateParams(params); + return http.request.call(this, params, cb); + }; + + https.get = function (params, cb) { + params = validateParams(params); + return http.get.call(this, params, cb); + }; + + function validateParams(params) { + if (typeof params === 'string') { + params = url.parse(params); + } + if (!params.protocol) { + params.protocol = 'https:'; + } + if (params.protocol !== 'https:') { + throw new Error('Protocol "' + params.protocol + '" not supported. Expected "https:"'); + } + return params; + } + }, { "http": 159, "url": 166 }], 100: [function (require, module, exports) { exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m; var eLen = nBytes * 8 - mLen - 1; @@ -11273,7 +11174,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol buffer[offset + i - d] |= s * 128; }; - }, {}], 100: [function (require, module, exports) { + }, {}], 101: [function (require, module, exports) { var indexOf = [].indexOf; @@ -11284,7 +11185,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } return -1; }; - }, {}], 101: [function (require, module, exports) { + }, {}], 102: [function (require, module, exports) { if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -11308,7 +11209,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol ctor.prototype.constructor = ctor; }; } - }, {}], 102: [function (require, module, exports) { + }, {}], 103: [function (require, module, exports) { /*! * Determine if an object is a Buffer * @@ -11330,13 +11231,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol function isSlowBuffer(obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)); } - }, {}], 103: [function (require, module, exports) { + }, {}], 104: [function (require, module, exports) { var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; - }, {}], 104: [function (require, module, exports) { + }, {}], 105: [function (require, module, exports) { (function (Buffer) { 'use strict'; @@ -11485,105 +11386,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = MD5; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "hash-base": 105, "inherits": 101 }], 105: [function (require, module, exports) { - 'use strict'; - - var Buffer = require('safe-buffer').Buffer; - var Transform = require('stream').Transform; - var inherits = require('inherits'); - - function throwIfNotStringOrBuffer(val, prefix) { - if (!Buffer.isBuffer(val) && typeof val !== 'string') { - throw new TypeError(prefix + ' must be a string or a buffer'); - } - } - - function HashBase(blockSize) { - Transform.call(this); - - this._block = Buffer.allocUnsafe(blockSize); - this._blockSize = blockSize; - this._blockOffset = 0; - this._length = [0, 0, 0, 0]; - - this._finalized = false; - } - - inherits(HashBase, Transform); - - HashBase.prototype._transform = function (chunk, encoding, callback) { - var error = null; - try { - this.update(chunk, encoding); - } catch (err) { - error = err; - } - - callback(error); - }; - - HashBase.prototype._flush = function (callback) { - var error = null; - try { - this.push(this.digest()); - } catch (err) { - error = err; - } - - callback(error); - }; - - HashBase.prototype.update = function (data, encoding) { - throwIfNotStringOrBuffer(data, 'Data'); - if (this._finalized) throw new Error('Digest already called'); - if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding); - - // consume data - var block = this._block; - var offset = 0; - while (this._blockOffset + data.length - offset >= this._blockSize) { - for (var i = this._blockOffset; i < this._blockSize;) { - block[i++] = data[offset++]; - }this._update(); - this._blockOffset = 0; - } - while (offset < data.length) { - block[this._blockOffset++] = data[offset++]; - } // update length - for (var j = 0, carry = data.length * 8; carry > 0; ++j) { - this._length[j] += carry; - carry = this._length[j] / 0x0100000000 | 0; - if (carry > 0) this._length[j] -= 0x0100000000 * carry; - } - - return this; - }; - - HashBase.prototype._update = function () { - throw new Error('_update is not implemented'); - }; - - HashBase.prototype.digest = function (encoding) { - if (this._finalized) throw new Error('Digest already called'); - this._finalized = true; - - var digest = this._digest(); - if (encoding !== undefined) digest = digest.toString(encoding); - - // reset state - this._block.fill(0); - this._blockOffset = 0; - for (var i = 0; i < 4; ++i) { - this._length[i] = 0; - }return digest; - }; - - HashBase.prototype._digest = function () { - throw new Error('_digest is not implemented'); - }; - - module.exports = HashBase; - }, { "inherits": 101, "safe-buffer": 147, "stream": 156 }], 106: [function (require, module, exports) { + }, { "buffer": 47, "hash-base": 85, "inherits": 102 }], 106: [function (require, module, exports) { var bn = require('bn.js'); var brorand = require('brorand'); @@ -11747,6 +11550,69 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (enc === 'hex') return toHex(arr);else return arr; }; }, {}], 109: [function (require, module, exports) { + exports.endianness = function () { + return 'LE'; + }; + + exports.hostname = function () { + if (typeof location !== 'undefined') { + return location.hostname; + } else return ''; + }; + + exports.loadavg = function () { + return []; + }; + + exports.uptime = function () { + return 0; + }; + + exports.freemem = function () { + return Number.MAX_VALUE; + }; + + exports.totalmem = function () { + return Number.MAX_VALUE; + }; + + exports.cpus = function () { + return []; + }; + + exports.type = function () { + return 'Browser'; + }; + + exports.release = function () { + if (typeof navigator !== 'undefined') { + return navigator.appVersion; + } + return ''; + }; + + exports.networkInterfaces = exports.getNetworkInterfaces = function () { + return {}; + }; + + exports.arch = function () { + return 'javascript'; + }; + + exports.platform = function () { + return 'browser'; + }; + + exports.tmpdir = exports.tmpDir = function () { + return '/tmp'; + }; + + exports.EOL = '\n'; + + exports.homedir = function () { + return '/'; + }; + }, {}], 110: [function (require, module, exports) { module.exports = { "2.16.840.1.101.3.4.1.1": "aes-128-ecb", "2.16.840.1.101.3.4.1.2": "aes-128-cbc", "2.16.840.1.101.3.4.1.3": "aes-128-ofb", @@ -11760,7 +11626,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol "2.16.840.1.101.3.4.1.43": "aes-256-ofb", "2.16.840.1.101.3.4.1.44": "aes-256-cfb" }; - }, {}], 110: [function (require, module, exports) { + }, {}], 111: [function (require, module, exports) { // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js // Fedor, you are amazing. 'use strict'; @@ -11821,7 +11687,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.signature = asn1.define('signature', function () { this.seq().obj(this.key('r').int(), this.key('s').int()); }); - }, { "./certificate": 111, "asn1.js": 1 }], 111: [function (require, module, exports) { + }, { "./certificate": 112, "asn1.js": 1 }], 112: [function (require, module, exports) { // from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js // thanks to @Rantanen @@ -11879,12 +11745,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }); module.exports = X509Certificate; - }, { "asn1.js": 1 }], 112: [function (require, module, exports) { + }, { "asn1.js": 1 }], 113: [function (require, module, exports) { (function (Buffer) { // adapted from https://github.com/apatil/pemstrip - var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m; - var startRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m; - var fullRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m; + var findProc = /Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m; + var startRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m; + var fullRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m; var evp = require('evp_bytestokey'); var ciphers = require('browserify-aes'); module.exports = function (okey, password) { @@ -11893,11 +11759,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var decrypted; if (!match) { var match2 = key.match(fullRegex); - decrypted = new Buffer(match2[2].replace(/\r?\n/g, ''), 'base64'); + decrypted = new Buffer(match2[2].replace(/[\r\n]/g, ''), 'base64'); } else { var suite = 'aes' + match[1]; var iv = new Buffer(match[2], 'hex'); - var cipherText = new Buffer(match[3].replace(/\r?\n/g, ''), 'base64'); + var cipherText = new Buffer(match[3].replace(/[\r\n]/g, ''), 'base64'); var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key; var out = []; var cipher = ciphers.createDecipheriv(suite, cipherKey, iv); @@ -11912,7 +11778,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; }; }).call(this, require("buffer").Buffer); - }, { "browserify-aes": 20, "buffer": 47, "evp_bytestokey": 84 }], 113: [function (require, module, exports) { + }, { "browserify-aes": 20, "buffer": 47, "evp_bytestokey": 84 }], 114: [function (require, module, exports) { (function (Buffer) { var asn1 = require('./asn1'); var aesid = require('./aesid.json'); @@ -12024,12 +11890,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return Buffer.concat(out); } }).call(this, require("buffer").Buffer); - }, { "./aesid.json": 109, "./asn1": 110, "./fixProc": 112, "browserify-aes": 20, "buffer": 47, "pbkdf2": 114 }], 114: [function (require, module, exports) { - + }, { "./aesid.json": 110, "./asn1": 111, "./fixProc": 113, "browserify-aes": 20, "buffer": 47, "pbkdf2": 115 }], 115: [function (require, module, exports) { exports.pbkdf2 = require('./lib/async'); - exports.pbkdf2Sync = require('./lib/sync'); - }, { "./lib/async": 115, "./lib/sync": 118 }], 115: [function (require, module, exports) { + }, { "./lib/async": 116, "./lib/sync": 119 }], 116: [function (require, module, exports) { (function (process, global) { var checkParameters = require('./precondition'); var defaultEncoding = require('./default-encoding'); @@ -12069,6 +11933,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol checks[algo] = prom; return prom; } + function browserPbkdf2(password, salt, iterations, length, algo) { return subtle.importKey('raw', password, { name: 'PBKDF2' }, false, ['deriveBits']).then(function (key) { return subtle.deriveBits({ @@ -12083,6 +11948,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return Buffer.from(res); }); } + function resolvePromise(promise, callback) { promise.then(function (out) { process.nextTick(function () { @@ -12095,18 +11961,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }); } module.exports = function (password, salt, iterations, keylen, digest, callback) { - if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding); - if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding); - - checkParameters(iterations, keylen); if (typeof digest === 'function') { callback = digest; digest = undefined; } - if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2'); digest = digest || 'sha1'; var algo = toBrowser[digest.toLowerCase()]; + if (!algo || typeof global.Promise !== 'function') { return process.nextTick(function () { var out; @@ -12118,16 +11980,20 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol callback(null, out); }); } + + checkParameters(password, salt, iterations, keylen); + if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2'); + if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding); + if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding); + resolvePromise(checkNative(algo).then(function (resp) { - if (resp) { - return browserPbkdf2(password, salt, iterations, keylen, algo); - } else { - return sync(password, salt, iterations, keylen, digest); - } + if (resp) return browserPbkdf2(password, salt, iterations, keylen, algo); + + return sync(password, salt, iterations, keylen, digest); }), callback); }; }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "./default-encoding": 116, "./precondition": 117, "./sync": 118, "_process": 120, "safe-buffer": 147 }], 116: [function (require, module, exports) { + }, { "./default-encoding": 117, "./precondition": 118, "./sync": 119, "_process": 121, "safe-buffer": 149 }], 117: [function (require, module, exports) { (function (process) { var defaultEncoding; /* istanbul ignore next */ @@ -12140,27 +12006,39 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } module.exports = defaultEncoding; }).call(this, require('_process')); - }, { "_process": 120 }], 117: [function (require, module, exports) { - var MAX_ALLOC = Math.pow(2, 30) - 1; // default in iojs - module.exports = function (iterations, keylen) { - if (typeof iterations !== 'number') { - throw new TypeError('Iterations not a number'); - } + }, { "_process": 121 }], 118: [function (require, module, exports) { + (function (Buffer) { + var MAX_ALLOC = Math.pow(2, 30) - 1; // default in iojs - if (iterations < 0) { - throw new TypeError('Bad iterations'); + function checkBuffer(buf, name) { + if (typeof buf !== 'string' && !Buffer.isBuffer(buf)) { + throw new TypeError(name + ' must be a buffer or string'); + } } - if (typeof keylen !== 'number') { - throw new TypeError('Key length not a number'); - } + module.exports = function (password, salt, iterations, keylen) { + checkBuffer(password, 'Password'); + checkBuffer(salt, 'Salt'); - if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { - /* eslint no-self-compare: 0 */ - throw new TypeError('Bad key length'); - } - }; - }, {}], 118: [function (require, module, exports) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number'); + } + + if (iterations < 0) { + throw new TypeError('Bad iterations'); + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number'); + } + + if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { + /* eslint no-self-compare: 0 */ + throw new TypeError('Bad key length'); + } + }; + }).call(this, { "isBuffer": require("../../is-buffer/index.js") }); + }, { "../../is-buffer/index.js": 103 }], 119: [function (require, module, exports) { var md5 = require('create-hash/md5'); var rmd160 = require('ripemd160'); var sha = require('sha.js'); @@ -12226,11 +12104,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } function pbkdf2(password, salt, iterations, keylen, digest) { + checkParameters(password, salt, iterations, keylen); + if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding); if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding); - checkParameters(iterations, keylen); - digest = digest || 'sha1'; var hmac = new Hmac(digest, password, salt.length); @@ -12264,7 +12142,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } module.exports = pbkdf2; - }, { "./default-encoding": 116, "./precondition": 117, "create-hash/md5": 53, "ripemd160": 146, "safe-buffer": 147, "sha.js": 149 }], 119: [function (require, module, exports) { + }, { "./default-encoding": 117, "./precondition": 118, "create-hash/md5": 53, "ripemd160": 148, "safe-buffer": 149, "sha.js": 151 }], 120: [function (require, module, exports) { (function (process) { 'use strict'; @@ -12308,7 +12186,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } }).call(this, require('_process')); - }, { "_process": 120 }], 120: [function (require, module, exports) { + }, { "_process": 121 }], 121: [function (require, module, exports) { // shim for using process in browser var process = module.exports = {}; @@ -12494,7 +12372,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol process.umask = function () { return 0; }; - }, {}], 121: [function (require, module, exports) { + }, {}], 122: [function (require, module, exports) { exports.publicEncrypt = require('./publicEncrypt'); exports.privateDecrypt = require('./privateDecrypt'); @@ -12505,7 +12383,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.publicDecrypt = function publicDecrypt(key, buf) { return exports.privateDecrypt(key, buf, true); }; - }, { "./privateDecrypt": 123, "./publicEncrypt": 124 }], 122: [function (require, module, exports) { + }, { "./privateDecrypt": 124, "./publicEncrypt": 125 }], 123: [function (require, module, exports) { (function (Buffer) { var createHash = require('create-hash'); module.exports = function (seed, len) { @@ -12525,7 +12403,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; } }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "create-hash": 51 }], 123: [function (require, module, exports) { + }, { "buffer": 47, "create-hash": 52 }], 124: [function (require, module, exports) { (function (Buffer) { var parseKeys = require('parse-asn1'); var mgf = require('./mgf'); @@ -12636,7 +12514,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return dif; } }).call(this, require("buffer").Buffer); - }, { "./mgf": 122, "./withPublic": 125, "./xor": 126, "bn.js": "BN", "browserify-rsa": 38, "buffer": 47, "create-hash": 51, "parse-asn1": 113 }], 124: [function (require, module, exports) { + }, { "./mgf": 123, "./withPublic": 126, "./xor": 127, "bn.js": "BN", "browserify-rsa": 38, "buffer": 47, "create-hash": 52, "parse-asn1": 114 }], 125: [function (require, module, exports) { (function (Buffer) { var parseKeys = require('parse-asn1'); var randomBytes = require('randombytes'); @@ -12734,7 +12612,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; } }).call(this, require("buffer").Buffer); - }, { "./mgf": 122, "./withPublic": 125, "./xor": 126, "bn.js": "BN", "browserify-rsa": 38, "buffer": 47, "create-hash": 51, "parse-asn1": 113, "randombytes": 131 }], 125: [function (require, module, exports) { + }, { "./mgf": 123, "./withPublic": 126, "./xor": 127, "bn.js": "BN", "browserify-rsa": 38, "buffer": 47, "create-hash": 52, "parse-asn1": 114, "randombytes": 132 }], 126: [function (require, module, exports) { (function (Buffer) { var bn = require('bn.js'); function withPublic(paddedMsg, key) { @@ -12743,7 +12621,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = withPublic; }).call(this, require("buffer").Buffer); - }, { "bn.js": "BN", "buffer": 47 }], 126: [function (require, module, exports) { + }, { "bn.js": "BN", "buffer": 47 }], 127: [function (require, module, exports) { module.exports = function xor(a, b) { var len = a.length; var i = -1; @@ -12752,7 +12630,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } return a; }; - }, {}], 127: [function (require, module, exports) { + }, {}], 128: [function (require, module, exports) { (function (global) { /*! https://mths.be/punycode v1.4.1 by @mathias */ ;(function (root) { @@ -13280,7 +13158,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } })(this); }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, {}], 128: [function (require, module, exports) { + }, {}], 129: [function (require, module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -13369,253 +13247,253 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var isArray = Array.isArray || function (xs) { return Object.prototype.toString.call(xs) === '[object Array]'; }; - }, {}], 129: [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 stringifyPrimitive(v) { - switch (typeof v === "undefined" ? "undefined" : _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 === "undefined" ? "undefined" : _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; - }; }, {}], 130: [function (require, module, exports) { - 'use strict'; - - exports.decode = exports.parse = require('./decode'); - exports.encode = exports.stringify = require('./encode'); - }, { "./decode": 128, "./encode": 129 }], 131: [function (require, module, exports) { - (function (process, global) { - 'use strict'; - - function oldBrowser() { - throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11'); - } - - var Buffer = require('safe-buffer').Buffer; - var crypto = global.crypto || global.msCrypto; - - if (crypto && crypto.getRandomValues) { - module.exports = randomBytes; - } else { - module.exports = oldBrowser; - } - - function randomBytes(size, cb) { - // phantomjs needs to throw - if (size > 65536) throw new Error('requested too many random bytes'); - // in case browserify isn't using the Uint8Array version - var rawBytes = new global.Uint8Array(size); - - // This will not work in older browsers. - // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues - if (size > 0) { - // getRandomValues fails on IE if size == 0 - crypto.getRandomValues(rawBytes); - } - - // XXX: phantomjs doesn't like a buffer being passed here - var bytes = Buffer.from(rawBytes.buffer); - - if (typeof cb === 'function') { - return process.nextTick(function () { - cb(null, bytes); - }); - } - - return bytes; - } - }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "_process": 120, "safe-buffer": 147 }], 132: [function (require, module, exports) { - (function (process, global) { - 'use strict'; - - function oldBrowser() { - throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11'); - } - var safeBuffer = require('safe-buffer'); - var randombytes = require('randombytes'); - var Buffer = safeBuffer.Buffer; - var kBufferMaxLength = safeBuffer.kMaxLength; - var crypto = global.crypto || global.msCrypto; - var kMaxUint32 = Math.pow(2, 32) - 1; - function assertOffset(offset, length) { - if (typeof offset !== 'number' || offset !== offset) { - // eslint-disable-line no-self-compare - throw new TypeError('offset must be a number'); - } - - if (offset > kMaxUint32 || offset < 0) { - throw new TypeError('offset must be a uint32'); - } - - if (offset > kBufferMaxLength || offset > length) { - throw new RangeError('offset out of range'); - } - } - - function assertSize(size, offset, length) { - if (typeof size !== 'number' || size !== size) { - // eslint-disable-line no-self-compare - throw new TypeError('size must be a number'); - } - - if (size > kMaxUint32 || size < 0) { - throw new TypeError('size must be a uint32'); - } - - if (size + offset > length || size > kBufferMaxLength) { - throw new RangeError('buffer too small'); - } - } - if (crypto && crypto.getRandomValues || !process.browser) { - exports.randomFill = randomFill; - exports.randomFillSync = randomFillSync; - } else { - exports.randomFill = oldBrowser; - exports.randomFillSync = oldBrowser; - } - function randomFill(buf, offset, size, cb) { - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array'); - } - - if (typeof offset === 'function') { - cb = offset; - offset = 0; - size = buf.length; - } else if (typeof size === 'function') { - cb = size; - size = buf.length - offset; - } else if (typeof cb !== 'function') { - throw new TypeError('"cb" argument must be a function'); - } - assertOffset(offset, buf.length); - assertSize(size, offset, buf.length); - return actualFill(buf, offset, size, cb); - } - - function actualFill(buf, offset, size, cb) { - if (process.browser) { - var ourBuf = buf.buffer; - var uint = new Uint8Array(ourBuf, offset, size); - crypto.getRandomValues(uint); - if (cb) { - process.nextTick(function () { - cb(null, buf); - }); - return; - } - return buf; - } - if (cb) { - randombytes(size, function (err, bytes) { - if (err) { - return cb(err); - } - bytes.copy(buf, offset); - cb(null, buf); - }); - return; - } - var bytes = randombytes(size); - bytes.copy(buf, offset); - return buf; - } - function randomFillSync(buf, offset, size) { - if (typeof offset === 'undefined') { - offset = 0; - } - if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { - throw new TypeError('"buf" argument must be a Buffer or Uint8Array'); - } - - assertOffset(offset, buf.length); - - if (size === undefined) size = buf.length - offset; - - assertSize(size, offset, buf.length); - - return actualFill(buf, offset, size); - } - }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "_process": 120, "randombytes": 131, "safe-buffer": 147 }], 133: [function (require, module, exports) { - module.exports = require('./lib/_stream_duplex.js'); - }, { "./lib/_stream_duplex.js": 134 }], 134: [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 stringifyPrimitive(v) { + switch (typeof v === "undefined" ? "undefined" : _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 === "undefined" ? "undefined" : _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; + }; + }, {}], 131: [function (require, module, exports) { + 'use strict'; + + exports.decode = exports.parse = require('./decode'); + exports.encode = exports.stringify = require('./encode'); + }, { "./decode": 129, "./encode": 130 }], 132: [function (require, module, exports) { + (function (process, global) { + 'use strict'; + + function oldBrowser() { + throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11'); + } + + var Buffer = require('safe-buffer').Buffer; + var crypto = global.crypto || global.msCrypto; + + if (crypto && crypto.getRandomValues) { + module.exports = randomBytes; + } else { + module.exports = oldBrowser; + } + + function randomBytes(size, cb) { + // phantomjs needs to throw + if (size > 65536) throw new Error('requested too many random bytes'); + // in case browserify isn't using the Uint8Array version + var rawBytes = new global.Uint8Array(size); + + // This will not work in older browsers. + // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues + if (size > 0) { + // getRandomValues fails on IE if size == 0 + crypto.getRandomValues(rawBytes); + } + + // XXX: phantomjs doesn't like a buffer being passed here + var bytes = Buffer.from(rawBytes.buffer); + + if (typeof cb === 'function') { + return process.nextTick(function () { + cb(null, bytes); + }); + } + + return bytes; + } + }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); + }, { "_process": 121, "safe-buffer": 149 }], 133: [function (require, module, exports) { + (function (process, global) { + 'use strict'; + + function oldBrowser() { + throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11'); + } + var safeBuffer = require('safe-buffer'); + var randombytes = require('randombytes'); + var Buffer = safeBuffer.Buffer; + var kBufferMaxLength = safeBuffer.kMaxLength; + var crypto = global.crypto || global.msCrypto; + var kMaxUint32 = Math.pow(2, 32) - 1; + function assertOffset(offset, length) { + if (typeof offset !== 'number' || offset !== offset) { + // eslint-disable-line no-self-compare + throw new TypeError('offset must be a number'); + } + + if (offset > kMaxUint32 || offset < 0) { + throw new TypeError('offset must be a uint32'); + } + + if (offset > kBufferMaxLength || offset > length) { + throw new RangeError('offset out of range'); + } + } + + function assertSize(size, offset, length) { + if (typeof size !== 'number' || size !== size) { + // eslint-disable-line no-self-compare + throw new TypeError('size must be a number'); + } + + if (size > kMaxUint32 || size < 0) { + throw new TypeError('size must be a uint32'); + } + + if (size + offset > length || size > kBufferMaxLength) { + throw new RangeError('buffer too small'); + } + } + if (crypto && crypto.getRandomValues || !process.browser) { + exports.randomFill = randomFill; + exports.randomFillSync = randomFillSync; + } else { + exports.randomFill = oldBrowser; + exports.randomFillSync = oldBrowser; + } + function randomFill(buf, offset, size, cb) { + if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array'); + } + + if (typeof offset === 'function') { + cb = offset; + offset = 0; + size = buf.length; + } else if (typeof size === 'function') { + cb = size; + size = buf.length - offset; + } else if (typeof cb !== 'function') { + throw new TypeError('"cb" argument must be a function'); + } + assertOffset(offset, buf.length); + assertSize(size, offset, buf.length); + return actualFill(buf, offset, size, cb); + } + + function actualFill(buf, offset, size, cb) { + if (process.browser) { + var ourBuf = buf.buffer; + var uint = new Uint8Array(ourBuf, offset, size); + crypto.getRandomValues(uint); + if (cb) { + process.nextTick(function () { + cb(null, buf); + }); + return; + } + return buf; + } + if (cb) { + randombytes(size, function (err, bytes) { + if (err) { + return cb(err); + } + bytes.copy(buf, offset); + cb(null, buf); + }); + return; + } + var bytes = randombytes(size); + bytes.copy(buf, offset); + return buf; + } + function randomFillSync(buf, offset, size) { + if (typeof offset === 'undefined') { + offset = 0; + } + if (!Buffer.isBuffer(buf) && !(buf instanceof global.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array'); + } + + assertOffset(offset, buf.length); + + if (size === undefined) size = buf.length - offset; + + assertSize(size, offset, buf.length); + + return actualFill(buf, offset, size); + } + }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); + }, { "_process": 121, "randombytes": 132, "safe-buffer": 149 }], 134: [function (require, module, exports) { + module.exports = require('./lib/_stream_duplex.js'); + }, { "./lib/_stream_duplex.js": 135 }], 135: [function (require, module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -13646,7 +13524,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol /**/ - var processNextTick = require('process-nextick-args').nextTick; + var pna = require('process-nextick-args'); /**/ /**/ @@ -13670,10 +13548,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol 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]; + { + // avoid scope creep, the keys array can then be collected + 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) { @@ -13692,6 +13573,16 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol this.once('end', onend); } + Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } + }); + // the no-half-open enforcer function onend() { // if we allow half-open state, or if the writable side ended, @@ -13700,7 +13591,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // no more data can be written. // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); + pna.nextTick(onEndNT, this); } function onEndNT(self) { @@ -13732,15 +13623,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol this.push(null); this.end(); - processNextTick(cb, err); + pna.nextTick(cb, err); }; - - function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } - } - }, { "./_stream_readable": 136, "./_stream_writable": 138, "core-util-is": 49, "inherits": 101, "process-nextick-args": 119 }], 135: [function (require, module, exports) { + }, { "./_stream_readable": 137, "./_stream_writable": 139, "core-util-is": 50, "inherits": 102, "process-nextick-args": 120 }], 136: [function (require, module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -13788,7 +13673,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; - }, { "./_stream_transform": 137, "core-util-is": 49, "inherits": 101 }], 136: [function (require, module, exports) { + }, { "./_stream_transform": 138, "core-util-is": 50, "inherits": 102 }], 137: [function (require, module, exports) { (function (process, global) { // Copyright Joyent, Inc. and other Node contributors. // @@ -13815,7 +13700,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol /**/ - var processNextTick = require('process-nextick-args').nextTick; + var pna = require('process-nextick-args'); /**/ module.exports = Readable; @@ -14287,7 +14172,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (!state.emittedReadable) { debug('emitReadable', state.flowing); state.emittedReadable = true; - if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); } } @@ -14306,7 +14191,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol function maybeReadMore(stream, state) { if (!state.readingMore) { state.readingMore = true; - processNextTick(maybeReadMore_, stream, state); + pna.nextTick(maybeReadMore_, stream, state); } } @@ -14351,7 +14236,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); dest.on('unpipe', onunpipe); function onunpipe(readable, unpipeInfo) { @@ -14541,7 +14426,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol state.readableListening = state.needReadable = true; state.emittedReadable = false; if (!state.reading) { - processNextTick(nReadingNextTick, this); + pna.nextTick(nReadingNextTick, this); } else if (state.length) { emitReadable(this); } @@ -14572,7 +14457,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol function resume(stream, state) { if (!state.resumeScheduled) { state.resumeScheduled = true; - processNextTick(resume_, stream, state); + pna.nextTick(resume_, stream, state); } } @@ -14668,6 +14553,16 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return this; }; + Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } + }); + // exposed for testing purposes only. Readable._fromList = fromList; @@ -14780,7 +14675,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (!state.endEmitted) { state.ended = true; - processNextTick(endReadableNT, state, stream); + pna.nextTick(endReadableNT, state, stream); } } @@ -14793,12 +14688,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } - 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; @@ -14806,7 +14695,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return -1; } }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "./_stream_duplex": 134, "./internal/streams/BufferList": 139, "./internal/streams/destroy": 140, "./internal/streams/stream": 141, "_process": 120, "core-util-is": 49, "events": 83, "inherits": 101, "isarray": 103, "process-nextick-args": 119, "safe-buffer": 147, "string_decoder/": 157, "util": 17 }], 137: [function (require, module, exports) { + }, { "./_stream_duplex": 135, "./internal/streams/BufferList": 140, "./internal/streams/destroy": 141, "./internal/streams/stream": 142, "_process": 121, "core-util-is": 50, "events": 83, "inherits": 102, "isarray": 104, "process-nextick-args": 120, "safe-buffer": 149, "string_decoder/": 143, "util": 17 }], 138: [function (require, module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -15021,8 +14910,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return stream.push(null); } - }, { "./_stream_duplex": 134, "core-util-is": 49, "inherits": 101 }], 138: [function (require, module, exports) { - (function (process, global) { + }, { "./_stream_duplex": 135, "core-util-is": 50, "inherits": 102 }], 139: [function (require, module, exports) { + (function (process, global, setImmediate) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -15052,7 +14941,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol /**/ - var processNextTick = require('process-nextick-args').nextTick; + var pna = require('process-nextick-args'); /**/ module.exports = Writable; @@ -15079,7 +14968,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol /* */ /**/ - var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; + var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; /**/ /**/ @@ -15313,7 +15202,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var er = new Error('write after end'); // TODO: defer error events consistently everywhere, not just the cb stream.emit('error', er); - processNextTick(cb, er); + pna.nextTick(cb, er); } // Checks that a user-supplied chunk is valid, especially for the particular @@ -15330,7 +15219,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } if (er) { stream.emit('error', er); - processNextTick(cb, er); + pna.nextTick(cb, er); valid = false; } return valid; @@ -15393,6 +15282,16 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return chunk; } + Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } + }); + // 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. @@ -15450,10 +15349,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (sync) { // defer the callback if we are being called synchronously // to avoid piling up things on the stack - processNextTick(cb, er); + pna.nextTick(cb, er); // this can emit finish, and it will always happen // after error - processNextTick(finishMaybe, stream, state); + pna.nextTick(finishMaybe, stream, state); stream._writableState.errorEmitted = true; stream.emit('error', er); } else { @@ -15628,7 +15527,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (typeof stream._final === 'function') { state.pendingcb++; state.finalCalled = true; - processNextTick(callFinal, stream, state); + pna.nextTick(callFinal, stream, state); } else { state.prefinished = true; stream.emit('prefinish'); @@ -15652,7 +15551,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol state.ending = true; finishMaybe(stream, state); if (cb) { - if (state.finished) processNextTick(cb);else stream.once('finish', cb); + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); } state.ended = true; stream.writable = false; @@ -15700,8 +15599,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol this.end(); cb(err); }; - }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "./_stream_duplex": 134, "./internal/streams/destroy": 140, "./internal/streams/stream": 141, "_process": 120, "core-util-is": 49, "inherits": 101, "process-nextick-args": 119, "safe-buffer": 147, "util-deprecate": 160 }], 139: [function (require, module, exports) { + }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("timers").setImmediate); + }, { "./_stream_duplex": 135, "./internal/streams/destroy": 141, "./internal/streams/stream": 142, "_process": 121, "core-util-is": 50, "inherits": 102, "process-nextick-args": 120, "safe-buffer": 149, "timers": 164, "util-deprecate": 168 }], 140: [function (require, module, exports) { 'use strict'; function _classCallCheck(instance, Constructor) { @@ -15785,12 +15684,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return this.constructor.name + ' ' + obj; }; } - }, { "safe-buffer": 147, "util": 17 }], 140: [function (require, module, exports) { + }, { "safe-buffer": 149, "util": 17 }], 141: [function (require, module, exports) { 'use strict'; /**/ - var processNextTick = require('process-nextick-args').nextTick; + var pna = require('process-nextick-args'); /**/ // undocumented cb() API, needed for core, not for public API @@ -15804,7 +15703,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (cb) { cb(err); } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - processNextTick(emitErrorNT, this, err); + pna.nextTick(emitErrorNT, this, err); } return this; } @@ -15823,7 +15722,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol this._destroy(err || null, function (err) { if (!cb && err) { - processNextTick(emitErrorNT, _this, err); + pna.nextTick(emitErrorNT, _this, err); if (_this._writableState) { _this._writableState.errorEmitted = true; } @@ -15860,382 +15759,526 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol destroy: destroy, undestroy: undestroy }; - }, { "process-nextick-args": 119 }], 141: [function (require, module, exports) { + }, { "process-nextick-args": 120 }], 142: [function (require, module, exports) { module.exports = require('events').EventEmitter; - }, { "events": 83 }], 142: [function (require, module, exports) { - module.exports = require('./readable').PassThrough; - }, { "./readable": 143 }], 143: [function (require, module, exports) { - exports = module.exports = require('./lib/_stream_readable.js'); - exports.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": 134, "./lib/_stream_passthrough.js": 135, "./lib/_stream_readable.js": 136, "./lib/_stream_transform.js": 137, "./lib/_stream_writable.js": 138 }], 144: [function (require, module, exports) { - module.exports = require('./readable').Transform; - }, { "./readable": 143 }], 145: [function (require, module, exports) { - module.exports = require('./lib/_stream_writable.js'); - }, { "./lib/_stream_writable.js": 138 }], 146: [function (require, module, exports) { - (function (Buffer) { - 'use strict'; - - var inherits = require('inherits'); - var HashBase = require('hash-base'); - - function RIPEMD160() { - HashBase.call(this, 64); - - // state - this._a = 0x67452301; - this._b = 0xefcdab89; - this._c = 0x98badcfe; - this._d = 0x10325476; - this._e = 0xc3d2e1f0; - } - - inherits(RIPEMD160, HashBase); - - RIPEMD160.prototype._update = function () { - var m = new Array(16); - for (var i = 0; i < 16; ++i) { - m[i] = this._block.readInt32LE(i * 4); - }var al = this._a; - var bl = this._b; - var cl = this._c; - var dl = this._d; - var el = this._e; - - // Mj = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - // K = 0x00000000 - // Sj = 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8 - al = fn1(al, bl, cl, dl, el, m[0], 0x00000000, 11);cl = rotl(cl, 10); - el = fn1(el, al, bl, cl, dl, m[1], 0x00000000, 14);bl = rotl(bl, 10); - dl = fn1(dl, el, al, bl, cl, m[2], 0x00000000, 15);al = rotl(al, 10); - cl = fn1(cl, dl, el, al, bl, m[3], 0x00000000, 12);el = rotl(el, 10); - bl = fn1(bl, cl, dl, el, al, m[4], 0x00000000, 5);dl = rotl(dl, 10); - al = fn1(al, bl, cl, dl, el, m[5], 0x00000000, 8);cl = rotl(cl, 10); - el = fn1(el, al, bl, cl, dl, m[6], 0x00000000, 7);bl = rotl(bl, 10); - dl = fn1(dl, el, al, bl, cl, m[7], 0x00000000, 9);al = rotl(al, 10); - cl = fn1(cl, dl, el, al, bl, m[8], 0x00000000, 11);el = rotl(el, 10); - bl = fn1(bl, cl, dl, el, al, m[9], 0x00000000, 13);dl = rotl(dl, 10); - al = fn1(al, bl, cl, dl, el, m[10], 0x00000000, 14);cl = rotl(cl, 10); - el = fn1(el, al, bl, cl, dl, m[11], 0x00000000, 15);bl = rotl(bl, 10); - dl = fn1(dl, el, al, bl, cl, m[12], 0x00000000, 6);al = rotl(al, 10); - cl = fn1(cl, dl, el, al, bl, m[13], 0x00000000, 7);el = rotl(el, 10); - bl = fn1(bl, cl, dl, el, al, m[14], 0x00000000, 9);dl = rotl(dl, 10); - al = fn1(al, bl, cl, dl, el, m[15], 0x00000000, 8);cl = rotl(cl, 10); - - // Mj = 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8 - // K = 0x5a827999 - // Sj = 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12 - el = fn2(el, al, bl, cl, dl, m[7], 0x5a827999, 7);bl = rotl(bl, 10); - dl = fn2(dl, el, al, bl, cl, m[4], 0x5a827999, 6);al = rotl(al, 10); - cl = fn2(cl, dl, el, al, bl, m[13], 0x5a827999, 8);el = rotl(el, 10); - bl = fn2(bl, cl, dl, el, al, m[1], 0x5a827999, 13);dl = rotl(dl, 10); - al = fn2(al, bl, cl, dl, el, m[10], 0x5a827999, 11);cl = rotl(cl, 10); - el = fn2(el, al, bl, cl, dl, m[6], 0x5a827999, 9);bl = rotl(bl, 10); - dl = fn2(dl, el, al, bl, cl, m[15], 0x5a827999, 7);al = rotl(al, 10); - cl = fn2(cl, dl, el, al, bl, m[3], 0x5a827999, 15);el = rotl(el, 10); - bl = fn2(bl, cl, dl, el, al, m[12], 0x5a827999, 7);dl = rotl(dl, 10); - al = fn2(al, bl, cl, dl, el, m[0], 0x5a827999, 12);cl = rotl(cl, 10); - el = fn2(el, al, bl, cl, dl, m[9], 0x5a827999, 15);bl = rotl(bl, 10); - dl = fn2(dl, el, al, bl, cl, m[5], 0x5a827999, 9);al = rotl(al, 10); - cl = fn2(cl, dl, el, al, bl, m[2], 0x5a827999, 11);el = rotl(el, 10); - bl = fn2(bl, cl, dl, el, al, m[14], 0x5a827999, 7);dl = rotl(dl, 10); - al = fn2(al, bl, cl, dl, el, m[11], 0x5a827999, 13);cl = rotl(cl, 10); - el = fn2(el, al, bl, cl, dl, m[8], 0x5a827999, 12);bl = rotl(bl, 10); - - // Mj = 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12 - // K = 0x6ed9eba1 - // Sj = 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5 - dl = fn3(dl, el, al, bl, cl, m[3], 0x6ed9eba1, 11);al = rotl(al, 10); - cl = fn3(cl, dl, el, al, bl, m[10], 0x6ed9eba1, 13);el = rotl(el, 10); - bl = fn3(bl, cl, dl, el, al, m[14], 0x6ed9eba1, 6);dl = rotl(dl, 10); - al = fn3(al, bl, cl, dl, el, m[4], 0x6ed9eba1, 7);cl = rotl(cl, 10); - el = fn3(el, al, bl, cl, dl, m[9], 0x6ed9eba1, 14);bl = rotl(bl, 10); - dl = fn3(dl, el, al, bl, cl, m[15], 0x6ed9eba1, 9);al = rotl(al, 10); - cl = fn3(cl, dl, el, al, bl, m[8], 0x6ed9eba1, 13);el = rotl(el, 10); - bl = fn3(bl, cl, dl, el, al, m[1], 0x6ed9eba1, 15);dl = rotl(dl, 10); - al = fn3(al, bl, cl, dl, el, m[2], 0x6ed9eba1, 14);cl = rotl(cl, 10); - el = fn3(el, al, bl, cl, dl, m[7], 0x6ed9eba1, 8);bl = rotl(bl, 10); - dl = fn3(dl, el, al, bl, cl, m[0], 0x6ed9eba1, 13);al = rotl(al, 10); - cl = fn3(cl, dl, el, al, bl, m[6], 0x6ed9eba1, 6);el = rotl(el, 10); - bl = fn3(bl, cl, dl, el, al, m[13], 0x6ed9eba1, 5);dl = rotl(dl, 10); - al = fn3(al, bl, cl, dl, el, m[11], 0x6ed9eba1, 12);cl = rotl(cl, 10); - el = fn3(el, al, bl, cl, dl, m[5], 0x6ed9eba1, 7);bl = rotl(bl, 10); - dl = fn3(dl, el, al, bl, cl, m[12], 0x6ed9eba1, 5);al = rotl(al, 10); - - // Mj = 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2 - // K = 0x8f1bbcdc - // Sj = 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12 - cl = fn4(cl, dl, el, al, bl, m[1], 0x8f1bbcdc, 11);el = rotl(el, 10); - bl = fn4(bl, cl, dl, el, al, m[9], 0x8f1bbcdc, 12);dl = rotl(dl, 10); - al = fn4(al, bl, cl, dl, el, m[11], 0x8f1bbcdc, 14);cl = rotl(cl, 10); - el = fn4(el, al, bl, cl, dl, m[10], 0x8f1bbcdc, 15);bl = rotl(bl, 10); - dl = fn4(dl, el, al, bl, cl, m[0], 0x8f1bbcdc, 14);al = rotl(al, 10); - cl = fn4(cl, dl, el, al, bl, m[8], 0x8f1bbcdc, 15);el = rotl(el, 10); - bl = fn4(bl, cl, dl, el, al, m[12], 0x8f1bbcdc, 9);dl = rotl(dl, 10); - al = fn4(al, bl, cl, dl, el, m[4], 0x8f1bbcdc, 8);cl = rotl(cl, 10); - el = fn4(el, al, bl, cl, dl, m[13], 0x8f1bbcdc, 9);bl = rotl(bl, 10); - dl = fn4(dl, el, al, bl, cl, m[3], 0x8f1bbcdc, 14);al = rotl(al, 10); - cl = fn4(cl, dl, el, al, bl, m[7], 0x8f1bbcdc, 5);el = rotl(el, 10); - bl = fn4(bl, cl, dl, el, al, m[15], 0x8f1bbcdc, 6);dl = rotl(dl, 10); - al = fn4(al, bl, cl, dl, el, m[14], 0x8f1bbcdc, 8);cl = rotl(cl, 10); - el = fn4(el, al, bl, cl, dl, m[5], 0x8f1bbcdc, 6);bl = rotl(bl, 10); - dl = fn4(dl, el, al, bl, cl, m[6], 0x8f1bbcdc, 5);al = rotl(al, 10); - cl = fn4(cl, dl, el, al, bl, m[2], 0x8f1bbcdc, 12);el = rotl(el, 10); - - // Mj = 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 - // K = 0xa953fd4e - // Sj = 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 - bl = fn5(bl, cl, dl, el, al, m[4], 0xa953fd4e, 9);dl = rotl(dl, 10); - al = fn5(al, bl, cl, dl, el, m[0], 0xa953fd4e, 15);cl = rotl(cl, 10); - el = fn5(el, al, bl, cl, dl, m[5], 0xa953fd4e, 5);bl = rotl(bl, 10); - dl = fn5(dl, el, al, bl, cl, m[9], 0xa953fd4e, 11);al = rotl(al, 10); - cl = fn5(cl, dl, el, al, bl, m[7], 0xa953fd4e, 6);el = rotl(el, 10); - bl = fn5(bl, cl, dl, el, al, m[12], 0xa953fd4e, 8);dl = rotl(dl, 10); - al = fn5(al, bl, cl, dl, el, m[2], 0xa953fd4e, 13);cl = rotl(cl, 10); - el = fn5(el, al, bl, cl, dl, m[10], 0xa953fd4e, 12);bl = rotl(bl, 10); - dl = fn5(dl, el, al, bl, cl, m[14], 0xa953fd4e, 5);al = rotl(al, 10); - cl = fn5(cl, dl, el, al, bl, m[1], 0xa953fd4e, 12);el = rotl(el, 10); - bl = fn5(bl, cl, dl, el, al, m[3], 0xa953fd4e, 13);dl = rotl(dl, 10); - al = fn5(al, bl, cl, dl, el, m[8], 0xa953fd4e, 14);cl = rotl(cl, 10); - el = fn5(el, al, bl, cl, dl, m[11], 0xa953fd4e, 11);bl = rotl(bl, 10); - dl = fn5(dl, el, al, bl, cl, m[6], 0xa953fd4e, 8);al = rotl(al, 10); - cl = fn5(cl, dl, el, al, bl, m[15], 0xa953fd4e, 5);el = rotl(el, 10); - bl = fn5(bl, cl, dl, el, al, m[13], 0xa953fd4e, 6);dl = rotl(dl, 10); - - var ar = this._a; - var br = this._b; - var cr = this._c; - var dr = this._d; - var er = this._e; - - // M'j = 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12 - // K' = 0x50a28be6 - // S'j = 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6 - ar = fn5(ar, br, cr, dr, er, m[5], 0x50a28be6, 8);cr = rotl(cr, 10); - er = fn5(er, ar, br, cr, dr, m[14], 0x50a28be6, 9);br = rotl(br, 10); - dr = fn5(dr, er, ar, br, cr, m[7], 0x50a28be6, 9);ar = rotl(ar, 10); - cr = fn5(cr, dr, er, ar, br, m[0], 0x50a28be6, 11);er = rotl(er, 10); - br = fn5(br, cr, dr, er, ar, m[9], 0x50a28be6, 13);dr = rotl(dr, 10); - ar = fn5(ar, br, cr, dr, er, m[2], 0x50a28be6, 15);cr = rotl(cr, 10); - er = fn5(er, ar, br, cr, dr, m[11], 0x50a28be6, 15);br = rotl(br, 10); - dr = fn5(dr, er, ar, br, cr, m[4], 0x50a28be6, 5);ar = rotl(ar, 10); - cr = fn5(cr, dr, er, ar, br, m[13], 0x50a28be6, 7);er = rotl(er, 10); - br = fn5(br, cr, dr, er, ar, m[6], 0x50a28be6, 7);dr = rotl(dr, 10); - ar = fn5(ar, br, cr, dr, er, m[15], 0x50a28be6, 8);cr = rotl(cr, 10); - er = fn5(er, ar, br, cr, dr, m[8], 0x50a28be6, 11);br = rotl(br, 10); - dr = fn5(dr, er, ar, br, cr, m[1], 0x50a28be6, 14);ar = rotl(ar, 10); - cr = fn5(cr, dr, er, ar, br, m[10], 0x50a28be6, 14);er = rotl(er, 10); - br = fn5(br, cr, dr, er, ar, m[3], 0x50a28be6, 12);dr = rotl(dr, 10); - ar = fn5(ar, br, cr, dr, er, m[12], 0x50a28be6, 6);cr = rotl(cr, 10); - - // M'j = 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2 - // K' = 0x5c4dd124 - // S'j = 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11 - er = fn4(er, ar, br, cr, dr, m[6], 0x5c4dd124, 9);br = rotl(br, 10); - dr = fn4(dr, er, ar, br, cr, m[11], 0x5c4dd124, 13);ar = rotl(ar, 10); - cr = fn4(cr, dr, er, ar, br, m[3], 0x5c4dd124, 15);er = rotl(er, 10); - br = fn4(br, cr, dr, er, ar, m[7], 0x5c4dd124, 7);dr = rotl(dr, 10); - ar = fn4(ar, br, cr, dr, er, m[0], 0x5c4dd124, 12);cr = rotl(cr, 10); - er = fn4(er, ar, br, cr, dr, m[13], 0x5c4dd124, 8);br = rotl(br, 10); - dr = fn4(dr, er, ar, br, cr, m[5], 0x5c4dd124, 9);ar = rotl(ar, 10); - cr = fn4(cr, dr, er, ar, br, m[10], 0x5c4dd124, 11);er = rotl(er, 10); - br = fn4(br, cr, dr, er, ar, m[14], 0x5c4dd124, 7);dr = rotl(dr, 10); - ar = fn4(ar, br, cr, dr, er, m[15], 0x5c4dd124, 7);cr = rotl(cr, 10); - er = fn4(er, ar, br, cr, dr, m[8], 0x5c4dd124, 12);br = rotl(br, 10); - dr = fn4(dr, er, ar, br, cr, m[12], 0x5c4dd124, 7);ar = rotl(ar, 10); - cr = fn4(cr, dr, er, ar, br, m[4], 0x5c4dd124, 6);er = rotl(er, 10); - br = fn4(br, cr, dr, er, ar, m[9], 0x5c4dd124, 15);dr = rotl(dr, 10); - ar = fn4(ar, br, cr, dr, er, m[1], 0x5c4dd124, 13);cr = rotl(cr, 10); - er = fn4(er, ar, br, cr, dr, m[2], 0x5c4dd124, 11);br = rotl(br, 10); - - // M'j = 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13 - // K' = 0x6d703ef3 - // S'j = 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5 - dr = fn3(dr, er, ar, br, cr, m[15], 0x6d703ef3, 9);ar = rotl(ar, 10); - cr = fn3(cr, dr, er, ar, br, m[5], 0x6d703ef3, 7);er = rotl(er, 10); - br = fn3(br, cr, dr, er, ar, m[1], 0x6d703ef3, 15);dr = rotl(dr, 10); - ar = fn3(ar, br, cr, dr, er, m[3], 0x6d703ef3, 11);cr = rotl(cr, 10); - er = fn3(er, ar, br, cr, dr, m[7], 0x6d703ef3, 8);br = rotl(br, 10); - dr = fn3(dr, er, ar, br, cr, m[14], 0x6d703ef3, 6);ar = rotl(ar, 10); - cr = fn3(cr, dr, er, ar, br, m[6], 0x6d703ef3, 6);er = rotl(er, 10); - br = fn3(br, cr, dr, er, ar, m[9], 0x6d703ef3, 14);dr = rotl(dr, 10); - ar = fn3(ar, br, cr, dr, er, m[11], 0x6d703ef3, 12);cr = rotl(cr, 10); - er = fn3(er, ar, br, cr, dr, m[8], 0x6d703ef3, 13);br = rotl(br, 10); - dr = fn3(dr, er, ar, br, cr, m[12], 0x6d703ef3, 5);ar = rotl(ar, 10); - cr = fn3(cr, dr, er, ar, br, m[2], 0x6d703ef3, 14);er = rotl(er, 10); - br = fn3(br, cr, dr, er, ar, m[10], 0x6d703ef3, 13);dr = rotl(dr, 10); - ar = fn3(ar, br, cr, dr, er, m[0], 0x6d703ef3, 13);cr = rotl(cr, 10); - er = fn3(er, ar, br, cr, dr, m[4], 0x6d703ef3, 7);br = rotl(br, 10); - dr = fn3(dr, er, ar, br, cr, m[13], 0x6d703ef3, 5);ar = rotl(ar, 10); - - // M'j = 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14 - // K' = 0x7a6d76e9 - // S'j = 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8 - cr = fn2(cr, dr, er, ar, br, m[8], 0x7a6d76e9, 15);er = rotl(er, 10); - br = fn2(br, cr, dr, er, ar, m[6], 0x7a6d76e9, 5);dr = rotl(dr, 10); - ar = fn2(ar, br, cr, dr, er, m[4], 0x7a6d76e9, 8);cr = rotl(cr, 10); - er = fn2(er, ar, br, cr, dr, m[1], 0x7a6d76e9, 11);br = rotl(br, 10); - dr = fn2(dr, er, ar, br, cr, m[3], 0x7a6d76e9, 14);ar = rotl(ar, 10); - cr = fn2(cr, dr, er, ar, br, m[11], 0x7a6d76e9, 14);er = rotl(er, 10); - br = fn2(br, cr, dr, er, ar, m[15], 0x7a6d76e9, 6);dr = rotl(dr, 10); - ar = fn2(ar, br, cr, dr, er, m[0], 0x7a6d76e9, 14);cr = rotl(cr, 10); - er = fn2(er, ar, br, cr, dr, m[5], 0x7a6d76e9, 6);br = rotl(br, 10); - dr = fn2(dr, er, ar, br, cr, m[12], 0x7a6d76e9, 9);ar = rotl(ar, 10); - cr = fn2(cr, dr, er, ar, br, m[2], 0x7a6d76e9, 12);er = rotl(er, 10); - br = fn2(br, cr, dr, er, ar, m[13], 0x7a6d76e9, 9);dr = rotl(dr, 10); - ar = fn2(ar, br, cr, dr, er, m[9], 0x7a6d76e9, 12);cr = rotl(cr, 10); - er = fn2(er, ar, br, cr, dr, m[7], 0x7a6d76e9, 5);br = rotl(br, 10); - dr = fn2(dr, er, ar, br, cr, m[10], 0x7a6d76e9, 15);ar = rotl(ar, 10); - cr = fn2(cr, dr, er, ar, br, m[14], 0x7a6d76e9, 8);er = rotl(er, 10); - - // M'j = 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 - // K' = 0x00000000 - // S'j = 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 - br = fn1(br, cr, dr, er, ar, m[12], 0x00000000, 8);dr = rotl(dr, 10); - ar = fn1(ar, br, cr, dr, er, m[15], 0x00000000, 5);cr = rotl(cr, 10); - er = fn1(er, ar, br, cr, dr, m[10], 0x00000000, 12);br = rotl(br, 10); - dr = fn1(dr, er, ar, br, cr, m[4], 0x00000000, 9);ar = rotl(ar, 10); - cr = fn1(cr, dr, er, ar, br, m[1], 0x00000000, 12);er = rotl(er, 10); - br = fn1(br, cr, dr, er, ar, m[5], 0x00000000, 5);dr = rotl(dr, 10); - ar = fn1(ar, br, cr, dr, er, m[8], 0x00000000, 14);cr = rotl(cr, 10); - er = fn1(er, ar, br, cr, dr, m[7], 0x00000000, 6);br = rotl(br, 10); - dr = fn1(dr, er, ar, br, cr, m[6], 0x00000000, 8);ar = rotl(ar, 10); - cr = fn1(cr, dr, er, ar, br, m[2], 0x00000000, 13);er = rotl(er, 10); - br = fn1(br, cr, dr, er, ar, m[13], 0x00000000, 6);dr = rotl(dr, 10); - ar = fn1(ar, br, cr, dr, er, m[14], 0x00000000, 5);cr = rotl(cr, 10); - er = fn1(er, ar, br, cr, dr, m[0], 0x00000000, 15);br = rotl(br, 10); - dr = fn1(dr, er, ar, br, cr, m[3], 0x00000000, 13);ar = rotl(ar, 10); - cr = fn1(cr, dr, er, ar, br, m[9], 0x00000000, 11);er = rotl(er, 10); - br = fn1(br, cr, dr, er, ar, m[11], 0x00000000, 11);dr = rotl(dr, 10); - - // change state - var t = this._b + cl + dr | 0; - this._b = this._c + dl + er | 0; - this._c = this._d + el + ar | 0; - this._d = this._e + al + br | 0; - this._e = this._a + bl + cr | 0; - this._a = t; - }; + }, { "events": 83 }], 143: [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. - RIPEMD160.prototype._digest = function () { - // create padding and handle blocks - this._block[this._blockOffset++] = 0x80; - if (this._blockOffset > 56) { - this._block.fill(0, this._blockOffset, 64); - this._update(); - this._blockOffset = 0; - } + 'use strict'; - this._block.fill(0, this._blockOffset, 56); - this._block.writeUInt32LE(this._length[0], 56); - this._block.writeUInt32LE(this._length[1], 60); - this._update(); + /**/ - // produce result - var buffer = new Buffer(20); - buffer.writeInt32LE(this._a, 0); - buffer.writeInt32LE(this._b, 4); - buffer.writeInt32LE(this._c, 8); - buffer.writeInt32LE(this._d, 12); - buffer.writeInt32LE(this._e, 16); - return buffer; - }; + var Buffer = require('safe-buffer').Buffer; + /**/ - function rotl(x, n) { - return x << n | x >>> 32 - n; + var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + 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 fn1(a, b, c, d, e, m, k, s) { - return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0; + function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } } + }; - function fn2(a, b, c, d, e, m, k, s) { - return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0; - } + // Do not cache `Buffer.isEncoding` when checking encoding names as some + // modules monkey-patch it to support additional encodings + function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; + } - function fn3(a, b, c, d, e, m, k, s) { - return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0; + // StringDecoder provides an interface for efficiently splitting a series of + // buffers into a series of JS strings without breaking apart multi-byte + // characters. + exports.StringDecoder = StringDecoder; + function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); + } - function fn4(a, b, c, d, e, m, k, s) { - return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0; + StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; + }; - function fn5(a, b, c, d, e, m, k, s) { - return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0; - } + StringDecoder.prototype.end = utf8End; - module.exports = RIPEMD160; - }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "hash-base": 85, "inherits": 101 }], 147: [function (require, module, exports) { - /* eslint-disable node/no-deprecated-api */ - var buffer = require('buffer'); - var Buffer = buffer.Buffer; + // Returns only complete characters in a Buffer + StringDecoder.prototype.text = utf8Text; - // alternative to using Object.keys for old browsers - function copyProps(src, dst) { - for (var key in src) { - dst[key] = src[key]; + // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer + StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); } - } - if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer; - } else { - // Copy properties from require('buffer') - copyProps(buffer, exports); - exports.Buffer = SafeBuffer; - } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; + }; - function SafeBuffer(arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length); + // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a + // continuation byte. If an invalid byte is detected, -2 is returned. + function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; } - // Copy static methods from Buffer - copyProps(Buffer, SafeBuffer); - - SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number'); + // Checks at most 3 bytes at the end of a Buffer in order to detect an + // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) + // needed to complete the UTF-8 character (if applicable) are returned. + function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; } - return Buffer(arg, encodingOrOffset, length); - }; - - SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number'); + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; } - var buf = Buffer(size); - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding); - } else { - buf.fill(fill); + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; } - } else { - buf.fill(0); + return nb; } - return buf; - }; + return 0; + } - SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number'); + // Validates as many continuation bytes for a multi-byte UTF-8 character as + // needed or are available. If we see a non-continuation byte where we expect + // one, we "replace" the validated continuation bytes we've seen so far with + // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding + // behavior. The continuation byte check is included three times in the case + // where all of the continuation bytes for a character exist in the same buffer. + // It is also done this way as a slight performance increase instead of using a + // loop. + function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return "\uFFFD"; } - return Buffer(size); - }; - - SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number'); + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return "\uFFFD"; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return "\uFFFD"; + } + } } - return buffer.SlowBuffer(size); - }; - }, { "buffer": 47 }], 148: [function (require, module, exports) { - var Buffer = require('safe-buffer').Buffer; + } + + // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. + function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; + } + + // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a + // partial character, the character's bytes are buffered until the required + // number of bytes are available. + function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); + } + + // For UTF-8, a replacement character is added when ending on a partial + // character. + function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + "\uFFFD"; + return r; + } + + // UTF-16LE typically needs two bytes per character, but even if we have an even + // number of bytes available, we need to check if we end on a leading/high + // surrogate. In that case, we need to wait for the next two bytes in order to + // decode the last character properly. + function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); + } + + // For UTF-16LE we do not explicitly append special replacement characters if we + // end on a partial character, we simply let v8 handle that. + function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; + } + + function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); + } + + function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; + } + + // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) + function simpleWrite(buf) { + return buf.toString(this.encoding); + } + + function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; + } + }, { "safe-buffer": 149 }], 144: [function (require, module, exports) { + module.exports = require('./readable').PassThrough; + }, { "./readable": 145 }], 145: [function (require, module, exports) { + exports = module.exports = require('./lib/_stream_readable.js'); + exports.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": 135, "./lib/_stream_passthrough.js": 136, "./lib/_stream_readable.js": 137, "./lib/_stream_transform.js": 138, "./lib/_stream_writable.js": 139 }], 146: [function (require, module, exports) { + module.exports = require('./readable').Transform; + }, { "./readable": 145 }], 147: [function (require, module, exports) { + module.exports = require('./lib/_stream_writable.js'); + }, { "./lib/_stream_writable.js": 139 }], 148: [function (require, module, exports) { + 'use strict'; + + var Buffer = require('buffer').Buffer; + var inherits = require('inherits'); + var HashBase = require('hash-base'); + + var ARRAY16 = new Array(16); + + var zl = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]; + + var zr = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]; + + var sl = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]; + + var sr = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]; + + var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]; + var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]; + + function RIPEMD160() { + HashBase.call(this, 64); + + // state + this._a = 0x67452301; + this._b = 0xefcdab89; + this._c = 0x98badcfe; + this._d = 0x10325476; + this._e = 0xc3d2e1f0; + } + + inherits(RIPEMD160, HashBase); + + RIPEMD160.prototype._update = function () { + var words = ARRAY16; + for (var j = 0; j < 16; ++j) { + words[j] = this._block.readInt32LE(j * 4); + }var al = this._a | 0; + var bl = this._b | 0; + var cl = this._c | 0; + var dl = this._d | 0; + var el = this._e | 0; + + var ar = this._a | 0; + var br = this._b | 0; + var cr = this._c | 0; + var dr = this._d | 0; + var er = this._e | 0; + + // computation + for (var i = 0; i < 80; i += 1) { + var tl; + var tr; + if (i < 16) { + tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]); + tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]); + } else if (i < 32) { + tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]); + tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]); + } else if (i < 48) { + tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]); + tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]); + } else if (i < 64) { + tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]); + tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]); + } else { + // if (i<80) { + tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]); + tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]); + } + + al = el; + el = dl; + dl = rotl(cl, 10); + cl = bl; + bl = tl; + + ar = er; + er = dr; + dr = rotl(cr, 10); + cr = br; + br = tr; + } + + // update state + var t = this._b + cl + dr | 0; + this._b = this._c + dl + er | 0; + this._c = this._d + el + ar | 0; + this._d = this._e + al + br | 0; + this._e = this._a + bl + cr | 0; + this._a = t; + }; + + RIPEMD160.prototype._digest = function () { + // create padding and handle blocks + this._block[this._blockOffset++] = 0x80; + if (this._blockOffset > 56) { + this._block.fill(0, this._blockOffset, 64); + this._update(); + this._blockOffset = 0; + } + + this._block.fill(0, this._blockOffset, 56); + this._block.writeUInt32LE(this._length[0], 56); + this._block.writeUInt32LE(this._length[1], 60); + this._update(); + + // produce result + var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20); + buffer.writeInt32LE(this._a, 0); + buffer.writeInt32LE(this._b, 4); + buffer.writeInt32LE(this._c, 8); + buffer.writeInt32LE(this._d, 12); + buffer.writeInt32LE(this._e, 16); + return buffer; + }; + + function rotl(x, n) { + return x << n | x >>> 32 - n; + } + + function fn1(a, b, c, d, e, m, k, s) { + return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0; + } + + function fn2(a, b, c, d, e, m, k, s) { + return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0; + } + + function fn3(a, b, c, d, e, m, k, s) { + return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0; + } + + function fn4(a, b, c, d, e, m, k, s) { + return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0; + } + + function fn5(a, b, c, d, e, m, k, s) { + return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0; + } + + module.exports = RIPEMD160; + }, { "buffer": 47, "hash-base": 85, "inherits": 102 }], 149: [function (require, module, exports) { + /* eslint-disable node/no-deprecated-api */ + var buffer = require('buffer'); + var Buffer = buffer.Buffer; + + // alternative to using Object.keys for old browsers + function copyProps(src, dst) { + for (var key in src) { + dst[key] = src[key]; + } + } + if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer; + } else { + // Copy properties from require('buffer') + copyProps(buffer, exports); + exports.Buffer = SafeBuffer; + } + + function SafeBuffer(arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length); + } + + // Copy static methods from Buffer + copyProps(Buffer, SafeBuffer); + + SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number'); + } + return Buffer(arg, encodingOrOffset, length); + }; + + SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number'); + } + var buf = Buffer(size); + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding); + } else { + buf.fill(fill); + } + } else { + buf.fill(0); + } + return buf; + }; + + SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number'); + } + return Buffer(size); + }; + + SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number'); + } + return buffer.SlowBuffer(size); + }; + }, { "buffer": 47 }], 150: [function (require, module, exports) { + var Buffer = require('safe-buffer').Buffer; // prototype class for hash functions function Hash(blockSize, finalSize) { @@ -16316,7 +16359,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Hash; - }, { "safe-buffer": 147 }], 149: [function (require, module, exports) { + }, { "safe-buffer": 149 }], 151: [function (require, module, exports) { var exports = module.exports = function SHA(algorithm) { algorithm = algorithm.toLowerCase(); @@ -16332,7 +16375,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.sha256 = require('./sha256'); exports.sha384 = require('./sha384'); exports.sha512 = require('./sha512'); - }, { "./sha": 150, "./sha1": 151, "./sha224": 152, "./sha256": 153, "./sha384": 154, "./sha512": 155 }], 150: [function (require, module, exports) { + }, { "./sha": 152, "./sha1": 153, "./sha224": 154, "./sha256": 155, "./sha384": 156, "./sha512": 157 }], 152: [function (require, module, exports) { /* * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined * in FIPS PUB 180-1 @@ -16426,7 +16469,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Sha; - }, { "./hash": 148, "inherits": 101, "safe-buffer": 147 }], 151: [function (require, module, exports) { + }, { "./hash": 150, "inherits": 102, "safe-buffer": 149 }], 153: [function (require, module, exports) { /* * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined * in FIPS PUB 180-1 @@ -16525,7 +16568,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Sha1; - }, { "./hash": 148, "inherits": 101, "safe-buffer": 147 }], 152: [function (require, module, exports) { + }, { "./hash": 150, "inherits": 102, "safe-buffer": 149 }], 154: [function (require, module, exports) { /** * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined * in FIPS 180-2 @@ -16579,7 +16622,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Sha224; - }, { "./hash": 148, "./sha256": 153, "inherits": 101, "safe-buffer": 147 }], 153: [function (require, module, exports) { + }, { "./hash": 150, "./sha256": 155, "inherits": 102, "safe-buffer": 149 }], 155: [function (require, module, exports) { /** * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined * in FIPS 180-2 @@ -16699,7 +16742,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Sha256; - }, { "./hash": 148, "inherits": 101, "safe-buffer": 147 }], 154: [function (require, module, exports) { + }, { "./hash": 150, "inherits": 102, "safe-buffer": 149 }], 156: [function (require, module, exports) { var inherits = require('inherits'); var SHA512 = require('./sha512'); var Hash = require('./hash'); @@ -16757,7 +16800,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Sha384; - }, { "./hash": 148, "./sha512": 155, "inherits": 101, "safe-buffer": 147 }], 155: [function (require, module, exports) { + }, { "./hash": 150, "./sha512": 157, "inherits": 102, "safe-buffer": 149 }], 157: [function (require, module, exports) { var inherits = require('inherits'); var Hash = require('./hash'); var Buffer = require('safe-buffer').Buffer; @@ -16977,7 +17020,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Sha512; - }, { "./hash": 148, "inherits": 101, "safe-buffer": 147 }], 156: [function (require, module, exports) { + }, { "./hash": 150, "inherits": 102, "safe-buffer": 149 }], 158: [function (require, module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -17102,7 +17145,651 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // Allow for unix-like usage: A.pipe(B).pipe(C) return dest; }; - }, { "events": 83, "inherits": 101, "readable-stream/duplex.js": 133, "readable-stream/passthrough.js": 142, "readable-stream/readable.js": 143, "readable-stream/transform.js": 144, "readable-stream/writable.js": 145 }], 157: [function (require, module, exports) { + }, { "events": 83, "inherits": 102, "readable-stream/duplex.js": 134, "readable-stream/passthrough.js": 144, "readable-stream/readable.js": 145, "readable-stream/transform.js": 146, "readable-stream/writable.js": 147 }], 159: [function (require, module, exports) { + (function (global) { + var ClientRequest = require('./lib/request'); + var response = require('./lib/response'); + var extend = require('xtend'); + var statusCodes = require('builtin-status-codes'); + var url = require('url'); + + var http = exports; + + http.request = function (opts, cb) { + if (typeof opts === 'string') opts = url.parse(opts);else opts = extend(opts); + + // 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:' : ''; + + var protocol = opts.protocol || defaultProtocol; + 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; + }; + + http.get = function get(opts, cb) { + var req = http.request(opts, cb); + req.end(); + return req; + }; + + http.ClientRequest = ClientRequest; + http.IncomingMessage = response.IncomingMessage; + + http.Agent = function () {}; + http.Agent.defaultMaxSockets = 4; + + http.globalAgent = new http.Agent(); + + http.STATUS_CODES = statusCodes; + + 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 : {}); + }, { "./lib/request": 161, "./lib/response": 162, "builtin-status-codes": 48, "url": 166, "xtend": 170 }], 160: [function (require, module, exports) { + (function (global) { + exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableStream); + + exports.writableStream = isFunction(global.WritableStream); + + exports.abortController = isFunction(global.AbortController); + + exports.blobConstructor = false; + try { + new Blob([new ArrayBuffer(1)]); + exports.blobConstructor = true; + } catch (e) {} + + // The xhr request to example.com may violate some restrictive CSP configurations, + // so if we're running in a browser that supports `fetch`, avoid calling getXHR() + // and assume support for certain features below. + var xhr; + function getXHR() { + // Cache the xhr value + if (xhr !== undefined) return xhr; + + if (global.XMLHttpRequest) { + xhr = new global.XMLHttpRequest(); + // If XDomainRequest is available (ie only, where xhr might not work + // cross domain), use the page location. Otherwise use example.com + // Note: this doesn't actually make an http request. + try { + xhr.open('GET', global.XDomainRequest ? '/' : 'https://example.com'); + } catch (e) { + xhr = null; + } + } else { + // Service workers don't have XHR + xhr = null; + } + return xhr; + } + + function checkTypeSupport(type) { + var xhr = getXHR(); + if (!xhr) return false; + try { + xhr.responseType = type; + return xhr.responseType === type; + } catch (e) {} + return false; + } + + // 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); + + // If fetch is supported, then arraybuffer will be supported too. Skip calling + // checkTypeSupport(), since that calls getXHR(). + exports.arraybuffer = exports.fetch || 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'); + + // If fetch is supported, then overrideMimeType will be supported too. Skip calling + // getXHR(). + exports.overrideMimeType = exports.fetch || (getXHR() ? isFunction(getXHR().overrideMimeType) : false); + + 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 : {}); + }, {}], 161: [function (require, module, exports) { + (function (process, global, Buffer) { + var capability = require('./capability'); + var inherits = require('inherits'); + var response = require('./response'); + var stream = require('readable-stream'); + var toArrayBuffer = require('to-arraybuffer'); + + var IncomingMessage = response.IncomingMessage; + var rStates = response.readyStates; + + function decideMode(preferBinary, useFetch) { + if (capability.fetch && useFetch) { + 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 ClientRequest = module.exports = function (opts) { + var self = this; + stream.Writable.call(self); + + 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]); + }); + + var preferBinary; + var useFetch = true; + if (opts.mode === 'disable-fetch' || 'requestTimeout' in opts && !capability.abortController) { + // If the use of XHR should be preferred. Not typically needed. + useFetch = false; + preferBinary = true; + } else 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, useFetch); + self._fetchTimer = null; + + self.on('finish', function () { + self._onFinish(); + }); + }; + + inherits(ClientRequest, stream.Writable); + + 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; + + self._headers[lowerName] = { + name: name, + value: value + }; + }; + + ClientRequest.prototype.getHeader = function (name) { + var header = this._headers[name.toLowerCase()]; + if (header) return header.value; + return null; + }; + + ClientRequest.prototype.removeHeader = function (name) { + var self = this; + delete self._headers[name.toLowerCase()]; + }; + + ClientRequest.prototype._onFinish = function () { + var self = this; + + if (self._destroyed) return; + var opts = self._opts; + + var headersObj = self._headers; + var body = null; + if (opts.method !== 'GET' && opts.method !== 'HEAD') { + if (capability.arraybuffer) { + body = toArrayBuffer(Buffer.concat(self._body)); + } else 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(); + } + } + + // create flattened list of headers + var headersList = []; + Object.keys(headersObj).forEach(function (keyName) { + var name = headersObj[keyName].name; + var value = headersObj[keyName].value; + if (Array.isArray(value)) { + value.forEach(function (v) { + headersList.push([name, v]); + }); + } else { + headersList.push([name, value]); + } + }); + + if (self._mode === 'fetch') { + var signal = null; + var fetchTimer = null; + if (capability.abortController) { + var controller = new AbortController(); + signal = controller.signal; + self._fetchAbortController = controller; + + if ('requestTimeout' in opts && opts.requestTimeout !== 0) { + self._fetchTimer = global.setTimeout(function () { + self.emit('requestTimeout'); + if (self._fetchAbortController) self._fetchAbortController.abort(); + }, opts.requestTimeout); + } + } + + global.fetch(self._opts.url, { + method: self._opts.method, + headers: headersList, + body: body || undefined, + mode: 'cors', + credentials: opts.withCredentials ? 'include' : 'same-origin', + signal: signal + }).then(function (response) { + self._fetchResponse = response; + self._connect(); + }, function (reason) { + global.clearTimeout(self._fetchTimer); + if (!self._destroyed) 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 ('withCredentials' in xhr) xhr.withCredentials = !!opts.withCredentials; + + if (self._mode === 'text' && 'overrideMimeType' in xhr) xhr.overrideMimeType('text/plain; charset=x-user-defined'); + + if ('requestTimeout' in opts) { + xhr.timeout = opts.requestTimeout; + xhr.ontimeout = function () { + self.emit('requestTimeout'); + }; + } + + headersList.forEach(function (header) { + xhr.setRequestHeader(header[0], header[1]); + }); + + 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(); + }; + } + + xhr.onerror = function () { + if (self._destroyed) return; + self.emit('error', new Error('XHR error')); + }; + + try { + xhr.send(body); + } catch (err) { + process.nextTick(function () { + self.emit('error', err); + }); + return; + } + } + }; + + /** + * 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 + */ + 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; + + if (!self._response) self._connect(); + + self._response._onXHRProgress(); + }; + + ClientRequest.prototype._connect = function () { + var self = this; + + if (self._destroyed) return; + + self._response = new IncomingMessage(self._xhr, self._fetchResponse, self._mode, self._fetchTimer); + self._response.on('error', function (err) { + self.emit('error', err); + }); + + self.emit('response', self._response); + }; + + ClientRequest.prototype._write = function (chunk, encoding, cb) { + var self = this; + + self._body.push(chunk); + cb(); + }; + + ClientRequest.prototype.abort = ClientRequest.prototype.destroy = function () { + var self = this; + self._destroyed = true; + global.clearTimeout(self._fetchTimer); + if (self._response) self._response._destroyed = true; + if (self._xhr) self._xhr.abort();else if (self._fetchAbortController) self._fetchAbortController.abort(); + }; + + 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', 'via']; + }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("buffer").Buffer); + }, { "./capability": 160, "./response": 162, "_process": 121, "buffer": 47, "inherits": 102, "readable-stream": 145, "to-arraybuffer": 165 }], 162: [function (require, module, exports) { + (function (process, global, Buffer) { + var capability = require('./capability'); + var inherits = require('inherits'); + var stream = require('readable-stream'); + + var rStates = exports.readyStates = { + UNSENT: 0, + OPENED: 1, + HEADERS_RECEIVED: 2, + LOADING: 3, + DONE: 4 + }; + + var IncomingMessage = exports.IncomingMessage = function (xhr, response, mode, fetchTimer) { + var self = this; + stream.Readable.call(self); + + 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'); + }); + }); + + if (mode === 'fetch') { + var read = function read() { + reader.read().then(function (result) { + if (self._destroyed) return; + if (result.done) { + global.clearTimeout(fetchTimer); + self.push(null); + return; + } + self.push(new Buffer(result.value)); + read(); + }).catch(function (err) { + global.clearTimeout(fetchTimer); + if (!self._destroyed) self.emit('error', err); + }); + }; + + self._fetchResponse = response; + + self.url = response.url; + self.statusCode = response.status; + self.statusMessage = response.statusText; + + response.headers.forEach(function (header, key) { + self.headers[key.toLowerCase()] = header; + self.rawHeaders.push(key, header); + }); + + if (capability.writableStream) { + var writable = new WritableStream({ + write: function write(chunk) { + return new Promise(function (resolve, reject) { + if (self._destroyed) { + reject(); + } else if (self.push(new Buffer(chunk))) { + resolve(); + } else { + self._resumeFetch = resolve; + } + }); + }, + close: function close() { + global.clearTimeout(fetchTimer); + if (!self._destroyed) self.push(null); + }, + abort: function abort(err) { + if (!self._destroyed) self.emit('error', err); + } + }); + + try { + response.body.pipeTo(writable).catch(function (err) { + global.clearTimeout(fetchTimer); + if (!self._destroyed) self.emit('error', err); + }); + return; + } catch (e) {} // pipeTo method isn't defined. Can't find a better way to feature test this + } + // fallback for when writableStream or pipeTo aren't available + var reader = response.body.getReader(); + + read(); + } else { + self._xhr = xhr; + self._pos = 0; + + self.url = xhr.responseURL; + 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 + } + } + }; + + inherits(IncomingMessage, stream.Readable); + + IncomingMessage.prototype._read = function () { + var self = this; + + var resolve = self._resumeFetch; + if (resolve) { + self._resumeFetch = null; + resolve(); + } + }; + + 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 || !xhr.response) 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); + } + }; + }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("buffer").Buffer); + }, { "./capability": 160, "_process": 121, "buffer": 47, "inherits": 102, "readable-stream": 145 }], 163: [function (require, module, exports) { 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -17375,7 +18062,114 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } - }, { "safe-buffer": 147 }], 158: [function (require, module, exports) { + }, { "safe-buffer": 149 }], 164: [function (require, module, exports) { + (function (setImmediate, clearImmediate) { + var nextTick = require('process/browser.js').nextTick; + var apply = Function.prototype.apply; + var slice = Array.prototype.slice; + var immediateIds = {}; + var nextImmediateId = 0; + + // DOM APIs, for completeness + + exports.setTimeout = function () { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); + }; + exports.setInterval = function () { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); + }; + exports.clearTimeout = exports.clearInterval = function (timeout) { + timeout.close(); + }; + + function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; + } + Timeout.prototype.unref = Timeout.prototype.ref = function () {}; + Timeout.prototype.close = function () { + this._clearFn.call(window, this._id); + }; + + // Does not start the time, just sets up the members needed. + exports.enroll = function (item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; + }; + + exports.unenroll = function (item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; + }; + + exports._unrefActive = exports.active = function (item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) item._onTimeout(); + }, msecs); + } + }; + + // That's not how node.js implements it but the exposed api is the same. + exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function (fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; + }; + + exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function (id) { + delete immediateIds[id]; + }; + }).call(this, require("timers").setImmediate, require("timers").clearImmediate); + }, { "process/browser.js": 121, "timers": 164 }], 165: [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); + } + } + + 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'); + } + }; + }, { "buffer": 47 }], 166: [function (require, module, exports) { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -18083,7 +18877,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } if (host) this.hostname = host; }; - }, { "./util": 159, "punycode": 127, "querystring": 130 }], 159: [function (require, module, exports) { + }, { "./util": 167, "punycode": 128, "querystring": 131 }], 167: [function (require, module, exports) { 'use strict'; module.exports = { @@ -18100,7 +18894,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return arg == null; } }; - }, {}], 160: [function (require, module, exports) { + }, {}], 168: [function (require, module, exports) { (function (global) { /** @@ -18170,7 +18964,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return String(val).toLowerCase() === 'true'; } }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, {}], 161: [function (require, module, exports) { + }, {}], 169: [function (require, module, exports) { var indexOf = require('indexof'); var Object_keys = function Object_keys(obj) { @@ -18305,103 +19099,27 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } return copy; }; - }, { "indexof": 100 }], 162: [function (require, module, exports) { - 'use strict'; - - var token = '%[a-f0-9]{2}'; - var singleMatcher = new RegExp(token, 'gi'); - var multiMatcher = new RegExp('(' + token + ')+', 'gi'); - - function decodeComponents(components, split) { - try { - // Try to decode the entire string first - return decodeURIComponent(components.join('')); - } catch (err) { - // Do nothing - } - - if (components.length === 1) { - return components; - } - - split = split || 1; - - // Split the array in 2 parts - var left = components.slice(0, split); - var right = components.slice(split); - - return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); - } - - function decode(input) { - try { - return decodeURIComponent(input); - } catch (err) { - var tokens = input.match(singleMatcher); - - for (var i = 1; i < tokens.length; i++) { - input = decodeComponents(tokens, i).join(''); - - tokens = input.match(singleMatcher); - } + }, { "indexof": 101 }], 170: [function (require, module, exports) { + module.exports = extend; - return input; - } - } + var hasOwnProperty = Object.prototype.hasOwnProperty; - function customDecodeURIComponent(input) { - // Keep track of all the replacements and prefill the map with the `BOM` - var replaceMap = { - '%FE%FF': "\uFFFD\uFFFD", - '%FF%FE': "\uFFFD\uFFFD" - }; + function extend() { + var target = {}; - var match = multiMatcher.exec(input); - while (match) { - try { - // Decode as big chunks as possible - replaceMap[match[0]] = decodeURIComponent(match[0]); - } catch (err) { - var result = decode(match[0]); + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i]; - if (result !== match[0]) { - replaceMap[match[0]] = result; + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key]; } } - - match = multiMatcher.exec(input); - } - - // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else - replaceMap['%C2'] = "\uFFFD"; - - var entries = Object.keys(replaceMap); - - for (var i = 0; i < entries.length; i++) { - // Replace all decoded components - var key = entries[i]; - input = input.replace(new RegExp(key, 'g'), replaceMap[key]); } - return input; + return target; } - - module.exports = function (encodedURI) { - if (typeof encodedURI !== 'string') { - throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + (typeof encodedURI === "undefined" ? "undefined" : _typeof(encodedURI)) + '`'); - } - - try { - encodedURI = encodedURI.replace(/\+/g, ' '); - - // Try the built in decoder first - return decodeURIComponent(encodedURI); - } catch (err) { - // Fallback to a more advanced decoder - return customDecodeURIComponent(encodedURI); - } - }; - }, {}], 163: [function (require, module, exports) { + }, {}], 171: [function (require, module, exports) { var generate = function generate(num, fn) { var a = []; for (var i = 0; i < num; ++i) { @@ -18442,7 +19160,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol flatten: flatten, chunksOf: chunksOf }; - }, {}], 164: [function (require, module, exports) { + }, {}], 172: [function (require, module, exports) { var A = require("./array.js"); var at = function at(bytes, index) { @@ -18631,7 +19349,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol fromUint8Array: fromUint8Array, toUint8Array: toUint8Array }; - }, { "./array.js": 163 }], 165: [function (require, module, exports) { + }, { "./array.js": 171 }], 173: [function (require, module, exports) { // This was ported from https://github.com/emn178/js-sha3, with some minor // modifications and pruning. It is licensed under MIT: // @@ -18971,7 +19689,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol keccak256s: keccak(256), keccak512s: keccak(512) }; - }, {}], 166: [function (require, module, exports) { + }, {}], 174: [function (require, module, exports) { var isFunction = require('is-function'); module.exports = forEach; @@ -19013,7 +19731,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } } - }, { "is-function": 168 }], 167: [function (require, module, exports) { + }, { "is-function": 176 }], 175: [function (require, module, exports) { (function (global) { var win; @@ -19029,7 +19747,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = win; }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, {}], 168: [function (require, module, exports) { + }, {}], 176: [function (require, module, exports) { module.exports = isFunction; var toString = Object.prototype.toString; @@ -19040,98 +19758,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol // IE8 and below fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt); }; - }, {}], 169: [function (require, module, exports) { - /* - object-assign - (c) Sindre Sorhus - @license MIT - */ - - 'use strict'; - /* eslint-disable no-unused-vars */ - - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } - } - - module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - }; - }, {}], 170: [function (require, module, exports) { + }, {}], 177: [function (require, module, exports) { var trim = require('trim'), forEach = require('for-each'), isArray = function isArray(arg) { @@ -19159,214 +19786,67 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return result; }; - }, { "for-each": 166, "trim": 177 }], 171: [function (require, module, exports) { + }, { "for-each": 174, "trim": 184 }], 178: [function (require, module, exports) { 'use strict'; var strictUriEncode = require('strict-uri-encode'); - var objectAssign = require('object-assign'); - var decodeComponent = require('decode-uri-component'); - - function encoderForArrayFormat(opts) { - switch (opts.arrayFormat) { - case 'index': - return function (key, value, index) { - return value === null ? [encode(key, opts), '[', index, ']'].join('') : [encode(key, opts), '[', encode(index, opts), ']=', encode(value, opts)].join(''); - }; - - case 'bracket': - return function (key, value) { - return value === null ? encode(key, opts) : [encode(key, opts), '[]=', encode(value, opts)].join(''); - }; - - default: - return function (key, value) { - return value === null ? encode(key, opts) : [encode(key, opts), '=', encode(value, opts)].join(''); - }; - } - } - - function parserForArrayFormat(opts) { - var result; - - switch (opts.arrayFormat) { - case 'index': - return function (key, value, accumulator) { - result = /\[(\d*)\]$/.exec(key); - - key = key.replace(/\[\d*\]$/, ''); - - if (!result) { - accumulator[key] = value; - return; - } - - if (accumulator[key] === undefined) { - accumulator[key] = {}; - } - - accumulator[key][result[1]] = value; - }; - - case 'bracket': - return function (key, value, accumulator) { - result = /(\[\])$/.exec(key); - key = key.replace(/\[\]$/, ''); - if (!result) { - accumulator[key] = value; - return; - } else if (accumulator[key] === undefined) { - accumulator[key] = [value]; - return; - } - - accumulator[key] = [].concat(accumulator[key], value); - }; - - default: - return function (key, value, accumulator) { - if (accumulator[key] === undefined) { - accumulator[key] = value; - return; - } - - accumulator[key] = [].concat(accumulator[key], value); - }; - } - } - - function encode(value, opts) { - if (opts.encode) { - return opts.strict ? strictUriEncode(value) : encodeURIComponent(value); - } - - return value; - } - - function keysSorter(input) { - if (Array.isArray(input)) { - return input.sort(); - } else if ((typeof input === "undefined" ? "undefined" : _typeof(input)) === 'object') { - return keysSorter(Object.keys(input)).sort(function (a, b) { - return Number(a) - Number(b); - }).map(function (key) { - return input[key]; - }); - } - - return input; - } - - function extract(str) { - var queryStart = str.indexOf('?'); - if (queryStart === -1) { - return ''; - } - return str.slice(queryStart + 1); - } - - function parse(str, opts) { - opts = objectAssign({ arrayFormat: 'none' }, opts); - - var formatter = parserForArrayFormat(opts); - - // Create an object with no prototype - // https://github.com/sindresorhus/query-string/issues/47 - var ret = Object.create(null); + exports.extract = function (str) { + return str.split('?')[1] || ''; + }; + exports.parse = function (str) { if (typeof str !== 'string') { - return ret; + return {}; } - str = str.trim().replace(/^[?#&]/, ''); + str = str.trim().replace(/^(\?|#|&)/, ''); if (!str) { - return ret; + return {}; } - str.split('&').forEach(function (param) { + return str.split('&').reduce(function (ret, param) { var parts = param.replace(/\+/g, ' ').split('='); // Firefox (pre 40) decodes `%3D` to `=` // https://github.com/sindresorhus/query-string/pull/37 var key = parts.shift(); var val = parts.length > 0 ? parts.join('=') : undefined; + key = decodeURIComponent(key); + // missing `=` should be `null`: // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters - val = val === undefined ? null : decodeComponent(val); - - formatter(decodeComponent(key), val, ret); - }); + val = val === undefined ? null : decodeURIComponent(val); - return Object.keys(ret).sort().reduce(function (result, key) { - var val = ret[key]; - if (Boolean(val) && (typeof val === "undefined" ? "undefined" : _typeof(val)) === 'object' && !Array.isArray(val)) { - // Sort object keys, not values - result[key] = keysSorter(val); + if (!ret.hasOwnProperty(key)) { + ret[key] = val; + } else if (Array.isArray(ret[key])) { + ret[key].push(val); } else { - result[key] = val; + ret[key] = [ret[key], val]; } - return result; - }, Object.create(null)); - } - - exports.extract = extract; - exports.parse = parse; - - exports.stringify = function (obj, opts) { - var defaults = { - encode: true, - strict: true, - arrayFormat: 'none' - }; - - opts = objectAssign(defaults, opts); - - if (opts.sort === false) { - opts.sort = function () {}; - } - - var formatter = encoderForArrayFormat(opts); + return ret; + }, {}); + }; - return obj ? Object.keys(obj).sort(opts.sort).map(function (key) { + exports.stringify = function (obj) { + return obj ? Object.keys(obj).sort().map(function (key) { var val = obj[key]; - if (val === undefined) { - return ''; - } - - if (val === null) { - return encode(key, opts); - } - if (Array.isArray(val)) { - var result = []; - - val.slice().forEach(function (val2) { - if (val2 === undefined) { - return; - } - - result.push(formatter(key, val2, result.length)); - }); - - return result.join('&'); + return val.sort().map(function (val2) { + return strictUriEncode(key) + '=' + strictUriEncode(val2); + }).join('&'); } - return encode(key, opts) + '=' + encode(val, opts); + return strictUriEncode(key) + '=' + strictUriEncode(val); }).filter(function (x) { return x.length > 0; }).join('&') : ''; }; - - exports.parseUrl = function (str, opts) { - return { - url: str.split('?')[0] || '', - query: parse(extract(str), opts) - }; - }; - }, { "decode-uri-component": 162, "object-assign": 169, "strict-uri-encode": 172 }], 172: [function (require, module, exports) { + }, { "strict-uri-encode": 179 }], 179: [function (require, module, exports) { 'use strict'; module.exports = function (str) { @@ -19374,7 +19854,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return '%' + c.charCodeAt(0).toString(16).toUpperCase(); }); }; - }, {}], 173: [function (require, module, exports) { + }, {}], 180: [function (require, module, exports) { var unavailable = function unavailable() { throw "This swarm.js function isn't available on the browser."; }; @@ -19407,7 +19887,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol hash: hash, pick: pick }); - }, { "./pick.js": 174, "./swarm": 176, "./swarm-hash.js": 175, "eth-lib/lib/bytes": 164, "xhr-request-promise": 180 }], 174: [function (require, module, exports) { + }, { "./pick.js": 181, "./swarm": 183, "./swarm-hash.js": 182, "eth-lib/lib/bytes": 172, "xhr-request-promise": 187 }], 181: [function (require, module, exports) { var picker = function picker(type) { return function () { return new Promise(function (resolve, reject) { @@ -19465,7 +19945,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol file: picker("file"), directory: picker("directory") }; - }, {}], 175: [function (require, module, exports) { + }, {}], 182: [function (require, module, exports) { // Thanks https://github.com/axic/swarmhash var keccak = require("eth-lib/lib/hash").keccak256; @@ -19506,7 +19986,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = swarmHash; - }, { "eth-lib/lib/bytes": 164, "eth-lib/lib/hash": 165 }], 176: [function (require, module, exports) { + }, { "eth-lib/lib/bytes": 172, "eth-lib/lib/hash": 173 }], 183: [function (require, module, exports) { // TODO: this is a temporary fix to hide those libraries from the browser. A // slightly better long-term solution would be to split this file into two, // separating the functions that are used on Node.js from the functions that @@ -20129,7 +20609,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol toString: toString }; }; - }, {}], 177: [function (require, module, exports) { + }, {}], 184: [function (require, module, exports) { exports = module.exports = trim; @@ -20144,7 +20624,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.right = function (str) { return str.replace(/\s*$/, ''); }; - }, {}], 178: [function (require, module, exports) { + }, {}], 185: [function (require, module, exports) { // Underscore.js 1.8.3 // http://underscorejs.org // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors @@ -21713,7 +22193,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }); } }).call(this); - }, {}], 179: [function (require, module, exports) { + }, {}], 186: [function (require, module, exports) { module.exports = urlSetQuery; function urlSetQuery(url, query) { if (query) { @@ -21738,7 +22218,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } return url; } - }, {}], 180: [function (require, module, exports) { + }, {}], 187: [function (require, module, exports) { var request = require('xhr-request'); module.exports = function (url, options) { @@ -21748,7 +22228,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }); }); }; - }, { "xhr-request": 181 }], 181: [function (require, module, exports) { + }, { "xhr-request": 188 }], 188: [function (require, module, exports) { var queryString = require('query-string'); var setQuery = require('url-set-query'); var assign = require('object-assign'); @@ -21808,7 +22288,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return request(opt, cb); } - }, { "./lib/ensure-header.js": 182, "./lib/request.js": 184, "object-assign": 169, "query-string": 171, "url-set-query": 179 }], 182: [function (require, module, exports) { + }, { "./lib/ensure-header.js": 189, "./lib/request.js": 191, "object-assign": 192, "query-string": 178, "url-set-query": 186 }], 189: [function (require, module, exports) { module.exports = ensureHeader; function ensureHeader(headers, key, value) { var lower = key.toLowerCase(); @@ -21816,7 +22296,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol headers[key] = value; } } - }, {}], 183: [function (require, module, exports) { + }, {}], 190: [function (require, module, exports) { module.exports = getResponse; function getResponse(opt, resp) { if (!resp) return null; @@ -21829,10 +22309,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol rawRequest: resp.rawRequest ? resp.rawRequest : resp }; } - }, {}], 184: [function (require, module, exports) { + }, {}], 191: [function (require, module, exports) { var xhr = require('xhr'); var normalize = require('./normalize-response'); - var noop = function noop() {}; module.exports = xhrRequest; function xhrRequest(opt, cb) { @@ -21845,7 +22324,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol useJson = true; } - var req = xhr(opt, function xhrRequestResult(err, resp, body) { + return xhr(opt, function xhrRequestResult(err, resp, body) { if (useJson && !err) { try { var text = resp.rawRequest.responseText; @@ -21857,21 +22336,50 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol resp = normalize(opt, resp); if (err) cb(err, null, resp);else cb(err, body, resp); - cb = noop; }); + } + }, { "./normalize-response": 190, "xhr": 193 }], 192: [function (require, module, exports) { + 'use strict'; - // Patch abort() so that it also calls the callback, but with an error - var onabort = req.onabort; - req.onabort = function () { - var ret = onabort.apply(req, Array.prototype.slice.call(arguments)); - cb(new Error('XHR Aborted')); - cb = noop; - return ret; - }; + var propIsEnumerable = Object.prototype.propertyIsEnumerable; + + function ToObject(val) { + if (val == null) { + throw new TypeError('Object.assign cannot be called with null or undefined'); + } + + return Object(val); + } + + function ownEnumerableKeys(obj) { + var keys = Object.getOwnPropertyNames(obj); + + if (Object.getOwnPropertySymbols) { + keys = keys.concat(Object.getOwnPropertySymbols(obj)); + } - return req; + return keys.filter(function (key) { + return propIsEnumerable.call(obj, key); + }); } - }, { "./normalize-response": 183, "xhr": 185 }], 185: [function (require, module, exports) { + + module.exports = Object.assign || function (target, source) { + var from; + var keys; + var to = ToObject(target); + + for (var s = 1; s < arguments.length; s++) { + from = arguments[s]; + keys = ownEnumerableKeys(Object(from)); + + for (var i = 0; i < keys.length; i++) { + to[keys[i]] = from[keys[i]]; + } + } + + return to; + }; + }, {}], 193: [function (require, module, exports) { "use strict"; var window = require("global/window"); @@ -22115,27 +22623,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } function noop() {} - }, { "global/window": 167, "is-function": 168, "parse-headers": 170, "xtend": 186 }], 186: [function (require, module, exports) { - module.exports = extend; - - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function extend() { - var target = {}; - - for (var i = 0; i < arguments.length; i++) { - var source = arguments[i]; - - for (var key in source) { - if (hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - - return target; - } - }, {}], 187: [function (require, module, exports) { + }, { "global/window": 175, "is-function": 176, "parse-headers": 177, "xtend": 194 }], 194: [function (require, module, exports) { + arguments[4][170][0].apply(exports, arguments); + }, { "dup": 170 }], 195: [function (require, module, exports) { /* This file is part of web3.js. @@ -22221,9 +22711,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Bzz; - }, { "swarm-js": 173, "underscore": 178 }], 188: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 189: [function (require, module, exports) { + }, { "swarm-js": 180, "underscore": 185 }], 196: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 197: [function (require, module, exports) { /* This file is part of web3.js. @@ -22271,7 +22761,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return new Error('CONNECTION TIMEOUT: timeout of ' + ms + ' ms achived'); } }; - }, {}], 190: [function (require, module, exports) { + }, {}], 198: [function (require, module, exports) { /* This file is part of web3.js. @@ -22685,7 +23175,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol outputPostFormatter: outputPostFormatter, outputSyncingFormatter: outputSyncingFormatter }; - }, { "underscore": 188, "web3-eth-iban": 368, "web3-utils": 393 }], 191: [function (require, module, exports) { + }, { "underscore": 196, "web3-eth-iban": 391, "web3-utils": 421 }], 199: [function (require, module, exports) { /* This file is part of web3.js. @@ -22717,9 +23207,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol errors: errors, formatters: formatters }; - }, { "./errors": 189, "./formatters": 190 }], 192: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 193: [function (require, module, exports) { + }, { "./errors": 197, "./formatters": 198 }], 200: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 201: [function (require, module, exports) { /* This file is part of web3.js. @@ -23293,9 +23783,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Method; - }, { "underscore": 192, "web3-core-helpers": 191, "web3-core-promievent": 198, "web3-core-subscriptions": 206, "web3-utils": 393 }], 194: [function (require, module, exports) { + }, { "underscore": 200, "web3-core-helpers": 199, "web3-core-promievent": 206, "web3-core-subscriptions": 214, "web3-utils": 421 }], 202: [function (require, module, exports) { module.exports = require('./register')().Promise; - }, { "./register": 196 }], 195: [function (require, module, exports) { + }, { "./register": 204 }], 203: [function (require, module, exports) { "use strict"; // global key for user preferred registration @@ -23372,7 +23862,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return registered; }; }; - }, {}], 196: [function (require, module, exports) { + }, {}], 204: [function (require, module, exports) { "use strict"; module.exports = require('./loader')(window, loadImplementation); @@ -23391,7 +23881,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol implementation: 'window.Promise' }; } - }, { "./loader": 195 }], 197: [function (require, module, exports) { + }, { "./loader": 203 }], 205: [function (require, module, exports) { 'use strict'; // @@ -23647,7 +24137,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if ('undefined' !== typeof module) { module.exports = EventEmitter; } - }, {}], 198: [function (require, module, exports) { + }, {}], 206: [function (require, module, exports) { /* This file is part of web3.js. @@ -23724,9 +24214,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = PromiEvent; - }, { "any-promise": 194, "eventemitter3": 197 }], 199: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 200: [function (require, module, exports) { + }, { "any-promise": 202, "eventemitter3": 205 }], 207: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 208: [function (require, module, exports) { /* This file is part of web3.js. @@ -23798,7 +24288,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Batch; - }, { "./jsonrpc": 203, "web3-core-helpers": 191 }], 201: [function (require, module, exports) { + }, { "./jsonrpc": 211, "web3-core-helpers": 199 }], 209: [function (require, module, exports) { /* This file is part of web3.js. @@ -23880,7 +24370,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol /* jshint ignore:end */ module.exports = givenProvider; - }, {}], 202: [function (require, module, exports) { + }, {}], 210: [function (require, module, exports) { /* This file is part of web3.js. @@ -24110,7 +24600,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol Manager: RequestManager, BatchManager: BatchManager }; - }, { "./batch.js": 200, "./givenProvider.js": 201, "./jsonrpc.js": 203, "underscore": 199, "web3-core-helpers": 191, "web3-providers-http": 375, "web3-providers-ipc": 378, "web3-providers-ws": 380 }], 203: [function (require, module, exports) { + }, { "./batch.js": 208, "./givenProvider.js": 209, "./jsonrpc.js": 211, "underscore": 207, "web3-core-helpers": 199, "web3-providers-http": 404, "web3-providers-ipc": 407, "web3-providers-ws": 409 }], 211: [function (require, module, exports) { /* This file is part of web3.js. @@ -24196,11 +24686,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Jsonrpc; - }, {}], 204: [function (require, module, exports) { - arguments[4][197][0].apply(exports, arguments); - }, { "dup": 197 }], 205: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 206: [function (require, module, exports) { + }, {}], 212: [function (require, module, exports) { + arguments[4][205][0].apply(exports, arguments); + }, { "dup": 205 }], 213: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 214: [function (require, module, exports) { /* This file is part of web3.js. @@ -24272,7 +24762,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol subscriptions: Subscriptions, subscription: Subscription }; - }, { "./subscription.js": 207 }], 207: [function (require, module, exports) { + }, { "./subscription.js": 215 }], 215: [function (require, module, exports) { /* This file is part of web3.js. @@ -24580,7 +25070,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = Subscription; - }, { "eventemitter3": 204, "underscore": 205, "web3-core-helpers": 191 }], 208: [function (require, module, exports) { + }, { "eventemitter3": 212, "underscore": 213, "web3-core-helpers": 199 }], 216: [function (require, module, exports) { /* This file is part of web3.js. @@ -24645,7 +25135,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = extend; - }, { "web3-core-helpers": 191, "web3-core-method": 193, "web3-utils": 393 }], 209: [function (require, module, exports) { + }, { "web3-core-helpers": 199, "web3-core-method": 201, "web3-utils": 421 }], 217: [function (require, module, exports) { /* This file is part of web3.js. @@ -24729,7 +25219,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol pkg.providers = requestManager.Manager.providers; } }; - }, { "./extend.js": 208, "web3-core-requestmanager": 202 }], 210: [function (require, module, exports) { + }, { "./extend.js": 216, "web3-core-requestmanager": 210 }], 218: [function (require, module, exports) { (function (module, exports) { 'use strict'; @@ -24783,7 +25273,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var Buffer; try { - Buffer = require('buf' + 'fer').Buffer; + Buffer = require('buffer').Buffer; } catch (e) {} BN.isBN = function isBN(num) { @@ -27951,7 +28441,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; Red.prototype.pow = function pow(a, num) { - if (num.isZero()) return new BN(1); + if (num.isZero()) return new BN(1).toRed(this); if (num.cmpn(1) === 0) return a.clone(); var windowSize = 4; @@ -28089,2305 +28579,2998 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return res._forceRed(this); }; })(typeof module === 'undefined' || module, this); - }, {}], 211: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 212: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** - * @file formatters.js - * @author Marek Kotewicz - * @author Fabian Vogelsteller - * @date 2017 - */ + }, { "buffer": 17 }], 219: [function (require, module, exports) { + arguments[4][173][0].apply(exports, arguments); + }, { "dup": 173 }], 220: [function (require, module, exports) { + 'use strict'; - var _ = require('underscore'); - var utils = require('web3-utils'); - var BN = require('bn.js'); - var SolidityParam = require('./param'); + // See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI - /** - * Formats input value to byte representation of int - * If value is negative, return it's two's complement - * If the value is floating point, round it down - * - * @method formatInputInt - * @param {String|Number|BN} value that needs to be formatted - * @returns {SolidityParam} - */ - var formatInputInt = function formatInputInt(value) { - if (_.isNumber(value)) { - value = Math.trunc(value); - } - return new SolidityParam(utils.toTwosComplement(value).replace('0x', '')); - }; + var utils = function () { + var convert = require('../utils/convert.js'); + var utf8 = require('../utils/utf8.js'); - /** - * Formats input bytes - * - * @method formatInputBytes - * @param {String} value - * @returns {SolidityParam} - */ - var formatInputBytes = function formatInputBytes(value) { - if (!utils.isHexStrict(value)) { - throw new Error('Given parameter is not bytes: "' + value + '"'); - } + return { + defineProperty: require('../utils/properties.js').defineProperty, - var result = value.replace(/^0x/i, ''); + arrayify: convert.arrayify, + padZeros: convert.padZeros, - if (result.length % 2 !== 0) { - throw new Error('Given parameter bytes has an invalid length: "' + value + '"'); - } + bigNumberify: require('../utils/bignumber.js').bigNumberify, - if (result.length > 64) { - throw new Error('Given parameter bytes is too long: "' + value + '"'); - } + getAddress: require('../utils/address').getAddress, - var l = Math.floor((result.length + 63) / 64); - result = utils.padRight(result, l * 64); - return new SolidityParam(result); - }; + concat: convert.concat, - /** - * Formats input bytes - * - * @method formatDynamicInputBytes - * @param {String} value - * @returns {SolidityParam} - */ - var formatInputDynamicBytes = function formatInputDynamicBytes(value) { - if (!utils.isHexStrict(value)) { - throw new Error('Given parameter is not bytes: "' + value + '"'); - } + toUtf8Bytes: utf8.toUtf8Bytes, + toUtf8String: utf8.toUtf8String, - var result = value.replace(/^0x/i, ''); + hexlify: convert.hexlify + }; + }(); - if (result.length % 2 !== 0) { - throw new Error('Given parameter bytes has an invalid length: "' + value + '"'); - } + var errors = require('./errors'); - var length = result.length / 2; - var l = Math.floor((result.length + 63) / 64); - result = utils.padRight(result, l * 64); - return new SolidityParam(formatInputInt(length).value + result); + var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); + var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); + var paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/); + + var defaultCoerceFunc = function defaultCoerceFunc(type, value) { + var match = type.match(paramTypeNumber); + if (match && parseInt(match[2]) <= 48) { + return value.toNumber(); + } + return value; }; - /** - * Formats input value to byte representation of string - * - * @method formatInputString - * @param {String} - * @returns {SolidityParam} - */ - var formatInputString = function formatInputString(value) { - if (!_.isString(value)) { - throw new Error('Given parameter is not a valid string: ' + value); + // Shallow copy object (will move to utils/properties in v4) + function shallowCopy(object) { + var result = {}; + for (var key in object) { + result[key] = object[key]; } + return result; + } - var result = utils.utf8ToHex(value).replace(/^0x/i, ''); - var length = result.length / 2; - var l = Math.floor((result.length + 63) / 64); - result = utils.padRight(result, l * 64); - return new SolidityParam(formatInputInt(length).value + result); - }; + /////////////////////////////////// + // Parsing for Solidity Signatures - /** - * Formats input value to byte representation of bool - * - * @method formatInputBool - * @param {Boolean} - * @returns {SolidityParam} - */ - var formatInputBool = function formatInputBool(value) { - var result = '000000000000000000000000000000000000000000000000000000000000000' + (value ? '1' : '0'); - return new SolidityParam(result); - }; + var regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"); + var regexIdentifier = new RegExp("^[A-Za-z_][A-Za-z0-9_]*$"); - /** - * Check if input value is negative - * - * @method signedIsNegative - * @param {String} value is hex format - * @returns {Boolean} true if it is negative, otherwise false - */ - var signedIsNegative = function signedIsNegative(value) { - return new BN(value.substr(0, 1), 16).toString(2).substr(0, 1) === '1'; - }; + var close = { "(": ")", "[": "]" }; - /** - * Formats right-aligned output bytes to int - * - * @method formatOutputInt - * @param {SolidityParam} param - * @returns {BN} right-aligned output bytes formatted to big number - */ - var formatOutputInt = function formatOutputInt(param) { - var value = param.staticPart(); + function verifyType(type) { - if (!value && !param.rawValue) { - throw new Error('Couldn\'t decode ' + name + ' from ABI: 0x' + param.rawValue); + // These need to be transformed to their full description + if (type.match(/^uint($|[^1-9])/)) { + type = 'uint256' + type.substring(4); + } else if (type.match(/^int($|[^1-9])/)) { + type = 'int256' + type.substring(3); } - // check if it's negative number - // it it is, return two's complement - if (signedIsNegative(value)) { - return new BN(value, 16).fromTwos(256).toString(10); + return type; + } + + function parseParam(param, allowIndexed) { + function throwError(i) { + throw new Error('unexpected character "' + param[i] + '" at position ' + i + ' in "' + param + '"'); } - return new BN(value, 16).toString(10); - }; - /** - * Formats right-aligned output bytes to uint - * - * @method formatOutputUInt - * @param {SolidityParam} param - * @returns {BN} right-aligned output bytes formatted to uint - */ - var formatOutputUInt = function formatOutputUInt(param, name) { - var value = param.staticPart(); + var parent = { type: '', name: '', state: { allowType: true } }; + var node = parent; - if (!value && !param.rawValue) { - throw new Error('Couldn\'t decode ' + name + ' from ABI: 0x' + param.rawValue); - } + for (var i = 0; i < param.length; i++) { + var c = param[i]; + switch (c) { + case '(': + if (!node.state.allowParams) { + throwError(i); + } + delete node.state.allowType; + node.type = verifyType(node.type); + node.components = [{ type: '', name: '', parent: node, state: { allowType: true } }]; + node = node.components[0]; + break; - return new BN(value, 16).toString(10); - }; + case ')': + delete node.state; + node.type = verifyType(node.type); - /** - * Should be used to format output bool - * - * @method formatOutputBool - * @param {SolidityParam} param - * @param {String} name type name - * @returns {Boolean} right-aligned input bytes formatted to bool - */ - var formatOutputBool = function formatOutputBool(param, name) { - var value = param.staticPart(); + var child = node; + node = node.parent; + if (!node) { + throwError(i); + } + delete child.parent; + delete node.state.allowParams; + node.state.allowName = true; + node.state.allowArray = true; + break; - if (!value && !param.rawValue) { - throw new Error('Couldn\'t decode ' + name + ' from ABI: 0x' + param.rawValue); - } + case ',': + delete node.state; + node.type = verifyType(node.type); - return value === '0000000000000000000000000000000000000000000000000000000000000001'; - }; + var sibling = { type: '', name: '', parent: node.parent, state: { allowType: true } }; + node.parent.components.push(sibling); + delete node.parent; + node = sibling; + break; - /** - * Should be used to format output bytes - * - * @method formatOutputBytes - * @param {SolidityParam} param left-aligned hex representation of string - * @param {String} name type name - * @returns {String} hex string - */ - var formatOutputBytes = function formatOutputBytes(param, name) { - var matches = name.match(/^bytes([0-9]*)/); - var size = parseInt(matches[1]); + // Hit a space... + case ' ': - if (param.staticPart().slice(0, 2 * size).length !== size * 2) { - throw new Error('Couldn\'t decode ' + name + ' from ABI: 0x' + param.rawValue + ' The size doesn\'t match.'); - } + // If reading type, the type is done and may read a param or name + if (node.state.allowType) { + if (node.type !== '') { + node.type = verifyType(node.type); + delete node.state.allowType; + node.state.allowName = true; + node.state.allowParams = true; + } + } - return '0x' + param.staticPart().slice(0, 2 * size); - }; + // If reading name, the name is done + if (node.state.allowName) { + if (node.name !== '') { + if (allowIndexed && node.name === 'indexed') { + node.indexed = true; + node.name = ''; + } else { + delete node.state.allowName; + } + } + } - /** - * Should be used to format output bytes - * - * @method formatOutputDynamicBytes - * @param {SolidityParam} param left-aligned hex representation of string - * @param {String} name type name - * @returns {String} hex string - */ - var formatOutputDynamicBytes = function formatOutputDynamicBytes(param, name) { - var hex = param.dynamicPart().slice(0, 64); + break; - if (!hex) { - throw new Error('Couldn\'t decode ' + name + ' from ABI: 0x' + param.rawValue); - } + case '[': + if (!node.state.allowArray) { + throwError(i); + } - var length = new BN(hex, 16).toNumber() * 2; - return '0x' + param.dynamicPart().substr(64, length); - }; + //if (!node.array) { node.array = ''; } + //node.array += c; + node.type += c; - /** - * Should be used to format output string - * - * @method formatOutputString - * @param {SolidityParam} left-aligned hex representation of string - * @returns {String} ascii string - */ - var formatOutputString = function formatOutputString(param) { - var hex = param.dynamicPart().slice(0, 64); + delete node.state.allowArray; + delete node.state.allowName; + node.state.readArray = true; + break; - if (!hex) { - throw new Error('ERROR: The returned value is not a convertible string:' + hex); - } + case ']': + if (!node.state.readArray) { + throwError(i); + } - var length = new BN(hex, 16).toNumber() * 2; - return length ? utils.hexToUtf8('0x' + param.dynamicPart().substr(64, length).replace(/^0x/i, '')) : ''; - }; + //node.array += c; + node.type += c; - /** - * Should be used to format output address - * - * @method formatOutputAddress - * @param {SolidityParam} param right-aligned input bytes - * @param {String} name type name - * @returns {String} address - */ - var formatOutputAddress = function formatOutputAddress(param, name) { - var value = param.staticPart(); + delete node.state.readArray; + node.state.allowArray = true; + node.state.allowName = true; + break; - if (!value) { - throw new Error('Couldn\'t decode ' + name + ' from ABI: 0x' + param.rawValue); + default: + if (node.state.allowType) { + node.type += c; + node.state.allowParams = true; + node.state.allowArray = true; + } else if (node.state.allowName) { + node.name += c; + delete node.state.allowArray; + } else if (node.state.readArray) { + //node.array += c; + node.type += c; + } else { + throwError(i); + } + } } - return utils.toChecksumAddress("0x" + value.slice(value.length - 40, value.length)); - }; + if (node.parent) { + throw new Error("unexpected eof"); + } - module.exports = { - formatInputInt: formatInputInt, - formatInputBytes: formatInputBytes, - formatInputDynamicBytes: formatInputDynamicBytes, - formatInputString: formatInputString, - formatInputBool: formatInputBool, - formatOutputInt: formatOutputInt, - formatOutputUInt: formatOutputUInt, - formatOutputBool: formatOutputBool, - formatOutputBytes: formatOutputBytes, - formatOutputDynamicBytes: formatOutputDynamicBytes, - formatOutputString: formatOutputString, - formatOutputAddress: formatOutputAddress, - toTwosComplement: utils.toTwosComplement - }; - }, { "./param": 214, "bn.js": 210, "underscore": 211, "web3-utils": 393 }], 213: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** - * @file index.js - * @author Marek Kotewicz - * @author Fabian Vogelsteller - * @date 2017 - */ + delete parent.state; + parent.type = verifyType(parent.type); - var _ = require('underscore'); - var utils = require('web3-utils'); + //verifyType(parent); - var f = require('./formatters'); + return parent; + } - var SolidityTypeAddress = require('./types/address'); - var SolidityTypeBool = require('./types/bool'); - var SolidityTypeInt = require('./types/int'); - var SolidityTypeUInt = require('./types/uint'); - var SolidityTypeDynamicBytes = require('./types/dynamicbytes'); - var SolidityTypeString = require('./types/string'); - var SolidityTypeBytes = require('./types/bytes'); + function parseSignatureEvent(fragment) { - var isDynamic = function isDynamic(solidityType, type) { - return solidityType.isDynamicType(type) || solidityType.isDynamicArray(type); - }; + var abi = { + anonymous: false, + inputs: [], + type: 'event' + }; - // result method - function Result() {} + var match = fragment.match(regexParen); + if (!match) { + throw new Error('invalid event: ' + fragment); + } - /** - * ABICoder prototype should be used to encode/decode solidity params of any type - */ - var ABICoder = function ABICoder(types) { - this._types = types; - }; + abi.name = match[1].trim(); - /** - * This method should be used to transform type to SolidityType - * - * @method _requireType - * @param {String} type - * @returns {SolidityType} - * @throws {Error} throws if no matching type is found - */ - ABICoder.prototype._requireType = function (type) { - var solidityType = this._types.filter(function (t) { - return t.isType(type); - })[0]; + splitNesting(match[2]).forEach(function (param) { + param = parseParam(param, true); + param.indexed = !!param.indexed; + abi.inputs.push(param); + }); + + match[3].split(' ').forEach(function (modifier) { + switch (modifier) { + case 'anonymous': + abi.anonymous = true; + break; + case '': + break; + default: + console.log('unknown modifier: ' + mdifier); + } + }); - if (!solidityType) { - throw Error('Invalid solidity type: ' + type); + if (abi.name && !abi.name.match(regexIdentifier)) { + throw new Error('invalid identifier: "' + result.name + '"'); } - return solidityType; - }; + return abi; + } - ABICoder.prototype._getOffsets = function (types, solidityTypes) { - var lengths = solidityTypes.map(function (solidityType, index) { - return solidityType.staticPartLength(types[index]); - }); + function parseSignatureFunction(fragment) { + var abi = { + constant: false, + inputs: [], + outputs: [], + payable: false, + type: 'function' + }; + + var comps = fragment.split(' returns '); + var left = comps[0].match(regexParen); + if (!left) { + throw new Error('invalid signature'); + } - for (var i = 1; i < lengths.length; i++) { - // sum with length of previous element - lengths[i] += lengths[i - 1]; + abi.name = left[1].trim(); + if (!abi.name.match(regexIdentifier)) { + throw new Error('invalid identifier: "' + left[1] + '"'); } - return lengths.map(function (length, index) { - // remove the current length, so the length is sum of previous elements - var staticPartLength = solidityTypes[index].staticPartLength(types[index]); - return length - staticPartLength; + splitNesting(left[2]).forEach(function (param) { + abi.inputs.push(parseParam(param)); }); - }; - ABICoder.prototype._getSolidityTypes = function (types) { - var self = this; - return types.map(function (type) { - return self._requireType(type); + left[3].split(' ').forEach(function (modifier) { + switch (modifier) { + case 'constant': + abi.constant = true; + break; + case 'payable': + abi.payable = true; + break; + case 'pure': + abi.constant = true; + abi.stateMutability = 'pure'; + break; + case 'view': + abi.constant = true; + abi.stateMutability = 'view'; + break; + case '': + break; + default: + console.log('unknown modifier: ' + modifier); + } }); - }; - ABICoder.prototype._encodeMultiWithOffset = function (types, solidityTypes, encodeds, dynamicOffset) { - var result = ""; - var self = this; + // We have outputs + if (comps.length > 1) { + var right = comps[1].match(regexParen); + if (right[1].trim() != '' || right[3].trim() != '') { + throw new Error('unexpected tokens'); + } + + splitNesting(right[2]).forEach(function (param) { + abi.outputs.push(parseParam(param)); + }); + } + + return abi; + } - types.forEach(function (type, i) { - if (isDynamic(solidityTypes[i], types[i])) { - result += f.formatInputInt(dynamicOffset).encode(); - var e = self._encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset); - dynamicOffset += e.length / 2; + function parseSignature(fragment) { + if (typeof fragment === 'string') { + // Make sure the "returns" is surrounded by a space and all whitespace is exactly one space + fragment = fragment.replace(/\(/g, ' (').replace(/\)/g, ') ').replace(/\s+/g, ' '); + fragment = fragment.trim(); + + if (fragment.substring(0, 6) === 'event ') { + return parseSignatureEvent(fragment.substring(6).trim()); } else { - // don't add length to dynamicOffset. it's already counted - result += self._encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset); + if (fragment.substring(0, 9) === 'function ') { + fragment = fragment.substring(9); + } + return parseSignatureFunction(fragment.trim()); } + } - // TODO: figure out nested arrays - }); + throw new Error('unknown fragment'); + } + + /////////////////////////////////// + // Coders + + var coderNull = function coderNull(coerceFunc) { + return { + name: 'null', + type: '', + encode: function encode(value) { + return utils.arrayify([]); + }, + decode: function decode(data, offset) { + if (offset > data.length) { + throw new Error('invalid null'); + } + return { + consumed: 0, + value: coerceFunc('null', undefined) + }; + }, + dynamic: false + }; + }; + + var coderNumber = function coderNumber(coerceFunc, size, signed, localName) { + var name = (signed ? 'int' : 'uint') + size * 8; + return { + localName: localName, + name: name, + type: name, + encode: function encode(value) { + try { + value = utils.bigNumberify(value); + } catch (error) { + errors.throwError('invalid number value', errors.INVALID_ARGUMENT, { + arg: localName, + type: typeof value === "undefined" ? "undefined" : _typeof(value), + value: value + }); + } + value = value.toTwos(size * 8).maskn(size * 8); + //value = value.toTwos(size * 8).maskn(size * 8); + if (signed) { + value = value.fromTwos(size * 8).toTwos(256); + } + return utils.padZeros(utils.arrayify(value), 32); + }, + decode: function decode(data, offset) { + if (data.length < offset + 32) { + errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: name, + value: utils.hexlify(data.slice(offset, offset + 32)) + }); + } + var junkLength = 32 - size; + var value = utils.bigNumberify(data.slice(offset + junkLength, offset + 32)); + if (signed) { + value = value.fromTwos(size * 8); + } else { + value = value.maskn(size * 8); + } - types.forEach(function (type, i) { - if (isDynamic(solidityTypes[i], types[i])) { - var e = self._encodeWithOffset(types[i], solidityTypes[i], encodeds[i], dynamicOffset); - dynamicOffset += e.length / 2; - result += e; + //if (size <= 6) { value = value.toNumber(); } + + return { + consumed: 32, + value: coerceFunc(name, value) + }; } - }); - return result; + }; }; + var uint256Coder = coderNumber(function (type, value) { + return value; + }, 32, false); - // TODO: refactor whole encoding! - ABICoder.prototype._encodeWithOffset = function (type, solidityType, encoded, offset) { - var self = this; - if (solidityType.isDynamicArray(type)) { - return function () { - // offset was already set - var nestedName = solidityType.nestedName(type); - var nestedStaticPartLength = solidityType.staticPartLength(nestedName); - var result = encoded[0]; - - (function () { - var previousLength = 2; // in int - if (solidityType.isDynamicArray(nestedName)) { - for (var i = 1; i < encoded.length; i++) { - previousLength += +encoded[i - 1][0] || 0; - result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode(); - } + var coderBoolean = function coderBoolean(coerceFunc, localName) { + return { + localName: localName, + name: 'bool', + type: 'bool', + encode: function encode(value) { + return uint256Coder.encode(!!value ? 1 : 0); + }, + decode: function decode(data, offset) { + try { + var result = uint256Coder.decode(data, offset); + } catch (error) { + if (error.reason === 'insufficient data for uint256 type') { + errors.throwError('insufficient data for boolean type', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'boolean', + value: error.value + }); } - })(); + throw error; + } + return { + consumed: result.consumed, + value: coerceFunc('boolean', !result.value.isZero()) + }; + } + }; + }; - // first element is length, skip it - (function () { - for (var i = 0; i < encoded.length - 1; i++) { - var additionalOffset = result / 2; - result += self._encodeWithOffset(nestedName, solidityType, encoded[i + 1], offset + additionalOffset); - } - })(); + var coderFixedBytes = function coderFixedBytes(coerceFunc, length, localName) { + var name = 'bytes' + length; + return { + localName: localName, + name: name, + type: name, + encode: function encode(value) { + try { + value = utils.arrayify(value); + } catch (error) { + errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, { + arg: localName, + type: typeof value === "undefined" ? "undefined" : _typeof(value), + value: error.value + }); + } + if (length === 32) { + return value; + } + var result = new Uint8Array(32); + result.set(value); return result; - }(); - } else if (solidityType.isStaticArray(type)) { - return function () { - var nestedName = solidityType.nestedName(type); - var nestedStaticPartLength = solidityType.staticPartLength(nestedName); - var result = ""; - - if (solidityType.isDynamicArray(nestedName)) { - (function () { - var previousLength = 0; // in int - for (var i = 0; i < encoded.length; i++) { - // calculate length of previous item - previousLength += +(encoded[i - 1] || [])[0] || 0; - result += f.formatInputInt(offset + i * nestedStaticPartLength + previousLength * 32).encode(); - } - })(); + }, + decode: function decode(data, offset) { + if (data.length < offset + 32) { + errors.throwError('insufficient data for ' + name + ' type', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: name, + value: utils.hexlify(data.slice(offset, offset + 32)) + }); } - (function () { - for (var i = 0; i < encoded.length; i++) { - var additionalOffset = result / 2; - result += self._encodeWithOffset(nestedName, solidityType, encoded[i], offset + additionalOffset); - } - })(); + return { + consumed: 32, + value: coerceFunc(name, utils.hexlify(data.slice(offset, offset + length))) + }; + } + }; + }; + var coderAddress = function coderAddress(coerceFunc, localName) { + return { + localName: localName, + name: 'address', + type: 'address', + encode: function encode(value) { + try { + value = utils.arrayify(utils.getAddress(value)); + } catch (error) { + errors.throwError('invalid address', errors.INVALID_ARGUMENT, { + arg: localName, + type: typeof value === "undefined" ? "undefined" : _typeof(value), + value: value + }); + } + var result = new Uint8Array(32); + result.set(value, 12); return result; - }(); - } - - return encoded; + }, + decode: function decode(data, offset) { + if (data.length < offset + 32) { + errors.throwError('insufficuent data for address type', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'address', + value: utils.hexlify(data.slice(offset, offset + 32)) + }); + } + return { + consumed: 32, + value: coerceFunc('address', utils.getAddress(utils.hexlify(data.slice(offset + 12, offset + 32)))) + }; + } + }; }; - /** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. - * - * @method encodeFunctionSignature - * @param {String|Object} functionName - * @return {String} encoded function name - */ - ABICoder.prototype.encodeFunctionSignature = function (functionName) { - if (_.isObject(functionName)) { - functionName = utils._jsonInterfaceMethodToString(functionName); - } + function _encodeDynamicBytes(value) { + var dataLength = parseInt(32 * Math.ceil(value.length / 32)); + var padding = new Uint8Array(dataLength - value.length); - return utils.sha3(functionName).slice(0, 10); - }; + return utils.concat([uint256Coder.encode(value.length), value, padding]); + } - /** - * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. - * - * @method encodeEventSignature - * @param {String|Object} functionName - * @return {String} encoded function name - */ - ABICoder.prototype.encodeEventSignature = function (functionName) { - if (_.isObject(functionName)) { - functionName = utils._jsonInterfaceMethodToString(functionName); + function _decodeDynamicBytes(data, offset, localName) { + if (data.length < offset + 32) { + errors.throwError('insufficient data for dynamicBytes length', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'dynamicBytes', + value: utils.hexlify(data.slice(offset, offset + 32)) + }); } - return utils.sha3(functionName); - }; - - /** - * Should be used to encode plain param - * - * @method encodeParameter - * @param {String} type - * @param {Object} param - * @return {String} encoded plain param - */ - ABICoder.prototype.encodeParameter = function (type, param) { - return this.encodeParameters([type], [param]); - }; - - /** - * Should be used to encode list of params - * - * @method encodeParameters - * @param {Array} types - * @param {Array} params - * @return {String} encoded list of params - */ - ABICoder.prototype.encodeParameters = function (types, params) { - // given a json interface - if (_.isObject(types) && types.inputs) { - types = _.map(types.inputs, function (input) { - return input.type; + var length = uint256Coder.decode(data, offset).value; + try { + length = length.toNumber(); + } catch (error) { + errors.throwError('dynamic bytes count too large', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'dynamicBytes', + value: length.toString() }); } - var solidityTypes = this._getSolidityTypes(types); - - var encodeds = solidityTypes.map(function (solidityType, index) { - return solidityType.encode(params[index], types[index]); - }); - - var dynamicOffset = solidityTypes.reduce(function (acc, solidityType, index) { - var staticPartLength = solidityType.staticPartLength(types[index]); - var roundedStaticPartLength = Math.floor((staticPartLength + 31) / 32) * 32; + if (data.length < offset + 32 + length) { + errors.throwError('insufficient data for dynamicBytes type', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'dynamicBytes', + value: utils.hexlify(data.slice(offset, offset + 32 + length)) + }); + } - return acc + (isDynamic(solidityTypes[index], types[index]) ? 32 : roundedStaticPartLength); - }, 0); + return { + consumed: parseInt(32 + 32 * Math.ceil(length / 32)), + value: data.slice(offset + 32, offset + 32 + length) + }; + } - return '0x' + this._encodeMultiWithOffset(types, solidityTypes, encodeds, dynamicOffset); + var coderDynamicBytes = function coderDynamicBytes(coerceFunc, localName) { + return { + localName: localName, + name: 'bytes', + type: 'bytes', + encode: function encode(value) { + try { + value = utils.arrayify(value); + } catch (error) { + errors.throwError('invalid bytes value', errors.INVALID_ARGUMENT, { + arg: localName, + type: typeof value === "undefined" ? "undefined" : _typeof(value), + value: error.value + }); + } + return _encodeDynamicBytes(value); + }, + decode: function decode(data, offset) { + var result = _decodeDynamicBytes(data, offset, localName); + result.value = coerceFunc('bytes', utils.hexlify(result.value)); + return result; + }, + dynamic: true + }; }; - /** - * Encodes a function call from its json interface and parameters. - * - * @method encodeFunctionCall - * @param {Array} jsonInterface - * @param {Array} params - * @return {String} The encoded ABI for this function call - */ - ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { - return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface, params).replace('0x', ''); + var coderString = function coderString(coerceFunc, localName) { + return { + localName: localName, + name: 'string', + type: 'string', + encode: function encode(value) { + if (typeof value !== 'string') { + errors.throwError('invalid string value', errors.INVALID_ARGUMENT, { + arg: localName, + type: typeof value === "undefined" ? "undefined" : _typeof(value), + value: value + }); + } + return _encodeDynamicBytes(utils.toUtf8Bytes(value)); + }, + decode: function decode(data, offset) { + var result = _decodeDynamicBytes(data, offset, localName); + result.value = coerceFunc('string', utils.toUtf8String(result.value)); + return result; + }, + dynamic: true + }; }; - /** - * Should be used to decode bytes to plain param - * - * @method decodeParameter - * @param {String} type - * @param {String} bytes - * @return {Object} plain param - */ - ABICoder.prototype.decodeParameter = function (type, bytes) { - - if (!_.isString(type)) { - throw new Error('Given parameter type is not a string: ' + type); - } + function alignSize(size) { + return parseInt(32 * Math.ceil(size / 32)); + } - return this.decodeParameters([{ type: type }], bytes)[0]; - }; + function pack(coders, values) { - /** - * Should be used to decode list of params - * - * @method decodeParameter - * @param {Array} outputs - * @param {String} bytes - * @return {Array} array of plain params - */ - ABICoder.prototype.decodeParameters = function (outputs, bytes) { - var isTypeArray = _.isArray(outputs) && _.isString(outputs[0]); - var types = isTypeArray ? outputs : []; + if (Array.isArray(values)) { + // do nothing - if (!isTypeArray) { - outputs.forEach(function (output) { - types.push(output.type); + } else if (values && (typeof values === "undefined" ? "undefined" : _typeof(values)) === 'object') { + var arrayValues = []; + coders.forEach(function (coder) { + arrayValues.push(values[coder.localName]); + }); + values = arrayValues; + } else { + errors.throwError('invalid tuple value', errors.INVALID_ARGUMENT, { + coderType: 'tuple', + type: typeof values === "undefined" ? "undefined" : _typeof(values), + value: values }); } - var solidityTypes = this._getSolidityTypes(types); - var offsets = this._getOffsets(types, solidityTypes); - - var returnValue = new Result(); - returnValue.__length__ = 0; - var count = 0; + if (coders.length !== values.length) { + errors.throwError('types/value length mismatch', errors.INVALID_ARGUMENT, { + coderType: 'tuple', + value: values + }); + } - outputs.forEach(function (output, i) { - var decodedValue = solidityTypes[count].decode(bytes.replace(/^0x/i, ''), offsets[count], types[count], count); - decodedValue = decodedValue === '0x' ? null : decodedValue; + var parts = []; - returnValue[i] = decodedValue; + coders.forEach(function (coder, index) { + parts.push({ dynamic: coder.dynamic, value: coder.encode(values[index]) }); + }); - if (_.isObject(output) && output.name) { - returnValue[output.name] = decodedValue; + var staticSize = 0, + dynamicSize = 0; + parts.forEach(function (part, index) { + if (part.dynamic) { + staticSize += 32; + dynamicSize += alignSize(part.value.length); + } else { + staticSize += alignSize(part.value.length); } - - returnValue.__length__++; - count++; }); - return returnValue; - }; - - /** - * Decodes events non- and indexed parameters. - * - * @method decodeLog - * @param {Object} inputs - * @param {String} data - * * @param {Array} topics - * @return {Array} array of plain params - */ - ABICoder.prototype.decodeLog = function (inputs, data, topics) { - - data = data || ''; + var offset = 0, + dynamicOffset = staticSize; + var data = new Uint8Array(staticSize + dynamicSize); - var notIndexedInputs = []; - var indexedInputs = []; + parts.forEach(function (part, index) { + if (part.dynamic) { + //uint256Coder.encode(dynamicOffset).copy(data, offset); + data.set(uint256Coder.encode(dynamicOffset), offset); + offset += 32; - inputs.forEach(function (input, i) { - if (input.indexed) { - indexedInputs[i] = input; + //part.value.copy(data, dynamicOffset); @TODO + data.set(part.value, dynamicOffset); + dynamicOffset += alignSize(part.value.length); } else { - notIndexedInputs[i] = input; + //part.value.copy(data, offset); @TODO + data.set(part.value, offset); + offset += alignSize(part.value.length); } }); - var nonIndexedData = data.slice(2); - var indexedData = _.isArray(topics) ? topics.map(function (topic) { - return topic.slice(2); - }).join('') : topics; + return data; + } - var notIndexedParams = this.decodeParameters(notIndexedInputs, nonIndexedData); - var indexedParams = this.decodeParameters(indexedInputs, indexedData); + function unpack(coders, data, offset) { + var baseOffset = offset; + var consumed = 0; + var value = []; + coders.forEach(function (coder) { + if (coder.dynamic) { + var dynamicOffset = uint256Coder.decode(data, offset); + var result = coder.decode(data, baseOffset + dynamicOffset.value.toNumber()); + // The dynamic part is leap-frogged somewhere else; doesn't count towards size + result.consumed = dynamicOffset.consumed; + } else { + var result = coder.decode(data, offset); + } - var returnValue = new Result(); - returnValue.__length__ = 0; + if (result.value != undefined) { + value.push(result.value); + } - inputs.forEach(function (res, i) { - returnValue[i] = res.type === 'string' ? '' : null; + offset += result.consumed; + consumed += result.consumed; + }); - if (notIndexedParams[i]) { - returnValue[i] = notIndexedParams[i]; + coders.forEach(function (coder, index) { + var name = coder.localName; + if (!name) { + return; } - if (indexedParams[i]) { - returnValue[i] = indexedParams[i]; + + if ((typeof name === "undefined" ? "undefined" : _typeof(name)) === 'object') { + name = name.name; + } + if (!name) { + return; } - if (res.name) { - returnValue[res.name] = returnValue[i]; + if (name === 'length') { + name = '_length'; } - returnValue.__length__++; + if (value[name] != null) { + return; + } + + value[name] = value[index]; }); - return returnValue; - }; + return { + value: value, + consumed: consumed + }; - var coder = new ABICoder([new SolidityTypeAddress(), new SolidityTypeBool(), new SolidityTypeInt(), new SolidityTypeUInt(), new SolidityTypeDynamicBytes(), new SolidityTypeBytes(), new SolidityTypeString()]); + return result; + } - module.exports = coder; - }, { "./formatters": 212, "./types/address": 216, "./types/bool": 217, "./types/bytes": 218, "./types/dynamicbytes": 219, "./types/int": 220, "./types/string": 221, "./types/uint": 222, "underscore": 211, "web3-utils": 393 }], 214: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** - * @file param.js - * @author Marek Kotewicz - * @date 2015 - */ + function coderArray(coerceFunc, coder, length, localName) { + var type = coder.type + '[' + (length >= 0 ? length : '') + ']'; - var formatters = require('./formatters.js'); + return { + coder: coder, + localName: localName, + length: length, + name: 'array', + type: type, + encode: function encode(value) { + if (!Array.isArray(value)) { + errors.throwError('expected array value', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'array', + type: typeof value === "undefined" ? "undefined" : _typeof(value), + value: value + }); + } - /** - * SolidityParam object prototype. - * Should be used when encoding, decoding solidity bytes - */ - var SolidityParam = function SolidityParam(value, offset, rawValue) { - this.value = value || ''; - this.offset = offset; // offset in bytes - this.rawValue = rawValue; // used for debugging - }; + var count = length; - /** - * This method should be used to get length of params's dynamic part - * - * @method dynamicPartLength - * @returns {Number} length of dynamic part (in bytes) - */ - SolidityParam.prototype.dynamicPartLength = function () { - return this.dynamicPart().length / 2; - }; + var result = new Uint8Array(0); + if (count === -1) { + count = value.length; + result = uint256Coder.encode(count); + } - /** - * This method should be used to create copy of solidity param with different offset - * - * @method withOffset - * @param {Number} offset length in bytes - * @returns {SolidityParam} new solidity param with applied offset - */ - SolidityParam.prototype.withOffset = function (offset) { - return new SolidityParam(this.value, offset); - }; + if (count !== value.length) { + error.throwError('array value length mismatch', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'array', + count: value.length, + expectedCount: count, + value: value + }); + } - /** - * This method should be used to combine solidity params together - * eg. when appending an array - * - * @method combine - * @param {SolidityParam} param with which we should combine - * @param {SolidityParam} result of combination - */ - SolidityParam.prototype.combine = function (param) { - return new SolidityParam(this.value + param.value); - }; + var coders = []; + value.forEach(function (value) { + coders.push(coder); + }); - /** - * This method should be called to check if param has dynamic size. - * If it has, it returns true, otherwise false - * - * @method isDynamic - * @returns {Boolean} - */ - SolidityParam.prototype.isDynamic = function () { - return this.offset !== undefined; - }; + return utils.concat([result, pack(coders, value)]); + }, + decode: function decode(data, offset) { + // @TODO: + //if (data.length < offset + length * 32) { throw new Error('invalid array'); } - /** - * This method should be called to transform offset to bytes - * - * @method offsetAsBytes - * @returns {String} bytes representation of offset - */ - SolidityParam.prototype.offsetAsBytes = function () { - return !this.isDynamic() ? '' : formatters.toTwosComplement(this.offset).replace('0x', ''); - }; + var consumed = 0; - /** - * This method should be called to get static part of param - * - * @method staticPart - * @returns {String} offset if it is a dynamic param, otherwise value - */ - SolidityParam.prototype.staticPart = function () { - if (!this.isDynamic()) { - return this.value; - } - return this.offsetAsBytes(); - }; + var count = length; - /** - * This method should be called to get dynamic part of param - * - * @method dynamicPart - * @returns {String} returns a value if it is a dynamic param, otherwise empty string - */ - SolidityParam.prototype.dynamicPart = function () { - return this.isDynamic() ? this.value : ''; - }; + if (count === -1) { + try { + var decodedLength = uint256Coder.decode(data, offset); + } catch (error) { + errors.throwError('insufficient data for dynamic array length', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'array', + value: error.value + }); + } + try { + count = decodedLength.value.toNumber(); + } catch (error) { + errors.throwError('array count too large', errors.INVALID_ARGUMENT, { + arg: localName, + coderType: 'array', + value: decodedLength.value.toString() + }); + } + consumed += decodedLength.consumed; + offset += decodedLength.consumed; + } - /** - * This method should be called to encode param - * - * @method encode - * @returns {String} - */ - SolidityParam.prototype.encode = function () { - return this.staticPart() + this.dynamicPart(); - }; + // We don't want the children to have a localName + var subCoder = { + name: coder.name, + type: coder.type, + encode: coder.encode, + decode: coder.decode, + dynamic: coder.dynamic + }; - /** - * This method should be called to encode array of params - * - * @method encodeList - * @param {Array[SolidityParam]} params - * @returns {String} - */ - SolidityParam.encodeList = function (params) { + var coders = []; + for (var i = 0; i < count; i++) { + coders.push(subCoder); + } + + var result = unpack(coders, data, offset); + result.consumed += consumed; + result.value = coerceFunc(type, result.value); + return result; + }, + dynamic: length === -1 || coder.dynamic + }; + } - // updating offsets - var totalOffset = params.length * 32; - var offsetParams = params.map(function (param) { - if (!param.isDynamic()) { - return param; + function coderTuple(coerceFunc, coders, localName) { + + var dynamic = false; + var types = []; + coders.forEach(function (coder) { + if (coder.dynamic) { + dynamic = true; } - var offset = totalOffset; - totalOffset += param.dynamicPartLength(); - return param.withOffset(offset); + types.push(coder.type); }); - // encode everything! - return offsetParams.reduce(function (result, param) { - return result + param.dynamicPart(); - }, offsetParams.reduce(function (result, param) { - return result + param.staticPart(); - }, '')); - }; + var type = 'tuple(' + types.join(',') + ')'; - module.exports = SolidityParam; - }, { "./formatters.js": 212 }], 215: [function (require, module, exports) { - var f = require('./formatters'); - var SolidityParam = require('./param'); + return { + coders: coders, + localName: localName, + name: 'tuple', + type: type, + encode: function encode(value) { + return pack(coders, value); + }, + decode: function decode(data, offset) { + var result = unpack(coders, data, offset); + result.value = coerceFunc(type, result.value); + return result; + }, + dynamic: dynamic + }; + } + /* + function getTypes(coders) { + var type = coderTuple(coders).type; + return type.substring(6, type.length - 1); + } + */ + function splitNesting(value) { + var result = []; + var accum = ''; + var depth = 0; + for (var offset = 0; offset < value.length; offset++) { + var c = value[offset]; + if (c === ',' && depth === 0) { + result.push(accum); + accum = ''; + } else { + accum += c; + if (c === '(') { + depth++; + } else if (c === ')') { + depth--; + if (depth === -1) { + throw new Error('unbalanced parenthsis'); + } + } + } + } + result.push(accum); - /** - * SolidityType prototype is used to encode/decode solidity params of certain type - */ - var SolidityType = function SolidityType(config) { - this._inputFormatter = config.inputFormatter; - this._outputFormatter = config.outputFormatter; - }; + return result; + } - /** - * Should be used to determine if this SolidityType do match given name - * - * @method isType - * @param {String} name - * @return {Bool} true if type match this SolidityType, otherwise false - */ - SolidityType.prototype.isType = function (name) { - throw "This method should be overwritten for type " + name; + var paramTypeSimple = { + address: coderAddress, + bool: coderBoolean, + string: coderString, + bytes: coderDynamicBytes }; - /** - * Should be used to determine what is the length of static part in given type - * - * @method staticPartLength - * @param {String} name - * @return {Number} length of static part in bytes - */ - SolidityType.prototype.staticPartLength = function (name) { - // If name isn't an array then treat it like a single element array. - return (this.nestedTypes(name) || ['[1]']).map(function (type) { - // the length of the nested array - return parseInt(type.slice(1, -1), 10) || 1; - }).reduce(function (previous, current) { - return previous * current; - // all basic types are 32 bytes long - }, 32); - }; + function getTupleParamCoder(coerceFunc, components, localName) { + if (!components) { + components = []; + } + var coders = []; + components.forEach(function (component) { + coders.push(getParamCoder(coerceFunc, component)); + }); - /** - * Should be used to determine if type is dynamic array - * eg: - * "type[]" => true - * "type[4]" => false - * - * @method isDynamicArray - * @param {String} name - * @return {Bool} true if the type is dynamic array - */ - SolidityType.prototype.isDynamicArray = function (name) { - var nestedTypes = this.nestedTypes(name); - return !!nestedTypes && !nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g); - }; + return coderTuple(coerceFunc, coders, localName); + } - /** - * Should be used to determine if type is static array - * eg: - * "type[]" => false - * "type[4]" => true - * - * @method isStaticArray - * @param {String} name - * @return {Bool} true if the type is static array - */ - SolidityType.prototype.isStaticArray = function (name) { - var nestedTypes = this.nestedTypes(name); - return !!nestedTypes && !!nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g); - }; + function getParamCoder(coerceFunc, param) { + var coder = paramTypeSimple[param.type]; + if (coder) { + return coder(coerceFunc, param.name); + } - /** - * Should return length of static array - * eg. - * "int[32]" => 32 - * "int256[14]" => 14 - * "int[2][3]" => 3 - * "int" => 1 - * "int[1]" => 1 - * "int[]" => 1 - * - * @method staticArrayLength - * @param {String} name - * @return {Number} static array length - */ - SolidityType.prototype.staticArrayLength = function (name) { - var nestedTypes = this.nestedTypes(name); - if (nestedTypes) { - return parseInt(nestedTypes[nestedTypes.length - 1].match(/[0-9]{1,}/g) || 1); + var match = param.type.match(paramTypeNumber); + if (match) { + var size = parseInt(match[2] || 256); + if (size === 0 || size > 256 || size % 8 !== 0) { + errors.throwError('invalid ' + match[1] + ' bit length', errors.INVALID_ARGUMENT, { + arg: 'param', + value: param + }); + } + return coderNumber(coerceFunc, size / 8, match[1] === 'int', param.name); } - return 1; - }; - /** - * Should return nested type - * eg. - * "int[32]" => "int" - * "int256[14]" => "int256" - * "int[2][3]" => "int[2]" - * "int" => "int" - * "int[]" => "int" - * - * @method nestedName - * @param {String} name - * @return {String} nested name - */ - SolidityType.prototype.nestedName = function (name) { - // remove last [] in name - var nestedTypes = this.nestedTypes(name); - if (!nestedTypes) { - return name; + var match = param.type.match(paramTypeBytes); + if (match) { + var size = parseInt(match[1]); + if (size === 0 || size > 32) { + errors.throwError('invalid bytes length', errors.INVALID_ARGUMENT, { + arg: 'param', + value: param + }); + } + return coderFixedBytes(coerceFunc, size, param.name); } - return name.substr(0, name.length - nestedTypes[nestedTypes.length - 1].length); - }; + var match = param.type.match(paramTypeArray); + if (match) { + param = shallowCopy(param); + var size = parseInt(match[2] || -1); + param.type = match[1]; + return coderArray(coerceFunc, getParamCoder(coerceFunc, param), size, param.name); + } - /** - * Should return true if type has dynamic size by default - * such types are "string", "bytes" - * - * @method isDynamicType - * @param {String} name - * @return {Bool} true if is dynamic, otherwise false - */ - SolidityType.prototype.isDynamicType = function () { - return false; - }; + if (param.type.substring(0, 5) === 'tuple') { + return getTupleParamCoder(coerceFunc, param.components, param.name); + } - /** - * Should return array of nested types - * eg. - * "int[2][3][]" => ["[2]", "[3]", "[]"] - * "int[] => ["[]"] - * "int" => null - * - * @method nestedTypes - * @param {String} name - * @return {Array} array of nested types - */ - SolidityType.prototype.nestedTypes = function (name) { - // return list of strings eg. "[]", "[3]", "[]", "[2]" - return name.match(/(\[[0-9]*\])/g); - }; + if (type === '') { + return coderNull(coerceFunc); + } - /** - * Should be used to encode the value - * - * @method encode - * @param {Object} value - * @param {String} name - * @return {String} encoded value - */ - SolidityType.prototype.encode = function (value, name) { - var self = this; - if (this.isDynamicArray(name)) { + errors.throwError('invalid type', errors.INVALID_ARGUMENT, { + arg: 'type', + value: type + }); + } - return function () { - var length = value.length; // in int - var nestedName = self.nestedName(name); + function Coder(coerceFunc) { + if (!(this instanceof Coder)) { + throw new Error('missing new'); + } + if (!coerceFunc) { + coerceFunc = defaultCoerceFunc; + } + utils.defineProperty(this, 'coerceFunc', coerceFunc); + } - var result = []; - result.push(f.formatInputInt(length).encode()); + // Legacy name support + // @TODO: In the next major version, remove names from decode/encode and don't do this + function populateNames(type, name) { + if (!name) { + return; + } - value.forEach(function (v) { - result.push(self.encode(v, nestedName)); + if (type.type.substring(0, 5) === 'tuple' && typeof name !== 'string') { + if (type.components.length != name.names.length) { + errors.throwError('names/types length mismatch', errors.INVALID_ARGUMENT, { + count: { names: name.names.length, types: type.components.length }, + value: { names: name.names, types: type.components } }); + } - return result; - }(); - } else if (this.isStaticArray(name)) { + name.names.forEach(function (name, index) { + populateNames(type.components[index], name); + }); - return function () { - var length = self.staticArrayLength(name); // in int - var nestedName = self.nestedName(name); + name = name.name || ''; + } - var result = []; - for (var i = 0; i < length; i++) { - result.push(self.encode(value[i], nestedName)); - } + if (!type.name && typeof name === 'string') { + type.name = name; + } + } - return result; - }(); + utils.defineProperty(Coder.prototype, 'encode', function (names, types, values) { + + // Names is optional, so shift over all the parameters if not provided + if (arguments.length < 3) { + values = types; + types = names; + names = []; } - return this._inputFormatter(value, name).encode(); - }; + if (types.length !== values.length) { + errors.throwError('types/values length mismatch', errors.INVALID_ARGUMENT, { + count: { types: types.length, values: values.length }, + value: { types: types, values: values } + }); + } - /** - * Should be used to decode value from bytes - * - * @method decode - * @param {String} bytes - * @param {Number} offset in bytes - * @param {String} name type name - * @returns {Object} decoded value - */ - SolidityType.prototype.decode = function (bytes, offset, name) { - var self = this; + var coders = []; + types.forEach(function (type, index) { + // Convert types to type objects + // - "uint foo" => { type: "uint", name: "foo" } + // - "tuple(uint, uint)" => { type: "tuple", components: [ { type: "uint" }, { type: "uint" }, ] } + if (typeof type === 'string') { + type = parseParam(type); + } - if (this.isDynamicArray(name)) { + // Legacy support for passing in names (this is going away in the next major version) + populateNames(type, names[index]); - return function () { - var arrayOffset = parseInt('0x' + bytes.substr(offset * 2, 64)); // in bytes - var length = parseInt('0x' + bytes.substr(arrayOffset * 2, 64)); // in int - var arrayStart = arrayOffset + 32; // array starts after length; // in bytes + coders.push(getParamCoder(this.coerceFunc, type)); + }, this); - var nestedName = self.nestedName(name); - var nestedStaticPartLength = self.staticPartLength(nestedName); // in bytes - var roundedNestedStaticPartLength = Math.floor((nestedStaticPartLength + 31) / 32) * 32; - var result = []; + return utils.hexlify(coderTuple(this.coerceFunc, coders).encode(values)); + }); - for (var i = 0; i < length * roundedNestedStaticPartLength; i += roundedNestedStaticPartLength) { - result.push(self.decode(bytes, arrayStart + i, nestedName)); - } + utils.defineProperty(Coder.prototype, 'decode', function (names, types, data) { - return result; - }(); - } else if (this.isStaticArray(name)) { + // Names is optional, so shift over all the parameters if not provided + if (arguments.length < 3) { + data = types; + types = names; + names = []; + } - return function () { - var length = self.staticArrayLength(name); // in int - var arrayStart = offset; // in bytes + data = utils.arrayify(data); - var nestedName = self.nestedName(name); - var nestedStaticPartLength = self.staticPartLength(nestedName); // in bytes - var roundedNestedStaticPartLength = Math.floor((nestedStaticPartLength + 31) / 32) * 32; - var result = []; + var coders = []; + types.forEach(function (type, index) { - for (var i = 0; i < length * roundedNestedStaticPartLength; i += roundedNestedStaticPartLength) { - result.push(self.decode(bytes, arrayStart + i, nestedName)); - } + // See encode for details + if (typeof type === 'string') { + type = parseParam(type); + } - return result; - }(); - } else if (this.isDynamicType(name)) { + // Legacy; going away in the next major version + populateNames(type, names[index]); - return function () { - var dynamicOffset = parseInt('0x' + bytes.substr(offset * 2, 64)); // in bytes - var length = parseInt('0x' + bytes.substr(dynamicOffset * 2, 64)); // in bytes - var roundedLength = Math.floor((length + 31) / 32); // in int - var param = new SolidityParam(bytes.substr(dynamicOffset * 2, (1 + roundedLength) * 64), 0, bytes); - return self._outputFormatter(param, name); - }(); - } + coders.push(getParamCoder(this.coerceFunc, type)); + }, this); - var length = this.staticPartLength(name); - var param = new SolidityParam(bytes.substr(offset * 2, length * 2), undefined, bytes); - return this._outputFormatter(param, name); - }; + return coderTuple(this.coerceFunc, coders).decode(data, 0).value; + }); - module.exports = SolidityType; - }, { "./formatters": 212, "./param": 214 }], 216: [function (require, module, exports) { - var f = require('../formatters'); - var formatters = require('web3-core-helpers').formatters; - var SolidityType = require('../type'); + utils.defineProperty(Coder, 'defaultCoder', new Coder()); - /** - * SolidityTypeAddress is a protoype that represents address type - * It matches: - * address - * address[] - * address[4] - * address[][] - * address[3][] - * address[][6][], ... - */ - var SolidityTypeAddress = function SolidityTypeAddress() { - this._inputFormatter = function () { - var args = Array.prototype.slice.call(arguments); - args[0] = !args[0] || args[0] === '0x0' ? '' : formatters.inputAddressFormatter(args[0]); - return f.formatInputInt.apply(this, args); - }; - this._outputFormatter = f.formatOutputAddress; - }; + utils.defineProperty(Coder, 'parseSignature', parseSignature); - SolidityTypeAddress.prototype = new SolidityType({}); - SolidityTypeAddress.prototype.constructor = SolidityTypeAddress; + module.exports = Coder; + }, { "../utils/address": 221, "../utils/bignumber.js": 222, "../utils/convert.js": 223, "../utils/properties.js": 226, "../utils/utf8.js": 228, "./errors": 224 }], 221: [function (require, module, exports) { - SolidityTypeAddress.prototype.isType = function (name) { - return !!name.match(/address(\[([0-9]*)\])?/); - }; + var BN = require('bn.js'); - module.exports = SolidityTypeAddress; - }, { "../formatters": 212, "../type": 215, "web3-core-helpers": 191 }], 217: [function (require, module, exports) { - var f = require('../formatters'); - var SolidityType = require('../type'); + var convert = require('./convert'); + var throwError = require('./throw-error'); + var keccak256 = require('./keccak256'); - /** - * SolidityTypeBool is a protoype that represents bool type - * It matches: - * bool - * bool[] - * bool[4] - * bool[][] - * bool[3][] - * bool[][6][], ... - */ - var SolidityTypeBool = function SolidityTypeBool() { - this._inputFormatter = f.formatInputBool; - this._outputFormatter = f.formatOutputBool; - }; + function getChecksumAddress(address) { + if (typeof address !== 'string' || !address.match(/^0x[0-9A-Fa-f]{40}$/)) { + throwError('invalid address', { input: address }); + } - SolidityTypeBool.prototype = new SolidityType({}); - SolidityTypeBool.prototype.constructor = SolidityTypeBool; + address = address.toLowerCase(); - SolidityTypeBool.prototype.isType = function (name) { - return !!name.match(/^bool(\[([0-9]*)\])*$/); - }; + var hashed = address.substring(2).split(''); + for (var i = 0; i < hashed.length; i++) { + hashed[i] = hashed[i].charCodeAt(0); + } + hashed = convert.arrayify(keccak256(hashed)); - module.exports = SolidityTypeBool; - }, { "../formatters": 212, "../type": 215 }], 218: [function (require, module, exports) { - var f = require('../formatters'); - var SolidityType = require('../type'); + address = address.substring(2).split(''); + for (var i = 0; i < 40; i += 2) { + if (hashed[i >> 1] >> 4 >= 8) { + address[i] = address[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + address[i + 1] = address[i + 1].toUpperCase(); + } + } - /** - * SolidityTypeBytes is a prototype that represents the bytes type. - * It matches: - * bytes - * bytes[] - * bytes[4] - * bytes[][] - * bytes[3][] - * bytes[][6][], ... - * bytes32 - * bytes8[4] - * bytes[3][] - */ - var SolidityTypeBytes = function SolidityTypeBytes() { - this._inputFormatter = f.formatInputBytes; - this._outputFormatter = f.formatOutputBytes; - }; + return '0x' + address.join(''); + } - SolidityTypeBytes.prototype = new SolidityType({}); - SolidityTypeBytes.prototype.constructor = SolidityTypeBytes; + // Shims for environments that are missing some required constants and functions + var MAX_SAFE_INTEGER = 0x1fffffffffffff; - SolidityTypeBytes.prototype.isType = function (name) { - return !!name.match(/^bytes([0-9]{1,})(\[([0-9]*)\])*$/); - }; + function log10(x) { + if (Math.log10) { + return Math.log10(x); + } + return Math.log(x) / Math.LN10; + } - module.exports = SolidityTypeBytes; - }, { "../formatters": 212, "../type": 215 }], 219: [function (require, module, exports) { - var f = require('../formatters'); - var SolidityType = require('../type'); + // See: https://en.wikipedia.org/wiki/International_Bank_Account_Number + var ibanChecksum = function () { - var SolidityTypeDynamicBytes = function SolidityTypeDynamicBytes() { - this._inputFormatter = f.formatInputDynamicBytes; - this._outputFormatter = f.formatOutputDynamicBytes; - }; + // Create lookup table + var ibanLookup = {}; + for (var i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); + } + for (var i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); + } - SolidityTypeDynamicBytes.prototype = new SolidityType({}); - SolidityTypeDynamicBytes.prototype.constructor = SolidityTypeDynamicBytes; + // How many decimal digits can we process? (for 64-bit float, this is 15) + var safeDigits = Math.floor(log10(MAX_SAFE_INTEGER)); - SolidityTypeDynamicBytes.prototype.isType = function (name) { - return !!name.match(/^bytes(\[([0-9]*)\])*$/); - }; + return function (address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + '00'; - SolidityTypeDynamicBytes.prototype.isDynamicType = function () { - return true; - }; + var expanded = address.split(''); + for (var i = 0; i < expanded.length; i++) { + expanded[i] = ibanLookup[expanded[i]]; + } + expanded = expanded.join(''); - module.exports = SolidityTypeDynamicBytes; - }, { "../formatters": 212, "../type": 215 }], 220: [function (require, module, exports) { - var f = require('../formatters'); - var SolidityType = require('../type'); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + var block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } - /** - * SolidityTypeInt is a protoype that represents int type - * It matches: - * int - * int[] - * int[4] - * int[][] - * int[3][] - * int[][6][], ... - * int32 - * int64[] - * int8[4] - * int256[][] - * int[3][] - * int64[][6][], ... - */ - var SolidityTypeInt = function SolidityTypeInt() { - this._inputFormatter = f.formatInputInt; - this._outputFormatter = f.formatOutputInt; - }; + var checksum = String(98 - parseInt(expanded, 10) % 97); + while (checksum.length < 2) { + checksum = '0' + checksum; + } - SolidityTypeInt.prototype = new SolidityType({}); - SolidityTypeInt.prototype.constructor = SolidityTypeInt; + return checksum; + }; + }(); - SolidityTypeInt.prototype.isType = function (name) { - return !!name.match(/^int([0-9]*)?(\[([0-9]*)\])*$/); - }; + function getAddress(address, icapFormat) { + var result = null; - module.exports = SolidityTypeInt; - }, { "../formatters": 212, "../type": 215 }], 221: [function (require, module, exports) { - var f = require('../formatters'); - var SolidityType = require('../type'); + if (typeof address !== 'string') { + throwError('invalid address', { input: address }); + } - var SolidityTypeString = function SolidityTypeString() { - this._inputFormatter = f.formatInputString; - this._outputFormatter = f.formatOutputString; - }; + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { - SolidityTypeString.prototype = new SolidityType({}); - SolidityTypeString.prototype.constructor = SolidityTypeString; + // Missing the 0x prefix + if (address.substring(0, 2) !== '0x') { + address = '0x' + address; + } - SolidityTypeString.prototype.isType = function (name) { - return !!name.match(/^string(\[([0-9]*)\])*$/); - }; + result = getChecksumAddress(address); - SolidityTypeString.prototype.isDynamicType = function () { - return true; - }; + // It is a checksummed address with a bad checksum + if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { + throwError('invalid address checksum', { input: address, expected: result }); + } - module.exports = SolidityTypeString; - }, { "../formatters": 212, "../type": 215 }], 222: [function (require, module, exports) { - var f = require('../formatters'); - var SolidityType = require('../type'); + // Maybe ICAP? (we only support direct mode) + } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { - /** - * SolidityTypeUInt is a protoype that represents uint type - * It matches: - * uint - * uint[] - * uint[4] - * uint[][] - * uint[3][] - * uint[][6][], ... - * uint32 - * uint64[] - * uint8[4] - * uint256[][] - * uint[3][] - * uint64[][6][], ... - */ - var SolidityTypeUInt = function SolidityTypeUInt() { - this._inputFormatter = f.formatInputInt; - this._outputFormatter = f.formatOutputUInt; - }; + // It is an ICAP address with a bad checksum + if (address.substring(2, 4) !== ibanChecksum(address)) { + throwError('invalid address icap checksum', { input: address }); + } + + result = new BN(address.substring(4), 36).toString(16); + while (result.length < 40) { + result = '0' + result; + } + result = getChecksumAddress('0x' + result); + } else { + throwError('invalid address', { input: address }); + } + + if (icapFormat) { + var base36 = new BN(result.substring(2), 16).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = '0' + base36; + } + return 'XE' + ibanChecksum('XE00' + base36) + base36; + } - SolidityTypeUInt.prototype = new SolidityType({}); - SolidityTypeUInt.prototype.constructor = SolidityTypeUInt; + return result; + } - SolidityTypeUInt.prototype.isType = function (name) { - return !!name.match(/^uint([0-9]*)?(\[([0-9]*)\])*$/); + module.exports = { + getAddress: getAddress }; + }, { "./convert": 223, "./keccak256": 225, "./throw-error": 227, "bn.js": 218 }], 222: [function (require, module, exports) { + /** + * BigNumber + * + * A wrapper around the BN.js object. In the future we can swap out + * the underlying BN.js library for something smaller. + */ - module.exports = SolidityTypeUInt; - }, { "../formatters": 212, "../type": 215 }], 223: [function (require, module, exports) { - arguments[4][194][0].apply(exports, arguments); - }, { "./register": 225, "dup": 194 }], 224: [function (require, module, exports) { - arguments[4][195][0].apply(exports, arguments); - }, { "dup": 195 }], 225: [function (require, module, exports) { - arguments[4][196][0].apply(exports, arguments); - }, { "./loader": 224, "dup": 196 }], 226: [function (require, module, exports) { - arguments[4][1][0].apply(exports, arguments); - }, { "./asn1/api": 227, "./asn1/base": 229, "./asn1/constants": 233, "./asn1/decoders": 235, "./asn1/encoders": 238, "bn.js": 240, "dup": 1 }], 227: [function (require, module, exports) { - arguments[4][2][0].apply(exports, arguments); - }, { "../asn1": 226, "dup": 2, "inherits": 325, "vm": 161 }], 228: [function (require, module, exports) { - arguments[4][3][0].apply(exports, arguments); - }, { "../base": 229, "buffer": 47, "dup": 3, "inherits": 325 }], 229: [function (require, module, exports) { - arguments[4][4][0].apply(exports, arguments); - }, { "./buffer": 228, "./node": 230, "./reporter": 231, "dup": 4 }], 230: [function (require, module, exports) { - arguments[4][5][0].apply(exports, arguments); - }, { "../base": 229, "dup": 5, "minimalistic-assert": 329 }], 231: [function (require, module, exports) { - arguments[4][6][0].apply(exports, arguments); - }, { "dup": 6, "inherits": 325 }], 232: [function (require, module, exports) { - arguments[4][7][0].apply(exports, arguments); - }, { "../constants": 233, "dup": 7 }], 233: [function (require, module, exports) { - arguments[4][8][0].apply(exports, arguments); - }, { "./der": 232, "dup": 8 }], 234: [function (require, module, exports) { - arguments[4][9][0].apply(exports, arguments); - }, { "../../asn1": 226, "dup": 9, "inherits": 325 }], 235: [function (require, module, exports) { - arguments[4][10][0].apply(exports, arguments); - }, { "./der": 234, "./pem": 236, "dup": 10 }], 236: [function (require, module, exports) { - arguments[4][11][0].apply(exports, arguments); - }, { "./der": 234, "buffer": 47, "dup": 11, "inherits": 325 }], 237: [function (require, module, exports) { - arguments[4][12][0].apply(exports, arguments); - }, { "../../asn1": 226, "buffer": 47, "dup": 12, "inherits": 325 }], 238: [function (require, module, exports) { - arguments[4][13][0].apply(exports, arguments); - }, { "./der": 237, "./pem": 239, "dup": 13 }], 239: [function (require, module, exports) { - arguments[4][14][0].apply(exports, arguments); - }, { "./der": 237, "dup": 14, "inherits": 325 }], 240: [function (require, module, exports) { - (function (module, exports) { - 'use strict'; + var BN = require('bn.js'); - // Utils + var defineProperty = require('./properties').defineProperty; + var convert = require('./convert'); + var throwError = require('./throw-error'); - function assert(val, msg) { - if (!val) throw new Error(msg || 'Assertion failed'); + function BigNumber(value) { + if (!(this instanceof BigNumber)) { + throw new Error('missing new'); } - // Could use `inherits` module, but don't want to move from single file - // architecture yet. - function inherits(ctor, superCtor) { - ctor.super_ = superCtor; - var TempCtor = function TempCtor() {}; - TempCtor.prototype = superCtor.prototype; - ctor.prototype = new TempCtor(); - ctor.prototype.constructor = ctor; + if (convert.isHexString(value)) { + if (value == '0x') { + value = '0x0'; + } + value = new BN(value.substring(2), 16); + } else if (typeof value === 'string' && value[0] === '-' && convert.isHexString(value.substring(1))) { + value = new BN(value.substring(3), 16).mul(BigNumber.constantNegativeOne._bn); + } else if (typeof value === 'string' && value.match(/^-?[0-9]*$/)) { + if (value == '') { + value = '0'; + } + value = new BN(value); + } else if (typeof value === 'number' && parseInt(value) == value) { + value = new BN(value); + } else if (BN.isBN(value)) { + //value = value + + } else if (isBigNumber(value)) { + value = value._bn; + } else if (convert.isArrayish(value)) { + value = new BN(convert.hexlify(value).substring(2), 16); + } else { + throwError('invalid BigNumber value', { input: value }); } - // BN + defineProperty(this, '_bn', value); + } - function BN(number, base, endian) { - if (BN.isBN(number)) { - return number; - } + defineProperty(BigNumber, 'constantNegativeOne', bigNumberify(-1)); + defineProperty(BigNumber, 'constantZero', bigNumberify(0)); + defineProperty(BigNumber, 'constantOne', bigNumberify(1)); + defineProperty(BigNumber, 'constantTwo', bigNumberify(2)); + defineProperty(BigNumber, 'constantWeiPerEther', bigNumberify(new BN('1000000000000000000'))); - this.negative = 0; - this.words = null; - this.length = 0; + defineProperty(BigNumber.prototype, 'fromTwos', function (value) { + return new BigNumber(this._bn.fromTwos(value)); + }); - // Reduction context - this.red = null; + defineProperty(BigNumber.prototype, 'toTwos', function (value) { + return new BigNumber(this._bn.toTwos(value)); + }); - if (number !== null) { - if (base === 'le' || base === 'be') { - endian = base; - base = 10; - } + defineProperty(BigNumber.prototype, 'add', function (other) { + return new BigNumber(this._bn.add(bigNumberify(other)._bn)); + }); - this._init(number || 0, base || 10, endian || 'be'); - } - } - if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === 'object') { - module.exports = BN; - } else { - exports.BN = BN; - } + defineProperty(BigNumber.prototype, 'sub', function (other) { + return new BigNumber(this._bn.sub(bigNumberify(other)._bn)); + }); - BN.BN = BN; - BN.wordSize = 26; + defineProperty(BigNumber.prototype, 'div', function (other) { + return new BigNumber(this._bn.div(bigNumberify(other)._bn)); + }); - var Buffer; - try { - Buffer = require('buffer').Buffer; - } catch (e) {} + defineProperty(BigNumber.prototype, 'mul', function (other) { + return new BigNumber(this._bn.mul(bigNumberify(other)._bn)); + }); - BN.isBN = function isBN(num) { - if (num instanceof BN) { - return true; - } + defineProperty(BigNumber.prototype, 'mod', function (other) { + return new BigNumber(this._bn.mod(bigNumberify(other)._bn)); + }); - return num !== null && (typeof num === "undefined" ? "undefined" : _typeof(num)) === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); - }; + defineProperty(BigNumber.prototype, 'pow', function (other) { + return new BigNumber(this._bn.pow(bigNumberify(other)._bn)); + }); - BN.max = function max(left, right) { - if (left.cmp(right) > 0) return left; - return right; - }; + defineProperty(BigNumber.prototype, 'maskn', function (value) { + return new BigNumber(this._bn.maskn(value)); + }); - BN.min = function min(left, right) { - if (left.cmp(right) < 0) return left; - return right; - }; + defineProperty(BigNumber.prototype, 'eq', function (other) { + return this._bn.eq(bigNumberify(other)._bn); + }); - BN.prototype._init = function init(number, base, endian) { - if (typeof number === 'number') { - return this._initNumber(number, base, endian); - } + defineProperty(BigNumber.prototype, 'lt', function (other) { + return this._bn.lt(bigNumberify(other)._bn); + }); - if ((typeof number === "undefined" ? "undefined" : _typeof(number)) === 'object') { - return this._initArray(number, base, endian); - } + defineProperty(BigNumber.prototype, 'lte', function (other) { + return this._bn.lte(bigNumberify(other)._bn); + }); - if (base === 'hex') { - base = 16; - } - assert(base === (base | 0) && base >= 2 && base <= 36); + defineProperty(BigNumber.prototype, 'gt', function (other) { + return this._bn.gt(bigNumberify(other)._bn); + }); - number = number.toString().replace(/\s+/g, ''); - var start = 0; - if (number[0] === '-') { - start++; - } + defineProperty(BigNumber.prototype, 'gte', function (other) { + return this._bn.gte(bigNumberify(other)._bn); + }); - if (base === 16) { - this._parseHex(number, start); - } else { - this._parseBase(number, base, start); - } + defineProperty(BigNumber.prototype, 'isZero', function () { + return this._bn.isZero(); + }); - if (number[0] === '-') { - this.negative = 1; - } + defineProperty(BigNumber.prototype, 'toNumber', function (base) { + return this._bn.toNumber(); + }); - this.strip(); + defineProperty(BigNumber.prototype, 'toString', function () { + //return this._bn.toString(base || 10); + return this._bn.toString(10); + }); - if (endian !== 'le') return; + defineProperty(BigNumber.prototype, 'toHexString', function () { + var hex = this._bn.toString(16); + if (hex.length % 2) { + hex = '0' + hex; + } + return '0x' + hex; + }); - this._initArray(this.toArray(), base, endian); - }; + function isBigNumber(value) { + return value._bn && value._bn.mod; + } - BN.prototype._initNumber = function _initNumber(number, base, endian) { - if (number < 0) { - this.negative = 1; - number = -number; - } - if (number < 0x4000000) { - this.words = [number & 0x3ffffff]; - this.length = 1; - } else if (number < 0x10000000000000) { - this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff]; - this.length = 2; - } else { - assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) - this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1]; - this.length = 3; - } + function bigNumberify(value) { + if (isBigNumber(value)) { + return value; + } + return new BigNumber(value); + } - if (endian !== 'le') return; + module.exports = { + isBigNumber: isBigNumber, + bigNumberify: bigNumberify, + BigNumber: BigNumber + }; + }, { "./convert": 223, "./properties": 226, "./throw-error": 227, "bn.js": 218 }], 223: [function (require, module, exports) { + /** + * Conversion Utilities + * + */ - // Reverse the bytes - this._initArray(this.toArray(), base, endian); - }; + var defineProperty = require('./properties.js').defineProperty; - BN.prototype._initArray = function _initArray(number, base, endian) { - // Perhaps a Uint8Array - assert(typeof number.length === 'number'); - if (number.length <= 0) { - this.words = [0]; - this.length = 1; - return this; - } + var errors = require('./errors'); - this.length = Math.ceil(number.length / 3); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; - } + function addSlice(array) { + if (array.slice) { + return array; + } - var j, w; - var off = 0; - if (endian === 'be') { - for (i = number.length - 1, j = 0; i >= 0; i -= 3) { - w = number[i] | number[i - 1] << 8 | number[i - 2] << 16; - this.words[j] |= w << off & 0x3ffffff; - this.words[j + 1] = w >>> 26 - off & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - } else if (endian === 'le') { - for (i = 0, j = 0; i < number.length; i += 3) { - w = number[i] | number[i + 1] << 8 | number[i + 2] << 16; - this.words[j] |= w << off & 0x3ffffff; - this.words[j + 1] = w >>> 26 - off & 0x3ffffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } - } - } - return this.strip(); + array.slice = function () { + var args = Array.prototype.slice.call(arguments); + return new Uint8Array(Array.prototype.slice.apply(array, args)); }; - function parseHex(str, start, end) { - var r = 0; - var len = Math.min(str.length, end); - for (var i = start; i < len; i++) { - var c = str.charCodeAt(i) - 48; + return array; + } - r <<= 4; + function isArrayish(value) { + if (!value || parseInt(value.length) != value.length || typeof value === 'string') { + return false; + } - // 'a' - 'f' - if (c >= 49 && c <= 54) { - r |= c - 49 + 0xa; + for (var i = 0; i < value.length; i++) { + var v = value[i]; + if (v < 0 || v >= 256 || parseInt(v) != v) { + return false; + } + } - // 'A' - 'F' - } else if (c >= 17 && c <= 22) { - r |= c - 17 + 0xa; + return true; + } - // '0' - '9' - } else { - r |= c & 0xf; - } - } - return r; + function arrayify(value) { + if (value == null) { + errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } - BN.prototype._parseHex = function _parseHex(number, start) { - // Create possibly bigger array to ensure that it fits the number - this.length = Math.ceil((number.length - start) / 6); - this.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - this.words[i] = 0; + if (value && value.toHexString) { + value = value.toHexString(); + } + + if (isHexString(value)) { + value = value.substring(2); + if (value.length % 2) { + value = '0' + value; } - var j, w; - // Scan 24-bit chunks and add them to the number - var off = 0; - for (i = number.length - 6, j = 0; i >= start; i -= 6) { - w = parseHex(number, i, i + 6); - this.words[j] |= w << off & 0x3ffffff; - // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb - this.words[j + 1] |= w >>> 26 - off & 0x3fffff; - off += 24; - if (off >= 26) { - off -= 26; - j++; - } + var result = []; + for (var i = 0; i < value.length; i += 2) { + result.push(parseInt(value.substr(i, 2), 16)); } - if (i + 6 !== start) { - w = parseHex(number, start, i + 6); - this.words[j] |= w << off & 0x3ffffff; - this.words[j + 1] |= w >>> 26 - off & 0x3fffff; + + return addSlice(new Uint8Array(result)); + } else if (typeof value === 'string') { + if (value.match(/^[0-9a-fA-F]*$/)) { + errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); } - this.strip(); - }; + errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value }); + } - function parseBase(str, start, end, mul) { - var r = 0; - var len = Math.min(str.length, end); - for (var i = start; i < len; i++) { - var c = str.charCodeAt(i) - 48; + if (isArrayish(value)) { + return addSlice(new Uint8Array(value)); + } - r *= mul; + errors.throwError('invalid arrayify value', { arg: 'value', value: value, type: typeof value === "undefined" ? "undefined" : _typeof(value) }); + } - // 'a' - if (c >= 49) { - r += c - 49 + 0xa; + function concat(objects) { + var arrays = []; + var length = 0; + for (var i = 0; i < objects.length; i++) { + var object = arrayify(objects[i]); + arrays.push(object); + length += object.length; + } - // 'A' - } else if (c >= 17) { - r += c - 17 + 0xa; + var result = new Uint8Array(length); + var offset = 0; + for (var i = 0; i < arrays.length; i++) { + result.set(arrays[i], offset); + offset += arrays[i].length; + } - // '0' - '9' - } else { - r += c; - } - } - return r; + return addSlice(result); + } + function stripZeros(value) { + value = arrayify(value); + + if (value.length === 0) { + return value; } - BN.prototype._parseBase = function _parseBase(number, base, start) { - // Initialize as zero - this.words = [0]; - this.length = 1; + // Find the first non-zero entry + var start = 0; + while (value[start] === 0) { + start++; + } - // Find length of limb in base - for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { - limbLen++; - } - limbLen--; - limbPow = limbPow / base | 0; + // If we started with zeros, strip them + if (start) { + value = value.slice(start); + } - var total = number.length - start; - var mod = total % limbLen; - var end = Math.min(total, total - mod) + start; + return value; + } - var word = 0; - for (var i = start; i < end; i += limbLen) { - word = parseBase(number, i, i + limbLen, base); + function padZeros(value, length) { + value = arrayify(value); - this.imuln(limbPow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); - } - } + if (length < value.length) { + throw new Error('cannot pad'); + } - if (mod !== 0) { - var pow = 1; - word = parseBase(number, i, number.length, base); + var result = new Uint8Array(length); + result.set(value, length - value.length); + return addSlice(result); + } - for (i = 0; i < mod; i++) { - pow *= base; - } + function isHexString(value, length) { + if (typeof value !== 'string' || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (length && value.length !== 2 + 2 * length) { + return false; + } + return true; + } - this.imuln(pow); - if (this.words[0] + word < 0x4000000) { - this.words[0] += word; - } else { - this._iaddn(word); - } - } - }; + var HexCharacters = '0123456789abcdef'; - BN.prototype.copy = function copy(dest) { - dest.words = new Array(this.length); - for (var i = 0; i < this.length; i++) { - dest.words[i] = this.words[i]; - } - dest.length = this.length; - dest.negative = this.negative; - dest.red = this.red; - }; + function hexlify(value) { - BN.prototype.clone = function clone() { - var r = new BN(null); - this.copy(r); - return r; - }; + if (value && value.toHexString) { + return value.toHexString(); + } - BN.prototype._expand = function _expand(size) { - while (this.length < size) { - this.words[this.length++] = 0; + if (typeof value === 'number') { + if (value < 0) { + errors.throwError('cannot hexlify negative value', errors.INVALID_ARG, { arg: 'value', value: value }); } - return this; - }; - // Remove leading `0` from `this` - BN.prototype.strip = function strip() { - while (this.length > 1 && this.words[this.length - 1] === 0) { - this.length--; + var hex = ''; + while (value) { + hex = HexCharacters[value & 0x0f] + hex; + value = parseInt(value / 16); } - return this._normSign(); - }; - BN.prototype._normSign = function _normSign() { - // -0 = 0 - if (this.length === 1 && this.words[0] === 0) { - this.negative = 0; + if (hex.length) { + if (hex.length % 2) { + hex = '0' + hex; + } + return '0x' + hex; } - return this; - }; - - BN.prototype.inspect = function inspect() { - return (this.red ? ''; - }; - /* - var zeros = []; - var groupSizes = []; - var groupBases = []; - var s = ''; - var i = -1; - while (++i < BN.wordSize) { - zeros[i] = s; - s += '0'; + return '0x00'; } - groupSizes[0] = 0; - groupSizes[1] = 0; - groupBases[0] = 0; - groupBases[1] = 0; - var base = 2 - 1; - while (++base < 36 + 1) { - var groupSize = 0; - var groupBase = 1; - while (groupBase < (1 << BN.wordSize) / base) { - groupBase *= base; - groupSize += 1; + + if (isHexString(value)) { + if (value.length % 2) { + value = '0x0' + value.substring(2); } - groupSizes[base] = groupSize; - groupBases[base] = groupBase; + return value; } - */ - var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000']; + if (isArrayish(value)) { + var result = []; + for (var i = 0; i < value.length; i++) { + var v = value[i]; + result.push(HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]); + } + return '0x' + result.join(''); + } - var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]; + errors.throwError('invalid hexlify value', { arg: 'value', value: value }); + } - var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176]; + function hexStripZeros(value) { + while (value.length > 3 && value.substring(0, 3) === '0x0') { + value = '0x' + value.substring(3); + } + return value; + } - BN.prototype.toString = function toString(base, padding) { - base = base || 10; - padding = padding | 0 || 1; + function hexZeroPad(value, length) { + while (value.length < 2 * length + 2) { + value = '0x0' + value.substring(2); + } + return value; + } - var out; - if (base === 16 || base === 'hex') { - out = ''; - var off = 0; - var carry = 0; - for (var i = 0; i < this.length; i++) { - var w = this.words[i]; - var word = ((w << off | carry) & 0xffffff).toString(16); - carry = w >>> 24 - off & 0xffffff; - if (carry !== 0 || i !== this.length - 1) { - out = zeros[6 - word.length] + word + out; - } else { - out = word + out; - } - off += 2; - if (off >= 26) { - off -= 26; - i--; - } - } - if (carry !== 0) { - out = carry.toString(16) + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; - } + /* @TODO: Add something like this to make slicing code easier to understand + function hexSlice(hex, start, end) { + hex = hexlify(hex); + return '0x' + hex.substring(2 + start * 2, 2 + end * 2); + } + */ - if (base === (base | 0) && base >= 2 && base <= 36) { - // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); - var groupSize = groupSizes[base]; - // var groupBase = Math.pow(base, groupSize); - var groupBase = groupBases[base]; - out = ''; - var c = this.clone(); - c.negative = 0; - while (!c.isZero()) { - var r = c.modn(groupBase).toString(base); - c = c.idivn(groupBase); + function splitSignature(signature) { + signature = arrayify(signature); + if (signature.length !== 65) { + throw new Error('invalid signature'); + } - if (!c.isZero()) { - out = zeros[groupSize - r.length] + r + out; - } else { - out = r + out; - } - } - if (this.isZero()) { - out = '0' + out; - } - while (out.length % padding !== 0) { - out = '0' + out; - } - if (this.negative !== 0) { - out = '-' + out; - } - return out; - } + var v = signature[64]; + if (v !== 27 && v !== 28) { + v = 27 + v % 2; + } - assert(false, 'Base should be between 2 and 36'); + return { + r: hexlify(signature.slice(0, 32)), + s: hexlify(signature.slice(32, 64)), + v: v }; + } - BN.prototype.toNumber = function toNumber() { - var ret = this.words[0]; - if (this.length === 2) { - ret += this.words[1] * 0x4000000; - } else if (this.length === 3 && this.words[2] === 0x01) { - // NOTE: at this stage it is known that the top bit is set - ret += 0x10000000000000 + this.words[1] * 0x4000000; - } else if (this.length > 2) { - assert(false, 'Number can only safely store up to 53 bits'); - } - return this.negative !== 0 ? -ret : ret; - }; + module.exports = { + arrayify: arrayify, + isArrayish: isArrayish, - BN.prototype.toJSON = function toJSON() { - return this.toString(16); - }; + concat: concat, - BN.prototype.toBuffer = function toBuffer(endian, length) { - assert(typeof Buffer !== 'undefined'); - return this.toArrayLike(Buffer, endian, length); - }; + padZeros: padZeros, + stripZeros: stripZeros, - BN.prototype.toArray = function toArray(endian, length) { - return this.toArrayLike(Array, endian, length); - }; + splitSignature: splitSignature, - BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) { - var byteLength = this.byteLength(); - var reqLength = length || Math.max(1, byteLength); - assert(byteLength <= reqLength, 'byte array longer than desired length'); - assert(reqLength > 0, 'Requested array length <= 0'); + hexlify: hexlify, + isHexString: isHexString, + hexStripZeros: hexStripZeros, + hexZeroPad: hexZeroPad + }; + }, { "./errors": 224, "./properties.js": 226 }], 224: [function (require, module, exports) { + 'use strict'; - this.strip(); - var littleEndian = endian === 'le'; - var res = new ArrayType(reqLength); + var defineProperty = require('./properties').defineProperty; - var b, i; - var q = this.clone(); - if (!littleEndian) { - // Assume big-endian - for (i = 0; i < reqLength - byteLength; i++) { - res[i] = 0; - } + var codes = {}; - for (i = 0; !q.isZero(); i++) { - b = q.andln(0xff); - q.iushrn(8); + [ + // Unknown Error + 'UNKNOWN_ERROR', - res[reqLength - i - 1] = b; - } - } else { - for (i = 0; !q.isZero(); i++) { - b = q.andln(0xff); - q.iushrn(8); + // Not implemented + 'NOT_IMPLEMENTED', - res[i] = b; - } + // Missing new operator to an object + // - name: The name of the class + 'MISSING_NEW', - for (; i < reqLength; i++) { - res[i] = 0; - } - } + // Call exception + 'CALL_EXCEPTION', - return res; - }; + // Response from a server was invalid + // - response: The body of the response + //'BAD_RESPONSE', - if (Math.clz32) { - BN.prototype._countBits = function _countBits(w) { - return 32 - Math.clz32(w); - }; - } else { - BN.prototype._countBits = function _countBits(w) { - var t = w; - var r = 0; - if (t >= 0x1000) { - r += 13; - t >>>= 13; - } - if (t >= 0x40) { - r += 7; - t >>>= 7; - } - if (t >= 0x8) { - r += 4; - t >>>= 4; - } - if (t >= 0x02) { - r += 2; - t >>>= 2; - } - return r + t; - }; - } - BN.prototype._zeroBits = function _zeroBits(w) { - // Short-cut - if (w === 0) return 26; + // Invalid argument (e.g. type) to a function: + // - arg: The argument name that was invalid + // - value: The value of the argument + // - type: The type of the argument + // - expected: What was expected + 'INVALID_ARGUMENT', - var t = w; - var r = 0; - if ((t & 0x1fff) === 0) { - r += 13; - t >>>= 13; - } - if ((t & 0x7f) === 0) { - r += 7; - t >>>= 7; - } - if ((t & 0xf) === 0) { - r += 4; - t >>>= 4; - } - if ((t & 0x3) === 0) { - r += 2; - t >>>= 2; - } - if ((t & 0x1) === 0) { - r++; - } - return r; - }; + // Missing argument to a function: + // - arg: The argument name that is required + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + 'MISSING_ARGUMENT', - // Return number of used bits in a BN - BN.prototype.bitLength = function bitLength() { - var w = this.words[this.length - 1]; - var hi = this._countBits(w); - return (this.length - 1) * 26 + hi; - }; + // Too many arguments + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + 'UNEXPECTED_ARGUMENT', - function toBitArray(num) { - var w = new Array(num.bitLength()); + // Unsupported operation + // - operation + 'UNSUPPORTED_OPERATION'].forEach(function (code) { + defineProperty(codes, code, code); + }); - for (var bit = 0; bit < w.length; bit++) { - var off = bit / 26 | 0; - var wbit = bit % 26; + defineProperty(codes, 'throwError', function (message, code, params) { + if (!code) { + code = codes.UNKNOWN_ERROR; + } + if (!params) { + params = {}; + } - w[bit] = (num.words[off] & 1 << wbit) >>> wbit; + var messageDetails = []; + Object.keys(params).forEach(function (key) { + try { + messageDetails.push(key + '=' + JSON.stringify(params[key])); + } catch (error) { + messageDetails.push(key + '=' + JSON.stringify(params[key].toString())); } - - return w; + }); + var reason = message; + if (messageDetails.length) { + message += ' (' + messageDetails.join(', ') + ')'; } - // Number of trailing zero bits - BN.prototype.zeroBits = function zeroBits() { - if (this.isZero()) return 0; + var error = new Error(message); + error.reason = reason; + error.code = code; - var r = 0; - for (var i = 0; i < this.length; i++) { - var b = this._zeroBits(this.words[i]); - r += b; - if (b !== 26) break; - } - return r; - }; + Object.keys(params).forEach(function (key) { + error[key] = params[key]; + }); - BN.prototype.byteLength = function byteLength() { - return Math.ceil(this.bitLength() / 8); - }; + throw error; + }); - BN.prototype.toTwos = function toTwos(width) { - if (this.negative !== 0) { - return this.abs().inotn(width).iaddn(1); - } - return this.clone(); - }; + defineProperty(codes, 'checkNew', function (self, kind) { + if (!(self instanceof kind)) { + codes.throwError('missing new', codes.MISSING_NEW, { name: kind.name }); + } + }); - BN.prototype.fromTwos = function fromTwos(width) { - if (this.testn(width - 1)) { - return this.notn(width).iaddn(1).ineg(); - } - return this.clone(); - }; + module.exports = codes; + }, { "./properties": 226 }], 225: [function (require, module, exports) { + 'use strict'; - BN.prototype.isNeg = function isNeg() { - return this.negative !== 0; - }; + var sha3 = require('js-sha3'); - // Return negative clone of `this` - BN.prototype.neg = function neg() { - return this.clone().ineg(); - }; + var convert = require('./convert.js'); - BN.prototype.ineg = function ineg() { - if (!this.isZero()) { - this.negative ^= 1; - } + function keccak256(data) { + data = convert.arrayify(data); + return '0x' + sha3.keccak_256(data); + } - return this; - }; + module.exports = keccak256; + }, { "./convert.js": 223, "js-sha3": 232 }], 226: [function (require, module, exports) { + 'use strict'; - // Or `num` with `this` in-place - BN.prototype.iuor = function iuor(num) { - while (this.length < num.length) { - this.words[this.length++] = 0; - } + function defineProperty(object, name, value) { + Object.defineProperty(object, name, { + enumerable: true, + value: value, + writable: false + }); + } - for (var i = 0; i < num.length; i++) { - this.words[i] = this.words[i] | num.words[i]; + function defineFrozen(object, name, value) { + var frozen = JSON.stringify(value); + Object.defineProperty(object, name, { + enumerable: true, + get: function get() { + return JSON.parse(frozen); } + }); + } - return this.strip(); - }; + module.exports = { + defineFrozen: defineFrozen, + defineProperty: defineProperty + }; + }, {}], 227: [function (require, module, exports) { + 'use strict'; - BN.prototype.ior = function ior(num) { - assert((this.negative | num.negative) === 0); - return this.iuor(num); - }; + function throwError(message, params) { + var error = new Error(message); + for (var key in params) { + error[key] = params[key]; + } + throw error; + } - // Or `num` with `this` - BN.prototype.or = function or(num) { - if (this.length > num.length) return this.clone().ior(num); - return num.clone().ior(this); - }; + module.exports = throwError; + }, {}], 228: [function (require, module, exports) { - BN.prototype.uor = function uor(num) { - if (this.length > num.length) return this.clone().iuor(num); - return num.clone().iuor(this); - }; + var convert = require('./convert.js'); - // And `num` with `this` in-place - BN.prototype.iuand = function iuand(num) { - // b = min-length(num, this) - var b; - if (this.length > num.length) { - b = num; + // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array + function utf8ToBytes(str) { + var result = []; + var offset = 0; + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + if (c < 128) { + result[offset++] = c; + } else if (c < 2048) { + result[offset++] = c >> 6 | 192; + result[offset++] = c & 63 | 128; + } else if ((c & 0xFC00) == 0xD800 && i + 1 < str.length && (str.charCodeAt(i + 1) & 0xFC00) == 0xDC00) { + // Surrogate Pair + c = 0x10000 + ((c & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF); + result[offset++] = c >> 18 | 240; + result[offset++] = c >> 12 & 63 | 128; + result[offset++] = c >> 6 & 63 | 128; + result[offset++] = c & 63 | 128; } else { - b = this; - } - - for (var i = 0; i < b.length; i++) { - this.words[i] = this.words[i] & num.words[i]; + result[offset++] = c >> 12 | 224; + result[offset++] = c >> 6 & 63 | 128; + result[offset++] = c & 63 | 128; } + } - this.length = b.length; - - return this.strip(); - }; - - BN.prototype.iand = function iand(num) { - assert((this.negative | num.negative) === 0); - return this.iuand(num); - }; + return convert.arrayify(result); + }; - // And `num` with `this` - BN.prototype.and = function and(num) { - if (this.length > num.length) return this.clone().iand(num); - return num.clone().iand(this); - }; + // http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 + function bytesToUtf8(bytes) { + bytes = convert.arrayify(bytes); - BN.prototype.uand = function uand(num) { - if (this.length > num.length) return this.clone().iuand(num); - return num.clone().iuand(this); - }; + var result = ''; + var i = 0; - // Xor `num` with `this` in-place - BN.prototype.iuxor = function iuxor(num) { - // a.length > b.length - var a; - var b; - if (this.length > num.length) { - a = this; - b = num; - } else { - a = num; - b = this; + // Invalid bytes are ignored + while (i < bytes.length) { + var c = bytes[i++]; + if (c >> 7 == 0) { + // 0xxx xxxx + result += String.fromCharCode(c); + continue; } - for (var i = 0; i < b.length; i++) { - this.words[i] = a.words[i] ^ b.words[i]; + // Invalid starting byte + if (c >> 6 == 0x02) { + continue; } - if (this !== a) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } + // Multibyte; how many bytes left for thus character? + var extraLength = null; + if (c >> 5 == 0x06) { + extraLength = 1; + } else if (c >> 4 == 0x0e) { + extraLength = 2; + } else if (c >> 3 == 0x1e) { + extraLength = 3; + } else if (c >> 2 == 0x3e) { + extraLength = 4; + } else if (c >> 1 == 0x7e) { + extraLength = 5; + } else { + continue; } - this.length = a.length; - - return this.strip(); - }; - - BN.prototype.ixor = function ixor(num) { - assert((this.negative | num.negative) === 0); - return this.iuxor(num); - }; - - // Xor `num` with `this` - BN.prototype.xor = function xor(num) { - if (this.length > num.length) return this.clone().ixor(num); - return num.clone().ixor(this); - }; + // Do we have enough bytes in our data? + if (i + extraLength > bytes.length) { - BN.prototype.uxor = function uxor(num) { - if (this.length > num.length) return this.clone().iuxor(num); - return num.clone().iuxor(this); - }; + // If there is an invalid unprocessed byte, try to continue + for (; i < bytes.length; i++) { + if (bytes[i] >> 6 != 0x02) { + break; + } + } + if (i != bytes.length) continue; - // Not ``this`` with ``width`` bitwidth - BN.prototype.inotn = function inotn(width) { - assert(typeof width === 'number' && width >= 0); + // All leftover bytes are valid. + return result; + } - var bytesNeeded = Math.ceil(width / 26) | 0; - var bitsLeft = width % 26; + // Remove the UTF-8 prefix from the char (res) + var res = c & (1 << 8 - extraLength - 1) - 1; - // Extend the buffer with leading zeroes - this._expand(bytesNeeded); + var count; + for (count = 0; count < extraLength; count++) { + var nextChar = bytes[i++]; - if (bitsLeft > 0) { - bytesNeeded--; + // Is the char valid multibyte part? + if (nextChar >> 6 != 0x02) { + break; + }; + res = res << 6 | nextChar & 0x3f; } - // Handle complete words - for (var i = 0; i < bytesNeeded; i++) { - this.words[i] = ~this.words[i] & 0x3ffffff; + if (count != extraLength) { + i--; + continue; } - // Handle the residue - if (bitsLeft > 0) { - this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft; + if (res <= 0xffff) { + result += String.fromCharCode(res); + continue; } - // And remove leading zeroes - return this.strip(); - }; - - BN.prototype.notn = function notn(width) { - return this.clone().inotn(width); - }; + res -= 0x10000; + result += String.fromCharCode((res >> 10 & 0x3ff) + 0xd800, (res & 0x3ff) + 0xdc00); + } - // Set `bit` of `this` - BN.prototype.setn = function setn(bit, val) { - assert(typeof bit === 'number' && bit >= 0); + return result; + } - var off = bit / 26 | 0; - var wbit = bit % 26; + module.exports = { + toUtf8Bytes: utf8ToBytes, + toUtf8String: bytesToUtf8 + }; + }, { "./convert.js": 223 }], 229: [function (require, module, exports) { + 'use strict'; - this._expand(off + 1); + var BN = require('bn.js'); + var numberToBN = require('number-to-bn'); - if (val) { - this.words[off] = this.words[off] | 1 << wbit; - } else { - this.words[off] = this.words[off] & ~(1 << wbit); - } + var zero = new BN(0); + var negative1 = new BN(-1); - return this.strip(); - }; + // complete ethereum unit map + var unitMap = { + 'noether': '0', // eslint-disable-line + 'wei': '1', // eslint-disable-line + 'kwei': '1000', // eslint-disable-line + 'Kwei': '1000', // eslint-disable-line + 'babbage': '1000', // eslint-disable-line + 'femtoether': '1000', // eslint-disable-line + 'mwei': '1000000', // eslint-disable-line + 'Mwei': '1000000', // eslint-disable-line + 'lovelace': '1000000', // eslint-disable-line + 'picoether': '1000000', // eslint-disable-line + 'gwei': '1000000000', // eslint-disable-line + 'Gwei': '1000000000', // eslint-disable-line + 'shannon': '1000000000', // eslint-disable-line + 'nanoether': '1000000000', // eslint-disable-line + 'nano': '1000000000', // eslint-disable-line + 'szabo': '1000000000000', // eslint-disable-line + 'microether': '1000000000000', // eslint-disable-line + 'micro': '1000000000000', // eslint-disable-line + 'finney': '1000000000000000', // eslint-disable-line + 'milliether': '1000000000000000', // eslint-disable-line + 'milli': '1000000000000000', // eslint-disable-line + 'ether': '1000000000000000000', // eslint-disable-line + 'kether': '1000000000000000000000', // eslint-disable-line + 'grand': '1000000000000000000000', // eslint-disable-line + 'mether': '1000000000000000000000000', // eslint-disable-line + 'gether': '1000000000000000000000000000', // eslint-disable-line + 'tether': '1000000000000000000000000000000' }; - // Add `num` to `this` in-place - BN.prototype.iadd = function iadd(num) { - var r; + /** + * Returns value of unit in Wei + * + * @method getValueOfUnit + * @param {String} unit the unit to convert to, default ether + * @returns {BigNumber} value of the unit (in Wei) + * @throws error if the unit is not correct:w + */ + function getValueOfUnit(unitInput) { + var unit = unitInput ? unitInput.toLowerCase() : 'ether'; + var unitValue = unitMap[unit]; // eslint-disable-line - // negative + positive - if (this.negative !== 0 && num.negative === 0) { - this.negative = 0; - r = this.isub(num); - this.negative ^= 1; - return this._normSign(); + if (typeof unitValue !== 'string') { + throw new Error('[ethjs-unit] the unit provided ' + unitInput + ' doesn\'t exists, please use the one of the following units ' + JSON.stringify(unitMap, null, 2)); + } - // positive + negative - } else if (this.negative === 0 && num.negative !== 0) { - num.negative = 0; - r = this.isub(num); - num.negative = 1; - return r._normSign(); - } + return new BN(unitValue, 10); + } - // a.length > b.length - var a, b; - if (this.length > num.length) { - a = this; - b = num; + function numberToString(arg) { + if (typeof arg === 'string') { + if (!arg.match(/^-?[0-9.]+$/)) { + throw new Error('while converting number to string, invalid number value \'' + arg + '\', should be a number matching (^-?[0-9.]+).'); + } + return arg; + } else if (typeof arg === 'number') { + return String(arg); + } else if ((typeof arg === "undefined" ? "undefined" : _typeof(arg)) === 'object' && arg.toString && (arg.toTwos || arg.dividedToIntegerBy)) { + if (arg.toPrecision) { + return String(arg.toPrecision()); } else { - a = num; - b = this; + // eslint-disable-line + return arg.toString(10); } + } + throw new Error('while converting number to string, invalid number value \'' + arg + '\' type ' + (typeof arg === "undefined" ? "undefined" : _typeof(arg)) + '.'); + } - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) + (b.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; - } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - this.words[i] = r & 0x3ffffff; - carry = r >>> 26; + function fromWei(weiInput, unit, optionsInput) { + var wei = numberToBN(weiInput); // eslint-disable-line + var negative = wei.lt(zero); // eslint-disable-line + var base = getValueOfUnit(unit); + var baseLength = unitMap[unit].length - 1 || 1; + var options = optionsInput || {}; + + if (negative) { + wei = wei.mul(negative1); + } + + var fraction = wei.mod(base).toString(10); // eslint-disable-line + + while (fraction.length < baseLength) { + fraction = '0' + fraction; + } + + if (!options.pad) { + fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1]; + } + + var whole = wei.div(base).toString(10); // eslint-disable-line + + if (options.commify) { + whole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ','); + } + + var value = '' + whole + (fraction == '0' ? '' : '.' + fraction); // eslint-disable-line + + if (negative) { + value = '-' + value; + } + + return value; + } + + function toWei(etherInput, unit) { + var ether = numberToString(etherInput); // eslint-disable-line + var base = getValueOfUnit(unit); + var baseLength = unitMap[unit].length - 1 || 1; + + // Is it negative? + var negative = ether.substring(0, 1) === '-'; // eslint-disable-line + if (negative) { + ether = ether.substring(1); + } + + if (ether === '.') { + throw new Error('[ethjs-unit] while converting number ' + etherInput + ' to wei, invalid value'); + } + + // Split it into a whole and fractional part + var comps = ether.split('.'); // eslint-disable-line + if (comps.length > 2) { + throw new Error('[ethjs-unit] while converting number ' + etherInput + ' to wei, too many decimal points'); + } + + var whole = comps[0], + fraction = comps[1]; // eslint-disable-line + + if (!whole) { + whole = '0'; + } + if (!fraction) { + fraction = '0'; + } + if (fraction.length > baseLength) { + throw new Error('[ethjs-unit] while converting number ' + etherInput + ' to wei, too many decimal places'); + } + + while (fraction.length < baseLength) { + fraction += '0'; + } + + whole = new BN(whole); + fraction = new BN(fraction); + var wei = whole.mul(base).add(fraction); // eslint-disable-line + + if (negative) { + wei = wei.mul(negative1); + } + + return new BN(wei.toString(10), 10); + } + + module.exports = { + unitMap: unitMap, + numberToString: numberToString, + getValueOfUnit: getValueOfUnit, + fromWei: fromWei, + toWei: toWei + }; + }, { "bn.js": 230, "number-to-bn": 234 }], 230: [function (require, module, exports) { + (function (module, exports) { + 'use strict'; + + // Utils + + function assert(val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function TempCtor() {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN(number, base, endian) { + if (BN.isBN(number)) { + return number; } - this.length = a.length; - if (carry !== 0) { - this.words[this.length] = carry; - this.length++; - // Copy the rest of the words - } else if (a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; } + + this._init(number || 0, base || 10, endian || 'be'); } + } + if ((typeof module === "undefined" ? "undefined" : _typeof(module)) === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } - return this; - }; + BN.BN = BN; + BN.wordSize = 26; - // Add `num` to `this` - BN.prototype.add = function add(num) { - var res; - if (num.negative !== 0 && this.negative === 0) { - num.negative = 0; - res = this.sub(num); - num.negative ^= 1; - return res; - } else if (num.negative === 0 && this.negative !== 0) { - this.negative = 0; - res = num.sub(this); - this.negative = 1; - return res; + var Buffer; + try { + Buffer = require('buf' + 'fer').Buffer; + } catch (e) {} + + BN.isBN = function isBN(num) { + if (num instanceof BN) { + return true; } - if (this.length > num.length) return this.clone().iadd(num); + return num !== null && (typeof num === "undefined" ? "undefined" : _typeof(num)) === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; - return num.clone().iadd(this); + BN.max = function max(left, right) { + if (left.cmp(right) > 0) return left; + return right; }; - // Subtract `num` from `this` in-place - BN.prototype.isub = function isub(num) { - // this - (-num) = this + num - if (num.negative !== 0) { - num.negative = 0; - var r = this.iadd(num); - num.negative = 1; - return r._normSign(); + BN.min = function min(left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; - // -this - num = -(this + num) - } else if (this.negative !== 0) { - this.negative = 0; - this.iadd(num); - this.negative = 1; - return this._normSign(); + BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); } - // At this point both numbers are positive - var cmp = this.cmp(num); - - // Optimization - zeroify - if (cmp === 0) { - this.negative = 0; - this.length = 1; - this.words[0] = 0; - return this; + if ((typeof number === "undefined" ? "undefined" : _typeof(number)) === 'object') { + return this._initArray(number, base, endian); } - // a > b - var a, b; - if (cmp > 0) { - a = this; - b = num; - } else { - a = num; - b = this; + if (base === 'hex') { + base = 16; } + assert(base === (base | 0) && base >= 2 && base <= 36); - var carry = 0; - for (var i = 0; i < b.length; i++) { - r = (a.words[i] | 0) - (b.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; } - for (; carry !== 0 && i < a.length; i++) { - r = (a.words[i] | 0) + carry; - carry = r >> 26; - this.words[i] = r & 0x3ffffff; + + if (base === 16) { + this._parseHex(number, start); + } else { + this._parseBase(number, base, start); } - // Copy rest of the words - if (carry === 0 && i < a.length && a !== this) { - for (; i < a.length; i++) { - this.words[i] = a.words[i]; - } + if (number[0] === '-') { + this.negative = 1; } - this.length = Math.max(this.length, i); + this.strip(); - if (a !== this) { + if (endian !== 'le') return; + + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initNumber = function _initNumber(number, base, endian) { + if (number < 0) { this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1]; + this.length = 3; } - return this.strip(); + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); }; - // Subtract `num` from `this` - BN.prototype.sub = function sub(num) { - return this.clone().isub(num); + BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | number[i - 1] << 8 | number[i - 2] << 16; + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] = w >>> 26 - off & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | number[i + 1] << 8 | number[i + 2] << 16; + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] = w >>> 26 - off & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); }; - function smallMulTo(self, num, out) { - out.negative = num.negative ^ self.negative; - var len = self.length + num.length | 0; - out.length = len; - len = len - 1 | 0; + function parseHex(str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; - // Peel one iteration (compiler can't do it, because of code complexity) - var a = self.words[0] | 0; - var b = num.words[0] | 0; - var r = a * b; + r <<= 4; - var lo = r & 0x3ffffff; - var carry = r / 0x4000000 | 0; - out.words[0] = lo; + // 'a' - 'f' + if (c >= 49 && c <= 54) { + r |= c - 49 + 0xa; - for (var k = 1; k < len; k++) { - // Sum all words with the same `i + j = k` and accumulate `ncarry`, - // note that ncarry could be >= 0x3ffffff - var ncarry = carry >>> 26; - var rword = carry & 0x3ffffff; - var maxJ = Math.min(k, num.length - 1); - for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { - var i = k - j | 0; - a = self.words[i] | 0; - b = num.words[j] | 0; - r = a * b + rword; - ncarry += r / 0x4000000 | 0; - rword = r & 0x3ffffff; + // 'A' - 'F' + } else if (c >= 17 && c <= 22) { + r |= c - 17 + 0xa; + + // '0' - '9' + } else { + r |= c & 0xf; } - out.words[k] = rword | 0; - carry = ncarry | 0; } - if (carry !== 0) { - out.words[k] = carry | 0; - } else { - out.length--; + return r; + } + + BN.prototype._parseHex = function _parseHex(number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; } - return out.strip(); - } + var j, w; + // Scan 24-bit chunks and add them to the number + var off = 0; + for (i = number.length - 6, j = 0; i >= start; i -= 6) { + w = parseHex(number, i, i + 6); + this.words[j] |= w << off & 0x3ffffff; + // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb + this.words[j + 1] |= w >>> 26 - off & 0x3fffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + if (i + 6 !== start) { + w = parseHex(number, start, i + 6); + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] |= w >>> 26 - off & 0x3fffff; + } + this.strip(); + }; - // TODO(indutny): it may be reasonable to omit it for users who don't need - // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit - // multiplication (like elliptic secp256k1). - var comb10MulTo = function comb10MulTo(self, num, out) { - var a = self.words; - var b = num.words; - var o = out.words; - var c = 0; - var lo; - var mid; - var hi; - var a0 = a[0] | 0; - var al0 = a0 & 0x1fff; + function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = limbPow / base | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + }; + + BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand(size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect() { + return (this.red ? ''; + }; + + /* + var zeros = []; + var groupSizes = []; + var groupBases = []; + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + */ + + var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000']; + + var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]; + + var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176]; + + BN.prototype.toString = function toString(base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = ((w << off | carry) & 0xffffff).toString(16); + carry = w >>> 24 - off & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber() { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + this.words[1] * 0x4000000; + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return this.negative !== 0 ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON() { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer(endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray(endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits(w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits(w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits(w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength() { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray(num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = bit / 26 | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & 1 << wbit) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits() { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos(width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos(width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg() { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg() { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor(num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior(num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or(num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor(num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand(num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand(num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and(num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand(num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor(num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor(num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor(num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor(num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn(width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft; + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = bit / 26 | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | 1 << wbit; + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd(num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add(num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + + function smallMulTo(self, num, out) { + out.negative = num.negative ^ self.negative; + var len = self.length + num.length | 0; + out.length = len; + len = len - 1 | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = r / 0x4000000 | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += r / 0x4000000 | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo(self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; var ah0 = a0 >>> 13; var a1 = a[1] | 0; var al1 = a1 & 0x1fff; @@ -30447,2346 +31630,4612 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol var bl9 = b9 & 0x1fff; var bh9 = b9 >>> 13; - out.negative = self.negative ^ num.negative; - out.length = 19; - /* k = 0 */ - lo = Math.imul(al0, bl0); - mid = Math.imul(al0, bh0); - mid = mid + Math.imul(ah0, bl0) | 0; - hi = Math.imul(ah0, bh0); - var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; - w0 &= 0x3ffffff; - /* k = 1 */ - lo = Math.imul(al1, bl0); - mid = Math.imul(al1, bh0); - mid = mid + Math.imul(ah1, bl0) | 0; - hi = Math.imul(ah1, bh0); - lo = lo + Math.imul(al0, bl1) | 0; - mid = mid + Math.imul(al0, bh1) | 0; - mid = mid + Math.imul(ah0, bl1) | 0; - hi = hi + Math.imul(ah0, bh1) | 0; - var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; - w1 &= 0x3ffffff; - /* k = 2 */ - lo = Math.imul(al2, bl0); - mid = Math.imul(al2, bh0); - mid = mid + Math.imul(ah2, bl0) | 0; - hi = Math.imul(ah2, bh0); - lo = lo + Math.imul(al1, bl1) | 0; - mid = mid + Math.imul(al1, bh1) | 0; - mid = mid + Math.imul(ah1, bl1) | 0; - hi = hi + Math.imul(ah1, bh1) | 0; - lo = lo + Math.imul(al0, bl2) | 0; - mid = mid + Math.imul(al0, bh2) | 0; - mid = mid + Math.imul(ah0, bl2) | 0; - hi = hi + Math.imul(ah0, bh2) | 0; - var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; - w2 &= 0x3ffffff; - /* k = 3 */ - lo = Math.imul(al3, bl0); - mid = Math.imul(al3, bh0); - mid = mid + Math.imul(ah3, bl0) | 0; - hi = Math.imul(ah3, bh0); - lo = lo + Math.imul(al2, bl1) | 0; - mid = mid + Math.imul(al2, bh1) | 0; - mid = mid + Math.imul(ah2, bl1) | 0; - hi = hi + Math.imul(ah2, bh1) | 0; - lo = lo + Math.imul(al1, bl2) | 0; - mid = mid + Math.imul(al1, bh2) | 0; - mid = mid + Math.imul(ah1, bl2) | 0; - hi = hi + Math.imul(ah1, bh2) | 0; - lo = lo + Math.imul(al0, bl3) | 0; - mid = mid + Math.imul(al0, bh3) | 0; - mid = mid + Math.imul(ah0, bl3) | 0; - hi = hi + Math.imul(ah0, bh3) | 0; - var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; - w3 &= 0x3ffffff; - /* k = 4 */ - lo = Math.imul(al4, bl0); - mid = Math.imul(al4, bh0); - mid = mid + Math.imul(ah4, bl0) | 0; - hi = Math.imul(ah4, bh0); - lo = lo + Math.imul(al3, bl1) | 0; - mid = mid + Math.imul(al3, bh1) | 0; - mid = mid + Math.imul(ah3, bl1) | 0; - hi = hi + Math.imul(ah3, bh1) | 0; - lo = lo + Math.imul(al2, bl2) | 0; - mid = mid + Math.imul(al2, bh2) | 0; - mid = mid + Math.imul(ah2, bl2) | 0; - hi = hi + Math.imul(ah2, bh2) | 0; - lo = lo + Math.imul(al1, bl3) | 0; - mid = mid + Math.imul(al1, bh3) | 0; - mid = mid + Math.imul(ah1, bl3) | 0; - hi = hi + Math.imul(ah1, bh3) | 0; - lo = lo + Math.imul(al0, bl4) | 0; - mid = mid + Math.imul(al0, bh4) | 0; - mid = mid + Math.imul(ah0, bl4) | 0; - hi = hi + Math.imul(ah0, bh4) | 0; - var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; - w4 &= 0x3ffffff; - /* k = 5 */ - lo = Math.imul(al5, bl0); - mid = Math.imul(al5, bh0); - mid = mid + Math.imul(ah5, bl0) | 0; - hi = Math.imul(ah5, bh0); - lo = lo + Math.imul(al4, bl1) | 0; - mid = mid + Math.imul(al4, bh1) | 0; - mid = mid + Math.imul(ah4, bl1) | 0; - hi = hi + Math.imul(ah4, bh1) | 0; - lo = lo + Math.imul(al3, bl2) | 0; - mid = mid + Math.imul(al3, bh2) | 0; - mid = mid + Math.imul(ah3, bl2) | 0; - hi = hi + Math.imul(ah3, bh2) | 0; - lo = lo + Math.imul(al2, bl3) | 0; - mid = mid + Math.imul(al2, bh3) | 0; - mid = mid + Math.imul(ah2, bl3) | 0; - hi = hi + Math.imul(ah2, bh3) | 0; - lo = lo + Math.imul(al1, bl4) | 0; - mid = mid + Math.imul(al1, bh4) | 0; - mid = mid + Math.imul(ah1, bl4) | 0; - hi = hi + Math.imul(ah1, bh4) | 0; - lo = lo + Math.imul(al0, bl5) | 0; - mid = mid + Math.imul(al0, bh5) | 0; - mid = mid + Math.imul(ah0, bl5) | 0; - hi = hi + Math.imul(ah0, bh5) | 0; - var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; - w5 &= 0x3ffffff; - /* k = 6 */ - lo = Math.imul(al6, bl0); - mid = Math.imul(al6, bh0); - mid = mid + Math.imul(ah6, bl0) | 0; - hi = Math.imul(ah6, bh0); - lo = lo + Math.imul(al5, bl1) | 0; - mid = mid + Math.imul(al5, bh1) | 0; - mid = mid + Math.imul(ah5, bl1) | 0; - hi = hi + Math.imul(ah5, bh1) | 0; - lo = lo + Math.imul(al4, bl2) | 0; - mid = mid + Math.imul(al4, bh2) | 0; - mid = mid + Math.imul(ah4, bl2) | 0; - hi = hi + Math.imul(ah4, bh2) | 0; - lo = lo + Math.imul(al3, bl3) | 0; - mid = mid + Math.imul(al3, bh3) | 0; - mid = mid + Math.imul(ah3, bl3) | 0; - hi = hi + Math.imul(ah3, bh3) | 0; - lo = lo + Math.imul(al2, bl4) | 0; - mid = mid + Math.imul(al2, bh4) | 0; - mid = mid + Math.imul(ah2, bl4) | 0; - hi = hi + Math.imul(ah2, bh4) | 0; - lo = lo + Math.imul(al1, bl5) | 0; - mid = mid + Math.imul(al1, bh5) | 0; - mid = mid + Math.imul(ah1, bl5) | 0; - hi = hi + Math.imul(ah1, bh5) | 0; - lo = lo + Math.imul(al0, bl6) | 0; - mid = mid + Math.imul(al0, bh6) | 0; - mid = mid + Math.imul(ah0, bl6) | 0; - hi = hi + Math.imul(ah0, bh6) | 0; - var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; - w6 &= 0x3ffffff; - /* k = 7 */ - lo = Math.imul(al7, bl0); - mid = Math.imul(al7, bh0); - mid = mid + Math.imul(ah7, bl0) | 0; - hi = Math.imul(ah7, bh0); - lo = lo + Math.imul(al6, bl1) | 0; - mid = mid + Math.imul(al6, bh1) | 0; - mid = mid + Math.imul(ah6, bl1) | 0; - hi = hi + Math.imul(ah6, bh1) | 0; - lo = lo + Math.imul(al5, bl2) | 0; - mid = mid + Math.imul(al5, bh2) | 0; - mid = mid + Math.imul(ah5, bl2) | 0; - hi = hi + Math.imul(ah5, bh2) | 0; - lo = lo + Math.imul(al4, bl3) | 0; - mid = mid + Math.imul(al4, bh3) | 0; - mid = mid + Math.imul(ah4, bl3) | 0; - hi = hi + Math.imul(ah4, bh3) | 0; - lo = lo + Math.imul(al3, bl4) | 0; - mid = mid + Math.imul(al3, bh4) | 0; - mid = mid + Math.imul(ah3, bl4) | 0; - hi = hi + Math.imul(ah3, bh4) | 0; - lo = lo + Math.imul(al2, bl5) | 0; - mid = mid + Math.imul(al2, bh5) | 0; - mid = mid + Math.imul(ah2, bl5) | 0; - hi = hi + Math.imul(ah2, bh5) | 0; - lo = lo + Math.imul(al1, bl6) | 0; - mid = mid + Math.imul(al1, bh6) | 0; - mid = mid + Math.imul(ah1, bl6) | 0; - hi = hi + Math.imul(ah1, bh6) | 0; - lo = lo + Math.imul(al0, bl7) | 0; - mid = mid + Math.imul(al0, bh7) | 0; - mid = mid + Math.imul(ah0, bl7) | 0; - hi = hi + Math.imul(ah0, bh7) | 0; - var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; - w7 &= 0x3ffffff; - /* k = 8 */ - lo = Math.imul(al8, bl0); - mid = Math.imul(al8, bh0); - mid = mid + Math.imul(ah8, bl0) | 0; - hi = Math.imul(ah8, bh0); - lo = lo + Math.imul(al7, bl1) | 0; - mid = mid + Math.imul(al7, bh1) | 0; - mid = mid + Math.imul(ah7, bl1) | 0; - hi = hi + Math.imul(ah7, bh1) | 0; - lo = lo + Math.imul(al6, bl2) | 0; - mid = mid + Math.imul(al6, bh2) | 0; - mid = mid + Math.imul(ah6, bl2) | 0; - hi = hi + Math.imul(ah6, bh2) | 0; - lo = lo + Math.imul(al5, bl3) | 0; - mid = mid + Math.imul(al5, bh3) | 0; - mid = mid + Math.imul(ah5, bl3) | 0; - hi = hi + Math.imul(ah5, bh3) | 0; - lo = lo + Math.imul(al4, bl4) | 0; - mid = mid + Math.imul(al4, bh4) | 0; - mid = mid + Math.imul(ah4, bl4) | 0; - hi = hi + Math.imul(ah4, bh4) | 0; - lo = lo + Math.imul(al3, bl5) | 0; - mid = mid + Math.imul(al3, bh5) | 0; - mid = mid + Math.imul(ah3, bl5) | 0; - hi = hi + Math.imul(ah3, bh5) | 0; - lo = lo + Math.imul(al2, bl6) | 0; - mid = mid + Math.imul(al2, bh6) | 0; - mid = mid + Math.imul(ah2, bl6) | 0; - hi = hi + Math.imul(ah2, bh6) | 0; - lo = lo + Math.imul(al1, bl7) | 0; - mid = mid + Math.imul(al1, bh7) | 0; - mid = mid + Math.imul(ah1, bl7) | 0; - hi = hi + Math.imul(ah1, bh7) | 0; - lo = lo + Math.imul(al0, bl8) | 0; - mid = mid + Math.imul(al0, bh8) | 0; - mid = mid + Math.imul(ah0, bl8) | 0; - hi = hi + Math.imul(ah0, bh8) | 0; - var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; - w8 &= 0x3ffffff; - /* k = 9 */ - lo = Math.imul(al9, bl0); - mid = Math.imul(al9, bh0); - mid = mid + Math.imul(ah9, bl0) | 0; - hi = Math.imul(ah9, bh0); - lo = lo + Math.imul(al8, bl1) | 0; - mid = mid + Math.imul(al8, bh1) | 0; - mid = mid + Math.imul(ah8, bl1) | 0; - hi = hi + Math.imul(ah8, bh1) | 0; - lo = lo + Math.imul(al7, bl2) | 0; - mid = mid + Math.imul(al7, bh2) | 0; - mid = mid + Math.imul(ah7, bl2) | 0; - hi = hi + Math.imul(ah7, bh2) | 0; - lo = lo + Math.imul(al6, bl3) | 0; - mid = mid + Math.imul(al6, bh3) | 0; - mid = mid + Math.imul(ah6, bl3) | 0; - hi = hi + Math.imul(ah6, bh3) | 0; - lo = lo + Math.imul(al5, bl4) | 0; - mid = mid + Math.imul(al5, bh4) | 0; - mid = mid + Math.imul(ah5, bl4) | 0; - hi = hi + Math.imul(ah5, bh4) | 0; - lo = lo + Math.imul(al4, bl5) | 0; - mid = mid + Math.imul(al4, bh5) | 0; - mid = mid + Math.imul(ah4, bl5) | 0; - hi = hi + Math.imul(ah4, bh5) | 0; - lo = lo + Math.imul(al3, bl6) | 0; - mid = mid + Math.imul(al3, bh6) | 0; - mid = mid + Math.imul(ah3, bl6) | 0; - hi = hi + Math.imul(ah3, bh6) | 0; - lo = lo + Math.imul(al2, bl7) | 0; - mid = mid + Math.imul(al2, bh7) | 0; - mid = mid + Math.imul(ah2, bl7) | 0; - hi = hi + Math.imul(ah2, bh7) | 0; - lo = lo + Math.imul(al1, bl8) | 0; - mid = mid + Math.imul(al1, bh8) | 0; - mid = mid + Math.imul(ah1, bl8) | 0; - hi = hi + Math.imul(ah1, bh8) | 0; - lo = lo + Math.imul(al0, bl9) | 0; - mid = mid + Math.imul(al0, bh9) | 0; - mid = mid + Math.imul(ah0, bl9) | 0; - hi = hi + Math.imul(ah0, bh9) | 0; - var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; - w9 &= 0x3ffffff; - /* k = 10 */ - lo = Math.imul(al9, bl1); - mid = Math.imul(al9, bh1); - mid = mid + Math.imul(ah9, bl1) | 0; - hi = Math.imul(ah9, bh1); - lo = lo + Math.imul(al8, bl2) | 0; - mid = mid + Math.imul(al8, bh2) | 0; - mid = mid + Math.imul(ah8, bl2) | 0; - hi = hi + Math.imul(ah8, bh2) | 0; - lo = lo + Math.imul(al7, bl3) | 0; - mid = mid + Math.imul(al7, bh3) | 0; - mid = mid + Math.imul(ah7, bl3) | 0; - hi = hi + Math.imul(ah7, bh3) | 0; - lo = lo + Math.imul(al6, bl4) | 0; - mid = mid + Math.imul(al6, bh4) | 0; - mid = mid + Math.imul(ah6, bl4) | 0; - hi = hi + Math.imul(ah6, bh4) | 0; - lo = lo + Math.imul(al5, bl5) | 0; - mid = mid + Math.imul(al5, bh5) | 0; - mid = mid + Math.imul(ah5, bl5) | 0; - hi = hi + Math.imul(ah5, bh5) | 0; - lo = lo + Math.imul(al4, bl6) | 0; - mid = mid + Math.imul(al4, bh6) | 0; - mid = mid + Math.imul(ah4, bl6) | 0; - hi = hi + Math.imul(ah4, bh6) | 0; - lo = lo + Math.imul(al3, bl7) | 0; - mid = mid + Math.imul(al3, bh7) | 0; - mid = mid + Math.imul(ah3, bl7) | 0; - hi = hi + Math.imul(ah3, bh7) | 0; - lo = lo + Math.imul(al2, bl8) | 0; - mid = mid + Math.imul(al2, bh8) | 0; - mid = mid + Math.imul(ah2, bl8) | 0; - hi = hi + Math.imul(ah2, bh8) | 0; - lo = lo + Math.imul(al1, bl9) | 0; - mid = mid + Math.imul(al1, bh9) | 0; - mid = mid + Math.imul(ah1, bl9) | 0; - hi = hi + Math.imul(ah1, bh9) | 0; - var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; - w10 &= 0x3ffffff; - /* k = 11 */ - lo = Math.imul(al9, bl2); - mid = Math.imul(al9, bh2); - mid = mid + Math.imul(ah9, bl2) | 0; - hi = Math.imul(ah9, bh2); - lo = lo + Math.imul(al8, bl3) | 0; - mid = mid + Math.imul(al8, bh3) | 0; - mid = mid + Math.imul(ah8, bl3) | 0; - hi = hi + Math.imul(ah8, bh3) | 0; - lo = lo + Math.imul(al7, bl4) | 0; - mid = mid + Math.imul(al7, bh4) | 0; - mid = mid + Math.imul(ah7, bl4) | 0; - hi = hi + Math.imul(ah7, bh4) | 0; - lo = lo + Math.imul(al6, bl5) | 0; - mid = mid + Math.imul(al6, bh5) | 0; - mid = mid + Math.imul(ah6, bl5) | 0; - hi = hi + Math.imul(ah6, bh5) | 0; - lo = lo + Math.imul(al5, bl6) | 0; - mid = mid + Math.imul(al5, bh6) | 0; - mid = mid + Math.imul(ah5, bl6) | 0; - hi = hi + Math.imul(ah5, bh6) | 0; - lo = lo + Math.imul(al4, bl7) | 0; - mid = mid + Math.imul(al4, bh7) | 0; - mid = mid + Math.imul(ah4, bl7) | 0; - hi = hi + Math.imul(ah4, bh7) | 0; - lo = lo + Math.imul(al3, bl8) | 0; - mid = mid + Math.imul(al3, bh8) | 0; - mid = mid + Math.imul(ah3, bl8) | 0; - hi = hi + Math.imul(ah3, bh8) | 0; - lo = lo + Math.imul(al2, bl9) | 0; - mid = mid + Math.imul(al2, bh9) | 0; - mid = mid + Math.imul(ah2, bl9) | 0; - hi = hi + Math.imul(ah2, bh9) | 0; - var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; - w11 &= 0x3ffffff; - /* k = 12 */ - lo = Math.imul(al9, bl3); - mid = Math.imul(al9, bh3); - mid = mid + Math.imul(ah9, bl3) | 0; - hi = Math.imul(ah9, bh3); - lo = lo + Math.imul(al8, bl4) | 0; - mid = mid + Math.imul(al8, bh4) | 0; - mid = mid + Math.imul(ah8, bl4) | 0; - hi = hi + Math.imul(ah8, bh4) | 0; - lo = lo + Math.imul(al7, bl5) | 0; - mid = mid + Math.imul(al7, bh5) | 0; - mid = mid + Math.imul(ah7, bl5) | 0; - hi = hi + Math.imul(ah7, bh5) | 0; - lo = lo + Math.imul(al6, bl6) | 0; - mid = mid + Math.imul(al6, bh6) | 0; - mid = mid + Math.imul(ah6, bl6) | 0; - hi = hi + Math.imul(ah6, bh6) | 0; - lo = lo + Math.imul(al5, bl7) | 0; - mid = mid + Math.imul(al5, bh7) | 0; - mid = mid + Math.imul(ah5, bl7) | 0; - hi = hi + Math.imul(ah5, bh7) | 0; - lo = lo + Math.imul(al4, bl8) | 0; - mid = mid + Math.imul(al4, bh8) | 0; - mid = mid + Math.imul(ah4, bl8) | 0; - hi = hi + Math.imul(ah4, bh8) | 0; - lo = lo + Math.imul(al3, bl9) | 0; - mid = mid + Math.imul(al3, bh9) | 0; - mid = mid + Math.imul(ah3, bl9) | 0; - hi = hi + Math.imul(ah3, bh9) | 0; - var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; - w12 &= 0x3ffffff; - /* k = 13 */ - lo = Math.imul(al9, bl4); - mid = Math.imul(al9, bh4); - mid = mid + Math.imul(ah9, bl4) | 0; - hi = Math.imul(ah9, bh4); - lo = lo + Math.imul(al8, bl5) | 0; - mid = mid + Math.imul(al8, bh5) | 0; - mid = mid + Math.imul(ah8, bl5) | 0; - hi = hi + Math.imul(ah8, bh5) | 0; - lo = lo + Math.imul(al7, bl6) | 0; - mid = mid + Math.imul(al7, bh6) | 0; - mid = mid + Math.imul(ah7, bl6) | 0; - hi = hi + Math.imul(ah7, bh6) | 0; - lo = lo + Math.imul(al6, bl7) | 0; - mid = mid + Math.imul(al6, bh7) | 0; - mid = mid + Math.imul(ah6, bl7) | 0; - hi = hi + Math.imul(ah6, bh7) | 0; - lo = lo + Math.imul(al5, bl8) | 0; - mid = mid + Math.imul(al5, bh8) | 0; - mid = mid + Math.imul(ah5, bl8) | 0; - hi = hi + Math.imul(ah5, bh8) | 0; - lo = lo + Math.imul(al4, bl9) | 0; - mid = mid + Math.imul(al4, bh9) | 0; - mid = mid + Math.imul(ah4, bl9) | 0; - hi = hi + Math.imul(ah4, bh9) | 0; - var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; - w13 &= 0x3ffffff; - /* k = 14 */ - lo = Math.imul(al9, bl5); - mid = Math.imul(al9, bh5); - mid = mid + Math.imul(ah9, bl5) | 0; - hi = Math.imul(ah9, bh5); - lo = lo + Math.imul(al8, bl6) | 0; - mid = mid + Math.imul(al8, bh6) | 0; - mid = mid + Math.imul(ah8, bl6) | 0; - hi = hi + Math.imul(ah8, bh6) | 0; - lo = lo + Math.imul(al7, bl7) | 0; - mid = mid + Math.imul(al7, bh7) | 0; - mid = mid + Math.imul(ah7, bl7) | 0; - hi = hi + Math.imul(ah7, bh7) | 0; - lo = lo + Math.imul(al6, bl8) | 0; - mid = mid + Math.imul(al6, bh8) | 0; - mid = mid + Math.imul(ah6, bl8) | 0; - hi = hi + Math.imul(ah6, bh8) | 0; - lo = lo + Math.imul(al5, bl9) | 0; - mid = mid + Math.imul(al5, bh9) | 0; - mid = mid + Math.imul(ah5, bl9) | 0; - hi = hi + Math.imul(ah5, bh9) | 0; - var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; - w14 &= 0x3ffffff; - /* k = 15 */ - lo = Math.imul(al9, bl6); - mid = Math.imul(al9, bh6); - mid = mid + Math.imul(ah9, bl6) | 0; - hi = Math.imul(ah9, bh6); - lo = lo + Math.imul(al8, bl7) | 0; - mid = mid + Math.imul(al8, bh7) | 0; - mid = mid + Math.imul(ah8, bl7) | 0; - hi = hi + Math.imul(ah8, bh7) | 0; - lo = lo + Math.imul(al7, bl8) | 0; - mid = mid + Math.imul(al7, bh8) | 0; - mid = mid + Math.imul(ah7, bl8) | 0; - hi = hi + Math.imul(ah7, bh8) | 0; - lo = lo + Math.imul(al6, bl9) | 0; - mid = mid + Math.imul(al6, bh9) | 0; - mid = mid + Math.imul(ah6, bl9) | 0; - hi = hi + Math.imul(ah6, bh9) | 0; - var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; - w15 &= 0x3ffffff; - /* k = 16 */ - lo = Math.imul(al9, bl7); - mid = Math.imul(al9, bh7); - mid = mid + Math.imul(ah9, bl7) | 0; - hi = Math.imul(ah9, bh7); - lo = lo + Math.imul(al8, bl8) | 0; - mid = mid + Math.imul(al8, bh8) | 0; - mid = mid + Math.imul(ah8, bl8) | 0; - hi = hi + Math.imul(ah8, bh8) | 0; - lo = lo + Math.imul(al7, bl9) | 0; - mid = mid + Math.imul(al7, bh9) | 0; - mid = mid + Math.imul(ah7, bl9) | 0; - hi = hi + Math.imul(ah7, bh9) | 0; - var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; - w16 &= 0x3ffffff; - /* k = 17 */ - lo = Math.imul(al9, bl8); - mid = Math.imul(al9, bh8); - mid = mid + Math.imul(ah9, bl8) | 0; - hi = Math.imul(ah9, bh8); - lo = lo + Math.imul(al8, bl9) | 0; - mid = mid + Math.imul(al8, bh9) | 0; - mid = mid + Math.imul(ah8, bl9) | 0; - hi = hi + Math.imul(ah8, bh9) | 0; - var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; - w17 &= 0x3ffffff; - /* k = 18 */ - lo = Math.imul(al9, bl9); - mid = Math.imul(al9, bh9); - mid = mid + Math.imul(ah9, bl9) | 0; - hi = Math.imul(ah9, bh9); - var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; - c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; - w18 &= 0x3ffffff; - o[0] = w0; - o[1] = w1; - o[2] = w2; - o[3] = w3; - o[4] = w4; - o[5] = w5; - o[6] = w6; - o[7] = w7; - o[8] = w8; - o[9] = w9; - o[10] = w10; - o[11] = w11; - o[12] = w12; - o[13] = w13; - o[14] = w14; - o[15] = w15; - o[16] = w16; - o[17] = w17; - o[18] = w18; - if (c !== 0) { - o[19] = c; - out.length++; + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = mid + Math.imul(ah0, bl0) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = mid + Math.imul(ah1, bl0) | 0; + hi = Math.imul(ah1, bh0); + lo = lo + Math.imul(al0, bl1) | 0; + mid = mid + Math.imul(al0, bh1) | 0; + mid = mid + Math.imul(ah0, bl1) | 0; + hi = hi + Math.imul(ah0, bh1) | 0; + var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = mid + Math.imul(ah2, bl0) | 0; + hi = Math.imul(ah2, bh0); + lo = lo + Math.imul(al1, bl1) | 0; + mid = mid + Math.imul(al1, bh1) | 0; + mid = mid + Math.imul(ah1, bl1) | 0; + hi = hi + Math.imul(ah1, bh1) | 0; + lo = lo + Math.imul(al0, bl2) | 0; + mid = mid + Math.imul(al0, bh2) | 0; + mid = mid + Math.imul(ah0, bl2) | 0; + hi = hi + Math.imul(ah0, bh2) | 0; + var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = mid + Math.imul(ah3, bl0) | 0; + hi = Math.imul(ah3, bh0); + lo = lo + Math.imul(al2, bl1) | 0; + mid = mid + Math.imul(al2, bh1) | 0; + mid = mid + Math.imul(ah2, bl1) | 0; + hi = hi + Math.imul(ah2, bh1) | 0; + lo = lo + Math.imul(al1, bl2) | 0; + mid = mid + Math.imul(al1, bh2) | 0; + mid = mid + Math.imul(ah1, bl2) | 0; + hi = hi + Math.imul(ah1, bh2) | 0; + lo = lo + Math.imul(al0, bl3) | 0; + mid = mid + Math.imul(al0, bh3) | 0; + mid = mid + Math.imul(ah0, bl3) | 0; + hi = hi + Math.imul(ah0, bh3) | 0; + var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = mid + Math.imul(ah4, bl0) | 0; + hi = Math.imul(ah4, bh0); + lo = lo + Math.imul(al3, bl1) | 0; + mid = mid + Math.imul(al3, bh1) | 0; + mid = mid + Math.imul(ah3, bl1) | 0; + hi = hi + Math.imul(ah3, bh1) | 0; + lo = lo + Math.imul(al2, bl2) | 0; + mid = mid + Math.imul(al2, bh2) | 0; + mid = mid + Math.imul(ah2, bl2) | 0; + hi = hi + Math.imul(ah2, bh2) | 0; + lo = lo + Math.imul(al1, bl3) | 0; + mid = mid + Math.imul(al1, bh3) | 0; + mid = mid + Math.imul(ah1, bl3) | 0; + hi = hi + Math.imul(ah1, bh3) | 0; + lo = lo + Math.imul(al0, bl4) | 0; + mid = mid + Math.imul(al0, bh4) | 0; + mid = mid + Math.imul(ah0, bl4) | 0; + hi = hi + Math.imul(ah0, bh4) | 0; + var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = mid + Math.imul(ah5, bl0) | 0; + hi = Math.imul(ah5, bh0); + lo = lo + Math.imul(al4, bl1) | 0; + mid = mid + Math.imul(al4, bh1) | 0; + mid = mid + Math.imul(ah4, bl1) | 0; + hi = hi + Math.imul(ah4, bh1) | 0; + lo = lo + Math.imul(al3, bl2) | 0; + mid = mid + Math.imul(al3, bh2) | 0; + mid = mid + Math.imul(ah3, bl2) | 0; + hi = hi + Math.imul(ah3, bh2) | 0; + lo = lo + Math.imul(al2, bl3) | 0; + mid = mid + Math.imul(al2, bh3) | 0; + mid = mid + Math.imul(ah2, bl3) | 0; + hi = hi + Math.imul(ah2, bh3) | 0; + lo = lo + Math.imul(al1, bl4) | 0; + mid = mid + Math.imul(al1, bh4) | 0; + mid = mid + Math.imul(ah1, bl4) | 0; + hi = hi + Math.imul(ah1, bh4) | 0; + lo = lo + Math.imul(al0, bl5) | 0; + mid = mid + Math.imul(al0, bh5) | 0; + mid = mid + Math.imul(ah0, bl5) | 0; + hi = hi + Math.imul(ah0, bh5) | 0; + var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = mid + Math.imul(ah6, bl0) | 0; + hi = Math.imul(ah6, bh0); + lo = lo + Math.imul(al5, bl1) | 0; + mid = mid + Math.imul(al5, bh1) | 0; + mid = mid + Math.imul(ah5, bl1) | 0; + hi = hi + Math.imul(ah5, bh1) | 0; + lo = lo + Math.imul(al4, bl2) | 0; + mid = mid + Math.imul(al4, bh2) | 0; + mid = mid + Math.imul(ah4, bl2) | 0; + hi = hi + Math.imul(ah4, bh2) | 0; + lo = lo + Math.imul(al3, bl3) | 0; + mid = mid + Math.imul(al3, bh3) | 0; + mid = mid + Math.imul(ah3, bl3) | 0; + hi = hi + Math.imul(ah3, bh3) | 0; + lo = lo + Math.imul(al2, bl4) | 0; + mid = mid + Math.imul(al2, bh4) | 0; + mid = mid + Math.imul(ah2, bl4) | 0; + hi = hi + Math.imul(ah2, bh4) | 0; + lo = lo + Math.imul(al1, bl5) | 0; + mid = mid + Math.imul(al1, bh5) | 0; + mid = mid + Math.imul(ah1, bl5) | 0; + hi = hi + Math.imul(ah1, bh5) | 0; + lo = lo + Math.imul(al0, bl6) | 0; + mid = mid + Math.imul(al0, bh6) | 0; + mid = mid + Math.imul(ah0, bl6) | 0; + hi = hi + Math.imul(ah0, bh6) | 0; + var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = mid + Math.imul(ah7, bl0) | 0; + hi = Math.imul(ah7, bh0); + lo = lo + Math.imul(al6, bl1) | 0; + mid = mid + Math.imul(al6, bh1) | 0; + mid = mid + Math.imul(ah6, bl1) | 0; + hi = hi + Math.imul(ah6, bh1) | 0; + lo = lo + Math.imul(al5, bl2) | 0; + mid = mid + Math.imul(al5, bh2) | 0; + mid = mid + Math.imul(ah5, bl2) | 0; + hi = hi + Math.imul(ah5, bh2) | 0; + lo = lo + Math.imul(al4, bl3) | 0; + mid = mid + Math.imul(al4, bh3) | 0; + mid = mid + Math.imul(ah4, bl3) | 0; + hi = hi + Math.imul(ah4, bh3) | 0; + lo = lo + Math.imul(al3, bl4) | 0; + mid = mid + Math.imul(al3, bh4) | 0; + mid = mid + Math.imul(ah3, bl4) | 0; + hi = hi + Math.imul(ah3, bh4) | 0; + lo = lo + Math.imul(al2, bl5) | 0; + mid = mid + Math.imul(al2, bh5) | 0; + mid = mid + Math.imul(ah2, bl5) | 0; + hi = hi + Math.imul(ah2, bh5) | 0; + lo = lo + Math.imul(al1, bl6) | 0; + mid = mid + Math.imul(al1, bh6) | 0; + mid = mid + Math.imul(ah1, bl6) | 0; + hi = hi + Math.imul(ah1, bh6) | 0; + lo = lo + Math.imul(al0, bl7) | 0; + mid = mid + Math.imul(al0, bh7) | 0; + mid = mid + Math.imul(ah0, bl7) | 0; + hi = hi + Math.imul(ah0, bh7) | 0; + var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = mid + Math.imul(ah8, bl0) | 0; + hi = Math.imul(ah8, bh0); + lo = lo + Math.imul(al7, bl1) | 0; + mid = mid + Math.imul(al7, bh1) | 0; + mid = mid + Math.imul(ah7, bl1) | 0; + hi = hi + Math.imul(ah7, bh1) | 0; + lo = lo + Math.imul(al6, bl2) | 0; + mid = mid + Math.imul(al6, bh2) | 0; + mid = mid + Math.imul(ah6, bl2) | 0; + hi = hi + Math.imul(ah6, bh2) | 0; + lo = lo + Math.imul(al5, bl3) | 0; + mid = mid + Math.imul(al5, bh3) | 0; + mid = mid + Math.imul(ah5, bl3) | 0; + hi = hi + Math.imul(ah5, bh3) | 0; + lo = lo + Math.imul(al4, bl4) | 0; + mid = mid + Math.imul(al4, bh4) | 0; + mid = mid + Math.imul(ah4, bl4) | 0; + hi = hi + Math.imul(ah4, bh4) | 0; + lo = lo + Math.imul(al3, bl5) | 0; + mid = mid + Math.imul(al3, bh5) | 0; + mid = mid + Math.imul(ah3, bl5) | 0; + hi = hi + Math.imul(ah3, bh5) | 0; + lo = lo + Math.imul(al2, bl6) | 0; + mid = mid + Math.imul(al2, bh6) | 0; + mid = mid + Math.imul(ah2, bl6) | 0; + hi = hi + Math.imul(ah2, bh6) | 0; + lo = lo + Math.imul(al1, bl7) | 0; + mid = mid + Math.imul(al1, bh7) | 0; + mid = mid + Math.imul(ah1, bl7) | 0; + hi = hi + Math.imul(ah1, bh7) | 0; + lo = lo + Math.imul(al0, bl8) | 0; + mid = mid + Math.imul(al0, bh8) | 0; + mid = mid + Math.imul(ah0, bl8) | 0; + hi = hi + Math.imul(ah0, bh8) | 0; + var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = mid + Math.imul(ah9, bl0) | 0; + hi = Math.imul(ah9, bh0); + lo = lo + Math.imul(al8, bl1) | 0; + mid = mid + Math.imul(al8, bh1) | 0; + mid = mid + Math.imul(ah8, bl1) | 0; + hi = hi + Math.imul(ah8, bh1) | 0; + lo = lo + Math.imul(al7, bl2) | 0; + mid = mid + Math.imul(al7, bh2) | 0; + mid = mid + Math.imul(ah7, bl2) | 0; + hi = hi + Math.imul(ah7, bh2) | 0; + lo = lo + Math.imul(al6, bl3) | 0; + mid = mid + Math.imul(al6, bh3) | 0; + mid = mid + Math.imul(ah6, bl3) | 0; + hi = hi + Math.imul(ah6, bh3) | 0; + lo = lo + Math.imul(al5, bl4) | 0; + mid = mid + Math.imul(al5, bh4) | 0; + mid = mid + Math.imul(ah5, bl4) | 0; + hi = hi + Math.imul(ah5, bh4) | 0; + lo = lo + Math.imul(al4, bl5) | 0; + mid = mid + Math.imul(al4, bh5) | 0; + mid = mid + Math.imul(ah4, bl5) | 0; + hi = hi + Math.imul(ah4, bh5) | 0; + lo = lo + Math.imul(al3, bl6) | 0; + mid = mid + Math.imul(al3, bh6) | 0; + mid = mid + Math.imul(ah3, bl6) | 0; + hi = hi + Math.imul(ah3, bh6) | 0; + lo = lo + Math.imul(al2, bl7) | 0; + mid = mid + Math.imul(al2, bh7) | 0; + mid = mid + Math.imul(ah2, bl7) | 0; + hi = hi + Math.imul(ah2, bh7) | 0; + lo = lo + Math.imul(al1, bl8) | 0; + mid = mid + Math.imul(al1, bh8) | 0; + mid = mid + Math.imul(ah1, bl8) | 0; + hi = hi + Math.imul(ah1, bh8) | 0; + lo = lo + Math.imul(al0, bl9) | 0; + mid = mid + Math.imul(al0, bh9) | 0; + mid = mid + Math.imul(ah0, bl9) | 0; + hi = hi + Math.imul(ah0, bh9) | 0; + var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = mid + Math.imul(ah9, bl1) | 0; + hi = Math.imul(ah9, bh1); + lo = lo + Math.imul(al8, bl2) | 0; + mid = mid + Math.imul(al8, bh2) | 0; + mid = mid + Math.imul(ah8, bl2) | 0; + hi = hi + Math.imul(ah8, bh2) | 0; + lo = lo + Math.imul(al7, bl3) | 0; + mid = mid + Math.imul(al7, bh3) | 0; + mid = mid + Math.imul(ah7, bl3) | 0; + hi = hi + Math.imul(ah7, bh3) | 0; + lo = lo + Math.imul(al6, bl4) | 0; + mid = mid + Math.imul(al6, bh4) | 0; + mid = mid + Math.imul(ah6, bl4) | 0; + hi = hi + Math.imul(ah6, bh4) | 0; + lo = lo + Math.imul(al5, bl5) | 0; + mid = mid + Math.imul(al5, bh5) | 0; + mid = mid + Math.imul(ah5, bl5) | 0; + hi = hi + Math.imul(ah5, bh5) | 0; + lo = lo + Math.imul(al4, bl6) | 0; + mid = mid + Math.imul(al4, bh6) | 0; + mid = mid + Math.imul(ah4, bl6) | 0; + hi = hi + Math.imul(ah4, bh6) | 0; + lo = lo + Math.imul(al3, bl7) | 0; + mid = mid + Math.imul(al3, bh7) | 0; + mid = mid + Math.imul(ah3, bl7) | 0; + hi = hi + Math.imul(ah3, bh7) | 0; + lo = lo + Math.imul(al2, bl8) | 0; + mid = mid + Math.imul(al2, bh8) | 0; + mid = mid + Math.imul(ah2, bl8) | 0; + hi = hi + Math.imul(ah2, bh8) | 0; + lo = lo + Math.imul(al1, bl9) | 0; + mid = mid + Math.imul(al1, bh9) | 0; + mid = mid + Math.imul(ah1, bl9) | 0; + hi = hi + Math.imul(ah1, bh9) | 0; + var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = mid + Math.imul(ah9, bl2) | 0; + hi = Math.imul(ah9, bh2); + lo = lo + Math.imul(al8, bl3) | 0; + mid = mid + Math.imul(al8, bh3) | 0; + mid = mid + Math.imul(ah8, bl3) | 0; + hi = hi + Math.imul(ah8, bh3) | 0; + lo = lo + Math.imul(al7, bl4) | 0; + mid = mid + Math.imul(al7, bh4) | 0; + mid = mid + Math.imul(ah7, bl4) | 0; + hi = hi + Math.imul(ah7, bh4) | 0; + lo = lo + Math.imul(al6, bl5) | 0; + mid = mid + Math.imul(al6, bh5) | 0; + mid = mid + Math.imul(ah6, bl5) | 0; + hi = hi + Math.imul(ah6, bh5) | 0; + lo = lo + Math.imul(al5, bl6) | 0; + mid = mid + Math.imul(al5, bh6) | 0; + mid = mid + Math.imul(ah5, bl6) | 0; + hi = hi + Math.imul(ah5, bh6) | 0; + lo = lo + Math.imul(al4, bl7) | 0; + mid = mid + Math.imul(al4, bh7) | 0; + mid = mid + Math.imul(ah4, bl7) | 0; + hi = hi + Math.imul(ah4, bh7) | 0; + lo = lo + Math.imul(al3, bl8) | 0; + mid = mid + Math.imul(al3, bh8) | 0; + mid = mid + Math.imul(ah3, bl8) | 0; + hi = hi + Math.imul(ah3, bh8) | 0; + lo = lo + Math.imul(al2, bl9) | 0; + mid = mid + Math.imul(al2, bh9) | 0; + mid = mid + Math.imul(ah2, bl9) | 0; + hi = hi + Math.imul(ah2, bh9) | 0; + var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = mid + Math.imul(ah9, bl3) | 0; + hi = Math.imul(ah9, bh3); + lo = lo + Math.imul(al8, bl4) | 0; + mid = mid + Math.imul(al8, bh4) | 0; + mid = mid + Math.imul(ah8, bl4) | 0; + hi = hi + Math.imul(ah8, bh4) | 0; + lo = lo + Math.imul(al7, bl5) | 0; + mid = mid + Math.imul(al7, bh5) | 0; + mid = mid + Math.imul(ah7, bl5) | 0; + hi = hi + Math.imul(ah7, bh5) | 0; + lo = lo + Math.imul(al6, bl6) | 0; + mid = mid + Math.imul(al6, bh6) | 0; + mid = mid + Math.imul(ah6, bl6) | 0; + hi = hi + Math.imul(ah6, bh6) | 0; + lo = lo + Math.imul(al5, bl7) | 0; + mid = mid + Math.imul(al5, bh7) | 0; + mid = mid + Math.imul(ah5, bl7) | 0; + hi = hi + Math.imul(ah5, bh7) | 0; + lo = lo + Math.imul(al4, bl8) | 0; + mid = mid + Math.imul(al4, bh8) | 0; + mid = mid + Math.imul(ah4, bl8) | 0; + hi = hi + Math.imul(ah4, bh8) | 0; + lo = lo + Math.imul(al3, bl9) | 0; + mid = mid + Math.imul(al3, bh9) | 0; + mid = mid + Math.imul(ah3, bl9) | 0; + hi = hi + Math.imul(ah3, bh9) | 0; + var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = mid + Math.imul(ah9, bl4) | 0; + hi = Math.imul(ah9, bh4); + lo = lo + Math.imul(al8, bl5) | 0; + mid = mid + Math.imul(al8, bh5) | 0; + mid = mid + Math.imul(ah8, bl5) | 0; + hi = hi + Math.imul(ah8, bh5) | 0; + lo = lo + Math.imul(al7, bl6) | 0; + mid = mid + Math.imul(al7, bh6) | 0; + mid = mid + Math.imul(ah7, bl6) | 0; + hi = hi + Math.imul(ah7, bh6) | 0; + lo = lo + Math.imul(al6, bl7) | 0; + mid = mid + Math.imul(al6, bh7) | 0; + mid = mid + Math.imul(ah6, bl7) | 0; + hi = hi + Math.imul(ah6, bh7) | 0; + lo = lo + Math.imul(al5, bl8) | 0; + mid = mid + Math.imul(al5, bh8) | 0; + mid = mid + Math.imul(ah5, bl8) | 0; + hi = hi + Math.imul(ah5, bh8) | 0; + lo = lo + Math.imul(al4, bl9) | 0; + mid = mid + Math.imul(al4, bh9) | 0; + mid = mid + Math.imul(ah4, bl9) | 0; + hi = hi + Math.imul(ah4, bh9) | 0; + var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = mid + Math.imul(ah9, bl5) | 0; + hi = Math.imul(ah9, bh5); + lo = lo + Math.imul(al8, bl6) | 0; + mid = mid + Math.imul(al8, bh6) | 0; + mid = mid + Math.imul(ah8, bl6) | 0; + hi = hi + Math.imul(ah8, bh6) | 0; + lo = lo + Math.imul(al7, bl7) | 0; + mid = mid + Math.imul(al7, bh7) | 0; + mid = mid + Math.imul(ah7, bl7) | 0; + hi = hi + Math.imul(ah7, bh7) | 0; + lo = lo + Math.imul(al6, bl8) | 0; + mid = mid + Math.imul(al6, bh8) | 0; + mid = mid + Math.imul(ah6, bl8) | 0; + hi = hi + Math.imul(ah6, bh8) | 0; + lo = lo + Math.imul(al5, bl9) | 0; + mid = mid + Math.imul(al5, bh9) | 0; + mid = mid + Math.imul(ah5, bl9) | 0; + hi = hi + Math.imul(ah5, bh9) | 0; + var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = mid + Math.imul(ah9, bl6) | 0; + hi = Math.imul(ah9, bh6); + lo = lo + Math.imul(al8, bl7) | 0; + mid = mid + Math.imul(al8, bh7) | 0; + mid = mid + Math.imul(ah8, bl7) | 0; + hi = hi + Math.imul(ah8, bh7) | 0; + lo = lo + Math.imul(al7, bl8) | 0; + mid = mid + Math.imul(al7, bh8) | 0; + mid = mid + Math.imul(ah7, bl8) | 0; + hi = hi + Math.imul(ah7, bh8) | 0; + lo = lo + Math.imul(al6, bl9) | 0; + mid = mid + Math.imul(al6, bh9) | 0; + mid = mid + Math.imul(ah6, bl9) | 0; + hi = hi + Math.imul(ah6, bh9) | 0; + var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = mid + Math.imul(ah9, bl7) | 0; + hi = Math.imul(ah9, bh7); + lo = lo + Math.imul(al8, bl8) | 0; + mid = mid + Math.imul(al8, bh8) | 0; + mid = mid + Math.imul(ah8, bl8) | 0; + hi = hi + Math.imul(ah8, bh8) | 0; + lo = lo + Math.imul(al7, bl9) | 0; + mid = mid + Math.imul(al7, bh9) | 0; + mid = mid + Math.imul(ah7, bl9) | 0; + hi = hi + Math.imul(ah7, bh9) | 0; + var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = mid + Math.imul(ah9, bl8) | 0; + hi = Math.imul(ah9, bh8); + lo = lo + Math.imul(al8, bl9) | 0; + mid = mid + Math.imul(al8, bh9) | 0; + mid = mid + Math.imul(ah8, bl9) | 0; + hi = hi + Math.imul(ah8, bh9) | 0; + var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = mid + Math.imul(ah9, bl9) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo(self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = ncarry + (r / 0x4000000 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 0x3ffffff; + ncarry = ncarry + (lo >>> 26) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo(self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo(num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM(x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT(N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin(x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << l - i - 1; + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b(n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate(rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b(ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff;carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff;carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub(N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp(x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += w / 0x4000000 | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr() { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = 0x3ffffff >>> 26 - r << 26 - r; + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] | 0) - newCarry << r; + this.words[i] = c | carry; + carry = newCarry >>> 26 - r; + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln(bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - hint % 26) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = carry << 26 - r | word >>> r; + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn(bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; } - return out; + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); }; - // Polyfill comb - if (!Math.imul) { - comb10MulTo = smallMulTo; - } + BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs() { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs() { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - (right / 0x4000000 | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min(qj / bhi | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod(num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div(num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod(num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = w / num | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd(p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {} + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {} + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp(p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {} + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {} + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd(num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm(num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; + }; - function bigMulTo(self, num, out) { - out.negative = num.negative ^ self.negative; - out.length = self.length + num.length; + // And first word and num + BN.prototype.andln = function andln(num) { + return this.words[0] & num; + }; - var carry = 0; - var hncarry = 0; - for (var k = 0; k < out.length - 1; k++) { - // Sum all words with the same `i + j = k` and accumulate `ncarry`, - // note that ncarry could be >= 0x3ffffff - var ncarry = hncarry; - hncarry = 0; - var rword = carry & 0x3ffffff; - var maxJ = Math.min(k, num.length - 1); - for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { - var i = k - j; - var a = self.words[i] | 0; - var b = num.words[j] | 0; - var r = a * b; + // Increment at the bit position in-line + BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; - var lo = r & 0x3ffffff; - ncarry = ncarry + (r / 0x4000000 | 0) | 0; - lo = lo + rword | 0; - rword = lo & 0x3ffffff; - ncarry = ncarry + (lo >>> 26) | 0; + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } - hncarry += ncarry >>> 26; - ncarry &= 0x3ffffff; - } - out.words[k] = rword; - carry = ncarry; - ncarry = hncarry; + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; } if (carry !== 0) { - out.words[k] = carry; - } else { - out.length--; + this.words[i] = carry; + this.length++; } + return this; + }; - return out.strip(); - } + BN.prototype.isZero = function isZero() { + return this.length === 1 && this.words[0] === 0; + }; - function jumboMulTo(self, num, out) { - var fftm = new FFTM(); - return fftm.mulp(self, num, out); - } + BN.prototype.cmpn = function cmpn(num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); - BN.prototype.mulTo = function mulTo(num, out) { var res; - var len = this.length + num.length; - if (this.length === 10 && num.length === 10) { - res = comb10MulTo(this, num, out); - } else if (len < 63) { - res = smallMulTo(this, num, out); - } else if (len < 1024) { - res = bigMulTo(this, num, out); + if (this.length > 1) { + res = 1; } else { - res = jumboMulTo(this, num, out); + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp(num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; return res; }; - // Cooley-Tukey algorithm for FFT - // slightly revisited to rely on looping instead of recursion + // Unsigned comparison + BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; - function FFTM(x, y) { - this.x = x; - this.y = y; - } + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; - FFTM.prototype.makeRBT = function makeRBT(N) { - var t = new Array(N); - var l = BN.prototype._countBits(N) - 1; - for (var i = 0; i < N; i++) { - t[i] = this.revBin(i, l, N); + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; } + return res; + }; - return t; + BN.prototype.gtn = function gtn(num) { + return this.cmpn(num) === 1; }; - // Returns binary-reversed representation of `x` - FFTM.prototype.revBin = function revBin(x, l, N) { - if (x === 0 || x === N - 1) return x; + BN.prototype.gt = function gt(num) { + return this.cmp(num) === 1; + }; - var rb = 0; - for (var i = 0; i < l; i++) { - rb |= (x & 1) << l - i - 1; - x >>= 1; - } + BN.prototype.gten = function gten(num) { + return this.cmpn(num) >= 0; + }; - return rb; + BN.prototype.gte = function gte(num) { + return this.cmp(num) >= 0; }; - // Performs "tweedling" phase, therefore 'emulating' - // behaviour of the recursive algorithm - FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) { - for (var i = 0; i < N; i++) { - rtws[i] = rws[rbt[i]]; - itws[i] = iws[rbt[i]]; - } + BN.prototype.ltn = function ltn(num) { + return this.cmpn(num) === -1; }; - FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { - this.permute(rbt, rws, iws, rtws, itws, N); + BN.prototype.lt = function lt(num) { + return this.cmp(num) === -1; + }; - for (var s = 1; s < N; s <<= 1) { - var l = s << 1; + BN.prototype.lten = function lten(num) { + return this.cmpn(num) <= 0; + }; - var rtwdf = Math.cos(2 * Math.PI / l); - var itwdf = Math.sin(2 * Math.PI / l); + BN.prototype.lte = function lte(num) { + return this.cmp(num) <= 0; + }; - for (var p = 0; p < N; p += l) { - var rtwdf_ = rtwdf; - var itwdf_ = itwdf; + BN.prototype.eqn = function eqn(num) { + return this.cmpn(num) === 0; + }; - for (var j = 0; j < s; j++) { - var re = rtws[p + j]; - var ie = itws[p + j]; + BN.prototype.eq = function eq(num) { + return this.cmp(num) === 0; + }; - var ro = rtws[p + j + s]; - var io = itws[p + j + s]; + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red(num) { + return new Red(num); + }; - var rx = rtwdf_ * ro - itwdf_ * io; + BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; - io = rtwdf_ * io + itwdf_ * ro; - ro = rx; + BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; - rtws[p + j] = re + ro; - itws[p + j] = ie + io; + BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; + }; - rtws[p + j + s] = re - ro; - itws[p + j + s] = ie - io; + BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; - /* jshint maxdepth : false */ - if (j !== l) { - rx = rtwdf * rtwdf_ - itwdf * itwdf_; + BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; - itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; - rtwdf_ = rx; - } - } + BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; + }; + + MPrime.prototype.split = function split(input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); + }; + + function K256() { + MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split(input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = (next & mask) << 4 | prev >>> 22; + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + (lo / 0x4000000 | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; } } + return num; }; - FFTM.prototype.guessLen13b = function guessLen13b(n, m) { - var N = Math.max(m, n) | 1; - var odd = N & 1; - var i = 0; - for (N = N / 2 | 0; N; N = N >>> 1) { - i++; + function P224() { + MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192() { + MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519() { + // 2 ^ 255 - 19 + MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; } + return num; + }; - return 1 << i + 1 + odd; + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1(a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2(a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod(a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); }; - FFTM.prototype.conjugate = function conjugate(rws, iws, N) { - if (N <= 1) return; - - for (var i = 0; i < N / 2; i++) { - var t = rws[i]; + Red.prototype.neg = function neg(a) { + if (a.isZero()) { + return a.clone(); + } - rws[i] = rws[N - i - 1]; - rws[N - i - 1] = t; + return this.m.sub(a)._forceRed(this); + }; - t = iws[i]; + Red.prototype.add = function add(a, b) { + this._verify2(a, b); - iws[i] = -iws[N - i - 1]; - iws[N - i - 1] = -t; + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); } + return res._forceRed(this); }; - FFTM.prototype.normalize13b = function normalize13b(ws, N) { - var carry = 0; - for (var i = 0; i < N / 2; i++) { - var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry; - - ws[i] = w & 0x3ffffff; + Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); - if (w < 0x4000000) { - carry = 0; - } else { - carry = w / 0x4000000 | 0; - } + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); } - - return ws; + return res; }; - FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) { - var carry = 0; - for (var i = 0; i < len; i++) { - carry = carry + (ws[i] | 0); + Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); - rws[2 * i] = carry & 0x1fff;carry = carry >>> 13; - rws[2 * i + 1] = carry & 0x1fff;carry = carry >>> 13; + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); } + return res._forceRed(this); + }; - // Pad with zeroes - for (i = 2 * len; i < N; ++i) { - rws[i] = 0; + Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); } + return res; + }; - assert(carry === 0); - assert((carry & ~0x1fff) === 0); + Red.prototype.shl = function shl(a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); }; - FFTM.prototype.stub = function stub(N) { - var ph = new Array(N); - for (var i = 0; i < N; i++) { - ph[i] = 0; - } + Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; - return ph; + Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); }; - FFTM.prototype.mulp = function mulp(x, y, out) { - var N = 2 * this.guessLen13b(x.length, y.length); + Red.prototype.isqr = function isqr(a) { + return this.imul(a, a.clone()); + }; - var rbt = this.makeRBT(N); + Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); + }; - var _ = this.stub(N); + Red.prototype.sqrt = function sqrt(a) { + if (a.isZero()) return a.clone(); - var rws = new Array(N); - var rwst = new Array(N); - var iwst = new Array(N); + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); - var nrws = new Array(N); - var nrwst = new Array(N); - var niwst = new Array(N); + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } - var rmws = out.words; - rmws.length = N; + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); - this.convert13b(x.words, x.length, rws, N); - this.convert13b(y.words, y.length, nrws, N); + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); - this.transform(rws, _, rwst, iwst, N, rbt); - this.transform(nrws, _, nrwst, niwst, N, rbt); + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); - for (var i = 0; i < N; i++) { - var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; - iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; - rwst[i] = rx; + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); } - this.conjugate(rwst, iwst, N); - this.transform(rwst, iwst, rmws, _, N, rbt); - this.conjugate(rmws, _, N); - this.normalize13b(rmws, N); + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); - out.negative = x.negative ^ y.negative; - out.length = x.length + y.length; - return out.strip(); - }; + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } - // Multiply `this` by `num` - BN.prototype.mul = function mul(num) { - var out = new BN(null); - out.words = new Array(this.length + num.length); - return this.mulTo(num, out); + return r; }; - // Multiply employing FFT - BN.prototype.mulf = function mulf(num) { - var out = new BN(null); - out.words = new Array(this.length + num.length); - return jumboMulTo(this, num, out); + Red.prototype.invm = function invm(a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } }; - // In-place Multiplication - BN.prototype.imul = function imul(num) { - return this.clone().mulTo(num, this); - }; + Red.prototype.pow = function pow(a, num) { + if (num.isZero()) return new BN(1); + if (num.cmpn(1) === 0) return a.clone(); - BN.prototype.imuln = function imuln(num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } - // Carry - var carry = 0; - for (var i = 0; i < this.length; i++) { - var w = (this.words[i] | 0) * num; - var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); - carry >>= 26; - carry += w / 0x4000000 | 0; - // NOTE: lo is 27bit maximum - carry += lo >>> 26; - this.words[i] = lo & 0x3ffffff; + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; } - if (carry !== 0) { - this.words[i] = carry; - this.length++; + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = word >> j & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; } - return this; + return res; }; - BN.prototype.muln = function muln(num) { - return this.clone().imuln(num); + Red.prototype.convertTo = function convertTo(num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; }; - // `this` * `this` - BN.prototype.sqr = function sqr() { - return this.mul(this); + Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; }; - // `this` * `this` in-place - BN.prototype.isqr = function isqr() { - return this.imul(this.clone()); + // + // Montgomery method engine + // + + BN.mont = function mont(num) { + return new Mont(num); }; - // Math.pow(`this`, `num`) - BN.prototype.pow = function pow(num) { - var w = toBitArray(num); - if (w.length === 0) return new BN(1); + function Mont(m) { + Red.call(this, m); - // Skip leading zeroes - var res = this; - for (var i = 0; i < w.length; i++, res = res.sqr()) { - if (w[i] !== 0) break; + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - this.shift % 26; } - if (++i < w.length) { - for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { - if (w[i] === 0) continue; + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); - res = res.mul(q); - } - } + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); - return res; + Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.ushln(this.shift)); }; - // Shift-left in-place - BN.prototype.iushln = function iushln(bits) { - assert(typeof bits === 'number' && bits >= 0); - var r = bits % 26; - var s = (bits - r) / 26; - var carryMask = 0x3ffffff >>> 26 - r << 26 - r; - var i; + Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; - if (r !== 0) { - var carry = 0; + Mont.prototype.imul = function imul(a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } - for (i = 0; i < this.length; i++) { - var newCarry = this.words[i] & carryMask; - var c = (this.words[i] | 0) - newCarry << r; - this.words[i] = c | carry; - carry = newCarry >>> 26 - r; - } + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; - if (carry) { - this.words[i] = carry; - this.length++; - } + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); } - if (s !== 0) { - for (i = this.length - 1; i >= 0; i--) { - this.words[i + s] = this.words[i]; - } + return res._forceRed(this); + }; - for (i = 0; i < s; i++) { - this.words[i] = 0; - } + Mont.prototype.mul = function mul(a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); - this.length += s; + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); } - return this.strip(); + return res._forceRed(this); }; - BN.prototype.ishln = function ishln(bits) { - // TODO(indutny): implement me - assert(this.negative === 0); - return this.iushln(bits); + Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); }; + })(typeof module === 'undefined' || module, this); + }, {}], 231: [function (require, module, exports) { + /** + * Returns a `Boolean` on whether or not the a `String` starts with '0x' + * @param {String} str the string input value + * @return {Boolean} a boolean if it is or is not hex prefixed + * @throws if the str input is not a string + */ + module.exports = function isHexPrefixed(str) { + if (typeof str !== 'string') { + throw new Error("[is-hex-prefixed] value must be type 'string', is currently type " + (typeof str === "undefined" ? "undefined" : _typeof(str)) + ", while checking isHexPrefixed."); + } - // Shift-right in-place - // NOTE: `hint` is a lowest bit before trailing zeroes - // NOTE: if `extended` is present - it will be filled with destroyed bits - BN.prototype.iushrn = function iushrn(bits, hint, extended) { - assert(typeof bits === 'number' && bits >= 0); - var h; - if (hint) { - h = (hint - hint % 26) / 26; - } else { - h = 0; - } - - var r = bits % 26; - var s = Math.min((bits - r) / 26, this.length); - var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; - var maskedWords = extended; + return str.slice(0, 2) === '0x'; + }; + }, {}], 232: [function (require, module, exports) { + (function (process, global) { + /** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.5.7 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2016 + * @license MIT + */ + /*jslint bitwise: true */ + (function () { + 'use strict'; + + var root = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object' ? window : {}; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process.versions && process.versions.node; + if (NODE_JS) { + root = global; + } + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && (typeof module === "undefined" ? "undefined" : _typeof(module)) === 'object' && module.exports; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array']; + + var createOutputMethod = function createOutputMethod(bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; - h -= s; - h = Math.max(0, h); + var createShakeOutputMethod = function createShakeOutputMethod(bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; - // Extended mode, copy masked part - if (maskedWords) { - for (var i = 0; i < s; i++) { - maskedWords.words[i] = this.words[i]; + var createMethod = function createMethod(bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + method.create = function () { + return new Keccak(bits, padding, bits); + }; + method.update = function (message) { + return method.create().update(message); + }; + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createOutputMethod(bits, padding, type); } - maskedWords.length = s; - } + return method; + }; - if (s === 0) { - // No-op, we should not move anything at all - } else if (this.length > s) { - this.length -= s; - for (i = 0; i < this.length; i++) { - this.words[i] = this.words[i + s]; + var createShakeMethod = function createShakeMethod(bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createShakeOutputMethod(bits, padding, type); } - } else { - this.words[0] = 0; - this.length = 1; - } - - var carry = 0; - for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { - var word = this.words[i] | 0; - this.words[i] = carry << 26 - r | word >>> r; - carry = word & mask; - } - - // Push carried bits as a mask - if (maskedWords && carry !== 0) { - maskedWords.words[maskedWords.length++] = carry; - } - - if (this.length === 0) { - this.words[0] = 0; - this.length = 1; - } - - return this.strip(); - }; + return method; + }; - BN.prototype.ishrn = function ishrn(bits, hint, extended) { - // TODO(indutny): implement me - assert(this.negative === 0); - return this.iushrn(bits, hint, extended); - }; + var algorithms = [{ name: 'keccak', padding: KECCAK_PADDING, bits: BITS, createMethod: createMethod }, { name: 'sha3', padding: PADDING, bits: BITS, createMethod: createMethod }, { name: 'shake', padding: SHAKE_PADDING, bits: SHAKE_BITS, createMethod: createShakeMethod }]; + + var methods = {}, + methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + } + } + + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.block = 0; + this.start = 0; + this.blockCount = 1600 - (bits << 1) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } + + Keccak.prototype.update = function (message) { + var notString = typeof message !== 'string'; + if (notString && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } + var length = message.length, + blocks = this.blocks, + byteCount = this.byteCount, + blockCount = this.blockCount, + index = 0, + s = this.s, + i, + code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | code >> 6) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | code >> 12) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + ((code & 0x3ff) << 10 | message.charCodeAt(++index) & 0x3ff); + blocks[i >> 2] |= (0xf0 | code >> 18) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code >> 12 & 0x3f) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3]; + } + } + } + this.lastByteIndex = i; + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + this.reset = true; + } else { + this.start = i; + } + } + return this; + }; - // Shift-left - BN.prototype.shln = function shln(bits) { - return this.clone().ishln(bits); - }; + Keccak.prototype.finalize = function () { + var blocks = this.blocks, + i = this.lastByteIndex, + blockCount = this.blockCount, + s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + blocks[blockCount - 1] |= 0x80000000; + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + f(s); + }; - BN.prototype.ushln = function ushln(bits) { - return this.clone().iushln(bits); - }; + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); - // Shift-right - BN.prototype.shrn = function shrn(bits) { - return this.clone().ishrn(bits); - }; + var blockCount = this.blockCount, + s = this.s, + outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, + i = 0, + j = 0; + var hex = '', + block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[block >> 4 & 0x0F] + HEX_CHARS[block & 0x0F] + HEX_CHARS[block >> 12 & 0x0F] + HEX_CHARS[block >> 8 & 0x0F] + HEX_CHARS[block >> 20 & 0x0F] + HEX_CHARS[block >> 16 & 0x0F] + HEX_CHARS[block >> 28 & 0x0F] + HEX_CHARS[block >> 24 & 0x0F]; + } + if (j % blockCount === 0) { + f(s); + i = 0; + } + } + if (extraBytes) { + block = s[i]; + if (extraBytes > 0) { + hex += HEX_CHARS[block >> 4 & 0x0F] + HEX_CHARS[block & 0x0F]; + } + if (extraBytes > 1) { + hex += HEX_CHARS[block >> 12 & 0x0F] + HEX_CHARS[block >> 8 & 0x0F]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[block >> 20 & 0x0F] + HEX_CHARS[block >> 16 & 0x0F]; + } + } + return hex; + }; - BN.prototype.ushrn = function ushrn(bits) { - return this.clone().iushrn(bits); - }; + Keccak.prototype.arrayBuffer = function () { + this.finalize(); - // Test if n bit is set - BN.prototype.testn = function testn(bit) { - assert(typeof bit === 'number' && bit >= 0); - var r = bit % 26; - var s = (bit - r) / 26; - var q = 1 << r; + var blockCount = this.blockCount, + s = this.s, + outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, + i = 0, + j = 0; + var bytes = this.outputBits >> 3; + var buffer; + if (extraBytes) { + buffer = new ArrayBuffer(outputBlocks + 1 << 2); + } else { + buffer = new ArrayBuffer(bytes); + } + var array = new Uint32Array(buffer); + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); + } + return buffer; + }; - // Fast case: bit is much higher than all existing words - if (this.length <= s) return false; + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; - // Check bit and return - var w = this.words[s]; + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); - return !!(w & q); - }; + var blockCount = this.blockCount, + s = this.s, + outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, + i = 0, + j = 0; + var array = [], + offset, + block; + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = block >> 8 & 0xFF; + array[offset + 2] = block >> 16 & 0xFF; + array[offset + 3] = block >> 24 & 0xFF; + } + if (j % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j << 2; + block = s[i]; + if (extraBytes > 0) { + array[offset] = block & 0xFF; + } + if (extraBytes > 1) { + array[offset + 1] = block >> 8 & 0xFF; + } + if (extraBytes > 2) { + array[offset + 2] = block >> 16 & 0xFF; + } + } + return array; + }; - // Return only lowers bits of number (in-place) - BN.prototype.imaskn = function imaskn(bits) { - assert(typeof bits === 'number' && bits >= 0); - var r = bits % 26; - var s = (bits - r) / 26; + var f = function f(s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + + h = c8 ^ (c2 << 1 | c3 >>> 31); + l = c9 ^ (c3 << 1 | c2 >>> 31); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ (c4 << 1 | c5 >>> 31); + l = c1 ^ (c5 << 1 | c4 >>> 31); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ (c6 << 1 | c7 >>> 31); + l = c3 ^ (c7 << 1 | c6 >>> 31); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ (c8 << 1 | c9 >>> 31); + l = c5 ^ (c9 << 1 | c8 >>> 31); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ (c0 << 1 | c1 >>> 31); + l = c7 ^ (c1 << 1 | c0 >>> 31); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + + b0 = s[0]; + b1 = s[1]; + b32 = s[11] << 4 | s[10] >>> 28; + b33 = s[10] << 4 | s[11] >>> 28; + b14 = s[20] << 3 | s[21] >>> 29; + b15 = s[21] << 3 | s[20] >>> 29; + b46 = s[31] << 9 | s[30] >>> 23; + b47 = s[30] << 9 | s[31] >>> 23; + b28 = s[40] << 18 | s[41] >>> 14; + b29 = s[41] << 18 | s[40] >>> 14; + b20 = s[2] << 1 | s[3] >>> 31; + b21 = s[3] << 1 | s[2] >>> 31; + b2 = s[13] << 12 | s[12] >>> 20; + b3 = s[12] << 12 | s[13] >>> 20; + b34 = s[22] << 10 | s[23] >>> 22; + b35 = s[23] << 10 | s[22] >>> 22; + b16 = s[33] << 13 | s[32] >>> 19; + b17 = s[32] << 13 | s[33] >>> 19; + b48 = s[42] << 2 | s[43] >>> 30; + b49 = s[43] << 2 | s[42] >>> 30; + b40 = s[5] << 30 | s[4] >>> 2; + b41 = s[4] << 30 | s[5] >>> 2; + b22 = s[14] << 6 | s[15] >>> 26; + b23 = s[15] << 6 | s[14] >>> 26; + b4 = s[25] << 11 | s[24] >>> 21; + b5 = s[24] << 11 | s[25] >>> 21; + b36 = s[34] << 15 | s[35] >>> 17; + b37 = s[35] << 15 | s[34] >>> 17; + b18 = s[45] << 29 | s[44] >>> 3; + b19 = s[44] << 29 | s[45] >>> 3; + b10 = s[6] << 28 | s[7] >>> 4; + b11 = s[7] << 28 | s[6] >>> 4; + b42 = s[17] << 23 | s[16] >>> 9; + b43 = s[16] << 23 | s[17] >>> 9; + b24 = s[26] << 25 | s[27] >>> 7; + b25 = s[27] << 25 | s[26] >>> 7; + b6 = s[36] << 21 | s[37] >>> 11; + b7 = s[37] << 21 | s[36] >>> 11; + b38 = s[47] << 24 | s[46] >>> 8; + b39 = s[46] << 24 | s[47] >>> 8; + b30 = s[8] << 27 | s[9] >>> 5; + b31 = s[9] << 27 | s[8] >>> 5; + b12 = s[18] << 20 | s[19] >>> 12; + b13 = s[19] << 20 | s[18] >>> 12; + b44 = s[29] << 7 | s[28] >>> 25; + b45 = s[28] << 7 | s[29] >>> 25; + b26 = s[38] << 8 | s[39] >>> 24; + b27 = s[39] << 8 | s[38] >>> 24; + b8 = s[48] << 14 | s[49] >>> 18; + b9 = s[49] << 14 | s[48] >>> 18; + + s[0] = b0 ^ ~b2 & b4; + s[1] = b1 ^ ~b3 & b5; + s[10] = b10 ^ ~b12 & b14; + s[11] = b11 ^ ~b13 & b15; + s[20] = b20 ^ ~b22 & b24; + s[21] = b21 ^ ~b23 & b25; + s[30] = b30 ^ ~b32 & b34; + s[31] = b31 ^ ~b33 & b35; + s[40] = b40 ^ ~b42 & b44; + s[41] = b41 ^ ~b43 & b45; + s[2] = b2 ^ ~b4 & b6; + s[3] = b3 ^ ~b5 & b7; + s[12] = b12 ^ ~b14 & b16; + s[13] = b13 ^ ~b15 & b17; + s[22] = b22 ^ ~b24 & b26; + s[23] = b23 ^ ~b25 & b27; + s[32] = b32 ^ ~b34 & b36; + s[33] = b33 ^ ~b35 & b37; + s[42] = b42 ^ ~b44 & b46; + s[43] = b43 ^ ~b45 & b47; + s[4] = b4 ^ ~b6 & b8; + s[5] = b5 ^ ~b7 & b9; + s[14] = b14 ^ ~b16 & b18; + s[15] = b15 ^ ~b17 & b19; + s[24] = b24 ^ ~b26 & b28; + s[25] = b25 ^ ~b27 & b29; + s[34] = b34 ^ ~b36 & b38; + s[35] = b35 ^ ~b37 & b39; + s[44] = b44 ^ ~b46 & b48; + s[45] = b45 ^ ~b47 & b49; + s[6] = b6 ^ ~b8 & b0; + s[7] = b7 ^ ~b9 & b1; + s[16] = b16 ^ ~b18 & b10; + s[17] = b17 ^ ~b19 & b11; + s[26] = b26 ^ ~b28 & b20; + s[27] = b27 ^ ~b29 & b21; + s[36] = b36 ^ ~b38 & b30; + s[37] = b37 ^ ~b39 & b31; + s[46] = b46 ^ ~b48 & b40; + s[47] = b47 ^ ~b49 & b41; + s[8] = b8 ^ ~b0 & b2; + s[9] = b9 ^ ~b1 & b3; + s[18] = b18 ^ ~b10 & b12; + s[19] = b19 ^ ~b11 & b13; + s[28] = b28 ^ ~b20 & b22; + s[29] = b29 ^ ~b21 & b23; + s[38] = b38 ^ ~b30 & b32; + s[39] = b39 ^ ~b31 & b33; + s[48] = b48 ^ ~b40 & b42; + s[49] = b49 ^ ~b41 & b43; + + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; - assert(this.negative === 0, 'imaskn works only with positive numbers'); + if (COMMON_JS) { + module.exports = methods; + } else { + for (var i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + } + })(); + }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); + }, { "_process": 121 }], 233: [function (require, module, exports) { + arguments[4][230][0].apply(exports, arguments); + }, { "dup": 230 }], 234: [function (require, module, exports) { + var BN = require('bn.js'); + var stripHexPrefix = require('strip-hex-prefix'); - if (this.length <= s) { - return this; + /** + * Returns a BN object, converts a number value to a BN + * @param {String|Number|Object} `arg` input a string number, hex string number, number, BigNumber or BN object + * @return {Object} `output` BN object of the number + * @throws if the argument is not an array, object that isn't a bignumber, not a string number or number + */ + module.exports = function numberToBN(arg) { + if (typeof arg === 'string' || typeof arg === 'number') { + var multiplier = new BN(1); // eslint-disable-line + var formattedString = String(arg).toLowerCase().trim(); + var isHexPrefixed = formattedString.substr(0, 2) === '0x' || formattedString.substr(0, 3) === '-0x'; + var stringArg = stripHexPrefix(formattedString); // eslint-disable-line + if (stringArg.substr(0, 1) === '-') { + stringArg = stripHexPrefix(stringArg.slice(1)); + multiplier = new BN(-1, 10); } + stringArg = stringArg === '' ? '0' : stringArg; - if (r !== 0) { - s++; + if (!stringArg.match(/^-?[0-9]+$/) && stringArg.match(/^[0-9A-Fa-f]+$/) || stringArg.match(/^[a-fA-F]+$/) || isHexPrefixed === true && stringArg.match(/^[0-9A-Fa-f]+$/)) { + return new BN(stringArg, 16).mul(multiplier); } - this.length = Math.min(s, this.length); - if (r !== 0) { - var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; - this.words[this.length - 1] &= mask; + if ((stringArg.match(/^-?[0-9]+$/) || stringArg === '') && isHexPrefixed === false) { + return new BN(stringArg, 10).mul(multiplier); + } + } else if ((typeof arg === "undefined" ? "undefined" : _typeof(arg)) === 'object' && arg.toString && !arg.pop && !arg.push) { + if (arg.toString(10).match(/^-?[0-9]+$/) && (arg.mul || arg.dividedToIntegerBy)) { + return new BN(arg.toString(10), 10); } + } - return this.strip(); - }; + throw new Error('[number-to-bn] while converting number ' + JSON.stringify(arg) + ' to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.'); + }; + }, { "bn.js": 233, "strip-hex-prefix": 238 }], 235: [function (require, module, exports) { + module.exports = window.crypto; + }, {}], 236: [function (require, module, exports) { + module.exports = require('crypto'); + }, { "crypto": 235 }], 237: [function (require, module, exports) { + var randomHex = function randomHex(size, callback) { + var crypto = require('./crypto.js'); + var isCallback = typeof callback === 'function'; - // Return only lowers bits of number - BN.prototype.maskn = function maskn(bits) { - return this.clone().imaskn(bits); + if (size > 65536) { + if (isCallback) { + callback(new Error('Requested too many random bytes.')); + } else { + throw new Error('Requested too many random bytes.'); + } }; - // Add plain number `num` to `this` - BN.prototype.iaddn = function iaddn(num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - if (num < 0) return this.isubn(-num); - - // Possible sign change - if (this.negative !== 0) { - if (this.length === 1 && (this.words[0] | 0) < num) { - this.words[0] = num - (this.words[0] | 0); - this.negative = 0; - return this; - } + // is node + if (typeof crypto !== 'undefined' && crypto.randomBytes) { - this.negative = 0; - this.isubn(num); - this.negative = 1; - return this; + if (isCallback) { + crypto.randomBytes(size, function (err, result) { + if (!err) { + callback(null, '0x' + result.toString('hex')); + } else { + callback(error); + } + }); + } else { + return '0x' + crypto.randomBytes(size).toString('hex'); } - // Add without checks - return this._iaddn(num); - }; + // is browser + } else { + var cryptoLib; - BN.prototype._iaddn = function _iaddn(num) { - this.words[0] += num; + if (typeof crypto !== 'undefined') { + cryptoLib = crypto; + } else if (typeof msCrypto !== 'undefined') { + cryptoLib = msCrypto; + } - // Carry - for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { - this.words[i] -= 0x4000000; - if (i === this.length - 1) { - this.words[i + 1] = 1; + if (cryptoLib && cryptoLib.getRandomValues) { + var randomBytes = cryptoLib.getRandomValues(new Uint8Array(size)); + var returnValue = '0x' + Array.from(randomBytes).map(function (arr) { + return arr.toString(16); + }).join(''); + + if (isCallback) { + callback(null, returnValue); } else { - this.words[i + 1]++; + return returnValue; } - } - this.length = Math.max(this.length, i + 1); - - return this; - }; - // Subtract plain number `num` from `this` - BN.prototype.isubn = function isubn(num) { - assert(typeof num === 'number'); - assert(num < 0x4000000); - if (num < 0) return this.iaddn(-num); + // not crypto object + } else { + var error = new Error('No "crypto" object available. This Browser doesn\'t support generating secure random bytes.'); - if (this.negative !== 0) { - this.negative = 0; - this.iaddn(num); - this.negative = 1; - return this; + if (isCallback) { + callback(error); + } else { + throw error; + } } + } + }; - this.words[0] -= num; + module.exports = randomHex; + }, { "./crypto.js": 236 }], 238: [function (require, module, exports) { + var isHexPrefixed = require('is-hex-prefixed'); - if (this.length === 1 && this.words[0] < 0) { - this.words[0] = -this.words[0]; - this.negative = 1; - } else { - // Carry - for (var i = 0; i < this.length && this.words[i] < 0; i++) { - this.words[i] += 0x4000000; - this.words[i + 1] -= 1; - } - } + /** + * Removes '0x' from a given `String` is present + * @param {String} str the string value + * @return {String|Optional} a string by pass if necessary + */ + module.exports = function stripHexPrefix(str) { + if (typeof str !== 'string') { + return str; + } - return this.strip(); - }; + return isHexPrefixed(str) ? str.slice(2) : str; + }; + }, { "is-hex-prefixed": 231 }], 239: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 240: [function (require, module, exports) { + (function (global) { + /*! https://mths.be/utf8js v2.0.0 by @mathias */ + ;(function (root) { - BN.prototype.addn = function addn(num) { - return this.clone().iaddn(num); - }; + // Detect free variables `exports` + var freeExports = (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == 'object' && exports; - BN.prototype.subn = function subn(num) { - return this.clone().isubn(num); - }; + // Detect free variable `module` + var freeModule = (typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object' && module && module.exports == freeExports && module; - BN.prototype.iabs = function iabs() { - this.negative = 0; + // Detect free variable `global`, from Node.js or Browserified code, + // and use it as `root` + var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof(global)) == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; + } - return this; - }; + /*--------------------------------------------------------------------------*/ - BN.prototype.abs = function abs() { - return this.clone().iabs(); - }; + var stringFromCharCode = String.fromCharCode; - BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { - var len = num.length + shift; - var i; + // Taken from https://mths.be/punycode + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var 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; + } - this._expand(len); + // Taken from https://mths.be/punycode + function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; + } - var w; - var carry = 0; - for (i = 0; i < num.length; i++) { - w = (this.words[i + shift] | 0) + carry; - var right = (num.words[i] | 0) * mul; - w -= right & 0x3ffffff; - carry = (w >> 26) - (right / 0x4000000 | 0); - this.words[i + shift] = w & 0x3ffffff; + function checkScalarValue(codePoint) { + if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { + throw Error('Lone surrogate U+' + codePoint.toString(16).toUpperCase() + ' is not a scalar value'); + } } - for (; i < this.length - shift; i++) { - w = (this.words[i + shift] | 0) + carry; - carry = w >> 26; - this.words[i + shift] = w & 0x3ffffff; + /*--------------------------------------------------------------------------*/ + + function createByte(codePoint, shift) { + return stringFromCharCode(codePoint >> shift & 0x3F | 0x80); } - if (carry === 0) return this.strip(); + function encodeCodePoint(codePoint) { + if ((codePoint & 0xFFFFFF80) == 0) { + // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { + // 2-byte sequence + symbol = stringFromCharCode(codePoint >> 6 & 0x1F | 0xC0); + } else if ((codePoint & 0xFFFF0000) == 0) { + // 3-byte sequence + checkScalarValue(codePoint); + symbol = stringFromCharCode(codePoint >> 12 & 0x0F | 0xE0); + symbol += createByte(codePoint, 6); + } else if ((codePoint & 0xFFE00000) == 0) { + // 4-byte sequence + symbol = stringFromCharCode(codePoint >> 18 & 0x07 | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode(codePoint & 0x3F | 0x80); + return symbol; + } - // Subtraction overflow - assert(carry === -1); - carry = 0; - for (i = 0; i < this.length; i++) { - w = -(this.words[i] | 0) + carry; - carry = w >> 26; - this.words[i] = w & 0x3ffffff; + function utf8encode(string) { + var codePoints = ucs2decode(string); + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint); + } + return byteString; } - this.negative = 1; - return this.strip(); - }; + /*--------------------------------------------------------------------------*/ - BN.prototype._wordDiv = function _wordDiv(num, mode) { - var shift = this.length - num.length; + function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } - var a = this.clone(); - var b = num; + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; - // Normalize - var bhi = b.words[b.length - 1] | 0; - var bhiBits = this._countBits(bhi); - shift = 26 - bhiBits; - if (shift !== 0) { - b = b.ushln(shift); - a.iushln(shift); - bhi = b.words[b.length - 1] | 0; + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } + + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); } - // Initialize quotient - var m = a.length - b.length; - var q; + function decodeSymbol() { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; - if (mode !== 'mod') { - q = new BN(null); - q.length = m + 1; - q.words = new Array(q.length); - for (var i = 0; i < q.length; i++) { - q.words[i] = 0; + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); } - } - var diff = a.clone()._ishlnsubmul(b, 1, m); - if (diff.negative === 0) { - a = diff; - if (q) { - q.words[m] = 1; + if (byteIndex == byteCount) { + return false; } - } - for (var j = m - 1; j >= 0; j--) { - var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; - // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max - // (0x7ffffff) - qj = Math.min(qj / bhi | 0, 0x3ffffff); + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } - a._ishlnsubmul(b, qj, j); - while (a.negative !== 0) { - qj--; - a.negative = 0; - a._ishlnsubmul(b, 1, j); - if (!a.isZero()) { - a.negative ^= 1; + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + var byte2 = readContinuationByte(); + codePoint = (byte1 & 0x1F) << 6 | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); } } - if (q) { - q.words[j] = qj; + + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = (byte1 & 0x0F) << 12 | byte2 << 6 | byte3; + if (codePoint >= 0x0800) { + checkScalarValue(codePoint); + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } } + + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = (byte1 & 0x0F) << 0x12 | byte2 << 0x0C | byte3 << 0x06 | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } + + throw Error('Invalid UTF-8 detected'); } - if (q) { - q.strip(); - } - a.strip(); - // Denormalize - if (mode !== 'div' && shift !== 0) { - a.iushrn(shift); + var byteArray; + var byteCount; + var byteIndex; + function utf8decode(byteString) { + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol()) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); } - return { - div: q || null, - mod: a - }; - }; + /*--------------------------------------------------------------------------*/ - // NOTE: 1) `mode` can be set to `mod` to request mod only, - // to `div` to request div only, or be absent to - // request both div & mod - // 2) `positive` is true if unsigned mod is requested - BN.prototype.divmod = function divmod(num, mode, positive) { - assert(!num.isZero()); + var utf8 = { + 'version': '2.0.0', + 'encode': utf8encode, + 'decode': utf8decode + }; - if (this.isZero()) { - return { - div: new BN(0), - mod: new BN(0) - }; + // 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(function () { + return utf8; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { + // in Node.js or RingoJS v0.8.0+ + freeModule.exports = utf8; + } else { + // in Narwhal or RingoJS v0.7.0- + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + for (var key in utf8) { + hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); + } + } + } else { + // in Rhino or a web browser + root.utf8 = utf8; } + })(this); + }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); + }, {}], 241: [function (require, module, exports) { + arguments[4][230][0].apply(exports, arguments); + }, { "dup": 230 }], 242: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** + * @file utils.js + * @author Marek Kotewicz + * @author Fabian Vogelsteller + * @date 2017 + */ - var div, mod, res; - if (this.negative !== 0 && num.negative === 0) { - res = this.neg().divmod(num, mode); - - if (mode !== 'mod') { - div = res.div.neg(); - } + var _ = require('underscore'); + var ethjsUnit = require('ethjs-unit'); + var utils = require('./utils.js'); + var soliditySha3 = require('./soliditySha3.js'); + var randomHex = require('randomhex'); - if (mode !== 'div') { - mod = res.mod.neg(); - if (positive && mod.negative !== 0) { - mod.iadd(num); - } - } + /** + * Fires an error in an event emitter and callback and returns the eventemitter + * + * @method _fireError + * @param {Object} error a string, a error, or an object with {message, data} + * @param {Object} emitter + * @param {Function} reject + * @param {Function} callback + * @return {Object} the emitter + */ + var _fireError = function _fireError(error, emitter, reject, callback) { + /*jshint maxcomplexity: 10 */ - return { - div: div, - mod: mod - }; + // add data if given + if (_.isObject(error) && !(error instanceof Error) && error.data) { + if (_.isObject(error.data) || _.isArray(error.data)) { + error.data = JSON.stringify(error.data, null, 2); } - if (this.negative === 0 && num.negative !== 0) { - res = this.divmod(num.neg(), mode); + error = error.message + "\n" + error.data; + } - if (mode !== 'mod') { - div = res.div.neg(); - } + if (_.isString(error)) { + error = new Error(error); + } - return { - div: div, - mod: res.mod - }; + if (_.isFunction(callback)) { + callback(error); + } + if (_.isFunction(reject)) { + // suppress uncatched error if an error listener is present + // OR suppress uncatched error if an callback listener is present + if (emitter && _.isFunction(emitter.listeners) && emitter.listeners('error').length || _.isFunction(callback)) { + emitter.catch(function () {}); } + // reject later, to be able to return emitter + setTimeout(function () { + reject(error); + }, 1); + } - if ((this.negative & num.negative) !== 0) { - res = this.neg().divmod(num.neg(), mode); + if (emitter && _.isFunction(emitter.emit)) { + // emit later, to be able to return emitter + setTimeout(function () { + emitter.emit('error', error); + emitter.removeAllListeners(); + }, 1); + } - if (mode !== 'div') { - mod = res.mod.neg(); - if (positive && mod.negative !== 0) { - mod.isub(num); - } - } + return emitter; + }; - return { - div: res.div, - mod: mod - }; - } + /** + * Should be used to create full function/event name from json abi + * + * @method _jsonInterfaceMethodToString + * @param {Object} json + * @return {String} full function/event name + */ + var _jsonInterfaceMethodToString = function _jsonInterfaceMethodToString(json) { + if (_.isObject(json) && json.name && json.name.indexOf('(') !== -1) { + return json.name; + } - // Both numbers are positive at this point + var typeName = json.inputs.map(function (i) { + return i.type; + }).join(','); + return json.name + '(' + typeName + ')'; + }; - // Strip both numbers to approximate shift value - if (num.length > this.length || this.cmp(num) < 0) { - return { - div: new BN(0), - mod: this - }; - } + /** + * Should be called to get ascii from it's hex representation + * + * @method hexToAscii + * @param {String} hex + * @returns {String} ascii string representation of hex value + */ + var hexToAscii = function hexToAscii(hex) { + if (!utils.isHexStrict(hex)) throw new Error('The parameter must be a valid HEX string.'); - // Very short reduction - if (num.length === 1) { - if (mode === 'div') { - return { - div: this.divn(num.words[0]), - mod: null - }; - } + var str = ""; + var i = 0, + l = hex.length; + if (hex.substring(0, 2) === '0x') { + i = 2; + } + for (; i < l; i += 2) { + var code = parseInt(hex.substr(i, 2), 16); + str += String.fromCharCode(code); + } - if (mode === 'mod') { - return { - div: null, - mod: new BN(this.modn(num.words[0])) - }; - } + return str; + }; - return { - div: this.divn(num.words[0]), - mod: new BN(this.modn(num.words[0])) - }; - } + /** + * Should be called to get hex representation (prefixed by 0x) of ascii string + * + * @method asciiToHex + * @param {String} str + * @returns {String} hex representation of input string + */ + var asciiToHex = function asciiToHex(str) { + if (!str) return "0x00"; + var hex = ""; + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + var n = code.toString(16); + hex += n.length < 2 ? '0' + n : n; + } - return this._wordDiv(num, mode); - }; + return "0x" + hex; + }; - // Find `this` / `num` - BN.prototype.div = function div(num) { - return this.divmod(num, 'div', false).div; - }; + /** + * Returns value of unit in Wei + * + * @method getUnitValue + * @param {String} unit the unit to convert to, default ether + * @returns {BN} value of the unit (in Wei) + * @throws error if the unit is not correct:w + */ + var getUnitValue = function getUnitValue(unit) { + unit = unit ? unit.toLowerCase() : 'ether'; + if (!ethjsUnit.unitMap[unit]) { + throw new Error('This unit "' + unit + '" doesn\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2)); + } + return unit; + }; - // Find `this` % `num` - BN.prototype.mod = function mod(num) { - return this.divmod(num, 'mod', false).mod; - }; + /** + * Takes a number of wei and converts it to any other ether unit. + * + * Possible units are: + * SI Short SI Full Effigy Other + * - kwei femtoether babbage + * - mwei picoether lovelace + * - gwei nanoether shannon nano + * - -- microether szabo micro + * - -- milliether finney milli + * - ether -- -- + * - kether -- grand + * - mether + * - gether + * - tether + * + * @method fromWei + * @param {Number|String} number can be a number, number string or a HEX of a decimal + * @param {String} unit the unit to convert to, default ether + * @return {String|Object} When given a BN object it returns one as well, otherwise a number + */ + var fromWei = function fromWei(number, unit) { + unit = getUnitValue(unit); - BN.prototype.umod = function umod(num) { - return this.divmod(num, 'mod', true).mod; - }; + if (!utils.isBN(number) && !_.isString(number)) { + throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); + } - // Find Round(`this` / `num`) - BN.prototype.divRound = function divRound(num) { - var dm = this.divmod(num); + return utils.isBN(number) ? ethjsUnit.fromWei(number, unit) : ethjsUnit.fromWei(number, unit).toString(10); + }; - // Fast case - exact division - if (dm.mod.isZero()) return dm.div; + /** + * Takes a number of a unit and converts it to wei. + * + * Possible units are: + * SI Short SI Full Effigy Other + * - kwei femtoether babbage + * - mwei picoether lovelace + * - gwei nanoether shannon nano + * - -- microether szabo micro + * - -- microether szabo micro + * - -- milliether finney milli + * - ether -- -- + * - kether -- grand + * - mether + * - gether + * - tether + * + * @method toWei + * @param {Number|String|BN} number can be a number, number string or a HEX of a decimal + * @param {String} unit the unit to convert from, default ether + * @return {String|Object} When given a BN object it returns one as well, otherwise a number + */ + var toWei = function toWei(number, unit) { + unit = getUnitValue(unit); - var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + if (!utils.isBN(number) && !_.isString(number)) { + throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); + } - var half = num.ushrn(1); - var r2 = num.andln(1); - var cmp = mod.cmp(half); + return utils.isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10); + }; - // Round down - if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + /** + * Converts to a checksum address + * + * @method toChecksumAddress + * @param {String} address the given HEX address + * @return {String} + */ + var toChecksumAddress = function toChecksumAddress(address) { + if (typeof address === 'undefined') return ''; - // Round up - return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); - }; + if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error('Given address "' + address + '" is not a valid Ethereum address.'); - BN.prototype.modn = function modn(num) { - assert(num <= 0x3ffffff); - var p = (1 << 26) % num; + address = address.toLowerCase().replace(/^0x/i, ''); + var addressHash = utils.sha3(address).replace(/^0x/i, ''); + var checksumAddress = '0x'; - var acc = 0; - for (var i = this.length - 1; i >= 0; i--) { - acc = (p * acc + (this.words[i] | 0)) % num; + for (var i = 0; i < address.length; i++) { + // If ith character is 9 to f then make it uppercase + if (parseInt(addressHash[i], 16) > 7) { + checksumAddress += address[i].toUpperCase(); + } else { + checksumAddress += address[i]; } + } + return checksumAddress; + }; - return acc; - }; - - // In-place division by number - BN.prototype.idivn = function idivn(num) { - assert(num <= 0x3ffffff); - - var carry = 0; - for (var i = this.length - 1; i >= 0; i--) { - var w = (this.words[i] | 0) + carry * 0x4000000; - this.words[i] = w / num | 0; - carry = w % num; - } + module.exports = { + _fireError: _fireError, + _jsonInterfaceMethodToString: _jsonInterfaceMethodToString, + // extractDisplayName: extractDisplayName, + // extractTypeName: extractTypeName, + randomHex: randomHex, + _: _, + BN: utils.BN, + isBN: utils.isBN, + isBigNumber: utils.isBigNumber, + isHex: utils.isHex, + isHexStrict: utils.isHexStrict, + sha3: utils.sha3, + keccak256: utils.sha3, + soliditySha3: soliditySha3, + isAddress: utils.isAddress, + checkAddressChecksum: utils.checkAddressChecksum, + toChecksumAddress: toChecksumAddress, + toHex: utils.toHex, + toBN: utils.toBN, - return this.strip(); - }; + bytesToHex: utils.bytesToHex, + hexToBytes: utils.hexToBytes, - BN.prototype.divn = function divn(num) { - return this.clone().idivn(num); - }; + hexToNumberString: utils.hexToNumberString, - BN.prototype.egcd = function egcd(p) { - assert(p.negative === 0); - assert(!p.isZero()); + hexToNumber: utils.hexToNumber, + toDecimal: utils.hexToNumber, // alias - var x = this; - var y = p.clone(); + numberToHex: utils.numberToHex, + fromDecimal: utils.numberToHex, // alias - if (x.negative !== 0) { - x = x.umod(p); - } else { - x = x.clone(); - } + hexToUtf8: utils.hexToUtf8, + hexToString: utils.hexToUtf8, + toUtf8: utils.hexToUtf8, - // A * x + B * y = x - var A = new BN(1); - var B = new BN(0); + utf8ToHex: utils.utf8ToHex, + stringToHex: utils.utf8ToHex, + fromUtf8: utils.utf8ToHex, - // C * x + D * y = y - var C = new BN(0); - var D = new BN(1); + hexToAscii: hexToAscii, + toAscii: hexToAscii, + asciiToHex: asciiToHex, + fromAscii: asciiToHex, - var g = 0; + unitMap: ethjsUnit.unitMap, + toWei: toWei, + fromWei: fromWei, - while (x.isEven() && y.isEven()) { - x.iushrn(1); - y.iushrn(1); - ++g; - } + padLeft: utils.leftPad, + leftPad: utils.leftPad, + padRight: utils.rightPad, + rightPad: utils.rightPad, + toTwosComplement: utils.toTwosComplement + }; + }, { "./soliditySha3.js": 243, "./utils.js": 244, "ethjs-unit": 229, "randomhex": 237, "underscore": 239 }], 243: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** + * @file soliditySha3.js + * @author Fabian Vogelsteller + * @date 2017 + */ - var yp = y.clone(); - var xp = x.clone(); + var _ = require('underscore'); + var BN = require('bn.js'); + var utils = require('./utils.js'); - while (!x.isZero()) { - for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {} - if (i > 0) { - x.iushrn(i); - while (i-- > 0) { - if (A.isOdd() || B.isOdd()) { - A.iadd(yp); - B.isub(xp); - } + var _elementaryName = function _elementaryName(name) { + /*jshint maxcomplexity:false */ - A.iushrn(1); - B.iushrn(1); - } - } + if (name.startsWith('int[')) { + return 'int256' + name.slice(3); + } else if (name === 'int') { + return 'int256'; + } else if (name.startsWith('uint[')) { + return 'uint256' + name.slice(4); + } else if (name === 'uint') { + return 'uint256'; + } else if (name.startsWith('fixed[')) { + return 'fixed128x128' + name.slice(5); + } else if (name === 'fixed') { + return 'fixed128x128'; + } else if (name.startsWith('ufixed[')) { + return 'ufixed128x128' + name.slice(6); + } else if (name === 'ufixed') { + return 'ufixed128x128'; + } + return name; + }; - for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {} - if (j > 0) { - y.iushrn(j); - while (j-- > 0) { - if (C.isOdd() || D.isOdd()) { - C.iadd(yp); - D.isub(xp); - } + // Parse N from type + var _parseTypeN = function _parseTypeN(type) { + var typesize = /^\D+(\d+).*$/.exec(type); + return typesize ? parseInt(typesize[1], 10) : null; + }; - C.iushrn(1); - D.iushrn(1); - } - } + // Parse N from type[] + var _parseTypeNArray = function _parseTypeNArray(type) { + var arraySize = /^\D+\d*\[(\d+)\]$/.exec(type); + return arraySize ? parseInt(arraySize[1], 10) : null; + }; - if (x.cmp(y) >= 0) { - x.isub(y); - A.isub(C); - B.isub(D); - } else { - y.isub(x); - C.isub(A); - D.isub(B); - } + var _parseNumber = function _parseNumber(arg) { + var type = typeof arg === "undefined" ? "undefined" : _typeof(arg); + if (type === 'string') { + if (utils.isHexStrict(arg)) { + return new BN(arg.replace(/0x/i, ''), 16); + } else { + return new BN(arg, 10); } + } else if (type === 'number') { + return new BN(arg); + } else if (utils.isBigNumber(arg)) { + return new BN(arg.toString(10)); + } else if (utils.isBN(arg)) { + return arg; + } else { + throw new Error(arg + ' is not a number'); + } + }; - return { - a: C, - b: D, - gcd: y.iushln(g) - }; - }; + var _solidityPack = function _solidityPack(type, value, arraySize) { + /*jshint maxcomplexity:false */ - // This is reduced incarnation of the binary EEA - // above, designated to invert members of the - // _prime_ fields F(p) at a maximal speed - BN.prototype._invmp = function _invmp(p) { - assert(p.negative === 0); - assert(!p.isZero()); + var size, num; + type = _elementaryName(type); - var a = this; - var b = p.clone(); + if (type === 'bytes') { + + if (value.replace(/^0x/i, '').length % 2 !== 0) { + throw new Error('Invalid bytes characters ' + value.length); + } - if (a.negative !== 0) { - a = a.umod(p); + return value; + } else if (type === 'string') { + return utils.utf8ToHex(value); + } else if (type === 'bool') { + return value ? '01' : '00'; + } else if (type.startsWith('address')) { + if (arraySize) { + size = 64; } else { - a = a.clone(); + size = 40; } - var x1 = new BN(1); - var x2 = new BN(0); - - var delta = b.clone(); - - while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { - for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) {} - if (i > 0) { - a.iushrn(i); - while (i-- > 0) { - if (x1.isOdd()) { - x1.iadd(delta); - } + if (!utils.isAddress(value)) { + throw new Error(value + ' is not a valid address, or the checksum is invalid.'); + } - x1.iushrn(1); - } - } + return utils.leftPad(value.toLowerCase(), size); + } - for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) {} - if (j > 0) { - b.iushrn(j); - while (j-- > 0) { - if (x2.isOdd()) { - x2.iadd(delta); - } + size = _parseTypeN(type); - x2.iushrn(1); - } - } + if (type.startsWith('bytes')) { - if (a.cmp(b) >= 0) { - a.isub(b); - x1.isub(x2); - } else { - b.isub(a); - x2.isub(x1); - } + if (!size) { + throw new Error('bytes[] not yet supported in solidity'); } - var res; - if (a.cmpn(1) === 0) { - res = x1; - } else { - res = x2; + // must be 32 byte slices when in an array + if (arraySize) { + size = 32; } - if (res.cmpn(0) < 0) { - res.iadd(p); + if (size < 1 || size > 32 || size < value.replace(/^0x/i, '').length / 2) { + throw new Error('Invalid bytes' + size + ' for ' + value); } - return res; - }; + return utils.rightPad(value, size * 2); + } else if (type.startsWith('uint')) { - BN.prototype.gcd = function gcd(num) { - if (this.isZero()) return num.abs(); - if (num.isZero()) return this.abs(); + if (size % 8 || size < 8 || size > 256) { + throw new Error('Invalid uint' + size + ' size'); + } - var a = this.clone(); - var b = num.clone(); - a.negative = 0; - b.negative = 0; + num = _parseNumber(value); + if (num.bitLength() > size) { + throw new Error('Supplied uint exceeds width: ' + size + ' vs ' + num.bitLength()); + } - // Remove common factor of two - for (var shift = 0; a.isEven() && b.isEven(); shift++) { - a.iushrn(1); - b.iushrn(1); + if (num.lt(new BN(0))) { + throw new Error('Supplied uint ' + num.toString() + ' is negative'); } - do { - while (a.isEven()) { - a.iushrn(1); - } - while (b.isEven()) { - b.iushrn(1); - } + return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; + } else if (type.startsWith('int')) { - var r = a.cmp(b); - if (r < 0) { - // Swap `a` and `b` to make `a` always bigger than `b` - var t = a; - a = b; - b = t; - } else if (r === 0 || b.cmpn(1) === 0) { - break; - } + if (size % 8 || size < 8 || size > 256) { + throw new Error('Invalid int' + size + ' size'); + } - a.isub(b); - } while (true); + num = _parseNumber(value); + if (num.bitLength() > size) { + throw new Error('Supplied int exceeds width: ' + size + ' vs ' + num.bitLength()); + } - return b.iushln(shift); - }; + if (num.lt(new BN(0))) { + return num.toTwos(size).toString('hex'); + } else { + return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; + } + } else { + // FIXME: support all other types + throw new Error('Unsupported or invalid type: ' + type); + } + }; - // Invert number in the field F(num) - BN.prototype.invm = function invm(num) { - return this.egcd(num).a.umod(num); - }; + var _processSoliditySha3Args = function _processSoliditySha3Args(arg) { + /*jshint maxcomplexity:false */ - BN.prototype.isEven = function isEven() { - return (this.words[0] & 1) === 0; - }; + if (_.isArray(arg)) { + throw new Error('Autodetection of array types is not supported.'); + } - BN.prototype.isOdd = function isOdd() { - return (this.words[0] & 1) === 1; - }; + var type, + value = ''; + var hexArg, arraySize; - // And first word and num - BN.prototype.andln = function andln(num) { - return this.words[0] & num; - }; + // if type is given + if (_.isObject(arg) && (arg.hasOwnProperty('v') || arg.hasOwnProperty('t') || arg.hasOwnProperty('value') || arg.hasOwnProperty('type'))) { + type = arg.hasOwnProperty('t') ? arg.t : arg.type; + value = arg.hasOwnProperty('v') ? arg.v : arg.value; - // Increment at the bit position in-line - BN.prototype.bincn = function bincn(bit) { - assert(typeof bit === 'number'); - var r = bit % 26; - var s = (bit - r) / 26; - var q = 1 << r; + // otherwise try to guess the type + } else { - // Fast case: bit is much higher than all existing words - if (this.length <= s) { - this._expand(s + 1); - this.words[s] |= q; - return this; - } + type = utils.toHex(arg, true); + value = utils.toHex(arg); - // Add bit and propagate, if needed - var carry = q; - for (var i = s; carry !== 0 && i < this.length; i++) { - var w = this.words[i] | 0; - w += carry; - carry = w >>> 26; - w &= 0x3ffffff; - this.words[i] = w; - } - if (carry !== 0) { - this.words[i] = carry; - this.length++; + if (!type.startsWith('int') && !type.startsWith('uint')) { + type = 'bytes'; } - return this; - }; - - BN.prototype.isZero = function isZero() { - return this.length === 1 && this.words[0] === 0; - }; + } - BN.prototype.cmpn = function cmpn(num) { - var negative = num < 0; + if ((type.startsWith('int') || type.startsWith('uint')) && typeof value === 'string' && !/^(-)?0x/i.test(value)) { + value = new BN(value); + } - if (this.negative !== 0 && !negative) return -1; - if (this.negative === 0 && negative) return 1; + // get the array size + if (_.isArray(value)) { + arraySize = _parseTypeNArray(type); + if (arraySize && value.length !== arraySize) { + throw new Error(type + ' is not matching the given array ' + JSON.stringify(value)); + } else { + arraySize = value.length; + } + } - this.strip(); + if (_.isArray(value)) { + hexArg = value.map(function (val) { + return _solidityPack(type, val, arraySize).toString('hex').replace('0x', ''); + }); + return hexArg.join(''); + } else { + hexArg = _solidityPack(type, value, arraySize); + return hexArg.toString('hex').replace('0x', ''); + } + }; - var res; - if (this.length > 1) { - res = 1; - } else { - if (negative) { - num = -num; - } + /** + * Hashes solidity values to a sha3 hash using keccak 256 + * + * @method soliditySha3 + * @return {Object} the sha3 + */ + var soliditySha3 = function soliditySha3() { + /*jshint maxcomplexity:false */ - assert(num <= 0x3ffffff, 'Number is too big'); + var args = Array.prototype.slice.call(arguments); - var w = this.words[0] | 0; - res = w === num ? 0 : w < num ? -1 : 1; - } - if (this.negative !== 0) return -res | 0; - return res; - }; + var hexArgs = _.map(args, _processSoliditySha3Args); - // Compare two numbers and return: - // 1 - if `this` > `num` - // 0 - if `this` == `num` - // -1 - if `this` < `num` - BN.prototype.cmp = function cmp(num) { - if (this.negative !== 0 && num.negative === 0) return -1; - if (this.negative === 0 && num.negative !== 0) return 1; + // console.log(args, hexArgs); + // console.log('0x'+ hexArgs.join('')); - var res = this.ucmp(num); - if (this.negative !== 0) return -res | 0; - return res; - }; + return utils.sha3('0x' + hexArgs.join('')); + }; - // Unsigned comparison - BN.prototype.ucmp = function ucmp(num) { - // At this point both numbers have the same sign - if (this.length > num.length) return 1; - if (this.length < num.length) return -1; + module.exports = soliditySha3; + }, { "./utils.js": 244, "bn.js": 241, "underscore": 239 }], 244: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** + * @file utils.js + * @author Fabian Vogelsteller + * @date 2017 + */ - var res = 0; - for (var i = this.length - 1; i >= 0; i--) { - var a = this.words[i] | 0; - var b = num.words[i] | 0; + var _ = require('underscore'); + var BN = require('bn.js'); + var numberToBN = require('number-to-bn'); + var utf8 = require('utf8'); + var Hash = require("eth-lib/lib/hash"); - if (a === b) continue; - if (a < b) { - res = -1; - } else if (a > b) { - res = 1; - } - break; - } - return res; - }; + /** + * Returns true if object is BN, otherwise false + * + * @method isBN + * @param {Object} object + * @return {Boolean} + */ + var isBN = function isBN(object) { + return object instanceof BN || object && object.constructor && object.constructor.name === 'BN'; + }; - BN.prototype.gtn = function gtn(num) { - return this.cmpn(num) === 1; - }; + /** + * Returns true if object is BigNumber, otherwise false + * + * @method isBigNumber + * @param {Object} object + * @return {Boolean} + */ + var isBigNumber = function isBigNumber(object) { + return object && object.constructor && object.constructor.name === 'BigNumber'; + }; - BN.prototype.gt = function gt(num) { - return this.cmp(num) === 1; - }; + /** + * Takes an input and transforms it into an BN + * + * @method toBN + * @param {Number|String|BN} number, string, HEX string or BN + * @return {BN} BN + */ + var toBN = function toBN(number) { + try { + return numberToBN.apply(null, arguments); + } catch (e) { + throw new Error(e + ' Given value: "' + number + '"'); + } + }; - BN.prototype.gten = function gten(num) { - return this.cmpn(num) >= 0; - }; + /** + * Takes and input transforms it into BN and if it is negative value, into two's complement + * + * @method toTwosComplement + * @param {Number|String|BN} number + * @return {String} + */ + var toTwosComplement = function toTwosComplement(number) { + return '0x' + toBN(number).toTwos(256).toString(16, 64); + }; - BN.prototype.gte = function gte(num) { - return this.cmp(num) >= 0; - }; + /** + * Checks if the given string is an address + * + * @method isAddress + * @param {String} address the given HEX address + * @return {Boolean} + */ + var isAddress = function isAddress(address) { + // check if it has the basic requirements of an address + if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { + return false; + // If it's ALL lowercase or ALL upppercase + } else if (/^(0x|0X)?[0-9a-f]{40}$/.test(address) || /^(0x|0X)?[0-9A-F]{40}$/.test(address)) { + return true; + // Otherwise check each case + } else { + return checkAddressChecksum(address); + } + }; - BN.prototype.ltn = function ltn(num) { - return this.cmpn(num) === -1; - }; + /** + * Checks if the given string is a checksummed address + * + * @method checkAddressChecksum + * @param {String} address the given HEX address + * @return {Boolean} + */ + var checkAddressChecksum = function checkAddressChecksum(address) { + // Check each case + address = address.replace(/^0x/i, ''); + var addressHash = sha3(address.toLowerCase()).replace(/^0x/i, ''); - BN.prototype.lt = function lt(num) { - return this.cmp(num) === -1; - }; + for (var i = 0; i < 40; i++) { + // the nth letter should be uppercase if the nth digit of casemap is 1 + if (parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i] || parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i]) { + return false; + } + } + return true; + }; - BN.prototype.lten = function lten(num) { - return this.cmpn(num) <= 0; - }; + /** + * Should be called to pad string to expected length + * + * @method leftPad + * @param {String} string to be padded + * @param {Number} chars that result string should have + * @param {String} sign, by default 0 + * @returns {String} right aligned string + */ + var leftPad = function leftPad(string, chars, sign) { + var hasPrefix = /^0x/i.test(string) || typeof string === 'number'; + string = string.toString(16).replace(/^0x/i, ''); - BN.prototype.lte = function lte(num) { - return this.cmp(num) <= 0; - }; + var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0; - BN.prototype.eqn = function eqn(num) { - return this.cmpn(num) === 0; - }; + return (hasPrefix ? '0x' : '') + new Array(padding).join(sign ? sign : "0") + string; + }; - BN.prototype.eq = function eq(num) { - return this.cmp(num) === 0; - }; + /** + * Should be called to pad string to expected length + * + * @method rightPad + * @param {String} string to be padded + * @param {Number} chars that result string should have + * @param {String} sign, by default 0 + * @returns {String} right aligned string + */ + var rightPad = function rightPad(string, chars, sign) { + var hasPrefix = /^0x/i.test(string) || typeof string === 'number'; + string = string.toString(16).replace(/^0x/i, ''); - // - // A reduce context, could be using montgomery or something better, depending - // on the `m` itself. - // - BN.red = function red(num) { - return new Red(num); - }; + var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0; - BN.prototype.toRed = function toRed(ctx) { - assert(!this.red, 'Already a number in reduction context'); - assert(this.negative === 0, 'red works only with positives'); - return ctx.convertTo(this)._forceRed(ctx); - }; + return (hasPrefix ? '0x' : '') + string + new Array(padding).join(sign ? sign : "0"); + }; - BN.prototype.fromRed = function fromRed() { - assert(this.red, 'fromRed works only with numbers in reduction context'); - return this.red.convertFrom(this); - }; + /** + * Should be called to get hex representation (prefixed by 0x) of utf8 string + * + * @method utf8ToHex + * @param {String} str + * @returns {String} hex representation of input string + */ + var utf8ToHex = function utf8ToHex(str) { + str = utf8.encode(str); + var hex = ""; - BN.prototype._forceRed = function _forceRed(ctx) { - this.red = ctx; - return this; - }; + // remove \u0000 padding from either side + str = str.replace(/^(?:\u0000)*/, ''); + str = str.split("").reverse().join(""); + str = str.replace(/^(?:\u0000)*/, ''); + str = str.split("").reverse().join(""); - BN.prototype.forceRed = function forceRed(ctx) { - assert(!this.red, 'Already a number in reduction context'); - return this._forceRed(ctx); - }; + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + // if (code !== 0) { + var n = code.toString(16); + hex += n.length < 2 ? '0' + n : n; + // } + } - BN.prototype.redAdd = function redAdd(num) { - assert(this.red, 'redAdd works only with red numbers'); - return this.red.add(this, num); - }; + return "0x" + hex; + }; - BN.prototype.redIAdd = function redIAdd(num) { - assert(this.red, 'redIAdd works only with red numbers'); - return this.red.iadd(this, num); - }; + /** + * Should be called to get utf8 from it's hex representation + * + * @method hexToUtf8 + * @param {String} hex + * @returns {String} ascii string representation of hex value + */ + var hexToUtf8 = function hexToUtf8(hex) { + if (!isHexStrict(hex)) throw new Error('The parameter "' + hex + '" must be a valid HEX string.'); - BN.prototype.redSub = function redSub(num) { - assert(this.red, 'redSub works only with red numbers'); - return this.red.sub(this, num); - }; + var str = ""; + var code = 0; + hex = hex.replace(/^0x/i, ''); - BN.prototype.redISub = function redISub(num) { - assert(this.red, 'redISub works only with red numbers'); - return this.red.isub(this, num); - }; + // remove 00 padding from either side + hex = hex.replace(/^(?:00)*/, ''); + hex = hex.split("").reverse().join(""); + hex = hex.replace(/^(?:00)*/, ''); + hex = hex.split("").reverse().join(""); - BN.prototype.redShl = function redShl(num) { - assert(this.red, 'redShl works only with red numbers'); - return this.red.shl(this, num); - }; + var l = hex.length; - BN.prototype.redMul = function redMul(num) { - assert(this.red, 'redMul works only with red numbers'); - this.red._verify2(this, num); - return this.red.mul(this, num); - }; + for (var i = 0; i < l; i += 2) { + code = parseInt(hex.substr(i, 2), 16); + // if (code !== 0) { + str += String.fromCharCode(code); + // } + } - BN.prototype.redIMul = function redIMul(num) { - assert(this.red, 'redMul works only with red numbers'); - this.red._verify2(this, num); - return this.red.imul(this, num); - }; + return utf8.decode(str); + }; - BN.prototype.redSqr = function redSqr() { - assert(this.red, 'redSqr works only with red numbers'); - this.red._verify1(this); - return this.red.sqr(this); - }; + /** + * Converts value to it's number representation + * + * @method hexToNumber + * @param {String|Number|BN} value + * @return {String} + */ + var hexToNumber = function hexToNumber(value) { + if (!value) { + return value; + } - BN.prototype.redISqr = function redISqr() { - assert(this.red, 'redISqr works only with red numbers'); - this.red._verify1(this); - return this.red.isqr(this); - }; + return toBN(value).toNumber(); + }; - // Square root over p - BN.prototype.redSqrt = function redSqrt() { - assert(this.red, 'redSqrt works only with red numbers'); - this.red._verify1(this); - return this.red.sqrt(this); - }; + /** + * Converts value to it's decimal representation in string + * + * @method hexToNumberString + * @param {String|Number|BN} value + * @return {String} + */ + var hexToNumberString = function hexToNumberString(value) { + if (!value) return value; - BN.prototype.redInvm = function redInvm() { - assert(this.red, 'redInvm works only with red numbers'); - this.red._verify1(this); - return this.red.invm(this); - }; + return toBN(value).toString(10); + }; - // Return negative clone of `this` % `red modulo` - BN.prototype.redNeg = function redNeg() { - assert(this.red, 'redNeg works only with red numbers'); - this.red._verify1(this); - return this.red.neg(this); - }; + /** + * Converts value to it's hex representation + * + * @method numberToHex + * @param {String|Number|BN} value + * @return {String} + */ + var numberToHex = function numberToHex(value) { + if (_.isNull(value) || _.isUndefined(value)) { + return value; + } - BN.prototype.redPow = function redPow(num) { - assert(this.red && !num.red, 'redPow(normalNum)'); - this.red._verify1(this); - return this.red.pow(this, num); - }; + if (!isFinite(value) && !isHexStrict(value)) { + throw new Error('Given input "' + value + '" is not a number.'); + } - // Prime numbers with efficient reduction - var primes = { - k256: null, - p224: null, - p192: null, - p25519: null - }; + var number = toBN(value); + var result = number.toString(16); - // Pseudo-Mersenne prime - function MPrime(name, p) { - // P = 2 ^ N - K - this.name = name; - this.p = new BN(p, 16); - this.n = this.p.bitLength(); - this.k = new BN(1).iushln(this.n).isub(this.p); + return number.lt(new BN(0)) ? '-0x' + result.substr(1) : '0x' + result; + }; - this.tmp = this._tmp(); + /** + * Convert a byte array to a hex string + * + * Note: Implementation from crypto-js + * + * @method bytesToHex + * @param {Array} bytes + * @return {String} the hex string + */ + var bytesToHex = function bytesToHex(bytes) { + for (var hex = [], i = 0; i < bytes.length; i++) { + /* jshint ignore:start */ + hex.push((bytes[i] >>> 4).toString(16)); + hex.push((bytes[i] & 0xF).toString(16)); + /* jshint ignore:end */ } + return '0x' + hex.join(""); + }; - MPrime.prototype._tmp = function _tmp() { - var tmp = new BN(null); - tmp.words = new Array(Math.ceil(this.n / 13)); - return tmp; - }; - - MPrime.prototype.ireduce = function ireduce(num) { - // Assumes that `num` is less than `P^2` - // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) - var r = num; - var rlen; + /** + * Convert a hex string to a byte array + * + * Note: Implementation from crypto-js + * + * @method hexToBytes + * @param {string} hex + * @return {Array} the byte array + */ + var hexToBytes = function hexToBytes(hex) { + hex = hex.toString(16); - do { - this.split(r, this.tmp); - r = this.imulK(r); - r = r.iadd(this.tmp); - rlen = r.bitLength(); - } while (rlen > this.n); + if (!isHexStrict(hex)) { + throw new Error('Given value "' + hex + '" is not a valid hex string.'); + } - var cmp = rlen < this.n ? -1 : r.ucmp(this.p); - if (cmp === 0) { - r.words[0] = 0; - r.length = 1; - } else if (cmp > 0) { - r.isub(this.p); - } else { - r.strip(); - } + hex = hex.replace(/^0x/i, ''); - return r; - }; + for (var bytes = [], c = 0; c < hex.length; c += 2) { + bytes.push(parseInt(hex.substr(c, 2), 16)); + }return bytes; + }; - MPrime.prototype.split = function split(input, out) { - input.iushrn(this.n, 0, out); - }; + /** + * Auto converts any given value into it's hex representation. + * + * And even stringifys objects before. + * + * @method toHex + * @param {String|Number|BN|Object} value + * @param {Boolean} returnType + * @return {String} + */ + var toHex = function toHex(value, returnType) { + /*jshint maxcomplexity: false */ - MPrime.prototype.imulK = function imulK(num) { - return num.imul(this.k); - }; + if (isAddress(value)) { + return returnType ? 'address' : '0x' + value.toLowerCase().replace(/^0x/i, ''); + } - function K256() { - MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + if (_.isBoolean(value)) { + return returnType ? 'bool' : value ? '0x01' : '0x00'; } - inherits(K256, MPrime); - K256.prototype.split = function split(input, output) { - // 256 = 9 * 26 + 22 - var mask = 0x3fffff; + if (_.isObject(value) && !isBigNumber(value) && !isBN(value)) { + return returnType ? 'string' : utf8ToHex(JSON.stringify(value)); + } - var outLen = Math.min(input.length, 9); - for (var i = 0; i < outLen; i++) { - output.words[i] = input.words[i]; + // if its a negative number, pass it through numberToHex + if (_.isString(value)) { + if (value.indexOf('-0x') === 0 || value.indexOf('-0X') === 0) { + return returnType ? 'int256' : numberToHex(value); + } else if (value.indexOf('0x') === 0 || value.indexOf('0X') === 0) { + return returnType ? 'bytes' : value; + } else if (!isFinite(value)) { + return returnType ? 'string' : utf8ToHex(value); } - output.length = outLen; + } - if (input.length <= 9) { - input.words[0] = 0; - input.length = 1; - return; - } + return returnType ? value < 0 ? 'int256' : 'uint256' : numberToHex(value); + }; - // Shift by 9 limbs - var prev = input.words[9]; - output.words[output.length++] = prev & mask; + /** + * Check if string is HEX, requires a 0x in front + * + * @method isHexStrict + * @param {String} hex to be checked + * @returns {Boolean} + */ + var isHexStrict = function isHexStrict(hex) { + return (_.isString(hex) || _.isNumber(hex)) && /^(-)?0x[0-9a-f]*$/i.test(hex); + }; - for (i = 10; i < input.length; i++) { - var next = input.words[i] | 0; - input.words[i - 10] = (next & mask) << 4 | prev >>> 22; - prev = next; - } - prev >>>= 22; - input.words[i - 10] = prev; - if (prev === 0 && input.length > 10) { - input.length -= 10; - } else { - input.length -= 9; - } - }; + /** + * Check if string is HEX + * + * @method isHex + * @param {String} hex to be checked + * @returns {Boolean} + */ + var isHex = function isHex(hex) { + return (_.isString(hex) || _.isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex); + }; - K256.prototype.imulK = function imulK(num) { - // K = 0x1000003d1 = [ 0x40, 0x3d1 ] - num.words[num.length] = 0; - num.words[num.length + 1] = 0; - num.length += 2; + /** + * Returns true if given string is a valid Ethereum block header bloom. + * + * TODO UNDOCUMENTED + * + * @method isBloom + * @param {String} hex encoded bloom filter + * @return {Boolean} + */ + var isBloom = function isBloom(bloom) { + if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) { + return false; + } else if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) { + return true; + } + return false; + }; - // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 - var lo = 0; - for (var i = 0; i < num.length; i++) { - var w = num.words[i] | 0; - lo += w * 0x3d1; - num.words[i] = lo & 0x3ffffff; - lo = w * 0x40 + (lo / 0x4000000 | 0); - } + /** + * Returns true if given string is a valid log topic. + * + * TODO UNDOCUMENTED + * + * @method isTopic + * @param {String} hex encoded topic + * @return {Boolean} + */ + var isTopic = function isTopic(topic) { + if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) { + return false; + } else if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) { + return true; + } + return false; + }; - // Fast length reduction - if (num.words[num.length - 1] === 0) { - num.length--; - if (num.words[num.length - 1] === 0) { - num.length--; - } - } - return num; - }; + /** + * Hashes values to a sha3 hash using keccak 256 + * + * To hash a HEX string the hex must have 0x in front. + * + * @method sha3 + * @return {String} the sha3 string + */ + var SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; - function P224() { - MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + var sha3 = function sha3(value) { + if (isHexStrict(value) && /^0x/i.test(value.toString())) { + value = hexToBytes(value); } - inherits(P224, MPrime); - function P192() { - MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); - } - inherits(P192, MPrime); + var returnValue = Hash.keccak256(value); // jshint ignore:line - function P25519() { - // 2 ^ 255 - 19 - MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + if (returnValue === SHA3_NULL_S) { + return null; + } else { + return returnValue; } - inherits(P25519, MPrime); + }; + // expose the under the hood keccak256 + sha3._Hash = Hash; - P25519.prototype.imulK = function imulK(num) { - // K = 0x13 - var carry = 0; - for (var i = 0; i < num.length; i++) { - var hi = (num.words[i] | 0) * 0x13 + carry; - var lo = hi & 0x3ffffff; - hi >>>= 26; + module.exports = { + BN: BN, + isBN: isBN, + isBigNumber: isBigNumber, + toBN: toBN, + isAddress: isAddress, + isBloom: isBloom, // TODO UNDOCUMENTED + isTopic: isTopic, // TODO UNDOCUMENTED + checkAddressChecksum: checkAddressChecksum, + utf8ToHex: utf8ToHex, + hexToUtf8: hexToUtf8, + hexToNumber: hexToNumber, + hexToNumberString: hexToNumberString, + numberToHex: numberToHex, + toHex: toHex, + hexToBytes: hexToBytes, + bytesToHex: bytesToHex, + isHex: isHex, + isHexStrict: isHexStrict, + leftPad: leftPad, + rightPad: rightPad, + toTwosComplement: toTwosComplement, + sha3: sha3 + }; + }, { "bn.js": 241, "eth-lib/lib/hash": 219, "number-to-bn": 234, "underscore": 239, "utf8": 240 }], 245: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** + * @file index.js + * @author Marek Kotewicz + * @author Fabian Vogelsteller + * @date 2018 + */ - num.words[i] = lo; - carry = hi; - } - if (carry !== 0) { - num.words[num.length++] = carry; - } - return num; - }; + var _ = require('underscore'); + var utils = require('web3-utils'); - // Exported mostly for testing purposes, use plain name instead - BN._prime = function prime(name) { - // Cached version of prime - if (primes[name]) return primes[name]; + var EthersAbi = require('ethers/utils/abi-coder'); + var ethersAbiCoder = new EthersAbi(function (type, value) { + if (type.match(/^u?int/) && !_.isArray(value) && (!_.isObject(value) || value.constructor.name !== 'BN')) { + return value.toString(); + } + return value; + }); - var prime; - if (name === 'k256') { - prime = new K256(); - } else if (name === 'p224') { - prime = new P224(); - } else if (name === 'p192') { - prime = new P192(); - } else if (name === 'p25519') { - prime = new P25519(); - } else { - throw new Error('Unknown prime ' + name); - } - primes[name] = prime; + // result method + function Result() {} - return prime; - }; + /** + * ABICoder prototype should be used to encode/decode solidity params of any type + */ + var ABICoder = function ABICoder() {}; - // - // Base reduction engine - // - function Red(m) { - if (typeof m === 'string') { - var prime = BN._prime(m); - this.m = prime.p; - this.prime = prime; - } else { - assert(m.gtn(1), 'modulus must be greater than 1'); - this.m = m; - this.prime = null; - } + /** + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * + * @method encodeFunctionSignature + * @param {String|Object} functionName + * @return {String} encoded function name + */ + ABICoder.prototype.encodeFunctionSignature = function (functionName) { + if (_.isObject(functionName)) { + functionName = utils._jsonInterfaceMethodToString(functionName); } - Red.prototype._verify1 = function _verify1(a) { - assert(a.negative === 0, 'red works only with positives'); - assert(a.red, 'red works only with red numbers'); - }; - - Red.prototype._verify2 = function _verify2(a, b) { - assert((a.negative | b.negative) === 0, 'red works only with positives'); - assert(a.red && a.red === b.red, 'red works only with red numbers'); - }; + return utils.sha3(functionName).slice(0, 10); + }; - Red.prototype.imod = function imod(a) { - if (this.prime) return this.prime.ireduce(a)._forceRed(this); - return a.umod(this.m)._forceRed(this); - }; + /** + * Encodes the function name to its ABI representation, which are the first 4 bytes of the sha3 of the function name including types. + * + * @method encodeEventSignature + * @param {String|Object} functionName + * @return {String} encoded function name + */ + ABICoder.prototype.encodeEventSignature = function (functionName) { + if (_.isObject(functionName)) { + functionName = utils._jsonInterfaceMethodToString(functionName); + } - Red.prototype.neg = function neg(a) { - if (a.isZero()) { - return a.clone(); - } + return utils.sha3(functionName); + }; - return this.m.sub(a)._forceRed(this); - }; + /** + * Should be used to encode plain param + * + * @method encodeParameter + * @param {String} type + * @param {Object} param + * @return {String} encoded plain param + */ + ABICoder.prototype.encodeParameter = function (type, param) { + return this.encodeParameters([type], [param]); + }; - Red.prototype.add = function add(a, b) { - this._verify2(a, b); + /** + * Should be used to encode list of params + * + * @method encodeParameters + * @param {Array} types + * @param {Array} params + * @return {String} encoded list of params + */ + ABICoder.prototype.encodeParameters = function (types, params) { + // given a json interface + // if (_.isArray(types) && _.isObject(types[0])) { + // types = utils._flattenTypes(true, types); + // } - var res = a.add(b); - if (res.cmp(this.m) >= 0) { - res.isub(this.m); - } - return res._forceRed(this); - }; + return ethersAbiCoder.encode(types, params); + }; - Red.prototype.iadd = function iadd(a, b) { - this._verify2(a, b); + /** + * Encodes a function call from its json interface and parameters. + * + * @method encodeFunctionCall + * @param {Array} jsonInterface + * @param {Array} params + * @return {String} The encoded ABI for this function call + */ + ABICoder.prototype.encodeFunctionCall = function (jsonInterface, params) { + return this.encodeFunctionSignature(jsonInterface) + this.encodeParameters(jsonInterface.inputs, params).replace('0x', ''); + }; - var res = a.iadd(b); - if (res.cmp(this.m) >= 0) { - res.isub(this.m); - } - return res; - }; + /** + * Should be used to decode bytes to plain param + * + * @method decodeParameter + * @param {String} type + * @param {String} bytes + * @return {Object} plain param + */ + ABICoder.prototype.decodeParameter = function (type, bytes) { - Red.prototype.sub = function sub(a, b) { - this._verify2(a, b); + if (!_.isString(type)) { + throw new Error('Given parameter type is not a string: ' + type); + } - var res = a.sub(b); - if (res.cmpn(0) < 0) { - res.iadd(this.m); - } - return res._forceRed(this); - }; + return this.decodeParameters([{ type: type }], bytes)[0]; + }; - Red.prototype.isub = function isub(a, b) { - this._verify2(a, b); + /** + * Should be used to decode list of params + * + * @method decodeParameter + * @param {Array} outputs + * @param {String} bytes + * @return {Array} array of plain params + */ + ABICoder.prototype.decodeParameters = function (outputs, bytes) { + // var isTypeArray = _.isArray(outputs) && _.isString(outputs[0]); + // var types = (isTypeArray) ? outputs : []; + var types = outputs; + console.log('BYTES_STRING', '0x' + bytes.replace(/0x/i, '')); - var res = a.isub(b); - if (res.cmpn(0) < 0) { - res.iadd(this.m); - } - return res; - }; + //if(!isTypeArray) { + // types = utils._flattenTypes(true, outputs); + //} - Red.prototype.shl = function shl(a, num) { - this._verify1(a); - return this.imod(a.ushln(num)); - }; + if (!bytes || bytes === '0x' || bytes === '0X') { + throw new Error('Returned values aren\'t valid, did it run Out of Gas?'); + } - Red.prototype.imul = function imul(a, b) { - this._verify2(a, b); - return this.imod(a.imul(b)); - }; + console.log('TYPES', types); - Red.prototype.mul = function mul(a, b) { - this._verify2(a, b); - return this.imod(a.mul(b)); - }; + var res = ethersAbiCoder.decode(types, '0x' + bytes.replace(/0x/i, '')); - Red.prototype.isqr = function isqr(a) { - return this.imul(a, a.clone()); - }; + console.log('ethersAbiCoderResult: ', res); - Red.prototype.sqr = function sqr(a) { - return this.mul(a, a); - }; + var returnValue = new Result(); + returnValue.__length__ = 0; - Red.prototype.sqrt = function sqrt(a) { - if (a.isZero()) return a.clone(); + outputs.forEach(function (output, i) { + var decodedValue = res[returnValue.__length__]; + decodedValue = decodedValue === '0x' ? null : decodedValue; - var mod3 = this.m.andln(3); - assert(mod3 % 2 === 1); + returnValue[i] = decodedValue; - // Fast case - if (mod3 === 3) { - var pow = this.m.add(new BN(1)).iushrn(2); - return this.pow(a, pow); + if (_.isObject(output) && output.name) { + returnValue[output.name] = decodedValue; } - // Tonelli-Shanks algorithm (Totally unoptimized and slow) - // - // Find Q and S, that Q * 2 ^ S = (P - 1) - var q = this.m.subn(1); - var s = 0; - while (!q.isZero() && q.andln(1) === 0) { - s++; - q.iushrn(1); - } - assert(!q.isZero()); + returnValue.__length__++; + }); - var one = new BN(1).toRed(this); - var nOne = one.redNeg(); + console.log('FUNCTION_RESULT_MAPPED_TO_RESULT_OBJECT: ', returnValue); - // Find quadratic non-residue - // NOTE: Max is such because of generalized Riemann hypothesis. - var lpow = this.m.subn(1).iushrn(1); - var z = this.m.bitLength(); - z = new BN(2 * z * z).toRed(this); + return returnValue; + }; - while (this.pow(z, lpow).cmp(nOne) !== 0) { - z.redIAdd(nOne); - } + /** + * Decodes events non- and indexed parameters. + * + * @method decodeLog + * @param {Object} inputs + * @param {String} data + * * @param {Array} topics + * @return {Array} array of plain params + */ + ABICoder.prototype.decodeLog = function (inputs, data, topics) { + var _this = this; + topics = _.isArray(topics) ? topics : [topics]; - var c = this.pow(z, q); - var r = this.pow(a, q.addn(1).iushrn(1)); - var t = this.pow(a, q); - var m = s; - while (t.cmp(one) !== 0) { - var tmp = t; - for (var i = 0; tmp.cmp(one) !== 0; i++) { - tmp = tmp.redSqr(); - } - assert(i < m); - var b = this.pow(c, new BN(1).iushln(m - i - 1)); + data = data || ''; - r = r.redMul(b); - c = b.redSqr(); - t = t.redMul(c); - m = i; - } + var notIndexedInputs = []; + var indexedParams = []; + var topicCount = 0; - return r; - }; + // TODO check for anonymous logs? - Red.prototype.invm = function invm(a) { - var inv = a._invmp(this.m); - if (inv.negative !== 0) { - inv.negative = 0; - return this.imod(inv).redNeg(); + inputs.forEach(function (input, i) { + if (input.indexed) { + indexedParams[i] = ['bool', 'int', 'uint', 'address', 'fixed', 'ufixed'].find(function (staticType) { + return input.type.indexOf(staticType) !== -1; + }) ? _this.decodeParameter(input.type, topics[topicCount]) : topics[topicCount]; + topicCount++; } else { - return this.imod(inv); + notIndexedInputs[i] = input; } - }; + }); - Red.prototype.pow = function pow(a, num) { - if (num.isZero()) return new BN(1).toRed(this); - if (num.cmpn(1) === 0) return a.clone(); + var nonIndexedData = data; + var notIndexedParams = nonIndexedData ? this.decodeParameters(notIndexedInputs, nonIndexedData) : []; - var windowSize = 4; - var wnd = new Array(1 << windowSize); - wnd[0] = new BN(1).toRed(this); - wnd[1] = a; - for (var i = 2; i < wnd.length; i++) { - wnd[i] = this.mul(wnd[i - 1], a); - } + var returnValue = new Result(); + returnValue.__length__ = 0; - var res = wnd[0]; - var current = 0; - var currentLen = 0; - var start = num.bitLength() % 26; - if (start === 0) { - start = 26; + inputs.forEach(function (res, i) { + returnValue[i] = res.type === 'string' ? '' : null; + + if (typeof notIndexedParams[i] !== 'undefined') { + returnValue[i] = notIndexedParams[i]; + } + if (typeof indexedParams[i] !== 'undefined') { + returnValue[i] = indexedParams[i]; } - for (i = num.length - 1; i >= 0; i--) { - var word = num.words[i]; - for (var j = start - 1; j >= 0; j--) { - var bit = word >> j & 1; - if (res !== wnd[0]) { - res = this.sqr(res); - } + if (res.name) { + returnValue[res.name] = returnValue[i]; + } - if (bit === 0 && current === 0) { - currentLen = 0; - continue; - } + returnValue.__length__++; + }); - current <<= 1; - current |= bit; - currentLen++; - if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + return returnValue; + }; - res = this.mul(res, wnd[current]); - currentLen = 0; - current = 0; - } - start = 26; - } + var coder = new ABICoder(); - return res; - }; + module.exports = coder; + }, { "ethers/utils/abi-coder": 220, "underscore": 239, "web3-utils": 242 }], 246: [function (require, module, exports) { + arguments[4][202][0].apply(exports, arguments); + }, { "./register": 248, "dup": 202 }], 247: [function (require, module, exports) { + arguments[4][203][0].apply(exports, arguments); + }, { "dup": 203 }], 248: [function (require, module, exports) { + arguments[4][204][0].apply(exports, arguments); + }, { "./loader": 247, "dup": 204 }], 249: [function (require, module, exports) { + arguments[4][1][0].apply(exports, arguments); + }, { "./asn1/api": 250, "./asn1/base": 252, "./asn1/constants": 256, "./asn1/decoders": 258, "./asn1/encoders": 261, "bn.js": 263, "dup": 1 }], 250: [function (require, module, exports) { + arguments[4][2][0].apply(exports, arguments); + }, { "../asn1": 249, "dup": 2, "inherits": 348, "vm": 169 }], 251: [function (require, module, exports) { + arguments[4][3][0].apply(exports, arguments); + }, { "../base": 252, "buffer": 47, "dup": 3, "inherits": 348 }], 252: [function (require, module, exports) { + arguments[4][4][0].apply(exports, arguments); + }, { "./buffer": 251, "./node": 253, "./reporter": 254, "dup": 4 }], 253: [function (require, module, exports) { + arguments[4][5][0].apply(exports, arguments); + }, { "../base": 252, "dup": 5, "minimalistic-assert": 352 }], 254: [function (require, module, exports) { + arguments[4][6][0].apply(exports, arguments); + }, { "dup": 6, "inherits": 348 }], 255: [function (require, module, exports) { + arguments[4][7][0].apply(exports, arguments); + }, { "../constants": 256, "dup": 7 }], 256: [function (require, module, exports) { + arguments[4][8][0].apply(exports, arguments); + }, { "./der": 255, "dup": 8 }], 257: [function (require, module, exports) { + arguments[4][9][0].apply(exports, arguments); + }, { "../../asn1": 249, "dup": 9, "inherits": 348 }], 258: [function (require, module, exports) { + arguments[4][10][0].apply(exports, arguments); + }, { "./der": 257, "./pem": 259, "dup": 10 }], 259: [function (require, module, exports) { + arguments[4][11][0].apply(exports, arguments); + }, { "./der": 257, "buffer": 47, "dup": 11, "inherits": 348 }], 260: [function (require, module, exports) { + arguments[4][12][0].apply(exports, arguments); + }, { "../../asn1": 249, "buffer": 47, "dup": 12, "inherits": 348 }], 261: [function (require, module, exports) { + arguments[4][13][0].apply(exports, arguments); + }, { "./der": 260, "./pem": 262, "dup": 13 }], 262: [function (require, module, exports) { + arguments[4][14][0].apply(exports, arguments); + }, { "./der": 260, "dup": 14, "inherits": 348 }], 263: [function (require, module, exports) { + arguments[4][218][0].apply(exports, arguments); + }, { "buffer": 17, "dup": 218 }], 264: [function (require, module, exports) { + arguments[4][16][0].apply(exports, arguments); + }, { "crypto": 17, "dup": 16 }], 265: [function (require, module, exports) { + arguments[4][18][0].apply(exports, arguments); + }, { "dup": 18, "safe-buffer": 373 }], 266: [function (require, module, exports) { + arguments[4][19][0].apply(exports, arguments); + }, { "./aes": 265, "./ghash": 270, "./incr32": 271, "buffer-xor": 292, "cipher-base": 293, "dup": 19, "inherits": 348, "safe-buffer": 373 }], 267: [function (require, module, exports) { + arguments[4][20][0].apply(exports, arguments); + }, { "./decrypter": 268, "./encrypter": 269, "./modes/list.json": 279, "dup": 20 }], 268: [function (require, module, exports) { + var AuthCipher = require('./authCipher'); + var Buffer = require('safe-buffer').Buffer; + var MODES = require('./modes'); + var StreamCipher = require('./streamCipher'); + var Transform = require('cipher-base'); + var aes = require('./aes'); + var ebtk = require('evp_bytestokey'); + var inherits = require('inherits'); - Red.prototype.convertTo = function convertTo(num) { - var r = num.umod(this.m); + function Decipher(mode, key, iv) { + Transform.call(this); - return r === num ? r.clone() : r; - }; + this._cache = new Splitter(); + this._last = void 0; + this._cipher = new aes.AES(key); + this._prev = Buffer.from(iv); + this._mode = mode; + this._autopadding = true; + } - Red.prototype.convertFrom = function convertFrom(num) { - var res = num.clone(); - res.red = null; - return res; - }; + inherits(Decipher, Transform); - // - // Montgomery method engine - // + Decipher.prototype._update = function (data) { + this._cache.add(data); + var chunk; + var thing; + var out = []; + while (chunk = this._cache.get(this._autopadding)) { + thing = this._mode.decrypt(this, chunk); + out.push(thing); + } + return Buffer.concat(out); + }; - BN.mont = function mont(num) { - return new Mont(num); - }; + Decipher.prototype._final = function () { + var chunk = this._cache.flush(); + if (this._autopadding) { + return unpad(this._mode.decrypt(this, chunk)); + } else if (chunk) { + throw new Error('data not multiple of block length'); + } + }; - function Mont(m) { - Red.call(this, m); + Decipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo; + return this; + }; - this.shift = this.m.bitLength(); - if (this.shift % 26 !== 0) { - this.shift += 26 - this.shift % 26; - } + function Splitter() { + this.cache = Buffer.allocUnsafe(0); + } - this.r = new BN(1).iushln(this.shift); - this.r2 = this.imod(this.r.sqr()); - this.rinv = this.r._invmp(this.m); + Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]); + }; - this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); - this.minv = this.minv.umod(this.r); - this.minv = this.r.sub(this.minv); + Splitter.prototype.get = function (autoPadding) { + var out; + if (autoPadding) { + if (this.cache.length > 16) { + out = this.cache.slice(0, 16); + this.cache = this.cache.slice(16); + return out; + } + } else { + if (this.cache.length >= 16) { + out = this.cache.slice(0, 16); + this.cache = this.cache.slice(16); + return out; + } } - inherits(Mont, Red); - Mont.prototype.convertTo = function convertTo(num) { - return this.imod(num.ushln(this.shift)); - }; + return null; + }; - Mont.prototype.convertFrom = function convertFrom(num) { - var r = this.imod(num.mul(this.rinv)); - r.red = null; - return r; - }; + Splitter.prototype.flush = function () { + if (this.cache.length) return this.cache; + }; - Mont.prototype.imul = function imul(a, b) { - if (a.isZero() || b.isZero()) { - a.words[0] = 0; - a.length = 1; - return a; + function unpad(last) { + var padded = last[15]; + var i = -1; + while (++i < padded) { + if (last[i + (16 - padded)] !== padded) { + throw new Error('unable to decrypt data'); } + } + if (padded === 16) return; - var t = a.imul(b); - var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); - var u = t.isub(c).iushrn(this.shift); - var res = u; + return last.slice(0, 16 - padded); + } - if (u.cmp(this.m) >= 0) { - res = u.isub(this.m); - } else if (u.cmpn(0) < 0) { - res = u.iadd(this.m); - } + function createDecipheriv(suite, password, iv) { + var config = MODES[suite.toLowerCase()]; + if (!config) throw new TypeError('invalid suite type'); - return res._forceRed(this); - }; + if (typeof iv === 'string') iv = Buffer.from(iv); + if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length); - Mont.prototype.mul = function mul(a, b) { - if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + if (typeof password === 'string') password = Buffer.from(password); + if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length); - var t = a.mul(b); - var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); - var u = t.isub(c).iushrn(this.shift); - var res = u; - if (u.cmp(this.m) >= 0) { - res = u.isub(this.m); - } else if (u.cmpn(0) < 0) { - res = u.iadd(this.m); - } + if (config.type === 'stream') { + return new StreamCipher(config.module, password, iv, true); + } else if (config.type === 'auth') { + return new AuthCipher(config.module, password, iv, true); + } - return res._forceRed(this); - }; + return new Decipher(config.module, password, iv); + } - Mont.prototype.invm = function invm(a) { - // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R - var res = this.imod(a._invmp(this.m).mul(this.r2)); - return res._forceRed(this); - }; - })(typeof module === 'undefined' || module, this); - }, { "buffer": 17 }], 241: [function (require, module, exports) { - arguments[4][16][0].apply(exports, arguments); - }, { "crypto": 17, "dup": 16 }], 242: [function (require, module, exports) { - arguments[4][18][0].apply(exports, arguments); - }, { "dup": 18, "safe-buffer": 350 }], 243: [function (require, module, exports) { - arguments[4][19][0].apply(exports, arguments); - }, { "./aes": 242, "./ghash": 247, "./incr32": 248, "buffer-xor": 269, "cipher-base": 270, "dup": 19, "inherits": 325, "safe-buffer": 350 }], 244: [function (require, module, exports) { - arguments[4][20][0].apply(exports, arguments); - }, { "./decrypter": 245, "./encrypter": 246, "./modes/list.json": 256, "dup": 20 }], 245: [function (require, module, exports) { - arguments[4][21][0].apply(exports, arguments); - }, { "./aes": 242, "./authCipher": 243, "./modes": 255, "./streamCipher": 258, "cipher-base": 270, "dup": 21, "evp_bytestokey": 310, "inherits": 325, "safe-buffer": 350 }], 246: [function (require, module, exports) { + function createDecipher(suite, password) { + var config = MODES[suite.toLowerCase()]; + if (!config) throw new TypeError('invalid suite type'); + + var keys = ebtk(password, false, config.key, config.iv); + return createDecipheriv(suite, keys.key, keys.iv); + } + + exports.createDecipher = createDecipher; + exports.createDecipheriv = createDecipheriv; + }, { "./aes": 265, "./authCipher": 266, "./modes": 278, "./streamCipher": 281, "cipher-base": 293, "evp_bytestokey": 333, "inherits": 348, "safe-buffer": 373 }], 269: [function (require, module, exports) { arguments[4][22][0].apply(exports, arguments); - }, { "./aes": 242, "./authCipher": 243, "./modes": 255, "./streamCipher": 258, "cipher-base": 270, "dup": 22, "evp_bytestokey": 310, "inherits": 325, "safe-buffer": 350 }], 247: [function (require, module, exports) { + }, { "./aes": 265, "./authCipher": 266, "./modes": 278, "./streamCipher": 281, "cipher-base": 293, "dup": 22, "evp_bytestokey": 333, "inherits": 348, "safe-buffer": 373 }], 270: [function (require, module, exports) { arguments[4][23][0].apply(exports, arguments); - }, { "dup": 23, "safe-buffer": 350 }], 248: [function (require, module, exports) { + }, { "dup": 23, "safe-buffer": 373 }], 271: [function (require, module, exports) { arguments[4][24][0].apply(exports, arguments); - }, { "dup": 24 }], 249: [function (require, module, exports) { + }, { "dup": 24 }], 272: [function (require, module, exports) { arguments[4][25][0].apply(exports, arguments); - }, { "buffer-xor": 269, "dup": 25 }], 250: [function (require, module, exports) { + }, { "buffer-xor": 292, "dup": 25 }], 273: [function (require, module, exports) { arguments[4][26][0].apply(exports, arguments); - }, { "buffer-xor": 269, "dup": 26, "safe-buffer": 350 }], 251: [function (require, module, exports) { + }, { "buffer-xor": 292, "dup": 26, "safe-buffer": 373 }], 274: [function (require, module, exports) { arguments[4][27][0].apply(exports, arguments); - }, { "dup": 27, "safe-buffer": 350 }], 252: [function (require, module, exports) { + }, { "dup": 27, "safe-buffer": 373 }], 275: [function (require, module, exports) { arguments[4][28][0].apply(exports, arguments); - }, { "dup": 28, "safe-buffer": 350 }], 253: [function (require, module, exports) { + }, { "dup": 28, "safe-buffer": 373 }], 276: [function (require, module, exports) { arguments[4][29][0].apply(exports, arguments); - }, { "../incr32": 248, "buffer-xor": 269, "dup": 29, "safe-buffer": 350 }], 254: [function (require, module, exports) { + }, { "../incr32": 271, "buffer-xor": 292, "dup": 29, "safe-buffer": 373 }], 277: [function (require, module, exports) { arguments[4][30][0].apply(exports, arguments); - }, { "dup": 30 }], 255: [function (require, module, exports) { + }, { "dup": 30 }], 278: [function (require, module, exports) { arguments[4][31][0].apply(exports, arguments); - }, { "./cbc": 249, "./cfb": 250, "./cfb1": 251, "./cfb8": 252, "./ctr": 253, "./ecb": 254, "./list.json": 256, "./ofb": 257, "dup": 31 }], 256: [function (require, module, exports) { + }, { "./cbc": 272, "./cfb": 273, "./cfb1": 274, "./cfb8": 275, "./ctr": 276, "./ecb": 277, "./list.json": 279, "./ofb": 280, "dup": 31 }], 279: [function (require, module, exports) { arguments[4][32][0].apply(exports, arguments); - }, { "dup": 32 }], 257: [function (require, module, exports) { + }, { "dup": 32 }], 280: [function (require, module, exports) { (function (Buffer) { var xor = require('buffer-xor'); @@ -32805,11 +36254,83 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return xor(chunk, pad); }; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "buffer-xor": 269 }], 258: [function (require, module, exports) { + }, { "buffer": 47, "buffer-xor": 292 }], 281: [function (require, module, exports) { arguments[4][34][0].apply(exports, arguments); - }, { "./aes": 242, "cipher-base": 270, "dup": 34, "inherits": 325, "safe-buffer": 350 }], 259: [function (require, module, exports) { - arguments[4][35][0].apply(exports, arguments); - }, { "browserify-aes/browser": 244, "browserify-aes/modes": 255, "browserify-des": 260, "browserify-des/modes": 261, "dup": 35, "evp_bytestokey": 310 }], 260: [function (require, module, exports) { + }, { "./aes": 265, "cipher-base": 293, "dup": 34, "inherits": 348, "safe-buffer": 373 }], 282: [function (require, module, exports) { + var ebtk = require('evp_bytestokey'); + var aes = require('browserify-aes/browser'); + var DES = require('browserify-des'); + var desModes = require('browserify-des/modes'); + var aesModes = require('browserify-aes/modes'); + function createCipher(suite, password) { + var keyLen, ivLen; + suite = suite.toLowerCase(); + if (aesModes[suite]) { + keyLen = aesModes[suite].key; + ivLen = aesModes[suite].iv; + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8; + ivLen = desModes[suite].iv; + } else { + throw new TypeError('invalid suite type'); + } + var keys = ebtk(password, false, keyLen, ivLen); + return createCipheriv(suite, keys.key, keys.iv); + } + function createDecipher(suite, password) { + var keyLen, ivLen; + suite = suite.toLowerCase(); + if (aesModes[suite]) { + keyLen = aesModes[suite].key; + ivLen = aesModes[suite].iv; + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8; + ivLen = desModes[suite].iv; + } else { + throw new TypeError('invalid suite type'); + } + var keys = ebtk(password, false, keyLen, ivLen); + return createDecipheriv(suite, keys.key, keys.iv); + } + + function createCipheriv(suite, key, iv) { + suite = suite.toLowerCase(); + if (aesModes[suite]) { + return aes.createCipheriv(suite, key, iv); + } else if (desModes[suite]) { + return new DES({ + key: key, + iv: iv, + mode: suite + }); + } else { + throw new TypeError('invalid suite type'); + } + } + function createDecipheriv(suite, key, iv) { + suite = suite.toLowerCase(); + if (aesModes[suite]) { + return aes.createDecipheriv(suite, key, iv); + } else if (desModes[suite]) { + return new DES({ + key: key, + iv: iv, + mode: suite, + decrypt: true + }); + } else { + throw new TypeError('invalid suite type'); + } + } + exports.createCipher = exports.Cipher = createCipher; + exports.createCipheriv = exports.Cipheriv = createCipheriv; + exports.createDecipher = exports.Decipher = createDecipher; + exports.createDecipheriv = exports.Decipheriv = createDecipheriv; + function getCiphers() { + return Object.keys(desModes).concat(aes.getCiphers()); + } + exports.listCiphers = exports.getCiphers = getCiphers; + }, { "browserify-aes/browser": 267, "browserify-aes/modes": 278, "browserify-des": 283, "browserify-des/modes": 284, "evp_bytestokey": 333 }], 283: [function (require, module, exports) { (function (Buffer) { var CipherBase = require('cipher-base'); var des = require('des.js'); @@ -32855,9 +36376,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return new Buffer(this._des.final()); }; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "cipher-base": 270, "des.js": 278, "inherits": 325 }], 261: [function (require, module, exports) { + }, { "buffer": 47, "cipher-base": 293, "des.js": 301, "inherits": 348 }], 284: [function (require, module, exports) { arguments[4][37][0].apply(exports, arguments); - }, { "dup": 37 }], 262: [function (require, module, exports) { + }, { "dup": 37 }], 285: [function (require, module, exports) { (function (Buffer) { var bn = require('bn.js'); var randomBytes = require('randombytes'); @@ -32899,13 +36420,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return r; } }).call(this, require("buffer").Buffer); - }, { "bn.js": 240, "buffer": 47, "randombytes": 347 }], 263: [function (require, module, exports) { + }, { "bn.js": 263, "buffer": 47, "randombytes": 370 }], 286: [function (require, module, exports) { arguments[4][39][0].apply(exports, arguments); - }, { "./browser/algorithms.json": 264, "dup": 39 }], 264: [function (require, module, exports) { + }, { "./browser/algorithms.json": 287, "dup": 39 }], 287: [function (require, module, exports) { arguments[4][40][0].apply(exports, arguments); - }, { "dup": 40 }], 265: [function (require, module, exports) { + }, { "dup": 40 }], 288: [function (require, module, exports) { arguments[4][41][0].apply(exports, arguments); - }, { "dup": 41 }], 266: [function (require, module, exports) { + }, { "dup": 41 }], 289: [function (require, module, exports) { (function (Buffer) { var createHash = require('create-hash'); var stream = require('stream'); @@ -32999,7 +36520,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol createVerify: createVerify }; }).call(this, require("buffer").Buffer); - }, { "./algorithms.json": 264, "./sign": 267, "./verify": 268, "buffer": 47, "create-hash": 272, "inherits": 325, "stream": 156 }], 267: [function (require, module, exports) { + }, { "./algorithms.json": 287, "./sign": 290, "./verify": 291, "buffer": 47, "create-hash": 295, "inherits": 348, "stream": 158 }], 290: [function (require, module, exports) { (function (Buffer) { // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var createHmac = require('create-hmac'); @@ -33148,7 +36669,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports.getKey = getKey; module.exports.makeKey = makeKey; }).call(this, require("buffer").Buffer); - }, { "./curves.json": 265, "bn.js": 240, "browserify-rsa": 262, "buffer": 47, "create-hmac": 275, "elliptic": 288, "parse-asn1": 335 }], 268: [function (require, module, exports) { + }, { "./curves.json": 288, "bn.js": 263, "browserify-rsa": 285, "buffer": 47, "create-hmac": 298, "elliptic": 311, "parse-asn1": 358 }], 291: [function (require, module, exports) { (function (Buffer) { // much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js var BN = require('bn.js'); @@ -33230,7 +36751,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = verify; }).call(this, require("buffer").Buffer); - }, { "./curves.json": 265, "bn.js": 240, "buffer": 47, "elliptic": 288, "parse-asn1": 335 }], 269: [function (require, module, exports) { + }, { "./curves.json": 288, "bn.js": 263, "buffer": 47, "elliptic": 311, "parse-asn1": 358 }], 292: [function (require, module, exports) { (function (Buffer) { module.exports = function xor(a, b) { var length = Math.min(a.length, b.length); @@ -33243,9 +36764,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return buffer; }; }).call(this, require("buffer").Buffer); - }, { "buffer": 47 }], 270: [function (require, module, exports) { - arguments[4][48][0].apply(exports, arguments); - }, { "dup": 48, "inherits": 325, "safe-buffer": 350, "stream": 156, "string_decoder": 157 }], 271: [function (require, module, exports) { + }, { "buffer": 47 }], 293: [function (require, module, exports) { + arguments[4][49][0].apply(exports, arguments); + }, { "dup": 49, "inherits": 348, "safe-buffer": 373, "stream": 158, "string_decoder": 163 }], 294: [function (require, module, exports) { (function (Buffer) { var elliptic = require('elliptic'); var BN = require('bn.js'); @@ -33370,7 +36891,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } }).call(this, require("buffer").Buffer); - }, { "bn.js": 240, "buffer": 47, "elliptic": 288 }], 272: [function (require, module, exports) { + }, { "bn.js": 263, "buffer": 47, "elliptic": 311 }], 295: [function (require, module, exports) { (function (Buffer) { 'use strict'; @@ -33426,7 +36947,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return new Hash(sha(alg)); }; }).call(this, require("buffer").Buffer); - }, { "./md5": 274, "buffer": 47, "cipher-base": 270, "inherits": 325, "ripemd160": 349, "sha.js": 354 }], 273: [function (require, module, exports) { + }, { "./md5": 297, "buffer": 47, "cipher-base": 293, "inherits": 348, "ripemd160": 372, "sha.js": 377 }], 296: [function (require, module, exports) { (function (Buffer) { 'use strict'; @@ -33460,27 +36981,177 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return buf; }; }).call(this, require("buffer").Buffer); - }, { "buffer": 47 }], 274: [function (require, module, exports) { - arguments[4][53][0].apply(exports, arguments); - }, { "./make-hash": 273, "dup": 53 }], 275: [function (require, module, exports) { + }, { "buffer": 47 }], 297: [function (require, module, exports) { + 'use strict'; + /* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ + + var makeHash = require('./make-hash'); + + /* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ + function core_md5(x, len) { + /* append padding */ + x[len >> 5] |= 0x80 << len % 32; + x[(len + 64 >>> 9 << 4) + 14] = len; + + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + + for (var i = 0; i < x.length; i += 16) { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936); + d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897); + d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); + d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i + 10], 17, -42063); + b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); + d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510); + d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); + c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i + 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691); + d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083); + c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438); + d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); + c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); + d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784); + c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i + 5], 4, -378558); + d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); + d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174); + d = md5_hh(d, a, b, c, x[i + 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487); + d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844); + d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); + d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); + d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070); + d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + + return [a, b, c, d]; + } + + /* + * These functions implement the four basic operations the algorithm uses. + */ + function md5_cmn(q, a, b, x, s, t) { + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); + } + + function md5_ff(a, b, c, d, x, s, t) { + return md5_cmn(b & c | ~b & d, a, b, x, s, t); + } + + function md5_gg(a, b, c, d, x, s, t) { + return md5_cmn(b & d | c & ~d, a, b, x, s, t); + } + + function md5_hh(a, b, c, d, x, s, t) { + return md5_cmn(b ^ c ^ d, a, b, x, s, t); + } + + function md5_ii(a, b, c, d, x, s, t) { + return md5_cmn(c ^ (b | ~d), a, b, x, s, t); + } + + /* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ + function safe_add(x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 0xFFFF; + } + + /* + * Bitwise rotate a 32-bit number to the left. + */ + function bit_rol(num, cnt) { + return num << cnt | num >>> 32 - cnt; + } + + module.exports = function md5(buf) { + return makeHash(buf, core_md5); + }; + }, { "./make-hash": 296 }], 298: [function (require, module, exports) { arguments[4][54][0].apply(exports, arguments); - }, { "./legacy": 276, "cipher-base": 270, "create-hash/md5": 274, "dup": 54, "inherits": 325, "ripemd160": 349, "safe-buffer": 350, "sha.js": 354 }], 276: [function (require, module, exports) { + }, { "./legacy": 299, "cipher-base": 293, "create-hash/md5": 297, "dup": 54, "inherits": 348, "ripemd160": 372, "safe-buffer": 373, "sha.js": 377 }], 299: [function (require, module, exports) { arguments[4][55][0].apply(exports, arguments); - }, { "cipher-base": 270, "dup": 55, "inherits": 325, "safe-buffer": 350 }], 277: [function (require, module, exports) { + }, { "cipher-base": 293, "dup": 55, "inherits": 348, "safe-buffer": 373 }], 300: [function (require, module, exports) { arguments[4][56][0].apply(exports, arguments); - }, { "browserify-cipher": 259, "browserify-sign": 266, "browserify-sign/algos": 263, "create-ecdh": 271, "create-hash": 272, "create-hmac": 275, "diffie-hellman": 284, "dup": 56, "pbkdf2": 336, "public-encrypt": 341, "randombytes": 347, "randomfill": 348 }], 278: [function (require, module, exports) { + }, { "browserify-cipher": 282, "browserify-sign": 289, "browserify-sign/algos": 286, "create-ecdh": 294, "create-hash": 295, "create-hmac": 298, "diffie-hellman": 307, "dup": 56, "pbkdf2": 359, "public-encrypt": 364, "randombytes": 370, "randomfill": 371 }], 301: [function (require, module, exports) { arguments[4][57][0].apply(exports, arguments); - }, { "./des/cbc": 279, "./des/cipher": 280, "./des/des": 281, "./des/ede": 282, "./des/utils": 283, "dup": 57 }], 279: [function (require, module, exports) { + }, { "./des/cbc": 302, "./des/cipher": 303, "./des/des": 304, "./des/ede": 305, "./des/utils": 306, "dup": 57 }], 302: [function (require, module, exports) { arguments[4][58][0].apply(exports, arguments); - }, { "dup": 58, "inherits": 325, "minimalistic-assert": 329 }], 280: [function (require, module, exports) { + }, { "dup": 58, "inherits": 348, "minimalistic-assert": 352 }], 303: [function (require, module, exports) { arguments[4][59][0].apply(exports, arguments); - }, { "dup": 59, "minimalistic-assert": 329 }], 281: [function (require, module, exports) { + }, { "dup": 59, "minimalistic-assert": 352 }], 304: [function (require, module, exports) { arguments[4][60][0].apply(exports, arguments); - }, { "../des": 278, "dup": 60, "inherits": 325, "minimalistic-assert": 329 }], 282: [function (require, module, exports) { + }, { "../des": 301, "dup": 60, "inherits": 348, "minimalistic-assert": 352 }], 305: [function (require, module, exports) { arguments[4][61][0].apply(exports, arguments); - }, { "../des": 278, "dup": 61, "inherits": 325, "minimalistic-assert": 329 }], 283: [function (require, module, exports) { + }, { "../des": 301, "dup": 61, "inherits": 348, "minimalistic-assert": 352 }], 306: [function (require, module, exports) { arguments[4][62][0].apply(exports, arguments); - }, { "dup": 62 }], 284: [function (require, module, exports) { + }, { "dup": 62 }], 307: [function (require, module, exports) { (function (Buffer) { var generatePrime = require('./lib/generatePrime'); var primes = require('./lib/primes.json'); @@ -33525,7 +37196,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman; exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman; }).call(this, require("buffer").Buffer); - }, { "./lib/dh": 285, "./lib/generatePrime": 286, "./lib/primes.json": 287, "buffer": 47 }], 285: [function (require, module, exports) { + }, { "./lib/dh": 308, "./lib/generatePrime": 309, "./lib/primes.json": 310, "buffer": 47 }], 308: [function (require, module, exports) { (function (Buffer) { var BN = require('bn.js'); var MillerRabin = require('miller-rabin'); @@ -33689,81 +37360,63 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } } }).call(this, require("buffer").Buffer); - }, { "./generatePrime": 286, "bn.js": 240, "buffer": 47, "miller-rabin": 328, "randombytes": 347 }], 286: [function (require, module, exports) { + }, { "./generatePrime": 309, "bn.js": 263, "buffer": 47, "miller-rabin": 351, "randombytes": 370 }], 309: [function (require, module, exports) { arguments[4][65][0].apply(exports, arguments); - }, { "bn.js": 240, "dup": 65, "miller-rabin": 328, "randombytes": 347 }], 287: [function (require, module, exports) { + }, { "bn.js": 263, "dup": 65, "miller-rabin": 351, "randombytes": 370 }], 310: [function (require, module, exports) { arguments[4][66][0].apply(exports, arguments); - }, { "dup": 66 }], 288: [function (require, module, exports) { + }, { "dup": 66 }], 311: [function (require, module, exports) { arguments[4][67][0].apply(exports, arguments); - }, { "../package.json": 303, "./elliptic/curve": 291, "./elliptic/curves": 294, "./elliptic/ec": 295, "./elliptic/eddsa": 298, "./elliptic/utils": 302, "brorand": 241, "dup": 67 }], 289: [function (require, module, exports) { + }, { "../package.json": 326, "./elliptic/curve": 314, "./elliptic/curves": 317, "./elliptic/ec": 318, "./elliptic/eddsa": 321, "./elliptic/utils": 325, "brorand": 264, "dup": 67 }], 312: [function (require, module, exports) { arguments[4][68][0].apply(exports, arguments); - }, { "../../elliptic": 288, "bn.js": 240, "dup": 68 }], 290: [function (require, module, exports) { + }, { "../../elliptic": 311, "bn.js": 263, "dup": 68 }], 313: [function (require, module, exports) { arguments[4][69][0].apply(exports, arguments); - }, { "../../elliptic": 288, "../curve": 291, "bn.js": 240, "dup": 69, "inherits": 325 }], 291: [function (require, module, exports) { + }, { "../../elliptic": 311, "../curve": 314, "bn.js": 263, "dup": 69, "inherits": 348 }], 314: [function (require, module, exports) { arguments[4][70][0].apply(exports, arguments); - }, { "./base": 289, "./edwards": 290, "./mont": 292, "./short": 293, "dup": 70 }], 292: [function (require, module, exports) { + }, { "./base": 312, "./edwards": 313, "./mont": 315, "./short": 316, "dup": 70 }], 315: [function (require, module, exports) { arguments[4][71][0].apply(exports, arguments); - }, { "../../elliptic": 288, "../curve": 291, "bn.js": 240, "dup": 71, "inherits": 325 }], 293: [function (require, module, exports) { + }, { "../../elliptic": 311, "../curve": 314, "bn.js": 263, "dup": 71, "inherits": 348 }], 316: [function (require, module, exports) { arguments[4][72][0].apply(exports, arguments); - }, { "../../elliptic": 288, "../curve": 291, "bn.js": 240, "dup": 72, "inherits": 325 }], 294: [function (require, module, exports) { + }, { "../../elliptic": 311, "../curve": 314, "bn.js": 263, "dup": 72, "inherits": 348 }], 317: [function (require, module, exports) { arguments[4][73][0].apply(exports, arguments); - }, { "../elliptic": 288, "./precomputed/secp256k1": 301, "dup": 73, "hash.js": 312 }], 295: [function (require, module, exports) { + }, { "../elliptic": 311, "./precomputed/secp256k1": 324, "dup": 73, "hash.js": 335 }], 318: [function (require, module, exports) { arguments[4][74][0].apply(exports, arguments); - }, { "../../elliptic": 288, "./key": 296, "./signature": 297, "bn.js": 240, "dup": 74, "hmac-drbg": 324 }], 296: [function (require, module, exports) { + }, { "../../elliptic": 311, "./key": 319, "./signature": 320, "bn.js": 263, "dup": 74, "hmac-drbg": 347 }], 319: [function (require, module, exports) { arguments[4][75][0].apply(exports, arguments); - }, { "../../elliptic": 288, "bn.js": 240, "dup": 75 }], 297: [function (require, module, exports) { + }, { "../../elliptic": 311, "bn.js": 263, "dup": 75 }], 320: [function (require, module, exports) { arguments[4][76][0].apply(exports, arguments); - }, { "../../elliptic": 288, "bn.js": 240, "dup": 76 }], 298: [function (require, module, exports) { + }, { "../../elliptic": 311, "bn.js": 263, "dup": 76 }], 321: [function (require, module, exports) { arguments[4][77][0].apply(exports, arguments); - }, { "../../elliptic": 288, "./key": 299, "./signature": 300, "dup": 77, "hash.js": 312 }], 299: [function (require, module, exports) { + }, { "../../elliptic": 311, "./key": 322, "./signature": 323, "dup": 77, "hash.js": 335 }], 322: [function (require, module, exports) { arguments[4][78][0].apply(exports, arguments); - }, { "../../elliptic": 288, "dup": 78 }], 300: [function (require, module, exports) { + }, { "../../elliptic": 311, "dup": 78 }], 323: [function (require, module, exports) { arguments[4][79][0].apply(exports, arguments); - }, { "../../elliptic": 288, "bn.js": 240, "dup": 79 }], 301: [function (require, module, exports) { + }, { "../../elliptic": 311, "bn.js": 263, "dup": 79 }], 324: [function (require, module, exports) { arguments[4][80][0].apply(exports, arguments); - }, { "dup": 80 }], 302: [function (require, module, exports) { + }, { "dup": 80 }], 325: [function (require, module, exports) { arguments[4][81][0].apply(exports, arguments); - }, { "bn.js": 240, "dup": 81, "minimalistic-assert": 329, "minimalistic-crypto-utils": 330 }], 303: [function (require, module, exports) { + }, { "bn.js": 263, "dup": 81, "minimalistic-assert": 352, "minimalistic-crypto-utils": 353 }], 326: [function (require, module, exports) { module.exports = { - "_args": [[{ - "raw": "elliptic@^6.0.0", - "scope": null, - "escapedName": "elliptic", - "name": "elliptic", - "rawSpec": "^6.0.0", - "spec": ">=6.0.0 <7.0.0", - "type": "range" - }, "/Users/frozeman/Sites/_ethereum/web3/packages/web3-eth-accounts/node_modules/browserify-sign"]], - "_from": "elliptic@>=6.0.0 <7.0.0", + "_args": [["elliptic@6.4.0", "/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts"]], + "_from": "elliptic@6.4.0", "_id": "elliptic@6.4.0", - "_inCache": true, + "_inBundle": false, + "_integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", "_location": "/elliptic", - "_nodeVersion": "7.0.0", - "_npmOperationalInternal": { - "host": "packages-18-east.internal.npmjs.com", - "tmp": "tmp/elliptic-6.4.0.tgz_1487798866428_0.30510620190761983" - }, - "_npmUser": { - "name": "indutny", - "email": "fedor@indutny.com" - }, - "_npmVersion": "3.10.8", "_phantomChildren": {}, "_requested": { - "raw": "elliptic@^6.0.0", - "scope": null, - "escapedName": "elliptic", + "type": "version", + "registry": true, + "raw": "elliptic@6.4.0", "name": "elliptic", - "rawSpec": "^6.0.0", - "spec": ">=6.0.0 <7.0.0", - "type": "range" + "escapedName": "elliptic", + "rawSpec": "6.4.0", + "saveSpec": null, + "fetchSpec": "6.4.0" }, "_requiredBy": ["/browserify-sign", "/create-ecdh", "/eth-lib"], "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "_shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", - "_shrinkwrap": null, - "_spec": "elliptic@^6.0.0", - "_where": "/Users/frozeman/Sites/_ethereum/web3/packages/web3-eth-accounts/node_modules/browserify-sign", + "_spec": "6.4.0", + "_where": "/Users/sam/Development/foundation/web3.js/packages/web3-eth-accounts", "author": { "name": "Fedor Indutny", "email": "fedor@indutny.com" @@ -33797,24 +37450,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol "jshint": "^2.6.0", "mocha": "^2.1.0" }, - "directories": {}, - "dist": { - "shasum": "cac9af8762c85836187003c8dfe193e5e2eae5df", - "tarball": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz" - }, "files": ["lib"], - "gitHead": "6b0d2b76caae91471649c8e21f0b1d3ba0f96090", "homepage": "https://github.com/indutny/elliptic", "keywords": ["EC", "Elliptic", "curve", "Cryptography"], "license": "MIT", "main": "lib/elliptic.js", - "maintainers": [{ - "name": "indutny", - "email": "fedor@indutny.com" - }], "name": "elliptic", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", "repository": { "type": "git", "url": "git+ssh://git@github.com/indutny/elliptic.git" @@ -33829,7 +37470,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }, "version": "6.4.0" }; - }, {}], 304: [function (require, module, exports) { + }, {}], 327: [function (require, module, exports) { (function (Buffer) { var _slicedToArray = function () { function sliceIterator(arr, i) { @@ -33937,13 +37578,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol decodeSignature: decodeSignature }; }).call(this, require("buffer").Buffer); - }, { "./bytes": 306, "./hash": 307, "./nat": 308, "./rlp": 309, "buffer": 47, "elliptic": 288 }], 305: [function (require, module, exports) { - arguments[4][163][0].apply(exports, arguments); - }, { "dup": 163 }], 306: [function (require, module, exports) { - arguments[4][164][0].apply(exports, arguments); - }, { "./array.js": 305, "dup": 164 }], 307: [function (require, module, exports) { - arguments[4][165][0].apply(exports, arguments); - }, { "dup": 165 }], 308: [function (require, module, exports) { + }, { "./bytes": 329, "./hash": 330, "./nat": 331, "./rlp": 332, "buffer": 47, "elliptic": 311 }], 328: [function (require, module, exports) { + arguments[4][171][0].apply(exports, arguments); + }, { "dup": 171 }], 329: [function (require, module, exports) { + arguments[4][172][0].apply(exports, arguments); + }, { "./array.js": 328, "dup": 172 }], 330: [function (require, module, exports) { + arguments[4][173][0].apply(exports, arguments); + }, { "dup": 173 }], 331: [function (require, module, exports) { var BN = require("bn.js"); var Bytes = require("./bytes"); @@ -34008,7 +37649,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol div: div, sub: sub }; - }, { "./bytes": 306, "bn.js": 240 }], 309: [function (require, module, exports) { + }, { "./bytes": 329, "bn.js": 263 }], 332: [function (require, module, exports) { // The RLP format // Serialization and deserialization for the BytesTree type, under the following grammar: // | First byte | Meaning | @@ -34082,9 +37723,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; module.exports = { encode: encode, decode: decode }; - }, {}], 310: [function (require, module, exports) { + }, {}], 333: [function (require, module, exports) { arguments[4][84][0].apply(exports, arguments); - }, { "dup": 84, "md5.js": 326, "safe-buffer": 350 }], 311: [function (require, module, exports) { + }, { "dup": 84, "md5.js": 349, "safe-buffer": 373 }], 334: [function (require, module, exports) { (function (Buffer) { 'use strict'; @@ -34172,35 +37813,35 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = HashBase; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "inherits": 325, "stream": 156 }], 312: [function (require, module, exports) { + }, { "buffer": 47, "inherits": 348, "stream": 158 }], 335: [function (require, module, exports) { arguments[4][86][0].apply(exports, arguments); - }, { "./hash/common": 313, "./hash/hmac": 314, "./hash/ripemd": 315, "./hash/sha": 316, "./hash/utils": 323, "dup": 86 }], 313: [function (require, module, exports) { + }, { "./hash/common": 336, "./hash/hmac": 337, "./hash/ripemd": 338, "./hash/sha": 339, "./hash/utils": 346, "dup": 86 }], 336: [function (require, module, exports) { arguments[4][87][0].apply(exports, arguments); - }, { "./utils": 323, "dup": 87, "minimalistic-assert": 329 }], 314: [function (require, module, exports) { + }, { "./utils": 346, "dup": 87, "minimalistic-assert": 352 }], 337: [function (require, module, exports) { arguments[4][88][0].apply(exports, arguments); - }, { "./utils": 323, "dup": 88, "minimalistic-assert": 329 }], 315: [function (require, module, exports) { + }, { "./utils": 346, "dup": 88, "minimalistic-assert": 352 }], 338: [function (require, module, exports) { arguments[4][89][0].apply(exports, arguments); - }, { "./common": 313, "./utils": 323, "dup": 89 }], 316: [function (require, module, exports) { + }, { "./common": 336, "./utils": 346, "dup": 89 }], 339: [function (require, module, exports) { arguments[4][90][0].apply(exports, arguments); - }, { "./sha/1": 317, "./sha/224": 318, "./sha/256": 319, "./sha/384": 320, "./sha/512": 321, "dup": 90 }], 317: [function (require, module, exports) { + }, { "./sha/1": 340, "./sha/224": 341, "./sha/256": 342, "./sha/384": 343, "./sha/512": 344, "dup": 90 }], 340: [function (require, module, exports) { arguments[4][91][0].apply(exports, arguments); - }, { "../common": 313, "../utils": 323, "./common": 322, "dup": 91 }], 318: [function (require, module, exports) { + }, { "../common": 336, "../utils": 346, "./common": 345, "dup": 91 }], 341: [function (require, module, exports) { arguments[4][92][0].apply(exports, arguments); - }, { "../utils": 323, "./256": 319, "dup": 92 }], 319: [function (require, module, exports) { + }, { "../utils": 346, "./256": 342, "dup": 92 }], 342: [function (require, module, exports) { arguments[4][93][0].apply(exports, arguments); - }, { "../common": 313, "../utils": 323, "./common": 322, "dup": 93, "minimalistic-assert": 329 }], 320: [function (require, module, exports) { + }, { "../common": 336, "../utils": 346, "./common": 345, "dup": 93, "minimalistic-assert": 352 }], 343: [function (require, module, exports) { arguments[4][94][0].apply(exports, arguments); - }, { "../utils": 323, "./512": 321, "dup": 94 }], 321: [function (require, module, exports) { + }, { "../utils": 346, "./512": 344, "dup": 94 }], 344: [function (require, module, exports) { arguments[4][95][0].apply(exports, arguments); - }, { "../common": 313, "../utils": 323, "dup": 95, "minimalistic-assert": 329 }], 322: [function (require, module, exports) { + }, { "../common": 336, "../utils": 346, "dup": 95, "minimalistic-assert": 352 }], 345: [function (require, module, exports) { arguments[4][96][0].apply(exports, arguments); - }, { "../utils": 323, "dup": 96 }], 323: [function (require, module, exports) { + }, { "../utils": 346, "dup": 96 }], 346: [function (require, module, exports) { arguments[4][97][0].apply(exports, arguments); - }, { "dup": 97, "inherits": 325, "minimalistic-assert": 329 }], 324: [function (require, module, exports) { + }, { "dup": 97, "inherits": 348, "minimalistic-assert": 352 }], 347: [function (require, module, exports) { arguments[4][98][0].apply(exports, arguments); - }, { "dup": 98, "hash.js": 312, "minimalistic-assert": 329, "minimalistic-crypto-utils": 330 }], 325: [function (require, module, exports) { - arguments[4][101][0].apply(exports, arguments); - }, { "dup": 101 }], 326: [function (require, module, exports) { + }, { "dup": 98, "hash.js": 335, "minimalistic-assert": 352, "minimalistic-crypto-utils": 353 }], 348: [function (require, module, exports) { + arguments[4][102][0].apply(exports, arguments); + }, { "dup": 102 }], 349: [function (require, module, exports) { (function (Buffer) { 'use strict'; @@ -34349,21 +37990,21 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = MD5; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "hash-base": 327, "inherits": 325 }], 327: [function (require, module, exports) { - arguments[4][105][0].apply(exports, arguments); - }, { "dup": 105, "inherits": 325, "safe-buffer": 350, "stream": 156 }], 328: [function (require, module, exports) { + }, { "buffer": 47, "hash-base": 350, "inherits": 348 }], 350: [function (require, module, exports) { + arguments[4][85][0].apply(exports, arguments); + }, { "dup": 85, "inherits": 348, "safe-buffer": 373, "stream": 158 }], 351: [function (require, module, exports) { arguments[4][106][0].apply(exports, arguments); - }, { "bn.js": 240, "brorand": 241, "dup": 106 }], 329: [function (require, module, exports) { + }, { "bn.js": 263, "brorand": 264, "dup": 106 }], 352: [function (require, module, exports) { arguments[4][107][0].apply(exports, arguments); - }, { "dup": 107 }], 330: [function (require, module, exports) { + }, { "dup": 107 }], 353: [function (require, module, exports) { arguments[4][108][0].apply(exports, arguments); - }, { "dup": 108 }], 331: [function (require, module, exports) { - arguments[4][109][0].apply(exports, arguments); - }, { "dup": 109 }], 332: [function (require, module, exports) { + }, { "dup": 108 }], 354: [function (require, module, exports) { arguments[4][110][0].apply(exports, arguments); - }, { "./certificate": 333, "asn1.js": 226, "dup": 110 }], 333: [function (require, module, exports) { + }, { "dup": 110 }], 355: [function (require, module, exports) { arguments[4][111][0].apply(exports, arguments); - }, { "asn1.js": 226, "dup": 111 }], 334: [function (require, module, exports) { + }, { "./certificate": 356, "asn1.js": 249, "dup": 111 }], 356: [function (require, module, exports) { + arguments[4][112][0].apply(exports, arguments); + }, { "asn1.js": 249, "dup": 112 }], 357: [function (require, module, exports) { (function (Buffer) { // adapted from https://github.com/apatil/pemstrip var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m; @@ -34396,7 +38037,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }; }; }).call(this, require("buffer").Buffer); - }, { "browserify-aes": 244, "buffer": 47, "evp_bytestokey": 310 }], 335: [function (require, module, exports) { + }, { "browserify-aes": 267, "buffer": 47, "evp_bytestokey": 333 }], 358: [function (require, module, exports) { (function (Buffer) { var asn1 = require('./asn1'); var aesid = require('./aesid.json'); @@ -34508,9 +38149,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return Buffer.concat(out); } }).call(this, require("buffer").Buffer); - }, { "./aesid.json": 331, "./asn1": 332, "./fixProc": 334, "browserify-aes": 244, "buffer": 47, "pbkdf2": 336 }], 336: [function (require, module, exports) { - arguments[4][114][0].apply(exports, arguments); - }, { "./lib/async": 337, "./lib/sync": 340, "dup": 114 }], 337: [function (require, module, exports) { + }, { "./aesid.json": 354, "./asn1": 355, "./fixProc": 357, "browserify-aes": 267, "buffer": 47, "pbkdf2": 359 }], 359: [function (require, module, exports) { + + exports.pbkdf2 = require('./lib/async'); + + exports.pbkdf2Sync = require('./lib/sync'); + }, { "./lib/async": 360, "./lib/sync": 363 }], 360: [function (require, module, exports) { (function (process, global) { var checkParameters = require('./precondition'); var defaultEncoding = require('./default-encoding'); @@ -34608,7 +38252,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol }), callback); }; }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "./default-encoding": 338, "./precondition": 339, "./sync": 340, "_process": 120, "safe-buffer": 350 }], 338: [function (require, module, exports) { + }, { "./default-encoding": 361, "./precondition": 362, "./sync": 363, "_process": 121, "safe-buffer": 373 }], 361: [function (require, module, exports) { (function (process) { var defaultEncoding; /* istanbul ignore next */ @@ -34621,13 +38265,133 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } module.exports = defaultEncoding; }).call(this, require('_process')); - }, { "_process": 120 }], 339: [function (require, module, exports) { - arguments[4][117][0].apply(exports, arguments); - }, { "dup": 117 }], 340: [function (require, module, exports) { - arguments[4][118][0].apply(exports, arguments); - }, { "./default-encoding": 338, "./precondition": 339, "create-hash/md5": 274, "dup": 118, "ripemd160": 349, "safe-buffer": 350, "sha.js": 354 }], 341: [function (require, module, exports) { - arguments[4][121][0].apply(exports, arguments); - }, { "./privateDecrypt": 343, "./publicEncrypt": 344, "dup": 121 }], 342: [function (require, module, exports) { + }, { "_process": 121 }], 362: [function (require, module, exports) { + var MAX_ALLOC = Math.pow(2, 30) - 1; // default in iojs + module.exports = function (iterations, keylen) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number'); + } + + if (iterations < 0) { + throw new TypeError('Bad iterations'); + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number'); + } + + if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { + /* eslint no-self-compare: 0 */ + throw new TypeError('Bad key length'); + } + }; + }, {}], 363: [function (require, module, exports) { + var md5 = require('create-hash/md5'); + var rmd160 = require('ripemd160'); + var sha = require('sha.js'); + + var checkParameters = require('./precondition'); + var defaultEncoding = require('./default-encoding'); + var Buffer = require('safe-buffer').Buffer; + var ZEROS = Buffer.alloc(128); + var sizes = { + md5: 16, + sha1: 20, + sha224: 28, + sha256: 32, + sha384: 48, + sha512: 64, + rmd160: 20, + ripemd160: 20 + }; + + function Hmac(alg, key, saltLen) { + var hash = getDigest(alg); + var blocksize = alg === 'sha512' || alg === 'sha384' ? 128 : 64; + + if (key.length > blocksize) { + key = hash(key); + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize); + } + + var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]); + var opad = Buffer.allocUnsafe(blocksize + sizes[alg]); + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36; + opad[i] = key[i] ^ 0x5C; + } + + var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4); + ipad.copy(ipad1, 0, 0, blocksize); + this.ipad1 = ipad1; + this.ipad2 = ipad; + this.opad = opad; + this.alg = alg; + this.blocksize = blocksize; + this.hash = hash; + this.size = sizes[alg]; + } + + Hmac.prototype.run = function (data, ipad) { + data.copy(ipad, this.blocksize); + var h = this.hash(ipad); + h.copy(this.opad, this.blocksize); + return this.hash(this.opad); + }; + + function getDigest(alg) { + function shaFunc(data) { + return sha(alg).update(data).digest(); + } + + if (alg === 'rmd160' || alg === 'ripemd160') return rmd160; + if (alg === 'md5') return md5; + return shaFunc; + } + + function pbkdf2(password, salt, iterations, keylen, digest) { + if (!Buffer.isBuffer(password)) password = Buffer.from(password, defaultEncoding); + if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, defaultEncoding); + + checkParameters(iterations, keylen); + + digest = digest || 'sha1'; + + var hmac = new Hmac(digest, password, salt.length); + + var DK = Buffer.allocUnsafe(keylen); + var block1 = Buffer.allocUnsafe(salt.length + 4); + salt.copy(block1, 0, 0, salt.length); + + var destPos = 0; + var hLen = sizes[digest]; + var l = Math.ceil(keylen / hLen); + + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length); + + var T = hmac.run(block1, hmac.ipad1); + var U = T; + + for (var j = 1; j < iterations; j++) { + U = hmac.run(U, hmac.ipad2); + for (var k = 0; k < hLen; k++) { + T[k] ^= U[k]; + } + } + + T.copy(DK, destPos); + destPos += hLen; + } + + return DK; + } + + module.exports = pbkdf2; + }, { "./default-encoding": 361, "./precondition": 362, "create-hash/md5": 297, "ripemd160": 372, "safe-buffer": 373, "sha.js": 377 }], 364: [function (require, module, exports) { + arguments[4][122][0].apply(exports, arguments); + }, { "./privateDecrypt": 366, "./publicEncrypt": 367, "dup": 122 }], 365: [function (require, module, exports) { (function (Buffer) { var createHash = require('create-hash'); module.exports = function (seed, len) { @@ -34647,7 +38411,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; } }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "create-hash": 272 }], 343: [function (require, module, exports) { + }, { "buffer": 47, "create-hash": 295 }], 366: [function (require, module, exports) { (function (Buffer) { var parseKeys = require('parse-asn1'); var mgf = require('./mgf'); @@ -34758,7 +38522,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return dif; } }).call(this, require("buffer").Buffer); - }, { "./mgf": 342, "./withPublic": 345, "./xor": 346, "bn.js": 240, "browserify-rsa": 262, "buffer": 47, "create-hash": 272, "parse-asn1": 335 }], 344: [function (require, module, exports) { + }, { "./mgf": 365, "./withPublic": 368, "./xor": 369, "bn.js": 263, "browserify-rsa": 285, "buffer": 47, "create-hash": 295, "parse-asn1": 358 }], 367: [function (require, module, exports) { (function (Buffer) { var parseKeys = require('parse-asn1'); var randomBytes = require('randombytes'); @@ -34856,7 +38620,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return out; } }).call(this, require("buffer").Buffer); - }, { "./mgf": 342, "./withPublic": 345, "./xor": 346, "bn.js": 240, "browserify-rsa": 262, "buffer": 47, "create-hash": 272, "parse-asn1": 335, "randombytes": 347 }], 345: [function (require, module, exports) { + }, { "./mgf": 365, "./withPublic": 368, "./xor": 369, "bn.js": 263, "browserify-rsa": 285, "buffer": 47, "create-hash": 295, "parse-asn1": 358, "randombytes": 370 }], 368: [function (require, module, exports) { (function (Buffer) { var bn = require('bn.js'); function withPublic(paddedMsg, key) { @@ -34865,9 +38629,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = withPublic; }).call(this, require("buffer").Buffer); - }, { "bn.js": 240, "buffer": 47 }], 346: [function (require, module, exports) { - arguments[4][126][0].apply(exports, arguments); - }, { "dup": 126 }], 347: [function (require, module, exports) { + }, { "bn.js": 263, "buffer": 47 }], 369: [function (require, module, exports) { + arguments[4][127][0].apply(exports, arguments); + }, { "dup": 127 }], 370: [function (require, module, exports) { (function (process, global) { 'use strict'; @@ -34909,7 +38673,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return bytes; } }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "_process": 120, "safe-buffer": 350 }], 348: [function (require, module, exports) { + }, { "_process": 121, "safe-buffer": 373 }], 371: [function (require, module, exports) { (function (process, global) { 'use strict'; @@ -35022,7 +38786,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol return actualFill(buf, offset, size); } }).call(this, require('_process'), typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, { "_process": 120, "randombytes": 347, "safe-buffer": 350 }], 349: [function (require, module, exports) { + }, { "_process": 121, "randombytes": 370, "safe-buffer": 373 }], 372: [function (require, module, exports) { (function (Buffer) { 'use strict'; @@ -35317,11 +39081,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = RIPEMD160; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "hash-base": 311, "inherits": 325 }], 350: [function (require, module, exports) { - arguments[4][147][0].apply(exports, arguments); - }, { "buffer": 47, "dup": 147 }], 351: [function (require, module, exports) { + }, { "buffer": 47, "hash-base": 334, "inherits": 348 }], 373: [function (require, module, exports) { + arguments[4][149][0].apply(exports, arguments); + }, { "buffer": 47, "dup": 149 }], 374: [function (require, module, exports) { module.exports = require('scryptsy'); - }, { "scryptsy": 352 }], 352: [function (require, module, exports) { + }, { "scryptsy": 375 }], 375: [function (require, module, exports) { (function (Buffer) { var pbkdf2Sync = require('pbkdf2').pbkdf2Sync; @@ -35503,25 +39267,105 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = scrypt; }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "pbkdf2": 336 }], 353: [function (require, module, exports) { - arguments[4][148][0].apply(exports, arguments); - }, { "dup": 148, "safe-buffer": 350 }], 354: [function (require, module, exports) { - arguments[4][149][0].apply(exports, arguments); - }, { "./sha": 355, "./sha1": 356, "./sha224": 357, "./sha256": 358, "./sha384": 359, "./sha512": 360, "dup": 149 }], 355: [function (require, module, exports) { - arguments[4][150][0].apply(exports, arguments); - }, { "./hash": 353, "dup": 150, "inherits": 325, "safe-buffer": 350 }], 356: [function (require, module, exports) { + }, { "buffer": 47, "pbkdf2": 359 }], 376: [function (require, module, exports) { + var Buffer = require('safe-buffer').Buffer; + + // prototype class for hash functions + function Hash(blockSize, finalSize) { + this._block = Buffer.alloc(blockSize); + this._finalSize = finalSize; + this._blockSize = blockSize; + this._len = 0; + } + + Hash.prototype.update = function (data, enc) { + if (typeof data === 'string') { + enc = enc || 'utf8'; + data = Buffer.from(data, enc); + } + + var block = this._block; + var blockSize = this._blockSize; + var length = data.length; + var accum = this._len; + + for (var offset = 0; offset < length;) { + var assigned = accum % blockSize; + var remainder = Math.min(length - offset, blockSize - assigned); + + for (var i = 0; i < remainder; i++) { + block[assigned + i] = data[offset + i]; + } + + accum += remainder; + offset += remainder; + + if (accum % blockSize === 0) { + this._update(block); + } + } + + this._len += length; + return this; + }; + + Hash.prototype.digest = function (enc) { + var rem = this._len % this._blockSize; + + this._block[rem] = 0x80; + + // zero (rem + 1) trailing bits, where (rem + 1) is the smallest + // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize + this._block.fill(0, rem + 1); + + if (rem >= this._finalSize) { + this._update(this._block); + this._block.fill(0); + } + + var bits = this._len * 8; + + // uint32 + if (bits <= 0xffffffff) { + this._block.writeUInt32BE(bits, this._blockSize - 4); + + // uint64 + } else { + var lowBits = bits & 0xffffffff; + var highBits = (bits - lowBits) / 0x100000000; + + this._block.writeUInt32BE(highBits, this._blockSize - 8); + this._block.writeUInt32BE(lowBits, this._blockSize - 4); + } + + this._update(this._block); + var hash = this._hash(); + + return enc ? hash.toString(enc) : hash; + }; + + Hash.prototype._update = function () { + throw new Error('_update must be implemented by subclass'); + }; + + module.exports = Hash; + }, { "safe-buffer": 373 }], 377: [function (require, module, exports) { arguments[4][151][0].apply(exports, arguments); - }, { "./hash": 353, "dup": 151, "inherits": 325, "safe-buffer": 350 }], 357: [function (require, module, exports) { + }, { "./sha": 378, "./sha1": 379, "./sha224": 380, "./sha256": 381, "./sha384": 382, "./sha512": 383, "dup": 151 }], 378: [function (require, module, exports) { arguments[4][152][0].apply(exports, arguments); - }, { "./hash": 353, "./sha256": 358, "dup": 152, "inherits": 325, "safe-buffer": 350 }], 358: [function (require, module, exports) { + }, { "./hash": 376, "dup": 152, "inherits": 348, "safe-buffer": 373 }], 379: [function (require, module, exports) { arguments[4][153][0].apply(exports, arguments); - }, { "./hash": 353, "dup": 153, "inherits": 325, "safe-buffer": 350 }], 359: [function (require, module, exports) { + }, { "./hash": 376, "dup": 153, "inherits": 348, "safe-buffer": 373 }], 380: [function (require, module, exports) { arguments[4][154][0].apply(exports, arguments); - }, { "./hash": 353, "./sha512": 360, "dup": 154, "inherits": 325, "safe-buffer": 350 }], 360: [function (require, module, exports) { + }, { "./hash": 376, "./sha256": 381, "dup": 154, "inherits": 348, "safe-buffer": 373 }], 381: [function (require, module, exports) { arguments[4][155][0].apply(exports, arguments); - }, { "./hash": 353, "dup": 155, "inherits": 325, "safe-buffer": 350 }], 361: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 362: [function (require, module, exports) { + }, { "./hash": 376, "dup": 155, "inherits": 348, "safe-buffer": 373 }], 382: [function (require, module, exports) { + arguments[4][156][0].apply(exports, arguments); + }, { "./hash": 376, "./sha512": 383, "dup": 156, "inherits": 348, "safe-buffer": 373 }], 383: [function (require, module, exports) { + arguments[4][157][0].apply(exports, arguments); + }, { "./hash": 376, "dup": 157, "inherits": 348, "safe-buffer": 373 }], 384: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 385: [function (require, module, exports) { (function (global) { var rng; @@ -35554,7 +39398,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = rng; }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, {}], 363: [function (require, module, exports) { + }, {}], 386: [function (require, module, exports) { // uuid.js // // Copyright (c) 2010-2012 Robert Kieffer @@ -35732,7 +39576,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol uuid.unparse = unparse; module.exports = uuid; - }, { "./rng": 362 }], 364: [function (require, module, exports) { + }, { "./rng": 385 }], 387: [function (require, module, exports) { (function (global, Buffer) { /* This file is part of web3.js. @@ -36241,9 +40085,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol module.exports = Accounts; }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}, require("buffer").Buffer); - }, { "any-promise": 223, "buffer": 47, "crypto": 56, "crypto-browserify": 277, "eth-lib/lib/account": 304, "eth-lib/lib/bytes": 306, "eth-lib/lib/hash": 307, "eth-lib/lib/nat": 308, "eth-lib/lib/rlp": 309, "scrypt.js": 351, "underscore": 361, "uuid": 363, "web3-core": 209, "web3-core-helpers": 191, "web3-core-method": 193, "web3-utils": 393 }], 365: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 366: [function (require, module, exports) { + }, { "any-promise": 246, "buffer": 47, "crypto": 56, "crypto-browserify": 300, "eth-lib/lib/account": 327, "eth-lib/lib/bytes": 329, "eth-lib/lib/hash": 330, "eth-lib/lib/nat": 331, "eth-lib/lib/rlp": 332, "scrypt.js": 374, "underscore": 384, "uuid": 386, "web3-core": 217, "web3-core-helpers": 199, "web3-core-method": 201, "web3-utils": 421 }], 388: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 389: [function (require, module, exports) { /* This file is part of web3.js. @@ -36547,6 +40391,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } // TODO: https://github.com/ethereum/web3.js/issues/344 + // TODO: deal properly with components if (_.isArray(value)) { return value.map(function (v) { @@ -36640,11 +40485,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol if (json.type === 'function') { signature = json.signature; } - return _.isArray(json.inputs) ? json.inputs.map(function (input) { - return input.type; - }) : []; - }).map(function (types) { - return abi.encodeParameters(types, args).replace('0x', ''); + return _.isArray(json.inputs) ? json.inputs : []; + }).map(function (inputs) { + return abi.encodeParameters(inputs, args).replace('0x', ''); })[0] || ''; // return constructor @@ -36663,1356 +40506,454 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } else { return returnValue; } - } - }; - - /** - * Decode method return values - * - * @method _decodeMethodReturn - * @param {Array} outputs - * @param {String} returnValues - * @return {Object} decoded output return values - */ - Contract.prototype._decodeMethodReturn = function (outputs, returnValues) { - if (!returnValues) { - return null; - } - - returnValues = returnValues.length >= 2 ? returnValues.slice(2) : returnValues; - var result = abi.decodeParameters(outputs, returnValues); - - if (result.__length__ === 1) { - return result[0]; - } else { - delete result.__length__; - return result; - } - }; - - /** - * Deploys a contract and fire events based on its state: transactionHash, receipt - * - * All event listeners will be removed, once the last possible event is fired ("error", or "receipt") - * - * @method deploy - * @param {Object} options - * @param {Function} callback - * @return {Object} EventEmitter possible events are "error", "transactionHash" and "receipt" - */ - Contract.prototype.deploy = function (options, callback) { - - options = options || {}; - - options.arguments = options.arguments || []; - options = this._getOrSetDefaultOptions(options); - - // return error, if no "data" is specified - if (!options.data) { - return utils._fireError(new Error('No "data" specified in neither the given options, nor the default options.'), null, null, callback); - } - - var constructor = _.find(this.options.jsonInterface, function (method) { - return method.type === 'constructor'; - }) || {}; - constructor.signature = 'constructor'; - - return this._createTxObject.apply({ - method: constructor, - parent: this, - deployData: options.data, - _ethAccounts: this.constructor._ethAccounts - }, options.arguments); - }; - - /** - * Gets the event signature and outputformatters - * - * @method _generateEventOptions - * @param {Object} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event options object - */ - Contract.prototype._generateEventOptions = function () { - var args = Array.prototype.slice.call(arguments); - - // get the callback - var callback = this._getCallback(args); - - // get the options - var options = _.isObject(args[args.length - 1]) ? args.pop() : {}; - - var event = _.isString(args[0]) ? args[0] : 'allevents'; - event = event.toLowerCase() === 'allevents' ? { - name: 'ALLEVENTS', - jsonInterface: this.options.jsonInterface - } : this.options.jsonInterface.find(function (json) { - return json.type === 'event' && (json.name === event || json.signature === '0x' + event.replace('0x', '')); - }); - - if (!event) { - throw new Error('Event "' + event.name + '" doesn\'t exist in this contract.'); - } - - if (!utils.isAddress(this.options.address)) { - throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - } - - return { - params: this._encodeEventABI(event, options), - event: event, - callback: callback - }; - }; - - /** - * Adds event listeners and creates a subscription, and remove it once its fired. - * - * @method clone - * @return {Object} the event subscription - */ - Contract.prototype.clone = function () { - return new this.constructor(this.options.jsonInterface, this.options.address, this.options); - }; - - /** - * Adds event listeners and creates a subscription, and remove it once its fired. - * - * @method once - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event subscription - */ - Contract.prototype.once = function (event, options, callback) { - var args = Array.prototype.slice.call(arguments); - - // get the callback - callback = this._getCallback(args); - - if (!callback) { - throw new Error('Once requires a callback as the second parameter.'); - } - - // don't allow fromBlock - if (options) delete options.fromBlock; - - // don't return as once shouldn't provide "on" - this._on(event, options, function (err, res, sub) { - sub.unsubscribe(); - if (_.isFunction(callback)) { - callback(err, res, sub); - } - }); - - return undefined; - }; - - /** - * Adds event listeners and creates a subscription. - * - * @method _on - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the event subscription - */ - Contract.prototype._on = function () { - var subOptions = this._generateEventOptions.apply(this, arguments); - - // prevent the event "newListener" and "removeListener" from being overwritten - this._checkListener('newListener', subOptions.event.name, subOptions.callback); - this._checkListener('removeListener', subOptions.event.name, subOptions.callback); - - // TODO check if listener already exists? and reuse subscription if options are the same. - - // create new subscription - var subscription = new Subscription({ - subscription: { - params: 1, - inputFormatter: [formatters.inputLogFormatter], - outputFormatter: this._decodeEventABI.bind(subOptions.event), - // DUBLICATE, also in web3-eth - subscriptionHandler: function subscriptionHandler(output) { - if (output.removed) { - this.emit('changed', output); - } else { - this.emit('data', output); - } - - if (_.isFunction(this.callback)) { - this.callback(null, output, this); - } - } - }, - type: 'eth', - requestManager: this._requestManager - }); - subscription.subscribe('logs', subOptions.params, subOptions.callback || function () {}); - - return subscription; - }; - - /** - * Get past events from contracts - * - * @method getPastEvents - * @param {String} event - * @param {Object} options - * @param {Function} callback - * @return {Object} the promievent - */ - Contract.prototype.getPastEvents = function () { - var subOptions = this._generateEventOptions.apply(this, arguments); - - var getPastLogs = new Method({ - name: 'getPastLogs', - call: 'eth_getLogs', - params: 1, - inputFormatter: [formatters.inputLogFormatter], - outputFormatter: this._decodeEventABI.bind(subOptions.event) - }); - getPastLogs.setRequestManager(this._requestManager); - var call = getPastLogs.buildCall(); - - getPastLogs = null; - - return call(subOptions.params, subOptions.callback); - }; - - /** - * returns the an object with call, send, estimate functions - * - * @method _createTxObject - * @returns {Object} an object with functions to call the methods - */ - Contract.prototype._createTxObject = function _createTxObject() { - var args = Array.prototype.slice.call(arguments); - var txObject = {}; - - if (this.method.type === 'function') { - - txObject.call = this.parent._executeMethod.bind(txObject, 'call'); - txObject.call.request = this.parent._executeMethod.bind(txObject, 'call', true); // to make batch requests - } - - txObject.send = this.parent._executeMethod.bind(txObject, 'send'); - txObject.send.request = this.parent._executeMethod.bind(txObject, 'send', true); // to make batch requests - txObject.encodeABI = this.parent._encodeMethodABI.bind(txObject); - txObject.estimateGas = this.parent._executeMethod.bind(txObject, 'estimate'); - - if (args && this.method.inputs && args.length !== this.method.inputs.length) { - if (this.nextMethod) { - return this.nextMethod.apply(null, args); - } - throw errors.InvalidNumberOfParams(args.length, this.method.inputs.length, this.method.name); - } - - txObject.arguments = args || []; - txObject._method = this.method; - txObject._parent = this.parent; - txObject._ethAccounts = this.parent.constructor._ethAccounts || this._ethAccounts; - - if (this.deployData) { - txObject._deployData = this.deployData; - } - - return txObject; - }; - - /** - * Generates the options for the execute call - * - * @method _processExecuteArguments - * @param {Array} args - * @param {Promise} defer - */ - Contract.prototype._processExecuteArguments = function _processExecuteArguments(args, defer) { - var processedArgs = {}; - - processedArgs.type = args.shift(); - - // get the callback - processedArgs.callback = this._parent._getCallback(args); - - // get block number to use for call - if (processedArgs.type === 'call' && args[args.length - 1] !== true && (_.isString(args[args.length - 1]) || isFinite(args[args.length - 1]))) processedArgs.defaultBlock = args.pop(); - - // get the options - processedArgs.options = _.isObject(args[args.length - 1]) ? args.pop() : {}; - - // get the generateRequest argument for batch requests - processedArgs.generateRequest = args[args.length - 1] === true ? args.pop() : false; - - processedArgs.options = this._parent._getOrSetDefaultOptions(processedArgs.options); - processedArgs.options.data = this.encodeABI(); - - // add contract address - if (!this._deployData && !utils.isAddress(this._parent.options.address)) throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - - if (!this._deployData) processedArgs.options.to = this._parent.options.address; - - // return error, if no "data" is specified - if (!processedArgs.options.data) return utils._fireError(new Error('Couldn\'t find a matching contract method, or the number of parameters is wrong.'), defer.eventEmitter, defer.reject, processedArgs.callback); - - return processedArgs; - }; - - /** - * Executes a call, transact or estimateGas on a contract function - * - * @method _executeMethod - * @param {String} type the type this execute function should execute - * @param {Boolean} makeRequest if true, it simply returns the request parameters, rather than executing it - */ - Contract.prototype._executeMethod = function _executeMethod() { - var _this = this, - args = this._parent._processExecuteArguments.call(this, Array.prototype.slice.call(arguments), defer), - defer = promiEvent(args.type !== 'send'), - ethAccounts = _this.constructor._ethAccounts || _this._ethAccounts; - - // simple return request for batch requests - if (args.generateRequest) { - - var payload = { - params: [formatters.inputCallFormatter.call(this._parent, args.options)], - callback: args.callback - }; - - if (args.type === 'call') { - payload.params.push(formatters.inputDefaultBlockNumberFormatter.call(this._parent, args.defaultBlock)); - payload.method = 'eth_call'; - payload.format = this._parent._decodeMethodReturn.bind(null, this._method.outputs); - } else { - payload.method = 'eth_sendTransaction'; - } - - return payload; - } else { - - switch (args.type) { - case 'estimate': - - var estimateGas = new Method({ - name: 'estimateGas', - call: 'eth_estimateGas', - params: 1, - inputFormatter: [formatters.inputCallFormatter], - outputFormatter: utils.hexToNumber, - requestManager: _this._parent._requestManager, - accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.defaultAccount, - defaultBlock: _this._parent.defaultBlock - }).createFunction(); - - return estimateGas(args.options, args.callback); - - case 'call': - - // TODO check errors: missing "from" should give error on deploy and send, call ? - - var call = new Method({ - name: 'call', - call: 'eth_call', - params: 2, - inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter], - // add output formatter for decoding - outputFormatter: function outputFormatter(result) { - return _this._parent._decodeMethodReturn(_this._method.outputs, result); - }, - requestManager: _this._parent._requestManager, - accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.defaultAccount, - defaultBlock: _this._parent.defaultBlock - }).createFunction(); - - return call(args.options, args.defaultBlock, args.callback); - - case 'send': - - // return error, if no "from" is specified - if (!utils.isAddress(args.options.from)) { - return utils._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'), defer.eventEmitter, defer.reject, args.callback); - } - - if (_.isBoolean(this._method.payable) && !this._method.payable && args.options.value && args.options.value > 0) { - return utils._fireError(new Error('Can not send value to non-payable contract method or constructor'), defer.eventEmitter, defer.reject, args.callback); - } - - // make sure receipt logs are decoded - var extraFormatters = { - receiptFormatter: function receiptFormatter(receipt) { - if (_.isArray(receipt.logs)) { - - // decode logs - var events = _.map(receipt.logs, function (log) { - return _this._parent._decodeEventABI.call({ - name: 'ALLEVENTS', - jsonInterface: _this._parent.options.jsonInterface - }, log); - }); - - // make log names keys - receipt.events = {}; - var count = 0; - events.forEach(function (ev) { - if (ev.event) { - // if > 1 of the same event, don't overwrite any existing events - if (receipt.events[ev.event]) { - if (Array.isArray(receipt.events[ev.event])) { - receipt.events[ev.event].push(ev); - } else { - receipt.events[ev.event] = [receipt.events[ev.event], ev]; - } - } else { - receipt.events[ev.event] = ev; - } - } else { - receipt.events[count] = ev; - count++; - } - }); - - delete receipt.logs; - } - return receipt; - }, - contractDeployFormatter: function contractDeployFormatter(receipt) { - var newContract = _this._parent.clone(); - newContract.options.address = receipt.contractAddress; - return newContract; - } - }; - - var sendTransaction = new Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [formatters.inputTransactionFormatter], - requestManager: _this._parent._requestManager, - accounts: _this.constructor._ethAccounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) - defaultAccount: _this._parent.defaultAccount, - defaultBlock: _this._parent.defaultBlock, - extraFormatters: extraFormatters - }).createFunction(); - - return sendTransaction(args.options, args.callback); - - } - } - }; - - module.exports = Contract; - }, { "underscore": 365, "web3-core": 209, "web3-core-helpers": 191, "web3-core-method": 193, "web3-core-promievent": 198, "web3-core-subscriptions": 206, "web3-eth-abi": 213, "web3-utils": 393 }], 367: [function (require, module, exports) { - arguments[4][210][0].apply(exports, arguments); - }, { "dup": 210 }], 368: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** - * @file iban.js - * - * Details: https://github.com/ethereum/wiki/wiki/ICAP:-Inter-exchange-Client-Address-Protocol - * - * @author Marek Kotewicz - * @date 2015 - */ - - "use strict"; - - var utils = require('web3-utils'); - var BigNumber = require('bn.js'); - - var leftPad = function leftPad(string, bytes) { - var result = string; - while (result.length < bytes * 2) { - result = '0' + result; - } - return result; - }; - - /** - * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to - * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616. - * - * @method iso13616Prepare - * @param {String} iban the IBAN - * @returns {String} the prepared IBAN - */ - var iso13616Prepare = function iso13616Prepare(iban) { - var A = 'A'.charCodeAt(0); - var Z = 'Z'.charCodeAt(0); - - iban = iban.toUpperCase(); - iban = iban.substr(4) + iban.substr(0, 4); - - return iban.split('').map(function (n) { - var code = n.charCodeAt(0); - if (code >= A && code <= Z) { - // A = 10, B = 11, ... Z = 35 - return code - A + 10; - } else { - return n; - } - }).join(''); + } }; /** - * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064. + * Decode method return values * - * @method mod9710 - * @param {String} iban - * @returns {Number} + * @method _decodeMethodReturn + * @param {Array} outputs + * @param {String} returnValues + * @return {Object} decoded output return values */ - var mod9710 = function mod9710(iban) { - var remainder = iban, - block; - - while (remainder.length > 2) { - block = remainder.slice(0, 9); - remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); + Contract.prototype._decodeMethodReturn = function (outputs, returnValues) { + if (!returnValues) { + return null; } - return parseInt(remainder, 10) % 97; - }; - - /** - * This prototype should be used to create iban object from iban correct string - * - * @param {String} iban - */ - var Iban = function Iban(iban) { - this._iban = iban; - }; + returnValues = returnValues.length >= 2 ? returnValues.slice(2) : returnValues; + console.log('CONTRACT_RETURNVALUE', returnValues); + console.log('CONTRACT_OUTPUTS', outputs); + var result = abi.decodeParameters(outputs, returnValues); - /** - * This method should be used to create an ethereum address from a direct iban address - * - * @method toAddress - * @param {String} iban address - * @return {String} the ethereum address - */ - Iban.toAddress = function (ib) { - ib = new Iban(ib); + console.log('CONTRACT_OBJECT_RESULT: ', result); - if (!ib.isDirect()) { - throw new Error('IBAN is indirect and can\'t be converted'); + if (result.__length__ === 1) { + return result[0]; + } else { + delete result.__length__; + return result; } - - return ib.toAddress(); }; /** - * This method should be used to create iban address from an ethereum address + * Deploys a contract and fire events based on its state: transactionHash, receipt * - * @method toIban - * @param {String} address - * @return {String} the IBAN address - */ - Iban.toIban = function (address) { - return Iban.fromAddress(address).toString(); - }; - - /** - * This method should be used to create iban object from an ethereum address + * All event listeners will be removed, once the last possible event is fired ("error", or "receipt") * - * @method fromAddress - * @param {String} address - * @return {Iban} the IBAN object + * @method deploy + * @param {Object} options + * @param {Function} callback + * @return {Object} EventEmitter possible events are "error", "transactionHash" and "receipt" */ - Iban.fromAddress = function (address) { - if (!utils.isAddress(address)) { - throw new Error('Provided address is not a valid address: ' + address); - } + Contract.prototype.deploy = function (options, callback) { - address = address.replace('0x', '').replace('0X', ''); + options = options || {}; - var asBn = new BigNumber(address, 16); - var base36 = asBn.toString(36); - var padded = leftPad(base36, 15); - return Iban.fromBban(padded.toUpperCase()); - }; + options.arguments = options.arguments || []; + options = this._getOrSetDefaultOptions(options); - /** - * Convert the passed BBAN to an IBAN for this country specification. - * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". - * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits - * - * @method fromBban - * @param {String} bban the BBAN to convert to IBAN - * @returns {Iban} the IBAN object - */ - Iban.fromBban = function (bban) { - var countryCode = 'XE'; + // return error, if no "data" is specified + if (!options.data) { + return utils._fireError(new Error('No "data" specified in neither the given options, nor the default options.'), null, null, callback); + } - var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban)); - var checkDigit = ('0' + (98 - remainder)).slice(-2); + var constructor = _.find(this.options.jsonInterface, function (method) { + return method.type === 'constructor'; + }) || {}; + constructor.signature = 'constructor'; - return new Iban(countryCode + checkDigit + bban); + return this._createTxObject.apply({ + method: constructor, + parent: this, + deployData: options.data, + _ethAccounts: this.constructor._ethAccounts + }, options.arguments); }; /** - * Should be used to create IBAN object for given institution and identifier + * Gets the event signature and outputformatters * - * @method createIndirect - * @param {Object} options, required options are "institution" and "identifier" - * @return {Iban} the IBAN object + * @method _generateEventOptions + * @param {Object} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the event options object */ - Iban.createIndirect = function (options) { - return Iban.fromBban('ETH' + options.institution + options.identifier); - }; + Contract.prototype._generateEventOptions = function () { + var args = Array.prototype.slice.call(arguments); - /** - * This method should be used to check if given string is valid iban object - * - * @method isValid - * @param {String} iban string - * @return {Boolean} true if it is valid IBAN - */ - Iban.isValid = function (iban) { - var i = new Iban(iban); - return i.isValid(); - }; + // get the callback + var callback = this._getCallback(args); - /** - * Should be called to check if iban is correct - * - * @method isValid - * @returns {Boolean} true if it is, otherwise false - */ - Iban.prototype.isValid = function () { - return (/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && mod9710(iso13616Prepare(this._iban)) === 1 - ); - }; + // get the options + var options = _.isObject(args[args.length - 1]) ? args.pop() : {}; - /** - * Should be called to check if iban number is direct - * - * @method isDirect - * @returns {Boolean} true if it is, otherwise false - */ - Iban.prototype.isDirect = function () { - return this._iban.length === 34 || this._iban.length === 35; - }; + var event = _.isString(args[0]) ? args[0] : 'allevents'; + event = event.toLowerCase() === 'allevents' ? { + name: 'ALLEVENTS', + jsonInterface: this.options.jsonInterface + } : this.options.jsonInterface.find(function (json) { + return json.type === 'event' && (json.name === event || json.signature === '0x' + event.replace('0x', '')); + }); - /** - * Should be called to check if iban number if indirect - * - * @method isIndirect - * @returns {Boolean} true if it is, otherwise false - */ - Iban.prototype.isIndirect = function () { - return this._iban.length === 20; - }; + if (!event) { + throw new Error('Event "' + event.name + '" doesn\'t exist in this contract.'); + } - /** - * Should be called to get iban checksum - * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) - * - * @method checksum - * @returns {String} checksum - */ - Iban.prototype.checksum = function () { - return this._iban.substr(2, 2); - }; + if (!utils.isAddress(this.options.address)) { + throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); + } - /** - * Should be called to get institution identifier - * eg. XREG - * - * @method institution - * @returns {String} institution identifier - */ - Iban.prototype.institution = function () { - return this.isIndirect() ? this._iban.substr(7, 4) : ''; + return { + params: this._encodeEventABI(event, options), + event: event, + callback: callback + }; }; /** - * Should be called to get client identifier within institution - * eg. GAVOFYORK + * Adds event listeners and creates a subscription, and remove it once its fired. * - * @method client - * @returns {String} client identifier + * @method clone + * @return {Object} the event subscription */ - Iban.prototype.client = function () { - return this.isIndirect() ? this._iban.substr(11) : ''; + Contract.prototype.clone = function () { + return new this.constructor(this.options.jsonInterface, this.options.address, this.options); }; /** - * Should be called to get client direct address + * Adds event listeners and creates a subscription, and remove it once its fired. * - * @method toAddress - * @returns {String} ethereum address + * @method once + * @param {String} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the event subscription */ - Iban.prototype.toAddress = function () { - if (this.isDirect()) { - var base36 = this._iban.substr(4); - var asBn = new BigNumber(base36, 36); - return utils.toChecksumAddress(asBn.toString(16, 20)); + Contract.prototype.once = function (event, options, callback) { + var args = Array.prototype.slice.call(arguments); + + // get the callback + callback = this._getCallback(args); + + if (!callback) { + throw new Error('Once requires a callback as the second parameter.'); } - return ''; - }; + // don't allow fromBlock + if (options) delete options.fromBlock; - Iban.prototype.toString = function () { - return this._iban; + // don't return as once shouldn't provide "on" + this._on(event, options, function (err, res, sub) { + sub.unsubscribe(); + if (_.isFunction(callback)) { + callback(err, res, sub); + } + }); + + return undefined; }; - module.exports = Iban; - }, { "bn.js": 367, "web3-utils": 393 }], 369: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ /** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 + * Adds event listeners and creates a subscription. + * + * @method _on + * @param {String} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the event subscription */ + Contract.prototype._on = function () { + var subOptions = this._generateEventOptions.apply(this, arguments); - "use strict"; - - var core = require('web3-core'); - var Method = require('web3-core-method'); - var utils = require('web3-utils'); - var Net = require('web3-net'); - - var formatters = require('web3-core-helpers').formatters; - - var Personal = function Personal() { - var _this = this; - - // sets _requestmanager - core.packageInit(this, arguments); + // prevent the event "newListener" and "removeListener" from being overwritten + this._checkListener('newListener', subOptions.event.name, subOptions.callback); + this._checkListener('removeListener', subOptions.event.name, subOptions.callback); - this.net = new Net(this.currentProvider); + // TODO check if listener already exists? and reuse subscription if options are the same. - var defaultAccount = null; - var defaultBlock = 'latest'; + // create new subscription + var subscription = new Subscription({ + subscription: { + params: 1, + inputFormatter: [formatters.inputLogFormatter], + outputFormatter: this._decodeEventABI.bind(subOptions.event), + // DUBLICATE, also in web3-eth + subscriptionHandler: function subscriptionHandler(output) { + if (output.removed) { + this.emit('changed', output); + } else { + this.emit('data', output); + } - Object.defineProperty(this, 'defaultAccount', { - get: function get() { - return defaultAccount; - }, - set: function set(val) { - if (val) { - defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val)); + if (_.isFunction(this.callback)) { + this.callback(null, output, this); + } } - - // update defaultBlock - methods.forEach(function (method) { - method.defaultAccount = defaultAccount; - }); - - return val; - }, - enumerable: true - }); - Object.defineProperty(this, 'defaultBlock', { - get: function get() { - return defaultBlock; - }, - set: function set(val) { - defaultBlock = val; - - // update defaultBlock - methods.forEach(function (method) { - method.defaultBlock = defaultBlock; - }); - - return val; }, - enumerable: true + type: 'eth', + requestManager: this._requestManager }); + subscription.subscribe('logs', subOptions.params, subOptions.callback || function () {}); - var methods = [new Method({ - name: 'getAccounts', - call: 'personal_listAccounts', - params: 0, - outputFormatter: utils.toChecksumAddress - }), new Method({ - name: 'newAccount', - call: 'personal_newAccount', - params: 1, - inputFormatter: [null], - outputFormatter: utils.toChecksumAddress - }), new Method({ - name: 'unlockAccount', - call: 'personal_unlockAccount', - params: 3, - inputFormatter: [formatters.inputAddressFormatter, null, null] - }), new Method({ - name: 'lockAccount', - call: 'personal_lockAccount', - params: 1, - inputFormatter: [formatters.inputAddressFormatter] - }), new Method({ - name: 'importRawKey', - call: 'personal_importRawKey', - params: 2 - }), new Method({ - name: 'sendTransaction', - call: 'personal_sendTransaction', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, null] - }), new Method({ - name: 'signTransaction', - call: 'personal_signTransaction', - params: 2, - inputFormatter: [formatters.inputTransactionFormatter, null] - }), new Method({ - name: 'sign', - call: 'personal_sign', - params: 3, - inputFormatter: [formatters.inputSignFormatter, formatters.inputAddressFormatter, null] - }), new Method({ - name: 'ecRecover', - call: 'personal_ecRecover', - params: 2, - inputFormatter: [formatters.inputSignFormatter, null] - })]; - methods.forEach(function (method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - method.defaultBlock = _this.defaultBlock; - method.defaultAccount = _this.defaultAccount; - }); + return subscription; }; - core.addProviders(Personal); - - module.exports = Personal; - }, { "web3-core": 209, "web3-core-helpers": 191, "web3-core-method": 193, "web3-net": 373, "web3-utils": 393 }], 370: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 371: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ /** - * @file getNetworkType.js - * @author Fabian Vogelsteller - * @date 2017 + * Get past events from contracts + * + * @method getPastEvents + * @param {String} event + * @param {Object} options + * @param {Function} callback + * @return {Object} the promievent */ + Contract.prototype.getPastEvents = function () { + var subOptions = this._generateEventOptions.apply(this, arguments); - "use strict"; - - var _ = require('underscore'); - - var getNetworkType = function getNetworkType(callback) { - var _this = this, - id; - - return this.net.getId().then(function (givenId) { - - id = givenId; - - return _this.getBlock(0); - }).then(function (genesis) { - var returnValue = 'private'; - - if (genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && id === 1) { - returnValue = 'main'; - } - if (genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && id === 2) { - returnValue = 'morden'; - } - if (genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && id === 3) { - returnValue = 'ropsten'; - } - if (genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && id === 4) { - returnValue = 'rinkeby'; - } - if (genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && id === 42) { - returnValue = 'kovan'; - } - - if (_.isFunction(callback)) { - callback(null, returnValue); - } - - return returnValue; - }).catch(function (err) { - if (_.isFunction(callback)) { - callback(err); - } else { - throw err; - } + var getPastLogs = new Method({ + name: 'getPastLogs', + call: 'eth_getLogs', + params: 1, + inputFormatter: [formatters.inputLogFormatter], + outputFormatter: this._decodeEventABI.bind(subOptions.event) }); - }; + getPastLogs.setRequestManager(this._requestManager); + var call = getPastLogs.buildCall(); + + getPastLogs = null; + + return call(subOptions.params, subOptions.callback); + }; - module.exports = getNetworkType; - }, { "underscore": 370 }], 372: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ /** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 + * returns the an object with call, send, estimate functions + * + * @method _createTxObject + * @returns {Object} an object with functions to call the methods */ + Contract.prototype._createTxObject = function _createTxObject() { + var args = Array.prototype.slice.call(arguments); + var txObject = {}; - "use strict"; - - var _ = require('underscore'); - var core = require('web3-core'); - var helpers = require('web3-core-helpers'); - var Subscriptions = require('web3-core-subscriptions').subscriptions; - var Method = require('web3-core-method'); - var utils = require('web3-utils'); - var Net = require('web3-net'); + if (this.method.type === 'function') { - var Personal = require('web3-eth-personal'); - var BaseContract = require('web3-eth-contract'); - var Iban = require('web3-eth-iban'); - var Accounts = require('web3-eth-accounts'); - var abi = require('web3-eth-abi'); + txObject.call = this.parent._executeMethod.bind(txObject, 'call'); + txObject.call.request = this.parent._executeMethod.bind(txObject, 'call', true); // to make batch requests + } - var getNetworkType = require('./getNetworkType.js'); - var formatter = helpers.formatters; + txObject.send = this.parent._executeMethod.bind(txObject, 'send'); + txObject.send.request = this.parent._executeMethod.bind(txObject, 'send', true); // to make batch requests + txObject.encodeABI = this.parent._encodeMethodABI.bind(txObject); + txObject.estimateGas = this.parent._executeMethod.bind(txObject, 'estimate'); - var blockCall = function blockCall(args) { - return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? "eth_getBlockByHash" : "eth_getBlockByNumber"; - }; + if (args && this.method.inputs && args.length !== this.method.inputs.length) { + if (this.nextMethod) { + return this.nextMethod.apply(null, args); + } + throw errors.InvalidNumberOfParams(args.length, this.method.inputs.length, this.method.name); + } - var transactionFromBlockCall = function transactionFromBlockCall(args) { - return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex'; - }; + txObject.arguments = args || []; + txObject._method = this.method; + txObject._parent = this.parent; + txObject._ethAccounts = this.parent.constructor._ethAccounts || this._ethAccounts; - var uncleCall = function uncleCall(args) { - return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex'; - }; + if (this.deployData) { + txObject._deployData = this.deployData; + } - var getBlockTransactionCountCall = function getBlockTransactionCountCall(args) { - return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber'; + return txObject; }; - var uncleCountCall = function uncleCountCall(args) { - return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber'; - }; + /** + * Generates the options for the execute call + * + * @method _processExecuteArguments + * @param {Array} args + * @param {Promise} defer + */ + Contract.prototype._processExecuteArguments = function _processExecuteArguments(args, defer) { + var processedArgs = {}; - var Eth = function Eth() { - var _this = this; + processedArgs.type = args.shift(); - // sets _requestmanager - core.packageInit(this, arguments); + // get the callback + processedArgs.callback = this._parent._getCallback(args); - // overwrite setProvider - var setProvider = this.setProvider; - this.setProvider = function () { - setProvider.apply(_this, arguments); - _this.net.setProvider.apply(_this, arguments); - _this.personal.setProvider.apply(_this, arguments); - _this.accounts.setProvider.apply(_this, arguments); - _this.Contract.setProvider(_this.currentProvider, _this.accounts); - }; + // get block number to use for call + if (processedArgs.type === 'call' && args[args.length - 1] !== true && (_.isString(args[args.length - 1]) || isFinite(args[args.length - 1]))) processedArgs.defaultBlock = args.pop(); - var defaultAccount = null; - var defaultBlock = 'latest'; + // get the options + processedArgs.options = _.isObject(args[args.length - 1]) ? args.pop() : {}; - Object.defineProperty(this, 'defaultAccount', { - get: function get() { - return defaultAccount; - }, - set: function set(val) { - if (val) { - defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); - } + // get the generateRequest argument for batch requests + processedArgs.generateRequest = args[args.length - 1] === true ? args.pop() : false; - // also set on the Contract object - _this.Contract.defaultAccount = defaultAccount; - _this.personal.defaultAccount = defaultAccount; + processedArgs.options = this._parent._getOrSetDefaultOptions(processedArgs.options); + processedArgs.options.data = this.encodeABI(); - // update defaultBlock - methods.forEach(function (method) { - method.defaultAccount = defaultAccount; - }); + // add contract address + if (!this._deployData && !utils.isAddress(this._parent.options.address)) throw new Error('This contract object doesn\'t have address set yet, please set an address first.'); - return val; - }, - enumerable: true - }); - Object.defineProperty(this, 'defaultBlock', { - get: function get() { - return defaultBlock; - }, - set: function set(val) { - defaultBlock = val; - // also set on the Contract object - _this.Contract.defaultBlock = defaultBlock; - _this.personal.defaultBlock = defaultBlock; + if (!this._deployData) processedArgs.options.to = this._parent.options.address; - // update defaultBlock - methods.forEach(function (method) { - method.defaultBlock = defaultBlock; - }); + // return error, if no "data" is specified + if (!processedArgs.options.data) return utils._fireError(new Error('Couldn\'t find a matching contract method, or the number of parameters is wrong.'), defer.eventEmitter, defer.reject, processedArgs.callback); - return val; - }, - enumerable: true - }); + return processedArgs; + }; - this.clearSubscriptions = _this._requestManager.clearSubscriptions; + /** + * Executes a call, transact or estimateGas on a contract function + * + * @method _executeMethod + * @param {String} type the type this execute function should execute + * @param {Boolean} makeRequest if true, it simply returns the request parameters, rather than executing it + */ + Contract.prototype._executeMethod = function _executeMethod() { + var _this = this, + args = this._parent._processExecuteArguments.call(this, Array.prototype.slice.call(arguments), defer), + defer = promiEvent(args.type !== 'send'), + ethAccounts = _this.constructor._ethAccounts || _this._ethAccounts; - // add net - this.net = new Net(this.currentProvider); - // add chain detection - this.net.getNetworkType = getNetworkType.bind(this); + // simple return request for batch requests + if (args.generateRequest) { - // add accounts - this.accounts = new Accounts(this.currentProvider); + var payload = { + params: [formatters.inputCallFormatter.call(this._parent, args.options)], + callback: args.callback + }; - // add personal - this.personal = new Personal(this.currentProvider); - this.personal.defaultAccount = this.defaultAccount; + if (args.type === 'call') { + payload.params.push(formatters.inputDefaultBlockNumberFormatter.call(this._parent, args.defaultBlock)); + payload.method = 'eth_call'; + payload.format = this._parent._decodeMethodReturn.bind(null, this._method.outputs); + } else { + payload.method = 'eth_sendTransaction'; + } - // create a proxy Contract type for this instance, as a Contract's provider - // is stored as a class member rather than an instance variable. If we do - // not create this proxy type, changing the provider in one instance of - // web3-eth would subsequently change the provider for _all_ contract - // instances! - var Contract = function Contract() { - BaseContract.apply(this, arguments); - }; + return payload; + } else { - Contract.setProvider = function () { - BaseContract.setProvider.apply(this, arguments); - }; + switch (args.type) { + case 'estimate': - // make our proxy Contract inherit from web3-eth-contract so that it has all - // the right functionality and so that instanceof and friends work properly - Contract.prototype = Object.create(BaseContract.prototype); - Contract.prototype.constructor = Contract; + var estimateGas = new Method({ + name: 'estimateGas', + call: 'eth_estimateGas', + params: 1, + inputFormatter: [formatters.inputCallFormatter], + outputFormatter: utils.hexToNumber, + requestManager: _this._parent._requestManager, + accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) + defaultAccount: _this._parent.defaultAccount, + defaultBlock: _this._parent.defaultBlock + }).createFunction(); - // add contract - this.Contract = Contract; - this.Contract.defaultAccount = this.defaultAccount; - this.Contract.defaultBlock = this.defaultBlock; - this.Contract.setProvider(this.currentProvider, this.accounts); + return estimateGas(args.options, args.callback); - // add IBAN - this.Iban = Iban; + case 'call': - // add ABI - this.abi = abi; + // TODO check errors: missing "from" should give error on deploy and send, call ? - var methods = [new Method({ - name: 'getNodeInfo', - call: 'web3_clientVersion' - }), new Method({ - name: 'getProtocolVersion', - call: 'eth_protocolVersion', - params: 0 - }), new Method({ - name: 'getCoinbase', - call: 'eth_coinbase', - params: 0 - }), new Method({ - name: 'isMining', - call: 'eth_mining', - params: 0 - }), new Method({ - name: 'getHashrate', - call: 'eth_hashrate', - params: 0, - outputFormatter: utils.hexToNumber - }), new Method({ - name: 'isSyncing', - call: 'eth_syncing', - params: 0, - outputFormatter: formatter.outputSyncingFormatter - }), new Method({ - name: 'getGasPrice', - call: 'eth_gasPrice', - params: 0, - outputFormatter: formatter.outputBigNumberFormatter - }), new Method({ - name: 'getAccounts', - call: 'eth_accounts', - params: 0, - outputFormatter: utils.toChecksumAddress - }), new Method({ - name: 'getBlockNumber', - call: 'eth_blockNumber', - params: 0, - outputFormatter: utils.hexToNumber - }), new Method({ - name: 'getBalance', - call: 'eth_getBalance', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], - outputFormatter: formatter.outputBigNumberFormatter - }), new Method({ - name: 'getStorageAt', - call: 'eth_getStorageAt', - params: 3, - inputFormatter: [formatter.inputAddressFormatter, utils.numberToHex, formatter.inputDefaultBlockNumberFormatter] - }), new Method({ - name: 'getCode', - call: 'eth_getCode', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter] - }), new Method({ - name: 'getBlock', - call: blockCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { - return !!val; - }], - outputFormatter: formatter.outputBlockFormatter - }), new Method({ - name: 'getUncle', - call: uncleCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], - outputFormatter: formatter.outputBlockFormatter + var call = new Method({ + name: 'call', + call: 'eth_call', + params: 2, + inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter], + // add output formatter for decoding + outputFormatter: function outputFormatter(result) { + return _this._parent._decodeMethodReturn(_this._method.outputs, result); + }, + requestManager: _this._parent._requestManager, + accounts: ethAccounts, // is eth.accounts (necessary for wallet signing) + defaultAccount: _this._parent.defaultAccount, + defaultBlock: _this._parent.defaultBlock + }).createFunction(); - }), new Method({ - name: 'getBlockTransactionCount', - call: getBlockTransactionCountCall, - params: 1, - inputFormatter: [formatter.inputBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), new Method({ - name: 'getBlockUncleCount', - call: uncleCountCall, - params: 1, - inputFormatter: [formatter.inputBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), new Method({ - name: 'getTransaction', - call: 'eth_getTransactionByHash', - params: 1, - inputFormatter: [null], - outputFormatter: formatter.outputTransactionFormatter - }), new Method({ - name: 'getTransactionFromBlock', - call: transactionFromBlockCall, - params: 2, - inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], - outputFormatter: formatter.outputTransactionFormatter - }), new Method({ - name: 'getTransactionReceipt', - call: 'eth_getTransactionReceipt', - params: 1, - inputFormatter: [null], - outputFormatter: formatter.outputTransactionReceiptFormatter - }), new Method({ - name: 'getTransactionCount', - call: 'eth_getTransactionCount', - params: 2, - inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], - outputFormatter: utils.hexToNumber - }), new Method({ - name: 'sendSignedTransaction', - call: 'eth_sendRawTransaction', - params: 1, - inputFormatter: [null] - }), new Method({ - name: 'signTransaction', - call: 'eth_signTransaction', - params: 1, - inputFormatter: [formatter.inputTransactionFormatter] - }), new Method({ - name: 'sendTransaction', - call: 'eth_sendTransaction', - params: 1, - inputFormatter: [formatter.inputTransactionFormatter] - }), new Method({ - name: 'sign', - call: 'eth_sign', - params: 2, - inputFormatter: [formatter.inputSignFormatter, formatter.inputAddressFormatter], - transformPayload: function transformPayload(payload) { - payload.params.reverse(); - return payload; - } - }), new Method({ - name: 'call', - call: 'eth_call', - params: 2, - inputFormatter: [formatter.inputCallFormatter, formatter.inputDefaultBlockNumberFormatter] - }), new Method({ - name: 'estimateGas', - call: 'eth_estimateGas', - params: 1, - inputFormatter: [formatter.inputCallFormatter], - outputFormatter: utils.hexToNumber - }), new Method({ - name: 'getCompilers', - call: 'eth_getCompilers', - params: 0 - }), new Method({ - name: 'compile.solidity', - call: 'eth_compileSolidity', - params: 1 - }), new Method({ - name: 'compile.lll', - call: 'eth_compileLLL', - params: 1 - }), new Method({ - name: 'compile.serpent', - call: 'eth_compileSerpent', - params: 1 - }), new Method({ - name: 'submitWork', - call: 'eth_submitWork', - params: 3 - }), new Method({ - name: 'getWork', - call: 'eth_getWork', - params: 0 - }), new Method({ - name: 'getPastLogs', - call: 'eth_getLogs', - params: 1, - inputFormatter: [formatter.inputLogFormatter], - outputFormatter: formatter.outputLogFormatter - }), + return call(args.options, args.defaultBlock, args.callback); - // subscriptions - new Subscriptions({ - name: 'subscribe', - type: 'eth', - subscriptions: { - 'newBlockHeaders': { - // TODO rename on RPC side? - subscriptionName: 'newHeads', // replace subscription with this name - params: 0, - outputFormatter: formatter.outputBlockFormatter - }, - 'pendingTransactions': { - subscriptionName: 'newPendingTransactions', // replace subscription with this name - params: 0 - }, - 'logs': { - params: 1, - inputFormatter: [formatter.inputLogFormatter], - outputFormatter: formatter.outputLogFormatter, - // DUBLICATE, also in web3-eth-contract - subscriptionHandler: function subscriptionHandler(output) { - if (output.removed) { - this.emit('changed', output); - } else { - this.emit('data', output); - } + case 'send': - if (_.isFunction(this.callback)) { - this.callback(null, output, this); - } + // return error, if no "from" is specified + if (!utils.isAddress(args.options.from)) { + return utils._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'), defer.eventEmitter, defer.reject, args.callback); } - }, - 'syncing': { - params: 0, - outputFormatter: formatter.outputSyncingFormatter, - subscriptionHandler: function subscriptionHandler(output) { - var _this = this; - // fire TRUE at start - if (this._isSyncing !== true) { - this._isSyncing = true; - this.emit('changed', _this._isSyncing); + if (_.isBoolean(this._method.payable) && !this._method.payable && args.options.value && args.options.value > 0) { + return utils._fireError(new Error('Can not send value to non-payable contract method or constructor'), defer.eventEmitter, defer.reject, args.callback); + } - if (_.isFunction(this.callback)) { - this.callback(null, _this._isSyncing, this); - } + // make sure receipt logs are decoded + var extraFormatters = { + receiptFormatter: function receiptFormatter(receipt) { + if (_.isArray(receipt.logs)) { - setTimeout(function () { - _this.emit('data', output); + // decode logs + var events = _.map(receipt.logs, function (log) { + return _this._parent._decodeEventABI.call({ + name: 'ALLEVENTS', + jsonInterface: _this._parent.options.jsonInterface + }, log); + }); - if (_.isFunction(_this.callback)) { - _this.callback(null, output, _this); - } - }, 0); + // make log names keys + receipt.events = {}; + var count = 0; + events.forEach(function (ev) { + if (ev.event) { + // if > 1 of the same event, don't overwrite any existing events + if (receipt.events[ev.event]) { + if (Array.isArray(receipt.events[ev.event])) { + receipt.events[ev.event].push(ev); + } else { + receipt.events[ev.event] = [receipt.events[ev.event], ev]; + } + } else { + receipt.events[ev.event] = ev; + } + } else { + receipt.events[count] = ev; + count++; + } + }); - // fire sync status - } else { - this.emit('data', output); - if (_.isFunction(_this.callback)) { - this.callback(null, output, this); + delete receipt.logs; } + return receipt; + }, + contractDeployFormatter: function contractDeployFormatter(receipt) { + var newContract = _this._parent.clone(); + newContract.options.address = receipt.contractAddress; + return newContract; + } + }; + + var sendTransaction = new Method({ + name: 'sendTransaction', + call: 'eth_sendTransaction', + params: 1, + inputFormatter: [formatters.inputTransactionFormatter], + requestManager: _this._parent._requestManager, + accounts: _this.constructor._ethAccounts || _this._ethAccounts, // is eth.accounts (necessary for wallet signing) + defaultAccount: _this._parent.defaultAccount, + defaultBlock: _this._parent.defaultBlock, + extraFormatters: extraFormatters + }).createFunction(); - // wait for some time before fireing the FALSE - clearTimeout(this._isSyncingTimeout); - this._isSyncingTimeout = setTimeout(function () { - if (output.currentBlock > output.highestBlock - 200) { - _this._isSyncing = false; - _this.emit('changed', _this._isSyncing); + return sendTransaction(args.options, args.callback); - if (_.isFunction(_this.callback)) { - _this.callback(null, _this._isSyncing, _this); - } - } - }, 500); - } - } - } } - })]; - - methods.forEach(function (method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager, _this.accounts); // second param means is eth.accounts (necessary for wallet signing) - method.defaultBlock = _this.defaultBlock; - method.defaultAccount = _this.defaultAccount; - }); + } }; - core.addProviders(Eth); - - module.exports = Eth; - }, { "./getNetworkType.js": 371, "underscore": 370, "web3-core": 209, "web3-core-helpers": 191, "web3-core-method": 193, "web3-core-subscriptions": 206, "web3-eth-abi": 213, "web3-eth-accounts": 364, "web3-eth-contract": 366, "web3-eth-iban": 368, "web3-eth-personal": 369, "web3-net": 373, "web3-utils": 393 }], 373: [function (require, module, exports) { + module.exports = Contract; + }, { "underscore": 388, "web3-core": 217, "web3-core-helpers": 199, "web3-core-method": 201, "web3-core-promievent": 206, "web3-core-subscriptions": 214, "web3-eth-abi": 245, "web3-utils": 421 }], 390: [function (require, module, exports) { + arguments[4][230][0].apply(exports, arguments); + }, { "dup": 230 }], 391: [function (require, module, exports) { /* This file is part of web3.js. @@ -38030,49 +40971,256 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol along with web3.js. If not, see . */ /** - * @file index.js - * @author Fabian Vogelsteller - * @date 2017 + * @file iban.js + * + * Details: https://github.com/ethereum/wiki/wiki/ICAP:-Inter-exchange-Client-Address-Protocol + * + * @author Marek Kotewicz + * @date 2015 */ "use strict"; - var core = require('web3-core'); - var Method = require('web3-core-method'); var utils = require('web3-utils'); + var BigNumber = require('bn.js'); - var Net = function Net() { - var _this = this; + var leftPad = function leftPad(string, bytes) { + var result = string; + while (result.length < bytes * 2) { + result = '0' + result; + } + return result; + }; - // sets _requestmanager - core.packageInit(this, arguments); + /** + * Prepare an IBAN for mod 97 computation by moving the first 4 chars to the end and transforming the letters to + * numbers (A = 10, B = 11, ..., Z = 35), as specified in ISO13616. + * + * @method iso13616Prepare + * @param {String} iban the IBAN + * @returns {String} the prepared IBAN + */ + var iso13616Prepare = function iso13616Prepare(iban) { + var A = 'A'.charCodeAt(0); + var Z = 'Z'.charCodeAt(0); - [new Method({ - name: 'getId', - call: 'net_version', - params: 0, - outputFormatter: utils.hexToNumber - }), new Method({ - name: 'isListening', - call: 'net_listening', - params: 0 - }), new Method({ - name: 'getPeerCount', - call: 'net_peerCount', - params: 0, - outputFormatter: utils.hexToNumber - })].forEach(function (method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - }); + iban = iban.toUpperCase(); + iban = iban.substr(4) + iban.substr(0, 4); + + return iban.split('').map(function (n) { + var code = n.charCodeAt(0); + if (code >= A && code <= Z) { + // A = 10, B = 11, ... Z = 35 + return code - A + 10; + } else { + return n; + } + }).join(''); }; - core.addProviders(Net); + /** + * Calculates the MOD 97 10 of the passed IBAN as specified in ISO7064. + * + * @method mod9710 + * @param {String} iban + * @returns {Number} + */ + var mod9710 = function mod9710(iban) { + var remainder = iban, + block; - module.exports = Net; - }, { "web3-core": 209, "web3-core-method": 193, "web3-utils": 393 }], 374: [function (require, module, exports) { - module.exports = XMLHttpRequest; - }, {}], 375: [function (require, module, exports) { + while (remainder.length > 2) { + block = remainder.slice(0, 9); + remainder = parseInt(block, 10) % 97 + remainder.slice(block.length); + } + + return parseInt(remainder, 10) % 97; + }; + + /** + * This prototype should be used to create iban object from iban correct string + * + * @param {String} iban + */ + var Iban = function Iban(iban) { + this._iban = iban; + }; + + /** + * This method should be used to create an ethereum address from a direct iban address + * + * @method toAddress + * @param {String} iban address + * @return {String} the ethereum address + */ + Iban.toAddress = function (ib) { + ib = new Iban(ib); + + if (!ib.isDirect()) { + throw new Error('IBAN is indirect and can\'t be converted'); + } + + return ib.toAddress(); + }; + + /** + * This method should be used to create iban address from an ethereum address + * + * @method toIban + * @param {String} address + * @return {String} the IBAN address + */ + Iban.toIban = function (address) { + return Iban.fromAddress(address).toString(); + }; + + /** + * This method should be used to create iban object from an ethereum address + * + * @method fromAddress + * @param {String} address + * @return {Iban} the IBAN object + */ + Iban.fromAddress = function (address) { + if (!utils.isAddress(address)) { + throw new Error('Provided address is not a valid address: ' + address); + } + + address = address.replace('0x', '').replace('0X', ''); + + var asBn = new BigNumber(address, 16); + var base36 = asBn.toString(36); + var padded = leftPad(base36, 15); + return Iban.fromBban(padded.toUpperCase()); + }; + + /** + * Convert the passed BBAN to an IBAN for this country specification. + * Please note that "generation of the IBAN shall be the exclusive responsibility of the bank/branch servicing the account". + * This method implements the preferred algorithm described in http://en.wikipedia.org/wiki/International_Bank_Account_Number#Generating_IBAN_check_digits + * + * @method fromBban + * @param {String} bban the BBAN to convert to IBAN + * @returns {Iban} the IBAN object + */ + Iban.fromBban = function (bban) { + var countryCode = 'XE'; + + var remainder = mod9710(iso13616Prepare(countryCode + '00' + bban)); + var checkDigit = ('0' + (98 - remainder)).slice(-2); + + return new Iban(countryCode + checkDigit + bban); + }; + + /** + * Should be used to create IBAN object for given institution and identifier + * + * @method createIndirect + * @param {Object} options, required options are "institution" and "identifier" + * @return {Iban} the IBAN object + */ + Iban.createIndirect = function (options) { + return Iban.fromBban('ETH' + options.institution + options.identifier); + }; + + /** + * This method should be used to check if given string is valid iban object + * + * @method isValid + * @param {String} iban string + * @return {Boolean} true if it is valid IBAN + */ + Iban.isValid = function (iban) { + var i = new Iban(iban); + return i.isValid(); + }; + + /** + * Should be called to check if iban is correct + * + * @method isValid + * @returns {Boolean} true if it is, otherwise false + */ + Iban.prototype.isValid = function () { + return (/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban) && mod9710(iso13616Prepare(this._iban)) === 1 + ); + }; + + /** + * Should be called to check if iban number is direct + * + * @method isDirect + * @returns {Boolean} true if it is, otherwise false + */ + Iban.prototype.isDirect = function () { + return this._iban.length === 34 || this._iban.length === 35; + }; + + /** + * Should be called to check if iban number if indirect + * + * @method isIndirect + * @returns {Boolean} true if it is, otherwise false + */ + Iban.prototype.isIndirect = function () { + return this._iban.length === 20; + }; + + /** + * Should be called to get iban checksum + * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003) + * + * @method checksum + * @returns {String} checksum + */ + Iban.prototype.checksum = function () { + return this._iban.substr(2, 2); + }; + + /** + * Should be called to get institution identifier + * eg. XREG + * + * @method institution + * @returns {String} institution identifier + */ + Iban.prototype.institution = function () { + return this.isIndirect() ? this._iban.substr(7, 4) : ''; + }; + + /** + * Should be called to get client identifier within institution + * eg. GAVOFYORK + * + * @method client + * @returns {String} client identifier + */ + Iban.prototype.client = function () { + return this.isIndirect() ? this._iban.substr(11) : ''; + }; + + /** + * Should be called to get client direct address + * + * @method toAddress + * @returns {String} ethereum address + */ + Iban.prototype.toAddress = function () { + if (this.isDirect()) { + var base36 = this._iban.substr(4); + var asBn = new BigNumber(base36, 36); + return utils.toChecksumAddress(asBn.toString(16, 20)); + } + + return ''; + }; + + Iban.prototype.toString = function () { + return this._iban; + }; + + module.exports = Iban; + }, { "bn.js": 390, "web3-utils": 421 }], 392: [function (require, module, exports) { /* This file is part of web3.js. @@ -38089,3198 +41237,4194 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ - /** @file httpprovider.js - * @authors: - * Marek Kotewicz - * Marian Oancea - * Fabian Vogelsteller - * @date 2015 - */ - - var errors = require('web3-core-helpers').errors; - var XHR2 = require('xhr2'); // jshint ignore: line - /** - * HttpProvider should be used to send rpc calls over http + * @file index.js + * @author Fabian Vogelsteller + * @date 2017 */ - var HttpProvider = function HttpProvider(host, timeout, headers) { - this.host = host || 'http://localhost:8545'; - this.timeout = timeout || 0; - this.connected = false; - this.headers = headers; - }; - - HttpProvider.prototype._prepareRequest = function () { - var request = new XHR2(); - request.open('POST', this.host, true); - request.setRequestHeader('Content-Type', 'application/json'); + "use strict"; - if (this.headers) { - this.headers.forEach(function (header) { - request.setRequestHeader(header.name, header.value); - }); - } + var core = require('web3-core'); + var Method = require('web3-core-method'); + var utils = require('web3-utils'); + var Net = require('web3-net'); - return request; - }; + var formatters = require('web3-core-helpers').formatters; - /** - * Should be used to make async request - * - * @method send - * @param {Object} payload - * @param {Function} callback triggered on end with (err, result) - */ - HttpProvider.prototype.send = function (payload, callback) { + var Personal = function Personal() { var _this = this; - var request = this._prepareRequest(); - - request.onreadystatechange = function () { - if (request.readyState === 4 && request.timeout !== 1) { - var result = request.responseText; - var error = null; - try { - result = JSON.parse(result); - } catch (e) { - error = errors.InvalidResponse(request.responseText); - } - - _this.connected = true; - callback(error, result); - } - }; + // sets _requestmanager + core.packageInit(this, arguments); - request.ontimeout = function () { - _this.connected = false; - callback(errors.ConnectionTimeout(this.timeout)); - }; + this.net = new Net(this.currentProvider); - try { - request.send(JSON.stringify(payload)); - } catch (error) { - this.connected = false; - callback(errors.InvalidConnection(this.host)); - } - }; + var defaultAccount = null; + var defaultBlock = 'latest'; - module.exports = HttpProvider; - }, { "web3-core-helpers": 191, "xhr2": 374 }], 376: [function (require, module, exports) { - // This file is the concatenation of many js files. - // See http://github.com/jimhigson/oboe.js for the raw source + Object.defineProperty(this, 'defaultAccount', { + get: function get() { + return defaultAccount; + }, + set: function set(val) { + if (val) { + defaultAccount = utils.toChecksumAddress(formatters.inputAddressFormatter(val)); + } - // having a local undefined, window, Object etc allows slightly better minification: - (function (window, Object, Array, Error, JSON, undefined) { + // update defaultBlock + methods.forEach(function (method) { + method.defaultAccount = defaultAccount; + }); - // v2.1.3 + return val; + }, + enumerable: true + }); + Object.defineProperty(this, 'defaultBlock', { + get: function get() { + return defaultBlock; + }, + set: function set(val) { + defaultBlock = val; - /* - - Copyright (c) 2013, Jim Higson - - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. 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 THE COPYRIGHT - HOLDER OR CONTRIBUTORS 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. - - */ + // update defaultBlock + methods.forEach(function (method) { + method.defaultBlock = defaultBlock; + }); - /** - * Partially complete a function. - * - * var add3 = partialComplete( function add(a,b){return a+b}, 3 ); - * - * add3(4) // gives 7 - * - * function wrap(left, right, cen){return left + " " + cen + " " + right;} - * - * var pirateGreeting = partialComplete( wrap , "I'm", ", a mighty pirate!" ); - * - * pirateGreeting("Guybrush Threepwood"); - * // gives "I'm Guybrush Threepwood, a mighty pirate!" - */ - var partialComplete = varArgs(function (fn, args) { + return val; + }, + enumerable: true + }); - // this isn't the shortest way to write this but it does - // avoid creating a new array each time to pass to fn.apply, - // otherwise could just call boundArgs.concat(callArgs) + var methods = [new Method({ + name: 'getAccounts', + call: 'personal_listAccounts', + params: 0, + outputFormatter: utils.toChecksumAddress + }), new Method({ + name: 'newAccount', + call: 'personal_newAccount', + params: 1, + inputFormatter: [null], + outputFormatter: utils.toChecksumAddress + }), new Method({ + name: 'unlockAccount', + call: 'personal_unlockAccount', + params: 3, + inputFormatter: [formatters.inputAddressFormatter, null, null] + }), new Method({ + name: 'lockAccount', + call: 'personal_lockAccount', + params: 1, + inputFormatter: [formatters.inputAddressFormatter] + }), new Method({ + name: 'importRawKey', + call: 'personal_importRawKey', + params: 2 + }), new Method({ + name: 'sendTransaction', + call: 'personal_sendTransaction', + params: 2, + inputFormatter: [formatters.inputTransactionFormatter, null] + }), new Method({ + name: 'signTransaction', + call: 'personal_signTransaction', + params: 2, + inputFormatter: [formatters.inputTransactionFormatter, null] + }), new Method({ + name: 'sign', + call: 'personal_sign', + params: 3, + inputFormatter: [formatters.inputSignFormatter, formatters.inputAddressFormatter, null] + }), new Method({ + name: 'ecRecover', + call: 'personal_ecRecover', + params: 2, + inputFormatter: [formatters.inputSignFormatter, null] + })]; + methods.forEach(function (method) { + method.attachToObject(_this); + method.setRequestManager(_this._requestManager); + method.defaultBlock = _this.defaultBlock; + method.defaultAccount = _this.defaultAccount; + }); + }; - var numBoundArgs = args.length; + core.addProviders(Personal); - return varArgs(function (callArgs) { + module.exports = Personal; + }, { "web3-core": 217, "web3-core-helpers": 199, "web3-core-method": 201, "web3-net": 396, "web3-utils": 421 }], 393: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 394: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** + * @file getNetworkType.js + * @author Fabian Vogelsteller + * @date 2017 + */ - for (var i = 0; i < callArgs.length; i++) { - args[numBoundArgs + i] = callArgs[i]; - } + "use strict"; - args.length = numBoundArgs + callArgs.length; + var _ = require('underscore'); - return fn.apply(this, args); - }); - }), + var getNetworkType = function getNetworkType(callback) { + var _this = this, + id; + return this.net.getId().then(function (givenId) { - /** - * Compose zero or more functions: - * - * compose(f1, f2, f3)(x) = f1(f2(f3(x)))) - * - * The last (inner-most) function may take more than one parameter: - * - * compose(f1, f2, f3)(x,y) = f1(f2(f3(x,y)))) - */ - compose = varArgs(function (fns) { + id = givenId; - var fnsList = arrayAsList(fns); + return _this.getBlock(0); + }).then(function (genesis) { + var returnValue = 'private'; - function next(params, curFn) { - return [apply(params, curFn)]; + if (genesis.hash === '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' && id === 1) { + returnValue = 'main'; + } + if (genesis.hash === '0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303' && id === 2) { + returnValue = 'morden'; + } + if (genesis.hash === '0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d' && id === 3) { + returnValue = 'ropsten'; + } + if (genesis.hash === '0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177' && id === 4) { + returnValue = 'rinkeby'; + } + if (genesis.hash === '0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9' && id === 42) { + returnValue = 'kovan'; } - return varArgs(function (startParams) { + if (_.isFunction(callback)) { + callback(null, returnValue); + } - return foldR(next, startParams, fnsList)[0]; - }); + return returnValue; + }).catch(function (err) { + if (_.isFunction(callback)) { + callback(err); + } else { + throw err; + } }); + }; - /** - * A more optimised version of compose that takes exactly two functions - * @param f1 - * @param f2 - */ - function compose2(f1, f2) { - return function () { - return f1.call(this, f2.apply(this, arguments)); - }; - } + module.exports = getNetworkType; + }, { "underscore": 393 }], 395: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** + * @file index.js + * @author Fabian Vogelsteller + * @date 2017 + */ - /** - * Generic form for a function to get a property from an object - * - * var o = { - * foo:'bar' - * } - * - * var getFoo = attr('foo') - * - * fetFoo(o) // returns 'bar' - * - * @param {String} key the property name - */ - function attr(key) { - return function (o) { - return o[key]; - }; - } + "use strict"; - /** - * Call a list of functions with the same args until one returns a - * truthy result. Similar to the || operator. - * - * So: - * lazyUnion([f1,f2,f3 ... fn])( p1, p2 ... pn ) - * - * Is equivalent to: - * apply([p1, p2 ... pn], f1) || - * apply([p1, p2 ... pn], f2) || - * apply([p1, p2 ... pn], f3) ... apply(fn, [p1, p2 ... pn]) - * - * @returns the first return value that is given that is truthy. - */ - var lazyUnion = varArgs(function (fns) { + var _ = require('underscore'); + var core = require('web3-core'); + var helpers = require('web3-core-helpers'); + var Subscriptions = require('web3-core-subscriptions').subscriptions; + var Method = require('web3-core-method'); + var utils = require('web3-utils'); + var Net = require('web3-net'); - return varArgs(function (params) { + var Personal = require('web3-eth-personal'); + var BaseContract = require('web3-eth-contract'); + var Iban = require('web3-eth-iban'); + var Accounts = require('web3-eth-accounts'); + var abi = require('web3-eth-abi'); - var maybeValue; + var getNetworkType = require('./getNetworkType.js'); + var formatter = helpers.formatters; - for (var i = 0; i < len(fns); i++) { + var blockCall = function blockCall(args) { + return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? "eth_getBlockByHash" : "eth_getBlockByNumber"; + }; - maybeValue = apply(params, fns[i]); + var transactionFromBlockCall = function transactionFromBlockCall(args) { + return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex'; + }; - if (maybeValue) { - return maybeValue; - } + var uncleCall = function uncleCall(args) { + return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex'; + }; + + var getBlockTransactionCountCall = function getBlockTransactionCountCall(args) { + return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber'; + }; + + var uncleCountCall = function uncleCountCall(args) { + return _.isString(args[0]) && args[0].indexOf('0x') === 0 ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber'; + }; + + var Eth = function Eth() { + var _this = this; + + // sets _requestmanager + core.packageInit(this, arguments); + + // overwrite setProvider + var setProvider = this.setProvider; + this.setProvider = function () { + setProvider.apply(_this, arguments); + _this.net.setProvider.apply(_this, arguments); + _this.personal.setProvider.apply(_this, arguments); + _this.accounts.setProvider.apply(_this, arguments); + _this.Contract.setProvider(_this.currentProvider, _this.accounts); + }; + + var defaultAccount = null; + var defaultBlock = 'latest'; + + Object.defineProperty(this, 'defaultAccount', { + get: function get() { + return defaultAccount; + }, + set: function set(val) { + if (val) { + defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val)); } - }); - }); - /** - * This file declares various pieces of functional programming. - * - * This isn't a general purpose functional library, to keep things small it - * has just the parts useful for Oboe.js. - */ + // also set on the Contract object + _this.Contract.defaultAccount = defaultAccount; + _this.personal.defaultAccount = defaultAccount; - /** - * Call a single function with the given arguments array. - * Basically, a functional-style version of the OO-style Function#apply for - * when we don't care about the context ('this') of the call. - * - * The order of arguments allows partial completion of the arguments array - */ - function apply(args, fn) { - return fn.apply(undefined, args); - } + // update defaultBlock + methods.forEach(function (method) { + method.defaultAccount = defaultAccount; + }); - /** - * Define variable argument functions but cut out all that tedious messing about - * with the arguments object. Delivers the variable-length part of the arguments - * list as an array. - * - * Eg: - * - * var myFunction = varArgs( - * function( fixedArgument, otherFixedArgument, variableNumberOfArguments ){ - * console.log( variableNumberOfArguments ); - * } - * ) - * - * myFunction('a', 'b', 1, 2, 3); // logs [1,2,3] - * - * var myOtherFunction = varArgs(function( variableNumberOfArguments ){ - * console.log( variableNumberOfArguments ); - * }) - * - * myFunction(1, 2, 3); // logs [1,2,3] - * - */ - function varArgs(fn) { + return val; + }, + enumerable: true + }); + Object.defineProperty(this, 'defaultBlock', { + get: function get() { + return defaultBlock; + }, + set: function set(val) { + defaultBlock = val; + // also set on the Contract object + _this.Contract.defaultBlock = defaultBlock; + _this.personal.defaultBlock = defaultBlock; - var numberOfFixedArguments = fn.length - 1, - slice = Array.prototype.slice; + // update defaultBlock + methods.forEach(function (method) { + method.defaultBlock = defaultBlock; + }); - if (numberOfFixedArguments == 0) { - // an optimised case for when there are no fixed args: + return val; + }, + enumerable: true + }); - return function () { - return fn.call(this, slice.call(arguments)); - }; - } else if (numberOfFixedArguments == 1) { - // an optimised case for when there are is one fixed args: + this.clearSubscriptions = _this._requestManager.clearSubscriptions; - return function () { - return fn.call(this, arguments[0], slice.call(arguments, 1)); - }; - } + // add net + this.net = new Net(this.currentProvider); + // add chain detection + this.net.getNetworkType = getNetworkType.bind(this); - // general case + // add accounts + this.accounts = new Accounts(this.currentProvider); - // we know how many arguments fn will always take. Create a - // fixed-size array to hold that many, to be re-used on - // every call to the returned function - var argsHolder = Array(fn.length); + // add personal + this.personal = new Personal(this.currentProvider); + this.personal.defaultAccount = this.defaultAccount; - return function () { + // create a proxy Contract type for this instance, as a Contract's provider + // is stored as a class member rather than an instance variable. If we do + // not create this proxy type, changing the provider in one instance of + // web3-eth would subsequently change the provider for _all_ contract + // instances! + var Contract = function Contract() { + BaseContract.apply(this, arguments); + }; - for (var i = 0; i < numberOfFixedArguments; i++) { - argsHolder[i] = arguments[i]; - } + Contract.setProvider = function () { + BaseContract.setProvider.apply(this, arguments); + }; - argsHolder[numberOfFixedArguments] = slice.call(arguments, numberOfFixedArguments); + // make our proxy Contract inherit from web3-eth-contract so that it has all + // the right functionality and so that instanceof and friends work properly + Contract.prototype = Object.create(BaseContract.prototype); + Contract.prototype.constructor = Contract; - return fn.apply(this, argsHolder); - }; - } + // add contract + this.Contract = Contract; + this.Contract.defaultAccount = this.defaultAccount; + this.Contract.defaultBlock = this.defaultBlock; + this.Contract.setProvider(this.currentProvider, this.accounts); - /** - * Swap the order of parameters to a binary function - * - * A bit like this flip: http://zvon.org/other/haskell/Outputprelude/flip_f.html - */ - function flip(fn) { - return function (a, b) { - return fn(b, a); - }; - } + // add IBAN + this.Iban = Iban; - /** - * Create a function which is the intersection of two other functions. - * - * Like the && operator, if the first is truthy, the second is never called, - * otherwise the return value from the second is returned. - */ - function lazyIntersection(fn1, fn2) { + // add ABI + this.abi = abi; + + var methods = [new Method({ + name: 'getNodeInfo', + call: 'web3_clientVersion' + }), new Method({ + name: 'getProtocolVersion', + call: 'eth_protocolVersion', + params: 0 + }), new Method({ + name: 'getCoinbase', + call: 'eth_coinbase', + params: 0 + }), new Method({ + name: 'isMining', + call: 'eth_mining', + params: 0 + }), new Method({ + name: 'getHashrate', + call: 'eth_hashrate', + params: 0, + outputFormatter: utils.hexToNumber + }), new Method({ + name: 'isSyncing', + call: 'eth_syncing', + params: 0, + outputFormatter: formatter.outputSyncingFormatter + }), new Method({ + name: 'getGasPrice', + call: 'eth_gasPrice', + params: 0, + outputFormatter: formatter.outputBigNumberFormatter + }), new Method({ + name: 'getAccounts', + call: 'eth_accounts', + params: 0, + outputFormatter: utils.toChecksumAddress + }), new Method({ + name: 'getBlockNumber', + call: 'eth_blockNumber', + params: 0, + outputFormatter: utils.hexToNumber + }), new Method({ + name: 'getBalance', + call: 'eth_getBalance', + params: 2, + inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], + outputFormatter: formatter.outputBigNumberFormatter + }), new Method({ + name: 'getStorageAt', + call: 'eth_getStorageAt', + params: 3, + inputFormatter: [formatter.inputAddressFormatter, utils.numberToHex, formatter.inputDefaultBlockNumberFormatter] + }), new Method({ + name: 'getCode', + call: 'eth_getCode', + params: 2, + inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter] + }), new Method({ + name: 'getBlock', + call: blockCall, + params: 2, + inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { + return !!val; + }], + outputFormatter: formatter.outputBlockFormatter + }), new Method({ + name: 'getUncle', + call: uncleCall, + params: 2, + inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], + outputFormatter: formatter.outputBlockFormatter + + }), new Method({ + name: 'getBlockTransactionCount', + call: getBlockTransactionCountCall, + params: 1, + inputFormatter: [formatter.inputBlockNumberFormatter], + outputFormatter: utils.hexToNumber + }), new Method({ + name: 'getBlockUncleCount', + call: uncleCountCall, + params: 1, + inputFormatter: [formatter.inputBlockNumberFormatter], + outputFormatter: utils.hexToNumber + }), new Method({ + name: 'getTransaction', + call: 'eth_getTransactionByHash', + params: 1, + inputFormatter: [null], + outputFormatter: formatter.outputTransactionFormatter + }), new Method({ + name: 'getTransactionFromBlock', + call: transactionFromBlockCall, + params: 2, + inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex], + outputFormatter: formatter.outputTransactionFormatter + }), new Method({ + name: 'getTransactionReceipt', + call: 'eth_getTransactionReceipt', + params: 1, + inputFormatter: [null], + outputFormatter: formatter.outputTransactionReceiptFormatter + }), new Method({ + name: 'getTransactionCount', + call: 'eth_getTransactionCount', + params: 2, + inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter], + outputFormatter: utils.hexToNumber + }), new Method({ + name: 'sendSignedTransaction', + call: 'eth_sendRawTransaction', + params: 1, + inputFormatter: [null] + }), new Method({ + name: 'signTransaction', + call: 'eth_signTransaction', + params: 1, + inputFormatter: [formatter.inputTransactionFormatter] + }), new Method({ + name: 'sendTransaction', + call: 'eth_sendTransaction', + params: 1, + inputFormatter: [formatter.inputTransactionFormatter] + }), new Method({ + name: 'sign', + call: 'eth_sign', + params: 2, + inputFormatter: [formatter.inputSignFormatter, formatter.inputAddressFormatter], + transformPayload: function transformPayload(payload) { + payload.params.reverse(); + return payload; + } + }), new Method({ + name: 'call', + call: 'eth_call', + params: 2, + inputFormatter: [formatter.inputCallFormatter, formatter.inputDefaultBlockNumberFormatter] + }), new Method({ + name: 'estimateGas', + call: 'eth_estimateGas', + params: 1, + inputFormatter: [formatter.inputCallFormatter], + outputFormatter: utils.hexToNumber + }), new Method({ + name: 'getCompilers', + call: 'eth_getCompilers', + params: 0 + }), new Method({ + name: 'compile.solidity', + call: 'eth_compileSolidity', + params: 1 + }), new Method({ + name: 'compile.lll', + call: 'eth_compileLLL', + params: 1 + }), new Method({ + name: 'compile.serpent', + call: 'eth_compileSerpent', + params: 1 + }), new Method({ + name: 'submitWork', + call: 'eth_submitWork', + params: 3 + }), new Method({ + name: 'getWork', + call: 'eth_getWork', + params: 0 + }), new Method({ + name: 'getPastLogs', + call: 'eth_getLogs', + params: 1, + inputFormatter: [formatter.inputLogFormatter], + outputFormatter: formatter.outputLogFormatter + }), - return function (param) { + // subscriptions + new Subscriptions({ + name: 'subscribe', + type: 'eth', + subscriptions: { + 'newBlockHeaders': { + // TODO rename on RPC side? + subscriptionName: 'newHeads', // replace subscription with this name + params: 0, + outputFormatter: formatter.outputBlockFormatter + }, + 'pendingTransactions': { + subscriptionName: 'newPendingTransactions', // replace subscription with this name + params: 0 + }, + 'logs': { + params: 1, + inputFormatter: [formatter.inputLogFormatter], + outputFormatter: formatter.outputLogFormatter, + // DUBLICATE, also in web3-eth-contract + subscriptionHandler: function subscriptionHandler(output) { + if (output.removed) { + this.emit('changed', output); + } else { + this.emit('data', output); + } - return fn1(param) && fn2(param); - }; - } + if (_.isFunction(this.callback)) { + this.callback(null, output, this); + } + } + }, + 'syncing': { + params: 0, + outputFormatter: formatter.outputSyncingFormatter, + subscriptionHandler: function subscriptionHandler(output) { + var _this = this; - /** - * A function which does nothing - */ - function noop() {} + // fire TRUE at start + if (this._isSyncing !== true) { + this._isSyncing = true; + this.emit('changed', _this._isSyncing); - /** - * A function which is always happy - */ - function always() { - return true; - } + if (_.isFunction(this.callback)) { + this.callback(null, _this._isSyncing, this); + } - /** - * Create a function which always returns the same - * value - * - * var return3 = functor(3); - * - * return3() // gives 3 - * return3() // still gives 3 - * return3() // will always give 3 - */ - function functor(val) { - return function () { - return val; - }; - } + setTimeout(function () { + _this.emit('data', output); - /** - * This file defines some loosely associated syntactic sugar for - * Javascript programming - */ + if (_.isFunction(_this.callback)) { + _this.callback(null, output, _this); + } + }, 0); - /** - * Returns true if the given candidate is of type T - */ - function isOfType(T, maybeSomething) { - return maybeSomething && maybeSomething.constructor === T; - } + // fire sync status + } else { + this.emit('data', output); + if (_.isFunction(_this.callback)) { + this.callback(null, output, this); + } - var len = attr('length'), - isString = partialComplete(isOfType, String); + // wait for some time before fireing the FALSE + clearTimeout(this._isSyncingTimeout); + this._isSyncingTimeout = setTimeout(function () { + if (output.currentBlock > output.highestBlock - 200) { + _this._isSyncing = false; + _this.emit('changed', _this._isSyncing); - /** - * I don't like saying this: - * - * foo !=== undefined - * - * because of the double-negative. I find this: - * - * defined(foo) - * - * easier to read. - */ - function defined(value) { - return value !== undefined; - } + if (_.isFunction(_this.callback)) { + _this.callback(null, _this._isSyncing, _this); + } + } + }, 500); + } + } + } + } + })]; - /** - * Returns true if object o has a key named like every property in - * the properties array. Will give false if any are missing, or if o - * is not an object. - */ - function hasAllProperties(fieldList, o) { + methods.forEach(function (method) { + method.attachToObject(_this); + method.setRequestManager(_this._requestManager, _this.accounts); // second param means is eth.accounts (necessary for wallet signing) + method.defaultBlock = _this.defaultBlock; + method.defaultAccount = _this.defaultAccount; + }); + }; - return o instanceof Object && all(function (field) { - return field in o; - }, fieldList); - } - /** - * Like cons in Lisp - */ - function cons(x, xs) { + core.addProviders(Eth); - /* Internally lists are linked 2-element Javascript arrays. - - Ideally the return here would be Object.freeze([x,xs]) - so that bugs related to mutation are found fast. - However, cons is right on the critical path for - performance and this slows oboe-mark down by - ~25%. Under theoretical future JS engines that freeze more - efficiently (possibly even use immutability to - run faster) this should be considered for - restoration. - */ + module.exports = Eth; + }, { "./getNetworkType.js": 394, "underscore": 393, "web3-core": 217, "web3-core-helpers": 199, "web3-core-method": 201, "web3-core-subscriptions": 214, "web3-eth-abi": 245, "web3-eth-accounts": 387, "web3-eth-contract": 389, "web3-eth-iban": 391, "web3-eth-personal": 392, "web3-net": 396, "web3-utils": 421 }], 396: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** + * @file index.js + * @author Fabian Vogelsteller + * @date 2017 + */ - return [x, xs]; - } + "use strict"; - /** - * The empty list - */ - var emptyList = null, + var core = require('web3-core'); + var Method = require('web3-core-method'); + var utils = require('web3-utils'); + var Net = function Net() { + var _this = this; - /** - * Get the head of a list. - * - * Ie, head(cons(a,b)) = a - */ - head = attr(0), + // sets _requestmanager + core.packageInit(this, arguments); + [new Method({ + name: 'getId', + call: 'net_version', + params: 0, + outputFormatter: utils.hexToNumber + }), new Method({ + name: 'isListening', + call: 'net_listening', + params: 0 + }), new Method({ + name: 'getPeerCount', + call: 'net_peerCount', + params: 0, + outputFormatter: utils.hexToNumber + })].forEach(function (method) { + method.attachToObject(_this); + method.setRequestManager(_this._requestManager); + }); + }; - /** - * Get the tail of a list. - * - * Ie, tail(cons(a,b)) = b - */ - tail = attr(1); + core.addProviders(Net); - /** - * Converts an array to a list - * - * asList([a,b,c]) - * - * is equivalent to: - * - * cons(a, cons(b, cons(c, emptyList))) - **/ - function arrayAsList(inputArray) { + module.exports = Net; + }, { "web3-core": 217, "web3-core-method": 201, "web3-utils": 421 }], 397: [function (require, module, exports) { + /* jshint node: true */ + (function () { + "use strict"; - return reverseList(inputArray.reduce(flip(cons), emptyList)); + function CookieAccessInfo(domain, path, secure, script) { + if (this instanceof CookieAccessInfo) { + this.domain = domain || undefined; + this.path = path || "/"; + this.secure = !!secure; + this.script = !!script; + return this; + } + return new CookieAccessInfo(domain, path, secure, script); } + CookieAccessInfo.All = Object.freeze(Object.create(null)); + exports.CookieAccessInfo = CookieAccessInfo; - /** - * A varargs version of arrayAsList. Works a bit like list - * in LISP. - * - * list(a,b,c) - * - * is equivalent to: - * - * cons(a, cons(b, cons(c, emptyList))) - */ - var list = varArgs(arrayAsList); - - /** - * Convert a list back to a js native array - */ - function listAsArray(list) { - - return foldR(function (arraySoFar, listItem) { - - arraySoFar.unshift(listItem); - return arraySoFar; - }, [], list); + function Cookie(cookiestr, request_domain, request_path) { + if (cookiestr instanceof Cookie) { + return cookiestr; + } + if (this instanceof Cookie) { + this.name = null; + this.value = null; + this.expiration_date = Infinity; + this.path = String(request_path || "/"); + this.explicit_path = false; + this.domain = request_domain || null; + this.explicit_domain = false; + this.secure = false; //how to define default? + this.noscript = false; //httponly + if (cookiestr) { + this.parse(cookiestr, request_domain, request_path); + } + return this; + } + return new Cookie(cookiestr, request_domain, request_path); } + exports.Cookie = Cookie; - /** - * Map a function over a list - */ - function map(fn, list) { + Cookie.prototype.toString = function toString() { + var str = [this.name + "=" + this.value]; + if (this.expiration_date !== Infinity) { + str.push("expires=" + new Date(this.expiration_date).toGMTString()); + } + if (this.domain) { + str.push("domain=" + this.domain); + } + if (this.path) { + str.push("path=" + this.path); + } + if (this.secure) { + str.push("secure"); + } + if (this.noscript) { + str.push("httponly"); + } + return str.join("; "); + }; - return list ? cons(fn(head(list)), map(fn, tail(list))) : emptyList; - } + Cookie.prototype.toValueString = function toValueString() { + return this.name + "=" + this.value; + }; - /** - * foldR implementation. Reduce a list down to a single value. - * - * @pram {Function} fn (rightEval, curVal) -> result - */ - function foldR(fn, startValue, list) { + var cookie_str_splitter = /[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g; + Cookie.prototype.parse = function parse(str, request_domain, request_path) { + if (this instanceof Cookie) { + var parts = str.split(";").filter(function (value) { + return !!value; + }); + var i; - return list ? fn(foldR(fn, startValue, tail(list)), head(list)) : startValue; - } + var pair = parts[0].match(/([^=]+)=([\s\S]*)/); + if (!pair) { + console.warn("Invalid cookie header encountered. Header: '" + str + "'"); + return; + } - /** - * foldR implementation. Reduce a list down to a single value. - * - * @pram {Function} fn (rightEval, curVal) -> result - */ - function foldR1(fn, list) { + var key = pair[1]; + var value = pair[2]; + if (typeof key !== 'string' || key.length === 0 || typeof value !== 'string') { + console.warn("Unable to extract values from cookie header. Cookie: '" + str + "'"); + return; + } - return tail(list) ? fn(foldR1(fn, tail(list)), head(list)) : head(list); - } + this.name = key; + this.value = value; - /** - * Return a list like the one given but with the first instance equal - * to item removed - */ - function without(list, test, removedFn) { + for (i = 1; i < parts.length; i += 1) { + pair = parts[i].match(/([^=]+)(?:=([\s\S]*))?/); + key = pair[1].trim().toLowerCase(); + value = pair[2]; + switch (key) { + case "httponly": + this.noscript = true; + break; + case "expires": + this.expiration_date = value ? Number(Date.parse(value)) : Infinity; + break; + case "path": + this.path = value ? value.trim() : ""; + this.explicit_path = true; + break; + case "domain": + this.domain = value ? value.trim() : ""; + this.explicit_domain = !!this.domain; + break; + case "secure": + this.secure = true; + break; + } + } - return withoutInner(list, removedFn || noop); + if (!this.explicit_path) { + this.path = request_path || "/"; + } + if (!this.explicit_domain) { + this.domain = request_domain; + } - function withoutInner(subList, removedFn) { - return subList ? test(head(subList)) ? (removedFn(head(subList)), tail(subList)) : cons(head(subList), withoutInner(tail(subList), removedFn)) : emptyList; + return this; } - } - - /** - * Returns true if the given function holds for every item in - * the list, false otherwise - */ - function all(fn, list) { - - return !list || fn(head(list)) && all(fn, tail(list)); - } - - /** - * Call every function in a list of functions with the same arguments - * - * This doesn't make any sense if we're doing pure functional because - * it doesn't return anything. Hence, this is only really useful if the - * functions being called have side-effects. - */ - function applyEach(fnList, args) { - - if (fnList) { - head(fnList).apply(null, args); + return new Cookie().parse(str, request_domain, request_path); + }; - applyEach(tail(fnList), args); + Cookie.prototype.matches = function matches(access_info) { + if (access_info === CookieAccessInfo.All) { + return true; } - } - - /** - * Reverse the order of a list - */ - function reverseList(list) { + if (this.noscript && access_info.script || this.secure && !access_info.secure || !this.collidesWith(access_info)) { + return false; + } + return true; + }; - // js re-implementation of 3rd solution from: - // http://www.haskell.org/haskellwiki/99_questions/Solutions/5 - function reverseInner(list, reversedAlready) { - if (!list) { - return reversedAlready; + Cookie.prototype.collidesWith = function collidesWith(access_info) { + if (this.path && !access_info.path || this.domain && !access_info.domain) { + return false; + } + if (this.path && access_info.path.indexOf(this.path) !== 0) { + return false; + } + if (this.explicit_path && access_info.path.indexOf(this.path) !== 0) { + return false; + } + var access_domain = access_info.domain && access_info.domain.replace(/^[\.]/, ''); + var cookie_domain = this.domain && this.domain.replace(/^[\.]/, ''); + if (cookie_domain === access_domain) { + return true; + } + if (cookie_domain) { + if (!this.explicit_domain) { + return false; // we already checked if the domains were exactly the same } - - return reverseInner(tail(list), cons(head(list), reversedAlready)); + var wildcard = access_domain.indexOf(cookie_domain); + if (wildcard === -1 || wildcard !== access_domain.length - cookie_domain.length) { + return false; + } + return true; } + return true; + }; - return reverseInner(list, emptyList); - } - - function first(test, list) { - return list && (test(head(list)) ? head(list) : first(test, tail(list))); - } - - /* - This is a slightly hacked-up browser only version of clarinet - - * some features removed to help keep browser Oboe under - the 5k micro-library limit - * plug directly into event bus - - For the original go here: - https://github.com/dscape/clarinet - - We receive the events: - STREAM_DATA - STREAM_END - - We emit the events: - SAX_KEY - SAX_VALUE_OPEN - SAX_VALUE_CLOSE - FAIL_EVENT - */ - - function clarinet(eventBus) { - "use strict"; - - var - // shortcut some events on the bus - emitSaxKey = eventBus(SAX_KEY).emit, - emitValueOpen = eventBus(SAX_VALUE_OPEN).emit, - emitValueClose = eventBus(SAX_VALUE_CLOSE).emit, - emitFail = eventBus(FAIL_EVENT).emit, - MAX_BUFFER_LENGTH = 64 * 1024, - stringTokenPattern = /[\\"\n]/g, - _n = 0 - - // states - , - BEGIN = _n++, - VALUE = _n++ // general stuff - , - OPEN_OBJECT = _n++ // { - , - CLOSE_OBJECT = _n++ // } - , - OPEN_ARRAY = _n++ // [ - , - CLOSE_ARRAY = _n++ // ] - , - STRING = _n++ // "" - , - OPEN_KEY = _n++ // , "a" - , - CLOSE_KEY = _n++ // : - , - TRUE = _n++ // r - , - TRUE2 = _n++ // u - , - TRUE3 = _n++ // e - , - FALSE = _n++ // a - , - FALSE2 = _n++ // l - , - FALSE3 = _n++ // s - , - FALSE4 = _n++ // e - , - NULL = _n++ // u - , - NULL2 = _n++ // l - , - NULL3 = _n++ // l - , - NUMBER_DECIMAL_POINT = _n++ // . - , - NUMBER_DIGIT = _n // [0-9] - - // setup initial parser values - , - bufferCheckPosition = MAX_BUFFER_LENGTH, - latestError, - c, - p, - textNode = undefined, - numberNode = "", - slashed = false, - closed = false, - state = BEGIN, - stack = [], - unicodeS = null, - unicodeI = 0, - depth = 0, - position = 0, - column = 0 //mostly for error reporting - , - line = 1; + function CookieJar() { + var cookies, cookies_list, collidable_cookie; + if (this instanceof CookieJar) { + cookies = Object.create(null); //name: [Cookie] + + this.setCookie = function setCookie(cookie, request_domain, request_path) { + var remove, i; + cookie = new Cookie(cookie, request_domain, request_path); + //Delete the cookie if the set is past the current time + remove = cookie.expiration_date <= Date.now(); + if (cookies[cookie.name] !== undefined) { + cookies_list = cookies[cookie.name]; + for (i = 0; i < cookies_list.length; i += 1) { + collidable_cookie = cookies_list[i]; + if (collidable_cookie.collidesWith(cookie)) { + if (remove) { + cookies_list.splice(i, 1); + if (cookies_list.length === 0) { + delete cookies[cookie.name]; + } + return false; + } + cookies_list[i] = cookie; + return cookie; + } + } + if (remove) { + return false; + } + cookies_list.push(cookie); + return cookie; + } + if (remove) { + return false; + } + cookies[cookie.name] = [cookie]; + return cookies[cookie.name]; + }; + //returns a cookie + this.getCookie = function getCookie(cookie_name, access_info) { + var cookie, i; + cookies_list = cookies[cookie_name]; + if (!cookies_list) { + return; + } + for (i = 0; i < cookies_list.length; i += 1) { + cookie = cookies_list[i]; + if (cookie.expiration_date <= Date.now()) { + if (cookies_list.length === 0) { + delete cookies[cookie.name]; + } + continue; + } - function checkBufferLength() { + if (cookie.matches(access_info)) { + return cookie; + } + } + }; + //returns a list of cookies + this.getCookies = function getCookies(access_info) { + var matches = [], + cookie_name, + cookie; + for (cookie_name in cookies) { + cookie = this.getCookie(cookie_name, access_info); + if (cookie) { + matches.push(cookie); + } + } + matches.toString = function toString() { + return matches.join(":"); + }; + matches.toValueString = function toValueString() { + return matches.map(function (c) { + return c.toValueString(); + }).join(';'); + }; + return matches; + }; - var maxActual = 0; + return this; + } + return new CookieJar(); + } + exports.CookieJar = CookieJar; - if (textNode !== undefined && textNode.length > MAX_BUFFER_LENGTH) { - emitError("Max buffer length exceeded: textNode"); - maxActual = Math.max(maxActual, textNode.length); - } - if (numberNode.length > MAX_BUFFER_LENGTH) { - emitError("Max buffer length exceeded: numberNode"); - maxActual = Math.max(maxActual, numberNode.length); + //returns list of cookies that were set correctly. Cookies that are expired and removed are not returned. + CookieJar.prototype.setCookies = function setCookies(cookies, request_domain, request_path) { + cookies = Array.isArray(cookies) ? cookies : cookies.split(cookie_str_splitter); + var successful = [], + i, + cookie; + cookies = cookies.map(function (item) { + return new Cookie(item, request_domain, request_path); + }); + for (i = 0; i < cookies.length; i += 1) { + cookie = cookies[i]; + if (this.setCookie(cookie, request_domain, request_path)) { + successful.push(cookie); } + } + return successful; + }; + })(); + }, {}], 398: [function (require, module, exports) { + "use strict"; - bufferCheckPosition = MAX_BUFFER_LENGTH - maxActual + position; + var __extends = this && this.__extends || function () { + var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) { + if (b.hasOwnProperty(p)) d[p] = b[p]; + } + }; + return function (d, b) { + extendStatics(d, b); + function __() { + this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports, "__esModule", { value: true }); + var SecurityError = /** @class */function (_super) { + __extends(SecurityError, _super); + function SecurityError() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SecurityError; + }(Error); + exports.SecurityError = SecurityError; + var InvalidStateError = /** @class */function (_super) { + __extends(InvalidStateError, _super); + function InvalidStateError() { + return _super !== null && _super.apply(this, arguments) || this; + } + return InvalidStateError; + }(Error); + exports.InvalidStateError = InvalidStateError; + var NetworkError = /** @class */function (_super) { + __extends(NetworkError, _super); + function NetworkError() { + return _super !== null && _super.apply(this, arguments) || this; + } + return NetworkError; + }(Error); + exports.NetworkError = NetworkError; + var SyntaxError = /** @class */function (_super) { + __extends(SyntaxError, _super); + function SyntaxError() { + return _super !== null && _super.apply(this, arguments) || this; + } + return SyntaxError; + }(Error); + exports.SyntaxError = SyntaxError; + }, {}], 399: [function (require, module, exports) { + "use strict"; - eventBus(STREAM_DATA).on(handleData); + function __export(m) { + for (var p in m) { + if (!exports.hasOwnProperty(p)) exports[p] = m[p]; + } + } + Object.defineProperty(exports, "__esModule", { value: true }); + __export(require("./xml-http-request")); + var xml_http_request_event_target_1 = require("./xml-http-request-event-target"); + exports.XMLHttpRequestEventTarget = xml_http_request_event_target_1.XMLHttpRequestEventTarget; + }, { "./xml-http-request": 403, "./xml-http-request-event-target": 401 }], 400: [function (require, module, exports) { + "use strict"; - /* At the end of the http content close the clarinet - This will provide an error if the total content provided was not - valid json, ie if not all arrays, objects and Strings closed properly */ - eventBus(STREAM_END).on(handleStreamEnd); + Object.defineProperty(exports, "__esModule", { value: true }); + var ProgressEvent = /** @class */function () { + function ProgressEvent(type) { + this.type = type; + this.bubbles = false; + this.cancelable = false; + this.loaded = 0; + this.lengthComputable = false; + this.total = 0; + } + return ProgressEvent; + }(); + exports.ProgressEvent = ProgressEvent; + }, {}], 401: [function (require, module, exports) { + "use strict"; - function emitError(errorString) { - if (textNode !== undefined) { - emitValueOpen(textNode); - emitValueClose(); - textNode = undefined; + Object.defineProperty(exports, "__esModule", { value: true }); + var XMLHttpRequestEventTarget = /** @class */function () { + function XMLHttpRequestEventTarget() { + this.listeners = {}; + } + XMLHttpRequestEventTarget.prototype.addEventListener = function (eventType, listener) { + eventType = eventType.toLowerCase(); + this.listeners[eventType] = this.listeners[eventType] || []; + this.listeners[eventType].push(listener.handleEvent || listener); + }; + XMLHttpRequestEventTarget.prototype.removeEventListener = function (eventType, listener) { + eventType = eventType.toLowerCase(); + if (!this.listeners[eventType]) { + return; + } + var index = this.listeners[eventType].indexOf(listener.handleEvent || listener); + if (index < 0) { + return; + } + this.listeners[eventType].splice(index, 1); + }; + XMLHttpRequestEventTarget.prototype.dispatchEvent = function (event) { + var eventType = event.type.toLowerCase(); + event.target = this; // TODO: set event.currentTarget? + if (this.listeners[eventType]) { + for (var _i = 0, _a = this.listeners[eventType]; _i < _a.length; _i++) { + var listener_1 = _a[_i]; + listener_1.call(this, event); } - - latestError = Error(errorString + "\nLn: " + line + "\nCol: " + column + "\nChr: " + c); - - emitFail(errorReport(undefined, undefined, latestError)); } + var listener = this["on" + eventType]; + if (listener) { + listener.call(this, event); + } + return true; + }; + return XMLHttpRequestEventTarget; + }(); + exports.XMLHttpRequestEventTarget = XMLHttpRequestEventTarget; + }, {}], 402: [function (require, module, exports) { + (function (Buffer) { + "use strict"; - function handleStreamEnd() { - if (state == BEGIN) { - // Handle the case where the stream closes without ever receiving - // any input. This isn't an error - response bodies can be blank, - // particularly for 204 http responses - - // Because of how Oboe is currently implemented, we parse a - // completely empty stream as containing an empty object. - // This is because Oboe's done event is only fired when the - // root object of the JSON stream closes. - - // This should be decoupled and attached instead to the input stream - // from the http (or whatever) resource ending. - // If this decoupling could happen the SAX parser could simply emit - // zero events on a completely empty input. - emitValueOpen({}); - emitValueClose(); - - closed = true; + var __extends = this && this.__extends || function () { + var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) { + if (b.hasOwnProperty(p)) d[p] = b[p]; + } + }; + return function (d, b) { + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports, "__esModule", { value: true }); + var xml_http_request_event_target_1 = require("./xml-http-request-event-target"); + var XMLHttpRequestUpload = /** @class */function (_super) { + __extends(XMLHttpRequestUpload, _super); + function XMLHttpRequestUpload() { + var _this = _super.call(this) || this; + _this._contentType = null; + _this._body = null; + _this._reset(); + return _this; + } + XMLHttpRequestUpload.prototype._reset = function () { + this._contentType = null; + this._body = null; + }; + XMLHttpRequestUpload.prototype._setData = function (data) { + if (data == null) { return; } - - if (state !== VALUE || depth !== 0) emitError("Unexpected end"); - - if (textNode !== undefined) { - emitValueOpen(textNode); - emitValueClose(); - textNode = undefined; + if (typeof data === 'string') { + if (data.length !== 0) { + this._contentType = 'text/plain;charset=UTF-8'; + } + this._body = new Buffer(data, 'utf-8'); + } else if (Buffer.isBuffer(data)) { + this._body = data; + } else if (data instanceof ArrayBuffer) { + var body = new Buffer(data.byteLength); + var view = new Uint8Array(data); + for (var i = 0; i < data.byteLength; i++) { + body[i] = view[i]; + } + this._body = body; + } else if (data.buffer && data.buffer instanceof ArrayBuffer) { + var body = new Buffer(data.byteLength); + var offset = data.byteOffset; + var view = new Uint8Array(data.buffer); + for (var i = 0; i < data.byteLength; i++) { + body[i] = view[i + offset]; + } + this._body = body; + } else { + throw new Error("Unsupported send() data " + data); } + }; + XMLHttpRequestUpload.prototype._finalizeHeaders = function (headers, loweredHeaders) { + if (this._contentType && !loweredHeaders['content-type']) { + headers['Content-Type'] = this._contentType; + } + if (this._body) { + headers['Content-Length'] = this._body.length.toString(); + } + }; + XMLHttpRequestUpload.prototype._startUpload = function (request) { + if (this._body) { + request.write(this._body); + } + request.end(); + }; + return XMLHttpRequestUpload; + }(xml_http_request_event_target_1.XMLHttpRequestEventTarget); + exports.XMLHttpRequestUpload = XMLHttpRequestUpload; + }).call(this, require("buffer").Buffer); + }, { "./xml-http-request-event-target": 401, "buffer": 47 }], 403: [function (require, module, exports) { + (function (process, Buffer) { + "use strict"; - closed = true; - } - - function whitespace(c) { - return c == '\r' || c == '\n' || c == ' ' || c == '\t'; + var __extends = this && this.__extends || function () { + var extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { + d.__proto__ = b; + } || function (d, b) { + for (var p in b) { + if (b.hasOwnProperty(p)) d[p] = b[p]; + } + }; + return function (d, b) { + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __assign = this && this.__assign || Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) { + if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } } + return t; + }; + Object.defineProperty(exports, "__esModule", { value: true }); + var http = require("http"); + var https = require("https"); + var os = require("os"); + var url = require("url"); + var progress_event_1 = require("./progress-event"); + var errors_1 = require("./errors"); + var xml_http_request_event_target_1 = require("./xml-http-request-event-target"); + var xml_http_request_upload_1 = require("./xml-http-request-upload"); + var Cookie = require("cookiejar"); + var XMLHttpRequest = /** @class */function (_super) { + __extends(XMLHttpRequest, _super); + function XMLHttpRequest(options) { + if (options === void 0) { + options = {}; + } + var _this = _super.call(this) || this; + _this.UNSENT = XMLHttpRequest.UNSENT; + _this.OPENED = XMLHttpRequest.OPENED; + _this.HEADERS_RECEIVED = XMLHttpRequest.HEADERS_RECEIVED; + _this.LOADING = XMLHttpRequest.LOADING; + _this.DONE = XMLHttpRequest.DONE; + _this.onreadystatechange = null; + _this.readyState = XMLHttpRequest.UNSENT; + _this.response = null; + _this.responseText = ''; + _this.responseType = ''; + _this.status = 0; // TODO: UNSENT? + _this.statusText = ''; + _this.timeout = 0; + _this.upload = new xml_http_request_upload_1.XMLHttpRequestUpload(); + _this.responseUrl = ''; + _this.withCredentials = false; + _this._method = null; + _this._url = null; + _this._sync = false; + _this._headers = {}; + _this._loweredHeaders = {}; + _this._mimeOverride = null; // TODO: is type right? + _this._request = null; + _this._response = null; + _this._responseParts = null; + _this._responseHeaders = null; + _this._aborting = null; // TODO: type? + _this._error = null; // TODO: type? + _this._loadedBytes = 0; + _this._totalBytes = 0; + _this._lengthComputable = false; + _this._restrictedMethods = { CONNECT: true, TRACE: true, TRACK: true }; + _this._restrictedHeaders = { + 'accept-charset': true, + 'accept-encoding': true, + 'access-control-request-headers': true, + 'access-control-request-method': true, + connection: true, + 'content-length': true, + cookie: true, + cookie2: true, + date: true, + dnt: true, + expect: true, + host: true, + 'keep-alive': true, + origin: true, + referer: true, + te: true, + trailer: true, + 'transfer-encoding': true, + upgrade: true, + 'user-agent': true, + via: true + }; + _this._privateHeaders = { 'set-cookie': true, 'set-cookie2': true }; + _this._userAgent = "Mozilla/5.0 (" + os.type() + " " + os.arch() + ") node.js/" + process.versions.node + " v8/" + process.versions.v8; + _this._anonymous = options.anon || false; + return _this; + } + XMLHttpRequest.prototype.open = function (method, url, async, user, password) { + if (async === void 0) { + async = true; + } + method = method.toUpperCase(); + if (this._restrictedMethods[method]) { + throw new XMLHttpRequest.SecurityError("HTTP method " + method + " is not allowed in XHR"); + } + ; + var xhrUrl = this._parseUrl(url, user, password); + if (this.readyState === XMLHttpRequest.HEADERS_RECEIVED || this.readyState === XMLHttpRequest.LOADING) { + // TODO(pwnall): terminate abort(), terminate send() + } + this._method = method; + this._url = xhrUrl; + this._sync = !async; + this._headers = {}; + this._loweredHeaders = {}; + this._mimeOverride = null; + this._setReadyState(XMLHttpRequest.OPENED); + this._request = null; + this._response = null; + this.status = 0; + this.statusText = ''; + this._responseParts = []; + this._responseHeaders = null; + this._loadedBytes = 0; + this._totalBytes = 0; + this._lengthComputable = false; + }; + XMLHttpRequest.prototype.setRequestHeader = function (name, value) { + if (this.readyState !== XMLHttpRequest.OPENED) { + throw new XMLHttpRequest.InvalidStateError('XHR readyState must be OPENED'); + } + var loweredName = name.toLowerCase(); + if (this._restrictedHeaders[loweredName] || /^sec-/.test(loweredName) || /^proxy-/.test(loweredName)) { + console.warn("Refused to set unsafe header \"" + name + "\""); + return; + } + value = value.toString(); + if (this._loweredHeaders[loweredName] != null) { + name = this._loweredHeaders[loweredName]; + this._headers[name] = this._headers[name] + ", " + value; + } else { + this._loweredHeaders[loweredName] = name; + this._headers[name] = value; + } + }; + XMLHttpRequest.prototype.send = function (data) { + if (this.readyState !== XMLHttpRequest.OPENED) { + throw new XMLHttpRequest.InvalidStateError('XHR readyState must be OPENED'); + } + if (this._request) { + throw new XMLHttpRequest.InvalidStateError('send() already called'); + } + switch (this._url.protocol) { + case 'file:': + return this._sendFile(data); + case 'http:': + case 'https:': + return this._sendHttp(data); + default: + throw new XMLHttpRequest.NetworkError("Unsupported protocol " + this._url.protocol); + } + }; + XMLHttpRequest.prototype.abort = function () { + if (this._request == null) { + return; + } + this._request.abort(); + this._setError(); + this._dispatchProgress('abort'); + this._dispatchProgress('loadend'); + }; + XMLHttpRequest.prototype.getResponseHeader = function (name) { + if (this._responseHeaders == null || name == null) { + return null; + } + var loweredName = name.toLowerCase(); + return this._responseHeaders.hasOwnProperty(loweredName) ? this._responseHeaders[name.toLowerCase()] : null; + }; + XMLHttpRequest.prototype.getAllResponseHeaders = function () { + var _this = this; + if (this._responseHeaders == null) { + return ''; + } + return Object.keys(this._responseHeaders).map(function (key) { + return key + ": " + _this._responseHeaders[key]; + }).join('\r\n'); + }; + XMLHttpRequest.prototype.overrideMimeType = function (mimeType) { + if (this.readyState === XMLHttpRequest.LOADING || this.readyState === XMLHttpRequest.DONE) { + throw new XMLHttpRequest.InvalidStateError('overrideMimeType() not allowed in LOADING or DONE'); + } + this._mimeOverride = mimeType.toLowerCase(); + }; + XMLHttpRequest.prototype.nodejsSet = function (options) { + this.nodejsHttpAgent = options.httpAgent || this.nodejsHttpAgent; + this.nodejsHttpsAgent = options.httpsAgent || this.nodejsHttpsAgent; + if (options.hasOwnProperty('baseUrl')) { + if (options.baseUrl != null) { + var parsedUrl = url.parse(options.baseUrl, false, true); + if (!parsedUrl.protocol) { + throw new XMLHttpRequest.SyntaxError("baseUrl must be an absolute URL"); + } + } + this.nodejsBaseUrl = options.baseUrl; + } + }; + XMLHttpRequest.nodejsSet = function (options) { + XMLHttpRequest.prototype.nodejsSet(options); + }; + XMLHttpRequest.prototype._setReadyState = function (readyState) { + this.readyState = readyState; + this.dispatchEvent(new progress_event_1.ProgressEvent('readystatechange')); + }; + XMLHttpRequest.prototype._sendFile = function (data) { + // TODO + throw new Error('Protocol file: not implemented'); + }; + XMLHttpRequest.prototype._sendHttp = function (data) { + if (this._sync) { + throw new Error('Synchronous XHR processing not implemented'); + } + if (data && (this._method === 'GET' || this._method === 'HEAD')) { + console.warn("Discarding entity body for " + this._method + " requests"); + data = null; + } else { + data = data || ''; + } + this.upload._setData(data); + this._finalizeHeaders(); + this._sendHxxpRequest(); + }; + XMLHttpRequest.prototype._sendHxxpRequest = function () { + var _this = this; + if (this.withCredentials) { + var cookie = XMLHttpRequest.cookieJar.getCookies(Cookie.CookieAccessInfo(this._url.hostname, this._url.pathname, this._url.protocol === 'https:')).toValueString(); + this._headers.cookie = this._headers.cookie2 = cookie; + } + var _a = this._url.protocol === 'http:' ? [http, this.nodejsHttpAgent] : [https, this.nodejsHttpsAgent], + hxxp = _a[0], + agent = _a[1]; + var requestMethod = hxxp.request.bind(hxxp); + var request = requestMethod({ + hostname: this._url.hostname, + port: +this._url.port, + path: this._url.path, + auth: this._url.auth, + method: this._method, + headers: this._headers, + agent: agent + }); + this._request = request; + if (this.timeout) { + request.setTimeout(this.timeout, function () { + return _this._onHttpTimeout(request); + }); + } + request.on('response', function (response) { + return _this._onHttpResponse(request, response); + }); + request.on('error', function (error) { + return _this._onHttpRequestError(request, error); + }); + this.upload._startUpload(request); + if (this._request === request) { + this._dispatchProgress('loadstart'); + } + }; + XMLHttpRequest.prototype._finalizeHeaders = function () { + this._headers = __assign({}, this._headers, { Connection: 'keep-alive', Host: this._url.host, 'User-Agent': this._userAgent }, this._anonymous ? { Referer: 'about:blank' } : {}); + this.upload._finalizeHeaders(this._headers, this._loweredHeaders); + }; + XMLHttpRequest.prototype._onHttpResponse = function (request, response) { + var _this = this; + if (this._request !== request) { + return; + } + if (this.withCredentials && (response.headers['set-cookie'] || response.headers['set-cookie2'])) { + XMLHttpRequest.cookieJar.setCookies(response.headers['set-cookie'] || response.headers['set-cookie2']); + } + if ([301, 302, 303, 307, 308].indexOf(response.statusCode) >= 0) { + this._url = this._parseUrl(response.headers.location); + this._method = 'GET'; + if (this._loweredHeaders['content-type']) { + delete this._headers[this._loweredHeaders['content-type']]; + delete this._loweredHeaders['content-type']; + } + if (this._headers['Content-Type'] != null) { + delete this._headers['Content-Type']; + } + delete this._headers['Content-Length']; + this.upload._reset(); + this._finalizeHeaders(); + this._sendHxxpRequest(); + return; + } + this._response = response; + this._response.on('data', function (data) { + return _this._onHttpResponseData(response, data); + }); + this._response.on('end', function () { + return _this._onHttpResponseEnd(response); + }); + this._response.on('close', function () { + return _this._onHttpResponseClose(response); + }); + this.responseUrl = this._url.href.split('#')[0]; + this.status = response.statusCode; + this.statusText = http.STATUS_CODES[this.status]; + this._parseResponseHeaders(response); + var lengthString = this._responseHeaders['content-length'] || ''; + this._totalBytes = +lengthString; + this._lengthComputable = !!lengthString; + this._setReadyState(XMLHttpRequest.HEADERS_RECEIVED); + }; + XMLHttpRequest.prototype._onHttpResponseData = function (response, data) { + if (this._response !== response) { + return; + } + this._responseParts.push(new Buffer(data)); + this._loadedBytes += data.length; + if (this.readyState !== XMLHttpRequest.LOADING) { + this._setReadyState(XMLHttpRequest.LOADING); + } + this._dispatchProgress('progress'); + }; + XMLHttpRequest.prototype._onHttpResponseEnd = function (response) { + if (this._response !== response) { + return; + } + this._parseResponse(); + this._request = null; + this._response = null; + this._setReadyState(XMLHttpRequest.DONE); + this._dispatchProgress('load'); + this._dispatchProgress('loadend'); + }; + XMLHttpRequest.prototype._onHttpResponseClose = function (response) { + if (this._response !== response) { + return; + } + var request = this._request; + this._setError(); + request.abort(); + this._setReadyState(XMLHttpRequest.DONE); + this._dispatchProgress('error'); + this._dispatchProgress('loadend'); + }; + XMLHttpRequest.prototype._onHttpTimeout = function (request) { + if (this._request !== request) { + return; + } + this._setError(); + request.abort(); + this._setReadyState(XMLHttpRequest.DONE); + this._dispatchProgress('timeout'); + this._dispatchProgress('loadend'); + }; + XMLHttpRequest.prototype._onHttpRequestError = function (request, error) { + if (this._request !== request) { + return; + } + this._setError(); + request.abort(); + this._setReadyState(XMLHttpRequest.DONE); + this._dispatchProgress('error'); + this._dispatchProgress('loadend'); + }; + XMLHttpRequest.prototype._dispatchProgress = function (eventType) { + var event = new XMLHttpRequest.ProgressEvent(eventType); + event.lengthComputable = this._lengthComputable; + event.loaded = this._loadedBytes; + event.total = this._totalBytes; + this.dispatchEvent(event); + }; + XMLHttpRequest.prototype._setError = function () { + this._request = null; + this._response = null; + this._responseHeaders = null; + this._responseParts = null; + }; + XMLHttpRequest.prototype._parseUrl = function (urlString, user, password) { + var absoluteUrl = this.nodejsBaseUrl == null ? urlString : url.resolve(this.nodejsBaseUrl, urlString); + var xhrUrl = url.parse(absoluteUrl, false, true); + xhrUrl.hash = null; + var _a = (xhrUrl.auth || '').split(':'), + xhrUser = _a[0], + xhrPassword = _a[1]; + if (xhrUser || xhrPassword || user || password) { + xhrUrl.auth = (user || xhrUser || '') + ":" + (password || xhrPassword || ''); + } + return xhrUrl; + }; + XMLHttpRequest.prototype._parseResponseHeaders = function (response) { + this._responseHeaders = {}; + for (var name_1 in response.headers) { + var loweredName = name_1.toLowerCase(); + if (this._privateHeaders[loweredName]) { + continue; + } + this._responseHeaders[loweredName] = response.headers[name_1]; + } + if (this._mimeOverride != null) { + this._responseHeaders['content-type'] = this._mimeOverride; + } + }; + XMLHttpRequest.prototype._parseResponse = function () { + var buffer = Buffer.concat(this._responseParts); + this._responseParts = null; + switch (this.responseType) { + case 'json': + this.responseText = null; + try { + this.response = JSON.parse(buffer.toString('utf-8')); + } catch (_a) { + this.response = null; + } + return; + case 'buffer': + this.responseText = null; + this.response = buffer; + return; + case 'arraybuffer': + this.responseText = null; + var arrayBuffer = new ArrayBuffer(buffer.length); + var view = new Uint8Array(arrayBuffer); + for (var i = 0; i < buffer.length; i++) { + view[i] = buffer[i]; + } + this.response = arrayBuffer; + return; + case 'text': + default: + try { + this.responseText = buffer.toString(this._parseResponseEncoding()); + } catch (_b) { + this.responseText = buffer.toString('binary'); + } + this.response = this.responseText; + } + }; + XMLHttpRequest.prototype._parseResponseEncoding = function () { + return (/;\s*charset=(.*)$/.exec(this._responseHeaders['content-type'] || '')[1] || 'utf-8' + ); + }; + XMLHttpRequest.ProgressEvent = progress_event_1.ProgressEvent; + XMLHttpRequest.InvalidStateError = errors_1.InvalidStateError; + XMLHttpRequest.NetworkError = errors_1.NetworkError; + XMLHttpRequest.SecurityError = errors_1.SecurityError; + XMLHttpRequest.SyntaxError = errors_1.SyntaxError; + XMLHttpRequest.XMLHttpRequestUpload = xml_http_request_upload_1.XMLHttpRequestUpload; + XMLHttpRequest.UNSENT = 0; + XMLHttpRequest.OPENED = 1; + XMLHttpRequest.HEADERS_RECEIVED = 2; + XMLHttpRequest.LOADING = 3; + XMLHttpRequest.DONE = 4; + XMLHttpRequest.cookieJar = Cookie.CookieJar(); + return XMLHttpRequest; + }(xml_http_request_event_target_1.XMLHttpRequestEventTarget); + exports.XMLHttpRequest = XMLHttpRequest; + XMLHttpRequest.prototype.nodejsHttpAgent = http.globalAgent; + XMLHttpRequest.prototype.nodejsHttpsAgent = https.globalAgent; + XMLHttpRequest.prototype.nodejsBaseUrl = null; + }).call(this, require('_process'), require("buffer").Buffer); + }, { "./errors": 398, "./progress-event": 400, "./xml-http-request-event-target": 401, "./xml-http-request-upload": 402, "_process": 121, "buffer": 47, "cookiejar": 397, "http": 159, "https": 99, "os": 109, "url": 166 }], 404: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** @file httpprovider.js + * @authors: + * Marek Kotewicz + * Marian Oancea + * Fabian Vogelsteller + * @date 2015 + */ - function handleData(chunk) { + var errors = require('web3-core-helpers').errors; + var XHR2 = require('xhr2-cookies').XMLHttpRequest; // jshint ignore: line - // this used to throw the error but inside Oboe we will have already - // gotten the error when it was emitted. The important thing is to - // not continue with the parse. - if (latestError) return; + /** + * HttpProvider should be used to send rpc calls over http + */ + var HttpProvider = function HttpProvider(host, options) { + options = options || {}; + this.host = host || 'http://localhost:8545'; + this.timeout = options.timeout || 0; + this.headers = options.headers; + this.connected = false; + }; - if (closed) { - return emitError("Cannot write after close"); - } + HttpProvider.prototype._prepareRequest = function () { + var request = new XHR2(); - var i = 0; - c = chunk[0]; + request.open('POST', this.host, true); + request.setRequestHeader('Content-Type', 'application/json'); + request.timeout = this.timeout && this.timeout !== 1 ? this.timeout : 0; + request.withCredentials = true; - while (c) { - p = c; - c = chunk[i++]; - if (!c) break; + if (this.headers) { + this.headers.forEach(function (header) { + request.setRequestHeader(header.name, header.value); + }); + } - position++; - if (c == "\n") { - line++; - column = 0; - } else column++; - switch (state) { + return request; + }; - case BEGIN: - if (c === "{") state = OPEN_OBJECT;else if (c === "[") state = OPEN_ARRAY;else if (!whitespace(c)) return emitError("Non-whitespace before {[."); - continue; + /** + * Should be used to make async request + * + * @method send + * @param {Object} payload + * @param {Function} callback triggered on end with (err, result) + */ + HttpProvider.prototype.send = function (payload, callback) { + var _this = this; + var request = this._prepareRequest(); - case OPEN_KEY: - case OPEN_OBJECT: - if (whitespace(c)) continue; - if (state === OPEN_KEY) stack.push(CLOSE_KEY);else { - if (c === '}') { - emitValueOpen({}); - emitValueClose(); - state = stack.pop() || VALUE; - continue; - } else stack.push(CLOSE_OBJECT); - } - if (c === '"') state = STRING;else return emitError("Malformed object key should start with \" "); - continue; + request.onreadystatechange = function () { + if (request.readyState === 4 && request.timeout !== 1) { + var result = request.responseText; + var error = null; - case CLOSE_KEY: - case CLOSE_OBJECT: - if (whitespace(c)) continue; + try { + result = JSON.parse(result); + } catch (e) { + error = errors.InvalidResponse(request.responseText); + } - if (c === ':') { - if (state === CLOSE_OBJECT) { - stack.push(CLOSE_OBJECT); + _this.connected = true; + callback(error, result); + } + }; - if (textNode !== undefined) { - // was previously (in upstream Clarinet) one event - // - object open came with the text of the first - emitValueOpen({}); - emitSaxKey(textNode); - textNode = undefined; - } - depth++; - } else { - if (textNode !== undefined) { - emitSaxKey(textNode); - textNode = undefined; - } - } - state = VALUE; - } else if (c === '}') { - if (textNode !== undefined) { - emitValueOpen(textNode); - emitValueClose(); - textNode = undefined; - } - emitValueClose(); - depth--; - state = stack.pop() || VALUE; - } else if (c === ',') { - if (state === CLOSE_OBJECT) stack.push(CLOSE_OBJECT); - if (textNode !== undefined) { - emitValueOpen(textNode); - emitValueClose(); - textNode = undefined; - } - state = OPEN_KEY; - } else return emitError('Bad object'); - continue; + request.ontimeout = function () { + _this.connected = false; + callback(errors.ConnectionTimeout(this.timeout)); + }; - case OPEN_ARRAY: // after an array there always a value - case VALUE: - if (whitespace(c)) continue; - if (state === OPEN_ARRAY) { - emitValueOpen([]); - depth++; - state = VALUE; - if (c === ']') { - emitValueClose(); - depth--; - state = stack.pop() || VALUE; - continue; - } else { - stack.push(CLOSE_ARRAY); - } - } - if (c === '"') state = STRING;else if (c === '{') state = OPEN_OBJECT;else if (c === '[') state = OPEN_ARRAY;else if (c === 't') state = TRUE;else if (c === 'f') state = FALSE;else if (c === 'n') state = NULL;else if (c === '-') { - // keep and continue - numberNode += c; - } else if (c === '0') { - numberNode += c; - state = NUMBER_DIGIT; - } else if ('123456789'.indexOf(c) !== -1) { - numberNode += c; - state = NUMBER_DIGIT; - } else return emitError("Bad value"); - continue; + try { + request.send(JSON.stringify(payload)); + } catch (error) { + this.connected = false; + callback(errors.InvalidConnection(this.host)); + } + }; - case CLOSE_ARRAY: - if (c === ',') { - stack.push(CLOSE_ARRAY); - if (textNode !== undefined) { - emitValueOpen(textNode); - emitValueClose(); - textNode = undefined; - } - state = VALUE; - } else if (c === ']') { - if (textNode !== undefined) { - emitValueOpen(textNode); - emitValueClose(); - textNode = undefined; - } - emitValueClose(); - depth--; - state = stack.pop() || VALUE; - } else if (whitespace(c)) continue;else return emitError('Bad array'); - continue; + module.exports = HttpProvider; + }, { "web3-core-helpers": 199, "xhr2-cookies": 399 }], 405: [function (require, module, exports) { + // This file is the concatenation of many js files. + // See http://github.com/jimhigson/oboe.js for the raw source - case STRING: - if (textNode === undefined) { - textNode = ""; - } + // having a local undefined, window, Object etc allows slightly better minification: + (function (window, Object, Array, Error, JSON, undefined) { - // thanks thejh, this is an about 50% performance improvement. - var starti = i - 1; + // v2.1.3 - STRING_BIGLOOP: while (true) { + /* + + Copyright (c) 2013, Jim Higson + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. 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 THE COPYRIGHT + HOLDER OR CONTRIBUTORS 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. + + */ - // zero means "no unicode active". 1-4 mean "parse some more". end after 4. - while (unicodeI > 0) { - unicodeS += c; - c = chunk.charAt(i++); - if (unicodeI === 4) { - // TODO this might be slow? well, probably not used too often anyway - textNode += String.fromCharCode(parseInt(unicodeS, 16)); - unicodeI = 0; - starti = i - 1; - } else { - unicodeI++; - } - // we can just break here: no stuff we skipped that still has to be sliced out or so - if (!c) break STRING_BIGLOOP; - } - if (c === '"' && !slashed) { - state = stack.pop() || VALUE; - textNode += chunk.substring(starti, i - 1); - break; - } - if (c === '\\' && !slashed) { - slashed = true; - textNode += chunk.substring(starti, i - 1); - c = chunk.charAt(i++); - if (!c) break; - } - if (slashed) { - slashed = false; - if (c === 'n') { - textNode += '\n'; - } else if (c === 'r') { - textNode += '\r'; - } else if (c === 't') { - textNode += '\t'; - } else if (c === 'f') { - textNode += '\f'; - } else if (c === 'b') { - textNode += '\b'; - } else if (c === 'u') { - // \uxxxx. meh! - unicodeI = 1; - unicodeS = ''; - } else { - textNode += c; - } - c = chunk.charAt(i++); - starti = i - 1; - if (!c) break;else continue; - } + /** + * Partially complete a function. + * + * var add3 = partialComplete( function add(a,b){return a+b}, 3 ); + * + * add3(4) // gives 7 + * + * function wrap(left, right, cen){return left + " " + cen + " " + right;} + * + * var pirateGreeting = partialComplete( wrap , "I'm", ", a mighty pirate!" ); + * + * pirateGreeting("Guybrush Threepwood"); + * // gives "I'm Guybrush Threepwood, a mighty pirate!" + */ + var partialComplete = varArgs(function (fn, args) { - stringTokenPattern.lastIndex = i; - var reResult = stringTokenPattern.exec(chunk); - if (!reResult) { - i = chunk.length + 1; - textNode += chunk.substring(starti, i - 1); - break; - } - i = reResult.index + 1; - c = chunk.charAt(reResult.index); - if (!c) { - textNode += chunk.substring(starti, i - 1); - break; - } - } - continue; + // this isn't the shortest way to write this but it does + // avoid creating a new array each time to pass to fn.apply, + // otherwise could just call boundArgs.concat(callArgs) - case TRUE: - if (!c) continue; // strange buffers - if (c === 'r') state = TRUE2;else return emitError('Invalid true started with t' + c); - continue; + var numBoundArgs = args.length; - case TRUE2: - if (!c) continue; - if (c === 'u') state = TRUE3;else return emitError('Invalid true started with tr' + c); - continue; + return varArgs(function (callArgs) { - case TRUE3: - if (!c) continue; - if (c === 'e') { - emitValueOpen(true); - emitValueClose(); - state = stack.pop() || VALUE; - } else return emitError('Invalid true started with tru' + c); - continue; + for (var i = 0; i < callArgs.length; i++) { + args[numBoundArgs + i] = callArgs[i]; + } - case FALSE: - if (!c) continue; - if (c === 'a') state = FALSE2;else return emitError('Invalid false started with f' + c); - continue; + args.length = numBoundArgs + callArgs.length; - case FALSE2: - if (!c) continue; - if (c === 'l') state = FALSE3;else return emitError('Invalid false started with fa' + c); - continue; + return fn.apply(this, args); + }); + }), - case FALSE3: - if (!c) continue; - if (c === 's') state = FALSE4;else return emitError('Invalid false started with fal' + c); - continue; - case FALSE4: - if (!c) continue; - if (c === 'e') { - emitValueOpen(false); - emitValueClose(); - state = stack.pop() || VALUE; - } else return emitError('Invalid false started with fals' + c); - continue; + /** + * Compose zero or more functions: + * + * compose(f1, f2, f3)(x) = f1(f2(f3(x)))) + * + * The last (inner-most) function may take more than one parameter: + * + * compose(f1, f2, f3)(x,y) = f1(f2(f3(x,y)))) + */ + compose = varArgs(function (fns) { - case NULL: - if (!c) continue; - if (c === 'u') state = NULL2;else return emitError('Invalid null started with n' + c); - continue; + var fnsList = arrayAsList(fns); - case NULL2: - if (!c) continue; - if (c === 'l') state = NULL3;else return emitError('Invalid null started with nu' + c); - continue; + function next(params, curFn) { + return [apply(params, curFn)]; + } - case NULL3: - if (!c) continue; - if (c === 'l') { - emitValueOpen(null); - emitValueClose(); - state = stack.pop() || VALUE; - } else return emitError('Invalid null started with nul' + c); - continue; + return varArgs(function (startParams) { - case NUMBER_DECIMAL_POINT: - if (c === '.') { - numberNode += c; - state = NUMBER_DIGIT; - } else return emitError('Leading zero not followed by .'); - continue; + return foldR(next, startParams, fnsList)[0]; + }); + }); - case NUMBER_DIGIT: - if ('0123456789'.indexOf(c) !== -1) numberNode += c;else if (c === '.') { - if (numberNode.indexOf('.') !== -1) return emitError('Invalid number has two dots'); - numberNode += c; - } else if (c === 'e' || c === 'E') { - if (numberNode.indexOf('e') !== -1 || numberNode.indexOf('E') !== -1) return emitError('Invalid number has two exponential'); - numberNode += c; - } else if (c === "+" || c === "-") { - if (!(p === 'e' || p === 'E')) return emitError('Invalid symbol in number'); - numberNode += c; - } else { - if (numberNode) { - emitValueOpen(parseFloat(numberNode)); - emitValueClose(); - numberNode = ""; - } - i--; // go back one - state = stack.pop() || VALUE; - } - continue; + /** + * A more optimised version of compose that takes exactly two functions + * @param f1 + * @param f2 + */ + function compose2(f1, f2) { + return function () { + return f1.call(this, f2.apply(this, arguments)); + }; + } - default: - return emitError("Unknown state: " + state); + /** + * Generic form for a function to get a property from an object + * + * var o = { + * foo:'bar' + * } + * + * var getFoo = attr('foo') + * + * fetFoo(o) // returns 'bar' + * + * @param {String} key the property name + */ + function attr(key) { + return function (o) { + return o[key]; + }; + } + + /** + * Call a list of functions with the same args until one returns a + * truthy result. Similar to the || operator. + * + * So: + * lazyUnion([f1,f2,f3 ... fn])( p1, p2 ... pn ) + * + * Is equivalent to: + * apply([p1, p2 ... pn], f1) || + * apply([p1, p2 ... pn], f2) || + * apply([p1, p2 ... pn], f3) ... apply(fn, [p1, p2 ... pn]) + * + * @returns the first return value that is given that is truthy. + */ + var lazyUnion = varArgs(function (fns) { + + return varArgs(function (params) { + + var maybeValue; + + for (var i = 0; i < len(fns); i++) { + + maybeValue = apply(params, fns[i]); + + if (maybeValue) { + return maybeValue; } } - if (position >= bufferCheckPosition) checkBufferLength(); - } + }); + }); + + /** + * This file declares various pieces of functional programming. + * + * This isn't a general purpose functional library, to keep things small it + * has just the parts useful for Oboe.js. + */ + + /** + * Call a single function with the given arguments array. + * Basically, a functional-style version of the OO-style Function#apply for + * when we don't care about the context ('this') of the call. + * + * The order of arguments allows partial completion of the arguments array + */ + function apply(args, fn) { + return fn.apply(undefined, args); } - /** - * A bridge used to assign stateless functions to listen to clarinet. + /** + * Define variable argument functions but cut out all that tedious messing about + * with the arguments object. Delivers the variable-length part of the arguments + * list as an array. * - * As well as the parameter from clarinet, each callback will also be passed - * the result of the last callback. + * Eg: * - * This may also be used to clear all listeners by assigning zero handlers: + * var myFunction = varArgs( + * function( fixedArgument, otherFixedArgument, variableNumberOfArguments ){ + * console.log( variableNumberOfArguments ); + * } + * ) + * + * myFunction('a', 'b', 1, 2, 3); // logs [1,2,3] + * + * var myOtherFunction = varArgs(function( variableNumberOfArguments ){ + * console.log( variableNumberOfArguments ); + * }) + * + * myFunction(1, 2, 3); // logs [1,2,3] * - * ascentManager( clarinet, {} ) */ - function ascentManager(oboeBus, handlers) { - "use strict"; + function varArgs(fn) { - var listenerId = {}, - ascent; + var numberOfFixedArguments = fn.length - 1, + slice = Array.prototype.slice; - function stateAfter(handler) { - return function (param) { - ascent = handler(ascent, param); - }; - } + if (numberOfFixedArguments == 0) { + // an optimised case for when there are no fixed args: - for (var eventName in handlers) { + return function () { + return fn.call(this, slice.call(arguments)); + }; + } else if (numberOfFixedArguments == 1) { + // an optimised case for when there are is one fixed args: - oboeBus(eventName).on(stateAfter(handlers[eventName]), listenerId); + return function () { + return fn.call(this, arguments[0], slice.call(arguments, 1)); + }; } - oboeBus(NODE_SWAP).on(function (newNode) { + // general case - var oldHead = head(ascent), - key = keyOf(oldHead), - ancestors = tail(ascent), - parentNode; + // we know how many arguments fn will always take. Create a + // fixed-size array to hold that many, to be re-used on + // every call to the returned function + var argsHolder = Array(fn.length); - if (ancestors) { - parentNode = nodeOf(head(ancestors)); - parentNode[key] = newNode; + return function () { + + for (var i = 0; i < numberOfFixedArguments; i++) { + argsHolder[i] = arguments[i]; } - }); - oboeBus(NODE_DROP).on(function () { + argsHolder[numberOfFixedArguments] = slice.call(arguments, numberOfFixedArguments); - var oldHead = head(ascent), - key = keyOf(oldHead), - ancestors = tail(ascent), - parentNode; + return fn.apply(this, argsHolder); + }; + } - if (ancestors) { - parentNode = nodeOf(head(ancestors)); + /** + * Swap the order of parameters to a binary function + * + * A bit like this flip: http://zvon.org/other/haskell/Outputprelude/flip_f.html + */ + function flip(fn) { + return function (a, b) { + return fn(b, a); + }; + } - delete parentNode[key]; - } - }); + /** + * Create a function which is the intersection of two other functions. + * + * Like the && operator, if the first is truthy, the second is never called, + * otherwise the return value from the second is returned. + */ + function lazyIntersection(fn1, fn2) { - oboeBus(ABORTING).on(function () { + return function (param) { - for (var eventName in handlers) { - oboeBus(eventName).un(listenerId); - } - }); + return fn1(param) && fn2(param); + }; } - // based on gist https://gist.github.com/monsur/706839 + /** + * A function which does nothing + */ + function noop() {} /** - * XmlHttpRequest's getAllResponseHeaders() method returns a string of response - * headers according to the format described here: - * http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method - * This method parses that string into a user-friendly key/value pair object. + * A function which is always happy */ - function parseResponseHeaders(headerStr) { - var headers = {}; + function always() { + return true; + } - headerStr && headerStr.split("\r\n").forEach(function (headerPair) { + /** + * Create a function which always returns the same + * value + * + * var return3 = functor(3); + * + * return3() // gives 3 + * return3() // still gives 3 + * return3() // will always give 3 + */ + function functor(val) { + return function () { + return val; + }; + } - // Can't use split() here because it does the wrong thing - // if the header value has the string ": " in it. - var index = headerPair.indexOf(": "); + /** + * This file defines some loosely associated syntactic sugar for + * Javascript programming + */ - headers[headerPair.substring(0, index)] = headerPair.substring(index + 2); - }); + /** + * Returns true if the given candidate is of type T + */ + function isOfType(T, maybeSomething) { + return maybeSomething && maybeSomething.constructor === T; + } - return headers; + var len = attr('length'), + isString = partialComplete(isOfType, String); + + /** + * I don't like saying this: + * + * foo !=== undefined + * + * because of the double-negative. I find this: + * + * defined(foo) + * + * easier to read. + */ + function defined(value) { + return value !== undefined; } /** - * Detect if a given URL is cross-origin in the scope of the - * current page. - * - * Browser only (since cross-origin has no meaning in Node.js) - * - * @param {Object} pageLocation - as in window.location - * @param {Object} ajaxHost - an object like window.location describing the - * origin of the url that we want to ajax in + * Returns true if object o has a key named like every property in + * the properties array. Will give false if any are missing, or if o + * is not an object. */ - function isCrossOrigin(pageLocation, ajaxHost) { + function hasAllProperties(fieldList, o) { - /* - * NB: defaultPort only knows http and https. - * Returns undefined otherwise. - */ - function defaultPort(protocol) { - return { 'http:': 80, 'https:': 443 }[protocol]; - } + return o instanceof Object && all(function (field) { + return field in o; + }, fieldList); + } + /** + * Like cons in Lisp + */ + function cons(x, xs) { - function portOf(location) { - // pageLocation should always have a protocol. ajaxHost if no port or - // protocol is specified, should use the port of the containing page + /* Internally lists are linked 2-element Javascript arrays. + + Ideally the return here would be Object.freeze([x,xs]) + so that bugs related to mutation are found fast. + However, cons is right on the critical path for + performance and this slows oboe-mark down by + ~25%. Under theoretical future JS engines that freeze more + efficiently (possibly even use immutability to + run faster) this should be considered for + restoration. + */ - return location.port || defaultPort(location.protocol || pageLocation.protocol); - } + return [x, xs]; + } - // if ajaxHost doesn't give a domain, port is the same as pageLocation - // it can't give a protocol but not a domain - // it can't give a port but not a domain + /** + * The empty list + */ + var emptyList = null, - return !!(ajaxHost.protocol && ajaxHost.protocol != pageLocation.protocol || ajaxHost.host && ajaxHost.host != pageLocation.host || ajaxHost.host && portOf(ajaxHost) != portOf(pageLocation)); + + /** + * Get the head of a list. + * + * Ie, head(cons(a,b)) = a + */ + head = attr(0), + + + /** + * Get the tail of a list. + * + * Ie, tail(cons(a,b)) = b + */ + tail = attr(1); + + /** + * Converts an array to a list + * + * asList([a,b,c]) + * + * is equivalent to: + * + * cons(a, cons(b, cons(c, emptyList))) + **/ + function arrayAsList(inputArray) { + + return reverseList(inputArray.reduce(flip(cons), emptyList)); } - /* turn any url into an object like window.location */ - function parseUrlOrigin(url) { - // url could be domain-relative - // url could give a domain + /** + * A varargs version of arrayAsList. Works a bit like list + * in LISP. + * + * list(a,b,c) + * + * is equivalent to: + * + * cons(a, cons(b, cons(c, emptyList))) + */ + var list = varArgs(arrayAsList); - // cross origin means: - // same domain - // same port - // some protocol - // so, same everything up to the first (single) slash - // if such is given - // - // can ignore everything after that + /** + * Convert a list back to a js native array + */ + function listAsArray(list) { - var URL_HOST_PATTERN = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/, + return foldR(function (arraySoFar, listItem) { + arraySoFar.unshift(listItem); + return arraySoFar; + }, [], list); + } - // if no match, use an empty array so that - // subexpressions 1,2,3 are all undefined - // and will ultimately return all empty - // strings as the parse result: - urlHostMatch = URL_HOST_PATTERN.exec(url) || []; + /** + * Map a function over a list + */ + function map(fn, list) { - return { - protocol: urlHostMatch[1] || '', - host: urlHostMatch[2] || '', - port: urlHostMatch[3] || '' - }; + return list ? cons(fn(head(list)), map(fn, tail(list))) : emptyList; } - function httpTransport() { - return new XMLHttpRequest(); + /** + * foldR implementation. Reduce a list down to a single value. + * + * @pram {Function} fn (rightEval, curVal) -> result + */ + function foldR(fn, startValue, list) { + + return list ? fn(foldR(fn, startValue, tail(list)), head(list)) : startValue; } /** - * A wrapper around the browser XmlHttpRequest object that raises an - * event whenever a new part of the response is available. + * foldR implementation. Reduce a list down to a single value. * - * In older browsers progressive reading is impossible so all the - * content is given in a single call. For newer ones several events - * should be raised, allowing progressive interpretation of the response. - * - * @param {Function} oboeBus an event bus local to this Oboe instance - * @param {XMLHttpRequest} xhr the xhr to use as the transport. Under normal - * operation, will have been created using httpTransport() above - * but for tests a stub can be provided instead. - * @param {String} method one of 'GET' 'POST' 'PUT' 'PATCH' 'DELETE' - * @param {String} url the url to make a request to - * @param {String|Null} data some content to be sent with the request. - * Only valid if method is POST or PUT. - * @param {Object} [headers] the http request headers to send - * @param {boolean} withCredentials the XHR withCredentials property will be - * set to this value + * @pram {Function} fn (rightEval, curVal) -> result */ - function streamingHttp(oboeBus, xhr, method, url, data, headers, withCredentials) { - - "use strict"; - - var emitStreamData = oboeBus(STREAM_DATA).emit, - emitFail = oboeBus(FAIL_EVENT).emit, - numberOfCharsAlreadyGivenToCallback = 0, - stillToSendStartEvent = true; + function foldR1(fn, list) { - // When an ABORTING message is put on the event bus abort - // the ajax request - oboeBus(ABORTING).on(function () { + return tail(list) ? fn(foldR1(fn, tail(list)), head(list)) : head(list); + } - // if we keep the onreadystatechange while aborting the XHR gives - // a callback like a successful call so first remove this listener - // by assigning null: - xhr.onreadystatechange = null; + /** + * Return a list like the one given but with the first instance equal + * to item removed + */ + function without(list, test, removedFn) { - xhr.abort(); - }); + return withoutInner(list, removedFn || noop); - /** - * Handle input from the underlying xhr: either a state change, - * the progress event or the request being complete. - */ - function handleProgress() { + function withoutInner(subList, removedFn) { + return subList ? test(head(subList)) ? (removedFn(head(subList)), tail(subList)) : cons(head(subList), withoutInner(tail(subList), removedFn)) : emptyList; + } + } - var textSoFar = xhr.responseText, - newText = textSoFar.substr(numberOfCharsAlreadyGivenToCallback); + /** + * Returns true if the given function holds for every item in + * the list, false otherwise + */ + function all(fn, list) { - /* Raise the event for new text. - - On older browsers, the new text is the whole response. - On newer/better ones, the fragment part that we got since - last progress. */ + return !list || fn(head(list)) && all(fn, tail(list)); + } - if (newText) { - emitStreamData(newText); - } + /** + * Call every function in a list of functions with the same arguments + * + * This doesn't make any sense if we're doing pure functional because + * it doesn't return anything. Hence, this is only really useful if the + * functions being called have side-effects. + */ + function applyEach(fnList, args) { - numberOfCharsAlreadyGivenToCallback = len(textSoFar); - } + if (fnList) { + head(fnList).apply(null, args); - if ('onprogress' in xhr) { - // detect browser support for progressive delivery - xhr.onprogress = handleProgress; + applyEach(tail(fnList), args); } + } - xhr.onreadystatechange = function () { + /** + * Reverse the order of a list + */ + function reverseList(list) { - function sendStartIfNotAlready() { - // Internet Explorer is very unreliable as to when xhr.status etc can - // be read so has to be protected with try/catch and tried again on - // the next readyState if it fails - try { - stillToSendStartEvent && oboeBus(HTTP_START).emit(xhr.status, parseResponseHeaders(xhr.getAllResponseHeaders())); - stillToSendStartEvent = false; - } catch (e) {/* do nothing, will try again on next readyState*/} + // js re-implementation of 3rd solution from: + // http://www.haskell.org/haskellwiki/99_questions/Solutions/5 + function reverseInner(list, reversedAlready) { + if (!list) { + return reversedAlready; } - switch (xhr.readyState) { + return reverseInner(tail(list), cons(head(list), reversedAlready)); + } - case 2: // HEADERS_RECEIVED - case 3: - // LOADING - return sendStartIfNotAlready(); + return reverseInner(list, emptyList); + } - case 4: - // DONE - sendStartIfNotAlready(); // if xhr.status hasn't been available yet, it must be NOW, huh IE? + function first(test, list) { + return list && (test(head(list)) ? head(list) : first(test, tail(list))); + } - // is this a 2xx http code? - var successful = String(xhr.status)[0] == 2; + /* + This is a slightly hacked-up browser only version of clarinet + + * some features removed to help keep browser Oboe under + the 5k micro-library limit + * plug directly into event bus + + For the original go here: + https://github.com/dscape/clarinet + + We receive the events: + STREAM_DATA + STREAM_END + + We emit the events: + SAX_KEY + SAX_VALUE_OPEN + SAX_VALUE_CLOSE + FAIL_EVENT + */ - if (successful) { - // In Chrome 29 (not 28) no onprogress is emitted when a response - // is complete before the onload. We need to always do handleInput - // in case we get the load but have not had a final progress event. - // This looks like a bug and may change in future but let's take - // the safest approach and assume we might not have received a - // progress event for each part of the response - handleProgress(); + function clarinet(eventBus) { + "use strict"; - oboeBus(STREAM_END).emit(); - } else { + var + // shortcut some events on the bus + emitSaxKey = eventBus(SAX_KEY).emit, + emitValueOpen = eventBus(SAX_VALUE_OPEN).emit, + emitValueClose = eventBus(SAX_VALUE_CLOSE).emit, + emitFail = eventBus(FAIL_EVENT).emit, + MAX_BUFFER_LENGTH = 64 * 1024, + stringTokenPattern = /[\\"\n]/g, + _n = 0 - emitFail(errorReport(xhr.status, xhr.responseText)); - } - } - }; + // states + , + BEGIN = _n++, + VALUE = _n++ // general stuff + , + OPEN_OBJECT = _n++ // { + , + CLOSE_OBJECT = _n++ // } + , + OPEN_ARRAY = _n++ // [ + , + CLOSE_ARRAY = _n++ // ] + , + STRING = _n++ // "" + , + OPEN_KEY = _n++ // , "a" + , + CLOSE_KEY = _n++ // : + , + TRUE = _n++ // r + , + TRUE2 = _n++ // u + , + TRUE3 = _n++ // e + , + FALSE = _n++ // a + , + FALSE2 = _n++ // l + , + FALSE3 = _n++ // s + , + FALSE4 = _n++ // e + , + NULL = _n++ // u + , + NULL2 = _n++ // l + , + NULL3 = _n++ // l + , + NUMBER_DECIMAL_POINT = _n++ // . + , + NUMBER_DIGIT = _n // [0-9] - try { + // setup initial parser values + , + bufferCheckPosition = MAX_BUFFER_LENGTH, + latestError, + c, + p, + textNode = undefined, + numberNode = "", + slashed = false, + closed = false, + state = BEGIN, + stack = [], + unicodeS = null, + unicodeI = 0, + depth = 0, + position = 0, + column = 0 //mostly for error reporting + , + line = 1; - xhr.open(method, url, true); + function checkBufferLength() { - for (var headerName in headers) { - xhr.setRequestHeader(headerName, headers[headerName]); - } + var maxActual = 0; - if (!isCrossOrigin(window.location, parseUrlOrigin(url))) { - xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + if (textNode !== undefined && textNode.length > MAX_BUFFER_LENGTH) { + emitError("Max buffer length exceeded: textNode"); + maxActual = Math.max(maxActual, textNode.length); + } + if (numberNode.length > MAX_BUFFER_LENGTH) { + emitError("Max buffer length exceeded: numberNode"); + maxActual = Math.max(maxActual, numberNode.length); } - xhr.withCredentials = withCredentials; + bufferCheckPosition = MAX_BUFFER_LENGTH - maxActual + position; + } - xhr.send(data); - } catch (e) { + eventBus(STREAM_DATA).on(handleData); - // To keep a consistent interface with Node, we can't emit an event here. - // Node's streaming http adaptor receives the error as an asynchronous - // event rather than as an exception. If we emitted now, the Oboe user - // has had no chance to add a .fail listener so there is no way - // the event could be useful. For both these reasons defer the - // firing to the next JS frame. - window.setTimeout(partialComplete(emitFail, errorReport(undefined, undefined, e)), 0); - } - } + /* At the end of the http content close the clarinet + This will provide an error if the total content provided was not + valid json, ie if not all arrays, objects and Strings closed properly */ + eventBus(STREAM_END).on(handleStreamEnd); - var jsonPathSyntax = function () { + function emitError(errorString) { + if (textNode !== undefined) { + emitValueOpen(textNode); + emitValueClose(); + textNode = undefined; + } - var + latestError = Error(errorString + "\nLn: " + line + "\nCol: " + column + "\nChr: " + c); - /** - * Export a regular expression as a simple function by exposing just - * the Regex#exec. This allows regex tests to be used under the same - * interface as differently implemented tests, or for a user of the - * tests to not concern themselves with their implementation as regular - * expressions. - * - * This could also be expressed point-free as: - * Function.prototype.bind.bind(RegExp.prototype.exec), - * - * But that's far too confusing! (and not even smaller once minified - * and gzipped) - */ - regexDescriptor = function regexDescriptor(regex) { - return regex.exec.bind(regex); + emitFail(errorReport(undefined, undefined, latestError)); } - /** - * Join several regular expressions and express as a function. - * This allows the token patterns to reuse component regular expressions - * instead of being expressed in full using huge and confusing regular - * expressions. - */ - , - jsonPathClause = varArgs(function (componentRegexes) { + function handleStreamEnd() { + if (state == BEGIN) { + // Handle the case where the stream closes without ever receiving + // any input. This isn't an error - response bodies can be blank, + // particularly for 204 http responses - // The regular expressions all start with ^ because we - // only want to find matches at the start of the - // JSONPath fragment we are inspecting - componentRegexes.unshift(/^/); + // Because of how Oboe is currently implemented, we parse a + // completely empty stream as containing an empty object. + // This is because Oboe's done event is only fired when the + // root object of the JSON stream closes. - return regexDescriptor(RegExp(componentRegexes.map(attr('source')).join(''))); - }), - possiblyCapturing = /(\$?)/, - namedNode = /([\w-_]+|\*)/, - namePlaceholder = /()/, - nodeInArrayNotation = /\["([^"]+)"\]/, - numberedNodeInArrayNotation = /\[(\d+|\*)\]/, - fieldList = /{([\w ]*?)}/, - optionalFieldList = /(?:{([\w ]*?)})?/ + // This should be decoupled and attached instead to the input stream + // from the http (or whatever) resource ending. + // If this decoupling could happen the SAX parser could simply emit + // zero events on a completely empty input. + emitValueOpen({}); + emitValueClose(); - // foo or * - , - jsonPathNamedNodeInObjectNotation = jsonPathClause(possiblyCapturing, namedNode, optionalFieldList) + closed = true; + return; + } - // ["foo"] - , - jsonPathNamedNodeInArrayNotation = jsonPathClause(possiblyCapturing, nodeInArrayNotation, optionalFieldList) + if (state !== VALUE || depth !== 0) emitError("Unexpected end"); - // [2] or [*] - , - jsonPathNumberedNodeInArrayNotation = jsonPathClause(possiblyCapturing, numberedNodeInArrayNotation, optionalFieldList) + if (textNode !== undefined) { + emitValueOpen(textNode); + emitValueClose(); + textNode = undefined; + } - // {a b c} - , - jsonPathPureDuckTyping = jsonPathClause(possiblyCapturing, namePlaceholder, fieldList) + closed = true; + } - // .. - , - jsonPathDoubleDot = jsonPathClause(/\.\./) + function whitespace(c) { + return c == '\r' || c == '\n' || c == ' ' || c == '\t'; + } - // . - , - jsonPathDot = jsonPathClause(/\./) + function handleData(chunk) { - // ! - , - jsonPathBang = jsonPathClause(possiblyCapturing, /!/) + // this used to throw the error but inside Oboe we will have already + // gotten the error when it was emitted. The important thing is to + // not continue with the parse. + if (latestError) return; - // nada! - , - emptyString = jsonPathClause(/$/); + if (closed) { + return emitError("Cannot write after close"); + } - /* We export only a single function. When called, this function injects - into another function the descriptors from above. - */ - return function (fn) { - return fn(lazyUnion(jsonPathNamedNodeInObjectNotation, jsonPathNamedNodeInArrayNotation, jsonPathNumberedNodeInArrayNotation, jsonPathPureDuckTyping), jsonPathDoubleDot, jsonPathDot, jsonPathBang, emptyString); - }; - }(); - /** - * Get a new key->node mapping - * - * @param {String|Number} key - * @param {Object|Array|String|Number|null} node a value found in the json - */ - function namedNode(key, node) { - return { key: key, node: node }; - } + var i = 0; + c = chunk[0]; - /** get the key of a namedNode */ - var keyOf = attr('key'); + while (c) { + p = c; + c = chunk[i++]; + if (!c) break; - /** get the node from a namedNode */ - var nodeOf = attr('node'); - /** - * This file provides various listeners which can be used to build up - * a changing ascent based on the callbacks provided by Clarinet. It listens - * to the low-level events from Clarinet and emits higher-level ones. - * - * The building up is stateless so to track a JSON file - * ascentManager.js is required to store the ascent state - * between calls. - */ + position++; + if (c == "\n") { + line++; + column = 0; + } else column++; + switch (state) { - /** - * A special value to use in the path list to represent the path 'to' a root - * object (which doesn't really have any path). This prevents the need for - * special-casing detection of the root object and allows it to be treated - * like any other object. We might think of this as being similar to the - * 'unnamed root' domain ".", eg if I go to - * http://en.wikipedia.org./wiki/En/Main_page the dot after 'org' deliminates - * the unnamed root of the DNS. - * - * This is kept as an object to take advantage that in Javascript's OO objects - * are guaranteed to be distinct, therefore no other object can possibly clash - * with this one. Strings, numbers etc provide no such guarantee. - **/ - var ROOT_PATH = {}; + case BEGIN: + if (c === "{") state = OPEN_OBJECT;else if (c === "[") state = OPEN_ARRAY;else if (!whitespace(c)) return emitError("Non-whitespace before {[."); + continue; - /** - * Create a new set of handlers for clarinet's events, bound to the emit - * function given. - */ - function incrementalContentBuilder(oboeBus) { + case OPEN_KEY: + case OPEN_OBJECT: + if (whitespace(c)) continue; + if (state === OPEN_KEY) stack.push(CLOSE_KEY);else { + if (c === '}') { + emitValueOpen({}); + emitValueClose(); + state = stack.pop() || VALUE; + continue; + } else stack.push(CLOSE_OBJECT); + } + if (c === '"') state = STRING;else return emitError("Malformed object key should start with \" "); + continue; - var emitNodeOpened = oboeBus(NODE_OPENED).emit, - emitNodeClosed = oboeBus(NODE_CLOSED).emit, - emitRootOpened = oboeBus(ROOT_PATH_FOUND).emit, - emitRootClosed = oboeBus(ROOT_NODE_FOUND).emit; + case CLOSE_KEY: + case CLOSE_OBJECT: + if (whitespace(c)) continue; - function arrayIndicesAreKeys(possiblyInconsistentAscent, newDeepestNode) { + if (c === ':') { + if (state === CLOSE_OBJECT) { + stack.push(CLOSE_OBJECT); - /* for values in arrays we aren't pre-warned of the coming paths - (Clarinet gives no call to onkey like it does for values in objects) - so if we are in an array we need to create this path ourselves. The - key will be len(parentNode) because array keys are always sequential - numbers. */ + if (textNode !== undefined) { + // was previously (in upstream Clarinet) one event + // - object open came with the text of the first + emitValueOpen({}); + emitSaxKey(textNode); + textNode = undefined; + } + depth++; + } else { + if (textNode !== undefined) { + emitSaxKey(textNode); + textNode = undefined; + } + } + state = VALUE; + } else if (c === '}') { + if (textNode !== undefined) { + emitValueOpen(textNode); + emitValueClose(); + textNode = undefined; + } + emitValueClose(); + depth--; + state = stack.pop() || VALUE; + } else if (c === ',') { + if (state === CLOSE_OBJECT) stack.push(CLOSE_OBJECT); + if (textNode !== undefined) { + emitValueOpen(textNode); + emitValueClose(); + textNode = undefined; + } + state = OPEN_KEY; + } else return emitError('Bad object'); + continue; - var parentNode = nodeOf(head(possiblyInconsistentAscent)); + case OPEN_ARRAY: // after an array there always a value + case VALUE: + if (whitespace(c)) continue; + if (state === OPEN_ARRAY) { + emitValueOpen([]); + depth++; + state = VALUE; + if (c === ']') { + emitValueClose(); + depth--; + state = stack.pop() || VALUE; + continue; + } else { + stack.push(CLOSE_ARRAY); + } + } + if (c === '"') state = STRING;else if (c === '{') state = OPEN_OBJECT;else if (c === '[') state = OPEN_ARRAY;else if (c === 't') state = TRUE;else if (c === 'f') state = FALSE;else if (c === 'n') state = NULL;else if (c === '-') { + // keep and continue + numberNode += c; + } else if (c === '0') { + numberNode += c; + state = NUMBER_DIGIT; + } else if ('123456789'.indexOf(c) !== -1) { + numberNode += c; + state = NUMBER_DIGIT; + } else return emitError("Bad value"); + continue; - return isOfType(Array, parentNode) ? keyFound(possiblyInconsistentAscent, len(parentNode), newDeepestNode) : - // nothing needed, return unchanged - possiblyInconsistentAscent; - } + case CLOSE_ARRAY: + if (c === ',') { + stack.push(CLOSE_ARRAY); + if (textNode !== undefined) { + emitValueOpen(textNode); + emitValueClose(); + textNode = undefined; + } + state = VALUE; + } else if (c === ']') { + if (textNode !== undefined) { + emitValueOpen(textNode); + emitValueClose(); + textNode = undefined; + } + emitValueClose(); + depth--; + state = stack.pop() || VALUE; + } else if (whitespace(c)) continue;else return emitError('Bad array'); + continue; - function nodeOpened(ascent, newDeepestNode) { + case STRING: + if (textNode === undefined) { + textNode = ""; + } - if (!ascent) { - // we discovered the root node, - emitRootOpened(newDeepestNode); + // thanks thejh, this is an about 50% performance improvement. + var starti = i - 1; - return keyFound(ascent, ROOT_PATH, newDeepestNode); - } + STRING_BIGLOOP: while (true) { - // we discovered a non-root node + // zero means "no unicode active". 1-4 mean "parse some more". end after 4. + while (unicodeI > 0) { + unicodeS += c; + c = chunk.charAt(i++); + if (unicodeI === 4) { + // TODO this might be slow? well, probably not used too often anyway + textNode += String.fromCharCode(parseInt(unicodeS, 16)); + unicodeI = 0; + starti = i - 1; + } else { + unicodeI++; + } + // we can just break here: no stuff we skipped that still has to be sliced out or so + if (!c) break STRING_BIGLOOP; + } + if (c === '"' && !slashed) { + state = stack.pop() || VALUE; + textNode += chunk.substring(starti, i - 1); + break; + } + if (c === '\\' && !slashed) { + slashed = true; + textNode += chunk.substring(starti, i - 1); + c = chunk.charAt(i++); + if (!c) break; + } + if (slashed) { + slashed = false; + if (c === 'n') { + textNode += '\n'; + } else if (c === 'r') { + textNode += '\r'; + } else if (c === 't') { + textNode += '\t'; + } else if (c === 'f') { + textNode += '\f'; + } else if (c === 'b') { + textNode += '\b'; + } else if (c === 'u') { + // \uxxxx. meh! + unicodeI = 1; + unicodeS = ''; + } else { + textNode += c; + } + c = chunk.charAt(i++); + starti = i - 1; + if (!c) break;else continue; + } - var arrayConsistentAscent = arrayIndicesAreKeys(ascent, newDeepestNode), - ancestorBranches = tail(arrayConsistentAscent), - previouslyUnmappedName = keyOf(head(arrayConsistentAscent)); + stringTokenPattern.lastIndex = i; + var reResult = stringTokenPattern.exec(chunk); + if (!reResult) { + i = chunk.length + 1; + textNode += chunk.substring(starti, i - 1); + break; + } + i = reResult.index + 1; + c = chunk.charAt(reResult.index); + if (!c) { + textNode += chunk.substring(starti, i - 1); + break; + } + } + continue; - appendBuiltContent(ancestorBranches, previouslyUnmappedName, newDeepestNode); + case TRUE: + if (!c) continue; // strange buffers + if (c === 'r') state = TRUE2;else return emitError('Invalid true started with t' + c); + continue; - return cons(namedNode(previouslyUnmappedName, newDeepestNode), ancestorBranches); - } + case TRUE2: + if (!c) continue; + if (c === 'u') state = TRUE3;else return emitError('Invalid true started with tr' + c); + continue; - /** - * Add a new value to the object we are building up to represent the - * parsed JSON - */ - function appendBuiltContent(ancestorBranches, key, node) { + case TRUE3: + if (!c) continue; + if (c === 'e') { + emitValueOpen(true); + emitValueClose(); + state = stack.pop() || VALUE; + } else return emitError('Invalid true started with tru' + c); + continue; - nodeOf(head(ancestorBranches))[key] = node; - } + case FALSE: + if (!c) continue; + if (c === 'a') state = FALSE2;else return emitError('Invalid false started with f' + c); + continue; - /** - * For when we find a new key in the json. - * - * @param {String|Number|Object} newDeepestName the key. If we are in an - * array will be a number, otherwise a string. May take the special - * value ROOT_PATH if the root node has just been found - * - * @param {String|Number|Object|Array|Null|undefined} [maybeNewDeepestNode] - * usually this won't be known so can be undefined. Can't use null - * to represent unknown because null is a valid value in JSON - **/ - function keyFound(ascent, newDeepestName, maybeNewDeepestNode) { + case FALSE2: + if (!c) continue; + if (c === 'l') state = FALSE3;else return emitError('Invalid false started with fa' + c); + continue; - if (ascent) { - // if not root + case FALSE3: + if (!c) continue; + if (c === 's') state = FALSE4;else return emitError('Invalid false started with fal' + c); + continue; - // If we have the key but (unless adding to an array) no known value - // yet. Put that key in the output but against no defined value: - appendBuiltContent(ascent, newDeepestName, maybeNewDeepestNode); - } + case FALSE4: + if (!c) continue; + if (c === 'e') { + emitValueOpen(false); + emitValueClose(); + state = stack.pop() || VALUE; + } else return emitError('Invalid false started with fals' + c); + continue; - var ascentWithNewPath = cons(namedNode(newDeepestName, maybeNewDeepestNode), ascent); + case NULL: + if (!c) continue; + if (c === 'u') state = NULL2;else return emitError('Invalid null started with n' + c); + continue; - emitNodeOpened(ascentWithNewPath); + case NULL2: + if (!c) continue; + if (c === 'l') state = NULL3;else return emitError('Invalid null started with nu' + c); + continue; - return ascentWithNewPath; - } + case NULL3: + if (!c) continue; + if (c === 'l') { + emitValueOpen(null); + emitValueClose(); + state = stack.pop() || VALUE; + } else return emitError('Invalid null started with nul' + c); + continue; - /** - * For when the current node ends. - */ - function nodeClosed(ascent) { + case NUMBER_DECIMAL_POINT: + if (c === '.') { + numberNode += c; + state = NUMBER_DIGIT; + } else return emitError('Leading zero not followed by .'); + continue; - emitNodeClosed(ascent); + case NUMBER_DIGIT: + if ('0123456789'.indexOf(c) !== -1) numberNode += c;else if (c === '.') { + if (numberNode.indexOf('.') !== -1) return emitError('Invalid number has two dots'); + numberNode += c; + } else if (c === 'e' || c === 'E') { + if (numberNode.indexOf('e') !== -1 || numberNode.indexOf('E') !== -1) return emitError('Invalid number has two exponential'); + numberNode += c; + } else if (c === "+" || c === "-") { + if (!(p === 'e' || p === 'E')) return emitError('Invalid symbol in number'); + numberNode += c; + } else { + if (numberNode) { + emitValueOpen(parseFloat(numberNode)); + emitValueClose(); + numberNode = ""; + } + i--; // go back one + state = stack.pop() || VALUE; + } + continue; - return tail(ascent) || - // If there are no nodes left in the ascent the root node - // just closed. Emit a special event for this: - emitRootClosed(nodeOf(head(ascent))); + default: + return emitError("Unknown state: " + state); + } + } + if (position >= bufferCheckPosition) checkBufferLength(); } - - var contentBuilderHandlers = {}; - contentBuilderHandlers[SAX_VALUE_OPEN] = nodeOpened; - contentBuilderHandlers[SAX_VALUE_CLOSE] = nodeClosed; - contentBuilderHandlers[SAX_KEY] = keyFound; - return contentBuilderHandlers; } - /** - * The jsonPath evaluator compiler used for Oboe.js. + /** + * A bridge used to assign stateless functions to listen to clarinet. * - * One function is exposed. This function takes a String JSONPath spec and - * returns a function to test candidate ascents for matches. + * As well as the parameter from clarinet, each callback will also be passed + * the result of the last callback. * - * String jsonPath -> (List ascent) -> Boolean|Object - * - * This file is coded in a pure functional style. That is, no function has - * side effects, every function evaluates to the same value for the same - * arguments and no variables are reassigned. + * This may also be used to clear all listeners by assigning zero handlers: + * + * ascentManager( clarinet, {} ) */ - // the call to jsonPathSyntax injects the token syntaxes that are needed - // inside the compiler - var jsonPathCompiler = jsonPathSyntax(function (pathNodeSyntax, doubleDotSyntax, dotSyntax, bangSyntax, emptySyntax) { - - var CAPTURING_INDEX = 1; - var NAME_INDEX = 2; - var FIELD_LIST_INDEX = 3; - - var headKey = compose2(keyOf, head), - headNode = compose2(nodeOf, head); + function ascentManager(oboeBus, handlers) { + "use strict"; - /** - * Create an evaluator function for a named path node, expressed in the - * JSONPath like: - * foo - * ["bar"] - * [2] - */ - function nameClause(previousExpr, detection) { + var listenerId = {}, + ascent; - var name = detection[NAME_INDEX], - matchesName = !name || name == '*' ? always : function (ascent) { - return headKey(ascent) == name; + function stateAfter(handler) { + return function (param) { + ascent = handler(ascent, param); }; - - return lazyIntersection(matchesName, previousExpr); - } - - /** - * Create an evaluator function for a a duck-typed node, expressed like: - * - * {spin, taste, colour} - * .particle{spin, taste, colour} - * *{spin, taste, colour} - */ - function duckTypeClause(previousExpr, detection) { - - var fieldListStr = detection[FIELD_LIST_INDEX]; - - if (!fieldListStr) return previousExpr; // don't wrap at all, return given expr as-is - - var hasAllrequiredFields = partialComplete(hasAllProperties, arrayAsList(fieldListStr.split(/\W+/))), - isMatch = compose2(hasAllrequiredFields, headNode); - - return lazyIntersection(isMatch, previousExpr); } - /** - * Expression for $, returns the evaluator function - */ - function capture(previousExpr, detection) { - - // extract meaning from the detection - var capturing = !!detection[CAPTURING_INDEX]; - - if (!capturing) return previousExpr; // don't wrap at all, return given expr as-is + for (var eventName in handlers) { - return lazyIntersection(previousExpr, head); + oboeBus(eventName).on(stateAfter(handlers[eventName]), listenerId); } - /** - * Create an evaluator function that moves onto the next item on the - * lists. This function is the place where the logic to move up a - * level in the ascent exists. - * - * Eg, for JSONPath ".foo" we need skip1(nameClause(always, [,'foo'])) - */ - function skip1(previousExpr) { + oboeBus(NODE_SWAP).on(function (newNode) { - if (previousExpr == always) { - /* If there is no previous expression this consume command - is at the start of the jsonPath. - Since JSONPath specifies what we'd like to find but not - necessarily everything leading down to it, when running - out of JSONPath to check against we default to true */ - return always; - } + var oldHead = head(ascent), + key = keyOf(oldHead), + ancestors = tail(ascent), + parentNode; - /** return true if the ascent we have contains only the JSON root, - * false otherwise - */ - function notAtRoot(ascent) { - return headKey(ascent) != ROOT_PATH; + if (ancestors) { + parentNode = nodeOf(head(ancestors)); + parentNode[key] = newNode; } + }); - return lazyIntersection( - /* If we're already at the root but there are more - expressions to satisfy, can't consume any more. No match. - This check is why none of the other exprs have to be able - to handle empty lists; skip1 is the only evaluator that - moves onto the next token and it refuses to do so once it - reaches the last item in the list. */ - notAtRoot, + oboeBus(NODE_DROP).on(function () { - /* We are not at the root of the ascent yet. - Move to the next level of the ascent by handing only - the tail to the previous expression */ - compose2(previousExpr, tail)); - } + var oldHead = head(ascent), + key = keyOf(oldHead), + ancestors = tail(ascent), + parentNode; - /** - * Create an evaluator function for the .. (double dot) token. Consumes - * zero or more levels of the ascent, the fewest that are required to find - * a match when given to previousExpr. - */ - function skipMany(previousExpr) { + if (ancestors) { + parentNode = nodeOf(head(ancestors)); - if (previousExpr == always) { - /* If there is no previous expression this consume command - is at the start of the jsonPath. - Since JSONPath specifies what we'd like to find but not - necessarily everything leading down to it, when running - out of JSONPath to check against we default to true */ - return always; + delete parentNode[key]; } + }); - var - // In JSONPath .. is equivalent to !.. so if .. reaches the root - // the match has succeeded. Ie, we might write ..foo or !..foo - // and both should match identically. - terminalCaseWhenArrivingAtRoot = rootExpr(), - terminalCaseWhenPreviousExpressionIsSatisfied = previousExpr, - recursiveCase = skip1(function (ascent) { - return cases(ascent); - }), - cases = lazyUnion(terminalCaseWhenArrivingAtRoot, terminalCaseWhenPreviousExpressionIsSatisfied, recursiveCase); - - return cases; - } - - /** - * Generate an evaluator for ! - matches only the root element of the json - * and ignores any previous expressions since nothing may precede !. - */ - function rootExpr() { - - return function (ascent) { - return headKey(ascent) == ROOT_PATH; - }; - } + oboeBus(ABORTING).on(function () { - /** - * Generate a statement wrapper to sit around the outermost - * clause evaluator. - * - * Handles the case where the capturing is implicit because the JSONPath - * did not contain a '$' by returning the last node. - */ - function statementExpr(lastClause) { + for (var eventName in handlers) { + oboeBus(eventName).un(listenerId); + } + }); + } - return function (ascent) { + // based on gist https://gist.github.com/monsur/706839 - // kick off the evaluation by passing through to the last clause - var exprMatch = lastClause(ascent); + /** + * XmlHttpRequest's getAllResponseHeaders() method returns a string of response + * headers according to the format described here: + * http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method + * This method parses that string into a user-friendly key/value pair object. + */ + function parseResponseHeaders(headerStr) { + var headers = {}; - return exprMatch === true ? head(ascent) : exprMatch; - }; - } + headerStr && headerStr.split("\r\n").forEach(function (headerPair) { - /** - * For when a token has been found in the JSONPath input. - * Compiles the parser for that token and returns in combination with the - * parser already generated. - * - * @param {Function} exprs a list of the clause evaluator generators for - * the token that was found - * @param {Function} parserGeneratedSoFar the parser already found - * @param {Array} detection the match given by the regex engine when - * the feature was found - */ - function expressionsReader(exprs, parserGeneratedSoFar, detection) { + // Can't use split() here because it does the wrong thing + // if the header value has the string ": " in it. + var index = headerPair.indexOf(": "); - // if exprs is zero-length foldR will pass back the - // parserGeneratedSoFar as-is so we don't need to treat - // this as a special case + headers[headerPair.substring(0, index)] = headerPair.substring(index + 2); + }); - return foldR(function (parserGeneratedSoFar, expr) { + return headers; + } - return expr(parserGeneratedSoFar, detection); - }, parserGeneratedSoFar, exprs); - } + /** + * Detect if a given URL is cross-origin in the scope of the + * current page. + * + * Browser only (since cross-origin has no meaning in Node.js) + * + * @param {Object} pageLocation - as in window.location + * @param {Object} ajaxHost - an object like window.location describing the + * origin of the url that we want to ajax in + */ + function isCrossOrigin(pageLocation, ajaxHost) { - /** - * If jsonPath matches the given detector function, creates a function which - * evaluates against every clause in the clauseEvaluatorGenerators. The - * created function is propagated to the onSuccess function, along with - * the remaining unparsed JSONPath substring. - * - * The intended use is to create a clauseMatcher by filling in - * the first two arguments, thus providing a function that knows - * some syntax to match and what kind of generator to create if it - * finds it. The parameter list once completed is: - * - * (jsonPath, parserGeneratedSoFar, onSuccess) - * - * onSuccess may be compileJsonPathToFunction, to recursively continue - * parsing after finding a match or returnFoundParser to stop here. + /* + * NB: defaultPort only knows http and https. + * Returns undefined otherwise. */ - function generateClauseReaderIfTokenFound(tokenDetector, clauseEvaluatorGenerators, jsonPath, parserGeneratedSoFar, onSuccess) { - - var detected = tokenDetector(jsonPath); - - if (detected) { - var compiledParser = expressionsReader(clauseEvaluatorGenerators, parserGeneratedSoFar, detected), - remainingUnparsedJsonPath = jsonPath.substr(len(detected[0])); - - return onSuccess(remainingUnparsedJsonPath, compiledParser); - } + function defaultPort(protocol) { + return { 'http:': 80, 'https:': 443 }[protocol]; } - /** - * Partially completes generateClauseReaderIfTokenFound above. - */ - function clauseMatcher(tokenDetector, exprs) { + function portOf(location) { + // pageLocation should always have a protocol. ajaxHost if no port or + // protocol is specified, should use the port of the containing page - return partialComplete(generateClauseReaderIfTokenFound, tokenDetector, exprs); + return location.port || defaultPort(location.protocol || pageLocation.protocol); } - /** - * clauseForJsonPath is a function which attempts to match against - * several clause matchers in order until one matches. If non match the - * jsonPath expression is invalid and an error is thrown. - * - * The parameter list is the same as a single clauseMatcher: - * - * (jsonPath, parserGeneratedSoFar, onSuccess) - */ - var clauseForJsonPath = lazyUnion(clauseMatcher(pathNodeSyntax, list(capture, duckTypeClause, nameClause, skip1)), clauseMatcher(doubleDotSyntax, list(skipMany)) + // if ajaxHost doesn't give a domain, port is the same as pageLocation + // it can't give a protocol but not a domain + // it can't give a port but not a domain - // dot is a separator only (like whitespace in other languages) but - // rather than make it a special case, use an empty list of - // expressions when this token is found - , clauseMatcher(dotSyntax, list()), clauseMatcher(bangSyntax, list(capture, rootExpr)), clauseMatcher(emptySyntax, list(statementExpr)), function (jsonPath) { - throw Error('"' + jsonPath + '" could not be tokenised'); - }); + return !!(ajaxHost.protocol && ajaxHost.protocol != pageLocation.protocol || ajaxHost.host && ajaxHost.host != pageLocation.host || ajaxHost.host && portOf(ajaxHost) != portOf(pageLocation)); + } - /** - * One of two possible values for the onSuccess argument of - * generateClauseReaderIfTokenFound. - * - * When this function is used, generateClauseReaderIfTokenFound simply - * returns the compiledParser that it made, regardless of if there is - * any remaining jsonPath to be compiled. - */ - function returnFoundParser(_remainingJsonPath, compiledParser) { - return compiledParser; - } + /* turn any url into an object like window.location */ + function parseUrlOrigin(url) { + // url could be domain-relative + // url could give a domain - /** - * Recursively compile a JSONPath expression. - * - * This function serves as one of two possible values for the onSuccess - * argument of generateClauseReaderIfTokenFound, meaning continue to - * recursively compile. Otherwise, returnFoundParser is given and - * compilation terminates. - */ - function compileJsonPathToFunction(uncompiledJsonPath, parserGeneratedSoFar) { + // cross origin means: + // same domain + // same port + // some protocol + // so, same everything up to the first (single) slash + // if such is given + // + // can ignore everything after that - /** - * On finding a match, if there is remaining text to be compiled - * we want to either continue parsing using a recursive call to - * compileJsonPathToFunction. Otherwise, we want to stop and return - * the parser that we have found so far. - */ - var onFind = uncompiledJsonPath ? compileJsonPathToFunction : returnFoundParser; + var URL_HOST_PATTERN = /(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/, - return clauseForJsonPath(uncompiledJsonPath, parserGeneratedSoFar, onFind); - } - /** - * This is the function that we expose to the rest of the library. - */ - return function (jsonPath) { + // if no match, use an empty array so that + // subexpressions 1,2,3 are all undefined + // and will ultimately return all empty + // strings as the parse result: + urlHostMatch = URL_HOST_PATTERN.exec(url) || []; - try { - // Kick off the recursive parsing of the jsonPath - return compileJsonPathToFunction(jsonPath, always); - } catch (e) { - throw Error('Could not compile "' + jsonPath + '" because ' + e.message); - } + return { + protocol: urlHostMatch[1] || '', + host: urlHostMatch[2] || '', + port: urlHostMatch[3] || '' }; - }); + } - /** - * A pub/sub which is responsible for a single event type. A - * multi-event type event bus is created by pubSub by collecting - * several of these. + function httpTransport() { + return new XMLHttpRequest(); + } + + /** + * A wrapper around the browser XmlHttpRequest object that raises an + * event whenever a new part of the response is available. * - * @param {String} eventType - * the name of the events managed by this singleEventPubSub - * @param {singleEventPubSub} [newListener] - * place to notify of new listeners - * @param {singleEventPubSub} [removeListener] - * place to notify of when listeners are removed + * In older browsers progressive reading is impossible so all the + * content is given in a single call. For newer ones several events + * should be raised, allowing progressive interpretation of the response. + * + * @param {Function} oboeBus an event bus local to this Oboe instance + * @param {XMLHttpRequest} xhr the xhr to use as the transport. Under normal + * operation, will have been created using httpTransport() above + * but for tests a stub can be provided instead. + * @param {String} method one of 'GET' 'POST' 'PUT' 'PATCH' 'DELETE' + * @param {String} url the url to make a request to + * @param {String|Null} data some content to be sent with the request. + * Only valid if method is POST or PUT. + * @param {Object} [headers] the http request headers to send + * @param {boolean} withCredentials the XHR withCredentials property will be + * set to this value */ - function singleEventPubSub(eventType, newListener, removeListener) { + function streamingHttp(oboeBus, xhr, method, url, data, headers, withCredentials) { - /** we are optimised for emitting events over firing them. - * As well as the tuple list which stores event ids and - * listeners there is a list with just the listeners which - * can be iterated more quickly when we are emitting + "use strict"; + + var emitStreamData = oboeBus(STREAM_DATA).emit, + emitFail = oboeBus(FAIL_EVENT).emit, + numberOfCharsAlreadyGivenToCallback = 0, + stillToSendStartEvent = true; + + // When an ABORTING message is put on the event bus abort + // the ajax request + oboeBus(ABORTING).on(function () { + + // if we keep the onreadystatechange while aborting the XHR gives + // a callback like a successful call so first remove this listener + // by assigning null: + xhr.onreadystatechange = null; + + xhr.abort(); + }); + + /** + * Handle input from the underlying xhr: either a state change, + * the progress event or the request being complete. */ - var listenerTupleList, listenerList; + function handleProgress() { - function hasId(id) { - return function (tuple) { - return tuple.id == id; - }; - } + var textSoFar = xhr.responseText, + newText = textSoFar.substr(numberOfCharsAlreadyGivenToCallback); - return { + /* Raise the event for new text. + + On older browsers, the new text is the whole response. + On newer/better ones, the fragment part that we got since + last progress. */ - /** - * @param {Function} listener - * @param {*} listenerId - * an id that this listener can later by removed by. - * Can be of any type, to be compared to other ids using == - */ - on: function on(listener, listenerId) { + if (newText) { + emitStreamData(newText); + } - var tuple = { - listener: listener, - id: listenerId || listener // when no id is given use the - // listener function as the id - }; + numberOfCharsAlreadyGivenToCallback = len(textSoFar); + } - if (newListener) { - newListener.emit(eventType, listener, tuple.id); - } + if ('onprogress' in xhr) { + // detect browser support for progressive delivery + xhr.onprogress = handleProgress; + } - listenerTupleList = cons(tuple, listenerTupleList); - listenerList = cons(listener, listenerList); + xhr.onreadystatechange = function () { - return this; // chaining - }, + function sendStartIfNotAlready() { + // Internet Explorer is very unreliable as to when xhr.status etc can + // be read so has to be protected with try/catch and tried again on + // the next readyState if it fails + try { + stillToSendStartEvent && oboeBus(HTTP_START).emit(xhr.status, parseResponseHeaders(xhr.getAllResponseHeaders())); + stillToSendStartEvent = false; + } catch (e) {/* do nothing, will try again on next readyState*/} + } - emit: function emit() { - applyEach(listenerList, arguments); - }, + switch (xhr.readyState) { - un: function un(listenerId) { + case 2: // HEADERS_RECEIVED + case 3: + // LOADING + return sendStartIfNotAlready(); - var removed; + case 4: + // DONE + sendStartIfNotAlready(); // if xhr.status hasn't been available yet, it must be NOW, huh IE? - listenerTupleList = without(listenerTupleList, hasId(listenerId), function (tuple) { - removed = tuple; - }); + // is this a 2xx http code? + var successful = String(xhr.status)[0] == 2; - if (removed) { - listenerList = without(listenerList, function (listener) { - return listener == removed.listener; - }); + if (successful) { + // In Chrome 29 (not 28) no onprogress is emitted when a response + // is complete before the onload. We need to always do handleInput + // in case we get the load but have not had a final progress event. + // This looks like a bug and may change in future but let's take + // the safest approach and assume we might not have received a + // progress event for each part of the response + handleProgress(); - if (removeListener) { - removeListener.emit(eventType, removed.listener, removed.id); + oboeBus(STREAM_END).emit(); + } else { + + emitFail(errorReport(xhr.status, xhr.responseText)); } - } - }, + } + }; - listeners: function listeners() { - // differs from Node EventEmitter: returns list, not array - return listenerList; - }, + try { - hasListener: function hasListener(listenerId) { - var test = listenerId ? hasId(listenerId) : always; + xhr.open(method, url, true); - return defined(first(test, listenerTupleList)); + for (var headerName in headers) { + xhr.setRequestHeader(headerName, headers[headerName]); } - }; - } - /** - * pubSub is a curried interface for listening to and emitting - * events. - * - * If we get a bus: - * - * var bus = pubSub(); - * - * We can listen to event 'foo' like: - * - * bus('foo').on(myCallback) - * - * And emit event foo like: - * - * bus('foo').emit() - * - * or, with a parameter: - * - * bus('foo').emit('bar') - * - * All functions can be cached and don't need to be - * bound. Ie: - * - * var fooEmitter = bus('foo').emit - * fooEmitter('bar'); // emit an event - * fooEmitter('baz'); // emit another - * - * There's also an uncurried[1] shortcut for .emit and .on: - * - * bus.on('foo', callback) - * bus.emit('foo', 'bar') - * - * [1]: http://zvon.org/other/haskell/Outputprelude/uncurry_f.html - */ - function pubSub() { - var singles = {}, - newListener = newSingle('newListener'), - removeListener = newSingle('removeListener'); + if (!isCrossOrigin(window.location, parseUrlOrigin(url))) { + xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + } - function newSingle(eventName) { - return singles[eventName] = singleEventPubSub(eventName, newListener, removeListener); - } + xhr.withCredentials = withCredentials; - /** pubSub instances are functions */ - function pubSubInstance(eventName) { + xhr.send(data); + } catch (e) { - return singles[eventName] || newSingle(eventName); + // To keep a consistent interface with Node, we can't emit an event here. + // Node's streaming http adaptor receives the error as an asynchronous + // event rather than as an exception. If we emitted now, the Oboe user + // has had no chance to add a .fail listener so there is no way + // the event could be useful. For both these reasons defer the + // firing to the next JS frame. + window.setTimeout(partialComplete(emitFail, errorReport(undefined, undefined, e)), 0); } + } - // add convenience EventEmitter-style uncurried form of 'emit' and 'on' - ['emit', 'on', 'un'].forEach(function (methodName) { + var jsonPathSyntax = function () { - pubSubInstance[methodName] = varArgs(function (eventName, parameters) { - apply(parameters, pubSubInstance(eventName)[methodName]); - }); - }); + var - return pubSubInstance; - } + /** + * Export a regular expression as a simple function by exposing just + * the Regex#exec. This allows regex tests to be used under the same + * interface as differently implemented tests, or for a user of the + * tests to not concern themselves with their implementation as regular + * expressions. + * + * This could also be expressed point-free as: + * Function.prototype.bind.bind(RegExp.prototype.exec), + * + * But that's far too confusing! (and not even smaller once minified + * and gzipped) + */ + regexDescriptor = function regexDescriptor(regex) { + return regex.exec.bind(regex); + } - /** - * This file declares some constants to use as names for event types. - */ + /** + * Join several regular expressions and express as a function. + * This allows the token patterns to reuse component regular expressions + * instead of being expressed in full using huge and confusing regular + * expressions. + */ + , + jsonPathClause = varArgs(function (componentRegexes) { - var // the events which are never exported are kept as - // the smallest possible representation, in numbers: - _S = 1, + // The regular expressions all start with ^ because we + // only want to find matches at the start of the + // JSONPath fragment we are inspecting + componentRegexes.unshift(/^/); + return regexDescriptor(RegExp(componentRegexes.map(attr('source')).join(''))); + }), + possiblyCapturing = /(\$?)/, + namedNode = /([\w-_]+|\*)/, + namePlaceholder = /()/, + nodeInArrayNotation = /\["([^"]+)"\]/, + numberedNodeInArrayNotation = /\[(\d+|\*)\]/, + fieldList = /{([\w ]*?)}/, + optionalFieldList = /(?:{([\w ]*?)})?/ - // fired whenever a new node starts in the JSON stream: - NODE_OPENED = _S++, + // foo or * + , + jsonPathNamedNodeInObjectNotation = jsonPathClause(possiblyCapturing, namedNode, optionalFieldList) + // ["foo"] + , + jsonPathNamedNodeInArrayNotation = jsonPathClause(possiblyCapturing, nodeInArrayNotation, optionalFieldList) - // fired whenever a node closes in the JSON stream: - NODE_CLOSED = _S++, + // [2] or [*] + , + jsonPathNumberedNodeInArrayNotation = jsonPathClause(possiblyCapturing, numberedNodeInArrayNotation, optionalFieldList) + // {a b c} + , + jsonPathPureDuckTyping = jsonPathClause(possiblyCapturing, namePlaceholder, fieldList) - // called if a .node callback returns a value - - NODE_SWAP = _S++, - NODE_DROP = _S++, - FAIL_EVENT = 'fail', - ROOT_NODE_FOUND = _S++, - ROOT_PATH_FOUND = _S++, - HTTP_START = 'start', - STREAM_DATA = 'data', - STREAM_END = 'end', - ABORTING = _S++, + // .. + , + jsonPathDoubleDot = jsonPathClause(/\.\./) + // . + , + jsonPathDot = jsonPathClause(/\./) - // SAX events butchered from Clarinet - SAX_KEY = _S++, - SAX_VALUE_OPEN = _S++, - SAX_VALUE_CLOSE = _S++; + // ! + , + jsonPathBang = jsonPathClause(possiblyCapturing, /!/) - function errorReport(statusCode, body, error) { - try { - var jsonBody = JSON.parse(body); - } catch (e) {} + // nada! + , + emptyString = jsonPathClause(/$/); - return { - statusCode: statusCode, - body: body, - jsonBody: jsonBody, - thrown: error + /* We export only a single function. When called, this function injects + into another function the descriptors from above. + */ + return function (fn) { + return fn(lazyUnion(jsonPathNamedNodeInObjectNotation, jsonPathNamedNodeInArrayNotation, jsonPathNumberedNodeInArrayNotation, jsonPathPureDuckTyping), jsonPathDoubleDot, jsonPathDot, jsonPathBang, emptyString); }; + }(); + /** + * Get a new key->node mapping + * + * @param {String|Number} key + * @param {Object|Array|String|Number|null} node a value found in the json + */ + function namedNode(key, node) { + return { key: key, node: node }; } + /** get the key of a namedNode */ + var keyOf = attr('key'); + + /** get the node from a namedNode */ + var nodeOf = attr('node'); /** - * The pattern adaptor listens for newListener and removeListener - * events. When patterns are added or removed it compiles the JSONPath - * and wires them up. + * This file provides various listeners which can be used to build up + * a changing ascent based on the callbacks provided by Clarinet. It listens + * to the low-level events from Clarinet and emits higher-level ones. * - * When nodes and paths are found it emits the fully-qualified match - * events with parameters ready to ship to the outside world + * The building up is stateless so to track a JSON file + * ascentManager.js is required to store the ascent state + * between calls. */ - function patternAdapter(oboeBus, jsonPathCompiler) { - - var predicateEventMap = { - node: oboeBus(NODE_CLOSED), - path: oboeBus(NODE_OPENED) - }; - - function emitMatchingNode(emitMatch, node, ascent) { + /** + * A special value to use in the path list to represent the path 'to' a root + * object (which doesn't really have any path). This prevents the need for + * special-casing detection of the root object and allows it to be treated + * like any other object. We might think of this as being similar to the + * 'unnamed root' domain ".", eg if I go to + * http://en.wikipedia.org./wiki/En/Main_page the dot after 'org' deliminates + * the unnamed root of the DNS. + * + * This is kept as an object to take advantage that in Javascript's OO objects + * are guaranteed to be distinct, therefore no other object can possibly clash + * with this one. Strings, numbers etc provide no such guarantee. + **/ + var ROOT_PATH = {}; - /* - We're now calling to the outside world where Lisp-style - lists will not be familiar. Convert to standard arrays. - Also, reverse the order because it is more common to - list paths "root to leaf" than "leaf to root" */ - var descent = reverseList(ascent); + /** + * Create a new set of handlers for clarinet's events, bound to the emit + * function given. + */ + function incrementalContentBuilder(oboeBus) { - emitMatch(node, + var emitNodeOpened = oboeBus(NODE_OPENED).emit, + emitNodeClosed = oboeBus(NODE_CLOSED).emit, + emitRootOpened = oboeBus(ROOT_PATH_FOUND).emit, + emitRootClosed = oboeBus(ROOT_NODE_FOUND).emit; - // To make a path, strip off the last item which is the special - // ROOT_PATH token for the 'path' to the root node - listAsArray(tail(map(keyOf, descent))), // path - listAsArray(map(nodeOf, descent)) // ancestors - ); - } + function arrayIndicesAreKeys(possiblyInconsistentAscent, newDeepestNode) { - /* - * Set up the catching of events such as NODE_CLOSED and NODE_OPENED and, if - * matching the specified pattern, propagate to pattern-match events such as - * oboeBus('node:!') - * - * - * - * @param {Function} predicateEvent - * either oboeBus(NODE_CLOSED) or oboeBus(NODE_OPENED). - * @param {Function} compiledJsonPath - */ - function addUnderlyingListener(fullEventName, predicateEvent, compiledJsonPath) { + /* for values in arrays we aren't pre-warned of the coming paths + (Clarinet gives no call to onkey like it does for values in objects) + so if we are in an array we need to create this path ourselves. The + key will be len(parentNode) because array keys are always sequential + numbers. */ - var emitMatch = oboeBus(fullEventName).emit; + var parentNode = nodeOf(head(possiblyInconsistentAscent)); - predicateEvent.on(function (ascent) { + return isOfType(Array, parentNode) ? keyFound(possiblyInconsistentAscent, len(parentNode), newDeepestNode) : + // nothing needed, return unchanged + possiblyInconsistentAscent; + } - var maybeMatchingMapping = compiledJsonPath(ascent); + function nodeOpened(ascent, newDeepestNode) { - /* Possible values for maybeMatchingMapping are now: - false: - we did not match - an object/array/string/number/null: - we matched and have the node that matched. - Because nulls are valid json values this can be null. - undefined: - we matched but don't have the matching node yet. - ie, we know there is an upcoming node that matches but we - can't say anything else about it. - */ - if (maybeMatchingMapping !== false) { + if (!ascent) { + // we discovered the root node, + emitRootOpened(newDeepestNode); - emitMatchingNode(emitMatch, nodeOf(maybeMatchingMapping), ascent); - } - }, fullEventName); + return keyFound(ascent, ROOT_PATH, newDeepestNode); + } - oboeBus('removeListener').on(function (removedEventName) { + // we discovered a non-root node - // if the fully qualified match event listener is later removed, clean up - // by removing the underlying listener if it was the last using that pattern: + var arrayConsistentAscent = arrayIndicesAreKeys(ascent, newDeepestNode), + ancestorBranches = tail(arrayConsistentAscent), + previouslyUnmappedName = keyOf(head(arrayConsistentAscent)); - if (removedEventName == fullEventName) { + appendBuiltContent(ancestorBranches, previouslyUnmappedName, newDeepestNode); - if (!oboeBus(removedEventName).listeners()) { - predicateEvent.un(fullEventName); - } - } - }); + return cons(namedNode(previouslyUnmappedName, newDeepestNode), ancestorBranches); } - oboeBus('newListener').on(function (fullEventName) { + /** + * Add a new value to the object we are building up to represent the + * parsed JSON + */ + function appendBuiltContent(ancestorBranches, key, node) { - var match = /(node|path):(.*)/.exec(fullEventName); + nodeOf(head(ancestorBranches))[key] = node; + } - if (match) { - var predicateEvent = predicateEventMap[match[1]]; + /** + * For when we find a new key in the json. + * + * @param {String|Number|Object} newDeepestName the key. If we are in an + * array will be a number, otherwise a string. May take the special + * value ROOT_PATH if the root node has just been found + * + * @param {String|Number|Object|Array|Null|undefined} [maybeNewDeepestNode] + * usually this won't be known so can be undefined. Can't use null + * to represent unknown because null is a valid value in JSON + **/ + function keyFound(ascent, newDeepestName, maybeNewDeepestNode) { - if (!predicateEvent.hasListener(fullEventName)) { + if (ascent) { + // if not root - addUnderlyingListener(fullEventName, predicateEvent, jsonPathCompiler(match[2])); - } + // If we have the key but (unless adding to an array) no known value + // yet. Put that key in the output but against no defined value: + appendBuiltContent(ascent, newDeepestName, maybeNewDeepestNode); } - }); - } - /** - * The instance API is the thing that is returned when oboe() is called. - * it allows: - * - * - listeners for various events to be added and removed - * - the http response header/headers to be read - */ - function instanceApi(oboeBus, contentSource) { + var ascentWithNewPath = cons(namedNode(newDeepestName, maybeNewDeepestNode), ascent); - var oboeApi, - fullyQualifiedNamePattern = /^(node|path):./, - rootNodeFinishedEvent = oboeBus(ROOT_NODE_FOUND), - emitNodeDrop = oboeBus(NODE_DROP).emit, - emitNodeSwap = oboeBus(NODE_SWAP).emit, + emitNodeOpened(ascentWithNewPath); + return ascentWithNewPath; + } /** - * Add any kind of listener that the instance api exposes + * For when the current node ends. */ - addListener = varArgs(function (eventId, parameters) { - - if (oboeApi[eventId]) { - - // for events added as .on(event, callback), if there is a - // .event() equivalent with special behaviour , pass through - // to that: - apply(parameters, oboeApi[eventId]); - } else { + function nodeClosed(ascent) { - // we have a standard Node.js EventEmitter 2-argument call. - // The first parameter is the listener. - var event = oboeBus(eventId), - listener = parameters[0]; + emitNodeClosed(ascent); - if (fullyQualifiedNamePattern.test(eventId)) { + return tail(ascent) || + // If there are no nodes left in the ascent the root node + // just closed. Emit a special event for this: + emitRootClosed(nodeOf(head(ascent))); + } - // allow fully-qualified node/path listeners - // to be added - addForgettableCallback(event, listener); - } else { + var contentBuilderHandlers = {}; + contentBuilderHandlers[SAX_VALUE_OPEN] = nodeOpened; + contentBuilderHandlers[SAX_VALUE_CLOSE] = nodeClosed; + contentBuilderHandlers[SAX_KEY] = keyFound; + return contentBuilderHandlers; + } - // the event has no special handling, pass through - // directly onto the event bus: - event.on(listener); - } - } + /** + * The jsonPath evaluator compiler used for Oboe.js. + * + * One function is exposed. This function takes a String JSONPath spec and + * returns a function to test candidate ascents for matches. + * + * String jsonPath -> (List ascent) -> Boolean|Object + * + * This file is coded in a pure functional style. That is, no function has + * side effects, every function evaluates to the same value for the same + * arguments and no variables are reassigned. + */ + // the call to jsonPathSyntax injects the token syntaxes that are needed + // inside the compiler + var jsonPathCompiler = jsonPathSyntax(function (pathNodeSyntax, doubleDotSyntax, dotSyntax, bangSyntax, emptySyntax) { - return oboeApi; // chaining - }), + var CAPTURING_INDEX = 1; + var NAME_INDEX = 2; + var FIELD_LIST_INDEX = 3; + var headKey = compose2(keyOf, head), + headNode = compose2(nodeOf, head); /** - * Remove any kind of listener that the instance api exposes + * Create an evaluator function for a named path node, expressed in the + * JSONPath like: + * foo + * ["bar"] + * [2] */ - removeListener = function removeListener(eventId, p2, p3) { + function nameClause(previousExpr, detection) { - if (eventId == 'done') { + var name = detection[NAME_INDEX], + matchesName = !name || name == '*' ? always : function (ascent) { + return headKey(ascent) == name; + }; - rootNodeFinishedEvent.un(p2); - } else if (eventId == 'node' || eventId == 'path') { + return lazyIntersection(matchesName, previousExpr); + } - // allow removal of node and path - oboeBus.un(eventId + ':' + p2, p3); - } else { + /** + * Create an evaluator function for a a duck-typed node, expressed like: + * + * {spin, taste, colour} + * .particle{spin, taste, colour} + * *{spin, taste, colour} + */ + function duckTypeClause(previousExpr, detection) { - // we have a standard Node.js EventEmitter 2-argument call. - // The second parameter is the listener. This may be a call - // to remove a fully-qualified node/path listener but requires - // no special handling - var listener = p2; + var fieldListStr = detection[FIELD_LIST_INDEX]; - oboeBus(eventId).un(listener); - } + if (!fieldListStr) return previousExpr; // don't wrap at all, return given expr as-is - return oboeApi; // chaining - }; + var hasAllrequiredFields = partialComplete(hasAllProperties, arrayAsList(fieldListStr.split(/\W+/))), + isMatch = compose2(hasAllrequiredFields, headNode); + + return lazyIntersection(isMatch, previousExpr); + } /** - * Add a callback, wrapped in a try/catch so as to not break the - * execution of Oboe if an exception is thrown (fail events are - * fired instead) - * - * The callback is used as the listener id so that it can later be - * removed using .un(callback) + * Expression for $, returns the evaluator function */ - function addProtectedCallback(eventName, callback) { - oboeBus(eventName).on(protectedCallback(callback), callback); - return oboeApi; // chaining + function capture(previousExpr, detection) { + + // extract meaning from the detection + var capturing = !!detection[CAPTURING_INDEX]; + + if (!capturing) return previousExpr; // don't wrap at all, return given expr as-is + + return lazyIntersection(previousExpr, head); } /** - * Add a callback where, if .forget() is called during the callback's - * execution, the callback will be de-registered + * Create an evaluator function that moves onto the next item on the + * lists. This function is the place where the logic to move up a + * level in the ascent exists. + * + * Eg, for JSONPath ".foo" we need skip1(nameClause(always, [,'foo'])) */ - function addForgettableCallback(event, callback, listenerId) { - - // listenerId is optional and if not given, the original - // callback will be used - listenerId = listenerId || callback; + function skip1(previousExpr) { - var safeCallback = protectedCallback(callback); + if (previousExpr == always) { + /* If there is no previous expression this consume command + is at the start of the jsonPath. + Since JSONPath specifies what we'd like to find but not + necessarily everything leading down to it, when running + out of JSONPath to check against we default to true */ + return always; + } - event.on(function () { + /** return true if the ascent we have contains only the JSON root, + * false otherwise + */ + function notAtRoot(ascent) { + return headKey(ascent) != ROOT_PATH; + } - var discard = false; + return lazyIntersection( + /* If we're already at the root but there are more + expressions to satisfy, can't consume any more. No match. + This check is why none of the other exprs have to be able + to handle empty lists; skip1 is the only evaluator that + moves onto the next token and it refuses to do so once it + reaches the last item in the list. */ + notAtRoot, - oboeApi.forget = function () { - discard = true; - }; + /* We are not at the root of the ascent yet. + Move to the next level of the ascent by handing only + the tail to the previous expression */ + compose2(previousExpr, tail)); + } - apply(arguments, safeCallback); + /** + * Create an evaluator function for the .. (double dot) token. Consumes + * zero or more levels of the ascent, the fewest that are required to find + * a match when given to previousExpr. + */ + function skipMany(previousExpr) { - delete oboeApi.forget; + if (previousExpr == always) { + /* If there is no previous expression this consume command + is at the start of the jsonPath. + Since JSONPath specifies what we'd like to find but not + necessarily everything leading down to it, when running + out of JSONPath to check against we default to true */ + return always; + } - if (discard) { - event.un(listenerId); - } - }, listenerId); + var + // In JSONPath .. is equivalent to !.. so if .. reaches the root + // the match has succeeded. Ie, we might write ..foo or !..foo + // and both should match identically. + terminalCaseWhenArrivingAtRoot = rootExpr(), + terminalCaseWhenPreviousExpressionIsSatisfied = previousExpr, + recursiveCase = skip1(function (ascent) { + return cases(ascent); + }), + cases = lazyUnion(terminalCaseWhenArrivingAtRoot, terminalCaseWhenPreviousExpressionIsSatisfied, recursiveCase); - return oboeApi; // chaining + return cases; } /** - * wrap a callback so that if it throws, Oboe.js doesn't crash but instead - * throw the error in another event loop + * Generate an evaluator for ! - matches only the root element of the json + * and ignores any previous expressions since nothing may precede !. */ - function protectedCallback(callback) { - return function () { - try { - return callback.apply(oboeApi, arguments); - } catch (e) { - setTimeout(function () { - throw e; - }); - } + function rootExpr() { + + return function (ascent) { + return headKey(ascent) == ROOT_PATH; }; } /** - * Return the fully qualified event for when a pattern matches - * either a node or a path - * - * @param type {String} either 'node' or 'path' + * Generate a statement wrapper to sit around the outermost + * clause evaluator. + * + * Handles the case where the capturing is implicit because the JSONPath + * did not contain a '$' by returning the last node. */ - function fullyQualifiedPatternMatchEvent(type, pattern) { - return oboeBus(type + ':' + pattern); - } + function statementExpr(lastClause) { - function wrapCallbackToSwapNodeIfSomethingReturned(callback) { - return function () { - var returnValueFromCallback = callback.apply(this, arguments); + return function (ascent) { - if (defined(returnValueFromCallback)) { + // kick off the evaluation by passing through to the last clause + var exprMatch = lastClause(ascent); - if (returnValueFromCallback == oboe.drop) { - emitNodeDrop(); - } else { - emitNodeSwap(returnValueFromCallback); - } - } + return exprMatch === true ? head(ascent) : exprMatch; }; } - function addSingleNodeOrPathListener(eventId, pattern, callback) { + /** + * For when a token has been found in the JSONPath input. + * Compiles the parser for that token and returns in combination with the + * parser already generated. + * + * @param {Function} exprs a list of the clause evaluator generators for + * the token that was found + * @param {Function} parserGeneratedSoFar the parser already found + * @param {Array} detection the match given by the regex engine when + * the feature was found + */ + function expressionsReader(exprs, parserGeneratedSoFar, detection) { - var effectiveCallback; + // if exprs is zero-length foldR will pass back the + // parserGeneratedSoFar as-is so we don't need to treat + // this as a special case - if (eventId == 'node') { - effectiveCallback = wrapCallbackToSwapNodeIfSomethingReturned(callback); - } else { - effectiveCallback = callback; - } + return foldR(function (parserGeneratedSoFar, expr) { - addForgettableCallback(fullyQualifiedPatternMatchEvent(eventId, pattern), effectiveCallback, callback); + return expr(parserGeneratedSoFar, detection); + }, parserGeneratedSoFar, exprs); } - /** - * Add several listeners at a time, from a map + /** + * If jsonPath matches the given detector function, creates a function which + * evaluates against every clause in the clauseEvaluatorGenerators. The + * created function is propagated to the onSuccess function, along with + * the remaining unparsed JSONPath substring. + * + * The intended use is to create a clauseMatcher by filling in + * the first two arguments, thus providing a function that knows + * some syntax to match and what kind of generator to create if it + * finds it. The parameter list once completed is: + * + * (jsonPath, parserGeneratedSoFar, onSuccess) + * + * onSuccess may be compileJsonPathToFunction, to recursively continue + * parsing after finding a match or returnFoundParser to stop here. */ - function addMultipleNodeOrPathListeners(eventId, listenerMap) { + function generateClauseReaderIfTokenFound(tokenDetector, clauseEvaluatorGenerators, jsonPath, parserGeneratedSoFar, onSuccess) { - for (var pattern in listenerMap) { - addSingleNodeOrPathListener(eventId, pattern, listenerMap[pattern]); + var detected = tokenDetector(jsonPath); + + if (detected) { + var compiledParser = expressionsReader(clauseEvaluatorGenerators, parserGeneratedSoFar, detected), + remainingUnparsedJsonPath = jsonPath.substr(len(detected[0])); + + return onSuccess(remainingUnparsedJsonPath, compiledParser); } } /** - * implementation behind .onPath() and .onNode() + * Partially completes generateClauseReaderIfTokenFound above. */ - function addNodeOrPathListenerApi(eventId, jsonPathOrListenerMap, callback) { - - if (isString(jsonPathOrListenerMap)) { - addSingleNodeOrPathListener(eventId, jsonPathOrListenerMap, callback); - } else { - addMultipleNodeOrPathListeners(eventId, jsonPathOrListenerMap); - } + function clauseMatcher(tokenDetector, exprs) { - return oboeApi; // chaining + return partialComplete(generateClauseReaderIfTokenFound, tokenDetector, exprs); } - // some interface methods are only filled in after we receive - // values and are noops before that: - oboeBus(ROOT_PATH_FOUND).on(function (rootNode) { - oboeApi.root = functor(rootNode); - }); - /** - * When content starts make the headers readable through the - * instance API + * clauseForJsonPath is a function which attempts to match against + * several clause matchers in order until one matches. If non match the + * jsonPath expression is invalid and an error is thrown. + * + * The parameter list is the same as a single clauseMatcher: + * + * (jsonPath, parserGeneratedSoFar, onSuccess) */ - oboeBus(HTTP_START).on(function (_statusCode, headers) { + var clauseForJsonPath = lazyUnion(clauseMatcher(pathNodeSyntax, list(capture, duckTypeClause, nameClause, skip1)), clauseMatcher(doubleDotSyntax, list(skipMany)) - oboeApi.header = function (name) { - return name ? headers[name] : headers; - }; + // dot is a separator only (like whitespace in other languages) but + // rather than make it a special case, use an empty list of + // expressions when this token is found + , clauseMatcher(dotSyntax, list()), clauseMatcher(bangSyntax, list(capture, rootExpr)), clauseMatcher(emptySyntax, list(statementExpr)), function (jsonPath) { + throw Error('"' + jsonPath + '" could not be tokenised'); }); /** - * Construct and return the public API of the Oboe instance to be - * returned to the calling application + * One of two possible values for the onSuccess argument of + * generateClauseReaderIfTokenFound. + * + * When this function is used, generateClauseReaderIfTokenFound simply + * returns the compiledParser that it made, regardless of if there is + * any remaining jsonPath to be compiled. */ - return oboeApi = { - on: addListener, - addListener: addListener, - removeListener: removeListener, - emit: oboeBus.emit, - - node: partialComplete(addNodeOrPathListenerApi, 'node'), - path: partialComplete(addNodeOrPathListenerApi, 'path'), + function returnFoundParser(_remainingJsonPath, compiledParser) { + return compiledParser; + } - done: partialComplete(addForgettableCallback, rootNodeFinishedEvent), - start: partialComplete(addProtectedCallback, HTTP_START), + /** + * Recursively compile a JSONPath expression. + * + * This function serves as one of two possible values for the onSuccess + * argument of generateClauseReaderIfTokenFound, meaning continue to + * recursively compile. Otherwise, returnFoundParser is given and + * compilation terminates. + */ + function compileJsonPathToFunction(uncompiledJsonPath, parserGeneratedSoFar) { - // fail doesn't use protectedCallback because - // could lead to non-terminating loops - fail: oboeBus(FAIL_EVENT).on, + /** + * On finding a match, if there is remaining text to be compiled + * we want to either continue parsing using a recursive call to + * compileJsonPathToFunction. Otherwise, we want to stop and return + * the parser that we have found so far. + */ + var onFind = uncompiledJsonPath ? compileJsonPathToFunction : returnFoundParser; - // public api calling abort fires the ABORTING event - abort: oboeBus(ABORTING).emit, + return clauseForJsonPath(uncompiledJsonPath, parserGeneratedSoFar, onFind); + } - // initially return nothing for header and root - header: noop, - root: noop, + /** + * This is the function that we expose to the rest of the library. + */ + return function (jsonPath) { - source: contentSource + try { + // Kick off the recursive parsing of the jsonPath + return compileJsonPathToFunction(jsonPath, always); + } catch (e) { + throw Error('Could not compile "' + jsonPath + '" because ' + e.message); + } }; - } - - /** - * This file sits just behind the API which is used to attain a new - * Oboe instance. It creates the new components that are required - * and introduces them to each other. - */ - - function wire(httpMethodName, contentSource, body, headers, withCredentials) { - - var oboeBus = pubSub(); + }); - // Wire the input stream in if we are given a content source. - // This will usually be the case. If not, the instance created - // will have to be passed content from an external source. + /** + * A pub/sub which is responsible for a single event type. A + * multi-event type event bus is created by pubSub by collecting + * several of these. + * + * @param {String} eventType + * the name of the events managed by this singleEventPubSub + * @param {singleEventPubSub} [newListener] + * place to notify of new listeners + * @param {singleEventPubSub} [removeListener] + * place to notify of when listeners are removed + */ + function singleEventPubSub(eventType, newListener, removeListener) { - if (contentSource) { + /** we are optimised for emitting events over firing them. + * As well as the tuple list which stores event ids and + * listeners there is a list with just the listeners which + * can be iterated more quickly when we are emitting + */ + var listenerTupleList, listenerList; - streamingHttp(oboeBus, httpTransport(), httpMethodName, contentSource, body, headers, withCredentials); + function hasId(id) { + return function (tuple) { + return tuple.id == id; + }; } - clarinet(oboeBus); + return { - ascentManager(oboeBus, incrementalContentBuilder(oboeBus)); + /** + * @param {Function} listener + * @param {*} listenerId + * an id that this listener can later by removed by. + * Can be of any type, to be compared to other ids using == + */ + on: function on(listener, listenerId) { - patternAdapter(oboeBus, jsonPathCompiler); + var tuple = { + listener: listener, + id: listenerId || listener // when no id is given use the + // listener function as the id + }; - return instanceApi(oboeBus, contentSource); - } + if (newListener) { + newListener.emit(eventType, listener, tuple.id); + } - function applyDefaults(passthrough, url, httpMethodName, body, headers, withCredentials, cached) { + listenerTupleList = cons(tuple, listenerTupleList); + listenerList = cons(listener, listenerList); - headers = headers ? - // Shallow-clone the headers array. This allows it to be - // modified without side effects to the caller. We don't - // want to change objects that the user passes in. - JSON.parse(JSON.stringify(headers)) : {}; + return this; // chaining + }, - if (body) { - if (!isString(body)) { + emit: function emit() { + applyEach(listenerList, arguments); + }, - // If the body is not a string, stringify it. This allows objects to - // be given which will be sent as JSON. - body = JSON.stringify(body); + un: function un(listenerId) { - // Default Content-Type to JSON unless given otherwise. - headers['Content-Type'] = headers['Content-Type'] || 'application/json'; - } - } else { - body = null; - } + var removed; - // support cache busting like jQuery.ajax({cache:false}) - function modifiedUrl(baseUrl, cached) { + listenerTupleList = without(listenerTupleList, hasId(listenerId), function (tuple) { + removed = tuple; + }); - if (cached === false) { + if (removed) { + listenerList = without(listenerList, function (listener) { + return listener == removed.listener; + }); - if (baseUrl.indexOf('?') == -1) { - baseUrl += '?'; - } else { - baseUrl += '&'; + if (removeListener) { + removeListener.emit(eventType, removed.listener, removed.id); + } } + }, - baseUrl += '_=' + new Date().getTime(); - } - return baseUrl; - } + listeners: function listeners() { + // differs from Node EventEmitter: returns list, not array + return listenerList; + }, - return passthrough(httpMethodName || 'GET', modifiedUrl(url, cached), body, headers, withCredentials || false); + hasListener: function hasListener(listenerId) { + var test = listenerId ? hasId(listenerId) : always; + + return defined(first(test, listenerTupleList)); + } + }; } + /** + * pubSub is a curried interface for listening to and emitting + * events. + * + * If we get a bus: + * + * var bus = pubSub(); + * + * We can listen to event 'foo' like: + * + * bus('foo').on(myCallback) + * + * And emit event foo like: + * + * bus('foo').emit() + * + * or, with a parameter: + * + * bus('foo').emit('bar') + * + * All functions can be cached and don't need to be + * bound. Ie: + * + * var fooEmitter = bus('foo').emit + * fooEmitter('bar'); // emit an event + * fooEmitter('baz'); // emit another + * + * There's also an uncurried[1] shortcut for .emit and .on: + * + * bus.on('foo', callback) + * bus.emit('foo', 'bar') + * + * [1]: http://zvon.org/other/haskell/Outputprelude/uncurry_f.html + */ + function pubSub() { - // export public API - function oboe(arg1) { + var singles = {}, + newListener = newSingle('newListener'), + removeListener = newSingle('removeListener'); - // We use duck-typing to detect if the parameter given is a stream, with the - // below list of parameters. - // Unpipe and unshift would normally be present on a stream but this breaks - // compatibility with Request streams. - // See https://github.com/jimhigson/oboe.js/issues/65 + function newSingle(eventName) { + return singles[eventName] = singleEventPubSub(eventName, newListener, removeListener); + } - var nodeStreamMethodNames = list('resume', 'pause', 'pipe'), - isStream = partialComplete(hasAllProperties, nodeStreamMethodNames); + /** pubSub instances are functions */ + function pubSubInstance(eventName) { - if (arg1) { - if (isStream(arg1) || isString(arg1)) { + return singles[eventName] || newSingle(eventName); + } - // simple version for GETs. Signature is: - // oboe( url ) - // or, under node: - // oboe( readableStream ) - return applyDefaults(wire, arg1 // url - ); - } else { + // add convenience EventEmitter-style uncurried form of 'emit' and 'on' + ['emit', 'on', 'un'].forEach(function (methodName) { - // method signature is: - // oboe({method:m, url:u, body:b, headers:{...}}) + pubSubInstance[methodName] = varArgs(function (eventName, parameters) { + apply(parameters, pubSubInstance(eventName)[methodName]); + }); + }); - return applyDefaults(wire, arg1.url, arg1.method, arg1.body, arg1.headers, arg1.withCredentials, arg1.cached); - } - } else { - // wire up a no-AJAX, no-stream Oboe. Will have to have content - // fed in externally and using .emit. - return wire(); - } + return pubSubInstance; } - /* oboe.drop is a special value. If a node callback returns this value the - parsed node is deleted from the JSON + /** + * This file declares some constants to use as names for event types. */ - oboe.drop = function () { - return oboe.drop; - }; - - if (typeof define === "function" && define.amd) { - define("oboe", [], function () { - return oboe; - }); - } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') { - module.exports = oboe; - } else { - window.oboe = oboe; - } - })(function () { - // Access to the window object throws an exception in HTML5 web workers so - // point it to "self" if it runs in a web worker - try { - return window; - } catch (e) { - return self; - } - }(), Object, Array, Error, JSON); - }, {}], 377: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 378: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** @file index.js - * @authors: - * Fabian Vogelsteller - * @date 2017 - */ - "use strict"; + var // the events which are never exported are kept as + // the smallest possible representation, in numbers: + _S = 1, - var _ = require('underscore'); - var errors = require('web3-core-helpers').errors; - var oboe = require('oboe'); - var IpcProvider = function IpcProvider(path, net) { - var _this = this; - this.responseCallbacks = {}; - this.notificationCallbacks = []; - this.path = path; + // fired whenever a new node starts in the JSON stream: + NODE_OPENED = _S++, - this.connection = net.connect({ path: this.path }); - this.addDefaultEvents(); + // fired whenever a node closes in the JSON stream: + NODE_CLOSED = _S++, - // LISTEN FOR CONNECTION RESPONSES - var callback = function callback(result) { - /*jshint maxcomplexity: 6 */ - var id = null; + // called if a .node callback returns a value - + NODE_SWAP = _S++, + NODE_DROP = _S++, + FAIL_EVENT = 'fail', + ROOT_NODE_FOUND = _S++, + ROOT_PATH_FOUND = _S++, + HTTP_START = 'start', + STREAM_DATA = 'data', + STREAM_END = 'end', + ABORTING = _S++, - // get the id which matches the returned id - if (_.isArray(result)) { - result.forEach(function (load) { - if (_this.responseCallbacks[load.id]) id = load.id; - }); - } else { - id = result.id; - } - // notification - if (!id && result.method.indexOf('_subscription') !== -1) { - _this.notificationCallbacks.forEach(function (callback) { - if (_.isFunction(callback)) callback(result); - }); + // SAX events butchered from Clarinet + SAX_KEY = _S++, + SAX_VALUE_OPEN = _S++, + SAX_VALUE_CLOSE = _S++; - // fire the callback - } else if (_this.responseCallbacks[id]) { - _this.responseCallbacks[id](null, result); - delete _this.responseCallbacks[id]; - } - }; + function errorReport(statusCode, body, error) { + try { + var jsonBody = JSON.parse(body); + } catch (e) {} - // use oboe.js for Sockets - if (net.constructor.name === 'Socket') { - oboe(this.connection).done(callback); - } else { - this.connection.on('data', function (data) { - _this._parseResponse(data.toString()).forEach(callback); - }); + return { + statusCode: statusCode, + body: body, + jsonBody: jsonBody, + thrown: error + }; } - }; - - /** - Will add the error and end event to timeout existing calls - - @method addDefaultEvents - */ - IpcProvider.prototype.addDefaultEvents = function () { - var _this = this; - this.connection.on('connect', function () {}); - - this.connection.on('error', function () { - _this._timeout(); - }); - - this.connection.on('end', function () { - _this._timeout(); - }); + /** + * The pattern adaptor listens for newListener and removeListener + * events. When patterns are added or removed it compiles the JSONPath + * and wires them up. + * + * When nodes and paths are found it emits the fully-qualified match + * events with parameters ready to ship to the outside world + */ - this.connection.on('timeout', function () { - _this._timeout(); - }); - }; + function patternAdapter(oboeBus, jsonPathCompiler) { - /** - Will parse the response and make an array out of it. - - NOTE, this exists for backwards compatibility reasons. - - @method _parseResponse - @param {String} data - */ - IpcProvider.prototype._parseResponse = function (data) { - var _this = this, - returnValues = []; + var predicateEventMap = { + node: oboeBus(NODE_CLOSED), + path: oboeBus(NODE_OPENED) + }; - // DE-CHUNKER - var dechunkedData = data.replace(/\}[\n\r]?\{/g, '}|--|{') // }{ - .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ - .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ - .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ - .split('|--|'); + function emitMatchingNode(emitMatch, node, ascent) { - dechunkedData.forEach(function (data) { + /* + We're now calling to the outside world where Lisp-style + lists will not be familiar. Convert to standard arrays. + Also, reverse the order because it is more common to + list paths "root to leaf" than "leaf to root" */ + var descent = reverseList(ascent); - // prepend the last chunk - if (_this.lastChunk) data = _this.lastChunk + data; + emitMatch(node, - var result = null; + // To make a path, strip off the last item which is the special + // ROOT_PATH token for the 'path' to the root node + listAsArray(tail(map(keyOf, descent))), // path + listAsArray(map(nodeOf, descent)) // ancestors + ); + } - try { - result = JSON.parse(data); - } catch (e) { + /* + * Set up the catching of events such as NODE_CLOSED and NODE_OPENED and, if + * matching the specified pattern, propagate to pattern-match events such as + * oboeBus('node:!') + * + * + * + * @param {Function} predicateEvent + * either oboeBus(NODE_CLOSED) or oboeBus(NODE_OPENED). + * @param {Function} compiledJsonPath + */ + function addUnderlyingListener(fullEventName, predicateEvent, compiledJsonPath) { - _this.lastChunk = data; + var emitMatch = oboeBus(fullEventName).emit; - // start timeout to cancel all requests - clearTimeout(_this.lastChunkTimeout); - _this.lastChunkTimeout = setTimeout(function () { - _this._timeout(); - throw errors.InvalidResponse(data); - }, 1000 * 15); + predicateEvent.on(function (ascent) { - return; - } + var maybeMatchingMapping = compiledJsonPath(ascent); - // cancel timeout and set chunk to null - clearTimeout(_this.lastChunkTimeout); - _this.lastChunk = null; + /* Possible values for maybeMatchingMapping are now: + false: + we did not match + an object/array/string/number/null: + we matched and have the node that matched. + Because nulls are valid json values this can be null. + undefined: + we matched but don't have the matching node yet. + ie, we know there is an upcoming node that matches but we + can't say anything else about it. + */ + if (maybeMatchingMapping !== false) { - if (result) returnValues.push(result); - }); + emitMatchingNode(emitMatch, nodeOf(maybeMatchingMapping), ascent); + } + }, fullEventName); - return returnValues; - }; + oboeBus('removeListener').on(function (removedEventName) { - /** - Get the adds a callback to the responseCallbacks object, - which will be called if a response matching the response Id will arrive. - - @method _addResponseCallback - */ - IpcProvider.prototype._addResponseCallback = function (payload, callback) { - var id = payload.id || payload[0].id; - var method = payload.method || payload[0].method; + // if the fully qualified match event listener is later removed, clean up + // by removing the underlying listener if it was the last using that pattern: - this.responseCallbacks[id] = callback; - this.responseCallbacks[id].method = method; - }; + if (removedEventName == fullEventName) { - /** - Timeout all requests when the end/error event is fired - - @method _timeout - */ - IpcProvider.prototype._timeout = function () { - for (var key in this.responseCallbacks) { - if (this.responseCallbacks.hasOwnProperty(key)) { - this.responseCallbacks[key](errors.InvalidConnection('on IPC')); - delete this.responseCallbacks[key]; + if (!oboeBus(removedEventName).listeners()) { + predicateEvent.un(fullEventName); + } + } + }); } - } - }; - - /** - Try to reconnect - - @method reconnect - */ - IpcProvider.prototype.reconnect = function () { - this.connection.connect({ path: this.path }); - }; - IpcProvider.prototype.send = function (payload, callback) { - // try reconnect, when connection is gone - if (!this.connection.writable) this.connection.connect({ path: this.path }); - - this.connection.write(JSON.stringify(payload)); - this._addResponseCallback(payload, callback); - }; + oboeBus('newListener').on(function (fullEventName) { - /** - Subscribes to provider events.provider - - @method on - @param {String} type 'notification', 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call - */ - IpcProvider.prototype.on = function (type, callback) { + var match = /(node|path):(.*)/.exec(fullEventName); - if (typeof callback !== 'function') throw new Error('The second parameter callback must be a function.'); + if (match) { + var predicateEvent = predicateEventMap[match[1]]; - switch (type) { - case 'data': - this.notificationCallbacks.push(callback); - break; + if (!predicateEvent.hasListener(fullEventName)) { - // adds error, end, timeout, connect - default: - this.connection.on(type, callback); - break; + addUnderlyingListener(fullEventName, predicateEvent, jsonPathCompiler(match[2])); + } + } + }); } - }; - /** - Subscribes to provider events.provider - - @method on - @param {String} type 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call - */ - IpcProvider.prototype.once = function (type, callback) { + /** + * The instance API is the thing that is returned when oboe() is called. + * it allows: + * + * - listeners for various events to be added and removed + * - the http response header/headers to be read + */ + function instanceApi(oboeBus, contentSource) { + + var oboeApi, + fullyQualifiedNamePattern = /^(node|path):./, + rootNodeFinishedEvent = oboeBus(ROOT_NODE_FOUND), + emitNodeDrop = oboeBus(NODE_DROP).emit, + emitNodeSwap = oboeBus(NODE_SWAP).emit, - if (typeof callback !== 'function') throw new Error('The second parameter callback must be a function.'); - this.connection.once(type, callback); - }; + /** + * Add any kind of listener that the instance api exposes + */ + addListener = varArgs(function (eventId, parameters) { - /** - Removes event listener - - @method removeListener - @param {String} type 'data', 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call - */ - IpcProvider.prototype.removeListener = function (type, callback) { - var _this = this; + if (oboeApi[eventId]) { - switch (type) { - case 'data': - this.notificationCallbacks.forEach(function (cb, index) { - if (cb === callback) _this.notificationCallbacks.splice(index, 1); - }); - break; + // for events added as .on(event, callback), if there is a + // .event() equivalent with special behaviour , pass through + // to that: + apply(parameters, oboeApi[eventId]); + } else { - default: - this.connection.removeListener(type, callback); - break; - } - }; + // we have a standard Node.js EventEmitter 2-argument call. + // The first parameter is the listener. + var event = oboeBus(eventId), + listener = parameters[0]; - /** - Removes all event listeners - - @method removeAllListeners - @param {String} type 'data', 'connect', 'error', 'end' or 'data' - */ - IpcProvider.prototype.removeAllListeners = function (type) { - switch (type) { - case 'data': - this.notificationCallbacks = []; - break; + if (fullyQualifiedNamePattern.test(eventId)) { - default: - this.connection.removeAllListeners(type); - break; - } - }; + // allow fully-qualified node/path listeners + // to be added + addForgettableCallback(event, listener); + } else { - /** - Resets the providers, clears all callbacks - - @method reset - */ - IpcProvider.prototype.reset = function () { - this._timeout(); - this.notificationCallbacks = []; + // the event has no special handling, pass through + // directly onto the event bus: + event.on(listener); + } + } - this.connection.removeAllListeners('error'); - this.connection.removeAllListeners('end'); - this.connection.removeAllListeners('timeout'); + return oboeApi; // chaining + }), - this.addDefaultEvents(); - }; - module.exports = IpcProvider; - }, { "oboe": 376, "underscore": 377, "web3-core-helpers": 191 }], 379: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 380: [function (require, module, exports) { - (function (Buffer) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** @file WebsocketProvider.js - * @authors: - * Fabian Vogelsteller - * @date 2017 - */ + /** + * Remove any kind of listener that the instance api exposes + */ + removeListener = function removeListener(eventId, p2, p3) { - "use strict"; + if (eventId == 'done') { - var _ = require('underscore'); - var errors = require('web3-core-helpers').errors; + rootNodeFinishedEvent.un(p2); + } else if (eventId == 'node' || eventId == 'path') { - var Ws = null; - var _btoa = null; - var parseURL = null; - if (typeof window !== 'undefined') { - Ws = window.WebSocket; - _btoa = btoa; - parseURL = function parseURL(url) { - return new URL(url); - }; - } else { - Ws = require('websocket').w3cwebsocket; - _btoa = function _btoa(str) { - return Buffer(str).toString('base64'); - }; - // Web3 supports Node.js 5, so we need to use the legacy URL API - parseURL = require('url').parse; - } - // Default connection ws://localhost:8546 + // allow removal of node and path + oboeBus.un(eventId + ':' + p2, p3); + } else { + // we have a standard Node.js EventEmitter 2-argument call. + // The second parameter is the listener. This may be a call + // to remove a fully-qualified node/path listener but requires + // no special handling + var listener = p2; - var WebsocketProvider = function WebsocketProvider(url, options) { - var _this = this; - this.responseCallbacks = {}; - this.notificationCallbacks = []; + oboeBus(eventId).un(listener); + } - options = options || {}; - this._customTimeout = options.timeout; + return oboeApi; // chaining + }; - // The w3cwebsocket implementation does not support Basic Auth - // username/password in the URL. So generate the basic auth header, and - // pass through with any additional headers supplied in constructor - var parsedURL = parseURL(url); - var headers = options.headers || {}; - if (parsedURL.username && parsedURL.password) { - headers.authorization = 'Basic ' + _btoa(parsedURL.username + ':' + parsedURL.password); + /** + * Add a callback, wrapped in a try/catch so as to not break the + * execution of Oboe if an exception is thrown (fail events are + * fired instead) + * + * The callback is used as the listener id so that it can later be + * removed using .un(callback) + */ + function addProtectedCallback(eventName, callback) { + oboeBus(eventName).on(protectedCallback(callback), callback); + return oboeApi; // chaining } - this.connection = new Ws(url, undefined, undefined, headers); + /** + * Add a callback where, if .forget() is called during the callback's + * execution, the callback will be de-registered + */ + function addForgettableCallback(event, callback, listenerId) { - this.addDefaultEvents(); + // listenerId is optional and if not given, the original + // callback will be used + listenerId = listenerId || callback; - // LISTEN FOR CONNECTION RESPONSES - this.connection.onmessage = function (e) { - /*jshint maxcomplexity: 6 */ - var data = typeof e.data === 'string' ? e.data : ''; + var safeCallback = protectedCallback(callback); - _this._parseResponse(data).forEach(function (result) { + event.on(function () { - var id = null; + var discard = false; - // get the id which matches the returned id - if (_.isArray(result)) { - result.forEach(function (load) { - if (_this.responseCallbacks[load.id]) id = load.id; - }); - } else { - id = result.id; - } + oboeApi.forget = function () { + discard = true; + }; - // notification - if (!id && result.method.indexOf('_subscription') !== -1) { - _this.notificationCallbacks.forEach(function (callback) { - if (_.isFunction(callback)) callback(result); - }); + apply(arguments, safeCallback); - // fire the callback - } else if (_this.responseCallbacks[id]) { - _this.responseCallbacks[id](null, result); - delete _this.responseCallbacks[id]; + delete oboeApi.forget; + + if (discard) { + event.un(listenerId); } - }); - }; - }; + }, listenerId); - /** - Will add the error and end event to timeout existing calls - - @method addDefaultEvents - */ - WebsocketProvider.prototype.addDefaultEvents = function () { - var _this = this; + return oboeApi; // chaining + } - this.connection.onerror = function () { - _this._timeout(); - }; + /** + * wrap a callback so that if it throws, Oboe.js doesn't crash but instead + * throw the error in another event loop + */ + function protectedCallback(callback) { + return function () { + try { + return callback.apply(oboeApi, arguments); + } catch (e) { + setTimeout(function () { + throw e; + }); + } + }; + } - this.connection.onclose = function () { - _this._timeout(); + /** + * Return the fully qualified event for when a pattern matches + * either a node or a path + * + * @param type {String} either 'node' or 'path' + */ + function fullyQualifiedPatternMatchEvent(type, pattern) { + return oboeBus(type + ':' + pattern); + } - // reset all requests and callbacks - _this.reset(); - }; + function wrapCallbackToSwapNodeIfSomethingReturned(callback) { + return function () { + var returnValueFromCallback = callback.apply(this, arguments); - // this.connection.on('timeout', function(){ - // _this._timeout(); - // }); - }; + if (defined(returnValueFromCallback)) { - /** - Will parse the response and make an array out of it. - - @method _parseResponse - @param {String} data - */ - WebsocketProvider.prototype._parseResponse = function (data) { - var _this = this, - returnValues = []; + if (returnValueFromCallback == oboe.drop) { + emitNodeDrop(); + } else { + emitNodeSwap(returnValueFromCallback); + } + } + }; + } - // DE-CHUNKER - var dechunkedData = data.replace(/\}[\n\r]?\{/g, '}|--|{') // }{ - .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ - .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ - .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ - .split('|--|'); + function addSingleNodeOrPathListener(eventId, pattern, callback) { - dechunkedData.forEach(function (data) { + var effectiveCallback; - // prepend the last chunk - if (_this.lastChunk) data = _this.lastChunk + data; + if (eventId == 'node') { + effectiveCallback = wrapCallbackToSwapNodeIfSomethingReturned(callback); + } else { + effectiveCallback = callback; + } - var result = null; + addForgettableCallback(fullyQualifiedPatternMatchEvent(eventId, pattern), effectiveCallback, callback); + } - try { - result = JSON.parse(data); - } catch (e) { + /** + * Add several listeners at a time, from a map + */ + function addMultipleNodeOrPathListeners(eventId, listenerMap) { - _this.lastChunk = data; + for (var pattern in listenerMap) { + addSingleNodeOrPathListener(eventId, pattern, listenerMap[pattern]); + } + } - // start timeout to cancel all requests - clearTimeout(_this.lastChunkTimeout); - _this.lastChunkTimeout = setTimeout(function () { - _this._timeout(); - throw errors.InvalidResponse(data); - }, 1000 * 15); + /** + * implementation behind .onPath() and .onNode() + */ + function addNodeOrPathListenerApi(eventId, jsonPathOrListenerMap, callback) { - return; + if (isString(jsonPathOrListenerMap)) { + addSingleNodeOrPathListener(eventId, jsonPathOrListenerMap, callback); + } else { + addMultipleNodeOrPathListeners(eventId, jsonPathOrListenerMap); } - // cancel timeout and set chunk to null - clearTimeout(_this.lastChunkTimeout); - _this.lastChunk = null; + return oboeApi; // chaining + } - if (result) returnValues.push(result); + // some interface methods are only filled in after we receive + // values and are noops before that: + oboeBus(ROOT_PATH_FOUND).on(function (rootNode) { + oboeApi.root = functor(rootNode); }); - return returnValues; - }; + /** + * When content starts make the headers readable through the + * instance API + */ + oboeBus(HTTP_START).on(function (_statusCode, headers) { - /** - Adds a callback to the responseCallbacks object, - which will be called if a response matching the response Id will arrive. - - @method _addResponseCallback - */ - WebsocketProvider.prototype._addResponseCallback = function (payload, callback) { - var id = payload.id || payload[0].id; - var method = payload.method || payload[0].method; + oboeApi.header = function (name) { + return name ? headers[name] : headers; + }; + }); - this.responseCallbacks[id] = callback; - this.responseCallbacks[id].method = method; + /** + * Construct and return the public API of the Oboe instance to be + * returned to the calling application + */ + return oboeApi = { + on: addListener, + addListener: addListener, + removeListener: removeListener, + emit: oboeBus.emit, - var _this = this; + node: partialComplete(addNodeOrPathListenerApi, 'node'), + path: partialComplete(addNodeOrPathListenerApi, 'path'), - // schedule triggering the error response if a custom timeout is set - if (this._customTimeout) { - setTimeout(function () { - if (_this.responseCallbacks[id]) { - _this.responseCallbacks[id](errors.ConnectionTimeout(_this._customTimeout)); - delete _this.responseCallbacks[id]; - } - }, this._customTimeout); - } - }; + done: partialComplete(addForgettableCallback, rootNodeFinishedEvent), + start: partialComplete(addProtectedCallback, HTTP_START), + + // fail doesn't use protectedCallback because + // could lead to non-terminating loops + fail: oboeBus(FAIL_EVENT).on, + + // public api calling abort fires the ABORTING event + abort: oboeBus(ABORTING).emit, + + // initially return nothing for header and root + header: noop, + root: noop, + + source: contentSource + }; + } /** - Timeout all requests when the end/error event is fired - - @method _timeout + * This file sits just behind the API which is used to attain a new + * Oboe instance. It creates the new components that are required + * and introduces them to each other. */ - WebsocketProvider.prototype._timeout = function () { - for (var key in this.responseCallbacks) { - if (this.responseCallbacks.hasOwnProperty(key)) { - this.responseCallbacks[key](errors.InvalidConnection('on WS')); - delete this.responseCallbacks[key]; - } - } - }; - WebsocketProvider.prototype.send = function (payload, callback) { - var _this = this; + function wire(httpMethodName, contentSource, body, headers, withCredentials) { - if (this.connection.readyState === this.connection.CONNECTING) { - setTimeout(function () { - _this.send(payload, callback); - }, 10); - return; - } + var oboeBus = pubSub(); - // try reconnect, when connection is gone - // if(!this.connection.writable) - // this.connection.connect({url: this.url}); - if (this.connection.readyState !== this.connection.OPEN) { - console.error('connection not open on send()'); - if (typeof this.connection.onerror === 'function') { - this.connection.onerror(new Error('connection not open')); - } else { - console.error('no error callback'); - } - callback(new Error('connection not open')); - return; + // Wire the input stream in if we are given a content source. + // This will usually be the case. If not, the instance created + // will have to be passed content from an external source. + + if (contentSource) { + + streamingHttp(oboeBus, httpTransport(), httpMethodName, contentSource, body, headers, withCredentials); } - this.connection.send(JSON.stringify(payload)); - this._addResponseCallback(payload, callback); - }; + clarinet(oboeBus); - /** - Subscribes to provider events.provider - - @method on - @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call - */ - WebsocketProvider.prototype.on = function (type, callback) { + ascentManager(oboeBus, incrementalContentBuilder(oboeBus)); - if (typeof callback !== 'function') throw new Error('The second parameter callback must be a function.'); + patternAdapter(oboeBus, jsonPathCompiler); - switch (type) { - case 'data': - this.notificationCallbacks.push(callback); - break; + return instanceApi(oboeBus, contentSource); + } - case 'connect': - this.connection.onopen = callback; - break; + function applyDefaults(passthrough, url, httpMethodName, body, headers, withCredentials, cached) { - case 'end': - this.connection.onclose = callback; - break; + headers = headers ? + // Shallow-clone the headers array. This allows it to be + // modified without side effects to the caller. We don't + // want to change objects that the user passes in. + JSON.parse(JSON.stringify(headers)) : {}; - case 'error': - this.connection.onerror = callback; - break; + if (body) { + if (!isString(body)) { - // default: - // this.connection.on(type, callback); - // break; - } - }; + // If the body is not a string, stringify it. This allows objects to + // be given which will be sent as JSON. + body = JSON.stringify(body); - // TODO add once + // Default Content-Type to JSON unless given otherwise. + headers['Content-Type'] = headers['Content-Type'] || 'application/json'; + } + } else { + body = null; + } - /** - Removes event listener - - @method removeListener - @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - @param {Function} callback the callback to call - */ - WebsocketProvider.prototype.removeListener = function (type, callback) { - var _this = this; + // support cache busting like jQuery.ajax({cache:false}) + function modifiedUrl(baseUrl, cached) { - switch (type) { - case 'data': - this.notificationCallbacks.forEach(function (cb, index) { - if (cb === callback) _this.notificationCallbacks.splice(index, 1); - }); - break; + if (cached === false) { - // TODO remvoving connect missing + if (baseUrl.indexOf('?') == -1) { + baseUrl += '?'; + } else { + baseUrl += '&'; + } - // default: - // this.connection.removeListener(type, callback); - // break; + baseUrl += '_=' + new Date().getTime(); + } + return baseUrl; } - }; - /** - Removes all event listeners - - @method removeAllListeners - @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' - */ - WebsocketProvider.prototype.removeAllListeners = function (type) { - switch (type) { - case 'data': - this.notificationCallbacks = []; - break; + return passthrough(httpMethodName || 'GET', modifiedUrl(url, cached), body, headers, withCredentials || false); + } - // TODO remvoving connect properly missing + // export public API + function oboe(arg1) { - case 'connect': - this.connection.onopen = null; - break; + // We use duck-typing to detect if the parameter given is a stream, with the + // below list of parameters. + // Unpipe and unshift would normally be present on a stream but this breaks + // compatibility with Request streams. + // See https://github.com/jimhigson/oboe.js/issues/65 - case 'end': - this.connection.onclose = null; - break; + var nodeStreamMethodNames = list('resume', 'pause', 'pipe'), + isStream = partialComplete(hasAllProperties, nodeStreamMethodNames); - case 'error': - this.connection.onerror = null; - break; + if (arg1) { + if (isStream(arg1) || isString(arg1)) { - default: - // this.connection.removeAllListeners(type); - break; - } - }; + // simple version for GETs. Signature is: + // oboe( url ) + // or, under node: + // oboe( readableStream ) + return applyDefaults(wire, arg1 // url + ); + } else { - /** - Resets the providers, clears all callbacks - - @method reset - */ - WebsocketProvider.prototype.reset = function () { - this._timeout(); - this.notificationCallbacks = []; + // method signature is: + // oboe({method:m, url:u, body:b, headers:{...}}) - // this.connection.removeAllListeners('error'); - // this.connection.removeAllListeners('end'); - // this.connection.removeAllListeners('timeout'); + return applyDefaults(wire, arg1.url, arg1.method, arg1.body, arg1.headers, arg1.withCredentials, arg1.cached); + } + } else { + // wire up a no-AJAX, no-stream Oboe. Will have to have content + // fed in externally and using .emit. + return wire(); + } + } - this.addDefaultEvents(); + /* oboe.drop is a special value. If a node callback returns this value the + parsed node is deleted from the JSON + */ + oboe.drop = function () { + return oboe.drop; }; - module.exports = WebsocketProvider; - }).call(this, require("buffer").Buffer); - }, { "buffer": 47, "underscore": 379, "url": 158, "web3-core-helpers": 191, "websocket": 45 }], 381: [function (require, module, exports) { + if (typeof define === "function" && define.amd) { + define("oboe", [], function () { + return oboe; + }); + } else if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) === 'object') { + module.exports = oboe; + } else { + window.oboe = oboe; + } + })(function () { + // Access to the window object throws an exception in HTML5 web workers so + // point it to "self" if it runs in a web worker + try { + return window; + } catch (e) { + return self; + } + }(), Object, Array, Error, JSON); + }, {}], 406: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 407: [function (require, module, exports) { /* This file is part of web3.js. @@ -41297,1691 +45441,1412 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol You should have received a copy of the GNU Lesser General Public License along with web3.js. If not, see . */ - /** - * @file index.js - * @author Fabian Vogelsteller + /** @file index.js + * @authors: + * Fabian Vogelsteller * @date 2017 */ "use strict"; - var core = require('web3-core'); - var Subscriptions = require('web3-core-subscriptions').subscriptions; - var Method = require('web3-core-method'); - // var formatters = require('web3-core-helpers').formatters; - var Net = require('web3-net'); + var _ = require('underscore'); + var errors = require('web3-core-helpers').errors; + var oboe = require('oboe'); - var Shh = function Shh() { + var IpcProvider = function IpcProvider(path, net) { var _this = this; + this.responseCallbacks = {}; + this.notificationCallbacks = []; + this.path = path; - // sets _requestmanager - core.packageInit(this, arguments); - - // overwrite setProvider - var setProvider = this.setProvider; - this.setProvider = function () { - setProvider.apply(_this, arguments); - _this.net.setProvider.apply(_this, arguments); - }; - - this.clearSubscriptions = _this._requestManager.clearSubscriptions; - - this.net = new Net(this.currentProvider); - - [new Subscriptions({ - name: 'subscribe', - type: 'shh', - subscriptions: { - 'messages': { - params: 1 - // inputFormatter: [formatters.inputPostFormatter], - // outputFormatter: formatters.outputPostFormatter - } - } - }), new Method({ - name: 'getVersion', - call: 'shh_version', - params: 0 - }), new Method({ - name: 'getInfo', - call: 'shh_info', - params: 0 - }), new Method({ - name: 'setMaxMessageSize', - call: 'shh_setMaxMessageSize', - params: 1 - }), new Method({ - name: 'setMinPoW', - call: 'shh_setMinPoW', - params: 1 - }), new Method({ - name: 'markTrustedPeer', - call: 'shh_markTrustedPeer', - params: 1 - }), new Method({ - name: 'newKeyPair', - call: 'shh_newKeyPair', - params: 0 - }), new Method({ - name: 'addPrivateKey', - call: 'shh_addPrivateKey', - params: 1 - }), new Method({ - name: 'deleteKeyPair', - call: 'shh_deleteKeyPair', - params: 1 - }), new Method({ - name: 'hasKeyPair', - call: 'shh_hasKeyPair', - params: 1 - }), new Method({ - name: 'getPublicKey', - call: 'shh_getPublicKey', - params: 1 - }), new Method({ - name: 'getPrivateKey', - call: 'shh_getPrivateKey', - params: 1 - }), new Method({ - name: 'newSymKey', - call: 'shh_newSymKey', - params: 0 - }), new Method({ - name: 'addSymKey', - call: 'shh_addSymKey', - params: 1 - }), new Method({ - name: 'generateSymKeyFromPassword', - call: 'shh_generateSymKeyFromPassword', - params: 1 - }), new Method({ - name: 'hasSymKey', - call: 'shh_hasSymKey', - params: 1 - }), new Method({ - name: 'getSymKey', - call: 'shh_getSymKey', - params: 1 - }), new Method({ - name: 'deleteSymKey', - call: 'shh_deleteSymKey', - params: 1 - }), new Method({ - name: 'newMessageFilter', - call: 'shh_newMessageFilter', - params: 1 - }), new Method({ - name: 'getFilterMessages', - call: 'shh_getFilterMessages', - params: 1 - }), new Method({ - name: 'deleteMessageFilter', - call: 'shh_deleteMessageFilter', - params: 1 - }), new Method({ - name: 'post', - call: 'shh_post', - params: 1, - inputFormatter: [null] - })].forEach(function (method) { - method.attachToObject(_this); - method.setRequestManager(_this._requestManager); - }); - }; - - core.addProviders(Shh); - - module.exports = Shh; - }, { "web3-core": 209, "web3-core-method": 193, "web3-core-subscriptions": 206, "web3-net": 373 }], 382: [function (require, module, exports) { - arguments[4][210][0].apply(exports, arguments); - }, { "dup": 210 }], 383: [function (require, module, exports) { - arguments[4][165][0].apply(exports, arguments); - }, { "dup": 165 }], 384: [function (require, module, exports) { - 'use strict'; - - var BN = require('bn.js'); - var numberToBN = require('number-to-bn'); - - var zero = new BN(0); - var negative1 = new BN(-1); - - // complete ethereum unit map - var unitMap = { - 'noether': '0', // eslint-disable-line - 'wei': '1', // eslint-disable-line - 'kwei': '1000', // eslint-disable-line - 'Kwei': '1000', // eslint-disable-line - 'babbage': '1000', // eslint-disable-line - 'femtoether': '1000', // eslint-disable-line - 'mwei': '1000000', // eslint-disable-line - 'Mwei': '1000000', // eslint-disable-line - 'lovelace': '1000000', // eslint-disable-line - 'picoether': '1000000', // eslint-disable-line - 'gwei': '1000000000', // eslint-disable-line - 'Gwei': '1000000000', // eslint-disable-line - 'shannon': '1000000000', // eslint-disable-line - 'nanoether': '1000000000', // eslint-disable-line - 'nano': '1000000000', // eslint-disable-line - 'szabo': '1000000000000', // eslint-disable-line - 'microether': '1000000000000', // eslint-disable-line - 'micro': '1000000000000', // eslint-disable-line - 'finney': '1000000000000000', // eslint-disable-line - 'milliether': '1000000000000000', // eslint-disable-line - 'milli': '1000000000000000', // eslint-disable-line - 'ether': '1000000000000000000', // eslint-disable-line - 'kether': '1000000000000000000000', // eslint-disable-line - 'grand': '1000000000000000000000', // eslint-disable-line - 'mether': '1000000000000000000000000', // eslint-disable-line - 'gether': '1000000000000000000000000000', // eslint-disable-line - 'tether': '1000000000000000000000000000000' }; + this.connection = net.connect({ path: this.path }); - /** - * Returns value of unit in Wei - * - * @method getValueOfUnit - * @param {String} unit the unit to convert to, default ether - * @returns {BigNumber} value of the unit (in Wei) - * @throws error if the unit is not correct:w - */ - function getValueOfUnit(unitInput) { - var unit = unitInput ? unitInput.toLowerCase() : 'ether'; - var unitValue = unitMap[unit]; // eslint-disable-line + this.addDefaultEvents(); - if (typeof unitValue !== 'string') { - throw new Error('[ethjs-unit] the unit provided ' + unitInput + ' doesn\'t exists, please use the one of the following units ' + JSON.stringify(unitMap, null, 2)); - } + // LISTEN FOR CONNECTION RESPONSES + var callback = function callback(result) { + /*jshint maxcomplexity: 6 */ - return new BN(unitValue, 10); - } + var id = null; - function numberToString(arg) { - if (typeof arg === 'string') { - if (!arg.match(/^-?[0-9.]+$/)) { - throw new Error('while converting number to string, invalid number value \'' + arg + '\', should be a number matching (^-?[0-9.]+).'); - } - return arg; - } else if (typeof arg === 'number') { - return String(arg); - } else if ((typeof arg === "undefined" ? "undefined" : _typeof(arg)) === 'object' && arg.toString && (arg.toTwos || arg.dividedToIntegerBy)) { - if (arg.toPrecision) { - return String(arg.toPrecision()); + // get the id which matches the returned id + if (_.isArray(result)) { + result.forEach(function (load) { + if (_this.responseCallbacks[load.id]) id = load.id; + }); } else { - // eslint-disable-line - return arg.toString(10); + id = result.id; } - } - throw new Error('while converting number to string, invalid number value \'' + arg + '\' type ' + (typeof arg === "undefined" ? "undefined" : _typeof(arg)) + '.'); - } - - function fromWei(weiInput, unit, optionsInput) { - var wei = numberToBN(weiInput); // eslint-disable-line - var negative = wei.lt(zero); // eslint-disable-line - var base = getValueOfUnit(unit); - var baseLength = unitMap[unit].length - 1 || 1; - var options = optionsInput || {}; - - if (negative) { - wei = wei.mul(negative1); - } - var fraction = wei.mod(base).toString(10); // eslint-disable-line + // notification + if (!id && result.method.indexOf('_subscription') !== -1) { + _this.notificationCallbacks.forEach(function (callback) { + if (_.isFunction(callback)) callback(result); + }); - while (fraction.length < baseLength) { - fraction = '0' + fraction; - } + // fire the callback + } else if (_this.responseCallbacks[id]) { + _this.responseCallbacks[id](null, result); + delete _this.responseCallbacks[id]; + } + }; - if (!options.pad) { - fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1]; + // use oboe.js for Sockets + if (net.constructor.name === 'Socket') { + oboe(this.connection).done(callback); + } else { + this.connection.on('data', function (data) { + _this._parseResponse(data.toString()).forEach(callback); + }); } + }; - var whole = wei.div(base).toString(10); // eslint-disable-line + /** + Will add the error and end event to timeout existing calls + + @method addDefaultEvents + */ + IpcProvider.prototype.addDefaultEvents = function () { + var _this = this; - if (options.commify) { - whole = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ','); - } + this.connection.on('connect', function () {}); - var value = '' + whole + (fraction == '0' ? '' : '.' + fraction); // eslint-disable-line + this.connection.on('error', function () { + _this._timeout(); + }); - if (negative) { - value = '-' + value; - } + this.connection.on('end', function () { + _this._timeout(); + }); - return value; - } + this.connection.on('timeout', function () { + _this._timeout(); + }); + }; - function toWei(etherInput, unit) { - var ether = numberToString(etherInput); // eslint-disable-line - var base = getValueOfUnit(unit); - var baseLength = unitMap[unit].length - 1 || 1; + /** + Will parse the response and make an array out of it. + + NOTE, this exists for backwards compatibility reasons. + + @method _parseResponse + @param {String} data + */ + IpcProvider.prototype._parseResponse = function (data) { + var _this = this, + returnValues = []; - // Is it negative? - var negative = ether.substring(0, 1) === '-'; // eslint-disable-line - if (negative) { - ether = ether.substring(1); - } + // DE-CHUNKER + var dechunkedData = data.replace(/\}[\n\r]?\{/g, '}|--|{') // }{ + .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ + .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ + .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ + .split('|--|'); - if (ether === '.') { - throw new Error('[ethjs-unit] while converting number ' + etherInput + ' to wei, invalid value'); - } + dechunkedData.forEach(function (data) { - // Split it into a whole and fractional part - var comps = ether.split('.'); // eslint-disable-line - if (comps.length > 2) { - throw new Error('[ethjs-unit] while converting number ' + etherInput + ' to wei, too many decimal points'); - } + // prepend the last chunk + if (_this.lastChunk) data = _this.lastChunk + data; - var whole = comps[0], - fraction = comps[1]; // eslint-disable-line + var result = null; - if (!whole) { - whole = '0'; - } - if (!fraction) { - fraction = '0'; - } - if (fraction.length > baseLength) { - throw new Error('[ethjs-unit] while converting number ' + etherInput + ' to wei, too many decimal places'); - } + try { + result = JSON.parse(data); + } catch (e) { - while (fraction.length < baseLength) { - fraction += '0'; - } + _this.lastChunk = data; - whole = new BN(whole); - fraction = new BN(fraction); - var wei = whole.mul(base).add(fraction); // eslint-disable-line + // start timeout to cancel all requests + clearTimeout(_this.lastChunkTimeout); + _this.lastChunkTimeout = setTimeout(function () { + _this._timeout(); + throw errors.InvalidResponse(data); + }, 1000 * 15); - if (negative) { - wei = wei.mul(negative1); - } + return; + } - return new BN(wei.toString(10), 10); - } + // cancel timeout and set chunk to null + clearTimeout(_this.lastChunkTimeout); + _this.lastChunk = null; - module.exports = { - unitMap: unitMap, - numberToString: numberToString, - getValueOfUnit: getValueOfUnit, - fromWei: fromWei, - toWei: toWei - }; - }, { "bn.js": 382, "number-to-bn": 386 }], 385: [function (require, module, exports) { - /** - * Returns a `Boolean` on whether or not the a `String` starts with '0x' - * @param {String} str the string input value - * @return {Boolean} a boolean if it is or is not hex prefixed - * @throws if the str input is not a string - */ - module.exports = function isHexPrefixed(str) { - if (typeof str !== 'string') { - throw new Error("[is-hex-prefixed] value must be type 'string', is currently type " + (typeof str === "undefined" ? "undefined" : _typeof(str)) + ", while checking isHexPrefixed."); - } + if (result) returnValues.push(result); + }); - return str.slice(0, 2) === '0x'; + return returnValues; }; - }, {}], 386: [function (require, module, exports) { - var BN = require('bn.js'); - var stripHexPrefix = require('strip-hex-prefix'); /** - * Returns a BN object, converts a number value to a BN - * @param {String|Number|Object} `arg` input a string number, hex string number, number, BigNumber or BN object - * @return {Object} `output` BN object of the number - * @throws if the argument is not an array, object that isn't a bignumber, not a string number or number - */ - module.exports = function numberToBN(arg) { - if (typeof arg === 'string' || typeof arg === 'number') { - var multiplier = new BN(1); // eslint-disable-line - var formattedString = String(arg).toLowerCase().trim(); - var isHexPrefixed = formattedString.substr(0, 2) === '0x' || formattedString.substr(0, 3) === '-0x'; - var stringArg = stripHexPrefix(formattedString); // eslint-disable-line - if (stringArg.substr(0, 1) === '-') { - stringArg = stripHexPrefix(stringArg.slice(1)); - multiplier = new BN(-1, 10); - } - stringArg = stringArg === '' ? '0' : stringArg; - - if (!stringArg.match(/^-?[0-9]+$/) && stringArg.match(/^[0-9A-Fa-f]+$/) || stringArg.match(/^[a-fA-F]+$/) || isHexPrefixed === true && stringArg.match(/^[0-9A-Fa-f]+$/)) { - return new BN(stringArg, 16).mul(multiplier); - } - - if ((stringArg.match(/^-?[0-9]+$/) || stringArg === '') && isHexPrefixed === false) { - return new BN(stringArg, 10).mul(multiplier); - } - } else if ((typeof arg === "undefined" ? "undefined" : _typeof(arg)) === 'object' && arg.toString && !arg.pop && !arg.push) { - if (arg.toString(10).match(/^-?[0-9]+$/) && (arg.mul || arg.dividedToIntegerBy)) { - return new BN(arg.toString(10), 10); - } - } + Get the adds a callback to the responseCallbacks object, + which will be called if a response matching the response Id will arrive. + + @method _addResponseCallback + */ + IpcProvider.prototype._addResponseCallback = function (payload, callback) { + var id = payload.id || payload[0].id; + var method = payload.method || payload[0].method; - throw new Error('[number-to-bn] while converting number ' + JSON.stringify(arg) + ' to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.'); + this.responseCallbacks[id] = callback; + this.responseCallbacks[id].method = method; }; - }, { "bn.js": 382, "strip-hex-prefix": 390 }], 387: [function (require, module, exports) { - module.exports = window.crypto; - }, {}], 388: [function (require, module, exports) { - module.exports = require('crypto'); - }, { "crypto": 387 }], 389: [function (require, module, exports) { - var randomHex = function randomHex(size, callback) { - var crypto = require('./crypto.js'); - var isCallback = typeof callback === 'function'; - if (size > 65536) { - if (isCallback) { - callback(new Error('Requested too many random bytes.')); - } else { - throw new Error('Requested too many random bytes.'); + /** + Timeout all requests when the end/error event is fired + + @method _timeout + */ + IpcProvider.prototype._timeout = function () { + for (var key in this.responseCallbacks) { + if (this.responseCallbacks.hasOwnProperty(key)) { + this.responseCallbacks[key](errors.InvalidConnection('on IPC')); + delete this.responseCallbacks[key]; } - }; - - // is node - if (typeof crypto !== 'undefined' && crypto.randomBytes) { + } + }; - if (isCallback) { - crypto.randomBytes(size, function (err, result) { - if (!err) { - callback(null, '0x' + result.toString('hex')); - } else { - callback(error); - } - }); - } else { - return '0x' + crypto.randomBytes(size).toString('hex'); - } + /** + Try to reconnect + + @method reconnect + */ + IpcProvider.prototype.reconnect = function () { + this.connection.connect({ path: this.path }); + }; - // is browser - } else { - var cryptoLib; + IpcProvider.prototype.send = function (payload, callback) { + // try reconnect, when connection is gone + if (!this.connection.writable) this.connection.connect({ path: this.path }); - if (typeof crypto !== 'undefined') { - cryptoLib = crypto; - } else if (typeof msCrypto !== 'undefined') { - cryptoLib = msCrypto; - } + this.connection.write(JSON.stringify(payload)); + this._addResponseCallback(payload, callback); + }; - if (cryptoLib && cryptoLib.getRandomValues) { - var randomBytes = cryptoLib.getRandomValues(new Uint8Array(size)); - var returnValue = '0x' + Array.from(randomBytes).map(function (arr) { - return arr.toString(16); - }).join(''); + /** + Subscribes to provider events.provider + + @method on + @param {String} type 'notification', 'connect', 'error', 'end' or 'data' + @param {Function} callback the callback to call + */ + IpcProvider.prototype.on = function (type, callback) { - if (isCallback) { - callback(null, returnValue); - } else { - return returnValue; - } + if (typeof callback !== 'function') throw new Error('The second parameter callback must be a function.'); - // not crypto object - } else { - var error = new Error('No "crypto" object available. This Browser doesn\'t support generating secure random bytes.'); + switch (type) { + case 'data': + this.notificationCallbacks.push(callback); + break; - if (isCallback) { - callback(error); - } else { - throw error; - } - } + // adds error, end, timeout, connect + default: + this.connection.on(type, callback); + break; } }; - module.exports = randomHex; - }, { "./crypto.js": 388 }], 390: [function (require, module, exports) { - var isHexPrefixed = require('is-hex-prefixed'); - /** - * Removes '0x' from a given `String` is present - * @param {String} str the string value - * @return {String|Optional} a string by pass if necessary + Subscribes to provider events.provider + + @method on + @param {String} type 'connect', 'error', 'end' or 'data' + @param {Function} callback the callback to call */ - module.exports = function stripHexPrefix(str) { - if (typeof str !== 'string') { - return str; - } + IpcProvider.prototype.once = function (type, callback) { - return isHexPrefixed(str) ? str.slice(2) : str; + if (typeof callback !== 'function') throw new Error('The second parameter callback must be a function.'); + + this.connection.once(type, callback); }; - }, { "is-hex-prefixed": 385 }], 391: [function (require, module, exports) { - arguments[4][178][0].apply(exports, arguments); - }, { "dup": 178 }], 392: [function (require, module, exports) { - (function (global) { - /*! https://mths.be/utf8js v2.0.0 by @mathias */ - ;(function (root) { - // Detect free variables `exports` - var freeExports = (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == 'object' && exports; + /** + Removes event listener + + @method removeListener + @param {String} type 'data', 'connect', 'error', 'end' or 'data' + @param {Function} callback the callback to call + */ + IpcProvider.prototype.removeListener = function (type, callback) { + var _this = this; - // Detect free variable `module` - var freeModule = (typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object' && module && module.exports == freeExports && module; + switch (type) { + case 'data': + this.notificationCallbacks.forEach(function (cb, index) { + if (cb === callback) _this.notificationCallbacks.splice(index, 1); + }); + break; - // Detect free variable `global`, from Node.js or Browserified code, - // and use it as `root` - var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof(global)) == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - root = freeGlobal; - } + default: + this.connection.removeListener(type, callback); + break; + } + }; - /*--------------------------------------------------------------------------*/ + /** + Removes all event listeners + + @method removeAllListeners + @param {String} type 'data', 'connect', 'error', 'end' or 'data' + */ + IpcProvider.prototype.removeAllListeners = function (type) { + switch (type) { + case 'data': + this.notificationCallbacks = []; + break; - var stringFromCharCode = String.fromCharCode; + default: + this.connection.removeAllListeners(type); + break; + } + }; - // Taken from https://mths.be/punycode - function ucs2decode(string) { - var output = []; - var counter = 0; - var length = string.length; - var value; - var 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; - } + /** + Resets the providers, clears all callbacks + + @method reset + */ + IpcProvider.prototype.reset = function () { + this._timeout(); + this.notificationCallbacks = []; - // Taken from https://mths.be/punycode - function ucs2encode(array) { - var length = array.length; - var index = -1; - var value; - var output = ''; - while (++index < length) { - value = array[index]; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - } - return output; - } + this.connection.removeAllListeners('error'); + this.connection.removeAllListeners('end'); + this.connection.removeAllListeners('timeout'); - function checkScalarValue(codePoint) { - if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { - throw Error('Lone surrogate U+' + codePoint.toString(16).toUpperCase() + ' is not a scalar value'); - } - } - /*--------------------------------------------------------------------------*/ + this.addDefaultEvents(); + }; - function createByte(codePoint, shift) { - return stringFromCharCode(codePoint >> shift & 0x3F | 0x80); - } + module.exports = IpcProvider; + }, { "oboe": 405, "underscore": 406, "web3-core-helpers": 199 }], 408: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 409: [function (require, module, exports) { + (function (Buffer) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ + /** @file WebsocketProvider.js + * @authors: + * Fabian Vogelsteller + * @date 2017 + */ - function encodeCodePoint(codePoint) { - if ((codePoint & 0xFFFFFF80) == 0) { - // 1-byte sequence - return stringFromCharCode(codePoint); - } - var symbol = ''; - if ((codePoint & 0xFFFFF800) == 0) { - // 2-byte sequence - symbol = stringFromCharCode(codePoint >> 6 & 0x1F | 0xC0); - } else if ((codePoint & 0xFFFF0000) == 0) { - // 3-byte sequence - checkScalarValue(codePoint); - symbol = stringFromCharCode(codePoint >> 12 & 0x0F | 0xE0); - symbol += createByte(codePoint, 6); - } else if ((codePoint & 0xFFE00000) == 0) { - // 4-byte sequence - symbol = stringFromCharCode(codePoint >> 18 & 0x07 | 0xF0); - symbol += createByte(codePoint, 12); - symbol += createByte(codePoint, 6); - } - symbol += stringFromCharCode(codePoint & 0x3F | 0x80); - return symbol; - } + "use strict"; - function utf8encode(string) { - var codePoints = ucs2decode(string); - var length = codePoints.length; - var index = -1; - var codePoint; - var byteString = ''; - while (++index < length) { - codePoint = codePoints[index]; - byteString += encodeCodePoint(codePoint); - } - return byteString; - } + var _ = require('underscore'); + var errors = require('web3-core-helpers').errors; - /*--------------------------------------------------------------------------*/ + var Ws = null; + var _btoa = null; + var parseURL = null; + if (typeof window !== 'undefined' && typeof window.WebSocket !== 'undefined') { + Ws = window.WebSocket; + _btoa = btoa; + parseURL = function parseURL(url) { + return new URL(url); + }; + } else { + Ws = require('websocket').w3cwebsocket; + _btoa = function _btoa(str) { + return Buffer(str).toString('base64'); + }; + var url = require('url'); + if (url.URL) { + // Use the new Node 6+ API for parsing URLs that supports username/password + var newURL = url.URL; + parseURL = function parseURL(url) { + return new newURL(url); + }; + } else { + // Web3 supports Node.js 5, so fall back to the legacy URL API if necessary + parseURL = require('url').parse; + } + } + // Default connection ws://localhost:8546 - function readContinuationByte() { - if (byteIndex >= byteCount) { - throw Error('Invalid byte index'); - } - var continuationByte = byteArray[byteIndex] & 0xFF; - byteIndex++; + var WebsocketProvider = function WebsocketProvider(url, options) { + var _this = this; + this.responseCallbacks = {}; + this.notificationCallbacks = []; - if ((continuationByte & 0xC0) == 0x80) { - return continuationByte & 0x3F; - } + options = options || {}; + this._customTimeout = options.timeout; - // If we end up here, it’s not a continuation byte - throw Error('Invalid continuation byte'); + // The w3cwebsocket implementation does not support Basic Auth + // username/password in the URL. So generate the basic auth header, and + // pass through with any additional headers supplied in constructor + var parsedURL = parseURL(url); + var headers = options.headers || {}; + var protocol = options.protocol || undefined; + if (parsedURL.username && parsedURL.password) { + headers.authorization = 'Basic ' + _btoa(parsedURL.username + ':' + parsedURL.password); } - function decodeSymbol() { - var byte1; - var byte2; - var byte3; - var byte4; - var codePoint; + this.connection = new Ws(url, protocol, undefined, headers); - if (byteIndex > byteCount) { - throw Error('Invalid byte index'); - } + this.addDefaultEvents(); - if (byteIndex == byteCount) { - return false; - } + // LISTEN FOR CONNECTION RESPONSES + this.connection.onmessage = function (e) { + /*jshint maxcomplexity: 6 */ + var data = typeof e.data === 'string' ? e.data : ''; - // Read first byte - byte1 = byteArray[byteIndex] & 0xFF; - byteIndex++; + _this._parseResponse(data).forEach(function (result) { - // 1-byte sequence (no continuation bytes) - if ((byte1 & 0x80) == 0) { - return byte1; - } + var id = null; - // 2-byte sequence - if ((byte1 & 0xE0) == 0xC0) { - var byte2 = readContinuationByte(); - codePoint = (byte1 & 0x1F) << 6 | byte2; - if (codePoint >= 0x80) { - return codePoint; + // get the id which matches the returned id + if (_.isArray(result)) { + result.forEach(function (load) { + if (_this.responseCallbacks[load.id]) id = load.id; + }); } else { - throw Error('Invalid continuation byte'); + id = result.id; } - } - // 3-byte sequence (may include unpaired surrogates) - if ((byte1 & 0xF0) == 0xE0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - codePoint = (byte1 & 0x0F) << 12 | byte2 << 6 | byte3; - if (codePoint >= 0x0800) { - checkScalarValue(codePoint); - return codePoint; - } else { - throw Error('Invalid continuation byte'); - } - } + // notification + if (!id && result.method.indexOf('_subscription') !== -1) { + _this.notificationCallbacks.forEach(function (callback) { + if (_.isFunction(callback)) callback(result); + }); - // 4-byte sequence - if ((byte1 & 0xF8) == 0xF0) { - byte2 = readContinuationByte(); - byte3 = readContinuationByte(); - byte4 = readContinuationByte(); - codePoint = (byte1 & 0x0F) << 0x12 | byte2 << 0x0C | byte3 << 0x06 | byte4; - if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { - return codePoint; + // fire the callback + } else if (_this.responseCallbacks[id]) { + _this.responseCallbacks[id](null, result); + delete _this.responseCallbacks[id]; } - } + }); + }; + }; - throw Error('Invalid UTF-8 detected'); - } + /** + Will add the error and end event to timeout existing calls + + @method addDefaultEvents + */ + WebsocketProvider.prototype.addDefaultEvents = function () { + var _this = this; - var byteArray; - var byteCount; - var byteIndex; - function utf8decode(byteString) { - byteArray = ucs2decode(byteString); - byteCount = byteArray.length; - byteIndex = 0; - var codePoints = []; - var tmp; - while ((tmp = decodeSymbol()) !== false) { - codePoints.push(tmp); - } - return ucs2encode(codePoints); - } + this.connection.onerror = function () { + _this._timeout(); + }; - /*--------------------------------------------------------------------------*/ + this.connection.onclose = function () { + _this._timeout(); - var utf8 = { - 'version': '2.0.0', - 'encode': utf8encode, - 'decode': utf8decode + // reset all requests and callbacks + _this.reset(); }; - // 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(function () { - return utf8; - }); - } else if (freeExports && !freeExports.nodeType) { - if (freeModule) { - // in Node.js or RingoJS v0.8.0+ - freeModule.exports = utf8; - } else { - // in Narwhal or RingoJS v0.7.0- - var object = {}; - var hasOwnProperty = object.hasOwnProperty; - for (var key in utf8) { - hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); - } - } - } else { - // in Rhino or a web browser - root.utf8 = utf8; - } - })(this); - }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); - }, {}], 393: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** - * @file utils.js - * @author Marek Kotewicz - * @author Fabian Vogelsteller - * @date 2017 - */ + // this.connection.on('timeout', function(){ + // _this._timeout(); + // }); + }; + + /** + Will parse the response and make an array out of it. + + @method _parseResponse + @param {String} data + */ + WebsocketProvider.prototype._parseResponse = function (data) { + var _this = this, + returnValues = []; - var _ = require('underscore'); - var ethjsUnit = require('ethjs-unit'); - var utils = require('./utils.js'); - var soliditySha3 = require('./soliditySha3.js'); - var randomHex = require('randomhex'); + // DE-CHUNKER + var dechunkedData = data.replace(/\}[\n\r]?\{/g, '}|--|{') // }{ + .replace(/\}\][\n\r]?\[\{/g, '}]|--|[{') // }][{ + .replace(/\}[\n\r]?\[\{/g, '}|--|[{') // }[{ + .replace(/\}\][\n\r]?\{/g, '}]|--|{') // }]{ + .split('|--|'); - /** - * Fires an error in an event emitter and callback and returns the eventemitter - * - * @method _fireError - * @param {Object} error a string, a error, or an object with {message, data} - * @param {Object} emitter - * @param {Function} reject - * @param {Function} callback - * @return {Object} the emitter - */ - var _fireError = function _fireError(error, emitter, reject, callback) { - /*jshint maxcomplexity: 10 */ + dechunkedData.forEach(function (data) { - // add data if given - if (_.isObject(error) && !(error instanceof Error) && error.data) { - if (_.isObject(error.data) || _.isArray(error.data)) { - error.data = JSON.stringify(error.data, null, 2); - } + // prepend the last chunk + if (_this.lastChunk) data = _this.lastChunk + data; - error = error.message + "\n" + error.data; - } + var result = null; - if (_.isString(error)) { - error = new Error(error); - } + try { + result = JSON.parse(data); + } catch (e) { - if (_.isFunction(callback)) { - callback(error); - } - if (_.isFunction(reject)) { - // suppress uncatched error if an error listener is present - // OR suppress uncatched error if an callback listener is present - if (emitter && _.isFunction(emitter.listeners) && emitter.listeners('error').length || _.isFunction(callback)) { - emitter.catch(function () {}); - } - // reject later, to be able to return emitter - setTimeout(function () { - reject(error); - }, 1); - } + _this.lastChunk = data; - if (emitter && _.isFunction(emitter.emit)) { - // emit later, to be able to return emitter - setTimeout(function () { - emitter.emit('error', error); - emitter.removeAllListeners(); - }, 1); - } + // start timeout to cancel all requests + clearTimeout(_this.lastChunkTimeout); + _this.lastChunkTimeout = setTimeout(function () { + _this._timeout(); + throw errors.InvalidResponse(data); + }, 1000 * 15); - return emitter; - }; + return; + } - /** - * Should be used to create full function/event name from json abi - * - * @method _jsonInterfaceMethodToString - * @param {Object} json - * @return {String} full function/event name - */ - var _jsonInterfaceMethodToString = function _jsonInterfaceMethodToString(json) { - if (_.isObject(json) && json.name && json.name.indexOf('(') !== -1) { - return json.name; - } + // cancel timeout and set chunk to null + clearTimeout(_this.lastChunkTimeout); + _this.lastChunk = null; - var typeName = json.inputs.map(function (i) { - return i.type; - }).join(','); - return json.name + '(' + typeName + ')'; - }; + if (result) returnValues.push(result); + }); - /** - * Should be called to get ascii from it's hex representation - * - * @method hexToAscii - * @param {String} hex - * @returns {String} ascii string representation of hex value - */ - var hexToAscii = function hexToAscii(hex) { - if (!utils.isHexStrict(hex)) throw new Error('The parameter must be a valid HEX string.'); + return returnValues; + }; - var str = ""; - var i = 0, - l = hex.length; - if (hex.substring(0, 2) === '0x') { - i = 2; - } - for (; i < l; i += 2) { - var code = parseInt(hex.substr(i, 2), 16); - str += String.fromCharCode(code); - } + /** + Adds a callback to the responseCallbacks object, + which will be called if a response matching the response Id will arrive. + + @method _addResponseCallback + */ + WebsocketProvider.prototype._addResponseCallback = function (payload, callback) { + var id = payload.id || payload[0].id; + var method = payload.method || payload[0].method; - return str; - }; + this.responseCallbacks[id] = callback; + this.responseCallbacks[id].method = method; - /** - * Should be called to get hex representation (prefixed by 0x) of ascii string - * - * @method asciiToHex - * @param {String} str - * @returns {String} hex representation of input string - */ - var asciiToHex = function asciiToHex(str) { - if (!str) return "0x00"; - var hex = ""; - for (var i = 0; i < str.length; i++) { - var code = str.charCodeAt(i); - var n = code.toString(16); - hex += n.length < 2 ? '0' + n : n; - } + var _this = this; - return "0x" + hex; - }; + // schedule triggering the error response if a custom timeout is set + if (this._customTimeout) { + setTimeout(function () { + if (_this.responseCallbacks[id]) { + _this.responseCallbacks[id](errors.ConnectionTimeout(_this._customTimeout)); + delete _this.responseCallbacks[id]; + } + }, this._customTimeout); + } + }; - /** - * Returns value of unit in Wei - * - * @method getUnitValue - * @param {String} unit the unit to convert to, default ether - * @returns {BN} value of the unit (in Wei) - * @throws error if the unit is not correct:w - */ - var getUnitValue = function getUnitValue(unit) { - unit = unit ? unit.toLowerCase() : 'ether'; - if (!ethjsUnit.unitMap[unit]) { - throw new Error('This unit "' + unit + '" doesn\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2)); - } - return unit; - }; + /** + Timeout all requests when the end/error event is fired + + @method _timeout + */ + WebsocketProvider.prototype._timeout = function () { + for (var key in this.responseCallbacks) { + if (this.responseCallbacks.hasOwnProperty(key)) { + this.responseCallbacks[key](errors.InvalidConnection('on WS')); + delete this.responseCallbacks[key]; + } + } + }; - /** - * Takes a number of wei and converts it to any other ether unit. - * - * Possible units are: - * SI Short SI Full Effigy Other - * - kwei femtoether babbage - * - mwei picoether lovelace - * - gwei nanoether shannon nano - * - -- microether szabo micro - * - -- milliether finney milli - * - ether -- -- - * - kether -- grand - * - mether - * - gether - * - tether - * - * @method fromWei - * @param {Number|String} number can be a number, number string or a HEX of a decimal - * @param {String} unit the unit to convert to, default ether - * @return {String|Object} When given a BN object it returns one as well, otherwise a number - */ - var fromWei = function fromWei(number, unit) { - unit = getUnitValue(unit); + WebsocketProvider.prototype.send = function (payload, callback) { + var _this = this; - if (!utils.isBN(number) && !_.isString(number)) { - throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); - } + if (this.connection.readyState === this.connection.CONNECTING) { + setTimeout(function () { + _this.send(payload, callback); + }, 10); + return; + } - return utils.isBN(number) ? ethjsUnit.fromWei(number, unit) : ethjsUnit.fromWei(number, unit).toString(10); - }; + // try reconnect, when connection is gone + // if(!this.connection.writable) + // this.connection.connect({url: this.url}); + if (this.connection.readyState !== this.connection.OPEN) { + console.error('connection not open on send()'); + if (typeof this.connection.onerror === 'function') { + this.connection.onerror(new Error('connection not open')); + } else { + console.error('no error callback'); + } + callback(new Error('connection not open')); + return; + } - /** - * Takes a number of a unit and converts it to wei. - * - * Possible units are: - * SI Short SI Full Effigy Other - * - kwei femtoether babbage - * - mwei picoether lovelace - * - gwei nanoether shannon nano - * - -- microether szabo micro - * - -- microether szabo micro - * - -- milliether finney milli - * - ether -- -- - * - kether -- grand - * - mether - * - gether - * - tether - * - * @method toWei - * @param {Number|String|BN} number can be a number, number string or a HEX of a decimal - * @param {String} unit the unit to convert from, default ether - * @return {String|Object} When given a BN object it returns one as well, otherwise a number - */ - var toWei = function toWei(number, unit) { - unit = getUnitValue(unit); + this.connection.send(JSON.stringify(payload)); + this._addResponseCallback(payload, callback); + }; - if (!utils.isBN(number) && !_.isString(number)) { - throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); - } + /** + Subscribes to provider events.provider + + @method on + @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + @param {Function} callback the callback to call + */ + WebsocketProvider.prototype.on = function (type, callback) { - return utils.isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10); - }; + if (typeof callback !== 'function') throw new Error('The second parameter callback must be a function.'); - /** - * Converts to a checksum address - * - * @method toChecksumAddress - * @param {String} address the given HEX address - * @return {String} - */ - var toChecksumAddress = function toChecksumAddress(address) { - if (typeof address === 'undefined') return ''; + switch (type) { + case 'data': + this.notificationCallbacks.push(callback); + break; - if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error('Given address "' + address + '" is not a valid Ethereum address.'); + case 'connect': + this.connection.onopen = callback; + break; - address = address.toLowerCase().replace(/^0x/i, ''); - var addressHash = utils.sha3(address).replace(/^0x/i, ''); - var checksumAddress = '0x'; + case 'end': + this.connection.onclose = callback; + break; - for (var i = 0; i < address.length; i++) { - // If ith character is 9 to f then make it uppercase - if (parseInt(addressHash[i], 16) > 7) { - checksumAddress += address[i].toUpperCase(); - } else { - checksumAddress += address[i]; + case 'error': + this.connection.onerror = callback; + break; + + // default: + // this.connection.on(type, callback); + // break; } - } - return checksumAddress; - }; + }; - module.exports = { - _fireError: _fireError, - _jsonInterfaceMethodToString: _jsonInterfaceMethodToString, - // extractDisplayName: extractDisplayName, - // extractTypeName: extractTypeName, - randomHex: randomHex, - _: _, - BN: utils.BN, - isBN: utils.isBN, - isBigNumber: utils.isBigNumber, - isHex: utils.isHex, - isHexStrict: utils.isHexStrict, - sha3: utils.sha3, - keccak256: utils.sha3, - soliditySha3: soliditySha3, - isAddress: utils.isAddress, - checkAddressChecksum: utils.checkAddressChecksum, - toChecksumAddress: toChecksumAddress, - toHex: utils.toHex, - toBN: utils.toBN, + // TODO add once - bytesToHex: utils.bytesToHex, - hexToBytes: utils.hexToBytes, + /** + Removes event listener + + @method removeListener + @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + @param {Function} callback the callback to call + */ + WebsocketProvider.prototype.removeListener = function (type, callback) { + var _this = this; - hexToNumberString: utils.hexToNumberString, + switch (type) { + case 'data': + this.notificationCallbacks.forEach(function (cb, index) { + if (cb === callback) _this.notificationCallbacks.splice(index, 1); + }); + break; - hexToNumber: utils.hexToNumber, - toDecimal: utils.hexToNumber, // alias + // TODO remvoving connect missing - numberToHex: utils.numberToHex, - fromDecimal: utils.numberToHex, // alias + // default: + // this.connection.removeListener(type, callback); + // break; + } + }; - hexToUtf8: utils.hexToUtf8, - hexToString: utils.hexToUtf8, - toUtf8: utils.hexToUtf8, + /** + Removes all event listeners + + @method removeAllListeners + @param {String} type 'notifcation', 'connect', 'error', 'end' or 'data' + */ + WebsocketProvider.prototype.removeAllListeners = function (type) { + switch (type) { + case 'data': + this.notificationCallbacks = []; + break; - utf8ToHex: utils.utf8ToHex, - stringToHex: utils.utf8ToHex, - fromUtf8: utils.utf8ToHex, + // TODO remvoving connect properly missing - hexToAscii: hexToAscii, - toAscii: hexToAscii, - asciiToHex: asciiToHex, - fromAscii: asciiToHex, + case 'connect': + this.connection.onopen = null; + break; - unitMap: ethjsUnit.unitMap, - toWei: toWei, - fromWei: fromWei, + case 'end': + this.connection.onclose = null; + break; - padLeft: utils.leftPad, - leftPad: utils.leftPad, - padRight: utils.rightPad, - rightPad: utils.rightPad, - toTwosComplement: utils.toTwosComplement - }; - }, { "./soliditySha3.js": 394, "./utils.js": 395, "ethjs-unit": 384, "randomhex": 389, "underscore": 391 }], 394: [function (require, module, exports) { + case 'error': + this.connection.onerror = null; + break; + + default: + // this.connection.removeAllListeners(type); + break; + } + }; + + /** + Resets the providers, clears all callbacks + + @method reset + */ + WebsocketProvider.prototype.reset = function () { + this._timeout(); + this.notificationCallbacks = []; + + // this.connection.removeAllListeners('error'); + // this.connection.removeAllListeners('end'); + // this.connection.removeAllListeners('timeout'); + + this.addDefaultEvents(); + }; + + module.exports = WebsocketProvider; + }).call(this, require("buffer").Buffer); + }, { "buffer": 47, "underscore": 408, "url": 166, "web3-core-helpers": 199, "websocket": 45 }], 410: [function (require, module, exports) { /* - This file is part of web3.js. + This file is part of web3.js. - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . + */ /** - * @file soliditySha3.js + * @file index.js * @author Fabian Vogelsteller * @date 2017 */ - var _ = require('underscore'); - var BN = require('bn.js'); - var utils = require('./utils.js'); - - var _elementaryName = function _elementaryName(name) { - /*jshint maxcomplexity:false */ - - if (name.startsWith('int[')) { - return 'int256' + name.slice(3); - } else if (name === 'int') { - return 'int256'; - } else if (name.startsWith('uint[')) { - return 'uint256' + name.slice(4); - } else if (name === 'uint') { - return 'uint256'; - } else if (name.startsWith('fixed[')) { - return 'fixed128x128' + name.slice(5); - } else if (name === 'fixed') { - return 'fixed128x128'; - } else if (name.startsWith('ufixed[')) { - return 'ufixed128x128' + name.slice(6); - } else if (name === 'ufixed') { - return 'ufixed128x128'; - } - return name; - }; - - // Parse N from type - var _parseTypeN = function _parseTypeN(type) { - var typesize = /^\D+(\d+).*$/.exec(type); - return typesize ? parseInt(typesize[1], 10) : null; - }; - - // Parse N from type[] - var _parseTypeNArray = function _parseTypeNArray(type) { - var arraySize = /^\D+\d*\[(\d+)\]$/.exec(type); - return arraySize ? parseInt(arraySize[1], 10) : null; - }; - - var _parseNumber = function _parseNumber(arg) { - var type = typeof arg === "undefined" ? "undefined" : _typeof(arg); - if (type === 'string') { - if (utils.isHexStrict(arg)) { - return new BN(arg.replace(/0x/i, ''), 16); - } else { - return new BN(arg, 10); - } - } else if (type === 'number') { - return new BN(arg); - } else if (utils.isBigNumber(arg)) { - return new BN(arg.toString(10)); - } else if (utils.isBN(arg)) { - return arg; - } else { - throw new Error(arg + ' is not a number'); - } - }; + "use strict"; - var _solidityPack = function _solidityPack(type, value, arraySize) { - /*jshint maxcomplexity:false */ + var core = require('web3-core'); + var Subscriptions = require('web3-core-subscriptions').subscriptions; + var Method = require('web3-core-method'); + // var formatters = require('web3-core-helpers').formatters; + var Net = require('web3-net'); - var size, num; - type = _elementaryName(type); + var Shh = function Shh() { + var _this = this; - if (type === 'bytes') { + // sets _requestmanager + core.packageInit(this, arguments); - if (value.replace(/^0x/i, '').length % 2 !== 0) { - throw new Error('Invalid bytes characters ' + value.length); - } + // overwrite setProvider + var setProvider = this.setProvider; + this.setProvider = function () { + setProvider.apply(_this, arguments); + _this.net.setProvider.apply(_this, arguments); + }; - return value; - } else if (type === 'string') { - return utils.utf8ToHex(value); - } else if (type === 'bool') { - return value ? '01' : '00'; - } else if (type.startsWith('address')) { - if (arraySize) { - size = 64; - } else { - size = 40; - } + this.clearSubscriptions = _this._requestManager.clearSubscriptions; - if (!utils.isAddress(value)) { - throw new Error(value + ' is not a valid address, or the checksum is invalid.'); + this.net = new Net(this.currentProvider); + + [new Subscriptions({ + name: 'subscribe', + type: 'shh', + subscriptions: { + 'messages': { + params: 1 + // inputFormatter: [formatters.inputPostFormatter], + // outputFormatter: formatters.outputPostFormatter + } } + }), new Method({ + name: 'getVersion', + call: 'shh_version', + params: 0 + }), new Method({ + name: 'getInfo', + call: 'shh_info', + params: 0 + }), new Method({ + name: 'setMaxMessageSize', + call: 'shh_setMaxMessageSize', + params: 1 + }), new Method({ + name: 'setMinPoW', + call: 'shh_setMinPoW', + params: 1 + }), new Method({ + name: 'markTrustedPeer', + call: 'shh_markTrustedPeer', + params: 1 + }), new Method({ + name: 'newKeyPair', + call: 'shh_newKeyPair', + params: 0 + }), new Method({ + name: 'addPrivateKey', + call: 'shh_addPrivateKey', + params: 1 + }), new Method({ + name: 'deleteKeyPair', + call: 'shh_deleteKeyPair', + params: 1 + }), new Method({ + name: 'hasKeyPair', + call: 'shh_hasKeyPair', + params: 1 + }), new Method({ + name: 'getPublicKey', + call: 'shh_getPublicKey', + params: 1 + }), new Method({ + name: 'getPrivateKey', + call: 'shh_getPrivateKey', + params: 1 + }), new Method({ + name: 'newSymKey', + call: 'shh_newSymKey', + params: 0 + }), new Method({ + name: 'addSymKey', + call: 'shh_addSymKey', + params: 1 + }), new Method({ + name: 'generateSymKeyFromPassword', + call: 'shh_generateSymKeyFromPassword', + params: 1 + }), new Method({ + name: 'hasSymKey', + call: 'shh_hasSymKey', + params: 1 + }), new Method({ + name: 'getSymKey', + call: 'shh_getSymKey', + params: 1 + }), new Method({ + name: 'deleteSymKey', + call: 'shh_deleteSymKey', + params: 1 + }), new Method({ + name: 'newMessageFilter', + call: 'shh_newMessageFilter', + params: 1 + }), new Method({ + name: 'getFilterMessages', + call: 'shh_getFilterMessages', + params: 1 + }), new Method({ + name: 'deleteMessageFilter', + call: 'shh_deleteMessageFilter', + params: 1 + }), new Method({ + name: 'post', + call: 'shh_post', + params: 1, + inputFormatter: [null] + })].forEach(function (method) { + method.attachToObject(_this); + method.setRequestManager(_this._requestManager); + }); + }; - return utils.leftPad(value.toLowerCase(), size); - } + core.addProviders(Shh); - size = _parseTypeN(type); + module.exports = Shh; + }, { "web3-core": 217, "web3-core-method": 201, "web3-core-subscriptions": 214, "web3-net": 396 }], 411: [function (require, module, exports) { + arguments[4][173][0].apply(exports, arguments); + }, { "dup": 173 }], 412: [function (require, module, exports) { + arguments[4][229][0].apply(exports, arguments); + }, { "bn.js": "BN", "dup": 229, "number-to-bn": 414 }], 413: [function (require, module, exports) { + arguments[4][231][0].apply(exports, arguments); + }, { "dup": 231 }], 414: [function (require, module, exports) { + arguments[4][234][0].apply(exports, arguments); + }, { "bn.js": "BN", "dup": 234, "strip-hex-prefix": 418 }], 415: [function (require, module, exports) { + arguments[4][235][0].apply(exports, arguments); + }, { "dup": 235 }], 416: [function (require, module, exports) { + arguments[4][236][0].apply(exports, arguments); + }, { "crypto": 415, "dup": 236 }], 417: [function (require, module, exports) { + arguments[4][237][0].apply(exports, arguments); + }, { "./crypto.js": 416, "dup": 237 }], 418: [function (require, module, exports) { + arguments[4][238][0].apply(exports, arguments); + }, { "dup": 238, "is-hex-prefixed": 413 }], 419: [function (require, module, exports) { + arguments[4][185][0].apply(exports, arguments); + }, { "dup": 185 }], 420: [function (require, module, exports) { + (function (global) { + /*! https://mths.be/utf8js v2.0.0 by @mathias */ + ;(function (root) { - if (type.startsWith('bytes')) { + // Detect free variables `exports` + var freeExports = (typeof exports === "undefined" ? "undefined" : _typeof(exports)) == 'object' && exports; - if (!size) { - throw new Error('bytes[] not yet supported in solidity'); - } + // Detect free variable `module` + var freeModule = (typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object' && module && module.exports == freeExports && module; - // must be 32 byte slices when in an array - if (arraySize) { - size = 32; + // Detect free variable `global`, from Node.js or Browserified code, + // and use it as `root` + var freeGlobal = (typeof global === "undefined" ? "undefined" : _typeof(global)) == 'object' && global; + if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { + root = freeGlobal; } - if (size < 1 || size > 32 || size < value.replace(/^0x/i, '').length / 2) { - throw new Error('Invalid bytes' + size + ' for ' + value); - } + /*--------------------------------------------------------------------------*/ - return utils.rightPad(value, size * 2); - } else if (type.startsWith('uint')) { + var stringFromCharCode = String.fromCharCode; - if (size % 8 || size < 8 || size > 256) { - throw new Error('Invalid uint' + size + ' size'); + // Taken from https://mths.be/punycode + function ucs2decode(string) { + var output = []; + var counter = 0; + var length = string.length; + var value; + var 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; } - num = _parseNumber(value); - if (num.bitLength() > size) { - throw new Error('Supplied uint exceeds width: ' + size + ' vs ' + num.bitLength()); + // Taken from https://mths.be/punycode + function ucs2encode(array) { + var length = array.length; + var index = -1; + var value; + var output = ''; + while (++index < length) { + value = array[index]; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + } + return output; } - if (num.lt(new BN(0))) { - throw new Error('Supplied uint ' + num.toString() + ' is negative'); + function checkScalarValue(codePoint) { + if (codePoint >= 0xD800 && codePoint <= 0xDFFF) { + throw Error('Lone surrogate U+' + codePoint.toString(16).toUpperCase() + ' is not a scalar value'); + } } + /*--------------------------------------------------------------------------*/ - return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; - } else if (type.startsWith('int')) { - - if (size % 8 || size < 8 || size > 256) { - throw new Error('Invalid int' + size + ' size'); + function createByte(codePoint, shift) { + return stringFromCharCode(codePoint >> shift & 0x3F | 0x80); } - num = _parseNumber(value); - if (num.bitLength() > size) { - throw new Error('Supplied int exceeds width: ' + size + ' vs ' + num.bitLength()); + function encodeCodePoint(codePoint) { + if ((codePoint & 0xFFFFFF80) == 0) { + // 1-byte sequence + return stringFromCharCode(codePoint); + } + var symbol = ''; + if ((codePoint & 0xFFFFF800) == 0) { + // 2-byte sequence + symbol = stringFromCharCode(codePoint >> 6 & 0x1F | 0xC0); + } else if ((codePoint & 0xFFFF0000) == 0) { + // 3-byte sequence + checkScalarValue(codePoint); + symbol = stringFromCharCode(codePoint >> 12 & 0x0F | 0xE0); + symbol += createByte(codePoint, 6); + } else if ((codePoint & 0xFFE00000) == 0) { + // 4-byte sequence + symbol = stringFromCharCode(codePoint >> 18 & 0x07 | 0xF0); + symbol += createByte(codePoint, 12); + symbol += createByte(codePoint, 6); + } + symbol += stringFromCharCode(codePoint & 0x3F | 0x80); + return symbol; } - if (num.lt(new BN(0))) { - return num.toTwos(size).toString('hex'); - } else { - return size ? utils.leftPad(num.toString('hex'), size / 8 * 2) : num; + function utf8encode(string) { + var codePoints = ucs2decode(string); + var length = codePoints.length; + var index = -1; + var codePoint; + var byteString = ''; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint); + } + return byteString; } - } else { - // FIXME: support all other types - throw new Error('Unsupported or invalid type: ' + type); - } - }; - - var _processSoliditySha3Args = function _processSoliditySha3Args(arg) { - /*jshint maxcomplexity:false */ - - if (_.isArray(arg)) { - throw new Error('Autodetection of array types is not supported.'); - } - var type, - value = ''; - var hexArg, arraySize; + /*--------------------------------------------------------------------------*/ - // if type is given - if (_.isObject(arg) && (arg.hasOwnProperty('v') || arg.hasOwnProperty('t') || arg.hasOwnProperty('value') || arg.hasOwnProperty('type'))) { - type = arg.hasOwnProperty('t') ? arg.t : arg.type; - value = arg.hasOwnProperty('v') ? arg.v : arg.value; + function readContinuationByte() { + if (byteIndex >= byteCount) { + throw Error('Invalid byte index'); + } - // otherwise try to guess the type - } else { + var continuationByte = byteArray[byteIndex] & 0xFF; + byteIndex++; - type = utils.toHex(arg, true); - value = utils.toHex(arg); + if ((continuationByte & 0xC0) == 0x80) { + return continuationByte & 0x3F; + } - if (!type.startsWith('int') && !type.startsWith('uint')) { - type = 'bytes'; + // If we end up here, it’s not a continuation byte + throw Error('Invalid continuation byte'); } - } - - if ((type.startsWith('int') || type.startsWith('uint')) && typeof value === 'string' && !/^(-)?0x/i.test(value)) { - value = new BN(value); - } - // get the array size - if (_.isArray(value)) { - arraySize = _parseTypeNArray(type); - if (arraySize && value.length !== arraySize) { - throw new Error(type + ' is not matching the given array ' + JSON.stringify(value)); - } else { - arraySize = value.length; - } - } + function decodeSymbol() { + var byte1; + var byte2; + var byte3; + var byte4; + var codePoint; - if (_.isArray(value)) { - hexArg = value.map(function (val) { - return _solidityPack(type, val, arraySize).toString('hex').replace('0x', ''); - }); - return hexArg.join(''); - } else { - hexArg = _solidityPack(type, value, arraySize); - return hexArg.toString('hex').replace('0x', ''); - } - }; + if (byteIndex > byteCount) { + throw Error('Invalid byte index'); + } - /** - * Hashes solidity values to a sha3 hash using keccak 256 - * - * @method soliditySha3 - * @return {Object} the sha3 - */ - var soliditySha3 = function soliditySha3() { - /*jshint maxcomplexity:false */ + if (byteIndex == byteCount) { + return false; + } - var args = Array.prototype.slice.call(arguments); + // Read first byte + byte1 = byteArray[byteIndex] & 0xFF; + byteIndex++; - var hexArgs = _.map(args, _processSoliditySha3Args); + // 1-byte sequence (no continuation bytes) + if ((byte1 & 0x80) == 0) { + return byte1; + } - // console.log(args, hexArgs); - // console.log('0x'+ hexArgs.join('')); + // 2-byte sequence + if ((byte1 & 0xE0) == 0xC0) { + var byte2 = readContinuationByte(); + codePoint = (byte1 & 0x1F) << 6 | byte2; + if (codePoint >= 0x80) { + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } - return utils.sha3('0x' + hexArgs.join('')); - }; + // 3-byte sequence (may include unpaired surrogates) + if ((byte1 & 0xF0) == 0xE0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + codePoint = (byte1 & 0x0F) << 12 | byte2 << 6 | byte3; + if (codePoint >= 0x0800) { + checkScalarValue(codePoint); + return codePoint; + } else { + throw Error('Invalid continuation byte'); + } + } - module.exports = soliditySha3; - }, { "./utils.js": 395, "bn.js": 382, "underscore": 391 }], 395: [function (require, module, exports) { - /* - This file is part of web3.js. - - web3.js is free software: you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - web3.js is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with web3.js. If not, see . - */ - /** - * @file utils.js - * @author Fabian Vogelsteller - * @date 2017 - */ + // 4-byte sequence + if ((byte1 & 0xF8) == 0xF0) { + byte2 = readContinuationByte(); + byte3 = readContinuationByte(); + byte4 = readContinuationByte(); + codePoint = (byte1 & 0x0F) << 0x12 | byte2 << 0x0C | byte3 << 0x06 | byte4; + if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) { + return codePoint; + } + } - var _ = require('underscore'); - var BN = require('bn.js'); - var numberToBN = require('number-to-bn'); - var utf8 = require('utf8'); - var Hash = require("eth-lib/lib/hash"); + throw Error('Invalid UTF-8 detected'); + } - /** - * Returns true if object is BN, otherwise false - * - * @method isBN - * @param {Object} object - * @return {Boolean} - */ - var isBN = function isBN(object) { - return object instanceof BN || object && object.constructor && object.constructor.name === 'BN'; - }; + var byteArray; + var byteCount; + var byteIndex; + function utf8decode(byteString) { + byteArray = ucs2decode(byteString); + byteCount = byteArray.length; + byteIndex = 0; + var codePoints = []; + var tmp; + while ((tmp = decodeSymbol()) !== false) { + codePoints.push(tmp); + } + return ucs2encode(codePoints); + } - /** - * Returns true if object is BigNumber, otherwise false - * - * @method isBigNumber - * @param {Object} object - * @return {Boolean} - */ - var isBigNumber = function isBigNumber(object) { - return object && object.constructor && object.constructor.name === 'BigNumber'; - }; + /*--------------------------------------------------------------------------*/ - /** - * Takes an input and transforms it into an BN - * - * @method toBN - * @param {Number|String|BN} number, string, HEX string or BN - * @return {BN} BN - */ - var toBN = function toBN(number) { - try { - return numberToBN.apply(null, arguments); - } catch (e) { - throw new Error(e + ' Given value: "' + number + '"'); - } - }; + var utf8 = { + 'version': '2.0.0', + 'encode': utf8encode, + 'decode': utf8decode + }; - /** - * Takes and input transforms it into BN and if it is negative value, into two's complement - * - * @method toTwosComplement - * @param {Number|String|BN} number - * @return {String} + // 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(function () { + return utf8; + }); + } else if (freeExports && !freeExports.nodeType) { + if (freeModule) { + // in Node.js or RingoJS v0.8.0+ + freeModule.exports = utf8; + } else { + // in Narwhal or RingoJS v0.7.0- + var object = {}; + var hasOwnProperty = object.hasOwnProperty; + for (var key in utf8) { + hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]); + } + } + } else { + // in Rhino or a web browser + root.utf8 = utf8; + } + })(this); + }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}); + }, {}], 421: [function (require, module, exports) { + /* + This file is part of web3.js. + + web3.js is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + web3.js is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with web3.js. If not, see . */ - var toTwosComplement = function toTwosComplement(number) { - return '0x' + toBN(number).toTwos(256).toString(16, 64); - }; - /** - * Checks if the given string is an address - * - * @method isAddress - * @param {String} address the given HEX address - * @return {Boolean} + * @file utils.js + * @author Marek Kotewicz + * @author Fabian Vogelsteller + * @date 2017 */ - var isAddress = function isAddress(address) { - // check if it has the basic requirements of an address - if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { - return false; - // If it's ALL lowercase or ALL upppercase - } else if (/^(0x|0X)?[0-9a-f]{40}$/.test(address) || /^(0x|0X)?[0-9A-F]{40}$/.test(address)) { - return true; - // Otherwise check each case - } else { - return checkAddressChecksum(address); - } - }; + + var _ = require('underscore'); + var ethjsUnit = require('ethjs-unit'); + var utils = require('./utils.js'); + var soliditySha3 = require('./soliditySha3.js'); + var randomHex = require('randomhex'); /** - * Checks if the given string is a checksummed address + * Fires an error in an event emitter and callback and returns the eventemitter * - * @method checkAddressChecksum - * @param {String} address the given HEX address - * @return {Boolean} + * @method _fireError + * @param {Object} error a string, a error, or an object with {message, data} + * @param {Object} emitter + * @param {Function} reject + * @param {Function} callback + * @return {Object} the emitter */ - var checkAddressChecksum = function checkAddressChecksum(address) { - // Check each case - address = address.replace(/^0x/i, ''); - var addressHash = sha3(address.toLowerCase()).replace(/^0x/i, ''); + var _fireError = function _fireError(error, emitter, reject, callback) { + /*jshint maxcomplexity: 10 */ - for (var i = 0; i < 40; i++) { - // the nth letter should be uppercase if the nth digit of casemap is 1 - if (parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i] || parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i]) { - return false; + // add data if given + if (_.isObject(error) && !(error instanceof Error) && error.data) { + if (_.isObject(error.data) || _.isArray(error.data)) { + error.data = JSON.stringify(error.data, null, 2); } + + error = error.message + "\n" + error.data; } - return true; - }; - /** - * Should be called to pad string to expected length - * - * @method leftPad - * @param {String} string to be padded - * @param {Number} chars that result string should have - * @param {String} sign, by default 0 - * @returns {String} right aligned string - */ - var leftPad = function leftPad(string, chars, sign) { - var hasPrefix = /^0x/i.test(string) || typeof string === 'number'; - string = string.toString(16).replace(/^0x/i, ''); + if (_.isString(error)) { + error = new Error(error); + } - var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0; + if (_.isFunction(callback)) { + callback(error); + } + if (_.isFunction(reject)) { + // suppress uncatched error if an error listener is present + // OR suppress uncatched error if an callback listener is present + if (emitter && _.isFunction(emitter.listeners) && emitter.listeners('error').length || _.isFunction(callback)) { + emitter.catch(function () {}); + } + // reject later, to be able to return emitter + setTimeout(function () { + reject(error); + }, 1); + } - return (hasPrefix ? '0x' : '') + new Array(padding).join(sign ? sign : "0") + string; + if (emitter && _.isFunction(emitter.emit)) { + // emit later, to be able to return emitter + setTimeout(function () { + emitter.emit('error', error); + emitter.removeAllListeners(); + }, 1); + } + + return emitter; }; /** - * Should be called to pad string to expected length + * Should be used to create full function/event name from json abi * - * @method rightPad - * @param {String} string to be padded - * @param {Number} chars that result string should have - * @param {String} sign, by default 0 - * @returns {String} right aligned string + * @method _jsonInterfaceMethodToString + * @param {Object} json + * @return {String} full function/event name */ - var rightPad = function rightPad(string, chars, sign) { - var hasPrefix = /^0x/i.test(string) || typeof string === 'number'; - string = string.toString(16).replace(/^0x/i, ''); - - var padding = chars - string.length + 1 >= 0 ? chars - string.length + 1 : 0; + var _jsonInterfaceMethodToString = function _jsonInterfaceMethodToString(json) { + if (_.isObject(json) && json.name && json.name.indexOf('(') !== -1) { + return json.name; + } - return (hasPrefix ? '0x' : '') + string + new Array(padding).join(sign ? sign : "0"); + return json.name + '(' + _flattenTypes(false, json.inputs).join(',') + ')'; }; /** - * Should be called to get hex representation (prefixed by 0x) of utf8 string + * Should be used to flatten json abi inputs/outputs into an array of type-representing-strings * - * @method utf8ToHex - * @param {String} str - * @returns {String} hex representation of input string + * @method _flattenTypes + * @param {bool} includeTuple + * @param {Object} puts + * @return {Array} parameters as strings */ - var utf8ToHex = function utf8ToHex(str) { - str = utf8.encode(str); - var hex = ""; - - // remove \u0000 padding from either side - str = str.replace(/^(?:\u0000)*/, ''); - str = str.split("").reverse().join(""); - str = str.replace(/^(?:\u0000)*/, ''); - str = str.split("").reverse().join(""); - - for (var i = 0; i < str.length; i++) { - var code = str.charCodeAt(i); - // if (code !== 0) { - var n = code.toString(16); - hex += n.length < 2 ? '0' + n : n; - // } - } + var _flattenTypes = function _flattenTypes(includeTuple, puts) { + // console.log("entered _flattenTypes. inputs/outputs: " + puts) + var types = []; + + puts.forEach(function (param) { + if (_typeof(param.components) === 'object') { + if (param.type.substring(0, 5) !== 'tuple') { + throw new Error('components found but type is not tuple; report on GitHub'); + } + var suffix = ''; + var arrayBracket = param.type.indexOf('['); + if (arrayBracket >= 0) { + suffix = param.type.substring(arrayBracket); + } + var result = _flattenTypes(includeTuple, param.components); + // console.log("result should have things: " + result) + if (_.isArray(result) && includeTuple) { + // console.log("include tuple word, and its an array. joining...: " + result.types) + types.push('tuple(' + result.join(',') + ')' + suffix); + } else if (!includeTuple) { + // console.log("don't include tuple, but its an array. joining...: " + result) + types.push('(' + result.join(',') + ')' + suffix); + } else { + // console.log("its a single type within a tuple: " + result.types) + types.push('(' + result + ')'); + } + } else { + // console.log("its a type and not directly in a tuple: " + param.type) + types.push(param.type); + } + }); - return "0x" + hex; + return types; }; /** - * Should be called to get utf8 from it's hex representation + * Should be called to get ascii from it's hex representation * - * @method hexToUtf8 + * @method hexToAscii * @param {String} hex * @returns {String} ascii string representation of hex value */ - var hexToUtf8 = function hexToUtf8(hex) { - if (!isHexStrict(hex)) throw new Error('The parameter "' + hex + '" must be a valid HEX string.'); + var hexToAscii = function hexToAscii(hex) { + if (!utils.isHexStrict(hex)) throw new Error('The parameter must be a valid HEX string.'); var str = ""; - var code = 0; - hex = hex.replace(/^0x/i, ''); - - // remove 00 padding from either side - hex = hex.replace(/^(?:00)*/, ''); - hex = hex.split("").reverse().join(""); - hex = hex.replace(/^(?:00)*/, ''); - hex = hex.split("").reverse().join(""); - - var l = hex.length; - - for (var i = 0; i < l; i += 2) { - code = parseInt(hex.substr(i, 2), 16); - // if (code !== 0) { + var i = 0, + l = hex.length; + if (hex.substring(0, 2) === '0x') { + i = 2; + } + for (; i < l; i += 2) { + var code = parseInt(hex.substr(i, 2), 16); str += String.fromCharCode(code); - // } } - return utf8.decode(str); + return str; }; /** - * Converts value to it's number representation + * Should be called to get hex representation (prefixed by 0x) of ascii string * - * @method hexToNumber - * @param {String|Number|BN} value - * @return {String} + * @method asciiToHex + * @param {String} str + * @returns {String} hex representation of input string */ - var hexToNumber = function hexToNumber(value) { - if (!value) { - return value; + var asciiToHex = function asciiToHex(str) { + if (!str) return "0x00"; + var hex = ""; + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + var n = code.toString(16); + hex += n.length < 2 ? '0' + n : n; } - return toBN(value).toNumber(); - }; - - /** - * Converts value to it's decimal representation in string - * - * @method hexToNumberString - * @param {String|Number|BN} value - * @return {String} - */ - var hexToNumberString = function hexToNumberString(value) { - if (!value) return value; - - return toBN(value).toString(10); + return "0x" + hex; }; /** - * Converts value to it's hex representation + * Returns value of unit in Wei * - * @method numberToHex - * @param {String|Number|BN} value - * @return {String} + * @method getUnitValue + * @param {String} unit the unit to convert to, default ether + * @returns {BN} value of the unit (in Wei) + * @throws error if the unit is not correct:w */ - var numberToHex = function numberToHex(value) { - if (_.isNull(value) || _.isUndefined(value)) { - return value; - } - - if (!isFinite(value) && !isHexStrict(value)) { - throw new Error('Given input "' + value + '" is not a number.'); + var getUnitValue = function getUnitValue(unit) { + unit = unit ? unit.toLowerCase() : 'ether'; + if (!ethjsUnit.unitMap[unit]) { + throw new Error('This unit "' + unit + '" doesn\'t exist, please use the one of the following units' + JSON.stringify(ethjsUnit.unitMap, null, 2)); } - - var number = toBN(value); - var result = number.toString(16); - - return number.lt(new BN(0)) ? '-0x' + result.substr(1) : '0x' + result; + return unit; }; /** - * Convert a byte array to a hex string + * Takes a number of wei and converts it to any other ether unit. * - * Note: Implementation from crypto-js + * Possible units are: + * SI Short SI Full Effigy Other + * - kwei femtoether babbage + * - mwei picoether lovelace + * - gwei nanoether shannon nano + * - -- microether szabo micro + * - -- milliether finney milli + * - ether -- -- + * - kether -- grand + * - mether + * - gether + * - tether * - * @method bytesToHex - * @param {Array} bytes - * @return {String} the hex string + * @method fromWei + * @param {Number|String} number can be a number, number string or a HEX of a decimal + * @param {String} unit the unit to convert to, default ether + * @return {String|Object} When given a BN object it returns one as well, otherwise a number */ - var bytesToHex = function bytesToHex(bytes) { - for (var hex = [], i = 0; i < bytes.length; i++) { - /* jshint ignore:start */ - hex.push((bytes[i] >>> 4).toString(16)); - hex.push((bytes[i] & 0xF).toString(16)); - /* jshint ignore:end */ + var fromWei = function fromWei(number, unit) { + unit = getUnitValue(unit); + + if (!utils.isBN(number) && !_.isString(number)) { + throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); } - return '0x' + hex.join(""); + + return utils.isBN(number) ? ethjsUnit.fromWei(number, unit) : ethjsUnit.fromWei(number, unit).toString(10); }; /** - * Convert a hex string to a byte array + * Takes a number of a unit and converts it to wei. * - * Note: Implementation from crypto-js + * Possible units are: + * SI Short SI Full Effigy Other + * - kwei femtoether babbage + * - mwei picoether lovelace + * - gwei nanoether shannon nano + * - -- microether szabo micro + * - -- microether szabo micro + * - -- milliether finney milli + * - ether -- -- + * - kether -- grand + * - mether + * - gether + * - tether * - * @method hexToBytes - * @param {string} hex - * @return {Array} the byte array + * @method toWei + * @param {Number|String|BN} number can be a number, number string or a HEX of a decimal + * @param {String} unit the unit to convert from, default ether + * @return {String|Object} When given a BN object it returns one as well, otherwise a number */ - var hexToBytes = function hexToBytes(hex) { - hex = hex.toString(16); + var toWei = function toWei(number, unit) { + unit = getUnitValue(unit); - if (!isHexStrict(hex)) { - throw new Error('Given value "' + hex + '" is not a valid hex string.'); + if (!utils.isBN(number) && !_.isString(number)) { + throw new Error('Please pass numbers as strings or BigNumber objects to avoid precision errors.'); } - hex = hex.replace(/^0x/i, ''); - - for (var bytes = [], c = 0; c < hex.length; c += 2) { - bytes.push(parseInt(hex.substr(c, 2), 16)); - }return bytes; + return utils.isBN(number) ? ethjsUnit.toWei(number, unit) : ethjsUnit.toWei(number, unit).toString(10); }; /** - * Auto converts any given value into it's hex representation. - * - * And even stringifys objects before. + * Converts to a checksum address * - * @method toHex - * @param {String|Number|BN|Object} value - * @param {Boolean} returnType + * @method toChecksumAddress + * @param {String} address the given HEX address * @return {String} */ - var toHex = function toHex(value, returnType) { - /*jshint maxcomplexity: false */ - - if (isAddress(value)) { - return returnType ? 'address' : '0x' + value.toLowerCase().replace(/^0x/i, ''); - } + var toChecksumAddress = function toChecksumAddress(address) { + if (typeof address === 'undefined') return ''; - if (_.isBoolean(value)) { - return returnType ? 'bool' : value ? '0x01' : '0x00'; - } + if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) throw new Error('Given address "' + address + '" is not a valid Ethereum address.'); - if (_.isObject(value) && !isBigNumber(value) && !isBN(value)) { - return returnType ? 'string' : utf8ToHex(JSON.stringify(value)); - } + address = address.toLowerCase().replace(/^0x/i, ''); + var addressHash = utils.sha3(address).replace(/^0x/i, ''); + var checksumAddress = '0x'; - // if its a negative number, pass it through numberToHex - if (_.isString(value)) { - if (value.indexOf('-0x') === 0 || value.indexOf('-0X') === 0) { - return returnType ? 'int256' : numberToHex(value); - } else if (value.indexOf('0x') === 0 || value.indexOf('0X') === 0) { - return returnType ? 'bytes' : value; - } else if (!isFinite(value)) { - return returnType ? 'string' : utf8ToHex(value); + for (var i = 0; i < address.length; i++) { + // If ith character is 9 to f then make it uppercase + if (parseInt(addressHash[i], 16) > 7) { + checksumAddress += address[i].toUpperCase(); + } else { + checksumAddress += address[i]; } } - - return returnType ? value < 0 ? 'int256' : 'uint256' : numberToHex(value); + return checksumAddress; }; - /** - * Check if string is HEX, requires a 0x in front - * - * @method isHexStrict - * @param {String} hex to be checked - * @returns {Boolean} - */ - var isHexStrict = function isHexStrict(hex) { - return (_.isString(hex) || _.isNumber(hex)) && /^(-)?0x[0-9a-f]*$/i.test(hex); - }; + module.exports = { + _fireError: _fireError, + _jsonInterfaceMethodToString: _jsonInterfaceMethodToString, + _flattenTypes: _flattenTypes, + // extractDisplayName: extractDisplayName, + // extractTypeName: extractTypeName, + randomHex: randomHex, + _: _, + BN: utils.BN, + isBN: utils.isBN, + isBigNumber: utils.isBigNumber, + isHex: utils.isHex, + isHexStrict: utils.isHexStrict, + sha3: utils.sha3, + keccak256: utils.sha3, + soliditySha3: soliditySha3, + isAddress: utils.isAddress, + checkAddressChecksum: utils.checkAddressChecksum, + toChecksumAddress: toChecksumAddress, + toHex: utils.toHex, + toBN: utils.toBN, - /** - * Check if string is HEX - * - * @method isHex - * @param {String} hex to be checked - * @returns {Boolean} - */ - var isHex = function isHex(hex) { - return (_.isString(hex) || _.isNumber(hex)) && /^(-0x|0x)?[0-9a-f]*$/i.test(hex); - }; + bytesToHex: utils.bytesToHex, + hexToBytes: utils.hexToBytes, - /** - * Returns true if given string is a valid Ethereum block header bloom. - * - * TODO UNDOCUMENTED - * - * @method isBloom - * @param {String} hex encoded bloom filter - * @return {Boolean} - */ - var isBloom = function isBloom(bloom) { - if (!/^(0x)?[0-9a-f]{512}$/i.test(bloom)) { - return false; - } else if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) { - return true; - } - return false; - }; + hexToNumberString: utils.hexToNumberString, - /** - * Returns true if given string is a valid log topic. - * - * TODO UNDOCUMENTED - * - * @method isTopic - * @param {String} hex encoded topic - * @return {Boolean} - */ - var isTopic = function isTopic(topic) { - if (!/^(0x)?[0-9a-f]{64}$/i.test(topic)) { - return false; - } else if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) { - return true; - } - return false; - }; + hexToNumber: utils.hexToNumber, + toDecimal: utils.hexToNumber, // alias - /** - * Hashes values to a sha3 hash using keccak 256 - * - * To hash a HEX string the hex must have 0x in front. - * - * @method sha3 - * @return {String} the sha3 string - */ - var SHA3_NULL_S = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; + numberToHex: utils.numberToHex, + fromDecimal: utils.numberToHex, // alias - var sha3 = function sha3(value) { - if (isHexStrict(value) && /^0x/i.test(value.toString())) { - value = hexToBytes(value); - } + hexToUtf8: utils.hexToUtf8, + hexToString: utils.hexToUtf8, + toUtf8: utils.hexToUtf8, - var returnValue = Hash.keccak256(value); // jshint ignore:line + utf8ToHex: utils.utf8ToHex, + stringToHex: utils.utf8ToHex, + fromUtf8: utils.utf8ToHex, - if (returnValue === SHA3_NULL_S) { - return null; - } else { - return returnValue; - } - }; - // expose the under the hood keccak256 - sha3._Hash = Hash; + hexToAscii: hexToAscii, + toAscii: hexToAscii, + asciiToHex: asciiToHex, + fromAscii: asciiToHex, - module.exports = { - BN: BN, - isBN: isBN, - isBigNumber: isBigNumber, - toBN: toBN, - isAddress: isAddress, - isBloom: isBloom, // TODO UNDOCUMENTED - isTopic: isTopic, // TODO UNDOCUMENTED - checkAddressChecksum: checkAddressChecksum, - utf8ToHex: utf8ToHex, - hexToUtf8: hexToUtf8, - hexToNumber: hexToNumber, - hexToNumberString: hexToNumberString, - numberToHex: numberToHex, - toHex: toHex, - hexToBytes: hexToBytes, - bytesToHex: bytesToHex, - isHex: isHex, - isHexStrict: isHexStrict, - leftPad: leftPad, - rightPad: rightPad, - toTwosComplement: toTwosComplement, - sha3: sha3 + unitMap: ethjsUnit.unitMap, + toWei: toWei, + fromWei: fromWei, + + padLeft: utils.leftPad, + leftPad: utils.leftPad, + padRight: utils.rightPad, + rightPad: utils.rightPad, + toTwosComplement: utils.toTwosComplement }; - }, { "bn.js": 382, "eth-lib/lib/hash": 383, "number-to-bn": 386, "underscore": 391, "utf8": 392 }], 396: [function (require, module, exports) { + }, { "./soliditySha3.js": 422, "./utils.js": 423, "ethjs-unit": 412, "randomhex": 417, "underscore": 419 }], 422: [function (require, module, exports) { + arguments[4][243][0].apply(exports, arguments); + }, { "./utils.js": 423, "bn.js": "BN", "dup": 243, "underscore": 419 }], 423: [function (require, module, exports) { + arguments[4][244][0].apply(exports, arguments); + }, { "bn.js": "BN", "dup": 244, "eth-lib/lib/hash": 411, "number-to-bn": 414, "underscore": 419, "utf8": 420 }], 424: [function (require, module, exports) { module.exports = { "name": "web3", "namespace": "ethereum", @@ -43027,8 +46892,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol } }; }, {}], "BN": [function (require, module, exports) { - arguments[4][240][0].apply(exports, arguments); - }, { "buffer": 17, "dup": 240 }], "Web3": [function (require, module, exports) { + arguments[4][218][0].apply(exports, arguments); + }, { "buffer": 17, "dup": 218 }], "Web3": [function (require, module, exports) { /* This file is part of web3.js. @@ -43106,6 +46971,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol core.addProviders(Web3); module.exports = Web3; - }, { "../package.json": 396, "web3-bzz": 187, "web3-core": 209, "web3-eth": 372, "web3-eth-personal": 369, "web3-net": 373, "web3-shh": 381, "web3-utils": 393 }] }, {}, ["Web3"])("Web3"); + }, { "../package.json": 424, "web3-bzz": 195, "web3-core": 217, "web3-eth": 395, "web3-eth-personal": 392, "web3-net": 396, "web3-shh": 410, "web3-utils": 421 }] }, {}, ["Web3"])("Web3"); }); //# sourceMappingURL=web3.js.map \ No newline at end of file diff --git a/dist/web3.min.js b/dist/web3.min.js index eeb73ee8350..c0f028a6209 100644 --- a/dist/web3.min.js +++ b/dist/web3.min.js @@ -1 +1 @@ -"use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(t){return void 0===t?"undefined":_typeof2(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":void 0===t?"undefined":_typeof2(t)};!function(t){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Web3=t()}}(function(){var define,module,exports;return function(){return function t(e,r,n){function i(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var c=r[a]={exports:{}};e[a][0].call(c.exports,function(t){var r=e[a][1][t];return i(r||t)},c,c.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=t.readUInt8(e),t.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:s.tag[r]}}function h(t,e,r){var n=t.readUInt8(r);if(t.isError(n))return n;if(!e&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(i>4)return t.error("length octect is too long");n=0;for(var o=0;o=31)return n.error("Multi-octet tag encoding unsupported");e||(i|=32);return i|=s.tagClassByName[r||"universal"]<<6}(t,e,r,this.reporter);if(n.length<128)return(o=new i(2))[0]=a,o[1]=n.length,this._createEncoderBuffer([o,n]);for(var u=1,f=n.length;f>=256;f>>=8)u++;(o=new i(2+u))[0]=a,o[1]=128|u;f=1+u;for(var c=n.length;c>0;f--,c>>=8)o[f]=255&c;return this._createEncoderBuffer([o,n])},f.prototype._encodeStr=function(t,e){if("bitstr"===e)return this._createEncoderBuffer([0|t.unused,t.data]);if("bmpstr"===e){for(var r=new i(2*t.length),n=0;n=40)return this.reporter.error("Second objid identifier OOB");t.splice(0,2,40*t[0]+t[1])}var o=0;for(n=0;n=128;a>>=7)o++}var s=new i(o),u=s.length-1;for(n=t.length-1;n>=0;n--){a=t[n];for(s[u--]=127&a;(a>>=7)>0;)s[u--]=128|127&a}return this._createEncoderBuffer(s)},f.prototype._encodeTime=function(t,e){var r,n=new Date(t);return"gentime"===e?r=[c(n.getFullYear()),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):"utctime"===e?r=[c(n.getFullYear()%100),c(n.getUTCMonth()+1),c(n.getUTCDate()),c(n.getUTCHours()),c(n.getUTCMinutes()),c(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+e+" time is not supported yet"),this._encodeStr(r,"octstr")},f.prototype._encodeNull=function(){return this._createEncoderBuffer("")},f.prototype._encodeInt=function(t,e){if("string"==typeof t){if(!e)return this.reporter.error("String int or enum given, but no values map");if(!e.hasOwnProperty(t))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(t));t=e[t]}if("number"!=typeof t&&!i.isBuffer(t)){var r=t.toArray();!t.sign&&128&r[0]&&r.unshift(0),t=new i(r)}if(i.isBuffer(t)){var n=t.length;0===t.length&&n++;var o=new i(n);return t.copy(o),0===t.length&&(o[0]=0),this._createEncoderBuffer(o)}if(t<128)return this._createEncoderBuffer(t);if(t<256)return this._createEncoderBuffer([0,t]);n=1;for(var a=t;a>=256;a>>=8)n++;for(a=(o=new Array(n)).length-1;a>=0;a--)o[a]=255&t,t>>=8;return 128&o[0]&&o.unshift(0),this._createEncoderBuffer(new i(o))},f.prototype._encodeBool=function(t){return this._createEncoderBuffer(t?255:0)},f.prototype._use=function(t,e){return"function"==typeof t&&(t=t(e)),t._getEncoder("der").tree},f.prototype._skipDefault=function(t,e,r){var n,i=this._baseState;if(null===i.default)return!1;var o=t.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,e,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n0?u-4:u;var c=0;for(e=0;e>16&255,s[c++]=n>>8&255,s[c++]=255&n;2===a?(n=i[t.charCodeAt(e)]<<2|i[t.charCodeAt(e+1)]>>4,s[c++]=255&n):1===a&&(n=i[t.charCodeAt(e)]<<10|i[t.charCodeAt(e+1)]<<4|i[t.charCodeAt(e+2)]>>2,s[c++]=n>>8&255,s[c++]=255&n);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o="",a=[],s=0,u=r-i;su?u:s+16383));1===i?(e=t[r-1],o+=n[e>>2],o+=n[e<<4&63],o+="=="):2===i&&(e=(t[r-2]<<8)+t[r-1],o+=n[e>>10],o+=n[e>>4&63],o+=n[e<<2&63],o+="=");return a.push(o),a.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function c(t,e,r){for(var i,o,a=[],s=e;s>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],16:[function(t,e,r){var n;function i(t){this.rand=t}if(e.exports=function(t){return n||(n=new i(null)),n.generate(t)},e.exports.Rand=i,i.prototype.generate=function(t){return this._rand(t)},i.prototype._rand=function(t){if(this.rand.getBytes)return this.rand.getBytes(t);for(var e=new Uint8Array(t),r=0;r>>24]^c[p>>>16&255]^h[b>>>8&255]^d[255&m]^e[y++],a=f[p>>>24]^c[b>>>16&255]^h[m>>>8&255]^d[255&l]^e[y++],s=f[b>>>24]^c[m>>>16&255]^h[l>>>8&255]^d[255&p]^e[y++],u=f[m>>>24]^c[l>>>16&255]^h[p>>>8&255]^d[255&b]^e[y++],l=o,p=a,b=s,m=u;return o=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&m])^e[y++],a=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[m>>>8&255]<<8|n[255&l])^e[y++],s=(n[b>>>24]<<24|n[m>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^e[y++],u=(n[m>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^e[y++],[o>>>=0,a>>>=0,s>>>=0,u>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],u=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,u=0;u<256;++u){var f=s^s<<1^s<<2^s<<3^s<<4;f=f>>>8^255&f^99,r[a]=f,n[f]=a;var c=t[a],h=t[c],d=t[h],l=257*t[f]^16843008*f;i[0][a]=l<<24|l>>>8,i[1][a]=l<<16|l>>>16,i[2][a]=l<<8|l>>>24,i[3][a]=l,l=16843009*d^65537*h^257*c^16843008*a,o[0][f]=l<<24|l>>>8,o[1][f]=l<<16|l>>>16,o[2][f]=l<<8|l>>>24,o[3][f]=l,0===a?a=s=1:(a=c^t[t[t[d^c]]],s^=t[t[s]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function f(t){this._key=i(t),this._reset()}f.blockSize=16,f.keySize=32,f.prototype.blockSize=f.blockSize,f.prototype.keySize=f.keySize,f.prototype._reset=function(){for(var t=this._key,e=t.length,r=e+6,n=4*(r+1),i=[],o=0;o>>24,a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=u.SBOX[a>>>24]<<24|u.SBOX[a>>>16&255]<<16|u.SBOX[a>>>8&255]<<8|u.SBOX[255&a]),i[o]=i[o-e]^a}for(var f=[],c=0;c>>24]]^u.INV_SUB_MIX[1][u.SBOX[d>>>16&255]]^u.INV_SUB_MIX[2][u.SBOX[d>>>8&255]]^u.INV_SUB_MIX[3][u.SBOX[255&d]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=f},f.prototype.encryptBlockRaw=function(t){return a(t=i(t),this._keySchedule,u.SUB_MIX,u.SBOX,this._nRounds)},f.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),r=n.allocUnsafe(16);return r.writeUInt32BE(e[0],0),r.writeUInt32BE(e[1],4),r.writeUInt32BE(e[2],8),r.writeUInt32BE(e[3],12),r},f.prototype.decryptBlock=function(t){var e=(t=i(t))[1];t[1]=t[3],t[3]=e;var r=a(t,this._invKeySchedule,u.INV_SUB_MIX,u.INV_SBOX,this._nRounds),o=n.allocUnsafe(16);return o.writeUInt32BE(r[0],0),o.writeUInt32BE(r[3],4),o.writeUInt32BE(r[2],8),o.writeUInt32BE(r[1],12),o},f.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},e.exports.AES=f},{"safe-buffer":147}],19:[function(t,e,r){var n=t("./aes"),i=t("safe-buffer").Buffer,o=t("cipher-base"),a=t("inherits"),s=t("./ghash"),u=t("buffer-xor"),f=t("./incr32");function c(t,e,r,a){o.call(this);var u=i.alloc(4,0);this._cipher=new n.AES(e);var c=this._cipher.encryptBlock(u);this._ghash=new s(c),r=function(t,e,r){if(12===e.length)return t._finID=i.concat([e,i.from([0,0,0,1])]),i.concat([e,i.from([0,0,0,2])]);var n=new s(r),o=e.length,a=o%16;n.update(e),a&&(a=16-a,n.update(i.alloc(a,0))),n.update(i.alloc(8,0));var u=8*o,c=i.alloc(8);c.writeUIntBE(u,0,8),n.update(c),t._finID=n.state;var h=i.from(t._finID);return f(h),h}(this,r,c),this._prev=i.from(r),this._cache=i.allocUnsafe(0),this._secCache=i.allocUnsafe(0),this._decrypt=a,this._alen=0,this._len=0,this._mode=t,this._authTag=null,this._called=!1}a(c,o),c.prototype._update=function(t){if(!this._called&&this._alen){var e=16-this._alen%16;e<16&&(e=i.alloc(e,0),this._ghash.update(e))}this._called=!0;var r=this._mode.encrypt(this,t);return this._decrypt?this._ghash.update(t):this._ghash.update(r),this._len+=t.length,r},c.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var t=u(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(t,e){var r=0;t.length!==e.length&&r++;for(var n=Math.min(t.length,e.length),i=0;i16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e}else if(this.cache.length>=16)return e=this.cache.slice(0,16),this.cache=this.cache.slice(16),e;return null},h.prototype.flush=function(){if(this.cache.length)return this.cache},r.createDecipher=function(t,e){var r=o[t.toLowerCase()];if(!r)throw new TypeError("invalid suite type");var n=f(e,!1,r.key,r.iv);return d(t,n.key,n.iv)},r.createDecipheriv=d},{"./aes":18,"./authCipher":19,"./modes":31,"./streamCipher":34,"cipher-base":48,evp_bytestokey:84,inherits:101,"safe-buffer":147}],22:[function(t,e,r){var n=t("./modes"),i=t("./authCipher"),o=t("safe-buffer").Buffer,a=t("./streamCipher"),s=t("cipher-base"),u=t("./aes"),f=t("evp_bytestokey");function c(t,e,r){s.call(this),this._cache=new d,this._cipher=new u.AES(e),this._prev=o.from(r),this._mode=t,this._autopadding=!0}t("inherits")(c,s),c.prototype._update=function(t){var e,r;this._cache.add(t);for(var n=[];e=this._cache.get();)r=this._mode.encrypt(this,e),n.push(r);return o.concat(n)};var h=o.alloc(16,16);function d(){this.cache=o.allocUnsafe(0)}function l(t,e,r){var s=n[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof e&&(e=o.from(e)),e.length!==s.key/8)throw new TypeError("invalid key length "+e.length);if("string"==typeof r&&(r=o.from(r)),"GCM"!==s.mode&&r.length!==s.iv)throw new TypeError("invalid iv length "+r.length);return"stream"===s.type?new a(s.module,e,r):"auth"===s.type?new i(s.module,e,r):new c(s.module,e,r)}c.prototype._final=function(){var t=this._cache.flush();if(this._autopadding)return t=this._mode.encrypt(this,t),this._cipher.scrub(),t;if(!t.equals(h))throw this._cipher.scrub(),new Error("data not multiple of block length")},c.prototype.setAutoPadding=function(t){return this._autopadding=!!t,this},d.prototype.add=function(t){this.cache=o.concat([this.cache,t])},d.prototype.get=function(){if(this.cache.length>15){var t=this.cache.slice(0,16);return this.cache=this.cache.slice(16),t}return null},d.prototype.flush=function(){for(var t=16-this.cache.length,e=o.allocUnsafe(t),r=-1;++r>>0,0),e.writeUInt32BE(t[1]>>>0,4),e.writeUInt32BE(t[2]>>>0,8),e.writeUInt32BE(t[3]>>>0,12),e}function a(t){this.h=t,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}a.prototype.ghash=function(t){for(var e=-1;++e0;e--)n[e]=n[e]>>>1|(1&n[e-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=o(i)},a.prototype.update=function(t){var e;for(this.cache=n.concat([this.cache,t]);this.cache.length>=16;)e=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(e)},a.prototype.final=function(t,e){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(o([0,t,0,e])),this.state},e.exports=a},{"safe-buffer":147}],24:[function(t,e,r){e.exports=function(t){for(var e,r=t.length;r--;){if(255!==(e=t.readUInt8(r))){e++,t.writeUInt8(e,r);break}t.writeUInt8(0,r)}}},{}],25:[function(t,e,r){var n=t("buffer-xor");r.encrypt=function(t,e){var r=n(e,t._prev);return t._prev=t._cipher.encryptBlock(r),t._prev},r.decrypt=function(t,e){var r=t._prev;t._prev=e;var i=t._cipher.decryptBlock(e);return n(i,r)}},{"buffer-xor":46}],26:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("buffer-xor");function o(t,e,r){var o=e.length,a=i(e,t._cache);return t._cache=t._cache.slice(o),t._prev=n.concat([t._prev,r?e:a]),a}r.encrypt=function(t,e,r){for(var i,a=n.allocUnsafe(0);e.length;){if(0===t._cache.length&&(t._cache=t._cipher.encryptBlock(t._prev),t._prev=n.allocUnsafe(0)),!(t._cache.length<=e.length)){a=n.concat([a,o(t,e,r)]);break}i=t._cache.length,a=n.concat([a,o(t,e.slice(0,i),r)]),e=e.slice(i)}return a}},{"buffer-xor":46,"safe-buffer":147}],27:[function(t,e,r){var n=t("safe-buffer").Buffer;function i(t,e,r){for(var n,i,a=-1,s=0;++a<8;)n=e&1<<7-a?128:0,s+=(128&(i=t._cipher.encryptBlock(t._prev)[0]^n))>>a%8,t._prev=o(t._prev,r?n:i);return s}function o(t,e){var r=t.length,i=-1,o=n.allocUnsafe(t.length);for(t=n.concat([t,n.from([e])]);++i>7;return o}r.encrypt=function(t,e,r){for(var o=e.length,a=n.allocUnsafe(o),s=-1;++s=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new n(i(e));return r}e.exports=o,o.getr=a}).call(this,t("buffer").Buffer)},{"bn.js":"BN",buffer:47,randombytes:131}],39:[function(t,e,r){e.exports=t("./browser/algorithms.json")},{"./browser/algorithms.json":40}],40:[function(t,e,r){e.exports={sha224WithRSAEncryption:{sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:{sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:{sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:{sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:{sign:"ecdsa",hash:"sha256",id:""},sha224:{sign:"ecdsa",hash:"sha224",id:""},sha384:{sign:"ecdsa",hash:"sha384",id:""},sha512:{sign:"ecdsa",hash:"sha512",id:""},"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:{sign:"dsa",hash:"sha1",id:""},"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}}},{}],41:[function(t,e,r){e.exports={"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}},{}],42:[function(t,e,r){(function(r){var n=t("create-hash"),i=t("stream"),o=t("inherits"),a=t("./sign"),s=t("./verify"),u=t("./algorithms.json");function f(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function c(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){return new f(t)}function d(t){return new c(t)}Object.keys(u).forEach(function(t){u[t].id=new r(u[t].id,"hex"),u[t.toLowerCase()]=u[t]}),o(f,i.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},f.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=a(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},o(c,i.Writable),c.prototype._write=function(t,e,r){this._hash.update(t),r()},c.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},c.prototype.verify=function(t,e,n){"string"==typeof e&&(e=new r(e,n)),this.end();var i=this._hash.digest();return s(e,i,t,this._signType,this._tag)},e.exports={Sign:h,Verify:d,createSign:h,createVerify:d}}).call(this,t("buffer").Buffer)},{"./algorithms.json":40,"./sign":43,"./verify":44,buffer:47,"create-hash":51,inherits:101,stream:156}],43:[function(t,e,r){(function(r){var n=t("create-hmac"),i=t("browserify-rsa"),o=t("elliptic").ec,a=t("bn.js"),s=t("parse-asn1"),u=t("./curves.json");function f(t,e,i,o){if((t=new r(t.toArray())).length0&&r.ishrn(n),r}function h(t,e,i){var o,a;do{for(o=new r(0);8*o.length=e)throw new Error("invalid sig")}e.exports=function(t,e,u,f,c){var h=o(u);if("ec"===h.type){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");return function(t,e,r){var n=a[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var o=new i(n),s=r.data.subjectPrivateKey.data;return o.verify(e,t,s)}(t,e,h)}if("dsa"===h.type){if("dsa"!==f)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,a=r.data.q,u=r.data.g,f=r.data.pub_key,c=o.signature.decode(t,"der"),h=c.s,d=c.r;s(h,a),s(d,a);var l=n.mont(i),p=h.invm(a);return 0===u.toRed(l).redPow(new n(e).mul(p).mod(a)).fromRed().mul(f.toRed(l).redPow(d.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(d)}(t,e,h)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");e=r.concat([c,e]);for(var d=h.modulus.byteLength(),l=[1],p=0;e.length+l.length+2o)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=s.prototype,e}function s(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(t)}return u(t,e,r)}function u(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return N(t)?function(t,e,r){if(e<0||t.byteLength=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function l(t,e){if(s.isBuffer(t))return t.length;if(L(t)||N(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return P(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return R(t).length;default:if(n)return P(t).length;e=(""+e).toLowerCase(),n=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function b(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),F(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(t,e,r,n,i){var o,a=1,s=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var h=!0,d=0;di&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var a=0;a239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(c=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&f)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=_)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return w(this,e,r);case"ascii":return M(this,e,r);case"latin1":case"binary":return x(this,e,r);case"base64":return g(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.equals=function(t){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===s.compare(this,t)},s.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},s.prototype.compare=function(t,e,r,n,i){if(!s.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0),u=Math.min(o,a),f=this.slice(n,i),c=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,a,s,u,f,c,h,d,l,p=!1;;)switch(n){case"hex":return y(this,t,e,r);case"utf8":case"utf-8":return d=e,l=r,O(P(t,(h=this).length-d),h,d,l);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return u=this,f=e,c=r,O(R(t),u,f,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a=e,s=r,O(function(t,e){for(var r,n,i,o=[],a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(t,(o=this).length-a),o,a,s);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function M(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",o=e;or)throw new RangeError("Trying to access beyond buffer length")}function A(t,e,r,n,i,o){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function j(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function B(t,e,r,n,o){return e=+e,r>>>=0,o||j(t,0,r,8),i.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||E(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},s.prototype.readUInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},s.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=this[t],i=1,o=0;++o=(i*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||E(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},s.prototype.readInt8=function(t,e){return t>>>=0,e||E(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt16BE=function(t,e){t>>>=0,e||E(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},s.prototype.readInt32LE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},s.prototype.readInt32BE=function(t,e){return t>>>=0,e||E(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},s.prototype.readFloatLE=function(t,e){return t>>>=0,e||E(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||E(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||E(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||E(t,8,this.length),i.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||A(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o>>=0,r>>>=0,n)||A(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,1,255,0),this[e]=255&t,e+1},s.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},s.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);A(this,t,e,r,i-1,-i)}var o=r-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},s.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},s.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},s.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},s.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},s.prototype.writeFloatLE=function(t,e,r){return I(this,t,e,!0,r)},s.prototype.writeFloatBE=function(t,e,r){return I(this,t,e,!1,r)},s.prototype.writeDoubleLE=function(t,e,r){return B(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return B(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--i)t[i+e]=this[i+r];else if(o<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function R(t){return n.toByteArray(function(t){if((t=t.trim().replace(T,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function O(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function N(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function L(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function F(t){return t!=t}},{"base64-js":15,ieee754:99}],48:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("stream").Transform,o=t("string_decoder").StringDecoder;function a(t){i.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}t("inherits")(a,i),a.prototype.update=function(t,e,r){"string"==typeof t&&(t=n.from(t,e));var i=this._update(t);return this.hashMode?this:(r&&(i=this._toString(i,r)),i)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,r){var n;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){n=t}finally{r(n)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||n.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,r){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var n=this._decoder.write(t);return r&&(n+=this._decoder.end()),n},e.exports=a},{inherits:101,"safe-buffer":147,stream:156,string_decoder:157}],49:[function(t,e,r){(function(t){function e(t){return Object.prototype.toString.call(t)}r.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===e(t)},r.isBoolean=function(t){return"boolean"==typeof t},r.isNull=function(t){return null===t},r.isNullOrUndefined=function(t){return null==t},r.isNumber=function(t){return"number"==typeof t},r.isString=function(t){return"string"==typeof t},r.isSymbol=function(t){return"symbol"===(void 0===t?"undefined":_typeof(t))},r.isUndefined=function(t){return void 0===t},r.isRegExp=function(t){return"[object RegExp]"===e(t)},r.isObject=function(t){return"object"===(void 0===t?"undefined":_typeof(t))&&null!==t},r.isDate=function(t){return"[object Date]"===e(t)},r.isError=function(t){return"[object Error]"===e(t)||t instanceof Error},r.isFunction=function(t){return"function"==typeof t},r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===(void 0===t?"undefined":_typeof(t))||void 0===t},r.isBuffer=t.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":102}],50:[function(t,e,r){(function(r){var n=t("elliptic"),i=t("bn.js");e.exports=function(t){return new a(t)};var o={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function a(t){this.curveType=o[t],this.curveType||(this.curveType={name:t}),this.curve=new n.ec(this.curveType.name),this.keys=void 0}function s(t,e,n){Array.isArray(t)||(t=t.toArray());var i=new r(t);if(n&&i.length>>2),a=0,s=0;a>5]|=128<>>9<<4)]=e;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,h=0;h>>32-s,r);var a,s}function a(t,e,r,n,i,a,s){return o(e&r|~e&n,t,e,i,a,s)}function s(t,e,r,n,i,a,s){return o(e&n|r&~n,t,e,i,a,s)}function u(t,e,r,n,i,a,s){return o(e^r^n,t,e,i,a,s)}function f(t,e,r,n,i,a,s){return o(r^(e|~n),t,e,i,a,s)}function c(t,e){var r=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(r>>16)<<16|65535&r}e.exports=function(t){return n(t,i)}},{"./make-hash":52}],54:[function(t,e,r){var n=t("inherits"),i=t("./legacy"),o=t("cipher-base"),a=t("safe-buffer").Buffer,s=t("create-hash/md5"),u=t("ripemd160"),f=t("sha.js"),c=a.alloc(128);function h(t,e){o.call(this,"digest"),"string"==typeof e&&(e=a.from(e));var r="sha512"===t||"sha384"===t?128:64;(this._alg=t,this._key=e,e.length>r)?e=("rmd160"===t?new u:f(t)).update(e).digest():e.lengths?e=t(e):e.length0;n--)e+=this._buffer(t,e),r+=this._flushBuffer(i,r);return e+=this._buffer(t,e),i},i.prototype.final=function(t){var e,r;return t&&(e=this.update(t)),r="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(r):r},i.prototype._pad=function(t,e){if(0===e)return!1;for(;e>>1];r=a.r28shl(r,s),i=a.r28shl(i,s),a.pc2(r,i,t.keys,o)}},u.prototype._update=function(t,e,r,n){var i=this._desState,o=a.readUInt32BE(t,e),s=a.readUInt32BE(t,e+4);a.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],a.writeUInt32BE(r,o,n),a.writeUInt32BE(r,s,n+4)},u.prototype._pad=function(t,e){for(var r=t.length-e,n=e;n>>0,o=d}a.rip(s,o,n,i)},u.prototype._decrypt=function(t,e,r,n,i){for(var o=r,s=e,u=t.keys.length-2;u>=0;u-=2){var f=t.keys[u],c=t.keys[u+1];a.expand(o,t.tmp,0),f^=t.tmp[0],c^=t.tmp[1];var h=a.substitute(f,c),d=o;o=(s^a.permute(h))>>>0,s=d}a.rip(o,s,n,i)}},{"../des":57,inherits:101,"minimalistic-assert":107}],61:[function(t,e,r){var n=t("minimalistic-assert"),i=t("inherits"),o=t("../des"),a=o.Cipher,s=o.DES;function u(t){a.call(this,t);var e=new function(t,e){n.equal(e.length,24,"Invalid key length");var r=e.slice(0,8),i=e.slice(8,16),o=e.slice(16,24);this.ciphers="encrypt"===t?[s.create({type:"encrypt",key:r}),s.create({type:"decrypt",key:i}),s.create({type:"encrypt",key:o})]:[s.create({type:"decrypt",key:o}),s.create({type:"encrypt",key:i}),s.create({type:"decrypt",key:r})]}(this.type,this.options.key);this._edeState=e}i(u,a),e.exports=u,u.create=function(t){return new u(t)},u.prototype._update=function(t,e,r,n){var i=this._edeState;i.ciphers[0]._update(t,e,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},u.prototype._pad=s.prototype._pad,u.prototype._unpad=s.prototype._unpad},{"../des":57,inherits:101,"minimalistic-assert":107}],62:[function(t,e,r){r.readUInt32BE=function(t,e){return(t[0+e]<<24|t[1+e]<<16|t[2+e]<<8|t[3+e])>>>0},r.writeUInt32BE=function(t,e,r){t[0+r]=e>>>24,t[1+r]=e>>>16&255,t[2+r]=e>>>8&255,t[3+r]=255&e},r.ip=function(t,e,r,n){for(var i=0,o=0,a=6;a>=0;a-=2){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>>s+a&1}for(a=6;a>=0;a-=2){for(s=1;s<=25;s+=8)o<<=1,o|=e>>>s+a&1;for(s=1;s<=25;s+=8)o<<=1,o|=t>>>s+a&1}r[n+0]=i>>>0,r[n+1]=o>>>0},r.rip=function(t,e,r,n){for(var i=0,o=0,a=0;a<4;a++)for(var s=24;s>=0;s-=8)i<<=1,i|=e>>>s+a&1,i<<=1,i|=t>>>s+a&1;for(a=4;a<8;a++)for(s=24;s>=0;s-=8)o<<=1,o|=e>>>s+a&1,o<<=1,o|=t>>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.pc1=function(t,e,r,n){for(var i=0,o=0,a=7;a>=5;a--){for(var s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(s=0;s<=24;s+=8)i<<=1,i|=t>>s+a&1}for(s=0;s<=24;s+=8)i<<=1,i|=e>>s+a&1;for(a=1;a<=3;a++){for(s=0;s<=24;s+=8)o<<=1,o|=e>>s+a&1;for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1}for(s=0;s<=24;s+=8)o<<=1,o|=t>>s+a&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.r28shl=function(t,e){return t<>>28-e};var n=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(t,e,r,i){for(var o=0,a=0,s=n.length>>>1,u=0;u>>n[u]&1;for(u=s;u>>n[u]&1;r[i+0]=o>>>0,r[i+1]=a>>>0},r.expand=function(t,e,r){var n=0,i=0;n=(1&t)<<5|t>>>27;for(var o=23;o>=15;o-=4)n<<=6,n|=t>>>o&63;for(o=11;o>=3;o-=4)i|=t>>>o&63,i<<=6;i|=(31&t)<<1|t>>>31,e[r+0]=n>>>0,e[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(t,e){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(t>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(e>>>18-6*n&63)]}return r>>>0};var o=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(t){for(var e=0,r=0;r>>o[r]&1;return e>>>0},r.padSplit=function(t,e,r){for(var n=t.toString(2);n.lengtht;)r.ishrn(1);if(r.isEven()&&r.iadd(s),r.testn(1)||r.iadd(u),e.cmp(u)){if(!e.cmp(f))for(;r.mod(c).cmp(h);)r.iadd(l)}else for(;r.mod(o).cmp(d);)r.iadd(l);if(b(p=r.shrn(1))&&b(r)&&m(p)&&m(r)&&a.test(p)&&a.test(r))return r}}},{"bn.js":"BN","miller-rabin":106,randombytes:131}],66:[function(t,e,r){e.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],67:[function(t,e,r){var n=r;n.version=t("../package.json").version,n.utils=t("./elliptic/utils"),n.rand=t("brorand"),n.curve=t("./elliptic/curve"),n.curves=t("./elliptic/curves"),n.ec=t("./elliptic/ec"),n.eddsa=t("./elliptic/eddsa")},{"../package.json":82,"./elliptic/curve":70,"./elliptic/curves":73,"./elliptic/ec":74,"./elliptic/eddsa":77,"./elliptic/utils":81,brorand:16}],68:[function(t,e,r){var n=t("bn.js"),i=t("../../elliptic").utils,o=i.getNAF,a=i.getJSF,s=i.assert;function u(t,e){this.type=t,this.p=new n(e.p,16),this.red=e.prime?n.red(e.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=e.n&&new n(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function f(t,e){this.curve=t,this.type=e,this.precomputed=null}e.exports=u,u.prototype.point=function(){throw new Error("Not implemented")},u.prototype.validate=function(){throw new Error("Not implemented")},u.prototype._fixedNafMul=function(t,e){s(t.precomputed);var r=t._getDoubles(),n=o(e,1),i=(1<=u;e--)f=(f<<1)+n[e];a.push(f)}for(var c=this.jpoint(null,null,null),h=this.jpoint(null,null,null),d=i;d>0;d--){for(u=0;u=0;f--){for(e=0;f>=0&&0===a[f];f--)e++;if(f>=0&&e++,u=u.dblp(e),f<0)break;var c=a[f];s(0!==c),u="affine"===t.type?c>0?u.mixedAdd(i[c-1>>1]):u.mixedAdd(i[-c-1>>1].neg()):c>0?u.add(i[c-1>>1]):u.add(i[-c-1>>1].neg())}return"affine"===t.type?u.toP():u},u.prototype._wnafMulAdd=function(t,e,r,n,i){for(var s=this._wnafT1,u=this._wnafT2,f=this._wnafT3,c=0,h=0;h=1;h-=2){var l=h-1,p=h;if(1===s[l]&&1===s[p]){var b=[e[l],null,null,e[p]];0===e[l].y.cmp(e[p].y)?(b[1]=e[l].add(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg())):0===e[l].y.cmp(e[p].y.redNeg())?(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].add(e[p].neg())):(b[1]=e[l].toJ().mixedAdd(e[p]),b[2]=e[l].toJ().mixedAdd(e[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=a(r[l],r[p]);c=Math.max(y[0].length,c),f[l]=new Array(c),f[p]=new Array(c);for(var v=0;v=0;h--){for(var x=0;h>=0;){var k=!0;for(v=0;v=0&&x++,_=_.dblp(x),h<0)break;for(v=0;v0?S=u[v][E-1>>1]:E<0&&(S=u[v][-E-1>>1].neg()),_="affine"===S.type?_.mixedAdd(S):_.add(S))}}for(h=0;h=Math.ceil((t.bitLength()+1)/e.step)},f.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},c.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),o=n.redAdd(e),a=o.redSub(r),s=n.redSub(e),u=i.redMul(a),f=o.redMul(s),c=i.redMul(s),h=a.redMul(o);return this.curve.point(u,f,h,c)},c.prototype._projDbl=function(){var t,e,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var a=(f=this.curve._mulA(i)).redAdd(o);if(this.zOne)t=n.redSub(i).redSub(o).redMul(a.redSub(this.curve.two)),e=a.redMul(f.redSub(o)),r=a.redSqr().redSub(a).redSub(a);else{var s=this.z.redSqr(),u=a.redSub(s).redISub(s);t=n.redSub(i).redISub(o).redMul(u),e=a.redMul(f.redSub(o)),r=a.redMul(u)}}else{var f=i.redAdd(o);s=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=f.redSub(s).redSub(s);t=this.curve._mulC(n.redISub(f)).redMul(u),e=this.curve._mulC(f).redMul(i.redISub(o)),r=f.redMul(u)}return this.curve.point(t,e,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),r=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),n=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),o=r.redSub(e),a=i.redSub(n),s=i.redAdd(n),u=r.redAdd(e),f=o.redMul(a),c=s.redMul(u),h=o.redMul(u),d=a.redMul(s);return this.curve.point(f,c,d,h)},c.prototype._projAdd=function(t){var e,r,n=this.z.redMul(t.z),i=n.redSqr(),o=this.x.redMul(t.x),a=this.y.redMul(t.y),s=this.curve.d.redMul(o).redMul(a),u=i.redSub(s),f=i.redAdd(s),c=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(o).redISub(a),h=n.redMul(u).redMul(c);return this.curve.twisted?(e=n.redMul(f).redMul(a.redSub(this.curve._mulA(o))),r=u.redMul(f)):(e=n.redMul(f).redMul(a.redSub(o)),r=this.curve._mulC(u).redMul(f)),this.curve.point(h,e,r)},c.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)},c.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!1)},c.prototype.jmulAdd=function(t,e,r){return this.curve._wnafMulAdd(1,[this,e],[t,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(t){return this===t||0===this.getX().cmp(t.getX())&&0===this.getY().cmp(t.getY())},c.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(e))return!0;for(var r=t.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(n),0===this.x.cmp(e))return!0}return!1},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:101}],70:[function(t,e,r){var n=r;n.base=t("./base"),n.short=t("./short"),n.mont=t("./mont"),n.edwards=t("./edwards")},{"./base":68,"./edwards":69,"./mont":71,"./short":72}],71:[function(t,e,r){var n=t("../curve"),i=t("bn.js"),o=t("inherits"),a=n.base,s=t("../../elliptic").utils;function u(t){a.call(this,"mont",t),this.a=new i(t.a,16).toRed(this.red),this.b=new i(t.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(t,e,r){a.BasePoint.call(this,t,"projective"),null===e&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(e,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,a),e.exports=u,u.prototype.validate=function(t){var e=t.normalize().x,r=e.redSqr(),n=r.redMul(e).redAdd(r.redMul(this.a)).redAdd(e);return 0===n.redSqrt().redSqr().cmp(n)},o(f,a.BasePoint),u.prototype.decodePoint=function(t,e){return this.point(s.toArray(t,e),1)},u.prototype.point=function(t,e){return new f(this,t,e)},u.prototype.pointFromJSON=function(t){return f.fromJSON(this,t)},f.prototype.precompute=function(){},f.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function(t,e){return new f(t,e[0],e[1]||t.one)},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},f.prototype.dbl=function(){var t=this.x.redAdd(this.z).redSqr(),e=this.x.redSub(this.z).redSqr(),r=t.redSub(e),n=t.redMul(e),i=r.redMul(e.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},f.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function(t,e){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=t.x.redAdd(t.z),o=t.x.redSub(t.z).redMul(r),a=i.redMul(n),s=e.z.redMul(o.redAdd(a).redSqr()),u=e.x.redMul(o.redISub(a).redSqr());return this.curve.point(s,u)},f.prototype.mul=function(t){for(var e=t.clone(),r=this,n=this.curve.point(null,null),i=[];0!==e.cmpn(0);e.iushrn(1))i.push(e.andln(1));for(var o=i.length-1;o>=0;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},f.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function(t){return 0===this.getX().cmp(t.getX())},f.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:101}],72:[function(t,e,r){var n=t("../curve"),i=t("../../elliptic"),o=t("bn.js"),a=t("inherits"),s=n.base,u=i.utils.assert;function f(t){s.call(this,"short",t),this.a=new o(t.a,16).toRed(this.red),this.b=new o(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function c(t,e,r,n){s.BasePoint.call(this,t,"affine"),null===e&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new o(e,16),this.y=new o(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function h(t,e,r,n){s.BasePoint.call(this,t,"jacobian"),null===e&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new o(0)):(this.x=new o(e,16),this.y=new o(r,16),this.z=new o(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}a(f,s),e.exports=f,f.prototype._getEndomorphism=function(t){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var e,r;if(t.beta)e=new o(t.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);e=(e=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(t.lambda)r=new o(t.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(e))?r=i[0]:(r=i[1],u(0===this.g.mul(r).x.cmp(this.g.x.redMul(e))))}return{beta:e,lambda:r,basis:t.basis?t.basis.map(function(t){return{a:new o(t.a,16),b:new o(t.b,16)}}):this._getEndoBasis(r)}}},f.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:o.mont(t),r=new o(2).toRed(e).redInvm(),n=r.redNeg(),i=new o(3).toRed(e).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},f.prototype._getEndoBasis=function(t){for(var e,r,n,i,a,s,u,f,c,h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),d=t,l=this.n.clone(),p=new o(1),b=new o(0),m=new o(0),y=new o(1),v=0;0!==d.cmpn(0);){var g=l.div(d);f=l.sub(g.mul(d)),c=m.sub(g.mul(p));var w=y.sub(g.mul(b));if(!n&&f.cmp(h)<0)e=u.neg(),r=p,n=f.neg(),i=c;else if(n&&2==++v)break;u=f,l=d,d=f,m=p,p=c,y=b,b=w}a=f.neg(),s=c;var _=n.sqr().add(i.sqr());return a.sqr().add(s.sqr()).cmp(_)>=0&&(a=e,s=r),n.negative&&(n=n.neg(),i=i.neg()),a.negative&&(a=a.neg(),s=s.neg()),[{a:n,b:i},{a:a,b:s}]},f.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],n=e[1],i=n.b.mul(t).divRound(this.n),o=r.b.neg().mul(t).divRound(this.n),a=i.mul(r.a),s=o.mul(n.a),u=i.mul(r.b),f=o.mul(n.b);return{k1:t.sub(a).sub(s),k2:u.add(f).neg()}},f.prototype.pointFromX=function(t,e){(t=new o(t,16)).red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(e&&!i||!e&&i)&&(n=n.redNeg()),this.point(t,n)},f.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,n=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},f.prototype._endoWnafMulAdd=function(t,e,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(0===this.x.cmp(t.x))return this.curve.point(null,null);var e=this.y.redSub(t.y);0!==e.cmpn(0)&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),n=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},c.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(0===t.cmpn(0))return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),n=t.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(t){return t=new o(t,16),this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},c.prototype.mulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},c.prototype.jmulAdd=function(t,e,r){var n=[this,e],i=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},c.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||0===this.x.cmp(t.x)&&0===this.y.cmp(t.y))},c.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,n=function(t){return t.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return e},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},a(h,s.BasePoint),f.prototype.jpoint=function(t,e,r){return new h(this,t,e,r)},h.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),n=this.y.redMul(e).redMul(t);return this.curve.point(r,n)},h.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},h.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(e),i=t.x.redMul(r),o=this.y.redMul(e.redMul(t.z)),a=t.y.redMul(r.redMul(this.z)),s=n.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=s.redSqr(),c=f.redMul(s),h=n.redMul(f),d=u.redSqr().redIAdd(c).redISub(h).redISub(h),l=u.redMul(h.redISub(d)).redISub(o.redMul(c)),p=this.z.redMul(t.z).redMul(s);return this.curve.jpoint(d,l,p)},h.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,n=t.x.redMul(e),i=this.y,o=t.y.redMul(e).redMul(this.z),a=r.redSub(n),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),f=u.redMul(a),c=r.redMul(u),h=s.redSqr().redIAdd(f).redISub(c).redISub(c),d=s.redMul(c.redISub(h)).redISub(i.redMul(f)),l=this.z.redMul(a);return this.curve.jpoint(h,d,l)},h.prototype.dblp=function(t){if(0===t)return this;if(this.isInfinity())return this;if(!t)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var e=this,r=0;r=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}return!1},h.prototype.inspect=function(){return this.isInfinity()?"":""},h.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:101}],73:[function(t,e,r){var n,i=r,o=t("hash.js"),a=t("../elliptic"),s=a.utils.assert;function u(t){"short"===t.type?this.curve=new a.curve.short(t):"edwards"===t.type?this.curve=new a.curve.edwards(t):this.curve=new a.curve.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(t,e){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var r=new u(e);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:r}),r}})}i.PresetCurve=u,f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=t("./precomputed/secp256k1")}catch(t){n=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":67,"./precomputed/secp256k1":80,"hash.js":86}],74:[function(t,e,r){var n=t("bn.js"),i=t("hmac-drbg"),o=t("../../elliptic"),a=o.utils.assert,s=t("./key"),u=t("./signature");function f(t){if(!(this instanceof f))return new f(t);"string"==typeof t&&(a(o.curves.hasOwnProperty(t),"Unknown curve "+t),t=o.curves[t]),t instanceof o.curves.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}e.exports=f,f.prototype.keyPair=function(t){return new s(this,t)},f.prototype.keyFromPrivate=function(t,e){return s.fromPrivate(this,t,e)},f.prototype.keyFromPublic=function(t,e){return s.fromPublic(this,t,e)},f.prototype.genKeyPair=function(t){t||(t={});for(var e=new i({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||o.rand(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),a=this.n.sub(new n(2));;){var s=new n(e.generate(r));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},f.prototype._truncateToN=function(t,e){var r=8*t.byteLength()-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},f.prototype.sign=function(t,e,r,o){"object"===(void 0===r?"undefined":_typeof(r))&&(o=r,r=null),o||(o={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new n(t,16));for(var a=this.n.byteLength(),s=e.getPrivate().toArray("be",a),f=t.toArray("be",a),c=new i({hash:this.hash,entropy:s,nonce:f,pers:o.pers,persEnc:o.persEnc||"utf8"}),h=this.n.sub(new n(1)),d=0;;d++){var l=o.k?o.k(d):new n(c.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(h)>=0)){var p=this.g.mul(l);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var y=l.invm(this.n).mul(m.mul(e.getPrivate()).iadd(t));if(0!==(y=y.umod(this.n)).cmpn(0)){var v=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return o.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),v^=1),new u({r:m,s:y,recoveryParam:v})}}}}}},f.prototype.verify=function(t,e,r,i){t=this._truncateToN(new n(t,16)),r=this.keyFromPublic(r,i);var o=(e=new u(e,"hex")).r,a=e.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var s,f=a.invm(this.n),c=f.mul(t).umod(this.n),h=f.mul(o).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),h)).isInfinity()&&s.eqXToP(o):!(s=this.g.mulAdd(c,r.getPublic(),h)).isInfinity()&&0===s.getX().umod(this.n).cmp(o)},f.prototype.recoverPubKey=function(t,e,r,i){a((3&r)===r,"The recovery param is more than two bits"),e=new u(e,i);var o=this.n,s=new n(t),f=e.r,c=e.s,h=1&r,d=r>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&d)throw new Error("Unable to find sencond key candinate");f=d?this.curve.pointFromX(f.add(this.curve.n),h):this.curve.pointFromX(f,h);var l=e.r.invm(o),p=o.sub(s).mul(l).umod(o),b=c.mul(l).umod(o);return this.g.mulAdd(p,f,b)},f.prototype.getKeyRecoveryParam=function(t,e,r,n){if(null!==(e=new u(e,n)).recoveryParam)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch(t){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":67,"./key":75,"./signature":76,"bn.js":"BN","hmac-drbg":98}],75:[function(t,e,r){var n=t("bn.js"),i=t("../../elliptic").utils.assert;function o(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}e.exports=o,o.fromPublic=function(t,e,r){return e instanceof o?e:new o(t,{pub:e,pubEnc:r})},o.fromPrivate=function(t,e,r){return e instanceof o?e:new o(t,{priv:e,privEnc:r})},o.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(t,e){return"string"==typeof t&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},o.prototype.getPrivate=function(t){return"hex"===t?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(t,e){this.priv=new n(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(t,e){if(t.x||t.y)return"mont"===this.ec.curve.type?i(t.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(t.x&&t.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(t.x,t.y));this.pub=this.ec.curve.decodePoint(t,e)},o.prototype.derive=function(t){return t.mul(this.priv).getX()},o.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},o.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":67,"bn.js":"BN"}],76:[function(t,e,r){var n=t("bn.js"),i=t("../../elliptic").utils,o=i.assert;function a(t,e){if(t instanceof a)return t;this._importDER(t,e)||(o(t.r&&t.s,"Signature without r or s"),this.r=new n(t.r,16),this.s=new n(t.s,16),void 0===t.recoveryParam?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}function s(t,e){var r=t[e.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,a=e.place;o>>3);for(t.push(128|r);--r;)t.push(e>>>(r<<3)&255);t.push(e)}}e.exports=a,a.prototype._importDER=function(t,e){t=i.toArray(t,e);var r=new function(){this.place=0};if(48!==t[r.place++])return!1;if(s(t,r)+r.place!==t.length)return!1;if(2!==t[r.place++])return!1;var o=s(t,r),a=t.slice(r.place,o+r.place);if(r.place+=o,2!==t[r.place++])return!1;var u=s(t,r);if(t.length!==u+r.place)return!1;var f=t.slice(r.place,u+r.place);return 0===a[0]&&128&a[1]&&(a=a.slice(1)),0===f[0]&&128&f[1]&&(f=f.slice(1)),this.r=new n(a),this.s=new n(f),this.recoveryParam=null,!0},a.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(128&e[0]&&(e=[0].concat(e)),128&r[0]&&(r=[0].concat(r)),e=u(e),r=u(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];f(n,e.length),(n=n.concat(e)).push(2),f(n,r.length);var o=n.concat(r),a=[48];return f(a,o.length),a=a.concat(o),i.encode(a,t)}},{"../../elliptic":67,"bn.js":"BN"}],77:[function(t,e,r){var n=t("hash.js"),i=t("../../elliptic"),o=i.utils,a=o.assert,s=o.parseBytes,u=t("./key"),f=t("./signature");function c(t){if(a("ed25519"===t,"only tested with ed25519 so far"),!(this instanceof c))return new c(t);t=i.curves[t].curve;this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=n.sha512}e.exports=c,c.prototype.sign=function(t,e){t=s(t);var r=this.keyFromSecret(e),n=this.hashInt(r.messagePrefix(),t),i=this.g.mul(n),o=this.encodePoint(i),a=this.hashInt(o,r.pubBytes(),t).mul(r.priv()),u=n.add(a).umod(this.curve.n);return this.makeSignature({R:i,S:u,Rencoded:o})},c.prototype.verify=function(t,e,r){t=s(t),e=this.makeSignature(e);var n=this.keyFromPublic(r),i=this.hashInt(e.Rencoded(),n.pubBytes(),t),o=this.g.mul(e.S());return e.R().add(n.pub().mul(i)).eq(o)},c.prototype.hashInt=function(){for(var t=this.hash(),e=0;e=0;){var o;if(i.isOdd()){var a=i.andln(n-1);o=a>(n>>1)-1?(n>>1)-a:a,i.isubn(o)}else o=0;r.push(o);for(var s=0!==i.cmpn(0)&&0===i.andln(n-1)?e+1:1,u=1;u0||e.cmpn(-i)>0;){var o,a,s,u=t.andln(3)+n&3,f=e.andln(3)+i&3;3===u&&(u=-1),3===f&&(f=-1),o=0==(1&u)?0:3!=(s=t.andln(7)+n&7)&&5!==s||2!==f?u:-u,r[0].push(o),a=0==(1&f)?0:3!=(s=e.andln(7)+i&7)&&5!==s||2!==u?f:-f,r[1].push(a),2*n===o+1&&(n=1-n),2*i===a+1&&(i=1-i),t.iushrn(1),e.iushrn(1)}return r},n.cachedProperty=function(t,e,r){var n="_"+e;t.prototype[e]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},n.parseBytes=function(t){return"string"==typeof t?n.toArray(t,"hex"):t},n.intFromLE=function(t){return new i(t,"hex","le")}},{"bn.js":"BN","minimalistic-assert":107,"minimalistic-crypto-utils":108}],82:[function(t,e,r){e.exports={_args:[[{raw:"elliptic@^6.0.0",scope:null,escapedName:"elliptic",name:"elliptic",rawSpec:"^6.0.0",spec:">=6.0.0 <7.0.0",type:"range"},"/Users/frozeman/Sites/_ethereum/web3/node_modules/browserify-sign"]],_from:"elliptic@>=6.0.0 <7.0.0",_id:"elliptic@6.4.0",_inCache:!0,_location:"/elliptic",_nodeVersion:"7.0.0",_npmOperationalInternal:{host:"packages-18-east.internal.npmjs.com",tmp:"tmp/elliptic-6.4.0.tgz_1487798866428_0.30510620190761983"},_npmUser:{name:"indutny",email:"fedor@indutny.com"},_npmVersion:"3.10.8",_phantomChildren:{},_requested:{raw:"elliptic@^6.0.0",scope:null,escapedName:"elliptic",name:"elliptic",rawSpec:"^6.0.0",spec:">=6.0.0 <7.0.0",type:"range"},_requiredBy:["/browserify-sign","/create-ecdh","/secp256k1"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_shrinkwrap:null,_spec:"elliptic@^6.0.0",_where:"/Users/frozeman/Sites/_ethereum/web3/node_modules/browserify-sign",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},directories:{},dist:{shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",tarball:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz"},files:["lib"],gitHead:"6b0d2b76caae91471649c8e21f0b1d3ba0f96090",homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",maintainers:[{name:"indutny",email:"fedor@indutny.com"}],name:"elliptic",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},{}],83:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"object"===(void 0===t?"undefined":_typeof(t))&&null!==t}function a(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,s,u,f;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(a(r=this._events[t]))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),n=(f=r.slice()).length,u=0;u0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){if(!i(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},n.prototype.removeListener=function(t,e){var r,n,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(a=(r=this._events[t]).length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(s=a;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],84:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("md5.js");e.exports=function(t,e,r,o){if(n.isBuffer(t)||(t=n.from(t,"binary")),e&&(n.isBuffer(e)||(e=n.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=r/8,s=n.alloc(a),u=n.alloc(o||0),f=n.alloc(0);a>0||o>0;){var c=new i;c.update(f),c.update(t),e&&c.update(e),f=c.digest();var h=0;if(a>0){var d=s.length-a;h=Math.min(a,f.length),f.copy(s,d,0,h),a-=h}if(h0){var l=u.length-o,p=Math.min(o,f.length-h);f.copy(u,l,h,h+p),o-=p}}return f.fill(0),{key:s,iv:u}}},{"md5.js":104,"safe-buffer":147}],85:[function(t,e,r){(function(r){var n=t("stream").Transform;function i(t){n.call(this),this._block=new r(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}t("inherits")(i,n),i.prototype._transform=function(t,e,n){var i=null;try{"buffer"!==e&&(t=new r(t,e)),this.update(t)}catch(t){i=t}n(i)},i.prototype._flush=function(t){var e=null;try{this.push(this._digest())}catch(t){e=t}t(e)},i.prototype.update=function(t,e){if(!r.isBuffer(t)&&"string"!=typeof t)throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");r.isBuffer(t)||(t=new r(t,e||"binary"));for(var n=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},i.prototype._update=function(t){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();return void 0!==t&&(e=e.toString(t)),e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=i}).call(this,t("buffer").Buffer)},{buffer:47,inherits:101,stream:156}],86:[function(t,e,r){var n=r;n.utils=t("./hash/utils"),n.common=t("./hash/common"),n.sha=t("./hash/sha"),n.ripemd=t("./hash/ripemd"),n.hmac=t("./hash/hmac"),n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160},{"./hash/common":87,"./hash/hmac":88,"./hash/ripemd":89,"./hash/sha":90,"./hash/utils":97}],87:[function(t,e,r){var n=t("./utils"),i=t("minimalistic-assert");function o(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}r.BlockHash=o,o.prototype.update=function(t,e){if(t=n.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){var r=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-r,t.length),0===this.pending.length&&(this.pending=null),t=n.join32(t,0,t.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=t>>>16&255,n[i++]=t>>>8&255,n[i++]=255&t}else for(n[i++]=255&t,n[i++]=t>>>8&255,n[i++]=t>>>16&255,n[i++]=t>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(t=(new this.Hash).update(t).digest()),i(t.length<=this.blockSize);for(var e=t.length;e>>3},r.g1_256=function(t){return n(t,17)^n(t,19)^t>>>10}},{"../utils":97}],97:[function(t,e,r){var n=t("minimalistic-assert"),i=t("inherits");function o(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function a(t){return 1===t.length?"0"+t:t}function s(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}r.inherits=i,r.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),n=0;n>8,a=255&i;o?r.push(o,a):r.push(a)}else for(n=0;n>>0}return a},r.split32=function(t,e){for(var r=new Array(4*t.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(t,e){return t>>>e|t<<32-e},r.rotl32=function(t,e){return t<>>32-e},r.sum32=function(t,e){return t+e>>>0},r.sum32_3=function(t,e,r){return t+e+r>>>0},r.sum32_4=function(t,e,r,n){return t+e+r+n>>>0},r.sum32_5=function(t,e,r,n,i){return t+e+r+n+i>>>0},r.sum64=function(t,e,r,n){var i=t[e],o=n+t[e+1]>>>0,a=(o>>0,t[e+1]=o},r.sum64_hi=function(t,e,r,n){return(e+n>>>0>>0},r.sum64_lo=function(t,e,r,n){return e+n>>>0},r.sum64_4_hi=function(t,e,r,n,i,o,a,s){var u=0,f=e;return u+=(f=f+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(t,e,r,n,i,o,a,s){return e+n+o+s>>>0},r.sum64_5_hi=function(t,e,r,n,i,o,a,s,u,f){var c=0,h=e;return c+=(h=h+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(t,e,r,n,i,o,a,s,u,f){return e+n+o+s+f>>>0},r.rotr64_hi=function(t,e,r){return(e<<32-r|t>>>r)>>>0},r.rotr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0},r.shr64_hi=function(t,e,r){return t>>>r},r.shr64_lo=function(t,e,r){return(t<<32-r|e>>>r)>>>0}},{inherits:101,"minimalistic-assert":107}],98:[function(t,e,r){var n=t("hash.js"),i=t("minimalistic-crypto-utils"),o=t("minimalistic-assert");function a(t){if(!(this instanceof a))return new a(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=i.toArray(t.entropy,t.entropyEnc||"hex"),r=i.toArray(t.nonce,t.nonceEnc||"hex"),n=i.toArray(t.pers,t.persEnc||"hex");o(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}e.exports=a,a.prototype._init=function(t,e,r){var n=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},a.prototype.generate=function(t,e,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof e&&(n=r,r=e,e=null),r&&(r=i.toArray(r,n||"hex"),this._update(r));for(var o=[];o.length>1,c=-7,h=r?i-1:0,d=r?-1:1,l=t[e+h];for(h+=d,o=l&(1<<-c)-1,l>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=256*a+t[e+h],h+=d,c-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(l?-1:1);a+=Math.pow(2,n),o-=f}return(l?-1:1)*a*Math.pow(2,o-n)},r.write=function(t,e,r,n,i,o){var a,s,u,f=8*o-i-1,c=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,b=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+l]=255&s,l+=p,s/=256,i-=8);for(a=a<0;t[r+l]=255&a,l+=p,a/=256,f-=8);t[r+l-p]|=128*b}},{}],100:[function(t,e,r){var n=[].indexOf;e.exports=function(t,e){if(n)return t.indexOf(e);for(var r=0;r>>32-e}function u(t,e,r,n,i,o,a){return s(t+(e&r|~e&n)+i+o|0,a)+e|0}function f(t,e,r,n,i,o,a){return s(t+(e&n|r&~n)+i+o|0,a)+e|0}function c(t,e,r,n,i,o,a){return s(t+(e^r^n)+i+o|0,a)+e|0}function h(t,e,r,n,i,o,a){return s(t+(r^(e|~n))+i+o|0,a)+e|0}n(a,i),a.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,a=this._d;n=h(n=h(n=h(n=h(n=c(n=c(n=c(n=c(n=f(n=f(n=f(n=f(n=u(n=u(n=u(n=u(n,i=u(i,a=u(a,r=u(r,n,i,a,t[0],3614090360,7),n,i,t[1],3905402710,12),r,n,t[2],606105819,17),a,r,t[3],3250441966,22),i=u(i,a=u(a,r=u(r,n,i,a,t[4],4118548399,7),n,i,t[5],1200080426,12),r,n,t[6],2821735955,17),a,r,t[7],4249261313,22),i=u(i,a=u(a,r=u(r,n,i,a,t[8],1770035416,7),n,i,t[9],2336552879,12),r,n,t[10],4294925233,17),a,r,t[11],2304563134,22),i=u(i,a=u(a,r=u(r,n,i,a,t[12],1804603682,7),n,i,t[13],4254626195,12),r,n,t[14],2792965006,17),a,r,t[15],1236535329,22),i=f(i,a=f(a,r=f(r,n,i,a,t[1],4129170786,5),n,i,t[6],3225465664,9),r,n,t[11],643717713,14),a,r,t[0],3921069994,20),i=f(i,a=f(a,r=f(r,n,i,a,t[5],3593408605,5),n,i,t[10],38016083,9),r,n,t[15],3634488961,14),a,r,t[4],3889429448,20),i=f(i,a=f(a,r=f(r,n,i,a,t[9],568446438,5),n,i,t[14],3275163606,9),r,n,t[3],4107603335,14),a,r,t[8],1163531501,20),i=f(i,a=f(a,r=f(r,n,i,a,t[13],2850285829,5),n,i,t[2],4243563512,9),r,n,t[7],1735328473,14),a,r,t[12],2368359562,20),i=c(i,a=c(a,r=c(r,n,i,a,t[5],4294588738,4),n,i,t[8],2272392833,11),r,n,t[11],1839030562,16),a,r,t[14],4259657740,23),i=c(i,a=c(a,r=c(r,n,i,a,t[1],2763975236,4),n,i,t[4],1272893353,11),r,n,t[7],4139469664,16),a,r,t[10],3200236656,23),i=c(i,a=c(a,r=c(r,n,i,a,t[13],681279174,4),n,i,t[0],3936430074,11),r,n,t[3],3572445317,16),a,r,t[6],76029189,23),i=c(i,a=c(a,r=c(r,n,i,a,t[9],3654602809,4),n,i,t[12],3873151461,11),r,n,t[15],530742520,16),a,r,t[2],3299628645,23),i=h(i,a=h(a,r=h(r,n,i,a,t[0],4096336452,6),n,i,t[7],1126891415,10),r,n,t[14],2878612391,15),a,r,t[5],4237533241,21),i=h(i,a=h(a,r=h(r,n,i,a,t[12],1700485571,6),n,i,t[3],2399980690,10),r,n,t[10],4293915773,15),a,r,t[1],2240044497,21),i=h(i,a=h(a,r=h(r,n,i,a,t[8],1873313359,6),n,i,t[15],4264355552,10),r,n,t[6],2734768916,15),a,r,t[13],1309151649,21),i=h(i,a=h(a,r=h(r,n,i,a,t[4],4149444226,6),n,i,t[11],3174756917,10),r,n,t[2],718787259,15),a,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+a|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=a}).call(this,t("buffer").Buffer)},{buffer:47,"hash-base":105,inherits:101}],105:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("stream").Transform;function o(t){i.call(this),this._block=n.allocUnsafe(t),this._blockSize=t,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}t("inherits")(o,i),o.prototype._transform=function(t,e,r){var n=null;try{this.update(t,e)}catch(t){n=t}r(n)},o.prototype._flush=function(t){var e=null;try{this.push(this.digest())}catch(t){e=t}t(e)},o.prototype.update=function(t,e){if(function(t,e){if(!n.isBuffer(t)&&"string"!=typeof t)throw new TypeError(e+" must be a string or a buffer")}(t,"Data"),this._finalized)throw new Error("Digest already called");n.isBuffer(t)||(t=n.from(t,e));for(var r=this._block,i=0;this._blockOffset+t.length-i>=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},o.prototype._update=function(){throw new Error("_update is not implemented")},o.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();void 0!==t&&(e=e.toString(t)),this._block.fill(0),this._blockOffset=0;for(var r=0;r<4;++r)this._length[r]=0;return e},o.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=o},{inherits:101,"safe-buffer":147,stream:156}],106:[function(t,e,r){var n=t("bn.js"),i=t("brorand");function o(t){this.rand=t||new i.Rand}e.exports=o,o.create=function(t){return new o(t)},o.prototype._randbelow=function(t){var e=t.bitLength(),r=Math.ceil(e/8);do{var i=new n(this.rand.generate(r))}while(i.cmp(t)>=0);return i},o.prototype._randrange=function(t,e){var r=e.sub(t);return t.add(this._randbelow(r))},o.prototype.test=function(t,e,r){var i=t.bitLength(),o=n.mont(t),a=new n(1).toRed(o);e||(e=Math.max(1,i/48|0));for(var s=t.subn(1),u=0;!s.testn(u);u++);for(var f=t.shrn(u),c=s.toRed(o);e>0;e--){var h=this._randrange(new n(2),s);r&&r(h);var d=h.toRed(o).redPow(f);if(0!==d.cmp(a)&&0!==d.cmp(c)){for(var l=1;l0;e--){var c=this._randrange(new n(2),a),h=t.gcd(c);if(0!==h.cmpn(1))return h;var d=c.toRed(i).redPow(u);if(0!==d.cmp(o)&&0!==d.cmp(f)){for(var l=1;l>8,a=255&i;o?r.push(o,a):r.push(a)}return r},n.zero2=i,n.toHex=o,n.encode=function(t,e){return"hex"===e?o(t):t}},{}],109:[function(t,e,r){e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],110:[function(t,e,r){var n=t("asn1.js");r.certificate=t("./certificate");var i=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=i;var o=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=o;var a=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())});r.PublicKey=a;var s=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=n.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(s),this.key("subjectPrivateKey").octstr())});r.PrivateKey=u;var f=n.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=f;var c=n.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=c,r.DSAparam=n.define("DSAparam",function(){this.int()});var h=n.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=h;var d=n.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=n.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":111,"asn1.js":1}],111:[function(t,e,r){var n=t("asn1.js"),i=n.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=n.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),a=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),s=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())}),u=n.define("RelativeDistinguishedName",function(){this.setof(o)}),f=n.define("RDNSequence",function(){this.seqof(u)}),c=n.define("Name",function(){this.choice({rdnSequence:this.use(f)})}),h=n.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),d=n.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),l=n.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(a),this.key("issuer").use(c),this.key("validity").use(h),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(s),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(d).optional())}),p=n.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(l),this.key("signatureAlgorithm").use(a),this.key("signatureValue").bitstr())});e.exports=p},{"asn1.js":1}],112:[function(t,e,r){(function(r){var n=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,i=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,o=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,a=t("evp_bytestokey"),s=t("browserify-aes");e.exports=function(t,e){var u,f=t.toString(),c=f.match(n);if(c){var h="aes"+c[1],d=new r(c[2],"hex"),l=new r(c[3].replace(/\r?\n/g,""),"base64"),p=a(e,d.slice(0,8),parseInt(c[1],10)).key,b=[],m=s.createDecipheriv(h,p,d);b.push(m.update(l)),b.push(m.final()),u=r.concat(b)}else{var y=f.match(o);u=new r(y[2].replace(/\r?\n/g,""),"base64")}return{tag:f.match(i)[1],data:u}}}).call(this,t("buffer").Buffer)},{"browserify-aes":20,buffer:47,evp_bytestokey:84}],113:[function(t,e,r){(function(r){var n=t("./asn1"),i=t("./aesid.json"),o=t("./fixProc"),a=t("browserify-aes"),s=t("pbkdf2");function u(t){var e;"object"!==(void 0===t?"undefined":_typeof(t))||r.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=new r(t));var u,f,c,h,d,l,p,b,m,y,v,g,w,_=o(t,e),M=_.tag,x=_.data;switch(M){case"CERTIFICATE":f=n.certificate.decode(x,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(f||(f=n.PublicKey.decode(x,"der")),u=f.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(f.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return f.subjectPrivateKey=f.subjectPublicKey,{type:"ec",data:f};case"1.2.840.10040.4.1":return f.algorithm.params.pub_key=n.DSAparam.decode(f.subjectPublicKey.data,"der"),{type:"dsa",data:f.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+M);case"ENCRYPTED PRIVATE KEY":x=n.EncryptedPrivateKey.decode(x,"der"),h=e,d=(c=x).algorithm.decrypt.kde.kdeparams.salt,l=parseInt(c.algorithm.decrypt.kde.kdeparams.iters.toString(),10),p=i[c.algorithm.decrypt.cipher.algo.join(".")],b=c.algorithm.decrypt.cipher.iv,m=c.subjectPrivateKey,y=parseInt(p.split("-")[1],10)/8,v=s.pbkdf2Sync(h,d,l,y),g=a.createDecipheriv(p,v,b),(w=[]).push(g.update(m)),w.push(g.final()),x=r.concat(w);case"PRIVATE KEY":switch(u=(f=n.PrivateKey.decode(x,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(f.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:f.algorithm.curve,privateKey:n.ECPrivateKey.decode(f.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return f.algorithm.params.priv_key=n.DSAparam.decode(f.subjectPrivateKey,"der"),{type:"dsa",params:f.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+M);case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(x,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(x,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(x,"der")};case"EC PRIVATE KEY":return{curve:(x=n.ECPrivateKey.decode(x,"der")).parameters.value,privateKey:x.privateKey};default:throw new Error("unknown key type "+M)}}e.exports=u,u.signature=n.signature}).call(this,t("buffer").Buffer)},{"./aesid.json":109,"./asn1":110,"./fixProc":112,"browserify-aes":20,buffer:47,pbkdf2:114}],114:[function(t,e,r){r.pbkdf2=t("./lib/async"),r.pbkdf2Sync=t("./lib/sync")},{"./lib/async":115,"./lib/sync":118}],115:[function(t,e,r){(function(r,n){var i,o=t("./precondition"),a=t("./default-encoding"),s=t("./sync"),u=t("safe-buffer").Buffer,f=n.crypto&&n.crypto.subtle,c={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},h=[];function d(t,e,r,n,i){return f.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(t){return f.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)}).then(function(t){return u.from(t)})}e.exports=function(t,e,l,p,b,m){if(u.isBuffer(t)||(t=u.from(t,a)),u.isBuffer(e)||(e=u.from(e,a)),o(l,p),"function"==typeof b&&(m=b,b=void 0),"function"!=typeof m)throw new Error("No callback provided to pbkdf2");var y,v,g=c[(b=b||"sha1").toLowerCase()];if(!g||"function"!=typeof n.Promise)return r.nextTick(function(){var r;try{r=s(t,e,l,p,b)}catch(t){return m(t)}m(null,r)});y=function(t){if(n.process&&!n.process.browser)return Promise.resolve(!1);if(!f||!f.importKey||!f.deriveBits)return Promise.resolve(!1);if(void 0!==h[t])return h[t];var e=d(i=i||u.alloc(8),i,10,128,t).then(function(){return!0}).catch(function(){return!1});return h[t]=e,e}(g).then(function(r){return r?d(t,e,l,p,g):s(t,e,l,p,b)}),v=m,y.then(function(t){r.nextTick(function(){v(null,t)})},function(t){r.nextTick(function(){v(t)})})}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-encoding":116,"./precondition":117,"./sync":118,_process:120,"safe-buffer":147}],116:[function(t,e,r){(function(t){var r;t.browser?r="utf-8":r=parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";e.exports=r}).call(this,t("_process"))},{_process:120}],117:[function(t,e,r){var n=Math.pow(2,30)-1;e.exports=function(t,e){if("number"!=typeof t)throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if("number"!=typeof e)throw new TypeError("Key length not a number");if(e<0||e>n||e!=e)throw new TypeError("Bad key length")}},{}],118:[function(t,e,r){var n=t("create-hash/md5"),i=t("ripemd160"),o=t("sha.js"),a=t("./precondition"),s=t("./default-encoding"),u=t("safe-buffer").Buffer,f=u.alloc(128),c={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function h(t,e,r){var a=function(t){return"rmd160"===t||"ripemd160"===t?i:"md5"===t?n:function(e){return o(t).update(e).digest()}}(t),s="sha512"===t||"sha384"===t?128:64;e.length>s?e=a(e):e.length1)for(var r=1;rp||new a(e).cmp(l.modulus)>=0)throw new Error("decryption error");d=c?f(new a(e),l):s(e,l);var b=new r(p-d.length);if(b.fill(0),d=r.concat([b,d],p),4===h)return function(t,e){t.modulus;var n=t.modulus.byteLength(),a=(e.length,u("sha1").update(new r("")).digest()),s=a.length;if(0!==e[0])throw new Error("decryption error");var f=e.slice(1,s+1),c=e.slice(s+1),h=o(f,i(c,s)),d=o(c,i(h,n-s-1));if(function(t,e){t=new r(t),e=new r(e);var n=0,i=t.length;t.length!==e.length&&(n++,i=Math.min(t.length,e.length));var o=-1;for(;++o=e.length){o++;break}var a=e.slice(2,i-1);e.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,d,c);if(3===h)return d;throw new Error("unknown padding")}}).call(this,t("buffer").Buffer)},{"./mgf":122,"./withPublic":125,"./xor":126,"bn.js":"BN","browserify-rsa":38,buffer:47,"create-hash":51,"parse-asn1":113}],124:[function(t,e,r){(function(r){var n=t("parse-asn1"),i=t("randombytes"),o=t("create-hash"),a=t("./mgf"),s=t("./xor"),u=t("bn.js"),f=t("./withPublic"),c=t("browserify-rsa");e.exports=function(t,e,h){var d;d=t.padding?t.padding:h?1:4;var l,p=n(t);if(4===d)l=function(t,e){var n=t.modulus.byteLength(),f=e.length,c=o("sha1").update(new r("")).digest(),h=c.length,d=2*h;if(f>n-d-2)throw new Error("message too long");var l=new r(n-f-d-2);l.fill(0);var p=n-h-1,b=i(h),m=s(r.concat([c,l,new r([1]),e],p),a(b,p)),y=s(b,a(m,h));return new u(r.concat([new r([0]),y,m],n))}(p,e);else if(1===d)l=function(t,e,n){var o,a=e.length,s=t.modulus.byteLength();if(a>s-11)throw new Error("message too long");n?(o=new r(s-a-3)).fill(255):o=function(t,e){var n,o=new r(t),a=0,s=i(2*t),u=0;for(;a=0)throw new Error("data too long for modulus")}return h?c(l,p):f(l,p)}}).call(this,t("buffer").Buffer)},{"./mgf":122,"./withPublic":125,"./xor":126,"bn.js":"BN","browserify-rsa":38,buffer:47,"create-hash":51,"parse-asn1":113,randombytes:131}],125:[function(t,e,r){(function(r){var n=t("bn.js");e.exports=function(t,e){return new r(t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed().toArray())}}).call(this,t("buffer").Buffer)},{"bn.js":"BN",buffer:47}],126:[function(t,e,r){e.exports=function(t,e){for(var r=t.length,n=-1;++n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},M=c-h,x=Math.floor,k=String.fromCharCode;function S(t){throw new RangeError(_[t])}function E(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function A(t,e){var r=t.split("@"),n="";return r.length>1&&(n=r[0]+"@",t=r[1]),n+E((t=t.replace(w,".")).split("."),e).join(".")}function j(t){for(var e,r,n=[],i=0,o=t.length;i=55296&&e<=56319&&i65535&&(e+=k((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=k(t)}).join("")}function B(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function T(t,e,r){var n=0;for(t=r?x(t/p):t>>1,t+=x(t/e);t>M*d>>1;n+=c)t=x(t/M);return x(n+(M+1)*t/(t+l))}function C(t){var e,r,n,i,o,a,s,u,l,p,v,g=[],w=t.length,_=0,M=m,k=b;for((r=t.lastIndexOf(y))<0&&(r=0),n=0;n=128&&S("not-basic"),g.push(t.charCodeAt(n));for(i=r>0?r+1:0;i=w&&S("invalid-input"),((u=(v=t.charCodeAt(i++))-48<10?v-22:v-65<26?v-65:v-97<26?v-97:c)>=c||u>x((f-_)/a))&&S("overflow"),_+=u*a,!(u<(l=s<=k?h:s>=k+d?d:s-k));s+=c)a>x(f/(p=c-l))&&S("overflow"),a*=p;k=T(_-o,e=g.length+1,0==o),x(_/e)>f-M&&S("overflow"),M+=x(_/e),_%=e,g.splice(_++,0,M)}return I(g)}function P(t){var e,r,n,i,o,a,s,u,l,p,v,g,w,_,M,E=[];for(g=(t=j(t)).length,e=m,r=0,o=b,a=0;a=e&&vx((f-r)/(w=n+1))&&S("overflow"),r+=(s-e)*w,e=s,a=0;af&&S("overflow"),v==e){for(u=r,l=c;!(u<(p=l<=o?h:l>=o+d?d:l-o));l+=c)M=u-p,_=c-p,E.push(k(B(p+M%_,0))),u=x(M/_);E.push(k(B(u,0))),o=T(r,w,n==i),r=0,++n}++r,++e}return E.join("")}if(s={version:"1.4.1",ucs2:{decode:j,encode:I},decode:C,encode:P,toASCII:function(t){return A(t,function(t){return g.test(t)?"xn--"+P(t):t})},toUnicode:function(t){return A(t,function(t){return v.test(t)?C(t.slice(4).toLowerCase()):t})}},"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define("punycode",function(){return s});else if(i&&o)if(e.exports==i)o.exports=s;else for(u in s)s.hasOwnProperty(u)&&(i[u]=s[u]);else n.punycode=s}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],128:[function(t,e,r){e.exports=function(t,e,r,i){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var a=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var u,f,c=t.length;s>0&&c>s&&(c=s);for(var h=0;h=0?(d=m.substr(0,y),l=m.substr(y+1)):(d=m,l=""),p=decodeURIComponent(d),b=decodeURIComponent(l),u=o,f=p,Object.prototype.hasOwnProperty.call(u,f)?n(o[p])?o[p].push(b):o[p]=[o[p],b]:o[p]=b}return o};var n=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],129:[function(t,e,r){var n=function(t){switch(void 0===t?"undefined":_typeof(t)){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,r,s){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"===(void 0===t?"undefined":_typeof(t))?o(a(t),function(a){var s=encodeURIComponent(n(a))+r;return i(t[a])?o(t[a],function(t){return s+encodeURIComponent(n(t))}).join(e):s+encodeURIComponent(n(t[a]))}).join(e):s?encodeURIComponent(n(s))+r+encodeURIComponent(n(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function o(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n65536)throw new Error("requested too many random bytes");var a=new n.Uint8Array(t);t>0&&o.getRandomValues(a);var s=i.from(a.buffer);if("function"==typeof e)return r.nextTick(function(){e(null,s)});return s}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:120,"safe-buffer":147}],132:[function(t,e,r){(function(e,n){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=t("safe-buffer"),a=t("randombytes"),s=o.Buffer,u=o.kMaxLength,f=n.crypto||n.msCrypto,c=Math.pow(2,32)-1;function h(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>c||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function d(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>c||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function l(t,r,n,i){if(e.browser){var o=t.buffer,s=new Uint8Array(o,r,n);return f.getRandomValues(s),i?void e.nextTick(function(){i(null,t)}):t}if(!i)return a(n).copy(t,r),t;a(n,function(e,n){if(e)return i(e);n.copy(t,r),i(null,t)})}f&&f.getRandomValues||!e.browser?(r.randomFill=function(t,e,r,i){if(!(s.isBuffer(t)||t instanceof n.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)i=e,e=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-e;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return h(e,t.length),d(r,e,t.length),l(t,e,r,i)},r.randomFillSync=function(t,e,r){void 0===e&&(e=0);if(!(s.isBuffer(t)||t instanceof n.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');h(e,t.length),void 0===r&&(r=t.length-e);return d(r,e,t.length),l(t,e,r)}):(r.randomFill=i,r.randomFillSync=i)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:120,randombytes:131,"safe-buffer":147}],133:[function(t,e,r){e.exports=t("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":134}],134:[function(t,e,r){var n=t("process-nextick-args").nextTick,i=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};e.exports=h;var o=t("core-util-is");o.inherits=t("inherits");var a=t("./_stream_readable"),s=t("./_stream_writable");o.inherits(h,a);for(var u=i(s.prototype),f=0;f0?("string"==typeof e||u.objectMode||Object.getPrototypeOf(e)===f.prototype||(a=e,e=f.from(a)),n?u.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):_(t,u,e,!0):u.ended?t.emit("error",new Error("stream.push() after EOF")):(u.reading=!1,u.decoder&&!r?(e=u.decoder.write(e),u.objectMode||0!==e.length?_(t,u,e,!1):E(t,u)):_(t,u,e,!1))):n||(u.reading=!1));return!(s=u).ended&&(s.needReadable||s.lengthe.highWaterMark&&(e.highWaterMark=((r=t)>=M?r=M:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),r)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0));var r}function k(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?i(S,t):S(t))}function S(t){l("emit readable"),t.emit("readable"),B(t)}function E(t,e){e.readingMore||(e.readingMore=!0,i(A,t,e))}function A(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var n;to.length?o.length:t;if(a===o.length?i+=o:i+=o.slice(0,t),0===(t-=a)){a===o.length?(++n,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=o.slice(a));break}++n}return e.length-=n,i}(t,e):function(t,e){var r=f.allocUnsafe(t),n=e.head,i=1;n.data.copy(r),t-=n.data.length;for(;n=n.next;){var o=n.data,a=t>o.length?o.length:t;if(o.copy(r,r.length-t,0,a),0===(t-=a)){a===o.length?(++i,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=o.slice(a));break}++i}return e.length-=i,r}(t,e);return n}(t,e.buffer,e.decoder),r);var r}function C(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,i(P,e,t))}function P(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function R(t,e){for(var r=0,n=t.length;r=e.highWaterMark||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?C(this):k(this),null;if(0===(t=x(t,e))&&e.ended)return 0===e.length&&C(this),null;var n,i=e.needReadable;return l("need readable",i),(0===e.length||e.length-t0?T(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&C(this)),null!==n&&this.emit("data",n),n},g.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},g.prototype.pipe=function(t,e){var n=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,l("pipe count=%d opts=%j",o.pipesCount,e);var u=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?c:w;function f(e,r){l("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,l("cleanup"),t.removeListener("close",v),t.removeListener("finish",g),t.removeListener("drain",d),t.removeListener("error",y),t.removeListener("unpipe",f),n.removeListener("end",c),n.removeListener("end",w),n.removeListener("data",m),p=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||d())}function c(){l("onend"),t.end()}o.endEmitted?i(u):n.once("end",u),t.on("unpipe",f);var h,d=(h=n,function(){var t=h._readableState;l("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&s(h,"data")&&(t.flowing=!0,B(h))});t.on("drain",d);var p=!1;var b=!1;function m(e){l("ondata"),b=!1,!1!==t.write(e)||b||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==R(o.pipes,t))&&!p&&(l("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,b=!0),n.pause())}function y(e){l("onerror",e),w(),t.removeListener("error",y),0===s(t,"error")&&t.emit("error",e)}function v(){t.removeListener("finish",g),w()}function g(){l("onfinish"),t.removeListener("close",v),w()}function w(){l("unpipe"),n.unpipe(t)}return n.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?a(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",y),t.once("close",v),t.once("finish",g),t.emit("pipe",n),o.flowing||(l("pipe resume"),n.resume()),t},g.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes?this:(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r),this);if(!t){var n=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var o=0;o-1?setImmediate:i;y.WritableState=m;var u=t("core-util-is");u.inherits=t("inherits");var f={deprecate:t("util-deprecate")},c=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,d=n.Uint8Array||function(){};var l,p=t("./internal/streams/destroy");function b(){}function m(e,r){a=a||t("./_stream_duplex"),e=e||{};var n=r instanceof a;this.objectMode=!!e.objectMode,n&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var u=e.highWaterMark,f=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=u||0===u?u:n&&(f||0===f)?f:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,n=r.sync,o=r.writecb;if(l=r,l.writing=!1,l.writecb=null,l.length-=l.writelen,l.writelen=0,e)u=t,f=r,c=n,h=e,d=o,--f.pendingcb,c?(i(d,h),i(x,u,f),u._writableState.errorEmitted=!0,u.emit("error",h)):(d(h),u._writableState.errorEmitted=!0,u.emit("error",h),x(u,f));else{var a=_(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||w(t,r),n?s(g,t,r,a,o):g(t,r,a,o)}var u,f,c,h,d;var l}(r,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function y(e){if(a=a||t("./_stream_duplex"),!(l.call(y,this)||this instanceof a))return new y(e);this._writableState=new m(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),c.call(this)}function v(t,e,r,n,i,o,a){e.writelen=n,e.writecb=a,e.writing=!0,e.sync=!0,r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function g(t,e,r,n){var i,o;r||(i=t,0===(o=e).length&&o.needDrain&&(o.needDrain=!1,i.emit("drain"))),e.pendingcb--,n(),x(t,e)}function w(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var n=e.bufferedRequestCount,i=new Array(n),a=e.corkedRequestsFree;a.entry=r;for(var s=0,u=!0;r;)i[s]=r,r.isBuf||(u=!1),r=r.next,s+=1;i.allBuffers=u,v(t,e,!0,e.length,i,"",a.finish),e.pendingcb++,e.lastBufferedRequest=null,a.next?(e.corkedRequestsFree=a.next,a.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var f=r.chunk,c=r.encoding,h=r.callback;if(v(t,e,!1,e.objectMode?1:f.length,f,c,h),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function _(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function M(t,e){t._final(function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),x(t,e)})}function x(t,e){var r,n,o=_(e);return o&&(r=t,(n=e).prefinished||n.finalCalled||("function"==typeof r._final?(n.pendingcb++,n.finalCalled=!0,i(M,r,n)):(n.prefinished=!0,r.emit("prefinish"))),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),o}u.inherits(y,c),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:f.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(l=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!l.call(this,t)||this===y&&(t&&t._writableState instanceof m)}})):l=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var n,o,a,s,u,f,c,l,p,m,y,g=this._writableState,w=!1,_=!g.objectMode&&(n=t,h.isBuffer(n)||n instanceof d);return _&&!h.isBuffer(t)&&(o=t,t=h.from(o)),"function"==typeof e&&(r=e,e=null),_?e="buffer":e||(e=g.defaultEncoding),"function"!=typeof r&&(r=b),g.ended?(p=this,m=r,y=new Error("write after end"),p.emit("error",y),i(m,y)):(_||(a=this,s=g,f=r,c=!0,l=!1,null===(u=t)?l=new TypeError("May not write null values to stream"):"string"==typeof u||void 0===u||s.objectMode||(l=new TypeError("Invalid non-string/buffer chunk")),l&&(a.emit("error",l),i(f,l),c=!1),c))&&(g.pendingcb++,w=function(t,e,r,n,i,o){if(!r){var a=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,r));return e}(e,n,i);n!==a&&(r=!0,i="buffer",n=a)}var s=e.objectMode?1:n.length;e.length+=s;var u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var n=this._writableState;"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||function(t,e,r){e.ending=!0,x(t,e),r&&(e.finished?i(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,n,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=p.destroy,y.prototype._undestroy=p.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":134,"./internal/streams/destroy":140,"./internal/streams/stream":141,_process:120,"core-util-is":49,inherits:101,"process-nextick-args":119,"safe-buffer":147,"util-deprecate":160}],139:[function(t,e,r){var n=t("safe-buffer").Buffer,i=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r},t.prototype.concat=function(t){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var e,r,i,o=n.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,r=o,i=s,e.copy(r,i),s+=a.data.length,a=a.next;return o},t}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var t=i.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":147,util:17}],140:[function(t,e,r){var n=t("process-nextick-args").nextTick;function i(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var r=this,o=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return o||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||n(i,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!e&&t?(n(i,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":119}],141:[function(t,e,r){e.exports=t("events").EventEmitter},{events:83}],142:[function(t,e,r){e.exports=t("./readable").PassThrough},{"./readable":143}],143:[function(t,e,r){(r=e.exports=t("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=t("./lib/_stream_writable.js"),r.Duplex=t("./lib/_stream_duplex.js"),r.Transform=t("./lib/_stream_transform.js"),r.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":134,"./lib/_stream_passthrough.js":135,"./lib/_stream_readable.js":136,"./lib/_stream_transform.js":137,"./lib/_stream_writable.js":138}],144:[function(t,e,r){e.exports=t("./readable").Transform},{"./readable":143}],145:[function(t,e,r){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":138}],146:[function(t,e,r){(function(r){var n=t("inherits"),i=t("hash-base");function o(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function a(t,e){return t<>>32-e}function s(t,e,r,n,i,o,s,u){return a(t+(e^r^n)+o+s|0,u)+i|0}function u(t,e,r,n,i,o,s,u){return a(t+(e&r|~e&n)+o+s|0,u)+i|0}function f(t,e,r,n,i,o,s,u){return a(t+((e|~r)^n)+o+s|0,u)+i|0}function c(t,e,r,n,i,o,s,u){return a(t+(e&n|r&~n)+o+s|0,u)+i|0}function h(t,e,r,n,i,o,s,u){return a(t+(e^(r|~n))+o+s|0,u)+i|0}n(o,i),o.prototype._update=function(){for(var t=new Array(16),e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d,d=this._e;d=s(d,r=s(r,n,i,o,d,t[0],0,11),n,i=a(i,10),o,t[1],0,14),n=s(n=a(n,10),i=s(i,o=s(o,d,r,n,i,t[2],0,15),d,r=a(r,10),n,t[3],0,12),o,d=a(d,10),r,t[4],0,5),o=s(o=a(o,10),d=s(d,r=s(r,n,i,o,d,t[5],0,8),n,i=a(i,10),o,t[6],0,7),r,n=a(n,10),i,t[7],0,9),r=s(r=a(r,10),n=s(n,i=s(i,o,d,r,n,t[8],0,11),o,d=a(d,10),r,t[9],0,13),i,o=a(o,10),d,t[10],0,14),i=s(i=a(i,10),o=s(o,d=s(d,r,n,i,o,t[11],0,15),r,n=a(n,10),i,t[12],0,6),d,r=a(r,10),n,t[13],0,7),d=u(d=a(d,10),r=s(r,n=s(n,i,o,d,r,t[14],0,9),i,o=a(o,10),d,t[15],0,8),n,i=a(i,10),o,t[7],1518500249,7),n=u(n=a(n,10),i=u(i,o=u(o,d,r,n,i,t[4],1518500249,6),d,r=a(r,10),n,t[13],1518500249,8),o,d=a(d,10),r,t[1],1518500249,13),o=u(o=a(o,10),d=u(d,r=u(r,n,i,o,d,t[10],1518500249,11),n,i=a(i,10),o,t[6],1518500249,9),r,n=a(n,10),i,t[15],1518500249,7),r=u(r=a(r,10),n=u(n,i=u(i,o,d,r,n,t[3],1518500249,15),o,d=a(d,10),r,t[12],1518500249,7),i,o=a(o,10),d,t[0],1518500249,12),i=u(i=a(i,10),o=u(o,d=u(d,r,n,i,o,t[9],1518500249,15),r,n=a(n,10),i,t[5],1518500249,9),d,r=a(r,10),n,t[2],1518500249,11),d=u(d=a(d,10),r=u(r,n=u(n,i,o,d,r,t[14],1518500249,7),i,o=a(o,10),d,t[11],1518500249,13),n,i=a(i,10),o,t[8],1518500249,12),n=f(n=a(n,10),i=f(i,o=f(o,d,r,n,i,t[3],1859775393,11),d,r=a(r,10),n,t[10],1859775393,13),o,d=a(d,10),r,t[14],1859775393,6),o=f(o=a(o,10),d=f(d,r=f(r,n,i,o,d,t[4],1859775393,7),n,i=a(i,10),o,t[9],1859775393,14),r,n=a(n,10),i,t[15],1859775393,9),r=f(r=a(r,10),n=f(n,i=f(i,o,d,r,n,t[8],1859775393,13),o,d=a(d,10),r,t[1],1859775393,15),i,o=a(o,10),d,t[2],1859775393,14),i=f(i=a(i,10),o=f(o,d=f(d,r,n,i,o,t[7],1859775393,8),r,n=a(n,10),i,t[0],1859775393,13),d,r=a(r,10),n,t[6],1859775393,6),d=f(d=a(d,10),r=f(r,n=f(n,i,o,d,r,t[13],1859775393,5),i,o=a(o,10),d,t[11],1859775393,12),n,i=a(i,10),o,t[5],1859775393,7),n=c(n=a(n,10),i=c(i,o=f(o,d,r,n,i,t[12],1859775393,5),d,r=a(r,10),n,t[1],2400959708,11),o,d=a(d,10),r,t[9],2400959708,12),o=c(o=a(o,10),d=c(d,r=c(r,n,i,o,d,t[11],2400959708,14),n,i=a(i,10),o,t[10],2400959708,15),r,n=a(n,10),i,t[0],2400959708,14),r=c(r=a(r,10),n=c(n,i=c(i,o,d,r,n,t[8],2400959708,15),o,d=a(d,10),r,t[12],2400959708,9),i,o=a(o,10),d,t[4],2400959708,8),i=c(i=a(i,10),o=c(o,d=c(d,r,n,i,o,t[13],2400959708,9),r,n=a(n,10),i,t[3],2400959708,14),d,r=a(r,10),n,t[7],2400959708,5),d=c(d=a(d,10),r=c(r,n=c(n,i,o,d,r,t[15],2400959708,6),i,o=a(o,10),d,t[14],2400959708,8),n,i=a(i,10),o,t[5],2400959708,6),n=h(n=a(n,10),i=c(i,o=c(o,d,r,n,i,t[6],2400959708,5),d,r=a(r,10),n,t[2],2400959708,12),o,d=a(d,10),r,t[4],2840853838,9),o=h(o=a(o,10),d=h(d,r=h(r,n,i,o,d,t[0],2840853838,15),n,i=a(i,10),o,t[5],2840853838,5),r,n=a(n,10),i,t[9],2840853838,11),r=h(r=a(r,10),n=h(n,i=h(i,o,d,r,n,t[7],2840853838,6),o,d=a(d,10),r,t[12],2840853838,8),i,o=a(o,10),d,t[2],2840853838,13),i=h(i=a(i,10),o=h(o,d=h(d,r,n,i,o,t[10],2840853838,12),r,n=a(n,10),i,t[14],2840853838,5),d,r=a(r,10),n,t[1],2840853838,12),d=h(d=a(d,10),r=h(r,n=h(n,i,o,d,r,t[3],2840853838,13),i,o=a(o,10),d,t[8],2840853838,14),n,i=a(i,10),o,t[11],2840853838,11),n=h(n=a(n,10),i=h(i,o=h(o,d,r,n,i,t[6],2840853838,8),d,r=a(r,10),n,t[15],2840853838,5),o,d=a(d,10),r,t[13],2840853838,6),o=a(o,10);var l=this._a,p=this._b,b=this._c,m=this._d,y=this._e;y=h(y,l=h(l,p,b,m,y,t[5],1352829926,8),p,b=a(b,10),m,t[14],1352829926,9),p=h(p=a(p,10),b=h(b,m=h(m,y,l,p,b,t[7],1352829926,9),y,l=a(l,10),p,t[0],1352829926,11),m,y=a(y,10),l,t[9],1352829926,13),m=h(m=a(m,10),y=h(y,l=h(l,p,b,m,y,t[2],1352829926,15),p,b=a(b,10),m,t[11],1352829926,15),l,p=a(p,10),b,t[4],1352829926,5),l=h(l=a(l,10),p=h(p,b=h(b,m,y,l,p,t[13],1352829926,7),m,y=a(y,10),l,t[6],1352829926,7),b,m=a(m,10),y,t[15],1352829926,8),b=h(b=a(b,10),m=h(m,y=h(y,l,p,b,m,t[8],1352829926,11),l,p=a(p,10),b,t[1],1352829926,14),y,l=a(l,10),p,t[10],1352829926,14),y=c(y=a(y,10),l=h(l,p=h(p,b,m,y,l,t[3],1352829926,12),b,m=a(m,10),y,t[12],1352829926,6),p,b=a(b,10),m,t[6],1548603684,9),p=c(p=a(p,10),b=c(b,m=c(m,y,l,p,b,t[11],1548603684,13),y,l=a(l,10),p,t[3],1548603684,15),m,y=a(y,10),l,t[7],1548603684,7),m=c(m=a(m,10),y=c(y,l=c(l,p,b,m,y,t[0],1548603684,12),p,b=a(b,10),m,t[13],1548603684,8),l,p=a(p,10),b,t[5],1548603684,9),l=c(l=a(l,10),p=c(p,b=c(b,m,y,l,p,t[10],1548603684,11),m,y=a(y,10),l,t[14],1548603684,7),b,m=a(m,10),y,t[15],1548603684,7),b=c(b=a(b,10),m=c(m,y=c(y,l,p,b,m,t[8],1548603684,12),l,p=a(p,10),b,t[12],1548603684,7),y,l=a(l,10),p,t[4],1548603684,6),y=c(y=a(y,10),l=c(l,p=c(p,b,m,y,l,t[9],1548603684,15),b,m=a(m,10),y,t[1],1548603684,13),p,b=a(b,10),m,t[2],1548603684,11),p=f(p=a(p,10),b=f(b,m=f(m,y,l,p,b,t[15],1836072691,9),y,l=a(l,10),p,t[5],1836072691,7),m,y=a(y,10),l,t[1],1836072691,15),m=f(m=a(m,10),y=f(y,l=f(l,p,b,m,y,t[3],1836072691,11),p,b=a(b,10),m,t[7],1836072691,8),l,p=a(p,10),b,t[14],1836072691,6),l=f(l=a(l,10),p=f(p,b=f(b,m,y,l,p,t[6],1836072691,6),m,y=a(y,10),l,t[9],1836072691,14),b,m=a(m,10),y,t[11],1836072691,12),b=f(b=a(b,10),m=f(m,y=f(y,l,p,b,m,t[8],1836072691,13),l,p=a(p,10),b,t[12],1836072691,5),y,l=a(l,10),p,t[2],1836072691,14),y=f(y=a(y,10),l=f(l,p=f(p,b,m,y,l,t[10],1836072691,13),b,m=a(m,10),y,t[0],1836072691,13),p,b=a(b,10),m,t[4],1836072691,7),p=u(p=a(p,10),b=u(b,m=f(m,y,l,p,b,t[13],1836072691,5),y,l=a(l,10),p,t[8],2053994217,15),m,y=a(y,10),l,t[6],2053994217,5),m=u(m=a(m,10),y=u(y,l=u(l,p,b,m,y,t[4],2053994217,8),p,b=a(b,10),m,t[1],2053994217,11),l,p=a(p,10),b,t[3],2053994217,14),l=u(l=a(l,10),p=u(p,b=u(b,m,y,l,p,t[11],2053994217,14),m,y=a(y,10),l,t[15],2053994217,6),b,m=a(m,10),y,t[0],2053994217,14),b=u(b=a(b,10),m=u(m,y=u(y,l,p,b,m,t[5],2053994217,6),l,p=a(p,10),b,t[12],2053994217,9),y,l=a(l,10),p,t[2],2053994217,12),y=u(y=a(y,10),l=u(l,p=u(p,b,m,y,l,t[13],2053994217,9),b,m=a(m,10),y,t[9],2053994217,12),p,b=a(b,10),m,t[7],2053994217,5),p=s(p=a(p,10),b=u(b,m=u(m,y,l,p,b,t[10],2053994217,15),y,l=a(l,10),p,t[14],2053994217,8),m,y=a(y,10),l,t[12],0,8),m=s(m=a(m,10),y=s(y,l=s(l,p,b,m,y,t[15],0,5),p,b=a(b,10),m,t[10],0,12),l,p=a(p,10),b,t[4],0,9),l=s(l=a(l,10),p=s(p,b=s(b,m,y,l,p,t[1],0,12),m,y=a(y,10),l,t[5],0,5),b,m=a(m,10),y,t[8],0,14),b=s(b=a(b,10),m=s(m,y=s(y,l,p,b,m,t[7],0,6),l,p=a(p,10),b,t[6],0,8),y,l=a(l,10),p,t[2],0,13),y=s(y=a(y,10),l=s(l,p=s(p,b,m,y,l,t[13],0,6),b,m=a(m,10),y,t[14],0,5),p,b=a(b,10),m,t[0],0,15),p=s(p=a(p,10),b=s(b,m=s(m,y,l,p,b,t[3],0,13),y,l=a(l,10),p,t[9],0,11),m,y=a(y,10),l,t[11],0,11),m=a(m,10);var v=this._b+i+m|0;this._b=this._c+o+y|0,this._c=this._d+d+l|0,this._d=this._e+r+p|0,this._e=this._a+n+b|0,this._a=v},o.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=o}).call(this,t("buffer").Buffer)},{buffer:47,"hash-base":85,inherits:101}],147:[function(t,e,r){var n=t("buffer"),i=n.Buffer;function o(t,e){for(var r in t)e[r]=t[r]}function a(t,e,r){return i(t,e,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,r),r.Buffer=a),o(i,a),a.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,r)},a.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var n=i(t);return void 0!==e?"string"==typeof r?n.fill(e,r):n.fill(e):n.fill(0),n},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n.SlowBuffer(t)}},{buffer:47}],148:[function(t,e,r){var n=t("safe-buffer").Buffer;function i(t,e){this._block=n.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}i.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=n.from(t,e));for(var r=this._block,i=this._blockSize,o=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i},{"safe-buffer":147}],149:[function(t,e,r){(r=e.exports=function(t){t=t.toLowerCase();var e=r[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e}).sha=t("./sha"),r.sha1=t("./sha1"),r.sha224=t("./sha224"),r.sha256=t("./sha256"),r.sha384=t("./sha384"),r.sha512=t("./sha512")},{"./sha":150,"./sha1":151,"./sha224":152,"./sha256":153,"./sha384":154,"./sha512":155}],150:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r,n,i,o,s,u=this._w,f=0|this._a,c=0|this._b,h=0|this._c,d=0|this._d,l=0|this._e,p=0;p<16;++p)u[p]=t.readInt32BE(4*p);for(;p<80;++p)u[p]=u[p-3]^u[p-8]^u[p-14]^u[p-16];for(var b=0;b<80;++b){var m=~~(b/20),y=0|((s=f)<<5|s>>>27)+(n=c,i=h,o=d,0===(r=m)?n&i|~n&o:2===r?n&i|n&o|i&o:n^i^o)+l+u[b]+a[m];l=d,d=h,h=(e=c)<<30|e>>>2,c=f,f=y}this._a=f+this._a|0,this._b=c+this._b|0,this._c=h+this._c|0,this._d=d+this._d|0,this._e=l+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=u},{"./hash":148,inherits:101,"safe-buffer":147}],151:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function u(){this.init(),this._w=s,i.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},u.prototype._update=function(t){for(var e,r,n,i,o,s,u,f=this._w,c=0|this._a,h=0|this._b,d=0|this._c,l=0|this._d,p=0|this._e,b=0;b<16;++b)f[b]=t.readInt32BE(4*b);for(;b<80;++b)f[b]=(e=f[b-3]^f[b-8]^f[b-14]^f[b-16])<<1|e>>>31;for(var m=0;m<80;++m){var y=~~(m/20),v=0|((u=c)<<5|u>>>27)+(i=h,o=d,s=l,0===(n=y)?i&o|~i&s:2===n?i&o|i&s|o&s:i^o^s)+p+f[m]+a[y];p=l,l=d,d=(r=h)<<30|r>>>2,h=c,c=v}this._a=c+this._a|0,this._b=h+this._b|0,this._c=d+this._c|0,this._d=l+this._d|0,this._e=p+this._e|0},u.prototype._hash=function(){var t=o.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t},e.exports=u},{"./hash":148,inherits:101,"safe-buffer":147}],152:[function(t,e,r){var n=t("inherits"),i=t("./sha256"),o=t("./hash"),a=t("safe-buffer").Buffer,s=new Array(64);function u(){this.init(),this._w=s,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t},e.exports=u},{"./hash":148,"./sha256":153,inherits:101,"safe-buffer":147}],153:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function u(){this.init(),this._w=s,i.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},u.prototype._update=function(t){for(var e,r,n,i,o,s,u,f=this._w,c=0|this._a,h=0|this._b,d=0|this._c,l=0|this._d,p=0|this._e,b=0|this._f,m=0|this._g,y=0|this._h,v=0;v<16;++v)f[v]=t.readInt32BE(4*v);for(;v<64;++v)f[v]=0|(((r=f[v-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)+f[v-7]+(((e=f[v-15])>>>7|e<<25)^(e>>>18|e<<14)^e>>>3)+f[v-16];for(var g=0;g<64;++g){var w=y+(((u=p)>>>6|u<<26)^(u>>>11|u<<21)^(u>>>25|u<<7))+((s=m)^p&(b^s))+a[g]+f[g]|0,_=0|(((o=c)>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((n=c)&(i=h)|d&(n|i));y=m,m=b,b=p,p=l+w|0,l=d,d=h,h=c,c=w+_|0}this._a=c+this._a|0,this._b=h+this._b|0,this._c=d+this._c|0,this._d=l+this._d|0,this._e=p+this._e|0,this._f=b+this._f|0,this._g=m+this._g|0,this._h=y+this._h|0},u.prototype._hash=function(){var t=o.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},e.exports=u},{"./hash":148,inherits:101,"safe-buffer":147}],154:[function(t,e,r){var n=t("inherits"),i=t("./sha512"),o=t("./hash"),a=t("safe-buffer").Buffer,s=new Array(160);function u(){this.init(),this._w=s,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var t=a.allocUnsafe(48);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t},e.exports=u},{"./hash":148,"./sha512":155,inherits:101,"safe-buffer":147}],155:[function(t,e,r){var n=t("inherits"),i=t("./hash"),o=t("safe-buffer").Buffer,a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function u(){this.init(),this._w=s,i.call(this,128,112)}function f(t,e,r){return r^t&(e^r)}function c(t,e,r){return t&e|r&(t|e)}function h(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function d(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function l(t,e){return t>>>0>>0?1:0}n(u,i),u.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},u.prototype._update=function(t){for(var e,r,n,i,o,s,u,p,b=this._w,m=0|this._ah,y=0|this._bh,v=0|this._ch,g=0|this._dh,w=0|this._eh,_=0|this._fh,M=0|this._gh,x=0|this._hh,k=0|this._al,S=0|this._bl,E=0|this._cl,A=0|this._dl,j=0|this._el,I=0|this._fl,B=0|this._gl,T=0|this._hl,C=0;C<32;C+=2)b[C]=t.readInt32BE(4*C),b[C+1]=t.readInt32BE(4*C+4);for(;C<160;C+=2){var P=b[C-30],R=b[C-30+1],O=((u=P)>>>1|(p=R)<<31)^(u>>>8|p<<24)^u>>>7,N=((o=R)>>>1|(s=P)<<31)^(o>>>8|s<<24)^(o>>>7|s<<25);P=b[C-4],R=b[C-4+1];var L=((n=P)>>>19|(i=R)<<13)^(i>>>29|n<<3)^n>>>6,F=((e=R)>>>19|(r=P)<<13)^(r>>>29|e<<3)^(e>>>6|r<<26),q=b[C-14],D=b[C-14+1],U=b[C-32],z=b[C-32+1],K=N+D|0,H=O+q+l(K,N)|0;H=(H=H+L+l(K=K+F|0,F)|0)+U+l(K=K+z|0,z)|0,b[C]=H,b[C+1]=K}for(var V=0;V<160;V+=2){H=b[V],K=b[V+1];var W=c(m,y,v),X=c(k,S,E),G=h(m,k),J=h(k,m),Z=d(w,j),$=d(j,w),Y=a[V],Q=a[V+1],tt=f(w,_,M),et=f(j,I,B),rt=T+$|0,nt=x+Z+l(rt,T)|0;nt=(nt=(nt=nt+tt+l(rt=rt+et|0,et)|0)+Y+l(rt=rt+Q|0,Q)|0)+H+l(rt=rt+K|0,K)|0;var it=J+X|0,ot=G+W+l(it,J)|0;x=M,T=B,M=_,B=I,_=w,I=j,w=g+nt+l(j=A+rt|0,A)|0,g=v,A=E,v=y,E=S,y=m,S=k,m=nt+ot+l(k=rt+it|0,rt)|0}this._al=this._al+k|0,this._bl=this._bl+S|0,this._cl=this._cl+E|0,this._dl=this._dl+A|0,this._el=this._el+j|0,this._fl=this._fl+I|0,this._gl=this._gl+B|0,this._hl=this._hl+T|0,this._ah=this._ah+m+l(this._al,k)|0,this._bh=this._bh+y+l(this._bl,S)|0,this._ch=this._ch+v+l(this._cl,E)|0,this._dh=this._dh+g+l(this._dl,A)|0,this._eh=this._eh+w+l(this._el,j)|0,this._fh=this._fh+_+l(this._fl,I)|0,this._gh=this._gh+M+l(this._gl,B)|0,this._hh=this._hh+x+l(this._hl,T)|0},u.prototype._hash=function(){var t=o.allocUnsafe(64);function e(e,r,n){t.writeInt32BE(e,n),t.writeInt32BE(r,n+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t},e.exports=u},{"./hash":148,inherits:101,"safe-buffer":147}],156:[function(t,e,r){e.exports=i;var n=t("events").EventEmitter;function i(){n.call(this)}t("inherits")(i,n),i.Readable=t("readable-stream/readable.js"),i.Writable=t("readable-stream/writable.js"),i.Duplex=t("readable-stream/duplex.js"),i.Transform=t("readable-stream/transform.js"),i.PassThrough=t("readable-stream/passthrough.js"),i.Stream=i,i.prototype.pipe=function(t,e){var r=this;function i(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function o(){r.readable&&r.resume&&r.resume()}r.on("data",i),t.on("drain",o),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function f(t){if(c(),0===n.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",i),t.removeListener("drain",o),r.removeListener("end",s),r.removeListener("close",u),r.removeListener("error",f),t.removeListener("error",f),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",f),t.on("error",f),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},{events:83,inherits:101,"readable-stream/duplex.js":133,"readable-stream/passthrough.js":142,"readable-stream/readable.js":143,"readable-stream/transform.js":144,"readable-stream/writable.js":145}],157:[function(t,e,r){var n=t("safe-buffer").Buffer,i=n.isEncoding||function(t){switch((t=""+t)&&t.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!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(n.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=f,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=c,this.end=h,e=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:-1}function s(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�".repeat(r);if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�".repeat(r+1);if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�".repeat(r+2)}}(this,t,e);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function f(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function l(t){return t&&t.length?this.write(t):""}r.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return i>0&&(t.lastNeed=i-1),i;if(--n=0)return i>0&&(t.lastNeed=i-2),i;if(--n=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":147}],158:[function(t,e,r){var n=t("punycode"),i=t("./util");function o(){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}r.parse=g,r.resolve=function(t,e){return g(t,!1,!0).resolve(e)},r.resolveObject=function(t,e){return t?g(t,!1,!0).resolveObject(e):e},r.format=function(t){i.isString(t)&&(t=g(t));return t instanceof o?t.format():o.prototype.format.call(t)},r.Url=o;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,f=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(f),h=["%","/","?",";","#"].concat(c),d=["/","?","#"],l=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,b={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=t("querystring");function g(t,e,r){if(t&&i.isObject(t)&&t instanceof o)return t;var n=new o;return n.parse(t,e,r),n}o.prototype.parse=function(t,e,r){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===t?"undefined":_typeof(t)));var o=t.indexOf("?"),s=-1!==o&&o127?P+="x":P+=C[R];if(!P.match(l)){var N=B.slice(0,A),L=B.slice(A+1),F=C.match(p);F&&(N.push(F[1]),L.unshift(F[2])),L.length&&(g="/"+L.join(".")+g),this.hostname=N.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=n.toASCII(this.hostname));var q=this.port?":"+this.port:"",D=this.hostname||"";this.host=D+q,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==g[0]&&(g="/"+g))}if(!b[M])for(A=0,T=c.length;A0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift());return r.search=t.search,r.query=t.query,i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!x.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var S=x.slice(-1)[0],E=(r.host||t.host||x.length>1)&&("."===S||".."===S)||""===S,A=0,j=x.length;j>=0;j--)"."===(S=x[j])?x.splice(j,1):".."===S?(x.splice(j,1),A++):A&&(x.splice(j,1),A--);if(!_&&!M)for(;A--;A)x.unshift("..");!_||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),E&&"/"!==x.join("/").substr(-1)&&x.push("");var I,B=""===x[0]||x[0]&&"/"===x[0].charAt(0);k&&(r.hostname=r.host=B?"":x.length?x.shift():"",(I=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=I.shift(),r.host=r.hostname=I.shift()));return(_=_||r.host&&x.length)&&!B&&x.unshift(""),x.length?r.pathname=x.join("/"):(r.pathname=null,r.path=null),i.isNull(r.pathname)&&i.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},o.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":159,punycode:127,querystring:130}],159:[function(t,e,r){e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"===(void 0===t?"undefined":_typeof(t))&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],160:[function(t,e,r){(function(t){function r(e){try{if(!t.localStorage)return!1}catch(t){return!1}var r=t.localStorage[e];return null!=r&&"true"===String(r).toLowerCase()}e.exports=function(t,e){if(r("noDeprecation"))return t;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(e);r("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],161:[function(require,module,exports){var indexOf=require("indexof"),Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var r in t)e.push(r);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r>6|192);else{if(i>55295&&i<56320){if(++n==t.length)return null;var o=t.charCodeAt(n);if(o<56320||o>57343)return null;r+=e((i=65536+((1023&i)<<10)+(1023&o))>>18|240),r+=e(i>>12&63|128)}else r+=e(i>>12|224);r+=e(i>>6&63|128)}r+=e(63&i|128)}}return r},toString:function(t){for(var e="",r=0,o=i(t);r127){if(a>191&&a<224){if(r>=o)return null;a=(31&a)<<6|63&n(t,r)}else if(a>223&&a<240){if(r+1>=o)return null;a=(15&a)<<12|(63&n(t,r))<<6|63&n(t,++r)}else{if(!(a>239&&a<248))return null;if(r+2>=o)return null;a=(7&a)<<18|(63&n(t,r))<<12|(63&n(t,++r))<<6|63&n(t,++r)}++r}if(a<=65535)e+=String.fromCharCode(a);else{if(!(a<=1114111))return null;a-=65536,e+=String.fromCharCode(a>>10|55296),e+=String.fromCharCode(1023&a|56320)}}return e},fromNumber:function(t){var e=t.toString(16);return e.length%2==0?"0x"+e:"0x0"+e},toNumber:function(t){return parseInt(t.slice(2),16)},fromNat:function(t){return"0x0"===t?"0x":t.length%2==0?t:"0x0"+t.slice(2)},toNat:function(t){return"0"===t[2]?"0x"+t.slice(3):t},fromArray:a,toArray:o,fromUint8Array:function(t){return a([].slice.call(t,0))},toUint8Array:function(t){return new Uint8Array(o(t))}}},{"./array.js":163}],165:[function(t,e,r){var n="0123456789abcdef".split(""),i=[1,256,65536,16777216],o=[0,8,16,24],a=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],s=function(t){var e,r,n,i,o,s,u,f,c,h,d,l,p,b,m,y,v,g,w,_,M,x,k,S,E,A,j,I,B,T,C,P,R,O,N,L,F,q,D,U,z,K,H,V,W,X,G,J,Z,$,Y,Q,tt,et,rt,nt,it,ot,at,st,ut,ft,ct;for(n=0;n<48;n+=2)i=t[0]^t[10]^t[20]^t[30]^t[40],o=t[1]^t[11]^t[21]^t[31]^t[41],s=t[2]^t[12]^t[22]^t[32]^t[42],u=t[3]^t[13]^t[23]^t[33]^t[43],f=t[4]^t[14]^t[24]^t[34]^t[44],c=t[5]^t[15]^t[25]^t[35]^t[45],h=t[6]^t[16]^t[26]^t[36]^t[46],d=t[7]^t[17]^t[27]^t[37]^t[47],e=(l=t[8]^t[18]^t[28]^t[38]^t[48])^(s<<1|u>>>31),r=(p=t[9]^t[19]^t[29]^t[39]^t[49])^(u<<1|s>>>31),t[0]^=e,t[1]^=r,t[10]^=e,t[11]^=r,t[20]^=e,t[21]^=r,t[30]^=e,t[31]^=r,t[40]^=e,t[41]^=r,e=i^(f<<1|c>>>31),r=o^(c<<1|f>>>31),t[2]^=e,t[3]^=r,t[12]^=e,t[13]^=r,t[22]^=e,t[23]^=r,t[32]^=e,t[33]^=r,t[42]^=e,t[43]^=r,e=s^(h<<1|d>>>31),r=u^(d<<1|h>>>31),t[4]^=e,t[5]^=r,t[14]^=e,t[15]^=r,t[24]^=e,t[25]^=r,t[34]^=e,t[35]^=r,t[44]^=e,t[45]^=r,e=f^(l<<1|p>>>31),r=c^(p<<1|l>>>31),t[6]^=e,t[7]^=r,t[16]^=e,t[17]^=r,t[26]^=e,t[27]^=r,t[36]^=e,t[37]^=r,t[46]^=e,t[47]^=r,e=h^(i<<1|o>>>31),r=d^(o<<1|i>>>31),t[8]^=e,t[9]^=r,t[18]^=e,t[19]^=r,t[28]^=e,t[29]^=r,t[38]^=e,t[39]^=r,t[48]^=e,t[49]^=r,b=t[0],m=t[1],X=t[11]<<4|t[10]>>>28,G=t[10]<<4|t[11]>>>28,I=t[20]<<3|t[21]>>>29,B=t[21]<<3|t[20]>>>29,st=t[31]<<9|t[30]>>>23,ut=t[30]<<9|t[31]>>>23,K=t[40]<<18|t[41]>>>14,H=t[41]<<18|t[40]>>>14,O=t[2]<<1|t[3]>>>31,N=t[3]<<1|t[2]>>>31,y=t[13]<<12|t[12]>>>20,v=t[12]<<12|t[13]>>>20,J=t[22]<<10|t[23]>>>22,Z=t[23]<<10|t[22]>>>22,T=t[33]<<13|t[32]>>>19,C=t[32]<<13|t[33]>>>19,ft=t[42]<<2|t[43]>>>30,ct=t[43]<<2|t[42]>>>30,et=t[5]<<30|t[4]>>>2,rt=t[4]<<30|t[5]>>>2,L=t[14]<<6|t[15]>>>26,F=t[15]<<6|t[14]>>>26,g=t[25]<<11|t[24]>>>21,w=t[24]<<11|t[25]>>>21,$=t[34]<<15|t[35]>>>17,Y=t[35]<<15|t[34]>>>17,P=t[45]<<29|t[44]>>>3,R=t[44]<<29|t[45]>>>3,S=t[6]<<28|t[7]>>>4,E=t[7]<<28|t[6]>>>4,nt=t[17]<<23|t[16]>>>9,it=t[16]<<23|t[17]>>>9,q=t[26]<<25|t[27]>>>7,D=t[27]<<25|t[26]>>>7,_=t[36]<<21|t[37]>>>11,M=t[37]<<21|t[36]>>>11,Q=t[47]<<24|t[46]>>>8,tt=t[46]<<24|t[47]>>>8,V=t[8]<<27|t[9]>>>5,W=t[9]<<27|t[8]>>>5,A=t[18]<<20|t[19]>>>12,j=t[19]<<20|t[18]>>>12,ot=t[29]<<7|t[28]>>>25,at=t[28]<<7|t[29]>>>25,U=t[38]<<8|t[39]>>>24,z=t[39]<<8|t[38]>>>24,x=t[48]<<14|t[49]>>>18,k=t[49]<<14|t[48]>>>18,t[0]=b^~y&g,t[1]=m^~v&w,t[10]=S^~A&I,t[11]=E^~j&B,t[20]=O^~L&q,t[21]=N^~F&D,t[30]=V^~X&J,t[31]=W^~G&Z,t[40]=et^~nt&ot,t[41]=rt^~it&at,t[2]=y^~g&_,t[3]=v^~w&M,t[12]=A^~I&T,t[13]=j^~B&C,t[22]=L^~q&U,t[23]=F^~D&z,t[32]=X^~J&$,t[33]=G^~Z&Y,t[42]=nt^~ot&st,t[43]=it^~at&ut,t[4]=g^~_&x,t[5]=w^~M&k,t[14]=I^~T&P,t[15]=B^~C&R,t[24]=q^~U&K,t[25]=D^~z&H,t[34]=J^~$&Q,t[35]=Z^~Y&tt,t[44]=ot^~st&ft,t[45]=at^~ut&ct,t[6]=_^~x&b,t[7]=M^~k&m,t[16]=T^~P&S,t[17]=C^~R&E,t[26]=U^~K&O,t[27]=z^~H&N,t[36]=$^~Q&V,t[37]=Y^~tt&W,t[46]=st^~ft&et,t[47]=ut^~ct&rt,t[8]=x^~b&y,t[9]=k^~m&v,t[18]=P^~S&A,t[19]=R^~E&j,t[28]=K^~O&L,t[29]=H^~N&F,t[38]=Q^~V&X,t[39]=tt^~W&G,t[48]=ft^~et&nt,t[49]=ct^~rt&it,t[0]^=a[n],t[1]^=a[n+1]},u=function(t){return function(e){var r,a,u;if("0x"===e.slice(0,2)){r=[];for(var f=2,c=e.length;f>2]|=e[l]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|63&r)<=57344?(u[m>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<=f){for(t.start=m-f,t.block=u[c],m=0;m>2]|=i[3&m],t.lastByteIndex===f)for(u[0]=u[c],m=1;m>4&15]+n[15&p]+n[p>>12&15]+n[p>>8&15]+n[p>>20&15]+n[p>>16&15]+n[p>>28&15]+n[p>>24&15];y%c==0&&(s(d),m=0)}return"0x"+b}({blocks:[],reset:!0,block:0,start:0,blockCount:1600-((a=t)<<1)>>5,outputBlocks:a>>5,s:(u=[0,0,0,0,0,0,0,0,0,0],[].concat(u,u,u,u,u))},r)}};e.exports={keccak256:u(256),keccak512:u(512),keccak256s:u(256),keccak512s:u(512)}},{}],166:[function(t,e,r){var n=t("is-function");e.exports=function(t,e,r){if(!n(e))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this);"[object Array]"===i.call(t)?function(t,e,r){for(var n=0,i=t.length;n0){var a=i.join(r,o);n.push(g(t)(e[o])(a))}return Promise.all(n).then(function(){return r})})}}},_=function(t){return function(e){return u(t+"/bzzr:/",{body:"string"==typeof e?L(e):e,method:"POST"})}},M=function(t){return function(e){return function(r){return function(n){return function i(o){var a="/"===r[0]?r:"/"+r,s=t+"/bzz:/"+e+a,f={method:"PUT",headers:{"Content-Type":n.type},body:n.data};return u(s,f).then(function(t){if(-1!==t.indexOf("error"))throw t;return t}).catch(function(t){return o>0&&i(o-1)})}(3)}}}},x=function(t){return function(e){return S(t)({"":e})}},k=function(t){return function(r){return e.readFile(r).then(function(e){return x(t)({type:a.lookup(r),data:e})})}},S=function(t){return function(e){return _(t)("{}").then(function(r){return Object.keys(e).reduce(function(r,n){return r.then((i=n,function(r){return M(t)(r)(i)(e[i])}));var i},Promise.resolve(r))})}},E=function(t){return function(r){return e.readFile(r).then(_(t))}},A=function(t){return function(n){return function(i){return r.directoryTree(i).then(function(t){return Promise.all(t.map(function(t){return e.readFile(t)})).then(function(e){var r=t.map(function(t){return t.slice(i.length)}),n=t.map(function(t){return a.lookup(t)||"text/plain"});return l(r)(e.map(function(t,e){return{type:n[e],data:t}}))})}).then(function(t){return(e=n?{"":t[n]}:{},function(t){var r={};for(var n in e)r[n]=e[n];for(var i in t)r[i]=t[i];return r})(t);var e}).then(S(t))}}},j=function(t){return function(e){if("data"===e.pick)return d.data().then(_(t));if("file"===e.pick)return d.file().then(x(t));if("directory"===e.pick)return d.directory().then(S(t));if(e.path)switch(e.kind){case"data":return E(t)(e.path);case"file":return k(t)(e.path);case"directory":return A(t)(e.defaultFile)(e.path)}else{if(e.length||"string"==typeof e)return _(t)(e);if(e instanceof Object)return S(t)(e)}return Promise.reject(new Error("Bad arguments"))}},I=function(t){return function(e){return function(r){return R(t)(e).then(function(n){return n?r?w(t)(e)(r):v(t)(e):r?g(t)(e)(r):b(t)(e)})}}},B=function(t,e){var i=n.platform().replace("win32","windows")+"-"+("x64"===n.arch()?"amd64":"386"),o=(e||s)[i],a=f+o.archive+".tar.gz",u=o.archiveMD5,c=o.binaryMD5;return r.safeDownloadArchived(a)(u)(c)(t)},T=function(t){return new Promise(function(e,r){var n=o.spawn,i=function(t){return function(e){return-1!==(""+e).indexOf(t)}},a=t.account,s=t.password,u=t.dataDir,f=t.ensApi,c=t.privateKey,h=0,d=n(t.binPath,["--bzzaccount",a||c,"--datadir",u,"--ens-api",f]),l=function(t){0===h&&i("Passphrase")(t)?setTimeout(function(){h=1,d.stdin.write(s+"\n")},500):i("Swarm http proxy started")(t)&&(h=2,clearTimeout(p),e(d))};d.stdout.on("data",l),d.stderr.on("data",l);var p=setTimeout(function(){return r(new Error("Couldn't start swarm process."))},2e4)})},C=function(t){return new Promise(function(e,r){t.stderr.removeAllListeners("data"),t.stdout.removeAllListeners("data"),t.stdin.removeAllListeners("error"),t.removeAllListeners("error"),t.removeAllListeners("exit"),t.kill("SIGINT");var n=setTimeout(function(){return t.kill("SIGKILL")},8e3);t.once("close",function(){clearTimeout(n),e()})})},P=function(t){return _(t)("test").then(function(t){return"c9a99c7d326dcc6316f32fe2625b311f6dc49a175e6877681ded93137d3569e7"===t}).catch(function(){return!1})},R=function(t){return function(e){return b(t)(e).then(function(t){try{return!!JSON.parse(N(t)).entries}catch(t){return!1}})}},O=function(t){return function(e,r,n,i,o){var a;return void 0!==e&&(a=t(e)),void 0!==r&&(a=t(r)),void 0!==n&&(a=t(n)),void 0!==i&&(a=t(i)),void 0!==o&&(a=t(o)),a}},N=function(t){return c.toString(c.fromUint8Array(t))},L=function(t){return c.toUint8Array(c.fromString(t))},F=function(t){return{download:function(e,r){return I(t)(e)(r)},downloadData:O(b(t)),downloadDataToDisk:O(g(t)),downloadDirectory:O(v(t)),downloadDirectoryToDisk:O(w(t)),downloadEntries:O(m(t)),downloadRoutes:O(y(t)),isAvailable:function(){return P(t)},upload:function(e){return j(t)(e)},uploadData:O(_(t)),uploadFile:O(x(t)),uploadFileFromDisk:O(x(t)),uploadDataFromDisk:O(E(t)),uploadDirectory:O(S(t)),uploadDirectoryFromDisk:O(A(t)),uploadToManifest:O(M(t)),pick:d,hash:h,fromString:L,toString:N}};return{at:F,local:function(t){return function(e){return P("http://localhost:8500").then(function(r){return r?e(F("http://localhost:8500")).then(function(){}):B(t.binPath,t.archives).onData(function(e){return(t.onProgress||function(){})(e.length)}).then(function(){return T(t)}).then(function(t){return e(F("http://localhost:8500")).then(function(){return t})}).then(C)})}},download:I,downloadBinary:B,downloadData:b,downloadDataToDisk:g,downloadDirectory:v,downloadDirectoryToDisk:w,downloadEntries:m,downloadRoutes:y,isAvailable:P,startProcess:T,stopProcess:C,upload:j,uploadData:_,uploadDataFromDisk:E,uploadFile:x,uploadFileFromDisk:k,uploadDirectory:S,uploadDirectoryFromDisk:A,uploadToManifest:M,pick:d,hash:h,fromString:L,toString:N}}},{}],177:[function(t,e,r){(r=e.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},r.right=function(t){return t.replace(/\s*$/,"")}},{}],178:[function(t,e,r){(function(){var t=this,n=t._,i=Array.prototype,o=Object.prototype,a=Function.prototype,s=i.push,u=i.slice,f=o.toString,c=o.hasOwnProperty,h=Array.isArray,d=Object.keys,l=a.bind,p=Object.create,b=function(){},m=function t(e){return e instanceof t?e:this instanceof t?void(this._wrapped=e):new t(e)};void 0!==r?(void 0!==e&&e.exports&&(r=e.exports=m),r._=m):t._=m,m.VERSION="1.8.3";var y=function(t,e,r){if(void 0===e)return t;switch(null==r?3:r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)};case 4:return function(r,n,i,o){return t.call(e,r,n,i,o)}}return function(){return t.apply(e,arguments)}},v=function(t,e,r){return null==t?m.identity:m.isFunction(t)?y(t,e,r):m.isObject(t)?m.matcher(t):m.property(t)};m.iteratee=function(t,e){return v(t,e,1/0)};var g=function(t,e){return function(r){var n=arguments.length;if(n<2||null==r)return r;for(var i=1;i=0&&e<=M};function S(t){return function(e,r,n,i){r=y(r,i,4);var o=!k(e)&&m.keys(e),a=(o||e).length,s=t>0?0:a-1;return arguments.length<3&&(n=e[o?o[s]:s],s+=t),function(e,r,n,i,o,a){for(;o>=0&&o=0},m.invoke=function(t,e){var r=u.call(arguments,2),n=m.isFunction(e);return m.map(t,function(t){var i=n?e:t[e];return null==i?i:i.apply(t,r)})},m.pluck=function(t,e){return m.map(t,m.property(e))},m.where=function(t,e){return m.filter(t,m.matcher(e))},m.findWhere=function(t,e){return m.find(t,m.matcher(e))},m.max=function(t,e,r){var n,i,o=-1/0,a=-1/0;if(null==e&&null!=t)for(var s=0,u=(t=k(t)?t:m.values(t)).length;so&&(o=n);else e=v(e,r),m.each(t,function(t,r,n){((i=e(t,r,n))>a||i===-1/0&&o===-1/0)&&(o=t,a=i)});return o},m.min=function(t,e,r){var n,i,o=1/0,a=1/0;if(null==e&&null!=t)for(var s=0,u=(t=k(t)?t:m.values(t)).length;sn||void 0===r)return 1;if(r0?0:i-1;o>=0&&o0?a=o>=0?o:Math.max(o+s,a):s=o>=0?Math.min(o+1,s):o+s+1;else if(r&&o&&s)return n[o=r(n,i)]===i?o:-1;if(i!=i)return(o=e(u.call(n,a,s),m.isNaN))>=0?o+a:-1;for(o=t>0?a:s-1;o>=0&&oe?(a&&(clearTimeout(a),a=null),s=f,o=t.apply(n,i),a||(n=i=null)):a||!1===r.trailing||(a=setTimeout(u,c)),o}},m.debounce=function(t,e,r){var n,i,o,a,s,u=function u(){var f=m.now()-a;f=0?n=setTimeout(u,e-f):(n=null,r||(s=t.apply(o,i),n||(o=i=null)))};return function(){o=this,i=arguments,a=m.now();var f=r&&!n;return n||(n=setTimeout(u,e)),f&&(s=t.apply(o,i),o=i=null),s}},m.wrap=function(t,e){return m.partial(e,t)},m.negate=function(t){return function(){return!t.apply(this,arguments)}},m.compose=function(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}},m.after=function(t,e){return function(){if(--t<1)return e.apply(this,arguments)}},m.before=function(t,e){var r;return function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=null),r}},m.once=m.partial(m.before,2);var T=!{toString:null}.propertyIsEnumerable("toString"),C=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];function P(t,e){var r=C.length,n=t.constructor,i=m.isFunction(n)&&n.prototype||o,a="constructor";for(m.has(t,a)&&!m.contains(e,a)&&e.push(a);r--;)(a=C[r])in t&&t[a]!==i[a]&&!m.contains(e,a)&&e.push(a)}m.keys=function(t){if(!m.isObject(t))return[];if(d)return d(t);var e=[];for(var r in t)m.has(t,r)&&e.push(r);return T&&P(t,e),e},m.allKeys=function(t){if(!m.isObject(t))return[];var e=[];for(var r in t)e.push(r);return T&&P(t,e),e},m.values=function(t){for(var e=m.keys(t),r=e.length,n=Array(r),i=0;i":">",'"':""","'":"'","`":"`"},O=m.invert(R),N=function(t){var e=function(e){return t[e]},r="(?:"+m.keys(t).join("|")+")",n=RegExp(r),i=RegExp(r,"g");return function(t){return t=null==t?"":""+t,n.test(t)?t.replace(i,e):t}};m.escape=N(R),m.unescape=N(O),m.result=function(t,e,r){var n=null==t?void 0:t[e];return void 0===n&&(n=r),m.isFunction(n)?n.call(t):n};var L=0;m.uniqueId=function(t){var e=++L+"";return t?t+e:e},m.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var F=/(.)^/,q={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\u2028|\u2029/g,U=function(t){return"\\"+q[t]};m.template=function(t,e,r){!e&&r&&(e=r),e=m.defaults({},e,m.templateSettings);var n=RegExp([(e.escape||F).source,(e.interpolate||F).source,(e.evaluate||F).source].join("|")+"|$","g"),i=0,o="__p+='";t.replace(n,function(e,r,n,a,s){return o+=t.slice(i,s).replace(D,U),i=s+e.length,r?o+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'":n?o+="'+\n((__t=("+n+"))==null?'':__t)+\n'":a&&(o+="';\n"+a+"\n__p+='"),e}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{var a=new Function(e.variable||"obj","_",o)}catch(t){throw t.source=o,t}var s=function(t){return a.call(this,t,m)},u=e.variable||"obj";return s.source="function("+u+"){\n"+o+"}",s},m.chain=function(t){var e=m(t);return e._chain=!0,e};var z=function(t,e){return t._chain?m(e).chain():e};m.mixin=function(t){m.each(m.functions(t),function(e){var r=m[e]=t[e];m.prototype[e]=function(){var t=[this._wrapped];return s.apply(t,arguments),z(this,r.apply(m,t))}})},m.mixin(m),m.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=i[t];m.prototype[t]=function(){var r=this._wrapped;return e.apply(r,arguments),"shift"!==t&&"splice"!==t||0!==r.length||delete r[0],z(this,r)}}),m.each(["concat","join","slice"],function(t){var e=i[t];m.prototype[t]=function(){return z(this,e.apply(this._wrapped,arguments))}}),m.prototype.value=function(){return this._wrapped},m.prototype.valueOf=m.prototype.toJSON=m.prototype.value,m.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return m})}).call(this)},{}],179:[function(t,e,r){e.exports=function(t,e){if(e){e=(e=e.trim().replace(/^(\?|#|&)/,""))?"?"+e:e;var r=t.split(/[\?\#]/),n=r[0];e&&/\:\/\/[^\/]*$/.test(n)&&(n+="/");var i=t.match(/(\#.*)$/);t=n+e,i&&(t+=i[0])}return t}},{}],180:[function(t,e,r){var n=t("xhr-request");e.exports=function(t,e){return new Promise(function(r,i){n(t,e,function(t,e){t?i(t):r(e)})})}},{"xhr-request":181}],181:[function(t,e,r){var n=t("query-string"),i=t("url-set-query"),o=t("object-assign"),a=t("./lib/ensure-header.js"),s=t("./lib/request.js"),u="application/json",f=function(){};e.exports=function(t,e,r){if(!t||"string"!=typeof t)throw new TypeError("must specify a URL");"function"==typeof e&&(r=e,e={});if(r&&"function"!=typeof r)throw new TypeError("expected cb to be undefined or a function");r=r||f;var c=(e=e||{}).json?"json":"text",h=(e=o({responseType:c},e)).headers||{},d=(e.method||"GET").toUpperCase(),l=e.query;l&&("string"!=typeof l&&(l=n.stringify(l)),t=i(t,l));"json"===e.responseType&&a(h,"Accept",u);e.json&&"GET"!==d&&"HEAD"!==d&&(a(h,"Content-Type",u),e.body=JSON.stringify(e.body));return e.method=d,e.url=t,e.headers=h,delete e.query,delete e.json,s(e,r)}},{"./lib/ensure-header.js":182,"./lib/request.js":184,"object-assign":169,"query-string":171,"url-set-query":179}],182:[function(t,e,r){e.exports=function(t,e,r){var n=e.toLowerCase();t[e]||t[n]||(t[e]=r)}},{}],183:[function(t,e,r){e.exports=function(t,e){return e?{statusCode:e.statusCode,headers:e.headers,method:t.method,url:t.url,rawRequest:e.rawRequest?e.rawRequest:e}:null}},{}],184:[function(t,e,r){var n=t("xhr"),i=t("./normalize-response"),o=function(){};e.exports=function(t,e){delete t.uri;var r=!1;"json"===t.responseType&&(t.responseType="text",r=!0);var a=n(t,function(n,a,s){if(r&&!n)try{var u=a.rawRequest.responseText;s=JSON.parse(u)}catch(t){n=t}a=i(t,a),e(n,n?null:s,a),e=o}),s=a.onabort;return a.onabort=function(){var t=s.apply(a,Array.prototype.slice.call(arguments));return e(new Error("XHR Aborted")),e=o,t},a}},{"./normalize-response":183,xhr:185}],185:[function(t,e,r){var n=t("global/window"),i=t("is-function"),o=t("parse-headers"),a=t("xtend");function s(t,e,r){var n=t;return i(e)?(r=e,"string"==typeof t&&(n={uri:t})):n=a(e,{uri:t}),n.callback=r,n}function u(t,e,r){return f(e=s(t,e,r))}function f(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,r=function(r,n,i){e||(e=!0,t.callback(r,n,i))};function n(t){return clearTimeout(c),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,r(t,y)}function i(){if(!s){var e;clearTimeout(c),e=t.useXDR&&void 0===f.status?200:1223===f.status?204:f.status;var n=y,i=null;return 0!==e?(n={body:function(){var t=void 0;if(t=f.response?f.response:f.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(f),m)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:d,headers:{},url:h,rawRequest:f},f.getAllResponseHeaders&&(n.headers=o(f.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),r(i,n,n.body)}}var a,s,f=t.xhr||null;f||(f=t.cors||t.useXDR?new u.XDomainRequest:new u.XMLHttpRequest);var c,h=f.url=t.uri||t.url,d=f.method=t.method||"GET",l=t.body||t.data,p=f.headers=t.headers||{},b=!!t.sync,m=!1,y={body:void 0,headers:{},statusCode:0,method:d,url:h,rawRequest:f};if("json"in t&&!1!==t.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),l=JSON.stringify(!0===t.json?l:t.json))),f.onreadystatechange=function(){4===f.readyState&&setTimeout(i,0)},f.onload=i,f.onerror=n,f.onprogress=function(){},f.onabort=function(){s=!0},f.ontimeout=n,f.open(d,h,!b,t.username,t.password),b||(f.withCredentials=!!t.withCredentials),!b&&t.timeout>0&&(c=setTimeout(function(){if(!s){s=!0,f.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",n(t)}},t.timeout)),f.setRequestHeader)for(a in p)p.hasOwnProperty(a)&&f.setRequestHeader(a,p[a]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(f.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(f),f.send(l||null),f}e.exports=u,u.XMLHttpRequest=n.XMLHttpRequest||function(){},u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:n.XDomainRequest,function(t,e){for(var r=0;r1?(t[r[0]]=t[r[0]]||{},t[r[0]][r[1]]=e):t[r[0]]=e},f.prototype.getCall=function(t){return n.isFunction(this.call)?this.call(t):this.call},f.prototype.extractCallback=function(t){if(n.isFunction(t[t.length-1]))return t.pop()},f.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams(t.length,this.params,this.name)},f.prototype.formatInput=function(t){var e=this;return this.inputFormatter?this.inputFormatter.map(function(r,n){return r?r.call(e,t[n]):t[n]}):t},f.prototype.formatOutput=function(t){var e=this;return n.isArray(t)?t.map(function(t){return e.outputFormatter&&t?e.outputFormatter(t):t}):this.outputFormatter&&t?this.outputFormatter(t):t},f.prototype.toPayload=function(t){var e=this.getCall(t),r=this.extractCallback(t),n=this.formatInput(t);this.validateArgs(n);var i={method:e,params:n,callback:r};return this.transformPayload&&(i=this.transformPayload(i)),i},f.prototype._confirmTransaction=function(t,e,r){var i=this,c=!1,h=!0,d=0,l=0,p=null,b=n.isObject(r.params[0])&&r.params[0].gas?r.params[0].gas:null,m=n.isObject(r.params[0])&&r.params[0].data&&r.params[0].from&&!r.params[0].to,y=[new f({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,inputFormatter:[null],outputFormatter:o.outputTransactionReceiptFormatter}),new f({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[o.inputAddressFormatter,o.inputDefaultBlockNumberFormatter]}),new u({name:"subscribe",type:"eth",subscriptions:{newBlockHeaders:{subscriptionName:"newHeads",params:0,outputFormatter:o.outputBlockFormatter}}})],v={};n.each(y,function(t){t.attachToObject(v),t.requestManager=i.requestManager});var g=function(r,n,o,u,f){if(!o)return f||(f={unsubscribe:function(){clearInterval(p)}}),(r?s.resolve(r):v.getTransactionReceipt(e)).catch(function(e){f.unsubscribe(),c=!0,a._fireError({message:"Failed to check for transaction receipt:",data:e},t.eventEmitter,t.reject)}).then(function(e){if(!e||!e.blockHash)throw new Error("Receipt missing or blockHash null");return i.extraFormatters&&i.extraFormatters.receiptFormatter&&(e=i.extraFormatters.receiptFormatter(e)),t.eventEmitter.listeners("confirmation").length>0&&(void 0!==r&&0===l||t.eventEmitter.emit("confirmation",l,e),h=!1,25===++l&&(f.unsubscribe(),t.eventEmitter.removeAllListeners())),e}).then(function(e){if(m&&!c){if(!e.contractAddress)return h&&(f.unsubscribe(),c=!0),void a._fireError(new Error("The transaction receipt didn't contain a contract address."),t.eventEmitter,t.reject);v.getCode(e.contractAddress,function(r,n){n&&(n.length>2?(t.eventEmitter.emit("receipt",e),i.extraFormatters&&i.extraFormatters.contractDeployFormatter?t.resolve(i.extraFormatters.contractDeployFormatter(e)):t.resolve(e),h&&t.eventEmitter.removeAllListeners()):a._fireError(new Error("The contract code couldn't be stored, please check your gas limit."),t.eventEmitter,t.reject),h&&f.unsubscribe(),c=!0)})}return e}).then(function(e){m||c||(e.outOfGas||b&&b===e.gasUsed||!0!==e.status&&"0x1"!==e.status&&void 0!==e.status?(e&&(e=JSON.stringify(e,null,2)),!1===e.status||"0x0"===e.status?a._fireError(new Error("Transaction has been reverted by the EVM:\n"+e),t.eventEmitter,t.reject):a._fireError(new Error("Transaction ran out of gas. Please provide more gas:\n"+e),t.eventEmitter,t.reject)):(t.eventEmitter.emit("receipt",e),t.resolve(e),h&&t.eventEmitter.removeAllListeners()),h&&f.unsubscribe(),c=!0)}).catch(function(){d++,n?d-1>=750&&(f.unsubscribe(),c=!0,a._fireError(new Error("Transaction was not mined within750 seconds, please make sure your transaction was properly sent. Be aware that it might still be mined!"),t.eventEmitter,t.reject)):d-1>=50&&(f.unsubscribe(),c=!0,a._fireError(new Error("Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still be mined!"),t.eventEmitter,t.reject))});f.unsubscribe(),c=!0,a._fireError({message:"Failed to subscribe to new newBlockHeaders to confirm the transaction receipts.",data:o},t.eventEmitter,t.reject)},w=function(t){n.isFunction(this.requestManager.provider.on)?v.subscribe("newBlockHeaders",g.bind(null,t,!1)):p=setInterval(g.bind(null,t,!0),1e3)}.bind(this);v.getTransactionReceipt(e).then(function(e){e&&e.blockHash?(t.eventEmitter.listeners("confirmation").length>0&&w(e),g(e,!1)):c||w()}).catch(function(){c||w()})};var c=function(t,e){return n.isNumber(t)?e.wallet[t]:n.isObject(t)&&t.address&&t.privateKey?t:e.wallet[t.toLowerCase()]};f.prototype.buildCall=function(){var t=this,e="eth_sendTransaction"===t.call||"eth_sendRawTransaction"===t.call,r=function(){var r=s(!e),i=t.toPayload(Array.prototype.slice.call(arguments)),o=function(n,o){try{o=t.formatOutput(o)}catch(t){n=t}if(o instanceof Error&&(n=o),n)return n.error&&(n=n.error),a._fireError(n,r.eventEmitter,r.reject,i.callback);i.callback&&i.callback(null,o),e?(r.eventEmitter.emit("transactionHash",o),t._confirmTransaction(r,o,i)):n||r.resolve(o)},u=function(e){var r=n.extend({},i,{method:"eth_sendRawTransaction",params:[e.rawTransaction]});t.requestManager.send(r,o)},h=function(t,e){var i;if(e&&e.accounts&&e.accounts.wallet&&e.accounts.wallet.length)if("eth_sendTransaction"===t.method){var a=t.params[0];if((i=c(n.isObject(a)?a.from:null,e.accounts))&&i.privateKey)return e.accounts.signTransaction(n.omit(a,"from"),i.privateKey).then(u)}else if("eth_sign"===t.method){var s=t.params[1];if((i=c(t.params[0],e.accounts))&&i.privateKey){var f=e.accounts.sign(s,i.privateKey);return t.callback&&t.callback(null,f.signature),void r.resolve(f.signature)}}return e.requestManager.send(t,o)};e&&n.isObject(i.params[0])&&!i.params[0].gasPrice?new f({name:"getGasPrice",call:"eth_gasPrice",params:0}).createFunction(t.requestManager)(function(e,r){r&&(i.params[0].gasPrice=r),h(i,t)}):h(i,t);return r.eventEmitter};return r.method=t,r.request=this.request.bind(this),r},f.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},e.exports=f},{underscore:192,"web3-core-helpers":191,"web3-core-promievent":198,"web3-core-subscriptions":206,"web3-utils":393}],194:[function(t,e,r){e.exports=t("./register")().Promise},{"./register":196}],195:[function(t,e,r){var n="@@any-promise/REGISTRATION",i=null;e.exports=function(t,e){return function(r,o){r=r||null;var a=!1!==(o=o||{}).global;if(null===i&&a&&(i=t[n]||null),null!==i&&null!==r&&i.implementation!==r)throw new Error('any-promise already defined as "'+i.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===i&&(i=null!==r&&void 0!==o.Promise?{Promise:o.Promise,implementation:r}:e(r),a&&(t[n]=i)),i}}},{}],196:[function(t,e,r){e.exports=t("./loader")(window,function(){if(void 0===window.Promise)throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}})},{"./loader":195}],197:[function(t,e,r){var n="function"!=typeof Object.create&&"~";function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(){}o.prototype._events=void 0,o.prototype.listeners=function(t,e){var r=n?n+t:t,i=this._events&&this._events[r];if(e)return!!i;if(!i)return[];if(i.fn)return[i.fn];for(var o=0,a=i.length,s=new Array(a);o1?(t[r[0]]=t[r[0]]||{},t[r[0]][r[1]]=e):t[r[0]]=e},i.prototype.buildCall=function(){var t=this;return function(){t.subscriptions[arguments[0]]||console.warn("Subscription "+JSON.stringify(arguments[0])+" doesn't exist. Subscribing anyway.");var e=new n({subscription:t.subscriptions[arguments[0]],requestManager:t.requestManager,type:t.type});return e.subscribe.apply(e,arguments)}},e.exports={subscriptions:i,subscription:n}},{"./subscription.js":207}],207:[function(t,e,r){var n=t("underscore"),i=t("web3-core-helpers").errors,o=t("eventemitter3");function a(t){o.call(this),this.id=null,this.callback=null,this.arguments=null,this._reconnectIntervalId=null,this.options={subscription:t.subscription,type:t.type,requestManager:t.requestManager}}a.prototype=Object.create(o.prototype),a.prototype.constructor=a,a.prototype._extractCallback=function(t){if(n.isFunction(t[t.length-1]))return t.pop()},a.prototype._validateArgs=function(t){var e=this.options.subscription;if(e||(e={}),e.params||(e.params=0),t.length!==e.params)throw i.InvalidNumberOfParams(t.length,e.params+1,t[0])},a.prototype._formatInput=function(t){var e=this.options.subscription;return e&&e.inputFormatter?e.inputFormatter.map(function(e,r){return e?e(t[r]):t[r]}):t},a.prototype._formatOutput=function(t){var e=this.options.subscription;return e&&e.outputFormatter&&t?e.outputFormatter(t):t},a.prototype._toPayload=function(t){var e=[];if(this.callback=this._extractCallback(t),this.subscriptionMethod||(this.subscriptionMethod=t.shift(),this.options.subscription.subscriptionName&&(this.subscriptionMethod=this.options.subscription.subscriptionName)),this.arguments||(this.arguments=this._formatInput(t),this._validateArgs(this.arguments),t=[]),e.push(this.subscriptionMethod),e=e.concat(this.arguments),t.length)throw new Error("Only a callback is allowed as parameter on an already instantiated subscription.");return{method:this.options.type+"_subscribe",params:e}},a.prototype.unsubscribe=function(t){this.options.requestManager.removeSubscription(this.id,t),this.id=null,this.removeAllListeners(),clearInterval(this._reconnectIntervalId)},a.prototype.subscribe=function(){var t=this,e=Array.prototype.slice.call(arguments),r=this._toPayload(e);if(!r)return this;if(!this.options.requestManager.provider){var i=new Error("No provider set.");return this.callback(i,null,this),this.emit("error",i),this}if(!this.options.requestManager.provider.on){var o=new Error("The current provider doesn't support subscriptions: "+this.options.requestManager.provider.constructor.name);return this.callback(o,null,this),this.emit("error",o),this}return this.id&&this.unsubscribe(),this.options.params=r.params[1],"logs"===r.params[0]&&n.isObject(r.params[1])&&r.params[1].hasOwnProperty("fromBlock")&&isFinite(r.params[1].fromBlock)&&this.options.requestManager.send({method:"eth_getLogs",params:[r.params[1]]},function(e,r){e?(t.callback(e,null,t),t.emit("error",e)):r.forEach(function(e){var r=t._formatOutput(e);t.callback(null,r,t),t.emit("data",r)})}),"object"===_typeof(r.params[1])&&delete r.params[1].fromBlock,this.options.requestManager.send(r,function(e,i){!e&&i?(t.id=i,t.options.requestManager.addSubscription(t.id,r.params[0],t.options.type,function(e,r){e?(t.options.requestManager.removeSubscription(t.id),t.options.requestManager.provider.once&&(t._reconnectIntervalId=setInterval(function(){t.options.requestManager.provider.reconnect&&t.options.requestManager.provider.reconnect()},500),t.options.requestManager.provider.once("connect",function(){clearInterval(t._reconnectIntervalId),t.subscribe(t.callback)})),t.emit("error",e),n.isFunction(t.callback)&&t.callback(e,null,t)):(n.isArray(r)||(r=[r]),r.forEach(function(e){var r=t._formatOutput(e);if(n.isFunction(t.options.subscription.subscriptionHandler))return t.options.subscription.subscriptionHandler.call(t,r);t.emit("data",r),n.isFunction(t.callback)&&t.callback(null,r,t)}))})):n.isFunction(t.callback)?(t.callback(e,null,t),t.emit("error",e)):t.emit("error",e)}),this},e.exports=a},{eventemitter3:204,underscore:205,"web3-core-helpers":191}],208:[function(t,e,r){var n=t("web3-core-helpers").formatters,i=t("web3-core-method"),o=t("web3-utils");e.exports=function(t){var e=function(e){var r;return e.property?(t[e.property]||(t[e.property]={}),r=t[e.property]):r=t,e.methods&&e.methods.forEach(function(e){e instanceof i||(e=new i(e)),e.attachToObject(r),e.setRequestManager(t._requestManager)}),t};return e.formatters=n,e.utils=o,e.Method=i,e}},{"web3-core-helpers":191,"web3-core-method":193,"web3-utils":393}],209:[function(t,e,r){var n=t("web3-core-requestmanager"),i=t("./extend.js");e.exports={packageInit:function(t,e){if(e=Array.prototype.slice.call(e),!t)throw new Error('You need to instantiate using the "new" keyword.');Object.defineProperty(t,"currentProvider",{get:function(){return t._provider},set:function(e){return t.setProvider(e)},enumerable:!0,configurable:!0}),e[0]&&e[0]._requestManager?t._requestManager=new n.Manager(e[0].currentProvider):(t._requestManager=new n.Manager,t._requestManager.setProvider(e[0],e[1])),t.givenProvider=n.Manager.givenProvider,t.providers=n.Manager.providers,t._provider=t._requestManager.provider,t.setProvider||(t.setProvider=function(e,r){return t._requestManager.setProvider(e,r),t._provider=t._requestManager.provider,!0}),t.BatchRequest=n.BatchManager.bind(null,t._requestManager),t.extend=i(t)},addProviders:function(t){t.givenProvider=n.Manager.givenProvider,t.providers=n.Manager.providers}}},{"./extend.js":208,"web3-core-requestmanager":202}],210:[function(t,e,r){!function(e,r){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}function i(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}function o(t,e,r){if(o.isBN(t))return t;this.negative=0,this.words=null,this.length=0,this.red=null,null!==t&&("le"!==e&&"be"!==e||(r=e,e=10),this._init(t||0,e||10,r||"be"))}var a;"object"===(void 0===e?"undefined":_typeof(e))?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;try{a=t("buffer").Buffer}catch(t){}function s(t,e,r){for(var n=0,i=Math.min(t.length,r),o=e;o=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===(void 0===t?"undefined":_typeof(t))&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===(void 0===t?"undefined":_typeof(t)))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var f=1;f>>26,h=67108863&u,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;c+=(a=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&a}r.words[f]=0|h,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var d=c[t],l=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?b+r:f[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,f=new t(o),c=this.clone();if(u){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),f[s]=a;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,b=l>>>13,m=0|a[2],y=8191&m,v=m>>>13,g=0|a[3],w=8191&g,_=g>>>13,M=0|a[4],x=8191&M,k=M>>>13,S=0|a[5],E=8191&S,A=S>>>13,j=0|a[6],I=8191&j,B=j>>>13,T=0|a[7],C=8191&T,P=T>>>13,R=0|a[8],O=8191&R,N=R>>>13,L=0|a[9],F=8191&L,q=L>>>13,D=0|s[0],U=8191&D,z=D>>>13,K=0|s[1],H=8191&K,V=K>>>13,W=0|s[2],X=8191&W,G=W>>>13,J=0|s[3],Z=8191&J,$=J>>>13,Y=0|s[4],Q=8191&Y,tt=Y>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ft=st>>>13,ct=0|s[8],ht=8191&ct,dt=ct>>>13,lt=0|s[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(h,U))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,U)|0))<<13)|0;f=((o=Math.imul(d,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,z))+Math.imul(b,U)|0,o=Math.imul(b,z);var yt=(f+(n=n+Math.imul(h,H)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,H)|0))<<13)|0;f=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,U),i=(i=Math.imul(y,z))+Math.imul(v,U)|0,o=Math.imul(v,z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0;var vt=(f+(n=n+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,X)|0))<<13)|0;f=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,z))+Math.imul(_,U)|0,o=Math.imul(_,z),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,G)|0;var gt=(f+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(d,Z)|0))<<13)|0;f=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,z))+Math.imul(k,U)|0,o=Math.imul(k,z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,$)|0;var wt=(f+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;f=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,z))+Math.imul(A,U)|0,o=Math.imul(A,z),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,V)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(f+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(d,rt)|0))<<13)|0;f=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,U),i=(i=Math.imul(I,z))+Math.imul(B,U)|0,o=Math.imul(B,z),n=n+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var Mt=(f+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;f=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,z))+Math.imul(P,U)|0,o=Math.imul(P,z),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var xt=(f+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((o=o+Math.imul(d,ft)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(O,U),i=(i=Math.imul(O,z))+Math.imul(N,U)|0,o=Math.imul(N,z),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0;var kt=(f+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;f=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,z))+Math.imul(q,U)|0,o=Math.imul(q,z),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(C,X)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ft)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(f+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;f=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,H),i=(i=Math.imul(F,V))+Math.imul(q,H)|0,o=Math.imul(q,V),n=n+Math.imul(O,X)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var Et=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,G))+Math.imul(q,X)|0,o=Math.imul(q,G),n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,$)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ft)|0,n=n+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,dt)|0;var At=(f+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,bt)|0)+Math.imul(v,pt)|0))<<13)|0;f=((o=o+Math.imul(v,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(F,Z),i=(i=Math.imul(F,$))+Math.imul(q,Z)|0,o=Math.imul(q,$),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ft)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var jt=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,tt))+Math.imul(q,Q)|0,o=Math.imul(q,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ft)|0,n=n+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var It=(f+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,bt)|0)+Math.imul(k,pt)|0))<<13)|0;f=((o=o+Math.imul(k,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(q,rt)|0,o=Math.imul(q,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ft)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,dt)|0;var Bt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,bt)|0)+Math.imul(A,pt)|0))<<13)|0;f=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,at))+Math.imul(q,ot)|0,o=Math.imul(q,at),n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Tt=(f+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,bt)|0)+Math.imul(B,pt)|0))<<13)|0;f=((o=o+Math.imul(B,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ut),i=(i=Math.imul(F,ft))+Math.imul(q,ut)|0,o=Math.imul(q,ft),n=n+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var Ct=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,bt)|0)+Math.imul(P,pt)|0))<<13)|0;f=((o=o+Math.imul(P,bt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,dt))+Math.imul(q,ht)|0,o=Math.imul(q,dt);var Pt=(f+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Rt=(f+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,bt))+Math.imul(q,pt)|0))<<13)|0;return f=((o=Math.imul(q,bt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=Mt,u[7]=xt,u[8]=kt,u[9]=St,u[10]=Et,u[11]=At,u[12]=jt,u[13]=It,u[14]=Bt,u[15]=Tt,u[16]=Ct,u[17]=Pt,u[18]=Rt,0!==f&&(u[19]=f,r.length++),r};function p(t,e,r){return(new b).mulp(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(l=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,f=0;f=0&&(0!==c||f>=i);f--){var h=0|this.words[f];this.words[f]=c<<26-o|h>>>o,c=h&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var f=0;f=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,c=1;0==(e.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(e.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(v,y),v.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new g;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return m[t]=e,e},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),f=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,f).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,m=0;0!==b.cmp(s);m++)b=b.redSqr();n(m=0;n--){for(var f=e.words[n],c=u-1;c>=0;c--){var h=f>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new x(t)},i(x,M),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],211:[function(t,e,r){arguments[4][178][0].apply(r,arguments)},{dup:178}],212:[function(t,e,r){var n=t("underscore"),i=t("web3-utils"),o=t("bn.js"),a=t("./param"),s=function(t){return n.isNumber(t)&&(t=Math.trunc(t)),new a(i.toTwosComplement(t).replace("0x",""))};e.exports={formatInputInt:s,formatInputBytes:function(t){if(!i.isHexStrict(t))throw new Error('Given parameter is not bytes: "'+t+'"');var e=t.replace(/^0x/i,"");if(e.length%2!=0)throw new Error('Given parameter bytes has an invalid length: "'+t+'"');if(e.length>64)throw new Error('Given parameter bytes is too long: "'+t+'"');var r=Math.floor((e.length+63)/64);return e=i.padRight(e,64*r),new a(e)},formatInputDynamicBytes:function(t){if(!i.isHexStrict(t))throw new Error('Given parameter is not bytes: "'+t+'"');var e=t.replace(/^0x/i,"");if(e.length%2!=0)throw new Error('Given parameter bytes has an invalid length: "'+t+'"');var r=e.length/2,n=Math.floor((e.length+63)/64);return e=i.padRight(e,64*n),new a(s(r).value+e)},formatInputString:function(t){if(!n.isString(t))throw new Error("Given parameter is not a valid string: "+t);var e=i.utf8ToHex(t).replace(/^0x/i,""),r=e.length/2,o=Math.floor((e.length+63)/64);return e=i.padRight(e,64*o),new a(s(r).value+e)},formatInputBool:function(t){return new a("000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0"))},formatOutputInt:function(t){var e=t.staticPart();if(!e&&!t.rawValue)throw new Error("Couldn't decode "+name+" from ABI: 0x"+t.rawValue);return"1"===new o(e.substr(0,1),16).toString(2).substr(0,1)?new o(e,16).fromTwos(256).toString(10):new o(e,16).toString(10)},formatOutputUInt:function(t,e){var r=t.staticPart();if(!r&&!t.rawValue)throw new Error("Couldn't decode "+e+" from ABI: 0x"+t.rawValue);return new o(r,16).toString(10)},formatOutputBool:function(t,e){var r=t.staticPart();if(!r&&!t.rawValue)throw new Error("Couldn't decode "+e+" from ABI: 0x"+t.rawValue);return"0000000000000000000000000000000000000000000000000000000000000001"===r},formatOutputBytes:function(t,e){var r=e.match(/^bytes([0-9]*)/),n=parseInt(r[1]);if(t.staticPart().slice(0,2*n).length!==2*n)throw new Error("Couldn't decode "+e+" from ABI: 0x"+t.rawValue+" The size doesn't match.");return"0x"+t.staticPart().slice(0,2*n)},formatOutputDynamicBytes:function(t,e){var r=t.dynamicPart().slice(0,64);if(!r)throw new Error("Couldn't decode "+e+" from ABI: 0x"+t.rawValue);var n=2*new o(r,16).toNumber();return"0x"+t.dynamicPart().substr(64,n)},formatOutputString:function(t){var e=t.dynamicPart().slice(0,64);if(!e)throw new Error("ERROR: The returned value is not a convertible string:"+e);var r=2*new o(e,16).toNumber();return r?i.hexToUtf8("0x"+t.dynamicPart().substr(64,r).replace(/^0x/i,"")):""},formatOutputAddress:function(t,e){var r=t.staticPart();if(!r)throw new Error("Couldn't decode "+e+" from ABI: 0x"+t.rawValue);return i.toChecksumAddress("0x"+r.slice(r.length-40,r.length))},toTwosComplement:i.toTwosComplement}},{"./param":214,"bn.js":210,underscore:211,"web3-utils":393}],213:[function(t,e,r){var n=t("underscore"),i=t("web3-utils"),o=t("./formatters"),a=t("./types/address"),s=t("./types/bool"),u=t("./types/int"),f=t("./types/uint"),c=t("./types/dynamicbytes"),h=t("./types/string"),d=t("./types/bytes"),l=function(t,e){return t.isDynamicType(e)||t.isDynamicArray(e)};function p(){}var b=function(t){this._types=t};b.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("Invalid solidity type: "+t);return e},b.prototype._getOffsets=function(t,e){for(var r=e.map(function(e,r){return e.staticPartLength(t[r])}),n=1;n=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return n}function u(t,e,r,n){for(var i=0,o=Math.min(t.length,r),a=e;a=49?s-49+10:s>=17?s-17+10:s}return i}o.isBN=function(t){return t instanceof o||null!==t&&"object"===(void 0===t?"undefined":_typeof(t))&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,e){return t.cmp(e)>0?t:e},o.min=function(t,e){return t.cmp(e)<0?t:e},o.prototype._init=function(t,e,r){if("number"==typeof t)return this._initNumber(t,e,r);if("object"===(void 0===t?"undefined":_typeof(t)))return this._initArray(t,e,r);"hex"===e&&(e=16),n(e===(0|e)&&e>=2&&e<=36);var i=0;"-"===(t=t.toString().replace(/\s+/g,""))[0]&&i++,16===e?this._parseHex(t,i):this._parseBase(t,e,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initNumber=function(t,e,r){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[67108863&t],this.length=1):t<4503599627370496?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),e,r)},o.prototype._initArray=function(t,e,r){if(n("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)a=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=a<>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=s(t,r,r+6),this.words[n]|=i<>>26-o&4194303,(o+=24)>=26&&(o-=26,n++);r+6!==e&&(i=s(t,e,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var o=t.length-r,a=o%n,s=Math.min(o,o-a)+r,f=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],c=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],h=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function d(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],o=0|e.words[0],a=i*o,s=67108863&a,u=a/67108864|0;r.words[0]=s;for(var f=1;f>>26,h=67108863&u,d=Math.min(f,e.length-1),l=Math.max(0,f-t.length+1);l<=d;l++){var p=f-l|0;c+=(a=(i=0|t.words[p])*(o=0|e.words[l])+h)/67108864|0,h=67108863&a}r.words[f]=0|h,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}o.prototype.toString=function(t,e){var r;if(e=0|e||1,16===(t=t||10)||"hex"===t){r="";for(var i=0,o=0,a=0;a>>24-i&16777215)||a!==this.length-1?f[6-u.length]+u+r:u+r,(i+=2)>=26&&(i-=26,a--)}for(0!==o&&(r=o.toString(16)+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(t===(0|t)&&t>=2&&t<=36){var d=c[t],l=h[t];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var b=p.modn(l).toString(t);r=(p=p.idivn(l)).isZero()?b+r:f[d-b.length]+b+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,e){return n(void 0!==a),this.toArrayLike(a,t,e)},o.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},o.prototype.toArrayLike=function(t,e,r){var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var a,s,u="le"===e,f=new t(o),c=this.clone();if(u){for(s=0;!c.isZero();s++)a=c.andln(255),c.iushrn(8),f[s]=a;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},o.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},o.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ot.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var o=0,a=0;a>26,this.words[a]=67108863&e;for(;0!==o&&a>26,this.words[a]=67108863&e;if(0===o&&a>>13,l=0|a[1],p=8191&l,b=l>>>13,m=0|a[2],y=8191&m,v=m>>>13,g=0|a[3],w=8191&g,_=g>>>13,M=0|a[4],x=8191&M,k=M>>>13,S=0|a[5],E=8191&S,A=S>>>13,j=0|a[6],I=8191&j,B=j>>>13,T=0|a[7],C=8191&T,P=T>>>13,R=0|a[8],O=8191&R,N=R>>>13,L=0|a[9],F=8191&L,q=L>>>13,D=0|s[0],U=8191&D,z=D>>>13,K=0|s[1],H=8191&K,V=K>>>13,W=0|s[2],X=8191&W,G=W>>>13,J=0|s[3],Z=8191&J,$=J>>>13,Y=0|s[4],Q=8191&Y,tt=Y>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],ot=8191&it,at=it>>>13,st=0|s[7],ut=8191&st,ft=st>>>13,ct=0|s[8],ht=8191&ct,dt=ct>>>13,lt=0|s[9],pt=8191<,bt=lt>>>13;r.negative=t.negative^e.negative,r.length=19;var mt=(f+(n=Math.imul(h,U))|0)+((8191&(i=(i=Math.imul(h,z))+Math.imul(d,U)|0))<<13)|0;f=((o=Math.imul(d,z))+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,z))+Math.imul(b,U)|0,o=Math.imul(b,z);var yt=(f+(n=n+Math.imul(h,H)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,H)|0))<<13)|0;f=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(y,U),i=(i=Math.imul(y,z))+Math.imul(v,U)|0,o=Math.imul(v,z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,H)|0,o=o+Math.imul(b,V)|0;var vt=(f+(n=n+Math.imul(h,X)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(d,X)|0))<<13)|0;f=((o=o+Math.imul(d,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(w,U),i=(i=Math.imul(w,z))+Math.imul(_,U)|0,o=Math.imul(_,z),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(v,H)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,X)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(b,X)|0,o=o+Math.imul(b,G)|0;var gt=(f+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(d,Z)|0))<<13)|0;f=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(x,U),i=(i=Math.imul(x,z))+Math.imul(k,U)|0,o=Math.imul(k,z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,H)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(y,X)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(v,X)|0,o=o+Math.imul(v,G)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,$)|0;var wt=(f+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(d,Q)|0))<<13)|0;f=((o=o+Math.imul(d,tt)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(E,U),i=(i=Math.imul(E,z))+Math.imul(A,U)|0,o=Math.imul(A,z),n=n+Math.imul(x,H)|0,i=(i=i+Math.imul(x,V)|0)+Math.imul(k,H)|0,o=o+Math.imul(k,V)|0,n=n+Math.imul(w,X)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(_,X)|0,o=o+Math.imul(_,G)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,tt)|0;var _t=(f+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(d,rt)|0))<<13)|0;f=((o=o+Math.imul(d,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(I,U),i=(i=Math.imul(I,z))+Math.imul(B,U)|0,o=Math.imul(B,z),n=n+Math.imul(E,H)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(A,H)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(x,X)|0,i=(i=i+Math.imul(x,G)|0)+Math.imul(k,X)|0,o=o+Math.imul(k,G)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,tt)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,tt)|0,n=n+Math.imul(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(b,rt)|0,o=o+Math.imul(b,nt)|0;var Mt=(f+(n=n+Math.imul(h,ot)|0)|0)+((8191&(i=(i=i+Math.imul(h,at)|0)+Math.imul(d,ot)|0))<<13)|0;f=((o=o+Math.imul(d,at)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(C,U),i=(i=Math.imul(C,z))+Math.imul(P,U)|0,o=Math.imul(P,z),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(B,H)|0,o=o+Math.imul(B,V)|0,n=n+Math.imul(E,X)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(A,X)|0,o=o+Math.imul(A,G)|0,n=n+Math.imul(x,Z)|0,i=(i=i+Math.imul(x,$)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,tt)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,tt)|0,n=n+Math.imul(y,rt)|0,i=(i=i+Math.imul(y,nt)|0)+Math.imul(v,rt)|0,o=o+Math.imul(v,nt)|0,n=n+Math.imul(p,ot)|0,i=(i=i+Math.imul(p,at)|0)+Math.imul(b,ot)|0,o=o+Math.imul(b,at)|0;var xt=(f+(n=n+Math.imul(h,ut)|0)|0)+((8191&(i=(i=i+Math.imul(h,ft)|0)+Math.imul(d,ut)|0))<<13)|0;f=((o=o+Math.imul(d,ft)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(O,U),i=(i=Math.imul(O,z))+Math.imul(N,U)|0,o=Math.imul(N,z),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(P,H)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(I,X)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(B,X)|0,o=o+Math.imul(B,G)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(x,Q)|0,i=(i=i+Math.imul(x,tt)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(w,rt)|0,i=(i=i+Math.imul(w,nt)|0)+Math.imul(_,rt)|0,o=o+Math.imul(_,nt)|0,n=n+Math.imul(y,ot)|0,i=(i=i+Math.imul(y,at)|0)+Math.imul(v,ot)|0,o=o+Math.imul(v,at)|0,n=n+Math.imul(p,ut)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(b,ut)|0,o=o+Math.imul(b,ft)|0;var kt=(f+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,dt)|0)+Math.imul(d,ht)|0))<<13)|0;f=((o=o+Math.imul(d,dt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(F,U),i=(i=Math.imul(F,z))+Math.imul(q,U)|0,o=Math.imul(q,z),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,V)|0)+Math.imul(N,H)|0,o=o+Math.imul(N,V)|0,n=n+Math.imul(C,X)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(P,X)|0,o=o+Math.imul(P,G)|0,n=n+Math.imul(I,Z)|0,i=(i=i+Math.imul(I,$)|0)+Math.imul(B,Z)|0,o=o+Math.imul(B,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,tt)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(x,rt)|0,i=(i=i+Math.imul(x,nt)|0)+Math.imul(k,rt)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(w,ot)|0,i=(i=i+Math.imul(w,at)|0)+Math.imul(_,ot)|0,o=o+Math.imul(_,at)|0,n=n+Math.imul(y,ut)|0,i=(i=i+Math.imul(y,ft)|0)+Math.imul(v,ut)|0,o=o+Math.imul(v,ft)|0,n=n+Math.imul(p,ht)|0,i=(i=i+Math.imul(p,dt)|0)+Math.imul(b,ht)|0,o=o+Math.imul(b,dt)|0;var St=(f+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,bt)|0)+Math.imul(d,pt)|0))<<13)|0;f=((o=o+Math.imul(d,bt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(F,H),i=(i=Math.imul(F,V))+Math.imul(q,H)|0,o=Math.imul(q,V),n=n+Math.imul(O,X)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(N,X)|0,o=o+Math.imul(N,G)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,tt)|0)+Math.imul(B,Q)|0,o=o+Math.imul(B,tt)|0,n=n+Math.imul(E,rt)|0,i=(i=i+Math.imul(E,nt)|0)+Math.imul(A,rt)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(x,ot)|0,i=(i=i+Math.imul(x,at)|0)+Math.imul(k,ot)|0,o=o+Math.imul(k,at)|0,n=n+Math.imul(w,ut)|0,i=(i=i+Math.imul(w,ft)|0)+Math.imul(_,ut)|0,o=o+Math.imul(_,ft)|0,n=n+Math.imul(y,ht)|0,i=(i=i+Math.imul(y,dt)|0)+Math.imul(v,ht)|0,o=o+Math.imul(v,dt)|0;var Et=(f+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,bt)|0)+Math.imul(b,pt)|0))<<13)|0;f=((o=o+Math.imul(b,bt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(F,X),i=(i=Math.imul(F,G))+Math.imul(q,X)|0,o=Math.imul(q,G),n=n+Math.imul(O,Z)|0,i=(i=i+Math.imul(O,$)|0)+Math.imul(N,Z)|0,o=o+Math.imul(N,$)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,tt)|0,n=n+Math.imul(I,rt)|0,i=(i=i+Math.imul(I,nt)|0)+Math.imul(B,rt)|0,o=o+Math.imul(B,nt)|0,n=n+Math.imul(E,ot)|0,i=(i=i+Math.imul(E,at)|0)+Math.imul(A,ot)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(x,ut)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(k,ut)|0,o=o+Math.imul(k,ft)|0,n=n+Math.imul(w,ht)|0,i=(i=i+Math.imul(w,dt)|0)+Math.imul(_,ht)|0,o=o+Math.imul(_,dt)|0;var At=(f+(n=n+Math.imul(y,pt)|0)|0)+((8191&(i=(i=i+Math.imul(y,bt)|0)+Math.imul(v,pt)|0))<<13)|0;f=((o=o+Math.imul(v,bt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(F,Z),i=(i=Math.imul(F,$))+Math.imul(q,Z)|0,o=Math.imul(q,$),n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(N,Q)|0,o=o+Math.imul(N,tt)|0,n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(P,rt)|0,o=o+Math.imul(P,nt)|0,n=n+Math.imul(I,ot)|0,i=(i=i+Math.imul(I,at)|0)+Math.imul(B,ot)|0,o=o+Math.imul(B,at)|0,n=n+Math.imul(E,ut)|0,i=(i=i+Math.imul(E,ft)|0)+Math.imul(A,ut)|0,o=o+Math.imul(A,ft)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,dt)|0)+Math.imul(k,ht)|0,o=o+Math.imul(k,dt)|0;var jt=(f+(n=n+Math.imul(w,pt)|0)|0)+((8191&(i=(i=i+Math.imul(w,bt)|0)+Math.imul(_,pt)|0))<<13)|0;f=((o=o+Math.imul(_,bt)|0)+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(F,Q),i=(i=Math.imul(F,tt))+Math.imul(q,Q)|0,o=Math.imul(q,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(N,rt)|0,o=o+Math.imul(N,nt)|0,n=n+Math.imul(C,ot)|0,i=(i=i+Math.imul(C,at)|0)+Math.imul(P,ot)|0,o=o+Math.imul(P,at)|0,n=n+Math.imul(I,ut)|0,i=(i=i+Math.imul(I,ft)|0)+Math.imul(B,ut)|0,o=o+Math.imul(B,ft)|0,n=n+Math.imul(E,ht)|0,i=(i=i+Math.imul(E,dt)|0)+Math.imul(A,ht)|0,o=o+Math.imul(A,dt)|0;var It=(f+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,bt)|0)+Math.imul(k,pt)|0))<<13)|0;f=((o=o+Math.imul(k,bt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(F,rt),i=(i=Math.imul(F,nt))+Math.imul(q,rt)|0,o=Math.imul(q,nt),n=n+Math.imul(O,ot)|0,i=(i=i+Math.imul(O,at)|0)+Math.imul(N,ot)|0,o=o+Math.imul(N,at)|0,n=n+Math.imul(C,ut)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(P,ut)|0,o=o+Math.imul(P,ft)|0,n=n+Math.imul(I,ht)|0,i=(i=i+Math.imul(I,dt)|0)+Math.imul(B,ht)|0,o=o+Math.imul(B,dt)|0;var Bt=(f+(n=n+Math.imul(E,pt)|0)|0)+((8191&(i=(i=i+Math.imul(E,bt)|0)+Math.imul(A,pt)|0))<<13)|0;f=((o=o+Math.imul(A,bt)|0)+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(F,ot),i=(i=Math.imul(F,at))+Math.imul(q,ot)|0,o=Math.imul(q,at),n=n+Math.imul(O,ut)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(N,ut)|0,o=o+Math.imul(N,ft)|0,n=n+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,dt)|0)+Math.imul(P,ht)|0,o=o+Math.imul(P,dt)|0;var Tt=(f+(n=n+Math.imul(I,pt)|0)|0)+((8191&(i=(i=i+Math.imul(I,bt)|0)+Math.imul(B,pt)|0))<<13)|0;f=((o=o+Math.imul(B,bt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(F,ut),i=(i=Math.imul(F,ft))+Math.imul(q,ut)|0,o=Math.imul(q,ft),n=n+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,dt)|0)+Math.imul(N,ht)|0,o=o+Math.imul(N,dt)|0;var Ct=(f+(n=n+Math.imul(C,pt)|0)|0)+((8191&(i=(i=i+Math.imul(C,bt)|0)+Math.imul(P,pt)|0))<<13)|0;f=((o=o+Math.imul(P,bt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(F,ht),i=(i=Math.imul(F,dt))+Math.imul(q,ht)|0,o=Math.imul(q,dt);var Pt=(f+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,bt)|0)+Math.imul(N,pt)|0))<<13)|0;f=((o=o+Math.imul(N,bt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863;var Rt=(f+(n=Math.imul(F,pt))|0)+((8191&(i=(i=Math.imul(F,bt))+Math.imul(q,pt)|0))<<13)|0;return f=((o=Math.imul(q,bt))+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,u[0]=mt,u[1]=yt,u[2]=vt,u[3]=gt,u[4]=wt,u[5]=_t,u[6]=Mt,u[7]=xt,u[8]=kt,u[9]=St,u[10]=Et,u[11]=At,u[12]=jt,u[13]=It,u[14]=Bt,u[15]=Tt,u[16]=Ct,u[17]=Pt,u[18]=Rt,0!==f&&(u[19]=f,r.length++),r};function p(t,e,r){return(new b).mulp(t,e,r)}function b(t,e){this.x=t,this.y=e}Math.imul||(l=d),o.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?l(this,t,e):r<63?d(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,a&=67108863}r.words[o]=s,n=a,a=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},b.prototype.makeRBT=function(t){for(var e=new Array(t),r=o.prototype._countBits(t)-1,n=0;n>=1;return n},b.prototype.permute=function(t,e,r,n,i,o){for(var a=0;a>>=1)i++;return 1<>>=13,r[2*a+1]=8191&o,o>>>=13;for(a=2*e;a>=26,e+=i/67108864|0,e+=o>>>26,this.words[r]=67108863&o}return 0!==e&&(this.words[r]=e,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new o(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(e=0;e>>26-r}a&&(this.words[e]=a,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var o=t%26,a=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a)for(this.length-=a,f=0;f=0&&(0!==c||f>=i);f--){var h=0|this.words[f];this.words[f]=c<<26-o|h>>>o,c=h&s}return u&&0!==c&&(u.words[u.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>26,this.words[i]=67108863&o;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),i=t,a=0|i.words[i.length-1];0!==(r=26-this._countBits(a))&&(i=i.ushln(r),n.iushln(r),a=0|i.words[i.length-1]);var s,u=n.length-i.length;if("mod"!==e){(s=new o(null)).length=u+1,s.words=new Array(s.length);for(var f=0;f=0;h--){var d=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(i,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=d)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},o.prototype.divmod=function(t,e,r){return n(!t.isZero()),this.isZero()?{div:new o(0),mod:new o(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(i=s.div.neg()),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(t)),{div:i,mod:a}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(i=s.div.neg()),{div:i,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(t)),{div:s.div,mod:a}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,e);var i,a,s},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),i=t.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?e.div:0!==e.div.negative?e.div.isubn(1):e.div.iaddn(1)},o.prototype.modn=function(t){n(t<=67108863);for(var e=(1<<26)%t,r=0,i=this.length-1;i>=0;i--)r=(e*r+(0|this.words[i]))%t;return r},o.prototype.idivn=function(t){n(t<=67108863);for(var e=0,r=this.length-1;r>=0;r--){var i=(0|this.words[r])+67108864*e;this.words[r]=i/t|0,e=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=new o(1),a=new o(0),s=new o(0),u=new o(1),f=0;e.isEven()&&r.isEven();)e.iushrn(1),r.iushrn(1),++f;for(var c=r.clone(),h=e.clone();!e.isZero();){for(var d=0,l=1;0==(e.words[0]&l)&&d<26;++d,l<<=1);if(d>0)for(e.iushrn(d);d-- >0;)(i.isOdd()||a.isOdd())&&(i.iadd(c),a.isub(h)),i.iushrn(1),a.iushrn(1);for(var p=0,b=1;0==(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(c),u.isub(h)),s.iushrn(1),u.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),a.isub(u)):(r.isub(e),s.isub(i),u.isub(a))}return{a:s,b:u,gcd:r.iushln(f)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i,a=new o(1),s=new o(0),u=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var f=0,c=1;0==(e.words[0]&c)&&f<26;++f,c<<=1);if(f>0)for(e.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);e.cmp(r)>=0?(e.isub(r),a.isub(s)):(r.isub(e),s.isub(a))}return(i=0===e.cmpn(1)?a:s).cmpn(0)<0&&i.iadd(t),i},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var o=e;e=r,r=o}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0==(1&this.words[0])},o.prototype.isOdd=function(){return 1==(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var e,r=t<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),this.length>1)e=1;else{r&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return-1===this.cmpn(t)},o.prototype.lt=function(t){return-1===this.cmp(t)},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new M(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var m={k256:null,p224:null,p192:null,p25519:null};function y(t,e){this.name=t,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function v(){y.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function g(){y.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function w(){y.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function _(){y.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function M(t){if("string"==typeof t){var e=o._prime(t);this.m=e.p,this.prime=e}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function x(t){M.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}y.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},y.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},y.prototype.split=function(t,e){t.iushrn(this.n,0,e)},y.prototype.imulK=function(t){return t.imul(this.k)},i(v,y),v.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=o}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},v.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},o._prime=function(t){if(m[t])return m[t];var e;if("k256"===t)e=new v;else if("p224"===t)e=new g;else if("p192"===t)e=new w;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new _}return m[t]=e,e},M.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},M.prototype._verify2=function(t,e){n(0==(t.negative|e.negative),"red works only with positives"),n(t.red&&t.red===e.red,"red works only with red numbers")},M.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},M.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},M.prototype.add=function(t,e){this._verify2(t,e);var r=t.add(e);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},M.prototype.iadd=function(t,e){this._verify2(t,e);var r=t.iadd(e);return r.cmp(this.m)>=0&&r.isub(this.m),r},M.prototype.sub=function(t,e){this._verify2(t,e);var r=t.sub(e);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},M.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},M.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},M.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},M.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},M.prototype.isqr=function(t){return this.imul(t,t.clone())},M.prototype.sqr=function(t){return this.mul(t,t)},M.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(n(e%2==1),3===e){var r=this.m.add(new o(1)).iushrn(2);return this.pow(t,r)}for(var i=this.m.subn(1),a=0;!i.isZero()&&0===i.andln(1);)a++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),u=s.redNeg(),f=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new o(2*c*c).toRed(this);0!==this.pow(c,f).cmp(u);)c.redIAdd(u);for(var h=this.pow(c,i),d=this.pow(t,i.addn(1).iushrn(1)),l=this.pow(t,i),p=a;0!==l.cmp(s);){for(var b=l,m=0;0!==b.cmp(s);m++)b=b.redSqr();n(m=0;n--){for(var f=e.words[n],c=u-1;c>=0;c--){var h=f>>c&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===n&&0===c)&&(i=this.mul(i,r[a]),s=0,a=0)):s=0}u=26}return i},M.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},M.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},o.mont=function(t){return new x(t)},i(x,M),x.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},x.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},x.prototype.imul=function(t,e){if(t.isZero()||e.isZero())return t.words[0]=0,t.length=1,t;var r=t.imul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new o(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},x.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:17}],241:[function(t,e,r){arguments[4][16][0].apply(r,arguments)},{crypto:17,dup:16}],242:[function(t,e,r){arguments[4][18][0].apply(r,arguments)},{dup:18,"safe-buffer":350}],243:[function(t,e,r){arguments[4][19][0].apply(r,arguments)},{"./aes":242,"./ghash":247,"./incr32":248,"buffer-xor":269,"cipher-base":270,dup:19,inherits:325,"safe-buffer":350}],244:[function(t,e,r){arguments[4][20][0].apply(r,arguments)},{"./decrypter":245,"./encrypter":246,"./modes/list.json":256,dup:20}],245:[function(t,e,r){arguments[4][21][0].apply(r,arguments)},{"./aes":242,"./authCipher":243,"./modes":255,"./streamCipher":258,"cipher-base":270,dup:21,evp_bytestokey:310,inherits:325,"safe-buffer":350}],246:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{"./aes":242,"./authCipher":243,"./modes":255,"./streamCipher":258,"cipher-base":270,dup:22,evp_bytestokey:310,inherits:325,"safe-buffer":350}],247:[function(t,e,r){arguments[4][23][0].apply(r,arguments)},{dup:23,"safe-buffer":350}],248:[function(t,e,r){arguments[4][24][0].apply(r,arguments)},{dup:24}],249:[function(t,e,r){arguments[4][25][0].apply(r,arguments)},{"buffer-xor":269,dup:25}],250:[function(t,e,r){arguments[4][26][0].apply(r,arguments)},{"buffer-xor":269,dup:26,"safe-buffer":350}],251:[function(t,e,r){arguments[4][27][0].apply(r,arguments)},{dup:27,"safe-buffer":350}],252:[function(t,e,r){arguments[4][28][0].apply(r,arguments)},{dup:28,"safe-buffer":350}],253:[function(t,e,r){arguments[4][29][0].apply(r,arguments)},{"../incr32":248,"buffer-xor":269,dup:29,"safe-buffer":350}],254:[function(t,e,r){arguments[4][30][0].apply(r,arguments)},{dup:30}],255:[function(t,e,r){arguments[4][31][0].apply(r,arguments)},{"./cbc":249,"./cfb":250,"./cfb1":251,"./cfb8":252,"./ctr":253,"./ecb":254,"./list.json":256,"./ofb":257,dup:31}],256:[function(t,e,r){arguments[4][32][0].apply(r,arguments)},{dup:32}],257:[function(t,e,r){(function(e){var n=t("buffer-xor");r.encrypt=function(t,r){for(;t._cache.length=0||!r.umod(t.prime1)||!r.umod(t.prime2);)r=new n(i(e));return r}e.exports=o,o.getr=a}).call(this,t("buffer").Buffer)},{"bn.js":240,buffer:47,randombytes:347}],263:[function(t,e,r){arguments[4][39][0].apply(r,arguments)},{"./browser/algorithms.json":264,dup:39}],264:[function(t,e,r){arguments[4][40][0].apply(r,arguments)},{dup:40}],265:[function(t,e,r){arguments[4][41][0].apply(r,arguments)},{dup:41}],266:[function(t,e,r){(function(r){var n=t("create-hash"),i=t("stream"),o=t("inherits"),a=t("./sign"),s=t("./verify"),u=t("./algorithms.json");function f(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function c(t){i.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function h(t){return new f(t)}function d(t){return new c(t)}Object.keys(u).forEach(function(t){u[t].id=new r(u[t].id,"hex"),u[t.toLowerCase()]=u[t]}),o(f,i.Writable),f.prototype._write=function(t,e,r){this._hash.update(t),r()},f.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},f.prototype.sign=function(t,e){this.end();var r=this._hash.digest(),n=a(r,t,this._hashType,this._signType,this._tag);return e?n.toString(e):n},o(c,i.Writable),c.prototype._write=function(t,e,r){this._hash.update(t),r()},c.prototype.update=function(t,e){return"string"==typeof t&&(t=new r(t,e)),this._hash.update(t),this},c.prototype.verify=function(t,e,n){"string"==typeof e&&(e=new r(e,n)),this.end();var i=this._hash.digest();return s(e,i,t,this._signType,this._tag)},e.exports={Sign:h,Verify:d,createSign:h,createVerify:d}}).call(this,t("buffer").Buffer)},{"./algorithms.json":264,"./sign":267,"./verify":268,buffer:47,"create-hash":272,inherits:325,stream:156}],267:[function(t,e,r){(function(r){var n=t("create-hmac"),i=t("browserify-rsa"),o=t("elliptic").ec,a=t("bn.js"),s=t("parse-asn1"),u=t("./curves.json");function f(t,e,i,o){if((t=new r(t.toArray())).length0&&r.ishrn(n),r}function h(t,e,i){var o,a;do{for(o=new r(0);8*o.length=e)throw new Error("invalid sig")}e.exports=function(t,e,u,f,c){var h=o(u);if("ec"===h.type){if("ecdsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");return function(t,e,r){var n=a[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var o=new i(n),s=r.data.subjectPrivateKey.data;return o.verify(e,t,s)}(t,e,h)}if("dsa"===h.type){if("dsa"!==f)throw new Error("wrong public key type");return function(t,e,r){var i=r.data.p,a=r.data.q,u=r.data.g,f=r.data.pub_key,c=o.signature.decode(t,"der"),h=c.s,d=c.r;s(h,a),s(d,a);var l=n.mont(i),p=h.invm(a);return 0===u.toRed(l).redPow(new n(e).mul(p).mod(a)).fromRed().mul(f.toRed(l).redPow(d.mul(p).mod(a)).fromRed()).mod(i).mod(a).cmp(d)}(t,e,h)}if("rsa"!==f&&"ecdsa/rsa"!==f)throw new Error("wrong public key type");e=r.concat([c,e]);for(var d=h.modulus.byteLength(),l=[1],p=0;e.length+l.length+2>>2),a=0,s=0;a=6.0.0 <7.0.0",type:"range"},"/Users/frozeman/Sites/_ethereum/web3/packages/web3-eth-accounts/node_modules/browserify-sign"]],_from:"elliptic@>=6.0.0 <7.0.0",_id:"elliptic@6.4.0",_inCache:!0,_location:"/elliptic",_nodeVersion:"7.0.0",_npmOperationalInternal:{host:"packages-18-east.internal.npmjs.com",tmp:"tmp/elliptic-6.4.0.tgz_1487798866428_0.30510620190761983"},_npmUser:{name:"indutny",email:"fedor@indutny.com"},_npmVersion:"3.10.8",_phantomChildren:{},_requested:{raw:"elliptic@^6.0.0",scope:null,escapedName:"elliptic",name:"elliptic",rawSpec:"^6.0.0",spec:">=6.0.0 <7.0.0",type:"range"},_requiredBy:["/browserify-sign","/create-ecdh","/eth-lib"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",_shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",_shrinkwrap:null,_spec:"elliptic@^6.0.0",_where:"/Users/frozeman/Sites/_ethereum/web3/packages/web3-eth-accounts/node_modules/browserify-sign",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0","hmac-drbg":"^1.0.0",inherits:"^2.0.1","minimalistic-assert":"^1.0.0","minimalistic-crypto-utils":"^1.0.0"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-cli":"^1.2.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},directories:{},dist:{shasum:"cac9af8762c85836187003c8dfe193e5e2eae5df",tarball:"https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz"},files:["lib"],gitHead:"6b0d2b76caae91471649c8e21f0b1d3ba0f96090",homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",maintainers:[{name:"indutny",email:"fedor@indutny.com"}],name:"elliptic",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.4.0"}},{}],304:[function(t,e,r){(function(r){var n=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!e||r.length!==e);n=!0);}catch(t){i=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw o}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=t("./bytes"),o=t("./nat"),a=t("elliptic"),s=(t("./rlp"),new a.ec("secp256k1")),u=t("./hash"),f=u.keccak256,c=u.keccak256s,h=function(t){for(var e=c(t.slice(2)),r="0x",n=0;n<40;n++)r+=parseInt(e[n+2],16)>7?t[n+2].toUpperCase():t[n+2];return r},d=function(t){var e=new r(t.slice(2),"hex"),n="0x"+s.keyFromPrivate(e).getPublic(!1,"hex").slice(2),i=f(n);return{address:h("0x"+i.slice(-40)),privateKey:t}},l=function(t){var e=n(t,3),r=e[0],o=i.pad(32,e[1]),a=i.pad(32,e[2]);return i.flatten([o,a,r])},p=function(t){return[i.slice(64,i.length(t),t),i.slice(0,32,t),i.slice(32,64,t)]},b=function(t){return function(e,n){var a=s.keyFromPrivate(new r(n.slice(2),"hex")).sign(new r(e.slice(2),"hex"),{canonical:!0});return l([o.fromString(i.fromNumber(t+a.recoveryParam)),i.pad(32,i.fromNat("0x"+a.r.toString(16))),i.pad(32,i.fromNat("0x"+a.s.toString(16)))])}},m=b(27);e.exports={create:function(t){var e=f(i.concat(i.random(32),t||i.random(32))),r=i.concat(i.concat(i.random(32),e),i.random(32)),n=f(r);return d(n)},toChecksum:h,fromPrivate:d,sign:m,makeSigner:b,recover:function(t,e){var n=p(e),o={v:i.toNumber(n[0]),r:n[1].slice(2),s:n[2].slice(2)},a="0x"+s.recoverPubKey(new r(t.slice(2),"hex"),o,o.v<2?o.v:1-o.v%2).encode("hex",!1).slice(2),u=f(a);return h("0x"+u.slice(-40))},encodeSignature:l,decodeSignature:p}}).call(this,t("buffer").Buffer)},{"./bytes":306,"./hash":307,"./nat":308,"./rlp":309,buffer:47,elliptic:288}],305:[function(t,e,r){arguments[4][163][0].apply(r,arguments)},{dup:163}],306:[function(t,e,r){arguments[4][164][0].apply(r,arguments)},{"./array.js":305,dup:164}],307:[function(t,e,r){arguments[4][165][0].apply(r,arguments)},{dup:165}],308:[function(t,e,r){var n=t("bn.js"),i=t("./bytes"),o=function(t){return new n(t.slice(2),16)},a=function(t){var e="0x"+("0x"===t.slice(0,2)?new n(t.slice(2),16):new n(t,10)).toString("hex");return"0x0"===e?"0x":e},s=function(t){return"string"==typeof t?/^0x/.test(t)?t:"0x"+t:"0x"+new n(t).toString("hex")},u=function(t){return o(t).toNumber()},f=function(t){return function(e,r){return"0x"+o(e)[t](o(r)).toString("hex")}},c=f("add"),h=f("mul"),d=f("div"),l=f("sub");e.exports={toString:function(t){return o(t).toString(10)},fromString:a,toNumber:u,fromNumber:s,toEther:function(t){return u(d(t,a("10000000000")))/1e8},fromEther:function(t){return h(s(Math.floor(1e8*t)),a("10000000000"))},toUint256:function(t){return i.pad(32,t)},add:c,mul:h,div:d,sub:l}},{"./bytes":306,"bn.js":240}],309:[function(t,e,r){e.exports={encode:function(t){var e=function(t){return(e=t.toString(16)).length%2==0?e:"0"+e;var e},r=function(t,r){return t<56?e(r+t):e(r+e(t).length/2+55)+e(t)};return"0x"+function t(e){if("string"==typeof e){var n=e.slice(2);return(2!=n.length||n>="80"?r(n.length/2,128):"")+n}var i=e.map(t).join("");return r(i.length/2,192)+i}(t)},decode:function(t){var e=2,r=function(){if(e>=t.length)throw"";var r=t.slice(e,e+2);return r<"80"?(e+=2,"0x"+r):r<"c0"?i():o()},n=function(){var r=parseInt(t.slice(e,e+=2),16)%64;return r<56?r:parseInt(t.slice(e,e+=2*(r-55)),16)},i=function(){var r=n();return"0x"+t.slice(e,e+=2*r)},o=function(){for(var t=2*n()+e,i=[];e=this._blockSize;){for(var o=this._blockOffset;o0;++a)this._length[a]+=s,(s=this._length[a]/4294967296|0)>0&&(this._length[a]-=4294967296*s);return this},i.prototype._update=function(t){throw new Error("_update is not implemented")},i.prototype.digest=function(t){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var e=this._digest();return void 0!==t&&(e=e.toString(t)),e},i.prototype._digest=function(){throw new Error("_digest is not implemented")},e.exports=i}).call(this,t("buffer").Buffer)},{buffer:47,inherits:325,stream:156}],312:[function(t,e,r){arguments[4][86][0].apply(r,arguments)},{"./hash/common":313,"./hash/hmac":314,"./hash/ripemd":315,"./hash/sha":316,"./hash/utils":323,dup:86}],313:[function(t,e,r){arguments[4][87][0].apply(r,arguments)},{"./utils":323,dup:87,"minimalistic-assert":329}],314:[function(t,e,r){arguments[4][88][0].apply(r,arguments)},{"./utils":323,dup:88,"minimalistic-assert":329}],315:[function(t,e,r){arguments[4][89][0].apply(r,arguments)},{"./common":313,"./utils":323,dup:89}],316:[function(t,e,r){arguments[4][90][0].apply(r,arguments)},{"./sha/1":317,"./sha/224":318,"./sha/256":319,"./sha/384":320,"./sha/512":321,dup:90}],317:[function(t,e,r){arguments[4][91][0].apply(r,arguments)},{"../common":313,"../utils":323,"./common":322,dup:91}],318:[function(t,e,r){arguments[4][92][0].apply(r,arguments)},{"../utils":323,"./256":319,dup:92}],319:[function(t,e,r){arguments[4][93][0].apply(r,arguments)},{"../common":313,"../utils":323,"./common":322,dup:93,"minimalistic-assert":329}],320:[function(t,e,r){arguments[4][94][0].apply(r,arguments)},{"../utils":323,"./512":321,dup:94}],321:[function(t,e,r){arguments[4][95][0].apply(r,arguments)},{"../common":313,"../utils":323,dup:95,"minimalistic-assert":329}],322:[function(t,e,r){arguments[4][96][0].apply(r,arguments)},{"../utils":323,dup:96}],323:[function(t,e,r){arguments[4][97][0].apply(r,arguments)},{dup:97,inherits:325,"minimalistic-assert":329}],324:[function(t,e,r){arguments[4][98][0].apply(r,arguments)},{dup:98,"hash.js":312,"minimalistic-assert":329,"minimalistic-crypto-utils":330}],325:[function(t,e,r){arguments[4][101][0].apply(r,arguments)},{dup:101}],326:[function(t,e,r){(function(r){var n=t("inherits"),i=t("hash-base"),o=new Array(16);function a(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function s(t,e){return t<>>32-e}function u(t,e,r,n,i,o,a){return s(t+(e&r|~e&n)+i+o|0,a)+e|0}function f(t,e,r,n,i,o,a){return s(t+(e&n|r&~n)+i+o|0,a)+e|0}function c(t,e,r,n,i,o,a){return s(t+(e^r^n)+i+o|0,a)+e|0}function h(t,e,r,n,i,o,a){return s(t+(r^(e|~n))+i+o|0,a)+e|0}n(a,i),a.prototype._update=function(){for(var t=o,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,a=this._d;n=h(n=h(n=h(n=h(n=c(n=c(n=c(n=c(n=f(n=f(n=f(n=f(n=u(n=u(n=u(n=u(n,i=u(i,a=u(a,r=u(r,n,i,a,t[0],3614090360,7),n,i,t[1],3905402710,12),r,n,t[2],606105819,17),a,r,t[3],3250441966,22),i=u(i,a=u(a,r=u(r,n,i,a,t[4],4118548399,7),n,i,t[5],1200080426,12),r,n,t[6],2821735955,17),a,r,t[7],4249261313,22),i=u(i,a=u(a,r=u(r,n,i,a,t[8],1770035416,7),n,i,t[9],2336552879,12),r,n,t[10],4294925233,17),a,r,t[11],2304563134,22),i=u(i,a=u(a,r=u(r,n,i,a,t[12],1804603682,7),n,i,t[13],4254626195,12),r,n,t[14],2792965006,17),a,r,t[15],1236535329,22),i=f(i,a=f(a,r=f(r,n,i,a,t[1],4129170786,5),n,i,t[6],3225465664,9),r,n,t[11],643717713,14),a,r,t[0],3921069994,20),i=f(i,a=f(a,r=f(r,n,i,a,t[5],3593408605,5),n,i,t[10],38016083,9),r,n,t[15],3634488961,14),a,r,t[4],3889429448,20),i=f(i,a=f(a,r=f(r,n,i,a,t[9],568446438,5),n,i,t[14],3275163606,9),r,n,t[3],4107603335,14),a,r,t[8],1163531501,20),i=f(i,a=f(a,r=f(r,n,i,a,t[13],2850285829,5),n,i,t[2],4243563512,9),r,n,t[7],1735328473,14),a,r,t[12],2368359562,20),i=c(i,a=c(a,r=c(r,n,i,a,t[5],4294588738,4),n,i,t[8],2272392833,11),r,n,t[11],1839030562,16),a,r,t[14],4259657740,23),i=c(i,a=c(a,r=c(r,n,i,a,t[1],2763975236,4),n,i,t[4],1272893353,11),r,n,t[7],4139469664,16),a,r,t[10],3200236656,23),i=c(i,a=c(a,r=c(r,n,i,a,t[13],681279174,4),n,i,t[0],3936430074,11),r,n,t[3],3572445317,16),a,r,t[6],76029189,23),i=c(i,a=c(a,r=c(r,n,i,a,t[9],3654602809,4),n,i,t[12],3873151461,11),r,n,t[15],530742520,16),a,r,t[2],3299628645,23),i=h(i,a=h(a,r=h(r,n,i,a,t[0],4096336452,6),n,i,t[7],1126891415,10),r,n,t[14],2878612391,15),a,r,t[5],4237533241,21),i=h(i,a=h(a,r=h(r,n,i,a,t[12],1700485571,6),n,i,t[3],2399980690,10),r,n,t[10],4293915773,15),a,r,t[1],2240044497,21),i=h(i,a=h(a,r=h(r,n,i,a,t[8],1873313359,6),n,i,t[15],4264355552,10),r,n,t[6],2734768916,15),a,r,t[13],1309151649,21),i=h(i,a=h(a,r=h(r,n,i,a,t[4],4149444226,6),n,i,t[11],3174756917,10),r,n,t[2],718787259,15),a,r,t[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+a|0},a.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},e.exports=a}).call(this,t("buffer").Buffer)},{buffer:47,"hash-base":327,inherits:325}],327:[function(t,e,r){arguments[4][105][0].apply(r,arguments)},{dup:105,inherits:325,"safe-buffer":350,stream:156}],328:[function(t,e,r){arguments[4][106][0].apply(r,arguments)},{"bn.js":240,brorand:241,dup:106}],329:[function(t,e,r){arguments[4][107][0].apply(r,arguments)},{dup:107}],330:[function(t,e,r){arguments[4][108][0].apply(r,arguments)},{dup:108}],331:[function(t,e,r){arguments[4][109][0].apply(r,arguments)},{dup:109}],332:[function(t,e,r){arguments[4][110][0].apply(r,arguments)},{"./certificate":333,"asn1.js":226,dup:110}],333:[function(t,e,r){arguments[4][111][0].apply(r,arguments)},{"asn1.js":226,dup:111}],334:[function(t,e,r){(function(r){var n=/Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m,i=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m,o=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m,a=t("evp_bytestokey"),s=t("browserify-aes");e.exports=function(t,e){var u,f=t.toString(),c=f.match(n);if(c){var h="aes"+c[1],d=new r(c[2],"hex"),l=new r(c[3].replace(/\r?\n/g,""),"base64"),p=a(e,d.slice(0,8),parseInt(c[1],10)).key,b=[],m=s.createDecipheriv(h,p,d);b.push(m.update(l)),b.push(m.final()),u=r.concat(b)}else{var y=f.match(o);u=new r(y[2].replace(/\r?\n/g,""),"base64")}return{tag:f.match(i)[1],data:u}}}).call(this,t("buffer").Buffer)},{"browserify-aes":244,buffer:47,evp_bytestokey:310}],335:[function(t,e,r){(function(r){var n=t("./asn1"),i=t("./aesid.json"),o=t("./fixProc"),a=t("browserify-aes"),s=t("pbkdf2");function u(t){var e;"object"!==(void 0===t?"undefined":_typeof(t))||r.isBuffer(t)||(e=t.passphrase,t=t.key),"string"==typeof t&&(t=new r(t));var u,f,c,h,d,l,p,b,m,y,v,g,w,_=o(t,e),M=_.tag,x=_.data;switch(M){case"CERTIFICATE":f=n.certificate.decode(x,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(f||(f=n.PublicKey.decode(x,"der")),u=f.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPublicKey.decode(f.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return f.subjectPrivateKey=f.subjectPublicKey,{type:"ec",data:f};case"1.2.840.10040.4.1":return f.algorithm.params.pub_key=n.DSAparam.decode(f.subjectPublicKey.data,"der"),{type:"dsa",data:f.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+M);case"ENCRYPTED PRIVATE KEY":x=n.EncryptedPrivateKey.decode(x,"der"),h=e,d=(c=x).algorithm.decrypt.kde.kdeparams.salt,l=parseInt(c.algorithm.decrypt.kde.kdeparams.iters.toString(),10),p=i[c.algorithm.decrypt.cipher.algo.join(".")],b=c.algorithm.decrypt.cipher.iv,m=c.subjectPrivateKey,y=parseInt(p.split("-")[1],10)/8,v=s.pbkdf2Sync(h,d,l,y),g=a.createDecipheriv(p,v,b),(w=[]).push(g.update(m)),w.push(g.final()),x=r.concat(w);case"PRIVATE KEY":switch(u=(f=n.PrivateKey.decode(x,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return n.RSAPrivateKey.decode(f.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:f.algorithm.curve,privateKey:n.ECPrivateKey.decode(f.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return f.algorithm.params.priv_key=n.DSAparam.decode(f.subjectPrivateKey,"der"),{type:"dsa",params:f.algorithm.params};default:throw new Error("unknown key id "+u)}throw new Error("unknown key type "+M);case"RSA PUBLIC KEY":return n.RSAPublicKey.decode(x,"der");case"RSA PRIVATE KEY":return n.RSAPrivateKey.decode(x,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:n.DSAPrivateKey.decode(x,"der")};case"EC PRIVATE KEY":return{curve:(x=n.ECPrivateKey.decode(x,"der")).parameters.value,privateKey:x.privateKey};default:throw new Error("unknown key type "+M)}}e.exports=u,u.signature=n.signature}).call(this,t("buffer").Buffer)},{"./aesid.json":331,"./asn1":332,"./fixProc":334,"browserify-aes":244,buffer:47,pbkdf2:336}],336:[function(t,e,r){arguments[4][114][0].apply(r,arguments)},{"./lib/async":337,"./lib/sync":340,dup:114}],337:[function(t,e,r){(function(r,n){var i,o=t("./precondition"),a=t("./default-encoding"),s=t("./sync"),u=t("safe-buffer").Buffer,f=n.crypto&&n.crypto.subtle,c={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},h=[];function d(t,e,r,n,i){return f.importKey("raw",t,{name:"PBKDF2"},!1,["deriveBits"]).then(function(t){return f.deriveBits({name:"PBKDF2",salt:e,iterations:r,hash:{name:i}},t,n<<3)}).then(function(t){return u.from(t)})}e.exports=function(t,e,l,p,b,m){if(u.isBuffer(t)||(t=u.from(t,a)),u.isBuffer(e)||(e=u.from(e,a)),o(l,p),"function"==typeof b&&(m=b,b=void 0),"function"!=typeof m)throw new Error("No callback provided to pbkdf2");var y,v,g=c[(b=b||"sha1").toLowerCase()];if(!g||"function"!=typeof n.Promise)return r.nextTick(function(){var r;try{r=s(t,e,l,p,b)}catch(t){return m(t)}m(null,r)});y=function(t){if(n.process&&!n.process.browser)return Promise.resolve(!1);if(!f||!f.importKey||!f.deriveBits)return Promise.resolve(!1);if(void 0!==h[t])return h[t];var e=d(i=i||u.alloc(8),i,10,128,t).then(function(){return!0}).catch(function(){return!1});return h[t]=e,e}(g).then(function(r){return r?d(t,e,l,p,g):s(t,e,l,p,b)}),v=m,y.then(function(t){r.nextTick(function(){v(null,t)})},function(t){r.nextTick(function(){v(t)})})}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-encoding":338,"./precondition":339,"./sync":340,_process:120,"safe-buffer":350}],338:[function(t,e,r){(function(t){var r;t.browser?r="utf-8":r=parseInt(t.version.split(".")[0].slice(1),10)>=6?"utf-8":"binary";e.exports=r}).call(this,t("_process"))},{_process:120}],339:[function(t,e,r){arguments[4][117][0].apply(r,arguments)},{dup:117}],340:[function(t,e,r){arguments[4][118][0].apply(r,arguments)},{"./default-encoding":338,"./precondition":339,"create-hash/md5":274,dup:118,ripemd160:349,"safe-buffer":350,"sha.js":354}],341:[function(t,e,r){arguments[4][121][0].apply(r,arguments)},{"./privateDecrypt":343,"./publicEncrypt":344,dup:121}],342:[function(t,e,r){(function(r){var n=t("create-hash");function i(t){var e=new r(4);return e.writeUInt32BE(t,0),e}e.exports=function(t,e){for(var o,a=new r(""),s=0;a.lengthp||new a(e).cmp(l.modulus)>=0)throw new Error("decryption error");d=c?f(new a(e),l):s(e,l);var b=new r(p-d.length);if(b.fill(0),d=r.concat([b,d],p),4===h)return function(t,e){t.modulus;var n=t.modulus.byteLength(),a=(e.length,u("sha1").update(new r("")).digest()),s=a.length;if(0!==e[0])throw new Error("decryption error");var f=e.slice(1,s+1),c=e.slice(s+1),h=o(f,i(c,s)),d=o(c,i(h,n-s-1));if(function(t,e){t=new r(t),e=new r(e);var n=0,i=t.length;t.length!==e.length&&(n++,i=Math.min(t.length,e.length));var o=-1;for(;++o=e.length){o++;break}var a=e.slice(2,i-1);e.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;a.length<8&&o++;if(o)throw new Error("decryption error");return e.slice(i)}(0,d,c);if(3===h)return d;throw new Error("unknown padding")}}).call(this,t("buffer").Buffer)},{"./mgf":342,"./withPublic":345,"./xor":346,"bn.js":240,"browserify-rsa":262,buffer:47,"create-hash":272,"parse-asn1":335}],344:[function(t,e,r){(function(r){var n=t("parse-asn1"),i=t("randombytes"),o=t("create-hash"),a=t("./mgf"),s=t("./xor"),u=t("bn.js"),f=t("./withPublic"),c=t("browserify-rsa");e.exports=function(t,e,h){var d;d=t.padding?t.padding:h?1:4;var l,p=n(t);if(4===d)l=function(t,e){var n=t.modulus.byteLength(),f=e.length,c=o("sha1").update(new r("")).digest(),h=c.length,d=2*h;if(f>n-d-2)throw new Error("message too long");var l=new r(n-f-d-2);l.fill(0);var p=n-h-1,b=i(h),m=s(r.concat([c,l,new r([1]),e],p),a(b,p)),y=s(b,a(m,h));return new u(r.concat([new r([0]),y,m],n))}(p,e);else if(1===d)l=function(t,e,n){var o,a=e.length,s=t.modulus.byteLength();if(a>s-11)throw new Error("message too long");n?(o=new r(s-a-3)).fill(255):o=function(t,e){var n,o=new r(t),a=0,s=i(2*t),u=0;for(;a=0)throw new Error("data too long for modulus")}return h?c(l,p):f(l,p)}}).call(this,t("buffer").Buffer)},{"./mgf":342,"./withPublic":345,"./xor":346,"bn.js":240,"browserify-rsa":262,buffer:47,"create-hash":272,"parse-asn1":335,randombytes:347}],345:[function(t,e,r){(function(r){var n=t("bn.js");e.exports=function(t,e){return new r(t.toRed(n.mont(e.modulus)).redPow(new n(e.publicExponent)).fromRed().toArray())}}).call(this,t("buffer").Buffer)},{"bn.js":240,buffer:47}],346:[function(t,e,r){arguments[4][126][0].apply(r,arguments)},{dup:126}],347:[function(t,e,r){(function(r,n){var i=t("safe-buffer").Buffer,o=n.crypto||n.msCrypto;o&&o.getRandomValues?e.exports=function(t,e){if(t>65536)throw new Error("requested too many random bytes");var a=new n.Uint8Array(t);t>0&&o.getRandomValues(a);var s=i.from(a.buffer);if("function"==typeof e)return r.nextTick(function(){e(null,s)});return s}:e.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:120,"safe-buffer":350}],348:[function(t,e,r){(function(e,n){function i(){throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}var o=t("safe-buffer"),a=t("randombytes"),s=o.Buffer,u=o.kMaxLength,f=n.crypto||n.msCrypto,c=Math.pow(2,32)-1;function h(t,e){if("number"!=typeof t||t!=t)throw new TypeError("offset must be a number");if(t>c||t<0)throw new TypeError("offset must be a uint32");if(t>u||t>e)throw new RangeError("offset out of range")}function d(t,e,r){if("number"!=typeof t||t!=t)throw new TypeError("size must be a number");if(t>c||t<0)throw new TypeError("size must be a uint32");if(t+e>r||t>u)throw new RangeError("buffer too small")}function l(t,r,n,i){if(e.browser){var o=t.buffer,s=new Uint8Array(o,r,n);return f.getRandomValues(s),i?void e.nextTick(function(){i(null,t)}):t}if(!i)return a(n).copy(t,r),t;a(n,function(e,n){if(e)return i(e);n.copy(t,r),i(null,t)})}f&&f.getRandomValues||!e.browser?(r.randomFill=function(t,e,r,i){if(!(s.isBuffer(t)||t instanceof n.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if("function"==typeof e)i=e,e=0,r=t.length;else if("function"==typeof r)i=r,r=t.length-e;else if("function"!=typeof i)throw new TypeError('"cb" argument must be a function');return h(e,t.length),d(r,e,t.length),l(t,e,r,i)},r.randomFillSync=function(t,e,r){void 0===e&&(e=0);if(!(s.isBuffer(t)||t instanceof n.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');h(e,t.length),void 0===r&&(r=t.length-e);return d(r,e,t.length),l(t,e,r)}):(r.randomFill=i,r.randomFillSync=i)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:120,randombytes:347,"safe-buffer":350}],349:[function(t,e,r){(function(r){var n=t("inherits"),i=t("hash-base");function o(){i.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}function a(t,e){return t<>>32-e}function s(t,e,r,n,i,o,s,u){return a(t+(e^r^n)+o+s|0,u)+i|0}function u(t,e,r,n,i,o,s,u){return a(t+(e&r|~e&n)+o+s|0,u)+i|0}function f(t,e,r,n,i,o,s,u){return a(t+((e|~r)^n)+o+s|0,u)+i|0}function c(t,e,r,n,i,o,s,u){return a(t+(e&n|r&~n)+o+s|0,u)+i|0}function h(t,e,r,n,i,o,s,u){return a(t+(e^(r|~n))+o+s|0,u)+i|0}n(o,i),o.prototype._update=function(){for(var t=new Array(16),e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var r=this._a,n=this._b,i=this._c,o=this._d,d=this._e;d=s(d,r=s(r,n,i,o,d,t[0],0,11),n,i=a(i,10),o,t[1],0,14),n=s(n=a(n,10),i=s(i,o=s(o,d,r,n,i,t[2],0,15),d,r=a(r,10),n,t[3],0,12),o,d=a(d,10),r,t[4],0,5),o=s(o=a(o,10),d=s(d,r=s(r,n,i,o,d,t[5],0,8),n,i=a(i,10),o,t[6],0,7),r,n=a(n,10),i,t[7],0,9),r=s(r=a(r,10),n=s(n,i=s(i,o,d,r,n,t[8],0,11),o,d=a(d,10),r,t[9],0,13),i,o=a(o,10),d,t[10],0,14),i=s(i=a(i,10),o=s(o,d=s(d,r,n,i,o,t[11],0,15),r,n=a(n,10),i,t[12],0,6),d,r=a(r,10),n,t[13],0,7),d=u(d=a(d,10),r=s(r,n=s(n,i,o,d,r,t[14],0,9),i,o=a(o,10),d,t[15],0,8),n,i=a(i,10),o,t[7],1518500249,7),n=u(n=a(n,10),i=u(i,o=u(o,d,r,n,i,t[4],1518500249,6),d,r=a(r,10),n,t[13],1518500249,8),o,d=a(d,10),r,t[1],1518500249,13),o=u(o=a(o,10),d=u(d,r=u(r,n,i,o,d,t[10],1518500249,11),n,i=a(i,10),o,t[6],1518500249,9),r,n=a(n,10),i,t[15],1518500249,7),r=u(r=a(r,10),n=u(n,i=u(i,o,d,r,n,t[3],1518500249,15),o,d=a(d,10),r,t[12],1518500249,7),i,o=a(o,10),d,t[0],1518500249,12),i=u(i=a(i,10),o=u(o,d=u(d,r,n,i,o,t[9],1518500249,15),r,n=a(n,10),i,t[5],1518500249,9),d,r=a(r,10),n,t[2],1518500249,11),d=u(d=a(d,10),r=u(r,n=u(n,i,o,d,r,t[14],1518500249,7),i,o=a(o,10),d,t[11],1518500249,13),n,i=a(i,10),o,t[8],1518500249,12),n=f(n=a(n,10),i=f(i,o=f(o,d,r,n,i,t[3],1859775393,11),d,r=a(r,10),n,t[10],1859775393,13),o,d=a(d,10),r,t[14],1859775393,6),o=f(o=a(o,10),d=f(d,r=f(r,n,i,o,d,t[4],1859775393,7),n,i=a(i,10),o,t[9],1859775393,14),r,n=a(n,10),i,t[15],1859775393,9),r=f(r=a(r,10),n=f(n,i=f(i,o,d,r,n,t[8],1859775393,13),o,d=a(d,10),r,t[1],1859775393,15),i,o=a(o,10),d,t[2],1859775393,14),i=f(i=a(i,10),o=f(o,d=f(d,r,n,i,o,t[7],1859775393,8),r,n=a(n,10),i,t[0],1859775393,13),d,r=a(r,10),n,t[6],1859775393,6),d=f(d=a(d,10),r=f(r,n=f(n,i,o,d,r,t[13],1859775393,5),i,o=a(o,10),d,t[11],1859775393,12),n,i=a(i,10),o,t[5],1859775393,7),n=c(n=a(n,10),i=c(i,o=f(o,d,r,n,i,t[12],1859775393,5),d,r=a(r,10),n,t[1],2400959708,11),o,d=a(d,10),r,t[9],2400959708,12),o=c(o=a(o,10),d=c(d,r=c(r,n,i,o,d,t[11],2400959708,14),n,i=a(i,10),o,t[10],2400959708,15),r,n=a(n,10),i,t[0],2400959708,14),r=c(r=a(r,10),n=c(n,i=c(i,o,d,r,n,t[8],2400959708,15),o,d=a(d,10),r,t[12],2400959708,9),i,o=a(o,10),d,t[4],2400959708,8),i=c(i=a(i,10),o=c(o,d=c(d,r,n,i,o,t[13],2400959708,9),r,n=a(n,10),i,t[3],2400959708,14),d,r=a(r,10),n,t[7],2400959708,5),d=c(d=a(d,10),r=c(r,n=c(n,i,o,d,r,t[15],2400959708,6),i,o=a(o,10),d,t[14],2400959708,8),n,i=a(i,10),o,t[5],2400959708,6),n=h(n=a(n,10),i=c(i,o=c(o,d,r,n,i,t[6],2400959708,5),d,r=a(r,10),n,t[2],2400959708,12),o,d=a(d,10),r,t[4],2840853838,9),o=h(o=a(o,10),d=h(d,r=h(r,n,i,o,d,t[0],2840853838,15),n,i=a(i,10),o,t[5],2840853838,5),r,n=a(n,10),i,t[9],2840853838,11),r=h(r=a(r,10),n=h(n,i=h(i,o,d,r,n,t[7],2840853838,6),o,d=a(d,10),r,t[12],2840853838,8),i,o=a(o,10),d,t[2],2840853838,13),i=h(i=a(i,10),o=h(o,d=h(d,r,n,i,o,t[10],2840853838,12),r,n=a(n,10),i,t[14],2840853838,5),d,r=a(r,10),n,t[1],2840853838,12),d=h(d=a(d,10),r=h(r,n=h(n,i,o,d,r,t[3],2840853838,13),i,o=a(o,10),d,t[8],2840853838,14),n,i=a(i,10),o,t[11],2840853838,11),n=h(n=a(n,10),i=h(i,o=h(o,d,r,n,i,t[6],2840853838,8),d,r=a(r,10),n,t[15],2840853838,5),o,d=a(d,10),r,t[13],2840853838,6),o=a(o,10);var l=this._a,p=this._b,b=this._c,m=this._d,y=this._e;y=h(y,l=h(l,p,b,m,y,t[5],1352829926,8),p,b=a(b,10),m,t[14],1352829926,9),p=h(p=a(p,10),b=h(b,m=h(m,y,l,p,b,t[7],1352829926,9),y,l=a(l,10),p,t[0],1352829926,11),m,y=a(y,10),l,t[9],1352829926,13),m=h(m=a(m,10),y=h(y,l=h(l,p,b,m,y,t[2],1352829926,15),p,b=a(b,10),m,t[11],1352829926,15),l,p=a(p,10),b,t[4],1352829926,5),l=h(l=a(l,10),p=h(p,b=h(b,m,y,l,p,t[13],1352829926,7),m,y=a(y,10),l,t[6],1352829926,7),b,m=a(m,10),y,t[15],1352829926,8),b=h(b=a(b,10),m=h(m,y=h(y,l,p,b,m,t[8],1352829926,11),l,p=a(p,10),b,t[1],1352829926,14),y,l=a(l,10),p,t[10],1352829926,14),y=c(y=a(y,10),l=h(l,p=h(p,b,m,y,l,t[3],1352829926,12),b,m=a(m,10),y,t[12],1352829926,6),p,b=a(b,10),m,t[6],1548603684,9),p=c(p=a(p,10),b=c(b,m=c(m,y,l,p,b,t[11],1548603684,13),y,l=a(l,10),p,t[3],1548603684,15),m,y=a(y,10),l,t[7],1548603684,7),m=c(m=a(m,10),y=c(y,l=c(l,p,b,m,y,t[0],1548603684,12),p,b=a(b,10),m,t[13],1548603684,8),l,p=a(p,10),b,t[5],1548603684,9),l=c(l=a(l,10),p=c(p,b=c(b,m,y,l,p,t[10],1548603684,11),m,y=a(y,10),l,t[14],1548603684,7),b,m=a(m,10),y,t[15],1548603684,7),b=c(b=a(b,10),m=c(m,y=c(y,l,p,b,m,t[8],1548603684,12),l,p=a(p,10),b,t[12],1548603684,7),y,l=a(l,10),p,t[4],1548603684,6),y=c(y=a(y,10),l=c(l,p=c(p,b,m,y,l,t[9],1548603684,15),b,m=a(m,10),y,t[1],1548603684,13),p,b=a(b,10),m,t[2],1548603684,11),p=f(p=a(p,10),b=f(b,m=f(m,y,l,p,b,t[15],1836072691,9),y,l=a(l,10),p,t[5],1836072691,7),m,y=a(y,10),l,t[1],1836072691,15),m=f(m=a(m,10),y=f(y,l=f(l,p,b,m,y,t[3],1836072691,11),p,b=a(b,10),m,t[7],1836072691,8),l,p=a(p,10),b,t[14],1836072691,6),l=f(l=a(l,10),p=f(p,b=f(b,m,y,l,p,t[6],1836072691,6),m,y=a(y,10),l,t[9],1836072691,14),b,m=a(m,10),y,t[11],1836072691,12),b=f(b=a(b,10),m=f(m,y=f(y,l,p,b,m,t[8],1836072691,13),l,p=a(p,10),b,t[12],1836072691,5),y,l=a(l,10),p,t[2],1836072691,14),y=f(y=a(y,10),l=f(l,p=f(p,b,m,y,l,t[10],1836072691,13),b,m=a(m,10),y,t[0],1836072691,13),p,b=a(b,10),m,t[4],1836072691,7),p=u(p=a(p,10),b=u(b,m=f(m,y,l,p,b,t[13],1836072691,5),y,l=a(l,10),p,t[8],2053994217,15),m,y=a(y,10),l,t[6],2053994217,5),m=u(m=a(m,10),y=u(y,l=u(l,p,b,m,y,t[4],2053994217,8),p,b=a(b,10),m,t[1],2053994217,11),l,p=a(p,10),b,t[3],2053994217,14),l=u(l=a(l,10),p=u(p,b=u(b,m,y,l,p,t[11],2053994217,14),m,y=a(y,10),l,t[15],2053994217,6),b,m=a(m,10),y,t[0],2053994217,14),b=u(b=a(b,10),m=u(m,y=u(y,l,p,b,m,t[5],2053994217,6),l,p=a(p,10),b,t[12],2053994217,9),y,l=a(l,10),p,t[2],2053994217,12),y=u(y=a(y,10),l=u(l,p=u(p,b,m,y,l,t[13],2053994217,9),b,m=a(m,10),y,t[9],2053994217,12),p,b=a(b,10),m,t[7],2053994217,5),p=s(p=a(p,10),b=u(b,m=u(m,y,l,p,b,t[10],2053994217,15),y,l=a(l,10),p,t[14],2053994217,8),m,y=a(y,10),l,t[12],0,8),m=s(m=a(m,10),y=s(y,l=s(l,p,b,m,y,t[15],0,5),p,b=a(b,10),m,t[10],0,12),l,p=a(p,10),b,t[4],0,9),l=s(l=a(l,10),p=s(p,b=s(b,m,y,l,p,t[1],0,12),m,y=a(y,10),l,t[5],0,5),b,m=a(m,10),y,t[8],0,14),b=s(b=a(b,10),m=s(m,y=s(y,l,p,b,m,t[7],0,6),l,p=a(p,10),b,t[6],0,8),y,l=a(l,10),p,t[2],0,13),y=s(y=a(y,10),l=s(l,p=s(p,b,m,y,l,t[13],0,6),b,m=a(m,10),y,t[14],0,5),p,b=a(b,10),m,t[0],0,15),p=s(p=a(p,10),b=s(b,m=s(m,y,l,p,b,t[3],0,13),y,l=a(l,10),p,t[9],0,11),m,y=a(y,10),l,t[11],0,11),m=a(m,10);var v=this._b+i+m|0;this._b=this._c+o+y|0,this._c=this._d+d+l|0,this._d=this._e+r+p|0,this._e=this._a+n+b|0,this._a=v},o.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=new r(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},e.exports=o}).call(this,t("buffer").Buffer)},{buffer:47,"hash-base":311,inherits:325}],350:[function(t,e,r){arguments[4][147][0].apply(r,arguments)},{buffer:47,dup:147}],351:[function(t,e,r){e.exports=t("scryptsy")},{scryptsy:352}],352:[function(t,e,r){(function(r){var n=t("pbkdf2").pbkdf2Sync,i=2147483647;function o(t,e,n,i,o){if(r.isBuffer(t)&&r.isBuffer(n))t.copy(n,i,e,e+o);else for(;o--;)n[i++]=t[e++]}e.exports=function(t,e,a,s,u,f,c){if(0===a||0!=(a&a-1))throw Error("N must be > 0 and a power of 2");if(a>i/128/s)throw Error("Parameter N is too large");if(s>i/128/u)throw Error("Parameter r is too large");var h,d=new r(256*s),l=new r(128*s*a),p=new Int32Array(16),b=new Int32Array(16),m=new r(64),y=n(t,e,1,128*u*s,"sha256");if(c){var v=u*a*2,g=0;h=function(){++g%1e3==0&&c({current:g,total:v,percent:g/v*100})}}for(var w=0;w>>32-e}function k(t){var e;for(e=0;e<16;e++)p[e]=(255&t[4*e+0])<<0,p[e]|=(255&t[4*e+1])<<8,p[e]|=(255&t[4*e+2])<<16,p[e]|=(255&t[4*e+3])<<24;for(o(p,0,b,0,16),e=8;e>0;e-=2)b[4]^=x(b[0]+b[12],7),b[8]^=x(b[4]+b[0],9),b[12]^=x(b[8]+b[4],13),b[0]^=x(b[12]+b[8],18),b[9]^=x(b[5]+b[1],7),b[13]^=x(b[9]+b[5],9),b[1]^=x(b[13]+b[9],13),b[5]^=x(b[1]+b[13],18),b[14]^=x(b[10]+b[6],7),b[2]^=x(b[14]+b[10],9),b[6]^=x(b[2]+b[14],13),b[10]^=x(b[6]+b[2],18),b[3]^=x(b[15]+b[11],7),b[7]^=x(b[3]+b[15],9),b[11]^=x(b[7]+b[3],13),b[15]^=x(b[11]+b[7],18),b[1]^=x(b[0]+b[3],7),b[2]^=x(b[1]+b[0],9),b[3]^=x(b[2]+b[1],13),b[0]^=x(b[3]+b[2],18),b[6]^=x(b[5]+b[4],7),b[7]^=x(b[6]+b[5],9),b[4]^=x(b[7]+b[6],13),b[5]^=x(b[4]+b[7],18),b[11]^=x(b[10]+b[9],7),b[8]^=x(b[11]+b[10],9),b[9]^=x(b[8]+b[11],13),b[10]^=x(b[9]+b[8],18),b[12]^=x(b[15]+b[14],7),b[13]^=x(b[12]+b[15],9),b[14]^=x(b[13]+b[12],13),b[15]^=x(b[14]+b[13],18);for(e=0;e<16;++e)p[e]=b[e]+p[e];for(e=0;e<16;e++){var r=4*e;t[r+0]=p[e]>>0&255,t[r+1]=p[e]>>8&255,t[r+2]=p[e]>>16&255,t[r+3]=p[e]>>24&255}}function S(t,e,r,n,i){for(var o=0;o>>((3&e)<<3)&255;return i}}e.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],363:[function(t,e,r){for(var n=t("./rng"),i=[],o={},a=0;a<256;a++)i[a]=(a+256).toString(16).substr(1),o[i[a]]=a;function s(t,e){var r=e||0,n=i;return n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+"-"+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]+n[t[r++]]}var u=n(),f=[1|u[0],u[1],u[2],u[3],u[4],u[5]],c=16383&(u[6]<<8|u[7]),h=0,d=0;function l(t,e,r){var i=e&&r||0;"string"==typeof t&&(e="binary"==t?new Array(16):null,t=null);var o=(t=t||{}).random||(t.rng||n)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,e)for(var a=0;a<16;a++)e[i+a]=o[a];return e||s(o)}var p=l;p.v1=function(t,e,r){var n=e&&r||0,i=e||[],o=void 0!==(t=t||{}).clockseq?t.clockseq:c,a=void 0!==t.msecs?t.msecs:(new Date).getTime(),u=void 0!==t.nsecs?t.nsecs:d+1,l=a-h+(u-d)/1e4;if(l<0&&void 0===t.clockseq&&(o=o+1&16383),(l<0||a>h)&&void 0===t.nsecs&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");h=a,d=u,c=o;var p=(1e4*(268435455&(a+=122192928e5))+u)%4294967296;i[n++]=p>>>24&255,i[n++]=p>>>16&255,i[n++]=p>>>8&255,i[n++]=255&p;var b=a/4294967296*1e4&268435455;i[n++]=b>>>8&255,i[n++]=255&b,i[n++]=b>>>24&15|16,i[n++]=b>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var m=t.node||f,y=0;y<6;y++)i[n+y]=m[y];return e||s(i)},p.v4=l,p.parse=function(t,e,r){var n=e&&r||0,i=0;for(e=e||[],t.toLowerCase().replace(/[0-9a-f]{2}/g,function(t){i<16&&(e[n+i++]=o[t])});i<16;)e[n+i++]=0;return e},p.unparse=s,e.exports=p},{"./rng":362}],364:[function(t,e,r){(function(r,n){var i=t("underscore"),o=t("web3-core"),a=t("web3-core-method"),s=t("any-promise"),u=t("eth-lib/lib/account"),f=t("eth-lib/lib/hash"),c=t("eth-lib/lib/rlp"),h=t("eth-lib/lib/nat"),d=t("eth-lib/lib/bytes"),l=t(void 0===r?"crypto-browserify":"crypto"),p=t("scrypt.js"),b=t("uuid"),m=t("web3-utils"),y=t("web3-core-helpers"),v=function(t){return i.isUndefined(t)||i.isNull(t)},g=function(t){for(;t&&t.startsWith("0x0");)t="0x"+t.slice(3);return t},w=function(t){return t.length%2==1&&(t=t.replace("0x","0x0")),t},_=function(){var t=this;o.packageInit(this,arguments),delete this.BatchRequest,delete this.extend;var e=[new a({name:"getId",call:"net_version",params:0,outputFormatter:m.hexToNumber}),new a({name:"getGasPrice",call:"eth_gasPrice",params:0}),new a({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[function(t){if(m.isAddress(t))return t;throw new Error("Address "+t+' is not a valid address to get the "transactionCount".')},function(){return"latest"}]})];this._ethereumCall={},i.each(e,function(e){e.attachToObject(t._ethereumCall),e.setRequestManager(t._requestManager)}),this.wallet=new M(this)};function M(t){this._accounts=t,this.length=0,this.defaultKeyName="web3js_wallet"}_.prototype._addAccountFunctions=function(t){var e=this;return t.signTransaction=function(r,n){return e.signTransaction(r,t.privateKey,n)},t.sign=function(r){return e.sign(r,t.privateKey)},t.encrypt=function(r,n){return e.encrypt(t.privateKey,r,n)},t},_.prototype.create=function(t){return this._addAccountFunctions(u.create(t||m.randomHex(32)))},_.prototype.privateKeyToAccount=function(t){return this._addAccountFunctions(u.fromPrivate(t))},_.prototype.signTransaction=function(t,e,r){var n,o=!1;if(r=r||function(){},!t)return o=new Error("No transaction object given!"),r(o),s.reject(o);function a(t){if(t.gas||t.gasLimit||(o=new Error('"gas" is missing')),(t.nonce<0||t.gas<0||t.gasPrice<0||t.chainId<0)&&(o=new Error("Gas, gasPrice, nonce or chainId is lower than 0")),o)return r(o),s.reject(new Error('"gas" is missing'));try{var i=t=y.formatters.inputCallFormatter(t);i.to=t.to||"0x",i.data=t.data||"0x",i.value=t.value||"0x",i.chainId=m.numberToHex(t.chainId);var a=c.encode([d.fromNat(i.nonce),d.fromNat(i.gasPrice),d.fromNat(i.gas),i.to.toLowerCase(),d.fromNat(i.value),i.data,d.fromNat(i.chainId||"0x1"),"0x","0x"]),l=f.keccak256(a),p=u.makeSigner(2*h.toNumber(i.chainId||"0x1")+35)(f.keccak256(a),e),b=c.decode(a).slice(0,6).concat(u.decodeSignature(p));b[6]=w(g(b[6])),b[7]=w(g(b[7])),b[8]=w(g(b[8]));var v=c.encode(b),_=c.decode(v);n={messageHash:l,v:g(_[6]),r:g(_[7]),s:g(_[8]),rawTransaction:v}}catch(t){return r(t),s.reject(t)}return r(null,n),n}return void 0!==t.nonce&&void 0!==t.chainId&&void 0!==t.gasPrice?s.resolve(a(t)):s.all([v(t.chainId)?this._ethereumCall.getId():t.chainId,v(t.gasPrice)?this._ethereumCall.getGasPrice():t.gasPrice,v(t.nonce)?this._ethereumCall.getTransactionCount(this.privateKeyToAccount(e).address):t.nonce]).then(function(e){if(v(e[0])||v(e[1])||v(e[2]))throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+JSON.stringify(e));return a(i.extend(t,{chainId:e[0],gasPrice:e[1],nonce:e[2]}))})},_.prototype.recoverTransaction=function(t){var e=c.decode(t),r=u.encodeSignature(e.slice(6,9)),n=d.toNumber(e[6]),i=n<35?[]:[d.fromNumber(n-35>>1),"0x","0x"],o=e.slice(0,6).concat(i),a=c.encode(o);return u.recover(f.keccak256(a),r)},_.prototype.hashMessage=function(t){var e=m.isHexStrict(t)?m.hexToBytes(t):t,r=n.from(e),i="Ethereum Signed Message:\n"+e.length,o=n.from(i),a=n.concat([o,r]);return f.keccak256s(a)},_.prototype.sign=function(t,e){var r=this.hashMessage(t),n=u.sign(r,e),i=u.decodeSignature(n);return{message:t,messageHash:r,v:i[0],r:i[1],s:i[2],signature:n}},_.prototype.recover=function(t,e,r){var n=[].slice.apply(arguments);return i.isObject(t)?this.recover(t.messageHash,u.encodeSignature([t.v,t.r,t.s]),!0):(r||(t=this.hashMessage(t)),n.length>=4?(r=n.slice(-1)[0],r=!!i.isBoolean(r)&&!!r,this.recover(t,u.encodeSignature(n.slice(1,4)),r)):u.recover(t,e))},_.prototype.decrypt=function(t,e,r){if(!i.isString(e))throw new Error("No password given.");var o,a,s=i.isObject(t)?t:JSON.parse(r?t.toLowerCase():t);if(3!==s.version)throw new Error("Not a valid V3 wallet");if("scrypt"===s.crypto.kdf)a=s.crypto.kdfparams,o=p(new n(e),new n(a.salt,"hex"),a.n,a.r,a.p,a.dklen);else{if("pbkdf2"!==s.crypto.kdf)throw new Error("Unsupported key derivation scheme");if("hmac-sha256"!==(a=s.crypto.kdfparams).prf)throw new Error("Unsupported parameters to PBKDF2");o=l.pbkdf2Sync(new n(e),new n(a.salt,"hex"),a.c,a.dklen,"sha256")}var u=new n(s.crypto.ciphertext,"hex");if(m.sha3(n.concat([o.slice(16,32),u])).replace("0x","")!==s.crypto.mac)throw new Error("Key derivation failed - possibly wrong password");var f=l.createDecipheriv(s.crypto.cipher,o.slice(0,16),new n(s.crypto.cipherparams.iv,"hex")),c="0x"+n.concat([f.update(u),f.final()]).toString("hex");return this.privateKeyToAccount(c)},_.prototype.encrypt=function(t,e,r){var i,o=this.privateKeyToAccount(t),a=(r=r||{}).salt||l.randomBytes(32),s=r.iv||l.randomBytes(16),u=r.kdf||"scrypt",f={dklen:r.dklen||32,salt:a.toString("hex")};if("pbkdf2"===u)f.c=r.c||262144,f.prf="hmac-sha256",i=l.pbkdf2Sync(new n(e),a,f.c,f.dklen,"sha256");else{if("scrypt"!==u)throw new Error("Unsupported kdf");f.n=r.n||8192,f.r=r.r||8,f.p=r.p||1,i=p(new n(e),a,f.n,f.r,f.p,f.dklen)}var c=l.createCipheriv(r.cipher||"aes-128-ctr",i.slice(0,16),s);if(!c)throw new Error("Unsupported cipher");var h=n.concat([c.update(new n(o.privateKey.replace("0x",""),"hex")),c.final()]),d=m.sha3(n.concat([i.slice(16,32),new n(h,"hex")])).replace("0x","");return{version:3,id:b.v4({random:r.uuid||l.randomBytes(16)}),address:o.address.toLowerCase().replace("0x",""),crypto:{ciphertext:h.toString("hex"),cipherparams:{iv:s.toString("hex")},cipher:r.cipher||"aes-128-ctr",kdf:u,kdfparams:f,mac:d.toString("hex")}}},M.prototype._findSafeIndex=function(t){return t=t||0,i.has(this,t)?this._findSafeIndex(t+1):t},M.prototype._currentIndexes=function(){return Object.keys(this).map(function(t){return parseInt(t)}).filter(function(t){return t<9e20})},M.prototype.create=function(t,e){for(var r=0;r=2?e.slice(2):e;var r=h.decodeParameters(t,e);return 1===r.__length__?r[0]:(delete r.__length__,r)},d.prototype.deploy=function(t,e){if((t=t||{}).arguments=t.arguments||[],!(t=this._getOrSetDefaultOptions(t)).data)return a._fireError(new Error('No "data" specified in neither the given options, nor the default options.'),null,null,e);var r=n.find(this.options.jsonInterface,function(t){return"constructor"===t.type})||{};return r.signature="constructor",this._createTxObject.apply({method:r,parent:this,deployData:t.data,_ethAccounts:this.constructor._ethAccounts},t.arguments)},d.prototype._generateEventOptions=function(){var t=Array.prototype.slice.call(arguments),e=this._getCallback(t),r=n.isObject(t[t.length-1])?t.pop():{},i=n.isString(t[0])?t[0]:"allevents";if(!(i="allevents"===i.toLowerCase()?{name:"ALLEVENTS",jsonInterface:this.options.jsonInterface}:this.options.jsonInterface.find(function(t){return"event"===t.type&&(t.name===i||t.signature==="0x"+i.replace("0x",""))})))throw new Error('Event "'+i.name+"\" doesn't exist in this contract.");if(!a.isAddress(this.options.address))throw new Error("This contract object doesn't have address set yet, please set an address first.");return{params:this._encodeEventABI(i,r),event:i,callback:e}},d.prototype.clone=function(){return new this.constructor(this.options.jsonInterface,this.options.address,this.options)},d.prototype.once=function(t,e,r){var i=Array.prototype.slice.call(arguments);if(!(r=this._getCallback(i)))throw new Error("Once requires a callback as the second parameter.");e&&delete e.fromBlock,this._on(t,e,function(t,e,i){i.unsubscribe(),n.isFunction(r)&&r(t,e,i)})},d.prototype._on=function(){var t=this._generateEventOptions.apply(this,arguments);this._checkListener("newListener",t.event.name,t.callback),this._checkListener("removeListener",t.event.name,t.callback);var e=new s({subscription:{params:1,inputFormatter:[u.inputLogFormatter],outputFormatter:this._decodeEventABI.bind(t.event),subscriptionHandler:function(t){t.removed?this.emit("changed",t):this.emit("data",t),n.isFunction(this.callback)&&this.callback(null,t,this)}},type:"eth",requestManager:this._requestManager});return e.subscribe("logs",t.params,t.callback||function(){}),e},d.prototype.getPastEvents=function(){var t=this._generateEventOptions.apply(this,arguments),e=new o({name:"getPastLogs",call:"eth_getLogs",params:1,inputFormatter:[u.inputLogFormatter],outputFormatter:this._decodeEventABI.bind(t.event)});e.setRequestManager(this._requestManager);var r=e.buildCall();return e=null,r(t.params,t.callback)},d.prototype._createTxObject=function(){var t=Array.prototype.slice.call(arguments),e={};if("function"===this.method.type&&(e.call=this.parent._executeMethod.bind(e,"call"),e.call.request=this.parent._executeMethod.bind(e,"call",!0)),e.send=this.parent._executeMethod.bind(e,"send"),e.send.request=this.parent._executeMethod.bind(e,"send",!0),e.encodeABI=this.parent._encodeMethodABI.bind(e),e.estimateGas=this.parent._executeMethod.bind(e,"estimate"),t&&this.method.inputs&&t.length!==this.method.inputs.length){if(this.nextMethod)return this.nextMethod.apply(null,t);throw f.InvalidNumberOfParams(t.length,this.method.inputs.length,this.method.name)}return e.arguments=t||[],e._method=this.method,e._parent=this.parent,e._ethAccounts=this.parent.constructor._ethAccounts||this._ethAccounts,this.deployData&&(e._deployData=this.deployData),e},d.prototype._processExecuteArguments=function(t,e){var r={};if(r.type=t.shift(),r.callback=this._parent._getCallback(t),"call"===r.type&&!0!==t[t.length-1]&&(n.isString(t[t.length-1])||isFinite(t[t.length-1]))&&(r.defaultBlock=t.pop()),r.options=n.isObject(t[t.length-1])?t.pop():{},r.generateRequest=!0===t[t.length-1]&&t.pop(),r.options=this._parent._getOrSetDefaultOptions(r.options),r.options.data=this.encodeABI(),!this._deployData&&!a.isAddress(this._parent.options.address))throw new Error("This contract object doesn't have address set yet, please set an address first.");return this._deployData||(r.options.to=this._parent.options.address),r.options.data?r:a._fireError(new Error("Couldn't find a matching contract method, or the number of parameters is wrong."),e.eventEmitter,e.reject,r.callback)},d.prototype._executeMethod=function(){var t=this,e=this._parent._processExecuteArguments.call(this,Array.prototype.slice.call(arguments),r),r=c("send"!==e.type),i=t.constructor._ethAccounts||t._ethAccounts;if(e.generateRequest){var s={params:[u.inputCallFormatter.call(this._parent,e.options)],callback:e.callback};return"call"===e.type?(s.params.push(u.inputDefaultBlockNumberFormatter.call(this._parent,e.defaultBlock)),s.method="eth_call",s.format=this._parent._decodeMethodReturn.bind(null,this._method.outputs)):s.method="eth_sendTransaction",s}switch(e.type){case"estimate":return new o({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[u.inputCallFormatter],outputFormatter:a.hexToNumber,requestManager:t._parent._requestManager,accounts:i,defaultAccount:t._parent.defaultAccount,defaultBlock:t._parent.defaultBlock}).createFunction()(e.options,e.callback);case"call":return new o({name:"call",call:"eth_call",params:2,inputFormatter:[u.inputCallFormatter,u.inputDefaultBlockNumberFormatter],outputFormatter:function(e){return t._parent._decodeMethodReturn(t._method.outputs,e)},requestManager:t._parent._requestManager,accounts:i,defaultAccount:t._parent.defaultAccount,defaultBlock:t._parent.defaultBlock}).createFunction()(e.options,e.defaultBlock,e.callback);case"send":if(!a.isAddress(e.options.from))return a._fireError(new Error('No "from" address specified in neither the given options, nor the default options.'),r.eventEmitter,r.reject,e.callback);if(n.isBoolean(this._method.payable)&&!this._method.payable&&e.options.value&&e.options.value>0)return a._fireError(new Error("Can not send value to non-payable contract method or constructor"),r.eventEmitter,r.reject,e.callback);var f={receiptFormatter:function(e){if(n.isArray(e.logs)){var r=n.map(e.logs,function(e){return t._parent._decodeEventABI.call({name:"ALLEVENTS",jsonInterface:t._parent.options.jsonInterface},e)});e.events={};var i=0;r.forEach(function(t){t.event?e.events[t.event]?Array.isArray(e.events[t.event])?e.events[t.event].push(t):e.events[t.event]=[e.events[t.event],t]:e.events[t.event]=t:(e.events[i]=t,i++)}),delete e.logs}return e},contractDeployFormatter:function(e){var r=t._parent.clone();return r.options.address=e.contractAddress,r}};return new o({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[u.inputTransactionFormatter],requestManager:t._parent._requestManager,accounts:t.constructor._ethAccounts||t._ethAccounts,defaultAccount:t._parent.defaultAccount,defaultBlock:t._parent.defaultBlock,extraFormatters:f}).createFunction()(e.options,e.callback)}},e.exports=d},{underscore:365,"web3-core":209,"web3-core-helpers":191,"web3-core-method":193,"web3-core-promievent":198,"web3-core-subscriptions":206,"web3-eth-abi":213,"web3-utils":393}],367:[function(t,e,r){arguments[4][210][0].apply(r,arguments)},{dup:210}],368:[function(t,e,r){var n=t("web3-utils"),i=t("bn.js"),o=function(t){var e="A".charCodeAt(0),r="Z".charCodeAt(0);return(t=(t=t.toUpperCase()).substr(4)+t.substr(0,4)).split("").map(function(t){var n=t.charCodeAt(0);return n>=e&&n<=r?n-e+10:t}).join("")},a=function(t){for(var e,r=t;r.length>2;)e=r.slice(0,9),r=parseInt(e,10)%97+r.slice(e.length);return parseInt(r,10)%97},s=function(t){this._iban=t};s.toAddress=function(t){if(!(t=new s(t)).isDirect())throw new Error("IBAN is indirect and can't be converted");return t.toAddress()},s.toIban=function(t){return s.fromAddress(t).toString()},s.fromAddress=function(t){if(!n.isAddress(t))throw new Error("Provided address is not a valid address: "+t);t=t.replace("0x","").replace("0X","");var e=function(t,e){for(var r=t;r.length<2*e;)r="0"+r;return r}(new i(t,16).toString(36),15);return s.fromBban(e.toUpperCase())},s.fromBban=function(t){var e=("0"+(98-a(o("XE00"+t)))).slice(-2);return new s("XE"+e+t)},s.createIndirect=function(t){return s.fromBban("ETH"+t.institution+t.identifier)},s.isValid=function(t){return new s(t).isValid()},s.prototype.isValid=function(){return/^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30,31})$/.test(this._iban)&&1===a(o(this._iban))},s.prototype.isDirect=function(){return 34===this._iban.length||35===this._iban.length},s.prototype.isIndirect=function(){return 20===this._iban.length},s.prototype.checksum=function(){return this._iban.substr(2,2)},s.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},s.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},s.prototype.toAddress=function(){if(this.isDirect()){var t=this._iban.substr(4),e=new i(t,36);return n.toChecksumAddress(e.toString(16,20))}return""},s.prototype.toString=function(){return this._iban},e.exports=s},{"bn.js":367,"web3-utils":393}],369:[function(t,e,r){var n=t("web3-core"),i=t("web3-core-method"),o=t("web3-utils"),a=t("web3-net"),s=t("web3-core-helpers").formatters,u=function(){var t=this;n.packageInit(this,arguments),this.net=new a(this.currentProvider);var e=null,r="latest";Object.defineProperty(this,"defaultAccount",{get:function(){return e},set:function(t){return t&&(e=o.toChecksumAddress(s.inputAddressFormatter(t))),u.forEach(function(t){t.defaultAccount=e}),t},enumerable:!0}),Object.defineProperty(this,"defaultBlock",{get:function(){return r},set:function(t){return r=t,u.forEach(function(t){t.defaultBlock=r}),t},enumerable:!0});var u=[new i({name:"getAccounts",call:"personal_listAccounts",params:0,outputFormatter:o.toChecksumAddress}),new i({name:"newAccount",call:"personal_newAccount",params:1,inputFormatter:[null],outputFormatter:o.toChecksumAddress}),new i({name:"unlockAccount",call:"personal_unlockAccount",params:3,inputFormatter:[s.inputAddressFormatter,null,null]}),new i({name:"lockAccount",call:"personal_lockAccount",params:1,inputFormatter:[s.inputAddressFormatter]}),new i({name:"importRawKey",call:"personal_importRawKey",params:2}),new i({name:"sendTransaction",call:"personal_sendTransaction",params:2,inputFormatter:[s.inputTransactionFormatter,null]}),new i({name:"signTransaction",call:"personal_signTransaction",params:2,inputFormatter:[s.inputTransactionFormatter,null]}),new i({name:"sign",call:"personal_sign",params:3,inputFormatter:[s.inputSignFormatter,s.inputAddressFormatter,null]}),new i({name:"ecRecover",call:"personal_ecRecover",params:2,inputFormatter:[s.inputSignFormatter,null]})];u.forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager),e.defaultBlock=t.defaultBlock,e.defaultAccount=t.defaultAccount})};n.addProviders(u),e.exports=u},{"web3-core":209,"web3-core-helpers":191,"web3-core-method":193,"web3-net":373,"web3-utils":393}],370:[function(t,e,r){arguments[4][178][0].apply(r,arguments)},{dup:178}],371:[function(t,e,r){var n=t("underscore");e.exports=function(t){var e,r=this;return this.net.getId().then(function(t){return e=t,r.getBlock(0)}).then(function(r){var i="private";return"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3"===r.hash&&1===e&&(i="main"),"0cd786a2425d16f152c658316c423e6ce1181e15c3295826d7c9904cba9ce303"===r.hash&&2===e&&(i="morden"),"0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d"===r.hash&&3===e&&(i="ropsten"),"0x6341fd3daf94b748c72ced5a5b26028f2474f5f00d824504e4fa37a75767e177"===r.hash&&4===e&&(i="rinkeby"),"0xa3c565fc15c7478862d50ccd6561e3c06b24cc509bf388941c25ea985ce32cb9"===r.hash&&42===e&&(i="kovan"),n.isFunction(t)&&t(null,i),i}).catch(function(e){if(!n.isFunction(t))throw e;t(e)})}},{underscore:370}],372:[function(t,e,r){var n=t("underscore"),i=t("web3-core"),o=t("web3-core-helpers"),a=t("web3-core-subscriptions").subscriptions,s=t("web3-core-method"),u=t("web3-utils"),f=t("web3-net"),c=t("web3-eth-personal"),h=t("web3-eth-contract"),d=t("web3-eth-iban"),l=t("web3-eth-accounts"),p=t("web3-eth-abi"),b=t("./getNetworkType.js"),m=o.formatters,y=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockByHash":"eth_getBlockByNumber"},v=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getTransactionByBlockHashAndIndex":"eth_getTransactionByBlockNumberAndIndex"},g=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleByBlockHashAndIndex":"eth_getUncleByBlockNumberAndIndex"},w=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getBlockTransactionCountByHash":"eth_getBlockTransactionCountByNumber"},_=function(t){return n.isString(t[0])&&0===t[0].indexOf("0x")?"eth_getUncleCountByBlockHash":"eth_getUncleCountByBlockNumber"},M=function(){var t=this;i.packageInit(this,arguments);var e=this.setProvider;this.setProvider=function(){e.apply(t,arguments),t.net.setProvider.apply(t,arguments),t.personal.setProvider.apply(t,arguments),t.accounts.setProvider.apply(t,arguments),t.Contract.setProvider(t.currentProvider,t.accounts)};var r=null,o="latest";Object.defineProperty(this,"defaultAccount",{get:function(){return r},set:function(e){return e&&(r=u.toChecksumAddress(m.inputAddressFormatter(e))),t.Contract.defaultAccount=r,t.personal.defaultAccount=r,x.forEach(function(t){t.defaultAccount=r}),e},enumerable:!0}),Object.defineProperty(this,"defaultBlock",{get:function(){return o},set:function(e){return o=e,t.Contract.defaultBlock=o,t.personal.defaultBlock=o,x.forEach(function(t){t.defaultBlock=o}),e},enumerable:!0}),this.clearSubscriptions=t._requestManager.clearSubscriptions,this.net=new f(this.currentProvider),this.net.getNetworkType=b.bind(this),this.accounts=new l(this.currentProvider),this.personal=new c(this.currentProvider),this.personal.defaultAccount=this.defaultAccount;var M=function(){h.apply(this,arguments)};M.setProvider=function(){h.setProvider.apply(this,arguments)},(M.prototype=Object.create(h.prototype)).constructor=M,this.Contract=M,this.Contract.defaultAccount=this.defaultAccount,this.Contract.defaultBlock=this.defaultBlock,this.Contract.setProvider(this.currentProvider,this.accounts),this.Iban=d,this.abi=p;var x=[new s({name:"getNodeInfo",call:"web3_clientVersion"}),new s({name:"getProtocolVersion",call:"eth_protocolVersion",params:0}),new s({name:"getCoinbase",call:"eth_coinbase",params:0}),new s({name:"isMining",call:"eth_mining",params:0}),new s({name:"getHashrate",call:"eth_hashrate",params:0,outputFormatter:u.hexToNumber}),new s({name:"isSyncing",call:"eth_syncing",params:0,outputFormatter:m.outputSyncingFormatter}),new s({name:"getGasPrice",call:"eth_gasPrice",params:0,outputFormatter:m.outputBigNumberFormatter}),new s({name:"getAccounts",call:"eth_accounts",params:0,outputFormatter:u.toChecksumAddress}),new s({name:"getBlockNumber",call:"eth_blockNumber",params:0,outputFormatter:u.hexToNumber}),new s({name:"getBalance",call:"eth_getBalance",params:2,inputFormatter:[m.inputAddressFormatter,m.inputDefaultBlockNumberFormatter],outputFormatter:m.outputBigNumberFormatter}),new s({name:"getStorageAt",call:"eth_getStorageAt",params:3,inputFormatter:[m.inputAddressFormatter,u.numberToHex,m.inputDefaultBlockNumberFormatter]}),new s({name:"getCode",call:"eth_getCode",params:2,inputFormatter:[m.inputAddressFormatter,m.inputDefaultBlockNumberFormatter]}),new s({name:"getBlock",call:y,params:2,inputFormatter:[m.inputBlockNumberFormatter,function(t){return!!t}],outputFormatter:m.outputBlockFormatter}),new s({name:"getUncle",call:g,params:2,inputFormatter:[m.inputBlockNumberFormatter,u.numberToHex],outputFormatter:m.outputBlockFormatter}),new s({name:"getBlockTransactionCount",call:w,params:1,inputFormatter:[m.inputBlockNumberFormatter],outputFormatter:u.hexToNumber}),new s({name:"getBlockUncleCount",call:_,params:1,inputFormatter:[m.inputBlockNumberFormatter],outputFormatter:u.hexToNumber}),new s({name:"getTransaction",call:"eth_getTransactionByHash",params:1,inputFormatter:[null],outputFormatter:m.outputTransactionFormatter}),new s({name:"getTransactionFromBlock",call:v,params:2,inputFormatter:[m.inputBlockNumberFormatter,u.numberToHex],outputFormatter:m.outputTransactionFormatter}),new s({name:"getTransactionReceipt",call:"eth_getTransactionReceipt",params:1,inputFormatter:[null],outputFormatter:m.outputTransactionReceiptFormatter}),new s({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[m.inputAddressFormatter,m.inputDefaultBlockNumberFormatter],outputFormatter:u.hexToNumber}),new s({name:"sendSignedTransaction",call:"eth_sendRawTransaction",params:1,inputFormatter:[null]}),new s({name:"signTransaction",call:"eth_signTransaction",params:1,inputFormatter:[m.inputTransactionFormatter]}),new s({name:"sendTransaction",call:"eth_sendTransaction",params:1,inputFormatter:[m.inputTransactionFormatter]}),new s({name:"sign",call:"eth_sign",params:2,inputFormatter:[m.inputSignFormatter,m.inputAddressFormatter],transformPayload:function(t){return t.params.reverse(),t}}),new s({name:"call",call:"eth_call",params:2,inputFormatter:[m.inputCallFormatter,m.inputDefaultBlockNumberFormatter]}),new s({name:"estimateGas",call:"eth_estimateGas",params:1,inputFormatter:[m.inputCallFormatter],outputFormatter:u.hexToNumber}),new s({name:"getCompilers",call:"eth_getCompilers",params:0}),new s({name:"compile.solidity",call:"eth_compileSolidity",params:1}),new s({name:"compile.lll",call:"eth_compileLLL",params:1}),new s({name:"compile.serpent",call:"eth_compileSerpent",params:1}),new s({name:"submitWork",call:"eth_submitWork",params:3}),new s({name:"getWork",call:"eth_getWork",params:0}),new s({name:"getPastLogs",call:"eth_getLogs",params:1,inputFormatter:[m.inputLogFormatter],outputFormatter:m.outputLogFormatter}),new a({name:"subscribe",type:"eth",subscriptions:{newBlockHeaders:{subscriptionName:"newHeads",params:0,outputFormatter:m.outputBlockFormatter},pendingTransactions:{subscriptionName:"newPendingTransactions",params:0},logs:{params:1,inputFormatter:[m.inputLogFormatter],outputFormatter:m.outputLogFormatter,subscriptionHandler:function(t){t.removed?this.emit("changed",t):this.emit("data",t),n.isFunction(this.callback)&&this.callback(null,t,this)}},syncing:{params:0,outputFormatter:m.outputSyncingFormatter,subscriptionHandler:function(t){var e=this;!0!==this._isSyncing?(this._isSyncing=!0,this.emit("changed",e._isSyncing),n.isFunction(this.callback)&&this.callback(null,e._isSyncing,this),setTimeout(function(){e.emit("data",t),n.isFunction(e.callback)&&e.callback(null,t,e)},0)):(this.emit("data",t),n.isFunction(e.callback)&&this.callback(null,t,this),clearTimeout(this._isSyncingTimeout),this._isSyncingTimeout=setTimeout(function(){t.currentBlock>t.highestBlock-200&&(e._isSyncing=!1,e.emit("changed",e._isSyncing),n.isFunction(e.callback)&&e.callback(null,e._isSyncing,e))},500))}}}})];x.forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager,t.accounts),e.defaultBlock=t.defaultBlock,e.defaultAccount=t.defaultAccount})};i.addProviders(M),e.exports=M},{"./getNetworkType.js":371,underscore:370,"web3-core":209,"web3-core-helpers":191,"web3-core-method":193,"web3-core-subscriptions":206,"web3-eth-abi":213,"web3-eth-accounts":364,"web3-eth-contract":366,"web3-eth-iban":368,"web3-eth-personal":369,"web3-net":373,"web3-utils":393}],373:[function(t,e,r){var n=t("web3-core"),i=t("web3-core-method"),o=t("web3-utils"),a=function(){var t=this;n.packageInit(this,arguments),[new i({name:"getId",call:"net_version",params:0,outputFormatter:o.hexToNumber}),new i({name:"isListening",call:"net_listening",params:0}),new i({name:"getPeerCount",call:"net_peerCount",params:0,outputFormatter:o.hexToNumber})].forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)})};n.addProviders(a),e.exports=a},{"web3-core":209,"web3-core-method":193,"web3-utils":393}],374:[function(t,e,r){e.exports=XMLHttpRequest},{}],375:[function(t,e,r){var n=t("web3-core-helpers").errors,i=t("xhr2"),o=function(t,e,r){this.host=t||"http://localhost:8545",this.timeout=e||0,this.connected=!1,this.headers=r};o.prototype._prepareRequest=function(){var t=new i;return t.open("POST",this.host,!0),t.setRequestHeader("Content-Type","application/json"),this.headers&&this.headers.forEach(function(e){t.setRequestHeader(e.name,e.value)}),t},o.prototype.send=function(t,e){var r=this,i=this._prepareRequest();i.onreadystatechange=function(){if(4===i.readyState&&1!==i.timeout){var t=i.responseText,o=null;try{t=JSON.parse(t)}catch(t){o=n.InvalidResponse(i.responseText)}r.connected=!0,e(o,t)}},i.ontimeout=function(){r.connected=!1,e(n.ConnectionTimeout(this.timeout))};try{i.send(JSON.stringify(t))}catch(t){this.connected=!1,e(n.InvalidConnection(this.host))}},e.exports=o},{"web3-core-helpers":191,xhr2:374}],376:[function(t,e,r){!function(t,n,i,o,a,s){var u=l(function(t,e){var r=e.length;return l(function(n){for(var i=0;i0;)if(U+=r,r=t.charAt(o++),4===z?(O+=String.fromCharCode(parseInt(U,16)),z=0,f=o-1):z++,!r)break t;if('"'===r&&!L){q=D.pop()||p,O+=t.substring(f,o-1);break}if(!("\\"!==r||L||(L=!0,O+=t.substring(f,o-1),r=t.charAt(o++))))break;if(L){if(L=!1,"n"===r?O+="\n":"r"===r?O+="\r":"t"===r?O+="\t":"f"===r?O+="\f":"b"===r?O+="\b":"u"===r?(z=1,U=""):O+=r,r=t.charAt(o++),f=o-1,r)continue;break}h.lastIndex=o;var d=h.exec(t);if(!d){o=t.length+1,O+=t.substring(f,o-1);break}if(o=d.index+1,!(r=t.charAt(d.index))){O+=t.substring(f,o-1);break}}continue;case M:if(!r)continue;if("r"!==r)return X("Invalid true started with t"+r);q=x;continue;case x:if(!r)continue;if("u"!==r)return X("Invalid true started with tr"+r);q=k;continue;case k:if(!r)continue;if("e"!==r)return X("Invalid true started with tru"+r);a(!0),u(),q=D.pop()||p;continue;case S:if(!r)continue;if("a"!==r)return X("Invalid false started with f"+r);q=E;continue;case E:if(!r)continue;if("l"!==r)return X("Invalid false started with fa"+r);q=A;continue;case A:if(!r)continue;if("s"!==r)return X("Invalid false started with fal"+r);q=j;continue;case j:if(!r)continue;if("e"!==r)return X("Invalid false started with fals"+r);a(!1),u(),q=D.pop()||p;continue;case I:if(!r)continue;if("u"!==r)return X("Invalid null started with n"+r);q=B;continue;case B:if(!r)continue;if("l"!==r)return X("Invalid null started with nu"+r);q=T;continue;case T:if(!r)continue;if("l"!==r)return X("Invalid null started with nul"+r);a(null),u(),q=D.pop()||p;continue;case C:if("."!==r)return X("Leading zero not followed by .");N+=r,q=P;continue;case P:if(-1!=="0123456789".indexOf(r))N+=r;else if("."===r){if(-1!==N.indexOf("."))return X("Invalid number has two dots");N+=r}else if("e"===r||"E"===r){if(-1!==N.indexOf("e")||-1!==N.indexOf("E"))return X("Invalid number has two exponential");N+=r}else if("+"===r||"-"===r){if("e"!==n&&"E"!==n)return X("Invalid symbol in number");N+=r}else N&&(a(parseFloat(N)),u(),N=""),o--,q=D.pop()||p;continue;default:return X("Unknown state: "+q)}H>=R&&(J=0,O!==s&&O.length>c&&(X("Max buffer length exceeded: textNode"),J=Math.max(J,O.length)),N.length>c&&(X("Max buffer length exceeded: numberNode"),J=Math.max(J,N.length)),R=c-J+H);var J}),t(ft).on(function(){if(q==l)return a({}),u(),void(F=!0);q===p&&0===K||X("Unexpected end");O!==s&&(a(O),u(),O=s);F=!0})}var R,O,N,L,F,q,D,U,z,K,H,V=(R=l(function(t){return t.unshift(/^/),(e=RegExp(t.map(c("source")).join(""))).exec.bind(e);var e}),L=R(O=/(\$?)/,/([\w-_]+|\*)/,N=/(?:{([\w ]*?)})?/),F=R(O,/\["([^"]+)"\]/,N),q=R(O,/\[(\d+|\*)\]/,N),D=R(O,/()/,/{([\w ]*?)}/),U=R(/\.\./),z=R(/\./),K=R(O,/!/),H=R(/$/),function(t){return t(h(L,F,q,D),U,z,K,H)});function W(t,e){return{key:t,node:e}}var X=c("key"),G=c("node"),J={};function Z(t){var e=t(tt).emit,r=t(et).emit,n=t(at).emit,o=t(ot).emit;function a(t,e,r){G(k(t))[e]=r}function s(t,r,n){t&&a(t,r,n);var i=M(W(r,n),t);return e(i),i}var u={};return u[dt]=function(t,e){if(!t)return n(e),s(t,J,e);var r,o,u,f=(o=e,u=G(k(r=t)),y(i,u)?s(r,v(u),o):r),c=S(f),h=X(k(f));return a(c,h,e),M(W(h,e),c)},u[lt]=function(t){return r(t),S(t)||o(G(k(t)))},u[ht]=s,u}var $=V(function(t,e,r,n,i){var a=1,s=2,c=3,d=f(X,k),l=f(G,k);function b(t,e){return!!e[a]?p(t,k):t}function y(t){if(t==m)return m;return p(function(t){return d(t)!=J},f(t,S))}function g(){return function(t){return d(t)==J}}function w(t,e,r,n,i){var o,a=t(r);if(a){var s=(o=a,B(function(t,e){return e(t,o)},n,e));return i(r.substr(v(a[0])),s)}}function M(t,e){return u(w,t,e)}var x=h(M(t,A(b,function(t,e){var r=e[c];return r?p(f(u(_,E(r.split(/\W+/))),l),t):t},function(t,e){var r=e[s];return p(r&&"*"!=r?function(t){return d(t)==r}:m,t)},y)),M(e,A(function(t){if(t==m)return m;var e=g(),r=t,n=y(function(t){return i(t)}),i=h(e,r,n);return i})),M(r,A()),M(n,A(b,g)),M(i,A(function(t){return function(e){var r=t(e);return!0===r?k(e):r}})),function(t){throw o('"'+t+'" could not be tokenised')});function j(t,e){return e}function I(t,e){return x(t,e,t?I:j)}return function(t){try{return I(t,m)}catch(e){throw o('Could not compile "'+t+'" because '+e.message)}}});function Y(t,e,r){var n,i;function o(t){return function(e){return e.id==t}}return{on:function(r,o){var a={listener:r,id:o||r};return e&&e.emit(t,r,a.id),n=M(a,n),i=M(r,i),this},emit:function(){!function t(e,r){e&&(k(e).apply(null,r),t(S(e),r))}(i,arguments)},un:function(e){var a;n=T(n,o(e),function(t){a=t}),a&&(i=T(i,function(t){return t==a.listener}),r&&r.emit(t,a.listener,a.id))},listeners:function(){return i},hasListener:function(t){return w(function t(e,r){return r&&(e(k(r))?k(r):t(e,S(r)))}(t?o(t):m,n))}}}var Q=1,tt=Q++,et=Q++,rt=Q++,nt=Q++,it="fail",ot=Q++,at=Q++,st="start",ut="data",ft="end",ct=Q++,ht=Q++,dt=Q++,lt=Q++;function pt(t,e,r){try{var n=a.parse(e)}catch(t){}return{statusCode:t,body:e,jsonBody:n,thrown:r}}function bt(t,e){var r={node:t(et),path:t(tt)};function n(e,r,n){var i=t(e).emit;r.on(function(t){var e,r,o,a=n(t);!1!==a&&(e=i,r=G(a),o=C(t),e(r,j(S(I(X,o))),j(I(G,o))))},e),t("removeListener").on(function(n){n==e&&(t(n).listeners()||r.un(e))})}t("newListener").on(function(t){var i=/(node|path):(.*)/.exec(t);if(i){var o=r[i[1]];o.hasListener(t)||n(t,o,e(i[2]))}})}function mt(t,e){var r,n=/^(node|path):./,i=t(ot),o=t(nt).emit,a=t(rt).emit,s=l(function(e,i){if(r[e])d(i,r[e]);else{var o=t(e),a=i[0];n.test(e)?f(o,a):o.on(a)}return r});function f(t,e,n){n=n||e;var i=c(e);return t.on(function(){var e=!1;r.forget=function(){e=!0},d(arguments,i),delete r.forget,e&&t.un(n)},n),r}function c(t){return function(){try{return t.apply(r,arguments)}catch(t){setTimeout(function(){throw t})}}}function h(e,r,n){var i,s;"node"==e?(s=n,i=function(){var t=s.apply(this,arguments);w(t)&&(t==gt.drop?o():a(t))}):i=n,f(t(e+":"+r),i,n)}function p(t,e,n){return g(e)?h(t,e,n):function(t,e){for(var r in e)h(t,r,e[r])}(t,e),r}return t(at).on(function(t){var e;r.root=(e=t,function(){return e})}),t(st).on(function(t,e){r.header=function(t){return t?e[t]:e}}),r={on:s,addListener:s,removeListener:function(e,n,o){if("done"==e)i.un(n);else if("node"==e||"path"==e)t.un(e+":"+n,o);else{var a=n;t(e).un(a)}return r},emit:t.emit,node:u(p,"node"),path:u(p,"path"),done:u(f,i),start:u(function(e,n){return t(e).on(c(n),n),r},st),fail:t(it).on,abort:t(ct).emit,header:b,root:b,source:e}}function yt(e,r,n,i,o){var a=function(){var t={},e=n("newListener"),r=n("removeListener");function n(n){return t[n]=Y(n,e,r)}function i(e){return t[e]||n(e)}return["emit","on","un"].forEach(function(t){i[t]=l(function(e,r){d(r,i(e)[t])})}),i}();return r&&function(e,r,n,i,o,a,f){var c,h=e(ut).emit,d=e(it).emit,l=0,p=!0;function b(){var t=r.responseText,e=t.substr(l);e&&h(e),l=v(t)}e(ct).on(function(){r.onreadystatechange=null,r.abort()}),"onprogress"in r&&(r.onprogress=b),r.onreadystatechange=function(){function t(){try{p&&e(st).emit(r.status,(t=r.getAllResponseHeaders(),n={},t&&t.split("\r\n").forEach(function(t){var e=t.indexOf(": ");n[t.substring(0,e)]=t.substring(e+2)}),n)),p=!1}catch(t){}var t,n}switch(r.readyState){case 2:case 3:return t();case 4:t(),2==String(r.status)[0]?(b(),e(ft).emit()):d(pt(r.status,r.responseText))}};try{for(var m in r.open(n,i,!0),a)r.setRequestHeader(m,a[m]);(function(t,e){function r(e){return e.port||{"http:":80,"https:":443}[e.protocol||t.protocol]}return!!(e.protocol&&e.protocol!=t.protocol||e.host&&e.host!=t.host||e.host&&r(e)!=r(t))})(t.location,{protocol:(c=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(i)||[])[1]||"",host:c[2]||"",port:c[3]||""})||r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.withCredentials=f,r.send(o)}catch(e){t.setTimeout(u(d,pt(s,s,e)),0)}}(a,new XMLHttpRequest,e,r,n,i,o),P(a),function(t,e){var r,n={};function i(t){return function(e){r=t(r,e)}}for(var o in e)t(o).on(i(e[o]),n);t(rt).on(function(t){var e=k(r),n=X(e),i=S(r);i&&(G(k(i))[n]=t)}),t(nt).on(function(){var t=k(r),e=X(t),n=S(r);n&&delete G(k(n))[e]}),t(ct).on(function(){for(var r in e)t(r).un(n)})}(a,Z(a)),bt(a,$),mt(a,r)}function vt(t,e,r,n,i,o,s){return i=i?a.parse(a.stringify(i)):{},n?g(n)||(n=a.stringify(n),i["Content-Type"]=i["Content-Type"]||"application/json"):n=null,t(r||"GET",(u=e,!1===s&&(-1==u.indexOf("?")?u+="?":u+="&",u+="_="+(new Date).getTime()),u),n,i,o||!1);var u}function gt(t){var e=A("resume","pause","pipe"),r=u(_,e);return t?r(t)||g(t)?vt(yt,t):vt(yt,t.url,t.method,t.body,t.headers,t.withCredentials,t.cached):yt()}gt.drop=function(){return gt.drop},"function"==typeof define&&define.amd?define("oboe",[],function(){return gt}):"object"===(void 0===r?"undefined":_typeof(r))?e.exports=gt:t.oboe=gt}(function(){try{return window}catch(t){return self}}(),Object,Array,Error,JSON)},{}],377:[function(t,e,r){arguments[4][178][0].apply(r,arguments)},{dup:178}],378:[function(t,e,r){var n=t("underscore"),i=t("web3-core-helpers").errors,o=t("oboe"),a=function(t,e){var r=this;this.responseCallbacks={},this.notificationCallbacks=[],this.path=t,this.connection=e.connect({path:this.path}),this.addDefaultEvents();var i=function(t){var e=null;n.isArray(t)?t.forEach(function(t){r.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,e||-1===t.method.indexOf("_subscription")?r.responseCallbacks[e]&&(r.responseCallbacks[e](null,t),delete r.responseCallbacks[e]):r.notificationCallbacks.forEach(function(e){n.isFunction(e)&&e(t)})};"Socket"===e.constructor.name?o(this.connection).done(i):this.connection.on("data",function(t){r._parseResponse(t.toString()).forEach(i)})};a.prototype.addDefaultEvents=function(){var t=this;this.connection.on("connect",function(){}),this.connection.on("error",function(){t._timeout()}),this.connection.on("end",function(){t._timeout()}),this.connection.on("timeout",function(){t._timeout()})},a.prototype._parseResponse=function(t){var e=this,r=[];return t.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){e.lastChunk&&(t=e.lastChunk+t);var n=null;try{n=JSON.parse(t)}catch(r){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout(function(){throw e._timeout(),i.InvalidResponse(t)},15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,n&&r.push(n)}),r},a.prototype._addResponseCallback=function(t,e){var r=t.id||t[0].id,n=t.method||t[0].method;this.responseCallbacks[r]=e,this.responseCallbacks[r].method=n},a.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.InvalidConnection("on IPC")),delete this.responseCallbacks[t])},a.prototype.reconnect=function(){this.connection.connect({path:this.path})},a.prototype.send=function(t,e){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(t)),this._addResponseCallback(t,e)},a.prototype.on=function(t,e){if("function"!=typeof e)throw new Error("The second parameter callback must be a function.");switch(t){case"data":this.notificationCallbacks.push(e);break;default:this.connection.on(t,e)}},a.prototype.once=function(t,e){if("function"!=typeof e)throw new Error("The second parameter callback must be a function.");this.connection.once(t,e)},a.prototype.removeListener=function(t,e){var r=this;switch(t){case"data":this.notificationCallbacks.forEach(function(t,n){t===e&&r.notificationCallbacks.splice(n,1)});break;default:this.connection.removeListener(t,e)}},a.prototype.removeAllListeners=function(t){switch(t){case"data":this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(t)}},a.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners("error"),this.connection.removeAllListeners("end"),this.connection.removeAllListeners("timeout"),this.addDefaultEvents()},e.exports=a},{oboe:376,underscore:377,"web3-core-helpers":191}],379:[function(t,e,r){arguments[4][178][0].apply(r,arguments)},{dup:178}],380:[function(t,e,r){(function(r){var n=t("underscore"),i=t("web3-core-helpers").errors,o=null,a=null,s=null;"undefined"!=typeof window?(o=window.WebSocket,a=btoa,s=function(t){return new URL(t)}):(o=t("websocket").w3cwebsocket,a=function(t){return r(t).toString("base64")},s=t("url").parse);var u=function(t,e){var r=this;this.responseCallbacks={},this.notificationCallbacks=[],e=e||{},this._customTimeout=e.timeout;var i=s(t),u=e.headers||{};i.username&&i.password&&(u.authorization="Basic "+a(i.username+":"+i.password)),this.connection=new o(t,void 0,void 0,u),this.addDefaultEvents(),this.connection.onmessage=function(t){var e="string"==typeof t.data?t.data:"";r._parseResponse(e).forEach(function(t){var e=null;n.isArray(t)?t.forEach(function(t){r.responseCallbacks[t.id]&&(e=t.id)}):e=t.id,e||-1===t.method.indexOf("_subscription")?r.responseCallbacks[e]&&(r.responseCallbacks[e](null,t),delete r.responseCallbacks[e]):r.notificationCallbacks.forEach(function(e){n.isFunction(e)&&e(t)})})}};u.prototype.addDefaultEvents=function(){var t=this;this.connection.onerror=function(){t._timeout()},this.connection.onclose=function(){t._timeout(),t.reset()}},u.prototype._parseResponse=function(t){var e=this,r=[];return t.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){e.lastChunk&&(t=e.lastChunk+t);var n=null;try{n=JSON.parse(t)}catch(r){return e.lastChunk=t,clearTimeout(e.lastChunkTimeout),void(e.lastChunkTimeout=setTimeout(function(){throw e._timeout(),i.InvalidResponse(t)},15e3))}clearTimeout(e.lastChunkTimeout),e.lastChunk=null,n&&r.push(n)}),r},u.prototype._addResponseCallback=function(t,e){var r=t.id||t[0].id,n=t.method||t[0].method;this.responseCallbacks[r]=e,this.responseCallbacks[r].method=n;var o=this;this._customTimeout&&setTimeout(function(){o.responseCallbacks[r]&&(o.responseCallbacks[r](i.ConnectionTimeout(o._customTimeout)),delete o.responseCallbacks[r])},this._customTimeout)},u.prototype._timeout=function(){for(var t in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(t)&&(this.responseCallbacks[t](i.InvalidConnection("on WS")),delete this.responseCallbacks[t])},u.prototype.send=function(t,e){var r=this;if(this.connection.readyState!==this.connection.CONNECTING){if(this.connection.readyState!==this.connection.OPEN)return console.error("connection not open on send()"),"function"==typeof this.connection.onerror?this.connection.onerror(new Error("connection not open")):console.error("no error callback"),void e(new Error("connection not open"));this.connection.send(JSON.stringify(t)),this._addResponseCallback(t,e)}else setTimeout(function(){r.send(t,e)},10)},u.prototype.on=function(t,e){if("function"!=typeof e)throw new Error("The second parameter callback must be a function.");switch(t){case"data":this.notificationCallbacks.push(e);break;case"connect":this.connection.onopen=e;break;case"end":this.connection.onclose=e;break;case"error":this.connection.onerror=e}},u.prototype.removeListener=function(t,e){var r=this;switch(t){case"data":this.notificationCallbacks.forEach(function(t,n){t===e&&r.notificationCallbacks.splice(n,1)})}},u.prototype.removeAllListeners=function(t){switch(t){case"data":this.notificationCallbacks=[];break;case"connect":this.connection.onopen=null;break;case"end":this.connection.onclose=null;break;case"error":this.connection.onerror=null}},u.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.addDefaultEvents()},e.exports=u}).call(this,t("buffer").Buffer)},{buffer:47,underscore:379,url:158,"web3-core-helpers":191,websocket:45}],381:[function(t,e,r){var n=t("web3-core"),i=t("web3-core-subscriptions").subscriptions,o=t("web3-core-method"),a=t("web3-net"),s=function(){var t=this;n.packageInit(this,arguments);var e=this.setProvider;this.setProvider=function(){e.apply(t,arguments),t.net.setProvider.apply(t,arguments)},this.clearSubscriptions=t._requestManager.clearSubscriptions,this.net=new a(this.currentProvider),[new i({name:"subscribe",type:"shh",subscriptions:{messages:{params:1}}}),new o({name:"getVersion",call:"shh_version",params:0}),new o({name:"getInfo",call:"shh_info",params:0}),new o({name:"setMaxMessageSize",call:"shh_setMaxMessageSize",params:1}),new o({name:"setMinPoW",call:"shh_setMinPoW",params:1}),new o({name:"markTrustedPeer",call:"shh_markTrustedPeer",params:1}),new o({name:"newKeyPair",call:"shh_newKeyPair",params:0}),new o({name:"addPrivateKey",call:"shh_addPrivateKey",params:1}),new o({name:"deleteKeyPair",call:"shh_deleteKeyPair",params:1}),new o({name:"hasKeyPair",call:"shh_hasKeyPair",params:1}),new o({name:"getPublicKey",call:"shh_getPublicKey",params:1}),new o({name:"getPrivateKey",call:"shh_getPrivateKey",params:1}),new o({name:"newSymKey",call:"shh_newSymKey",params:0}),new o({name:"addSymKey",call:"shh_addSymKey",params:1}),new o({name:"generateSymKeyFromPassword",call:"shh_generateSymKeyFromPassword",params:1}),new o({name:"hasSymKey",call:"shh_hasSymKey",params:1}),new o({name:"getSymKey",call:"shh_getSymKey",params:1}),new o({name:"deleteSymKey",call:"shh_deleteSymKey",params:1}),new o({name:"newMessageFilter",call:"shh_newMessageFilter",params:1}),new o({name:"getFilterMessages",call:"shh_getFilterMessages",params:1}),new o({name:"deleteMessageFilter",call:"shh_deleteMessageFilter",params:1}),new o({name:"post",call:"shh_post",params:1,inputFormatter:[null]})].forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)})};n.addProviders(s),e.exports=s},{"web3-core":209,"web3-core-method":193,"web3-core-subscriptions":206,"web3-net":373}],382:[function(t,e,r){arguments[4][210][0].apply(r,arguments)},{dup:210}],383:[function(t,e,r){arguments[4][165][0].apply(r,arguments)},{dup:165}],384:[function(t,e,r){var n=t("bn.js"),i=t("number-to-bn"),o=new n(0),a=new n(-1),s={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"};function u(t){var e=t?t.toLowerCase():"ether",r=s[e];if("string"!=typeof r)throw new Error("[ethjs-unit] the unit provided "+t+" doesn't exists, please use the one of the following units "+JSON.stringify(s,null,2));return new n(r,10)}function f(t){if("string"==typeof t){if(!t.match(/^-?[0-9.]+$/))throw new Error("while converting number to string, invalid number value '"+t+"', should be a number matching (^-?[0-9.]+).");return t}if("number"==typeof t)return String(t);if("object"===(void 0===t?"undefined":_typeof(t))&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error("while converting number to string, invalid number value '"+t+"' type "+(void 0===t?"undefined":_typeof(t))+".")}e.exports={unitMap:s,numberToString:f,getValueOfUnit:u,fromWei:function(t,e,r){var n=i(t),f=n.lt(o),c=u(e),h=s[e].length-1||1,d=r||{};f&&(n=n.mul(a));for(var l=n.mod(c).toString(10);l.length2)throw new Error("[ethjs-unit] while converting number "+t+" to wei, too many decimal points");var d=h[0],l=h[1];if(d||(d="0"),l||(l="0"),l.length>o)throw new Error("[ethjs-unit] while converting number "+t+" to wei, too many decimal places");for(;l.length65536){if(!i)throw new Error("Requested too many random bytes.");r(new Error("Requested too many random bytes."))}if(void 0!==n&&n.randomBytes){if(!i)return"0x"+n.randomBytes(e).toString("hex");n.randomBytes(e,function(t,e){t?r(u):r(null,"0x"+e.toString("hex"))})}else{var o;if(void 0!==n?o=n:"undefined"!=typeof msCrypto&&(o=msCrypto),o&&o.getRandomValues){var a=o.getRandomValues(new Uint8Array(e)),s="0x"+Array.from(a).map(function(t){return t.toString(16)}).join("");if(!i)return s;r(null,s)}else{var u=new Error('No "crypto" object available. This Browser doesn\'t support generating secure random bytes.');if(!i)throw u;r(u)}}}},{"./crypto.js":388}],390:[function(t,e,r){var n=t("is-hex-prefixed");e.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},{"is-hex-prefixed":385}],391:[function(t,e,r){arguments[4][178][0].apply(r,arguments)},{dup:178}],392:[function(t,e,r){(function(t){!function(n){var i="object"==(void 0===r?"undefined":_typeof(r))&&r,o="object"==(void 0===e?"undefined":_typeof(e))&&e&&e.exports==i&&e,a="object"==(void 0===t?"undefined":_typeof(t))&&t;a.global!==a&&a.window!==a||(n=a);var s,u,f,c=String.fromCharCode;function h(t){for(var e,r,n=[],i=0,o=t.length;i=55296&&e<=56319&&i=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function l(t,e){return c(t>>e&63|128)}function p(t){if(0==(4294967168&t))return c(t);var e="";return 0==(4294965248&t)?e=c(t>>6&31|192):0==(4294901760&t)?(d(t),e=c(t>>12&15|224),e+=l(t,6)):0==(4292870144&t)&&(e=c(t>>18&7|240),e+=l(t,12),e+=l(t,6)),e+=c(63&t|128)}function b(){if(f>=u)throw Error("Invalid byte index");var t=255&s[f];if(f++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function m(){var t,e;if(f>u)throw Error("Invalid byte index");if(f==u)return!1;if(t=255&s[f],f++,0==(128&t))return t;if(192==(224&t)){if((e=(31&t)<<6|b())>=128)return e;throw Error("Invalid continuation byte")}if(224==(240&t)){if((e=(15&t)<<12|b()<<6|b())>=2048)return d(e),e;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=(15&t)<<18|b()<<12|b()<<6|b())>=65536&&e<=1114111)return e;throw Error("Invalid UTF-8 detected")}var y={version:"2.0.0",encode:function(t){for(var e=h(t),r=e.length,n=-1,i="";++n65535&&(i+=c((e-=65536)>>>10&1023|55296),e=56320|1023&e),i+=c(e);return i}(r)}};if("function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define(function(){return y});else if(i&&!i.nodeType)if(o)o.exports=y;else{var v={}.hasOwnProperty;for(var g in y)v.call(y,g)&&(i[g]=y[g])}else n.utf8=y}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],393:[function(t,e,r){var n=t("underscore"),i=t("ethjs-unit"),o=t("./utils.js"),a=t("./soliditySha3.js"),s=t("randomhex"),u=function(t){if(!o.isHexStrict(t))throw new Error("The parameter must be a valid HEX string.");var e="",r=0,n=t.length;for("0x"===t.substring(0,2)&&(r=2);r7?r+=t[n].toUpperCase():r+=t[n];return r},toHex:o.toHex,toBN:o.toBN,bytesToHex:o.bytesToHex,hexToBytes:o.hexToBytes,hexToNumberString:o.hexToNumberString,hexToNumber:o.hexToNumber,toDecimal:o.hexToNumber,numberToHex:o.numberToHex,fromDecimal:o.numberToHex,hexToUtf8:o.hexToUtf8,hexToString:o.hexToUtf8,toUtf8:o.hexToUtf8,utf8ToHex:o.utf8ToHex,stringToHex:o.utf8ToHex,fromUtf8:o.utf8ToHex,hexToAscii:u,toAscii:u,asciiToHex:f,fromAscii:f,unitMap:i.unitMap,toWei:function(t,e){if(e=c(e),!o.isBN(t)&&!n.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?i.toWei(t,e):i.toWei(t,e).toString(10)},fromWei:function(t,e){if(e=c(e),!o.isBN(t)&&!n.isString(t))throw new Error("Please pass numbers as strings or BigNumber objects to avoid precision errors.");return o.isBN(t)?i.fromWei(t,e):i.fromWei(t,e).toString(10)},padLeft:o.leftPad,leftPad:o.leftPad,padRight:o.rightPad,rightPad:o.rightPad,toTwosComplement:o.toTwosComplement}},{"./soliditySha3.js":394,"./utils.js":395,"ethjs-unit":384,randomhex:389,underscore:391}],394:[function(t,e,r){var n=t("underscore"),i=t("bn.js"),o=t("./utils.js"),a=function(t){var e=void 0===t?"undefined":_typeof(t);if("string"===e)return o.isHexStrict(t)?new i(t.replace(/0x/i,""),16):new i(t,10);if("number"===e)return new i(t);if(o.isBigNumber(t))return new i(t.toString(10));if(o.isBN(t))return t;throw new Error(t+" is not a number")},s=function(t,e,r){var n,s,u,f;if("bytes"===(t=(u=t).startsWith("int[")?"int256"+u.slice(3):"int"===u?"int256":u.startsWith("uint[")?"uint256"+u.slice(4):"uint"===u?"uint256":u.startsWith("fixed[")?"fixed128x128"+u.slice(5):"fixed"===u?"fixed128x128":u.startsWith("ufixed[")?"ufixed128x128"+u.slice(6):"ufixed"===u?"ufixed128x128":u)){if(e.replace(/^0x/i,"").length%2!=0)throw new Error("Invalid bytes characters "+e.length);return e}if("string"===t)return o.utf8ToHex(e);if("bool"===t)return e?"01":"00";if(t.startsWith("address")){if(n=r?64:40,!o.isAddress(e))throw new Error(e+" is not a valid address, or the checksum is invalid.");return o.leftPad(e.toLowerCase(),n)}if(n=(f=/^\D+(\d+).*$/.exec(t))?parseInt(f[1],10):null,t.startsWith("bytes")){if(!n)throw new Error("bytes[] not yet supported in solidity");if(r&&(n=32),n<1||n>32||n256)throw new Error("Invalid uint"+n+" size");if((s=a(e)).bitLength()>n)throw new Error("Supplied uint exceeds width: "+n+" vs "+s.bitLength());if(s.lt(new i(0)))throw new Error("Supplied uint "+s.toString()+" is negative");return n?o.leftPad(s.toString("hex"),n/8*2):s}if(t.startsWith("int")){if(n%8||n<8||n>256)throw new Error("Invalid int"+n+" size");if((s=a(e)).bitLength()>n)throw new Error("Supplied int exceeds width: "+n+" vs "+s.bitLength());return s.lt(new i(0))?s.toTwos(n).toString("hex"):n?o.leftPad(s.toString("hex"),n/8*2):s}throw new Error("Unsupported or invalid type: "+t)},u=function(t){if(n.isArray(t))throw new Error("Autodetection of array types is not supported.");var e,r,a,u="";if(n.isObject(t)&&(t.hasOwnProperty("v")||t.hasOwnProperty("t")||t.hasOwnProperty("value")||t.hasOwnProperty("type"))?(e=t.hasOwnProperty("t")?t.t:t.type,u=t.hasOwnProperty("v")?t.v:t.value):(e=o.toHex(t,!0),u=o.toHex(t),e.startsWith("int")||e.startsWith("uint")||(e="bytes")),!e.startsWith("int")&&!e.startsWith("uint")||"string"!=typeof u||/^(-)?0x/i.test(u)||(u=new i(u)),n.isArray(u)){if(a=/^\D+\d*\[(\d+)\]$/.exec(e),(r=a?parseInt(a[1],10):null)&&u.length!==r)throw new Error(e+" is not matching the given array "+JSON.stringify(u));r=u.length}return n.isArray(u)?u.map(function(t){return s(e,t,r).toString("hex").replace("0x","")}).join(""):s(e,u,r).toString("hex").replace("0x","")};e.exports=function(){var t=Array.prototype.slice.call(arguments),e=n.map(t,u);return o.sha3("0x"+e.join(""))}},{"./utils.js":395,"bn.js":382,underscore:391}],395:[function(t,e,r){var n=t("underscore"),i=t("bn.js"),o=t("number-to-bn"),a=t("utf8"),s=t("eth-lib/lib/hash"),u=function(t){return t instanceof i||t&&t.constructor&&"BN"===t.constructor.name},f=function(t){return t&&t.constructor&&"BigNumber"===t.constructor.name},c=function(t){try{return o.apply(null,arguments)}catch(e){throw new Error(e+' Given value: "'+t+'"')}},h=function(t){return!!/^(0x)?[0-9a-f]{40}$/i.test(t)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(t)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(t))||d(t))},d=function(t){t=t.replace(/^0x/i,"");for(var e=y(t.toLowerCase()).replace(/^0x/i,""),r=0;r<40;r++)if(parseInt(e[r],16)>7&&t[r].toUpperCase()!==t[r]||parseInt(e[r],16)<=7&&t[r].toLowerCase()!==t[r])return!1;return!0},l=function(t){var e="";t=(t=(t=(t=(t=a.encode(t)).replace(/^(?:\u0000)*/,"")).split("").reverse().join("")).replace(/^(?:\u0000)*/,"")).split("").reverse().join("");for(var r=0;r>>4).toString(16)),e.push((15&t[r]).toString(16));return"0x"+e.join("")},isHex:function(t){return(n.isString(t)||n.isNumber(t))&&/^(-0x|0x)?[0-9a-f]*$/i.test(t)},isHexStrict:m,leftPad:function(t,e,r){var n=/^0x/i.test(t)||"number"==typeof t,i=e-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?e-t.length+1:0;return(n?"0x":"")+new Array(i).join(r||"0")+t},rightPad:function(t,e,r){var n=/^0x/i.test(t)||"number"==typeof t,i=e-(t=t.toString(16).replace(/^0x/i,"")).length+1>=0?e-t.length+1:0;return(n?"0x":"")+t+new Array(i).join(r||"0")},toTwosComplement:function(t){return"0x"+c(t).toTwos(256).toString(16,64)},sha3:y}},{"bn.js":382,"eth-lib/lib/hash":383,"number-to-bn":386,underscore:391,utf8:392}],396:[function(t,e,r){e.exports={name:"web3",namespace:"ethereum",version:"1.0.0-beta.34",description:"Ethereum JavaScript API",repository:"https://github.com/ethereum/web3.js/tree/master/packages/web3",license:"LGPL-3.0",main:"src/index.js",types:"index.d.ts",bugs:{url:"https://github.com/ethereum/web3.js/issues"},keywords:["Ethereum","JavaScript","API"],author:"ethereum.org",authors:[{name:"Fabian Vogelsteller",email:"fabian@ethereum.org",homepage:"http://frozeman.de"},{name:"Marek Kotewicz",email:"marek@parity.io",url:"https://github.com/debris"},{name:"Marian Oancea",url:"https://github.com/cubedro"},{name:"Gav Wood",email:"g@parity.io",homepage:"http://gavwood.com"},{name:"Jeffery Wilcke",email:"jeffrey.wilcke@ethereum.org",url:"https://github.com/obscuren"}],dependencies:{"web3-bzz":"1.0.0-beta.34","web3-core":"1.0.0-beta.34","web3-eth":"1.0.0-beta.34","web3-eth-personal":"1.0.0-beta.34","web3-net":"1.0.0-beta.34","web3-shh":"1.0.0-beta.34","web3-utils":"1.0.0-beta.34"}}},{}],BN:[function(t,e,r){arguments[4][240][0].apply(r,arguments)},{buffer:17,dup:240}],Web3:[function(t,e,r){var n=t("../package.json").version,i=t("web3-core"),o=t("web3-eth"),a=t("web3-net"),s=t("web3-eth-personal"),u=t("web3-shh"),f=t("web3-bzz"),c=t("web3-utils"),h=function(){var t=this;i.packageInit(this,arguments),this.version=n,this.utils=c,this.eth=new o(this),this.shh=new u(this),this.bzz=new f(this);var e=this.setProvider;this.setProvider=function(r,n){return e.apply(t,arguments),this.eth.setProvider(r,n),this.shh.setProvider(r,n),this.bzz.setProvider(r),!0}};h.version=n,h.utils=c,h.modules={Eth:o,Net:a,Personal:s,Shh:u,Bzz:f},i.addProviders(h),e.exports=h},{"../package.json":396,"web3-bzz":187,"web3-core":209,"web3-eth":372,"web3-eth-personal":369,"web3-net":373,"web3-shh":381,"web3-utils":393}]},{},["Web3"])("Web3")}); \ No newline at end of file +"use strict";var _typeof2="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof="function"==typeof Symbol&&"symbol"===_typeof2(Symbol.iterator)?function(e){return void 0===e?"undefined":_typeof2(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":void 0===e?"undefined":_typeof2(e)};!function(e){if("object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Web3=e()}}(function(){var define,module,exports;return function o(s,a,u){function f(t,e){if(!a[t]){if(!s[t]){var r="function"==typeof require&&require;if(!e&&r)return r(t,!0);if(c)return c(t,!0);var n=new Error("Cannot find module '"+t+"'");throw n.code="MODULE_NOT_FOUND",n}var i=a[t]={exports:{}};s[t][0].call(i.exports,function(e){return f(s[t][1][e]||e)},i,i.exports,o,s,a,u)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e>6],i=0==(32&r);if(31==(31&r)){var o=r;for(r=0;128==(128&o);){if(o=e.readUInt8(t),e.isError(o))return o;r<<=7,r|=127&o}}else r&=31;return{cls:n,primitive:i,tag:r,tagStr:a.tag[r]}}function h(e,t,r){var n=e.readUInt8(r);if(e.isError(n))return n;if(!t&&128===n)return null;if(0==(128&n))return n;var i=127&n;if(4>=8)s++;(i=new f(2+s))[0]=o,i[1]=128|s;a=1+s;for(var u=n.length;0>=8)i[a]=255&u;return this._createEncoderBuffer([i,n])},a.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var r=new f(2*e.length),n=0;n>=7)i++}var s=new f(i),a=s.length-1;for(n=e.length-1;0<=n;n--){o=e[n];for(s[a--]=127&o;0<(o>>=7);)s[a--]=128|127&o}return this._createEncoderBuffer(s)},a.prototype._encodeTime=function(e,t){var r,n=new Date(e);return"gentime"===t?r=[u(n.getFullYear()),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):"utctime"===t?r=[u(n.getFullYear()%100),u(n.getUTCMonth()+1),u(n.getUTCDate()),u(n.getUTCHours()),u(n.getUTCMinutes()),u(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(r,"octstr")},a.prototype._encodeNull=function(){return this._createEncoderBuffer("")},a.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!f.isBuffer(e)){var r=e.toArray();!e.sign&&128&r[0]&&r.unshift(0),e=new f(r)}if(f.isBuffer(e)){var n=e.length;0===e.length&&n++;var i=new f(n);return e.copy(i),0===e.length&&(i[0]=0),this._createEncoderBuffer(i)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);n=1;for(var o=e;256<=o;o>>=8)n++;for(o=(i=new Array(n)).length-1;0<=o;o--)i[o]=255&e,e>>=8;return 128&i[0]&&i.unshift(0),this._createEncoderBuffer(new f(i))},a.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},a.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},a.prototype._skipDefault=function(e,t,r){var n,i=this._baseState;if(null===i.default)return!1;var o=e.join();if(void 0===i.defaultBuffer&&(i.defaultBuffer=this._encodeValue(i.default,t,r).join()),o.length!==i.defaultBuffer.length)return!1;for(n=0;n>16&255,o[s++]=t>>8&255,o[s++]=255&t;var f,c;2===i&&(t=h[e.charCodeAt(u)]<<2|h[e.charCodeAt(u+1)]>>4,o[s++]=255&t);1===i&&(t=h[e.charCodeAt(u)]<<10|h[e.charCodeAt(u+1)]<<4|h[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},r.fromByteArray=function(e){for(var t,r=e.length,n=r%3,i=[],o=0,s=r-n;o>2]+a[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],h=[],d="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,o=n.length;i>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return o.join("")}h["-".charCodeAt(0)]=62,h["_".charCodeAt(0)]=63},{}],16:[function(e,t,r){var n;function i(e){this.rand=e}if(t.exports=function(e){return n||(n=new i(null)),n.generate(e)},(t.exports.Rand=i).prototype.generate=function(e){return this._rand(e)},i.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),r=0;r>>24]^c[p>>>16&255]^h[b>>>8&255]^d[255&m]^t[y++],s=f[p>>>24]^c[b>>>16&255]^h[m>>>8&255]^d[255&l]^t[y++],a=f[b>>>24]^c[m>>>16&255]^h[l>>>8&255]^d[255&p]^t[y++],u=f[m>>>24]^c[l>>>16&255]^h[p>>>8&255]^d[255&b]^t[y++],l=o,p=s,b=a,m=u;return o=(n[l>>>24]<<24|n[p>>>16&255]<<16|n[b>>>8&255]<<8|n[255&m])^t[y++],s=(n[p>>>24]<<24|n[b>>>16&255]<<16|n[m>>>8&255]<<8|n[255&l])^t[y++],a=(n[b>>>24]<<24|n[m>>>16&255]<<16|n[l>>>8&255]<<8|n[255&p])^t[y++],u=(n[m>>>24]<<24|n[l>>>16&255]<<16|n[p>>>8&255]<<8|n[255&b])^t[y++],[o>>>=0,s>>>=0,a>>>=0,u>>>=0]}var h=[0,1,2,4,8,16,32,64,128,27,54],d=function(){for(var e=new Array(256),t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;for(var r=[],n=[],i=[[],[],[],[]],o=[[],[],[],[]],s=0,a=0,u=0;u<256;++u){var f=a^a<<1^a<<2^a<<3^a<<4;f=f>>>8^255&f^99;var c=e[n[r[s]=f]=s],h=e[c],d=e[h],l=257*e[f]^16843008*f;i[0][s]=l<<24|l>>>8,i[1][s]=l<<16|l>>>16,i[2][s]=l<<8|l>>>24,i[3][s]=l,l=16843009*d^65537*h^257*c^16843008*s,o[0][f]=l<<24|l>>>8,o[1][f]=l<<16|l>>>16,o[2][f]=l<<8|l>>>24,o[3][f]=l,0===s?s=a=1:(s=c^e[e[e[d^c]]],a^=e[e[a]])}return{SBOX:r,INV_SBOX:n,SUB_MIX:i,INV_SUB_MIX:o}}();function a(e){this._key=o(e),this._reset()}a.blockSize=16,a.keySize=32,a.prototype.blockSize=a.blockSize,a.prototype.keySize=a.keySize,a.prototype._reset=function(){for(var e=this._key,t=e.length,r=t+6,n=4*(r+1),i=[],o=0;o>>24,s=d.SBOX[s>>>24]<<24|d.SBOX[s>>>16&255]<<16|d.SBOX[s>>>8&255]<<8|d.SBOX[255&s],s^=h[o/t|0]<<24):6>>24]<<24|d.SBOX[s>>>16&255]<<16|d.SBOX[s>>>8&255]<<8|d.SBOX[255&s]),i[o]=i[o-t]^s}for(var a=[],u=0;u>>24]]^d.INV_SUB_MIX[1][d.SBOX[c>>>16&255]]^d.INV_SUB_MIX[2][d.SBOX[c>>>8&255]]^d.INV_SUB_MIX[3][d.SBOX[255&c]]}this._nRounds=r,this._keySchedule=i,this._invKeySchedule=a},a.prototype.encryptBlockRaw=function(e){return s(e=o(e),this._keySchedule,d.SUB_MIX,d.SBOX,this._nRounds)},a.prototype.encryptBlock=function(e){var t=this.encryptBlockRaw(e),r=i.allocUnsafe(16);return r.writeUInt32BE(t[0],0),r.writeUInt32BE(t[1],4),r.writeUInt32BE(t[2],8),r.writeUInt32BE(t[3],12),r},a.prototype.decryptBlock=function(e){var t=(e=o(e))[1];e[1]=e[3],e[3]=t;var r=s(e,this._invKeySchedule,d.INV_SUB_MIX,d.INV_SBOX,this._nRounds),n=i.allocUnsafe(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},a.prototype.scrub=function(){n(this._keySchedule),n(this._invKeySchedule),n(this._key)},t.exports.AES=a},{"safe-buffer":149}],19:[function(e,t,r){var s=e("./aes"),f=e("safe-buffer").Buffer,a=e("cipher-base"),n=e("inherits"),c=e("./ghash"),i=e("buffer-xor"),h=e("./incr32");function o(e,t,r,n){a.call(this);var i=f.alloc(4,0);this._cipher=new s.AES(t);var o=this._cipher.encryptBlock(i);this._ghash=new c(o),r=function(e,t,r){if(12===t.length)return e._finID=f.concat([t,f.from([0,0,0,1])]),f.concat([t,f.from([0,0,0,2])]);var n=new c(r),i=t.length,o=i%16;n.update(t),o&&(o=16-o,n.update(f.alloc(o,0))),n.update(f.alloc(8,0));var s=8*i,a=f.alloc(8);a.writeUIntBE(s,0,8),n.update(a),e._finID=n.state;var u=f.from(e._finID);return h(u),u}(this,r,o),this._prev=f.from(r),this._cache=f.allocUnsafe(0),this._secCache=f.allocUnsafe(0),this._decrypt=n,this._alen=0,this._len=0,this._mode=e,this._authTag=null,this._called=!1}n(o,a),o.prototype._update=function(e){if(!this._called&&this._alen){var t=16-this._alen%16;t<16&&(t=f.alloc(t,0),this._ghash.update(t))}this._called=!0;var r=this._mode.encrypt(this,e);return this._decrypt?this._ghash.update(e):this._ghash.update(r),this._len+=e.length,r},o.prototype._final=function(){if(this._decrypt&&!this._authTag)throw new Error("Unsupported state or unable to authenticate data");var e=i(this._ghash.final(8*this._alen,8*this._len),this._cipher.encryptBlock(this._finID));if(this._decrypt&&function(e,t){var r=0;e.length!==t.length&&r++;for(var n=Math.min(e.length,t.length),i=0;i>>0,0),t.writeUInt32BE(e[1]>>>0,4),t.writeUInt32BE(e[2]>>>0,8),t.writeUInt32BE(e[3]>>>0,12),t}function o(e){this.h=e,this.state=n.alloc(16,0),this.cache=n.allocUnsafe(0)}o.prototype.ghash=function(e){for(var t=-1;++t>>1|(1&n[t-1])<<31;n[0]=n[0]>>>1,r&&(n[0]=n[0]^225<<24)}this.state=s(i)},o.prototype.update=function(e){var t;for(this.cache=n.concat([this.cache,e]);16<=this.cache.length;)t=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(t)},o.prototype.final=function(e,t){return this.cache.length&&this.ghash(n.concat([this.cache,i],16)),this.ghash(s([0,e,0,t])),this.state},t.exports=o},{"safe-buffer":149}],24:[function(e,t,r){t.exports=function(e){for(var t,r=e.length;r--;){if(255!==(t=e.readUInt8(r))){t++,e.writeUInt8(t,r);break}e.writeUInt8(0,r)}}},{}],25:[function(e,t,r){var i=e("buffer-xor");r.encrypt=function(e,t){var r=i(t,e._prev);return e._prev=e._cipher.encryptBlock(r),e._prev},r.decrypt=function(e,t){var r=e._prev;e._prev=t;var n=e._cipher.decryptBlock(t);return i(n,r)}},{"buffer-xor":46}],26:[function(e,t,r){var o=e("safe-buffer").Buffer,s=e("buffer-xor");function a(e,t,r){var n=t.length,i=s(t,e._cache);return e._cache=e._cache.slice(n),e._prev=o.concat([e._prev,r?t:i]),i}r.encrypt=function(e,t,r){for(var n,i=o.allocUnsafe(0);t.length;){if(0===e._cache.length&&(e._cache=e._cipher.encryptBlock(e._prev),e._prev=o.allocUnsafe(0)),!(e._cache.length<=t.length)){i=o.concat([i,a(e,t,r)]);break}n=e._cache.length,i=o.concat([i,a(e,t.slice(0,n),r)]),t=t.slice(n)}return i}},{"buffer-xor":46,"safe-buffer":149}],27:[function(e,t,r){var s=e("safe-buffer").Buffer;function a(e,t,r){for(var n,i,o=-1,s=0;++o<8;)n=t&1<<7-o?128:0,s+=(128&(i=e._cipher.encryptBlock(e._prev)[0]^n))>>o%8,e._prev=u(e._prev,r?n:i);return s}function u(e,t){var r=e.length,n=-1,i=s.allocUnsafe(e.length);for(e=s.concat([e,s.from([t])]);++n>7;return i}r.encrypt=function(e,t,r){for(var n=t.length,i=s.allocUnsafe(n),o=-1;++o=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=b(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=m[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,s=r.data.pub_key,a=b.signature.decode(e,"der"),u=a.s,f=a.r;y(u,i),y(f,i);var c=l.mont(n),h=u.invm(i);return 0===o.toRed(c).redPow(new l(t).mul(h).mod(i)).fromRed().mul(s.toRed(c).redPow(f.mul(h).mod(i)).fromRed()).mod(n).mod(i).cmp(f)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=d.concat([i,t]);for(var s=o.modulus.byteLength(),a=[1],u=0;t.length+a.length+2>>1;case"base64":return N(e).length;default:if(n)return P(e).length;t=(""+t).toLowerCase(),n=!0}}function p(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):2147483647=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=h.from(t,n)),h.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a/=s=2,u/=2,r/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;o>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return k(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return M(this,t,r);case"base64":return g(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}.apply(this,arguments)},h.prototype.equals=function(e){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===h.compare(this,e)},h.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return 0t&&(e+=" ... ")),""},h.prototype.compare=function(e,t,r,n,i){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(i<=n&&r<=t)return 0;if(i<=n)return-1;if(r<=t)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),u=this.slice(n,i),f=e.slice(t,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||ithis.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o,s,a,u,f,c,h,d,l,p=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return d=t,l=r,R(P(e,(h=this).length-d),h,d,l);case"ascii":return v(this,e,t,r);case"latin1":case"binary":return v(this,e,t,r);case"base64":return u=this,f=t,c=r,R(N(e),u,f,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s=t,a=r,R(function(e,t){for(var r,n,i,o=[],s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,(o=this).length-s),o,s,a);default:if(p)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),p=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function x(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;ie.length)throw new RangeError("Index out of range")}function j(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function T(e,t,r,n,i){return t=+t,r>>>=0,i||j(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,i){return t=+t,r>>>=0,i||j(e,0,r,8),o.write(e,t,r,n,52,8),r+8}h.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):r>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e+--t],i=1;0>>=0,t||E(e,1,this.length),this[e]},h.prototype.readUInt16LE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUInt16BE=function(e,t){return e>>>=0,t||E(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||E(e,t,this.length);for(var n=this[e],i=1,o=0;++o>>=0,t>>>=0,r||E(e,t,this.length);for(var n=t,i=1,o=this[e+--n];0>>=0,t||E(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){e>>>=0,t||E(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){e>>>=0,t||E(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return e>>>=0,t||E(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readFloatLE=function(e,t){return e>>>=0,t||E(e,4,this.length),o.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return e>>>=0,t||E(e,4,this.length),o.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return e>>>=0,t||E(e,8,this.length),o.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return e>>>=0,t||E(e,8,this.length),o.read(this,e,!1,52,8)},h.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||A(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o>>=0,r>>>=0,n)||A(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;0<=--i&&(o*=256);)this[t+i]=e/o&255;return t+r},h.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,1,255,0),this[t]=255&e,t+1},h.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},h.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},h.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},h.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},h.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);A(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o>0)-a&255;return t+r},h.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);A(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;0<=--o&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},h.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},h.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},h.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},h.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},h.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||A(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},h.prototype.writeFloatLE=function(e,t,r){return T(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return T(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,n){if(!h.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),0=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function N(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(B,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function R(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function O(e){return e instanceof ArrayBuffer||null!=e&&null!=e.constructor&&"ArrayBuffer"===e.constructor.name&&"number"==typeof e.byteLength}function L(e){return e!=e}},{"base64-js":15,ieee754:100}],48:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",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"}},{}],49:[function(e,t,r){var i=e("safe-buffer").Buffer,n=e("stream").Transform,o=e("string_decoder").StringDecoder;function s(e){n.call(this),this.hashMode="string"==typeof e,this.hashMode?this[e]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}e("inherits")(s,n),s.prototype.update=function(e,t,r){"string"==typeof e&&(e=i.from(e,t));var n=this._update(e);return this.hashMode?this:(r&&(n=this._toString(n,r)),n)},s.prototype.setAutoPadding=function(){},s.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},s.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},s.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},s.prototype._transform=function(e,t,r){var n;try{this.hashMode?this._update(e):this.push(this._update(e))}catch(e){n=e}finally{r(n)}},s.prototype._flush=function(e){var t;try{this.push(this.__final())}catch(e){t=e}e(t)},s.prototype._finalOrDigest=function(e){var t=this.__final()||i.alloc(0);return e&&(t=this._toString(t,e,!0)),t},s.prototype._toString=function(e,t,r){if(this._decoder||(this._decoder=new o(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(e);return r&&(n+=this._decoder.end()),n},t.exports=s},{inherits:102,"safe-buffer":149,stream:158,string_decoder:163}],50:[function(e,t,r){(function(e){function t(e){return Object.prototype.toString.call(e)}r.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===t(e)},r.isBoolean=function(e){return"boolean"==typeof e},r.isNull=function(e){return null===e},r.isNullOrUndefined=function(e){return null==e},r.isNumber=function(e){return"number"==typeof e},r.isString=function(e){return"string"==typeof e},r.isSymbol=function(e){return"symbol"===(void 0===e?"undefined":_typeof(e))},r.isUndefined=function(e){return void 0===e},r.isRegExp=function(e){return"[object RegExp]"===t(e)},r.isObject=function(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e},r.isDate=function(e){return"[object Date]"===t(e)},r.isError=function(e){return"[object Error]"===t(e)||e instanceof Error},r.isFunction=function(e){return"function"==typeof e},r.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"===(void 0===e?"undefined":_typeof(e))||void 0===e},r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":103}],51:[function(e,a,t){(function(o){var t=e("elliptic"),n=e("bn.js");a.exports=function(e){return new i(e)};var r={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};function i(e){this.curveType=r[e],this.curveType||(this.curveType={name:e}),this.curve=new t.ec(this.curveType.name),this.keys=void 0}function s(e,t,r){Array.isArray(e)||(e=e.toArray());var n=new o(e);if(r&&n.lengthr)?t=("rmd160"===e?new u:f(e)).update(t).digest():t.length>>1];r=d.r28shl(r,o),n=d.r28shl(n,o),d.pc2(r,n,e.keys,i)}},u.prototype._update=function(e,t,r,n){var i=this._desState,o=d.readUInt32BE(e,t),s=d.readUInt32BE(e,t+4);d.ip(o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],"encrypt"===this.type?this._encrypt(i,o,s,i.tmp,0):this._decrypt(i,o,s,i.tmp,0),o=i.tmp[0],s=i.tmp[1],d.writeUInt32BE(r,o,n),d.writeUInt32BE(r,s,n+4)},u.prototype._pad=function(e,t){for(var r=e.length-t,n=t;n>>0,o=h}d.rip(s,o,n,i)},u.prototype._decrypt=function(e,t,r,n,i){for(var o=r,s=t,a=e.keys.length-2;0<=a;a-=2){var u=e.keys[a],f=e.keys[a+1];d.expand(o,e.tmp,0),u^=e.tmp[0],f^=e.tmp[1];var c=d.substitute(u,f),h=o;o=(s^d.permute(c))>>>0,s=h}d.rip(o,s,n,i)}},{"../des":57,inherits:102,"minimalistic-assert":107}],61:[function(e,t,r){var o=e("minimalistic-assert"),n=e("inherits"),i=e("../des"),s=i.Cipher,a=i.DES;function u(e,t){o.equal(t.length,24,"Invalid key length");var r=t.slice(0,8),n=t.slice(8,16),i=t.slice(16,24);this.ciphers="encrypt"===e?[a.create({type:"encrypt",key:r}),a.create({type:"decrypt",key:n}),a.create({type:"encrypt",key:i})]:[a.create({type:"decrypt",key:i}),a.create({type:"encrypt",key:n}),a.create({type:"decrypt",key:r})]}function f(e){s.call(this,e);var t=new u(this.type,this.options.key);this._edeState=t}n(f,s),(t.exports=f).create=function(e){return new f(e)},f.prototype._update=function(e,t,r,n){var i=this._edeState;i.ciphers[0]._update(e,t,r,n),i.ciphers[1]._update(r,n,r,n),i.ciphers[2]._update(r,n,r,n)},f.prototype._pad=a.prototype._pad,f.prototype._unpad=a.prototype._unpad},{"../des":57,inherits:102,"minimalistic-assert":107}],62:[function(e,t,r){r.readUInt32BE=function(e,t){return(e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])>>>0},r.writeUInt32BE=function(e,t,r){e[0+r]=t>>>24,e[1+r]=t>>>16&255,e[2+r]=t>>>8&255,e[3+r]=255&t},r.ip=function(e,t,r,n){for(var i=0,o=0,s=6;0<=s;s-=2){for(var a=0;a<=24;a+=8)i<<=1,i|=t>>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=e>>>a+s&1}for(s=6;0<=s;s-=2){for(a=1;a<=25;a+=8)o<<=1,o|=t>>>a+s&1;for(a=1;a<=25;a+=8)o<<=1,o|=e>>>a+s&1}r[n+0]=i>>>0,r[n+1]=o>>>0},r.rip=function(e,t,r,n){for(var i=0,o=0,s=0;s<4;s++)for(var a=24;0<=a;a-=8)i<<=1,i|=t>>>a+s&1,i<<=1,i|=e>>>a+s&1;for(s=4;s<8;s++)for(a=24;0<=a;a-=8)o<<=1,o|=t>>>a+s&1,o<<=1,o|=e>>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.pc1=function(e,t,r,n){for(var i=0,o=0,s=7;5<=s;s--){for(var a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1;for(a=0;a<=24;a+=8)i<<=1,i|=e>>a+s&1}for(a=0;a<=24;a+=8)i<<=1,i|=t>>a+s&1;for(s=1;s<=3;s++){for(a=0;a<=24;a+=8)o<<=1,o|=t>>a+s&1;for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1}for(a=0;a<=24;a+=8)o<<=1,o|=e>>a+s&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.r28shl=function(e,t){return e<>>28-t};var u=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];r.pc2=function(e,t,r,n){for(var i=0,o=0,s=u.length>>>1,a=0;a>>u[a]&1;for(a=s;a>>u[a]&1;r[n+0]=i>>>0,r[n+1]=o>>>0},r.expand=function(e,t,r){var n=0,i=0;n=(1&e)<<5|e>>>27;for(var o=23;15<=o;o-=4)n<<=6,n|=e>>>o&63;for(o=11;3<=o;o-=4)i|=e>>>o&63,i<<=6;i|=(31&e)<<1|e>>>31,t[r+0]=n>>>0,t[r+1]=i>>>0};var i=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];r.substitute=function(e,t){for(var r=0,n=0;n<4;n++){r<<=4,r|=i[64*n+(e>>>18-6*n&63)]}for(n=0;n<4;n++){r<<=4,r|=i[256+64*n+(t>>>18-6*n&63)]}return r>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];r.permute=function(e){for(var t=0,r=0;r>>n[r]&1;return t>>>0},r.padSplit=function(e,t,r){for(var n=e.toString(2);n.lengthe;)r.ishrn(1);if(r.isEven()&&r.iadd(u),r.testn(1)||r.iadd(f),t.cmp(f)){if(!t.cmp(c))for(;r.mod(h).cmp(d);)r.iadd(p)}else for(;r.mod(s).cmp(l);)r.iadd(p);if(m(n=r.shrn(1))&&m(r)&&y(n)&&y(r)&&a.test(n)&&a.test(r))return r}}},{"bn.js":"BN","miller-rabin":106,randombytes:132}],66:[function(e,t,r){t.exports={modp1:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18:{gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}},{}],67:[function(e,t,r){var n=r;n.version=e("../package.json").version,n.utils=e("./elliptic/utils"),n.rand=e("brorand"),n.curve=e("./elliptic/curve"),n.curves=e("./elliptic/curves"),n.ec=e("./elliptic/ec"),n.eddsa=e("./elliptic/eddsa")},{"../package.json":82,"./elliptic/curve":70,"./elliptic/curves":73,"./elliptic/ec":74,"./elliptic/eddsa":77,"./elliptic/utils":81,brorand:16}],68:[function(e,t,r){var n=e("bn.js"),i=e("../../elliptic").utils,S=i.getNAF,E=i.getJSF,h=i.assert;function o(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4);var r=this.n&&this.p.div(this.n);!r||0>1]):s.mixedAdd(i[-u-1>>1].neg()):0>1]):s.add(i[-u-1>>1].neg())}return"affine"===e.type?s.toP():s},o.prototype._wnafMulAdd=function(e,t,r,n,i){for(var o=this._wnafT1,s=this._wnafT2,a=this._wnafT3,u=0,f=0;f>1]:k<0&&(M=s[m][-k-1>>1].neg()),g="affine"===M.type?g.mixedAdd(M):g.add(M))}}for(f=0;f=Math.ceil((e.bitLength()+1)/t.step)},s.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i":""},c.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),r=this.z.redSqr();r=r.redIAdd(r);var n=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),o=n.redAdd(t),s=o.redSub(r),a=n.redSub(t),u=i.redMul(s),f=o.redMul(a),c=i.redMul(a),h=s.redMul(o);return this.curve.point(u,f,h,c)},c.prototype._projDbl=function(){var e,t,r,n=this.x.redAdd(this.y).redSqr(),i=this.x.redSqr(),o=this.y.redSqr();if(this.curve.twisted){var s=(f=this.curve._mulA(i)).redAdd(o);if(this.zOne)e=n.redSub(i).redSub(o).redMul(s.redSub(this.curve.two)),t=s.redMul(f.redSub(o)),r=s.redSqr().redSub(s).redSub(s);else{var a=this.z.redSqr(),u=s.redSub(a).redISub(a);e=n.redSub(i).redISub(o).redMul(u),t=s.redMul(f.redSub(o)),r=s.redMul(u)}}else{var f=i.redAdd(o);a=this.curve._mulC(this.c.redMul(this.z)).redSqr(),u=f.redSub(a).redSub(a);e=this.curve._mulC(n.redISub(f)).redMul(u),t=this.curve._mulC(f).redMul(i.redISub(o)),r=f.redMul(u)}return this.curve.point(e,t,r)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),r=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),o=r.redSub(t),s=i.redSub(n),a=i.redAdd(n),u=r.redAdd(t),f=o.redMul(s),c=a.redMul(u),h=o.redMul(u),d=s.redMul(a);return this.curve.point(f,c,d,h)},c.prototype._projAdd=function(e){var t,r,n=this.z.redMul(e.z),i=n.redSqr(),o=this.x.redMul(e.x),s=this.y.redMul(e.y),a=this.curve.d.redMul(o).redMul(s),u=i.redSub(a),f=i.redAdd(a),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(o).redISub(s),h=n.redMul(u).redMul(c);return this.curve.twisted?(t=n.redMul(f).redMul(s.redSub(this.curve._mulA(o))),r=u.redMul(f)):(t=n.redMul(f).redMul(s.redSub(o)),r=this.curve._mulC(u).redMul(f)),this.curve.point(h,t,r)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!1)},c.prototype.jmulAdd=function(e,t,r){return this.curve._wnafMulAdd(1,[this,t],[e,r],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var r=e.clone(),n=this.curve.redN.redMul(this.z);;){if(r.iadd(this.curve.n),0<=r.cmp(this.curve.p))return!1;if(t.redIAdd(n),0===this.x.cmp(t))return!0}return!1},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:102}],70:[function(e,t,r){var n=r;n.base=e("./base"),n.short=e("./short"),n.mont=e("./mont"),n.edwards=e("./edwards")},{"./base":68,"./edwards":69,"./mont":71,"./short":72}],71:[function(e,t,r){var n=e("../curve"),i=e("bn.js"),o=e("inherits"),s=n.base,a=e("../../elliptic").utils;function u(e){s.call(this,"mont",e),this.a=new i(e.a,16).toRed(this.red),this.b=new i(e.b,16).toRed(this.red),this.i4=new i(4).toRed(this.red).redInvm(),this.two=new i(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function f(e,t,r){s.BasePoint.call(this,e,"projective"),null===t&&null===r?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new i(t,16),this.z=new i(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}o(u,s),(t.exports=u).prototype.validate=function(e){var t=e.normalize().x,r=t.redSqr(),n=r.redMul(t).redAdd(r.redMul(this.a)).redAdd(t);return 0===n.redSqrt().redSqr().cmp(n)},o(f,s.BasePoint),u.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},u.prototype.point=function(e,t){return new f(this,e,t)},u.prototype.pointFromJSON=function(e){return f.fromJSON(this,e)},f.prototype.precompute=function(){},f.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},f.fromJSON=function(e,t){return new f(e,t[0],t[1]||e.one)},f.prototype.inspect=function(){return this.isInfinity()?"":""},f.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},f.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),r=e.redSub(t),n=e.redMul(t),i=r.redMul(t.redAdd(this.curve.a24.redMul(r)));return this.curve.point(n,i)},f.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.diffAdd=function(e,t){var r=this.x.redAdd(this.z),n=this.x.redSub(this.z),i=e.x.redAdd(e.z),o=e.x.redSub(e.z).redMul(r),s=i.redMul(n),a=t.z.redMul(o.redAdd(s).redSqr()),u=t.x.redMul(o.redISub(s).redSqr());return this.curve.point(a,u)},f.prototype.mul=function(e){for(var t=e.clone(),r=this,n=this.curve.point(null,null),i=[];0!==t.cmpn(0);t.iushrn(1))i.push(t.andln(1));for(var o=i.length-1;0<=o;o--)0===i[o]?(r=r.diffAdd(n,this),n=n.dbl()):(n=r.diffAdd(n,this),r=r.dbl());return n},f.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},f.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},f.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},f.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:102}],72:[function(e,t,r){var n=e("../curve"),i=e("../../elliptic"),_=e("bn.js"),o=e("inherits"),s=n.base,a=i.utils.assert;function u(e){s.call(this,"short",e),this.a=new _(e.a,16).toRed(this.red),this.b=new _(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function f(e,t,r,n){s.BasePoint.call(this,e,"affine"),null===t&&null===r?(this.x=null,this.y=null,this.inf=!0):(this.x=new _(t,16),this.y=new _(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function c(e,t,r,n){s.BasePoint.call(this,e,"jacobian"),null===t&&null===r&&null===n?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _(0)):(this.x=new _(t,16),this.y=new _(r,16),this.z=new _(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}o(u,s),(t.exports=u).prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,r;if(e.beta)t=new _(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);t=(t=n[0].cmp(n[1])<0?n[0]:n[1]).toRed(this.red)}if(e.lambda)r=new _(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?r=i[0]:(r=i[1],a(0===this.g.mul(r).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:r,basis:e.basis?e.basis.map(function(e){return{a:new _(e.a,16),b:new _(e.b,16)}}):this._getEndoBasis(r)}}},u.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:_.mont(e),r=new _(2).toRed(t).redInvm(),n=r.redNeg(),i=new _(3).toRed(t).redNeg().redSqrt().redMul(r);return[n.redAdd(i).fromRed(),n.redSub(i).fromRed()]},u.prototype._getEndoBasis=function(e){for(var t,r,n,i,o,s,a,u,f,c=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,d=this.n.clone(),l=new _(1),p=new _(0),b=new _(0),m=new _(1),y=0;0!==h.cmpn(0);){var v=d.div(h);u=d.sub(v.mul(h)),f=b.sub(v.mul(l));var g=m.sub(v.mul(p));if(!n&&u.cmp(c)<0)t=a.neg(),r=l,n=u.neg(),i=f;else if(n&&2==++y)break;d=h,h=a=u,b=l,l=f,m=p,p=g}o=u.neg(),s=f;var w=n.sqr().add(i.sqr());return 0<=o.sqr().add(s.sqr()).cmp(w)&&(o=t,s=r),n.negative&&(n=n.neg(),i=i.neg()),o.negative&&(o=o.neg(),s=s.neg()),[{a:n,b:i},{a:o,b:s}]},u.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),s=i.mul(r.a),a=o.mul(n.a),u=i.mul(r.b),f=o.mul(n.b);return{k1:e.sub(s).sub(a),k2:u.add(f).neg()}},u.prototype.pointFromX=function(e,t){(e=new _(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},u.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},u.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,o=0;o":""},f.prototype.isInfinity=function(){return this.inf},f.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},f.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),o=i.redSqr().redISub(this.x.redAdd(this.x)),s=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,s)},f.prototype.getX=function(){return this.x.fromRed()},f.prototype.getY=function(){return this.y.fromRed()},f.prototype.mul=function(e){return e=new _(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},f.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},f.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},f.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},f.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},f.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},o(c,s.BasePoint),u.prototype.jpoint=function(e,t,r){return new c(this,e,t,r)},c.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},c.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},c.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),s=e.y.redMul(r.redMul(this.z)),a=n.redSub(i),u=o.redSub(s);if(0===a.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),c=f.redMul(a),h=n.redMul(f),d=u.redSqr().redIAdd(c).redISub(h).redISub(h),l=u.redMul(h.redISub(d)).redISub(o.redMul(c)),p=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(d,l,p)},c.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),s=r.redSub(n),a=i.redSub(o);if(0===s.cmpn(0))return 0!==a.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=s.redSqr(),f=u.redMul(s),c=r.redMul(u),h=a.redSqr().redIAdd(f).redISub(c).redISub(c),d=a.redMul(c.redISub(h)).redISub(i.redMul(f)),l=this.z.redMul(s);return this.curve.jpoint(h,d,l)},c.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,r=0;r":""},c.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},{"../../elliptic":67,"../curve":70,"bn.js":"BN",inherits:102}],73:[function(e,t,r){var n,i=r,o=e("hash.js"),s=e("../elliptic"),a=s.utils.assert;function u(e){"short"===e.type?this.curve=new s.curve.short(e):"edwards"===e.type?this.curve=new s.curve.edwards(e):this.curve=new s.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,a(this.g.validate(),"Invalid curve"),a(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function f(t,r){Object.defineProperty(i,t,{configurable:!0,enumerable:!0,get:function(){var e=new u(r);return Object.defineProperty(i,t,{configurable:!0,enumerable:!0,value:e}),e}})}i.PresetCurve=u,f("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),f("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),f("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),f("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),f("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),f("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),f("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=e("./precomputed/secp256k1")}catch(e){n=void 0}f("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})},{"../elliptic":67,"./precomputed/secp256k1":80,"hash.js":86}],74:[function(e,t,r){var m=e("bn.js"),y=e("hmac-drbg"),o=e("../../elliptic"),l=o.utils.assert,n=e("./key"),v=e("./signature");function i(e){if(!(this instanceof i))return new i(e);"string"==typeof e&&(l(o.curves.hasOwnProperty(e),"Unknown curve "+e),e=o.curves[e]),e instanceof o.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}(t.exports=i).prototype.keyPair=function(e){return new n(this,e)},i.prototype.keyFromPrivate=function(e,t){return n.fromPrivate(this,e,t)},i.prototype.keyFromPublic=function(e,t){return n.fromPublic(this,e,t)},i.prototype.genKeyPair=function(e){e||(e={});for(var t=new y({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o.rand(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new m(2));;){var i=new m(t.generate(r));if(!(0>1;if(0<=s.cmp(this.curve.p.umod(this.curve.n))&&f)throw new Error("Unable to find sencond key candinate");s=f?this.curve.pointFromX(s.add(this.curve.n),u):this.curve.pointFromX(s,u);var c=t.r.invm(i),h=i.sub(o).mul(c).umod(i),d=a.mul(c).umod(i);return this.g.mulAdd(h,s,d)},i.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new v(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")}},{"../../elliptic":67,"./key":75,"./signature":76,"bn.js":"BN","hmac-drbg":98}],75:[function(e,t,r){var n=e("bn.js"),i=e("../../elliptic").utils.assert;function o(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}(t.exports=o).fromPublic=function(e,t,r){return t instanceof o?t:new o(e,{pub:t,pubEnc:r})},o.fromPrivate=function(e,t,r){return t instanceof o?t:new o(e,{priv:t,privEnc:r})},o.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},o.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},o.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},o.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},o.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?i(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||i(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},o.prototype.derive=function(e){return e.mul(this.priv).getX()},o.prototype.sign=function(e,t,r){return this.ec.sign(e,this,t,r)},o.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},o.prototype.inspect=function(){return""}},{"../../elliptic":67,"bn.js":"BN"}],76:[function(e,t,r){var a=e("bn.js"),u=e("../../elliptic").utils,n=u.assert;function i(e,t){if(e instanceof i)return e;this._importDER(e,t)||(n(e.r&&e.s,"Signature without r or s"),this.r=new a(e.r,16),this.s=new a(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}function f(){this.place=0}function c(e,t){var r=e[t.place++];if(!(128&r))return r;for(var n=15&r,i=0,o=0,s=t.place;o>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}(t.exports=i).prototype._importDER=function(e,t){e=u.toArray(e,t);var r=new f;if(48!==e[r.place++])return!1;if(c(e,r)+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var n=c(e,r),i=e.slice(r.place,n+r.place);if(r.place+=n,2!==e[r.place++])return!1;var o=c(e,r);if(e.length!==o+r.place)return!1;var s=e.slice(r.place,o+r.place);return 0===i[0]&&128&i[1]&&(i=i.slice(1)),0===s[0]&&128&s[1]&&(s=s.slice(1)),this.r=new a(i),this.s=new a(s),!(this.recoveryParam=null)},i.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=s(t),r=s(r);!(r[0]||128&r[1]);)r=r.slice(1);var n=[2];h(n,t.length),(n=n.concat(t)).push(2),h(n,r.length);var i=n.concat(r),o=[48];return h(o,i.length),o=o.concat(i),u.encode(o,e)}},{"../../elliptic":67,"bn.js":"BN"}],77:[function(e,t,r){var n=e("hash.js"),i=e("../../elliptic"),o=i.utils,s=o.assert,u=o.parseBytes,a=e("./key"),f=e("./signature");function c(e){if(s("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof c))return new c(e);e=i.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}(t.exports=c).prototype.sign=function(e,t){e=u(e);var r=this.keyFromSecret(t),n=this.hashInt(r.messagePrefix(),e),i=this.g.mul(n),o=this.encodePoint(i),s=this.hashInt(o,r.pubBytes(),e).mul(r.priv()),a=n.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:a,Rencoded:o})},c.prototype.verify=function(e,t,r){e=u(e),t=this.makeSignature(t);var n=this.keyFromPublic(r),i=this.hashInt(t.Rencoded(),n.pubBytes(),e),o=this.g.mul(t.S());return t.R().add(n.pub().mul(i)).eq(o)},c.prototype.hashInt=function(){for(var e=this.hash(),t=0;t>1)-1>1)-s:s,i.isubn(o)}else o=0;r.push(o);for(var a=0!==i.cmpn(0)&&0===i.andln(n-1)?t+1:1,u=1;ur&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.once=function(e,t){if(!u(t))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var r,n,i,o;if(!u(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=(r=this._events[e]).length,n=-1,r===t||u(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(f(r)){for(o=i;0=this._blockSize;){for(var i=this._blockOffset;i=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=i.join32(e,0,e.length-r,this.endian);for(var n=0;n>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,o=8;othis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},r.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},{"../utils":97}],97:[function(e,t,r){var f=e("minimalistic-assert"),n=e("inherits");function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function i(e){return 1===e.length?"0"+e:e}function s(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}r.inherits=n,r.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),n=0;n>8,s=255&i;o?r.push(o,s):r.push(s)}else for(n=0;n>>0}return o},r.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=255&o):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=255&o)}return r},r.rotr32=function(e,t){return e>>>t|e<<32-t},r.rotl32=function(e,t){return e<>>32-t},r.sum32=function(e,t){return e+t>>>0},r.sum32_3=function(e,t,r){return e+t+r>>>0},r.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},r.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},r.sum64=function(e,t,r,n){var i=e[t],o=n+e[t+1]>>>0,s=(o>>0,e[t+1]=o},r.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},r.sum64_lo=function(e,t,r,n){return t+n>>>0},r.sum64_4_hi=function(e,t,r,n,i,o,s,a){var u=0,f=t;return u+=(f=f+n>>>0)>>0)>>0)>>0},r.sum64_4_lo=function(e,t,r,n,i,o,s,a){return t+n+o+a>>>0},r.sum64_5_hi=function(e,t,r,n,i,o,s,a,u,f){var c=0,h=t;return c+=(h=h+n>>>0)>>0)>>0)>>0)>>0},r.sum64_5_lo=function(e,t,r,n,i,o,s,a,u,f){return t+n+o+a+f>>>0},r.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},r.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},r.shr64_hi=function(e,t,r){return e>>>r},r.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},{inherits:102,"minimalistic-assert":107}],98:[function(e,t,r){var n=e("hash.js"),s=e("minimalistic-crypto-utils"),i=e("minimalistic-assert");function o(e){if(!(this instanceof o))return new o(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=s.toArray(e.entropy,e.entropyEnc||"hex"),r=s.toArray(e.nonce,e.nonceEnc||"hex"),n=s.toArray(e.pers,e.persEnc||"hex");i(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}(t.exports=o).prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},o.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(n=r,r=t,t=null),r&&(r=s.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length>1,c=-7,h=r?i-1:0,d=r?-1:1,l=e[t+h];for(h+=d,o=l&(1<<-c)-1,l>>=-c,c+=a;0>=-c,c+=n;0>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=n?0:o-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=c):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),2<=(t+=1<=s+h?d/u:d*Math.pow(2,1-h))*u&&(s++,u/=2),c<=s+h?(a=0,s=c):1<=s+h?(a=(t*u-1)*Math.pow(2,i),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),s=0));8<=i;e[r+l]=255&a,l+=p,a/=256,i-=8);for(s=s<>>32-t}function u(e,t,r,n,i,o,s){return a(e+(t&r|~t&n)+i+o|0,s)+t|0}function f(e,t,r,n,i,o,s){return a(e+(t&n|r&~n)+i+o|0,s)+t|0}function c(e,t,r,n,i,o,s){return a(e+(t^r^n)+i+o|0,s)+t|0}function h(e,t,r,n,i,o,s){return a(e+(r^(t|~n))+i+o|0,s)+t|0}e(n,r),n.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;n=h(n=h(n=h(n=h(n=c(n=c(n=c(n=c(n=f(n=f(n=f(n=f(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),o,r,e[3],3250441966,22),i=u(i,o=u(o,r=u(r,n,i,o,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),o,r,e[7],4249261313,22),i=u(i,o=u(o,r=u(r,n,i,o,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),o,r,e[11],2304563134,22),i=u(i,o=u(o,r=u(r,n,i,o,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),o,r,e[15],1236535329,22),i=f(i,o=f(o,r=f(r,n,i,o,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),o,r,e[0],3921069994,20),i=f(i,o=f(o,r=f(r,n,i,o,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),o,r,e[4],3889429448,20),i=f(i,o=f(o,r=f(r,n,i,o,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),o,r,e[8],1163531501,20),i=f(i,o=f(o,r=f(r,n,i,o,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),o,r,e[12],2368359562,20),i=c(i,o=c(o,r=c(r,n,i,o,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),o,r,e[14],4259657740,23),i=c(i,o=c(o,r=c(r,n,i,o,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),o,r,e[10],3200236656,23),i=c(i,o=c(o,r=c(r,n,i,o,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),o,r,e[6],76029189,23),i=c(i,o=c(o,r=c(r,n,i,o,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),o,r,e[2],3299628645,23),i=h(i,o=h(o,r=h(r,n,i,o,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),o,r,e[5],4237533241,21),i=h(i,o=h(o,r=h(r,n,i,o,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),o,r,e[1],2240044497,21),i=h(i,o=h(o,r=h(r,n,i,o,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),o,r,e[13],1309151649,21),i=h(i,o=h(o,r=h(r,n,i,o,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56>8,s=255&i;o?r.push(o,s):r.push(s)}return r},n.zero2=i,n.toHex=o,n.encode=function(e,t){return"hex"===t?o(e):e}},{}],109:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n",r.homedir=function(){return"/"}},{}],110:[function(e,t,r){t.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},{}],111:[function(e,t,r){var n=e("asn1.js");r.certificate=e("./certificate");var i=n.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});r.RSAPrivateKey=i;var o=n.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});r.RSAPublicKey=o;var s=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(a),this.key("subjectPublicKey").bitstr())});r.PublicKey=s;var a=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),u=n.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(a),this.key("subjectPrivateKey").octstr())});r.PrivateKey=u;var f=n.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});r.EncryptedPrivateKey=f;var c=n.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});r.DSAPrivateKey=c,r.DSAparam=n.define("DSAparam",function(){this.int()});var h=n.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(d),this.key("publicKey").optional().explicit(1).bitstr())});r.ECPrivateKey=h;var d=n.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});r.signature=n.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},{"./certificate":112,"asn1.js":1}],112:[function(e,t,r){var n=e("asn1.js"),i=n.define("Time",function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),o=n.define("AttributeTypeValue",function(){this.seq().obj(this.key("type").objid(),this.key("value").any())}),s=n.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional())}),a=n.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(s),this.key("subjectPublicKey").bitstr())}),u=n.define("RelativeDistinguishedName",function(){this.setof(o)}),f=n.define("RDNSequence",function(){this.seqof(u)}),c=n.define("Name",function(){this.choice({rdnSequence:this.use(f)})}),h=n.define("Validity",function(){this.seq().obj(this.key("notBefore").use(i),this.key("notAfter").use(i))}),d=n.define("Extension",function(){this.seq().obj(this.key("extnID").objid(),this.key("critical").bool().def(!1),this.key("extnValue").octstr())}),l=n.define("TBSCertificate",function(){this.seq().obj(this.key("version").explicit(0).int(),this.key("serialNumber").int(),this.key("signature").use(s),this.key("issuer").use(c),this.key("validity").use(h),this.key("subject").use(c),this.key("subjectPublicKeyInfo").use(a),this.key("issuerUniqueID").implicit(1).bitstr().optional(),this.key("subjectUniqueID").implicit(2).bitstr().optional(),this.key("extensions").explicit(3).seqof(d).optional())}),p=n.define("X509Certificate",function(){this.seq().obj(this.key("tbsCertificate").use(l),this.key("signatureAlgorithm").use(s),this.key("signatureValue").bitstr())});t.exports=p},{"asn1.js":1}],113:[function(e,t,r){(function(d){var l=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r\+\/\=]+)[\n\r]+/m,p=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----/m,b=/^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----([0-9A-z\n\r\+\/\=]+)-----END \1-----$/m,m=e("evp_bytestokey"),y=e("browserify-aes");t.exports=function(e,t){var r,n=e.toString(),i=n.match(l);if(i){var o="aes"+i[1],s=new d(i[2],"hex"),a=new d(i[3].replace(/[\r\n]/g,""),"base64"),u=m(t,s.slice(0,8),parseInt(i[1],10)).key,f=[],c=y.createDecipheriv(o,u,s);f.push(c.update(a)),f.push(c.final()),r=d.concat(f)}else{var h=n.match(b);r=new d(h[2].replace(/[\r\n]/g,""),"base64")}return{tag:n.match(p)[1],data:r}}}).call(this,e("buffer").Buffer)},{"browserify-aes":20,buffer:47,evp_bytestokey:84}],114:[function(t,r,e){(function(v){var g=t("./asn1"),w=t("./aesid.json"),_=t("./fixProc"),x=t("browserify-aes"),M=t("pbkdf2");function e(e){var t;"object"!==(void 0===e?"undefined":_typeof(e))||v.isBuffer(e)||(t=e.passphrase,e=e.key),"string"==typeof e&&(e=new v(e));var r,n,i,o,s,a,u,f,c,h,d,l,p,b=_(e,t),m=b.tag,y=b.data;switch(m){case"CERTIFICATE":n=g.certificate.decode(y,"der").tbsCertificate.subjectPublicKeyInfo;case"PUBLIC KEY":switch(n||(n=g.PublicKey.decode(y,"der")),r=n.algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return g.RSAPublicKey.decode(n.subjectPublicKey.data,"der");case"1.2.840.10045.2.1":return n.subjectPrivateKey=n.subjectPublicKey,{type:"ec",data:n};case"1.2.840.10040.4.1":return n.algorithm.params.pub_key=g.DSAparam.decode(n.subjectPublicKey.data,"der"),{type:"dsa",data:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+m);case"ENCRYPTED PRIVATE KEY":y=g.EncryptedPrivateKey.decode(y,"der"),o=t,s=(i=y).algorithm.decrypt.kde.kdeparams.salt,a=parseInt(i.algorithm.decrypt.kde.kdeparams.iters.toString(),10),u=w[i.algorithm.decrypt.cipher.algo.join(".")],f=i.algorithm.decrypt.cipher.iv,c=i.subjectPrivateKey,h=parseInt(u.split("-")[1],10)/8,d=M.pbkdf2Sync(o,s,a,h),l=x.createDecipheriv(u,d,f),(p=[]).push(l.update(c)),p.push(l.final()),y=v.concat(p);case"PRIVATE KEY":switch(r=(n=g.PrivateKey.decode(y,"der")).algorithm.algorithm.join(".")){case"1.2.840.113549.1.1.1":return g.RSAPrivateKey.decode(n.subjectPrivateKey,"der");case"1.2.840.10045.2.1":return{curve:n.algorithm.curve,privateKey:g.ECPrivateKey.decode(n.subjectPrivateKey,"der").privateKey};case"1.2.840.10040.4.1":return n.algorithm.params.priv_key=g.DSAparam.decode(n.subjectPrivateKey,"der"),{type:"dsa",params:n.algorithm.params};default:throw new Error("unknown key id "+r)}throw new Error("unknown key type "+m);case"RSA PUBLIC KEY":return g.RSAPublicKey.decode(y,"der");case"RSA PRIVATE KEY":return g.RSAPrivateKey.decode(y,"der");case"DSA PRIVATE KEY":return{type:"dsa",params:g.DSAPrivateKey.decode(y,"der")};case"EC PRIVATE KEY":return{curve:(y=g.ECPrivateKey.decode(y,"der")).parameters.value,privateKey:y.privateKey};default:throw new Error("unknown key type "+m)}}(r.exports=e).signature=g.signature}).call(this,t("buffer").Buffer)},{"./aesid.json":110,"./asn1":111,"./fixProc":113,"browserify-aes":20,buffer:47,pbkdf2:115}],115:[function(e,t,r){r.pbkdf2=e("./lib/async"),r.pbkdf2Sync=e("./lib/sync")},{"./lib/async":116,"./lib/sync":119}],116:[function(e,t,r){(function(f,c){var h,d=e("./precondition"),l=e("./default-encoding"),p=e("./sync"),b=e("safe-buffer").Buffer,m=c.crypto&&c.crypto.subtle,y={sha:"SHA-1","sha-1":"SHA-1",sha1:"SHA-1",sha256:"SHA-256","sha-256":"SHA-256",sha384:"SHA-384","sha-384":"SHA-384","sha-512":"SHA-512",sha512:"SHA-512"},v=[];function g(e,t,r,n,i){return m.importKey("raw",e,{name:"PBKDF2"},!1,["deriveBits"]).then(function(e){return m.deriveBits({name:"PBKDF2",salt:t,iterations:r,hash:{name:i}},e,n<<3)}).then(function(e){return b.from(e)})}t.exports=function(t,r,n,i,o,s){"function"==typeof o&&(s=o,o=void 0);var e,a,u=y[(o=o||"sha1").toLowerCase()];if(!u||"function"!=typeof c.Promise)return f.nextTick(function(){var e;try{e=p(t,r,n,i,o)}catch(e){return s(e)}s(null,e)});if(d(t,r,n,i),"function"!=typeof s)throw new Error("No callback provided to pbkdf2");b.isBuffer(t)||(t=b.from(t,l)),b.isBuffer(r)||(r=b.from(r,l)),e=function(e){if(c.process&&!c.process.browser)return Promise.resolve(!1);if(!m||!m.importKey||!m.deriveBits)return Promise.resolve(!1);if(void 0!==v[e])return v[e];var t=g(h=h||b.alloc(8),h,10,128,e).then(function(){return!0}).catch(function(){return!1});return v[e]=t}(u).then(function(e){return e?g(t,r,n,i,u):p(t,r,n,i,o)}),a=s,e.then(function(e){f.nextTick(function(){a(null,e)})},function(e){f.nextTick(function(){a(e)})})}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-encoding":117,"./precondition":118,"./sync":119,_process:121,"safe-buffer":149}],117:[function(e,r,t){(function(e){var t;e.browser?t="utf-8":t=6<=parseInt(e.version.split(".")[0].slice(1),10)?"utf-8":"binary";r.exports=t}).call(this,e("_process"))},{_process:121}],118:[function(e,t,r){(function(r){var i=Math.pow(2,30)-1;function o(e,t){if("string"!=typeof e&&!r.isBuffer(e))throw new TypeError(t+" must be a buffer or string")}t.exports=function(e,t,r,n){if(o(e,"Password"),o(t,"Salt"),"number"!=typeof r)throw new TypeError("Iterations not a number");if(r<0)throw new TypeError("Bad iterations");if("number"!=typeof n)throw new TypeError("Key length not a number");if(n<0||io?t=i(t):t.lengths||0<=new f(t).cmp(o.modulus))throw new Error("decryption error");i=r?b(new f(t),o):l(t,o);var a=new c(s-i.length);if(a.fill(0),i=c.concat([a,i],s),4===n)return function(e,t){e.modulus;var r=e.modulus.byteLength(),n=(t.length,p("sha1").update(new c("")).digest()),i=n.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),s=t.slice(i+1),a=d(o,h(s,i)),u=d(s,h(a,r-i-1));if(function(e,t){e=new c(e),t=new c(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var s=t.slice(2,i-1);t.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;s.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":123,"./withPublic":126,"./xor":127,"bn.js":"BN","browserify-rsa":38,buffer:47,"create-hash":52,"parse-asn1":114}],125:[function(e,t,r){(function(d){var s=e("parse-asn1"),l=e("randombytes"),p=e("create-hash"),b=e("./mgf"),m=e("./xor"),y=e("bn.js"),a=e("./withPublic"),u=e("browserify-rsa");t.exports=function(e,t,r){var n;n=e.padding?e.padding:r?1:4;var i,o=s(e);if(4===n)i=function(e,t){var r=e.modulus.byteLength(),n=t.length,i=p("sha1").update(new d("")).digest(),o=i.length,s=2*o;if(r-s-2= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=v-g,k=Math.floor,S=String.fromCharCode;function E(e){throw new RangeError(h[e])}function l(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function p(e,t){var r=e.split("@"),n="";return 1>>10&1023|55296),e=56320|1023&e),t+=S(e)}).join("")}function T(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function I(e,t,r){var n=0;for(e=r?k(e/a):e>>1,e+=k(e/t);d*w>>1k((y-p)/s))&&E("overflow"),p+=u*s,!(u<(f=a<=m?g:m+w<=a?w:a-m));a+=v)s>k(y/(c=v-f))&&E("overflow"),s*=c;m=I(p-o,t=d.length+1,0==o),k(p/t)>y-b&&E("overflow"),b+=k(p/t),p%=t,d.splice(p++,0,b)}return j(d)}function m(e){var t,r,n,i,o,s,a,u,f,c,h,d,l,p,b,m=[];for(d=(e=A(e)).length,t=x,o=_,s=r=0;sk((y-r)/(l=n+1))&&E("overflow"),r+=(a-t)*l,t=a,s=0;sy&&E("overflow"),h==t){for(u=r,f=v;!(u<(c=f<=o?g:o+w<=f?w:f-o));f+=v)b=u-c,p=v-c,m.push(S(T(c+b%p,0))),u=k(b/p);m.push(S(T(u,0))),o=I(r,l,n==i),r=0,++n}++r,++t}return m.join("")}if(i={version:"1.4.1",ucs2:{decode:A,encode:j},decode:b,encode:m,toASCII:function(e){return p(e,function(e){return f.test(e)?"xn--"+m(e):e})},toUnicode:function(e){return p(e,function(e){return u.test(e)?b(e.slice(4).toLowerCase()):e})}},"function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define("punycode",function(){return i});else if(t&&r)if(C.exports==t)r.exports=i;else for(o in i)i.hasOwnProperty(o)&&(t[o]=i[o]);else e.punycode=i}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],129:[function(e,t,r){t.exports=function(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var a,u,f=e.length;0t.highWaterMark&&(t.highWaterMark=(b<=(r=e)?r=b:(r--,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r++),r)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0));var r}function x(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(w("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?y.nextTick(M,e):M(e))}function M(e){w("emit readable"),e.emit("readable"),j(e)}function k(e,t){t.readingMore||(t.readingMore=!0,y.nextTick(S,e,t))}function S(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=function(e,t,r){var n;eo.length?o.length:e;if(s===o.length?i+=o:i+=o.slice(0,e),0===(e-=s)){s===o.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r).data=o.slice(s);break}++n}return t.length-=n,i}(e,t):function(e,t){var r=f.allocUnsafe(e),n=t.head,i=1;n.data.copy(r),e-=n.data.length;for(;n=n.next;){var o=n.data,s=e>o.length?o.length:e;if(o.copy(r,r.length-e,0,s),0===(e-=s)){s===o.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n).data=o.slice(s);break}++i}return t.length-=i,r}(e,t);return n}(e,t.buffer,t.decoder),r);var r}function I(e){var t=e._readableState;if(0=t.highWaterMark||t.ended))return w("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?I(this):x(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&I(this),null;var n,i=t.needReadable;return w("need readable",i),(0===t.length||t.length-e>>0),o=this.head,s=0;o;)t=o.data,r=i,n=s,t.copy(r,n),s+=o.data.length,o=o.next;return i},e}(),n&&n.inspect&&n.inspect.custom&&(t.exports.prototype[n.inspect.custom]=function(){var e=n.inspect({length:this.length});return this.constructor.name+" "+e})},{"safe-buffer":149,util:17}],141:[function(e,t,r){var o=e("process-nextick-args");function s(e,t){e.emit("error",t)}t.exports={destroy:function(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?t?t(e):!e||this._writableState&&this._writableState.errorEmitted||o.nextTick(s,this,e):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(o.nextTick(s,r,e),r._writableState&&(r._writableState.errorEmitted=!0)):t&&t(e)})),this},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":120}],142:[function(e,t,r){t.exports=e("events").EventEmitter},{events:83}],143:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.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!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=f,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=h,t=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(1>>32-t}function k(e,t,r,n,i,o,s,a){return M(e+(t^r^n)+o+s|0,a)+i|0}function S(e,t,r,n,i,o,s,a){return M(e+(t&r|~t&n)+o+s|0,a)+i|0}function E(e,t,r,n,i,o,s,a){return M(e+((t|~r)^n)+o+s|0,a)+i|0}function A(e,t,r,n,i,o,s,a){return M(e+(t&n|r&~n)+o+s|0,a)+i|0}function j(e,t,r,n,i,o,s,a){return M(e+(t^(r|~n))+o+s|0,a)+i|0}i(s,o),s.prototype._update=function(){for(var e=m,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);for(var r=0|this._a,n=0|this._b,i=0|this._c,o=0|this._d,s=0|this._e,a=0|this._a,u=0|this._b,f=0|this._c,c=0|this._d,h=0|this._e,d=0;d<80;d+=1){var l,p;d<16?(l=k(r,n,i,o,s,e[y[d]],_[0],g[d]),p=j(a,u,f,c,h,e[v[d]],x[0],w[d])):d<32?(l=S(r,n,i,o,s,e[y[d]],_[1],g[d]),p=A(a,u,f,c,h,e[v[d]],x[1],w[d])):d<48?(l=E(r,n,i,o,s,e[y[d]],_[2],g[d]),p=E(a,u,f,c,h,e[v[d]],x[2],w[d])):d<64?(l=A(r,n,i,o,s,e[y[d]],_[3],g[d]),p=S(a,u,f,c,h,e[v[d]],x[3],w[d])):(l=j(r,n,i,o,s,e[y[d]],_[4],g[d]),p=k(a,u,f,c,h,e[v[d]],x[4],w[d])),r=s,s=o,o=M(i,10),i=n,n=l,a=h,h=c,c=M(f,10),f=u,u=p}var b=this._b+i+c|0;this._b=this._c+o+h|0,this._c=this._d+s+a|0,this._d=this._e+r+u|0,this._e=this._a+n+f|0,this._a=b},s.prototype._digest=function(){this._block[this._blockOffset++]=128,56=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(4294967295&r)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},{"safe-buffer":149}],151:[function(e,t,r){(r=t.exports=function(e){e=e.toLowerCase();var t=r[e];if(!t)throw new Error(e+" is not supported (we accept pull requests)");return new t}).sha=e("./sha"),r.sha1=e("./sha1"),r.sha224=e("./sha224"),r.sha256=e("./sha256"),r.sha384=e("./sha384"),r.sha512=e("./sha512")},{"./sha":152,"./sha1":153,"./sha224":154,"./sha256":155,"./sha384":156,"./sha512":157}],152:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,y=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function a(){this.init(),this._w=s,i.call(this,64,56)}n(a,i),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},a.prototype._update=function(e){for(var t,r,n,i,o,s,a=this._w,u=0|this._a,f=0|this._b,c=0|this._c,h=0|this._d,d=0|this._e,l=0;l<16;++l)a[l]=e.readInt32BE(4*l);for(;l<80;++l)a[l]=a[l-3]^a[l-8]^a[l-14]^a[l-16];for(var p=0;p<80;++p){var b=~~(p/20),m=0|((s=u)<<5|s>>>27)+(n=f,i=c,o=h,0===(r=b)?n&i|~n&o:2===r?n&i|n&o|i&o:n^i^o)+d+a[p]+y[b];d=h,h=c,c=(t=f)<<30|t>>>2,f=u,u=m}this._a=u+this._a|0,this._b=f+this._b|0,this._c=c+this._c|0,this._d=h+this._d|0,this._e=d+this._e|0},a.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=a},{"./hash":150,inherits:102,"safe-buffer":149}],153:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,v=[1518500249,1859775393,-1894007588,-899497514],s=new Array(80);function a(){this.init(),this._w=s,i.call(this,64,56)}n(a,i),a.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},a.prototype._update=function(e){for(var t,r,n,i,o,s,a,u=this._w,f=0|this._a,c=0|this._b,h=0|this._c,d=0|this._d,l=0|this._e,p=0;p<16;++p)u[p]=e.readInt32BE(4*p);for(;p<80;++p)u[p]=(t=u[p-3]^u[p-8]^u[p-14]^u[p-16])<<1|t>>>31;for(var b=0;b<80;++b){var m=~~(b/20),y=0|((a=f)<<5|a>>>27)+(i=c,o=h,s=d,0===(n=m)?i&o|~i&s:2===n?i&o|i&s|o&s:i^o^s)+l+u[b]+v[m];l=d,d=h,h=(r=c)<<30|r>>>2,c=f,f=y}this._a=f+this._a|0,this._b=c+this._b|0,this._c=h+this._c|0,this._d=d+this._d|0,this._e=l+this._e|0},a.prototype._hash=function(){var e=o.allocUnsafe(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},t.exports=a},{"./hash":150,inherits:102,"safe-buffer":149}],154:[function(e,t,r){var n=e("inherits"),i=e("./sha256"),o=e("./hash"),s=e("safe-buffer").Buffer,a=new Array(64);function u(){this.init(),this._w=a,o.call(this,64,56)}n(u,i),u.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},u.prototype._hash=function(){var e=s.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},t.exports=u},{"./hash":150,"./sha256":155,inherits:102,"safe-buffer":149}],155:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],s=new Array(64);function a(){this.init(),this._w=s,i.call(this,64,56)}n(a,i),a.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},a.prototype._update=function(e){for(var t,r,n,i,o,s,a,u=this._w,f=0|this._a,c=0|this._b,h=0|this._c,d=0|this._d,l=0|this._e,p=0|this._f,b=0|this._g,m=0|this._h,y=0;y<16;++y)u[y]=e.readInt32BE(4*y);for(;y<64;++y)u[y]=0|(((r=u[y-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)+u[y-7]+(((t=u[y-15])>>>7|t<<25)^(t>>>18|t<<14)^t>>>3)+u[y-16];for(var v=0;v<64;++v){var g=m+(((a=l)>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+((s=b)^l&(p^s))+_[v]+u[v]|0,w=0|(((o=f)>>>2|o<<30)^(o>>>13|o<<19)^(o>>>22|o<<10))+((n=f)&(i=c)|h&(n|i));m=b,b=p,p=l,l=d+g|0,d=h,h=c,c=f,f=g+w|0}this._a=f+this._a|0,this._b=c+this._b|0,this._c=h+this._c|0,this._d=d+this._d|0,this._e=l+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=m+this._h|0},a.prototype._hash=function(){var e=o.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},t.exports=a},{"./hash":150,inherits:102,"safe-buffer":149}],156:[function(e,t,r){var n=e("inherits"),i=e("./sha512"),o=e("./hash"),s=e("safe-buffer").Buffer,a=new Array(160);function u(){this.init(),this._w=a,o.call(this,128,112)}n(u,i),u.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},u.prototype._hash=function(){var n=s.allocUnsafe(48);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),n},t.exports=u},{"./hash":150,"./sha512":157,inherits:102,"safe-buffer":149}],157:[function(e,t,r){var n=e("inherits"),i=e("./hash"),o=e("safe-buffer").Buffer,ee=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],s=new Array(160);function a(){this.init(),this._w=s,i.call(this,128,112)}function te(e,t,r){return r^e&(t^r)}function re(e,t,r){return e&t|r&(e|t)}function ne(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function ie(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function oe(e,t){return e>>>0>>0?1:0}n(a,i),a.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},a.prototype._update=function(e){for(var t,r,n,i,o,s,a,u,f=this._w,c=0|this._ah,h=0|this._bh,d=0|this._ch,l=0|this._dh,p=0|this._eh,b=0|this._fh,m=0|this._gh,y=0|this._hh,v=0|this._al,g=0|this._bl,w=0|this._cl,_=0|this._dl,x=0|this._el,M=0|this._fl,k=0|this._gl,S=0|this._hl,E=0;E<32;E+=2)f[E]=e.readInt32BE(4*E),f[E+1]=e.readInt32BE(4*E+4);for(;E<160;E+=2){var A=f[E-30],j=f[E-30+1],T=((a=A)>>>1|(u=j)<<31)^(a>>>8|u<<24)^a>>>7,I=((o=j)>>>1|(s=A)<<31)^(o>>>8|s<<24)^(o>>>7|s<<25);A=f[E-4],j=f[E-4+1];var B=((n=A)>>>19|(i=j)<<13)^(i>>>29|n<<3)^n>>>6,C=((t=j)>>>19|(r=A)<<13)^(r>>>29|t<<3)^(t>>>6|r<<26),P=f[E-14],N=f[E-14+1],R=f[E-32],O=f[E-32+1],L=I+N|0,q=T+P+oe(L,I)|0;q=(q=q+B+oe(L=L+C|0,C)|0)+R+oe(L=L+O|0,O)|0,f[E]=q,f[E+1]=L}for(var U=0;U<160;U+=2){q=f[U],L=f[U+1];var D=re(c,h,d),F=re(v,g,w),H=ne(c,v),z=ne(v,c),K=ie(p,x),V=ie(x,p),G=ee[U],W=ee[U+1],X=te(p,b,m),J=te(x,M,k),Z=S+V|0,$=y+K+oe(Z,S)|0;$=($=($=$+X+oe(Z=Z+J|0,J)|0)+G+oe(Z=Z+W|0,W)|0)+q+oe(Z=Z+L|0,L)|0;var Y=z+F|0,Q=H+D+oe(Y,z)|0;y=m,S=k,m=b,k=M,b=p,M=x,p=l+$+oe(x=_+Z|0,_)|0,l=d,_=w,d=h,w=g,h=c,g=v,c=$+Q+oe(v=Z+Y|0,Z)|0}this._al=this._al+v|0,this._bl=this._bl+g|0,this._cl=this._cl+w|0,this._dl=this._dl+_|0,this._el=this._el+x|0,this._fl=this._fl+M|0,this._gl=this._gl+k|0,this._hl=this._hl+S|0,this._ah=this._ah+c+oe(this._al,v)|0,this._bh=this._bh+h+oe(this._bl,g)|0,this._ch=this._ch+d+oe(this._cl,w)|0,this._dh=this._dh+l+oe(this._dl,_)|0,this._eh=this._eh+p+oe(this._el,x)|0,this._fh=this._fh+b+oe(this._fl,M)|0,this._gh=this._gh+m+oe(this._gl,k)|0,this._hh=this._hh+y+oe(this._hl,S)|0},a.prototype._hash=function(){var n=o.allocUnsafe(64);function e(e,t,r){n.writeInt32BE(e,r),n.writeInt32BE(t,r+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),n},t.exports=a},{"./hash":150,inherits:102,"safe-buffer":149}],158:[function(e,t,r){t.exports=n;var c=e("events").EventEmitter;function n(){c.call(this)}e("inherits")(n,c),n.Readable=e("readable-stream/readable.js"),n.Writable=e("readable-stream/writable.js"),n.Duplex=e("readable-stream/duplex.js"),n.Transform=e("readable-stream/transform.js"),n.PassThrough=e("readable-stream/passthrough.js"),(n.Stream=n).prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function i(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",i),t._isStdio||e&&!1===e.end||(r.on("end",s),r.on("close",a));var o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function u(e){if(f(),0===c.listenerCount(this,"error"))throw e}function f(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("error",u),t.on("error",u),r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t}},{events:83,inherits:102,"readable-stream/duplex.js":134,"readable-stream/passthrough.js":144,"readable-stream/readable.js":145,"readable-stream/transform.js":146,"readable-stream/writable.js":147}],159:[function(r,e,i){(function(u){var f=r("./lib/request"),e=r("./lib/response"),c=r("xtend"),t=r("builtin-status-codes"),h=r("url"),n=i;n.request=function(e,t){e="string"==typeof e?h.parse(e):c(e);var r=-1===u.location.protocol.search(/^https?:$/)?"http:":"",n=e.protocol||r,i=e.hostname||e.host,o=e.port,s=e.path||"/";i&&-1!==i.indexOf(":")&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(o?":"+o:"")+s,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var a=new f(e);return t&&a.on("response",t),a},n.get=function(e,t){var r=n.request(e,t);return r.end(),r},n.ClientRequest=f,n.IncomingMessage=e.IncomingMessage,n.Agent=function(){},n.Agent.defaultMaxSockets=4,n.globalAgent=new n.Agent,n.STATUS_CODES=t,n.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,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":161,"./lib/response":162,"builtin-status-codes":48,url:166,xtend:170}],160:[function(e,t,a){(function(e){a.fetch=s(e.fetch)&&s(e.ReadableStream),a.writableStream=s(e.WritableStream),a.abortController=s(e.AbortController),a.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),a.blobConstructor=!0}catch(e){}var t;function r(){if(void 0!==t)return t;if(e.XMLHttpRequest){t=new e.XMLHttpRequest;try{t.open("GET",e.XDomainRequest?"/":"https://example.com")}catch(e){t=null}}else t=null;return t}function n(e){var t=r();if(!t)return!1;try{return t.responseType=e,t.responseType===e}catch(e){}return!1}var i=void 0!==e.ArrayBuffer,o=i&&s(e.ArrayBuffer.prototype.slice);function s(e){return"function"==typeof e}a.arraybuffer=a.fetch||i&&n("arraybuffer"),a.msstream=!a.fetch&&o&&n("ms-stream"),a.mozchunkedarraybuffer=!a.fetch&&i&&n("moz-chunked-arraybuffer"),a.overrideMimeType=a.fetch||!!r()&&s(r().overrideMimeType),a.vbArray=s(e.VBArray),t=null}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],161:[function(o,a,e){(function(u,f,c){var h=o("./capability"),e=o("inherits"),t=o("./response"),s=o("readable-stream"),d=o("to-arraybuffer"),r=t.IncomingMessage,l=t.readyStates;var n=a.exports=function(t){var e,r=this;s.Writable.call(r),r._opts=t,r._body=[],r._headers={},t.auth&&r.setHeader("Authorization","Basic "+new c(t.auth).toString("base64")),Object.keys(t.headers).forEach(function(e){r.setHeader(e,t.headers[e])});var n,i,o=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!h.abortController)e=!(o=!1);else if("prefer-streaming"===t.mode)e=!1;else if("allow-wrong-content-type"===t.mode)e=!h.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");e=!0}r._mode=(n=e,i=o,h.fetch&&i?"fetch":h.mozchunkedarraybuffer?"moz-chunked-arraybuffer":h.msstream?"ms-stream":h.arraybuffer&&n?"arraybuffer":h.vbArray&&n?"text:vbarray":"text"),r._fetchTimer=null,r.on("finish",function(){r._onFinish()})};e(n,s.Writable),n.prototype.setHeader=function(e,t){var r=e.toLowerCase();-1===i.indexOf(r)&&(this._headers[r]={name:e,value:t})},n.prototype.getHeader=function(e){var t=this._headers[e.toLowerCase()];return t?t.value:null},n.prototype.removeHeader=function(e){delete this._headers[e.toLowerCase()]},n.prototype._onFinish=function(){var t=this;if(!t._destroyed){var e=t._opts,n=t._headers,r=null;"GET"!==e.method&&"HEAD"!==e.method&&(r=h.arraybuffer?d(c.concat(t._body)):h.blobConstructor?new f.Blob(t._body.map(function(e){return d(e)}),{type:(n["content-type"]||{}).value||""}):c.concat(t._body).toString());var i=[];if(Object.keys(n).forEach(function(e){var t=n[e].name,r=n[e].value;Array.isArray(r)?r.forEach(function(e){i.push([t,e])}):i.push([t,r])}),"fetch"===t._mode){var o=null;if(h.abortController){var s=new AbortController;o=s.signal,t._fetchAbortController=s,"requestTimeout"in e&&0!==e.requestTimeout&&(t._fetchTimer=f.setTimeout(function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()},e.requestTimeout))}f.fetch(t._opts.url,{method:t._opts.method,headers:i,body:r||void 0,mode:"cors",credentials:e.withCredentials?"include":"same-origin",signal:o}).then(function(e){t._fetchResponse=e,t._connect()},function(e){f.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",e)})}else{var a=t._xhr=new f.XMLHttpRequest;try{a.open(t._opts.method,t._opts.url,!0)}catch(e){return void u.nextTick(function(){t.emit("error",e)})}"responseType"in a&&(a.responseType=t._mode.split(":")[0]),"withCredentials"in a&&(a.withCredentials=!!e.withCredentials),"text"===t._mode&&"overrideMimeType"in a&&a.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in e&&(a.timeout=e.requestTimeout,a.ontimeout=function(){t.emit("requestTimeout")}),i.forEach(function(e){a.setRequestHeader(e[0],e[1])}),t._response=null,a.onreadystatechange=function(){switch(a.readyState){case l.LOADING:case l.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(a.onprogress=function(){t._onXHRProgress()}),a.onerror=function(){t._destroyed||t.emit("error",new Error("XHR error"))};try{a.send(r)}catch(e){return void u.nextTick(function(){t.emit("error",e)})}}}},n.prototype._onXHRProgress=function(){(function(e){try{var t=e.status;return null!==t&&0!==t}catch(e){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},n.prototype._connect=function(){var t=this;t._destroyed||(t._response=new r(t._xhr,t._fetchResponse,t._mode,t._fetchTimer),t._response.on("error",function(e){t.emit("error",e)}),t.emit("response",t._response))},n.prototype._write=function(e,t,r){this._body.push(e),r()},n.prototype.abort=n.prototype.destroy=function(){this._destroyed=!0,f.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},n.prototype.end=function(e,t,r){"function"==typeof e&&(r=e,e=void 0),s.Writable.prototype.end.call(this,e,t,r)},n.prototype.flushHeaders=function(){},n.prototype.setTimeout=function(){},n.prototype.setNoDelay=function(){},n.prototype.setSocketKeepAlive=function(){};var i=["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","via"]}).call(this,o("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},o("buffer").Buffer)},{"./capability":160,"./response":162,_process:121,buffer:47,inherits:102,"readable-stream":145,"to-arraybuffer":165}],162:[function(r,e,n){(function(f,c,h){var d=r("./capability"),e=r("inherits"),l=r("readable-stream"),a=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},t=n.IncomingMessage=function(e,t,r,n){var i=this;if(l.Readable.call(i),i._mode=r,i.headers={},i.rawHeaders=[],i.trailers={},i.rawTrailers=[],i.on("end",function(){f.nextTick(function(){i.emit("close")})}),"fetch"===r){if(i._fetchResponse=t,i.url=t.url,i.statusCode=t.status,i.statusMessage=t.statusText,t.headers.forEach(function(e,t){i.headers[t.toLowerCase()]=e,i.rawHeaders.push(t,e)}),d.writableStream){var o=new WritableStream({write:function(r){return new Promise(function(e,t){i._destroyed?t():i.push(new h(r))?e():i._resumeFetch=e})},close:function(){c.clearTimeout(n),i._destroyed||i.push(null)},abort:function(e){i._destroyed||i.emit("error",e)}});try{return void t.body.pipeTo(o).catch(function(e){c.clearTimeout(n),i._destroyed||i.emit("error",e)})}catch(e){}}var s=t.body.getReader();!function t(){s.read().then(function(e){if(!i._destroyed){if(e.done)return c.clearTimeout(n),void i.push(null);i.push(new h(e.value)),t()}}).catch(function(e){c.clearTimeout(n),i._destroyed||i.emit("error",e)})}()}else{if(i._xhr=e,i._pos=0,i.url=e.responseURL,i.statusCode=e.status,i.statusMessage=e.statusText,e.getAllResponseHeaders().split(/\r?\n/).forEach(function(e){var t=e.match(/^([^:]+):\s*(.*)/);if(t){var r=t[1].toLowerCase();"set-cookie"===r?(void 0===i.headers[r]&&(i.headers[r]=[]),i.headers[r].push(t[2])):void 0!==i.headers[r]?i.headers[r]+=", "+t[2]:i.headers[r]=t[2],i.rawHeaders.push(t[1],t[2])}}),i._charset="x-user-defined",!d.overrideMimeType){var a=i.rawHeaders["mime-type"];if(a){var u=a.match(/;\s*charset=([^;])(;|$)/);u&&(i._charset=u[1].toLowerCase())}i._charset||(i._charset="utf-8")}}};e(t,l.Readable),t.prototype._read=function(){var e=this._resumeFetch;e&&(this._resumeFetch=null,e())},t.prototype._onXHRProgress=function(){var t=this,e=t._xhr,r=null;switch(t._mode){case"text:vbarray":if(e.readyState!==a.DONE)break;try{r=new c.VBArray(e.responseBody).toArray()}catch(e){}if(null!==r){t.push(new h(r));break}case"text":try{r=e.responseText}catch(e){t._mode="text:vbarray";break}if(r.length>t._pos){var n=r.substr(t._pos);if("x-user-defined"===t._charset){for(var i=new h(n.length),o=0;ot._pos&&(t.push(new h(new Uint8Array(s.result.slice(t._pos)))),t._pos=s.result.byteLength)},s.onload=function(){t.push(null)},s.readAsArrayBuffer(r)}t._xhr.readyState===a.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,r("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},r("buffer").Buffer)},{"./capability":160,_process:121,buffer:47,inherits:102,"readable-stream":145}],163:[function(e,t,r){var n=e("safe-buffer").Buffer,i=n.isEncoding||function(e){switch((e=""+e)&&e.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!0;default:return!1}};function o(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(n.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=f,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=h,t=3;break;default:return this.write=d,void(this.end=l)}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:-1}function a(e){var t=this.lastTotal-this.lastNeed,r=function(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�".repeat(r);if(1",'"',"`"," ","\r","\n","\t"]),L=["'"].concat(i),q=["%","/","?",";","#"].concat(L),U=["/","?","#"],D=/^[+a-z0-9A-Z_-]{0,63}$/,F=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,H={javascript:!0,"javascript:":!0},z={javascript:!0,"javascript:":!0},K={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},V=e("querystring");function o(e,t,r){if(e&&N.isObject(e)&&e instanceof A)return e;var n=new A;return n.parse(e,t,r),n}A.prototype.parse=function(e,t,r){if(!N.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+(void 0===e?"undefined":_typeof(e)));var n=e.indexOf("?"),i=-1!==n&&n>6|192);else{if(55295>18|240),r+=t(i>>12&63|128)}else r+=t(i>>12|224);r+=t(i>>6&63|128)}r+=t(63&i|128)}}return r},toString:function(e){for(var t="",r=0,n=s(e);r>10|55296),t+=String.fromCharCode(1023&i|56320)}}return t},fromNumber:function(e){var t=e.toString(16);return t.length%2==0?"0x"+t:"0x0"+t},toNumber:function(e){return parseInt(e.slice(2),16)},fromNat:function(e){return"0x0"===e?"0x":e.length%2==0?e:"0x0"+e.slice(2)},toNat:function(e){return"0"===e[2]?"0x"+e.slice(3):e},fromArray:n,toArray:r,fromUint8Array:function(e){return n([].slice.call(e,0))},toUint8Array:function(e){return new Uint8Array(r(e))}}},{"./array.js":171}],173:[function(e,t,r){var p="0123456789abcdef".split(""),b=[1,256,65536,16777216],m=[0,8,16,24],ce=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],y=function(e){var t,r,n,i,o,s,a,u,f,c,h,d,l,p,b,m,y,v,g,w,_,x,M,k,S,E,A,j,T,I,B,C,P,N,R,O,L,q,U,D,F,H,z,K,V,G,W,X,J,Z,$,Y,Q,ee,te,re,ne,ie,oe,se,ae,ue,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(l=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|f>>>31),r=o^(f<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(c<<1|h>>>31),r=a^(h<<1|c>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(d<<1|l>>>31),r=f^(l<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=c^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],G=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,T=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ae=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,z=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,R=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,X=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,I=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,O=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,q=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Y=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,A=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,F=e[39]<<8|e[38]>>>24,x=e[48]<<14|e[49]>>>18,M=e[49]<<14|e[48]>>>18,e[0]=p^~m&v,e[1]=b^~y&g,e[10]=k^~E&j,e[11]=S^~A&T,e[20]=N^~O&q,e[21]=R^~L&U,e[30]=K^~G&X,e[31]=V^~W&J,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=m^~v&w,e[3]=y^~g&_,e[12]=E^~j&I,e[13]=A^~T&B,e[22]=O^~q&D,e[23]=L^~U&F,e[32]=G^~X&Z,e[33]=W^~J&$,e[42]=re^~ie&se,e[43]=ne^~oe&ae,e[4]=v^~w&x,e[5]=g^~_&M,e[14]=j^~I&C,e[15]=T^~B&P,e[24]=q^~D&H,e[25]=U^~F&z,e[34]=X^~Z&Y,e[35]=J^~$&Q,e[44]=ie^~se&ue,e[45]=oe^~ae&fe,e[6]=w^~x&p,e[7]=_^~M&b,e[16]=I^~C&k,e[17]=B^~P&S,e[26]=D^~H&N,e[27]=F^~z&R,e[36]=Z^~Y&K,e[37]=$^~Q&V,e[46]=se^~ue&ee,e[47]=ae^~fe&te,e[8]=x^~p&m,e[9]=M^~b&y,e[18]=C^~k&E,e[19]=P^~S&A,e[28]=H^~N&O,e[29]=z^~R&L,e[38]=Y^~K&G,e[39]=Q^~V&W,e[48]=ue^~ee&re,e[49]=fe^~te&ne,e[0]^=ce[n],e[1]^=ce[n+1]},n=function(s){return function(e){var t,r,n;if("0x"===e.slice(0,2)){t=[];for(var i=2,o=e.length;i>2]|=t[f]<>2]|=r<>2]|=(192|r>>6)<>2]|=(224|r>>12)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=b[3&d],e.lastByteIndex===o)for(i[0]=i[s],d=1;d>4&15]+p[15&c]+p[c>>12&15]+p[c>>8&15]+p[c>>20&15]+p[c>>16&15]+p[c>>28&15]+p[c>>24&15];l%s==0&&(y(u),d=0)}return"0x"+h}({blocks:[],reset:!0,block:0,start:0,blockCount:1600-((r=s)<<1)>>5,outputBlocks:r>>5,s:(n=[0,0,0,0,0,0,0,0,0,0],[].concat(n,n,n,n,n))},t)}};t.exports={keccak256:n(256),keccak512:n(512),keccak256s:n(256),keccak512s:n(512)}},{}],174:[function(e,t,r){var n=e("is-function");t.exports=function(e,t,r){if(!n(t))throw new TypeError("iterator must be a function");arguments.length<3&&(r=this);"[object Array]"===i.call(e)?function(e,t,r){for(var n=0,i=e.length;n":">",'"':""","'":"'","`":"`"},P=p.invert(C),N=function(t){var r=function(e){return t[e]},e="(?:"+p.keys(t).join("|")+")",n=RegExp(e),i=RegExp(e,"g");return function(e){return e=null==e?"":""+e,n.test(e)?e.replace(i,r):e}};p.escape=N(C),p.unescape=N(P),p.result=function(e,t,r){var n=null==e?void 0:e[t];return void 0===n&&(n=r),p.isFunction(n)?n.call(e):n};var R=0;p.uniqueId=function(e){var t=++R+"";return e?e+t:t},p.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,L={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},q=/\\|'|\r|\n|\u2028|\u2029/g,U=function(e){return"\\"+L[e]};p.template=function(o,e,t){!e&&t&&(e=t),e=p.defaults({},e,p.templateSettings);var r=RegExp([(e.escape||O).source,(e.interpolate||O).source,(e.evaluate||O).source].join("|")+"|$","g"),s=0,a="__p+='";o.replace(r,function(e,t,r,n,i){return a+=o.slice(s,i).replace(q,U),s=i+e.length,t?a+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":r?a+="'+\n((__t=("+r+"))==null?'':__t)+\n'":n&&(a+="';\n"+n+"\n__p+='"),e}),a+="';\n",e.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{var n=new Function(e.variable||"obj","_",a)}catch(e){throw e.source=a,e}var i=function(e){return n.call(this,e,p)},u=e.variable||"obj";return i.source="function("+u+"){\n"+a+"}",i},p.chain=function(e){var t=p(e);return t._chain=!0,t};var D=function(e,t){return e._chain?p(t).chain():t};p.mixin=function(r){p.each(p.functions(r),function(e){var t=p[e]=r[e];p.prototype[e]=function(){var e=[this._wrapped];return i.apply(e,arguments),D(this,t.apply(p,e))}})},p.mixin(p),p.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var r=n[t];p.prototype[t]=function(){var e=this._wrapped;return r.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],D(this,e)}}),p.each(["concat","join","slice"],function(e){var t=n[e];p.prototype[e]=function(){return D(this,t.apply(this._wrapped,arguments))}}),p.prototype.value=function(){return this._wrapped},p.prototype.valueOf=p.prototype.toJSON=p.prototype.value,p.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return p})}).call(this)},{}],186:[function(e,t,r){t.exports=function(e,t){if(t){t=(t=t.trim().replace(/^(\?|#|&)/,""))?"?"+t:t;var r=e.split(/[\?\#]/),n=r[0];t&&/\:\/\/[^\/]*$/.test(n)&&(n+="/");var i=e.match(/(\#.*)$/);e=n+t,i&&(e+=i[0])}return e}},{}],187:[function(e,t,r){var i=e("xhr-request");t.exports=function(e,t){return new Promise(function(r,n){i(e,t,function(e,t){e?n(e):r(t)})})}},{"xhr-request":188}],188:[function(e,t,r){var a=e("query-string"),u=e("url-set-query"),f=e("object-assign"),c=e("./lib/ensure-header.js"),h=e("./lib/request.js"),d="application/json",l=function(){};t.exports=function(e,t,r){if(!e||"string"!=typeof e)throw new TypeError("must specify a URL");"function"==typeof t&&(r=t,t={});if(r&&"function"!=typeof r)throw new TypeError("expected cb to be undefined or a function");r=r||l;var n=(t=t||{}).json?"json":"text",i=(t=f({responseType:n},t)).headers||{},o=(t.method||"GET").toUpperCase(),s=t.query;s&&("string"!=typeof s&&(s=a.stringify(s)),e=u(e,s));"json"===t.responseType&&c(i,"Accept",d);t.json&&"GET"!==o&&"HEAD"!==o&&(c(i,"Content-Type",d),t.body=JSON.stringify(t.body));return t.method=o,t.url=e,t.headers=i,delete t.query,delete t.json,h(t,r)}},{"./lib/ensure-header.js":189,"./lib/request.js":191,"object-assign":192,"query-string":178,"url-set-query":186}],189:[function(e,t,r){t.exports=function(e,t,r){var n=t.toLowerCase();e[t]||e[n]||(e[t]=r)}},{}],190:[function(e,t,r){t.exports=function(e,t){return t?{statusCode:t.statusCode,headers:t.headers,method:e.method,url:e.url,rawRequest:t.rawRequest?t.rawRequest:t}:null}},{}],191:[function(e,t,r){var n=e("xhr"),a=e("./normalize-response");t.exports=function(i,o){delete i.uri;var s=!1;"json"===i.responseType&&(i.responseType="text",s=!0);return n(i,function(t,e,r){if(s&&!t)try{var n=e.rawRequest.responseText;r=JSON.parse(n)}catch(e){t=e}e=a(i,e),o(t,t?null:r,e)})}},{"./normalize-response":190,xhr:193}],192:[function(e,t,r){var n=Object.prototype.propertyIsEnumerable;function a(t){var e=Object.getOwnPropertyNames(t);return Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(t))),e.filter(function(e){return n.call(t,e)})}t.exports=Object.assign||function(e,t){for(var r,n,i=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),o=1;o>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=n=0;n>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);return this.strip()},y.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},y.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,f=r;f"};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f>>26,h=67108863&u,d=Math.min(f,t.length-1),l=Math.max(0,f-e.length+1);l<=d;l++){var p=f-l|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[l])+h)/67108864|0,h=67108863&s}r.words[f]=0|h,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}y.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?d[6-a.length]+a+r:a+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=l[e],f=p[e];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var h=c.modn(f).toString(e);r=(c=c.idivn(f)).isZero()?h+r:d[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}m(!1,"Base should be between 2 and 36")},y.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},y.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},y.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},y.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},y.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},y.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},y.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},y.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},y.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},y.prototype.inotn=function(e){m("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},y.prototype.notn=function(e){return this.clone().inotn(e)},y.prototype.setn=function(e,t){m("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},y.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,l=0|s[1],p=8191&l,b=l>>>13,m=0|s[2],y=8191&m,v=m>>>13,g=0|s[3],w=8191&g,_=g>>>13,x=0|s[4],M=8191&x,k=x>>>13,S=0|s[5],E=8191&S,A=S>>>13,j=0|s[6],T=8191&j,I=j>>>13,B=0|s[7],C=8191&B,P=B>>>13,N=0|s[8],R=8191&N,O=N>>>13,L=0|s[9],q=8191&L,U=L>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],K=8191&z,V=z>>>13,G=0|a[2],W=8191&G,X=G>>>13,J=0|a[3],Z=8191&J,$=J>>>13,Y=0|a[4],Q=8191&Y,ee=Y>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,fe=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,le=0|a[9],pe=8191&le,be=le>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(f+(n=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,H))+Math.imul(d,F)|0))<<13)|0;f=((o=Math.imul(d,H))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,H))+Math.imul(b,F)|0,o=Math.imul(b,H);var ye=(f+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;f=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,F),i=(i=Math.imul(y,H))+Math.imul(v,F)|0,o=Math.imul(v,H),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0;var ve=(f+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,W)|0))<<13)|0;f=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,X)|0;var ge=(f+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(d,Z)|0))<<13)|0;f=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,H))+Math.imul(k,F)|0,o=Math.imul(k,H),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,$)|0;var we=(f+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;f=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(E,F),i=(i=Math.imul(E,H))+Math.imul(A,F)|0,o=Math.imul(A,H),n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,V)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var _e=(f+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;f=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(T,F),i=(i=Math.imul(T,H))+Math.imul(I,F)|0,o=Math.imul(I,H),n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,X)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var xe=(f+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;f=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,H))+Math.imul(P,F)|0,o=Math.imul(P,H),n=n+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,$)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0;var Me=(f+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(d,ue)|0))<<13)|0;f=((o=o+Math.imul(d,fe)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(R,F),i=(i=Math.imul(R,H))+Math.imul(O,F)|0,o=Math.imul(O,H),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,fe)|0;var ke=(f+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;f=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(q,F),i=(i=Math.imul(q,H))+Math.imul(U,F)|0,o=Math.imul(U,H),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,X)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,$)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,se)|0,n=n+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,fe)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,fe)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,de)|0;var Se=(f+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(d,pe)|0))<<13)|0;f=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(q,K),i=(i=Math.imul(q,V))+Math.imul(U,K)|0,o=Math.imul(U,V),n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,se)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,fe)|0,n=n+Math.imul(y,he)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(f+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;f=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(q,W),i=(i=Math.imul(q,X))+Math.imul(U,W)|0,o=Math.imul(U,X),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,fe)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,he)|0,o=o+Math.imul(_,de)|0;var Ae=(f+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,be)|0)+Math.imul(v,pe)|0))<<13)|0;f=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(q,Z),i=(i=Math.imul(q,$))+Math.imul(U,Z)|0,o=Math.imul(U,$),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,n=n+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,fe)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(k,he)|0,o=o+Math.imul(k,de)|0;var je=(f+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;f=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(q,Q),i=(i=Math.imul(q,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,se)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,fe)|0,n=n+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var Te=(f+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,be)|0)+Math.imul(k,pe)|0))<<13)|0;f=((o=o+Math.imul(k,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(q,re),i=(i=Math.imul(q,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,fe)|0,n=n+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(I,he)|0,o=o+Math.imul(I,de)|0;var Ie=(f+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,be)|0)+Math.imul(A,pe)|0))<<13)|0;f=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(q,oe),i=(i=Math.imul(q,se))+Math.imul(U,oe)|0,o=Math.imul(U,se),n=n+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,fe)|0,n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var Be=(f+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,be)|0)+Math.imul(I,pe)|0))<<13)|0;f=((o=o+Math.imul(I,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(q,ue),i=(i=Math.imul(q,fe))+Math.imul(U,ue)|0,o=Math.imul(U,fe),n=n+Math.imul(R,he)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Ce=(f+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(P,pe)|0))<<13)|0;f=((o=o+Math.imul(P,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(q,he),i=(i=Math.imul(q,de))+Math.imul(U,he)|0,o=Math.imul(U,de);var Pe=(f+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,be)|0)+Math.imul(O,pe)|0))<<13)|0;f=((o=o+Math.imul(O,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(f+(n=Math.imul(q,pe))|0)+((8191&(i=(i=Math.imul(q,be))+Math.imul(U,pe)|0))<<13)|0;return f=((o=Math.imul(U,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=me,u[1]=ye,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Se,u[10]=Ee,u[11]=Ae,u[12]=je,u[13]=Te,u[14]=Ie,u[15]=Be,u[16]=Ce,u[17]=Pe,u[18]=Ne,0!==f&&(u[19]=f,r.length++),r};function a(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),y.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):a(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=y.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},y.prototype.muln=function(e){return this.clone().imuln(e)},y.prototype.sqr=function(){return this.mul(this)},y.prototype.isqr=function(){return this.imul(this.clone())},y.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new y(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,f=c&s}return a&&0!==f&&(a.words[a.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},y.prototype.ishrn=function(e,t,r){return m(0===this.negative),this.iushrn(e,t,r)},y.prototype.shln=function(e){return this.clone().ishln(e)},y.prototype.ushln=function(e){return this.clone().iushln(e)},y.prototype.shrn=function(e){return this.clone().ishrn(e)},y.prototype.ushrn=function(e){return this.clone().iushrn(e)},y.prototype.testn=function(e){m("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(a/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===s)return this.strip();for(m(-1===s),n=s=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},y.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,a=n.length-i.length;if("mod"!==t){(s=new y(null)).length=a+1,s.words=new Array(s.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new y(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new y(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new y(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},y.prototype.div=function(e){return this.divmod(e,"div",!1).div},y.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},y.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},y.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},y.prototype.modn=function(e){m(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},y.prototype.idivn=function(e){m(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},y.prototype.divn=function(e){return this.clone().idivn(e)},y.prototype.egcd=function(e){m(0===e.negative),m(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new y(1),i=new y(0),o=new y(0),s=new y(1),a=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++a;for(var u=r.clone(),f=t.clone();!t.isZero();){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(0>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},y.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},y.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},y._prime=function(e){if(f[e])return f[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new g;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return f[e]=t},_.prototype._verify1=function(e){m(0===e.negative,"red works only with positives"),m(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){m(0==(e.negative|t.negative),"red works only with positives"),m(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(m(t%2==1),3===t){var r=this.m.add(new y(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);m(!n.isZero());var o=new y(1).toRed(this),s=o.redNeg(),a=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new y(2*u*u).toRed(this);0!==this.pow(u,a).cmp(s);)u.redIAdd(s);for(var f=this.pow(u,n),c=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),d=i;0!==h.cmp(o);){for(var l=h,p=0;0!==l.cmp(o);p++)l=l.redSqr();m(p>f&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===n&&0===f)&&(i=this.mul(i,r[o]),o=s=0)):s=0}a=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},y.mont=function(e){return new x(e)},r(x,_),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new y(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{buffer:17}],219:[function(e,t,r){arguments[4][173][0].apply(r,arguments)},{dup:173}],220:[function(e,t,r){var n,i,p=(n=e("../utils/convert.js"),i=e("../utils/utf8.js"),{defineProperty:e("../utils/properties.js").defineProperty,arrayify:n.arrayify,padZeros:n.padZeros,bigNumberify:e("../utils/bignumber.js").bigNumberify,getAddress:e("../utils/address").getAddress,concat:n.concat,toUtf8Bytes:i.toUtf8Bytes,toUtf8String:i.toUtf8String,hexlify:n.hexlify}),b=e("./errors"),o=new RegExp(/^bytes([0-9]*)$/),s=new RegExp(/^(u?int)([0-9]*)$/),a=new RegExp(/^(.*)\[([0-9]*)\]$/),u=function(e,t){var r=e.match(s);return r&&parseInt(r[2])<=48?t.toNumber():t};var f=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"),c=new RegExp("^[A-Za-z_][A-Za-z0-9_]*$");function h(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}function d(t,e){function r(e){throw new Error('unexpected character "'+t[e]+'" at position '+e+' in "'+t+'"')}for(var n={type:"",name:"",state:{allowType:!0}},i=n,o=0;oe.length)throw new Error("invalid null");return{consumed:0,value:r("null",void 0)}},dynamic:!1}},y=function(i,o,s,a){var u=(s?"int":"uint")+8*o;return{localName:a,name:u,type:u,encode:function(t){try{t=p.bigNumberify(t)}catch(e){b.throwError("invalid number value",b.INVALID_ARGUMENT,{arg:a,type:void 0===t?"undefined":_typeof(t),value:t})}return t=t.toTwos(8*o).maskn(8*o),s&&(t=t.fromTwos(8*o).toTwos(256)),p.padZeros(p.arrayify(t),32)},decode:function(e,t){e.length>1]>>4&&(e[r]=e[r].toUpperCase()),8<=(15&t[r>>1])&&(e[r+1]=e[r+1].toUpperCase());return"0x"+e.join("")}var u=function(){for(var o={},e=0;e<10;e++)o[String(e)]=String(e);for(e=0;e<26;e++)o[String.fromCharCode(65+e)]=String(10+e);var t,s=Math.floor((t=9007199254740991,Math.log10?Math.log10(t):Math.log(t)/Math.LN10));return function(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split(""),r=0;r=s;){var n=t.substring(0,s);t=parseInt(n,10)%97+t.substring(n.length)}for(var i=String(98-parseInt(t,10)%97);i.length<2;)i="0"+i;return i}}();t.exports={getAddress:function(e,t){var r=null;if("string"!=typeof e&&o("invalid address",{input:e}),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),r=a(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&r!==e&&o("invalid address checksum",{input:e,expected:r});else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==u(e)&&o("invalid address icap checksum",{input:e}),r=new i(e.substring(4),36).toString(16);r.length<40;)r="0"+r;r=a("0x"+r)}else o("invalid address",{input:e});if(t){for(var n=new i(r.substring(2),16).toString(36).toUpperCase();n.length<30;)n="0"+n;return"XE"+u("XE00"+n)+n}return r}}},{"./convert":223,"./keccak256":225,"./throw-error":227,"bn.js":218}],222:[function(e,t,r){var n=e("bn.js"),i=e("./properties").defineProperty,o=e("./convert"),s=e("./throw-error");function a(e){if(!(this instanceof a))throw new Error("missing new");o.isHexString(e)?("0x"==e&&(e="0x0"),e=new n(e.substring(2),16)):"string"==typeof e&&"-"===e[0]&&o.isHexString(e.substring(1))?e=new n(e.substring(3),16).mul(a.constantNegativeOne._bn):"string"==typeof e&&e.match(/^-?[0-9]*$/)?(""==e&&(e="0"),e=new n(e)):"number"==typeof e&&parseInt(e)==e?e=new n(e):n.isBN(e)||(u(e)?e=e._bn:o.isArrayish(e)?e=new n(o.hexlify(e).substring(2),16):s("invalid BigNumber value",{input:e})),i(this,"_bn",e)}function u(e){return e._bn&&e._bn.mod}function f(e){return u(e)?e:new a(e)}i(a,"constantNegativeOne",f(-1)),i(a,"constantZero",f(0)),i(a,"constantOne",f(1)),i(a,"constantTwo",f(2)),i(a,"constantWeiPerEther",f(new n("1000000000000000000"))),i(a.prototype,"fromTwos",function(e){return new a(this._bn.fromTwos(e))}),i(a.prototype,"toTwos",function(e){return new a(this._bn.toTwos(e))}),i(a.prototype,"add",function(e){return new a(this._bn.add(f(e)._bn))}),i(a.prototype,"sub",function(e){return new a(this._bn.sub(f(e)._bn))}),i(a.prototype,"div",function(e){return new a(this._bn.div(f(e)._bn))}),i(a.prototype,"mul",function(e){return new a(this._bn.mul(f(e)._bn))}),i(a.prototype,"mod",function(e){return new a(this._bn.mod(f(e)._bn))}),i(a.prototype,"pow",function(e){return new a(this._bn.pow(f(e)._bn))}),i(a.prototype,"maskn",function(e){return new a(this._bn.maskn(e))}),i(a.prototype,"eq",function(e){return this._bn.eq(f(e)._bn)}),i(a.prototype,"lt",function(e){return this._bn.lt(f(e)._bn)}),i(a.prototype,"lte",function(e){return this._bn.lte(f(e)._bn)}),i(a.prototype,"gt",function(e){return this._bn.gt(f(e)._bn)}),i(a.prototype,"gte",function(e){return this._bn.gte(f(e)._bn)}),i(a.prototype,"isZero",function(){return this._bn.isZero()}),i(a.prototype,"toNumber",function(e){return this._bn.toNumber()}),i(a.prototype,"toString",function(){return this._bn.toString(10)}),i(a.prototype,"toHexString",function(){var e=this._bn.toString(16);return e.length%2&&(e="0"+e),"0x"+e}),t.exports={isBigNumber:u,bigNumberify:f,BigNumber:a}},{"./convert":223,"./properties":226,"./throw-error":227,"bn.js":218}],223:[function(e,t,r){e("./properties.js").defineProperty;var o=e("./errors");function a(t){return t.slice||(t.slice=function(){var e=Array.prototype.slice.call(arguments);return new Uint8Array(Array.prototype.slice.apply(t,e))}),t}function s(e){if(!e||parseInt(e.length)!=e.length||"string"==typeof e)return!1;for(var t=0;t>4]+c[15&i])}return"0x"+r.join("")}o.throwError("invalid hexlify value",{arg:"value",value:e})}t.exports={arrayify:u,isArrayish:s,concat:function(e){for(var t=[],r=0,n=0;n>6|192:(55296==(64512&i)&&n+1>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return u.arrayify(t)},toUtf8String:function(e){e=u.arrayify(e);for(var t="",r=0;r>7!=0){if(n>>6!=2){var i=null;if(n>>5==6)i=1;else if(n>>4==14)i=2;else if(n>>3==30)i=3;else if(n>>2==62)i=4;else{if(n>>1!=126)continue;i=5}if(r+i>e.length){for(;r>6==2;r++);if(r!=e.length)continue;return t}var o,s=n&(1<<8-i-1)-1;for(o=0;o>6!=2)break;s=s<<6|63&a}o==i?s<=65535?t+=String.fromCharCode(s):(s-=65536,t+=String.fromCharCode(55296+(s>>10&1023),56320+(1023&s))):r--}}else t+=String.fromCharCode(n)}return t}}},{"./convert.js":223}],229:[function(e,t,r){var c=e("bn.js"),h=e("number-to-bn"),d=new c(0),l=new c(-1),p={noether:"0",wei:"1",kwei:"1000",Kwei:"1000",babbage:"1000",femtoether:"1000",mwei:"1000000",Mwei:"1000000",lovelace:"1000000",picoether:"1000000",gwei:"1000000000",Gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"};function b(e){var t=e?e.toLowerCase():"ether",r=p[t];if("string"!=typeof r)throw new Error("[ethjs-unit] the unit provided "+e+" doesn't exists, please use the one of the following units "+JSON.stringify(p,null,2));return new c(r,10)}function m(e){if("string"==typeof e){if(!e.match(/^-?[0-9.]+$/))throw new Error("while converting number to string, invalid number value '"+e+"', should be a number matching (^-?[0-9.]+).");return e}if("number"==typeof e)return String(e);if("object"===(void 0===e?"undefined":_typeof(e))&&e.toString&&(e.toTwos||e.dividedToIntegerBy))return e.toPrecision?String(e.toPrecision()):e.toString(10);throw new Error("while converting number to string, invalid number value '"+e+"' type "+(void 0===e?"undefined":_typeof(e))+".")}t.exports={unitMap:p,numberToString:m,getValueOfUnit:b,fromWei:function(e,t,r){var n=h(e),i=n.lt(d),o=b(t),s=p[t].length-1||1,a=r||{};i&&(n=n.mul(l));for(var u=n.mod(o).toString(10);u.lengthi)throw new Error("[ethjs-unit] while converting number "+e+" to wei, too many decimal places");for(;u.length>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);else if("le"===r)for(i=n=0;n>>26-s&67108863,26<=(s+=24)&&(s-=26,i++);return this.strip()},y.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r>>26-o&4194303,26<=(o+=24)&&(o-=26,n++);r+6!==t&&(i=s(e,t,r+6),this.words[n]|=i<>>26-o&4194303),this.strip()},y.prototype._parseBase=function(e,t,r){this.words=[0];for(var n=0,i=this.length=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var o=e.length-r,s=o%n,a=Math.min(o,o-s)+r,u=0,f=r;f"};var d=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],l=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function i(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;n=(r.length=n)-1|0;var i=0|e.words[0],o=0|t.words[0],s=i*o,a=67108863&s,u=s/67108864|0;r.words[0]=a;for(var f=1;f>>26,h=67108863&u,d=Math.min(f,t.length-1),l=Math.max(0,f-e.length+1);l<=d;l++){var p=f-l|0;c+=(s=(i=0|e.words[p])*(o=0|t.words[l])+h)/67108864|0,h=67108863&s}r.words[f]=0|h,u=0|c}return 0!==u?r.words[f]=0|u:r.length--,r.strip()}y.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var n=0,i=0,o=0;o>>24-n&16777215)||o!==this.length-1?d[6-a.length]+a+r:a+r,26<=(n+=2)&&(n-=26,o--)}for(0!==i&&(r=i.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&2<=e&&e<=36){var u=l[e],f=p[e];r="";var c=this.clone();for(c.negative=0;!c.isZero();){var h=c.modn(f).toString(e);r=(c=c.idivn(f)).isZero()?h+r:d[u-h.length]+h+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}m(!1,"Base should be between 2 and 36")},y.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:2>>=13),64<=t&&(r+=7,t>>>=7),8<=t&&(r+=4,t>>>=4),2<=t&&(r+=2,t>>>=2),r+t},y.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0==(8191&t)&&(r+=13,t>>>=13),0==(127&t)&&(r+=7,t>>>=7),0==(15&t)&&(r+=4,t>>>=4),0==(3&t)&&(r+=2,t>>>=2),0==(1&t)&&r++,r},y.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},y.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},y.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},y.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},y.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},y.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},y.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},y.prototype.inotn=function(e){m("number"==typeof e&&0<=e);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),0>26-r),this.strip()},y.prototype.notn=function(e){return this.clone().inotn(e)},y.prototype.setn=function(e,t){m("number"==typeof e&&0<=e);var r=e/26|0,n=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>>26;for(;0!==i&&o>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;oe.length?this.clone().iadd(e):e.clone().iadd(this)},y.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;0>26,this.words[s]=67108863&t;for(;0!==o&&s>26,this.words[s]=67108863&t;if(0===o&&s>>13,l=0|s[1],p=8191&l,b=l>>>13,m=0|s[2],y=8191&m,v=m>>>13,g=0|s[3],w=8191&g,_=g>>>13,x=0|s[4],M=8191&x,k=x>>>13,S=0|s[5],E=8191&S,A=S>>>13,j=0|s[6],T=8191&j,I=j>>>13,B=0|s[7],C=8191&B,P=B>>>13,N=0|s[8],R=8191&N,O=N>>>13,L=0|s[9],q=8191&L,U=L>>>13,D=0|a[0],F=8191&D,H=D>>>13,z=0|a[1],K=8191&z,V=z>>>13,G=0|a[2],W=8191&G,X=G>>>13,J=0|a[3],Z=8191&J,$=J>>>13,Y=0|a[4],Q=8191&Y,ee=Y>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],oe=8191&ie,se=ie>>>13,ae=0|a[7],ue=8191&ae,fe=ae>>>13,ce=0|a[8],he=8191&ce,de=ce>>>13,le=0|a[9],pe=8191&le,be=le>>>13;r.negative=e.negative^t.negative,r.length=19;var me=(f+(n=Math.imul(h,F))|0)+((8191&(i=(i=Math.imul(h,H))+Math.imul(d,F)|0))<<13)|0;f=((o=Math.imul(d,H))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(p,F),i=(i=Math.imul(p,H))+Math.imul(b,F)|0,o=Math.imul(b,H);var ye=(f+(n=n+Math.imul(h,K)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,K)|0))<<13)|0;f=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,F),i=(i=Math.imul(y,H))+Math.imul(v,F)|0,o=Math.imul(v,H),n=n+Math.imul(p,K)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(b,K)|0,o=o+Math.imul(b,V)|0;var ve=(f+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,W)|0))<<13)|0;f=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,F),i=(i=Math.imul(w,H))+Math.imul(_,F)|0,o=Math.imul(_,H),n=n+Math.imul(y,K)|0,i=(i=i+Math.imul(y,V)|0)+Math.imul(v,K)|0,o=o+Math.imul(v,V)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(b,W)|0,o=o+Math.imul(b,X)|0;var ge=(f+(n=n+Math.imul(h,Z)|0)|0)+((8191&(i=(i=i+Math.imul(h,$)|0)+Math.imul(d,Z)|0))<<13)|0;f=((o=o+Math.imul(d,$)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(M,F),i=(i=Math.imul(M,H))+Math.imul(k,F)|0,o=Math.imul(k,H),n=n+Math.imul(w,K)|0,i=(i=i+Math.imul(w,V)|0)+Math.imul(_,K)|0,o=o+Math.imul(_,V)|0,n=n+Math.imul(y,W)|0,i=(i=i+Math.imul(y,X)|0)+Math.imul(v,W)|0,o=o+Math.imul(v,X)|0,n=n+Math.imul(p,Z)|0,i=(i=i+Math.imul(p,$)|0)+Math.imul(b,Z)|0,o=o+Math.imul(b,$)|0;var we=(f+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;f=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(E,F),i=(i=Math.imul(E,H))+Math.imul(A,F)|0,o=Math.imul(A,H),n=n+Math.imul(M,K)|0,i=(i=i+Math.imul(M,V)|0)+Math.imul(k,K)|0,o=o+Math.imul(k,V)|0,n=n+Math.imul(w,W)|0,i=(i=i+Math.imul(w,X)|0)+Math.imul(_,W)|0,o=o+Math.imul(_,X)|0,n=n+Math.imul(y,Z)|0,i=(i=i+Math.imul(y,$)|0)+Math.imul(v,Z)|0,o=o+Math.imul(v,$)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(b,Q)|0,o=o+Math.imul(b,ee)|0;var _e=(f+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(d,re)|0))<<13)|0;f=((o=o+Math.imul(d,ne)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(T,F),i=(i=Math.imul(T,H))+Math.imul(I,F)|0,o=Math.imul(I,H),n=n+Math.imul(E,K)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(A,K)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(k,W)|0,o=o+Math.imul(k,X)|0,n=n+Math.imul(w,Z)|0,i=(i=i+Math.imul(w,$)|0)+Math.imul(_,Z)|0,o=o+Math.imul(_,$)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(v,Q)|0,o=o+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(b,re)|0,o=o+Math.imul(b,ne)|0;var xe=(f+(n=n+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,se)|0)+Math.imul(d,oe)|0))<<13)|0;f=((o=o+Math.imul(d,se)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(C,F),i=(i=Math.imul(C,H))+Math.imul(P,F)|0,o=Math.imul(P,H),n=n+Math.imul(T,K)|0,i=(i=i+Math.imul(T,V)|0)+Math.imul(I,K)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(A,W)|0,o=o+Math.imul(A,X)|0,n=n+Math.imul(M,Z)|0,i=(i=i+Math.imul(M,$)|0)+Math.imul(k,Z)|0,o=o+Math.imul(k,$)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(_,Q)|0,o=o+Math.imul(_,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(v,re)|0,o=o+Math.imul(v,ne)|0,n=n+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,se)|0)+Math.imul(b,oe)|0,o=o+Math.imul(b,se)|0;var Me=(f+(n=n+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(d,ue)|0))<<13)|0;f=((o=o+Math.imul(d,fe)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(R,F),i=(i=Math.imul(R,H))+Math.imul(O,F)|0,o=Math.imul(O,H),n=n+Math.imul(C,K)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(P,K)|0,o=o+Math.imul(P,V)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(I,W)|0,o=o+Math.imul(I,X)|0,n=n+Math.imul(E,Z)|0,i=(i=i+Math.imul(E,$)|0)+Math.imul(A,Z)|0,o=o+Math.imul(A,$)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(k,Q)|0,o=o+Math.imul(k,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(_,re)|0,o=o+Math.imul(_,ne)|0,n=n+Math.imul(y,oe)|0,i=(i=i+Math.imul(y,se)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,se)|0,n=n+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(b,ue)|0,o=o+Math.imul(b,fe)|0;var ke=(f+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;f=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(q,F),i=(i=Math.imul(q,H))+Math.imul(U,F)|0,o=Math.imul(U,H),n=n+Math.imul(R,K)|0,i=(i=i+Math.imul(R,V)|0)+Math.imul(O,K)|0,o=o+Math.imul(O,V)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(P,W)|0,o=o+Math.imul(P,X)|0,n=n+Math.imul(T,Z)|0,i=(i=i+Math.imul(T,$)|0)+Math.imul(I,Z)|0,o=o+Math.imul(I,$)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(A,Q)|0,o=o+Math.imul(A,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(k,re)|0,o=o+Math.imul(k,ne)|0,n=n+Math.imul(w,oe)|0,i=(i=i+Math.imul(w,se)|0)+Math.imul(_,oe)|0,o=o+Math.imul(_,se)|0,n=n+Math.imul(y,ue)|0,i=(i=i+Math.imul(y,fe)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,fe)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(b,he)|0,o=o+Math.imul(b,de)|0;var Se=(f+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,be)|0)+Math.imul(d,pe)|0))<<13)|0;f=((o=o+Math.imul(d,be)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(q,K),i=(i=Math.imul(q,V))+Math.imul(U,K)|0,o=Math.imul(U,V),n=n+Math.imul(R,W)|0,i=(i=i+Math.imul(R,X)|0)+Math.imul(O,W)|0,o=o+Math.imul(O,X)|0,n=n+Math.imul(C,Z)|0,i=(i=i+Math.imul(C,$)|0)+Math.imul(P,Z)|0,o=o+Math.imul(P,$)|0,n=n+Math.imul(T,Q)|0,i=(i=i+Math.imul(T,ee)|0)+Math.imul(I,Q)|0,o=o+Math.imul(I,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(A,re)|0,o=o+Math.imul(A,ne)|0,n=n+Math.imul(M,oe)|0,i=(i=i+Math.imul(M,se)|0)+Math.imul(k,oe)|0,o=o+Math.imul(k,se)|0,n=n+Math.imul(w,ue)|0,i=(i=i+Math.imul(w,fe)|0)+Math.imul(_,ue)|0,o=o+Math.imul(_,fe)|0,n=n+Math.imul(y,he)|0,i=(i=i+Math.imul(y,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(f+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;f=((o=o+Math.imul(b,be)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(q,W),i=(i=Math.imul(q,X))+Math.imul(U,W)|0,o=Math.imul(U,X),n=n+Math.imul(R,Z)|0,i=(i=i+Math.imul(R,$)|0)+Math.imul(O,Z)|0,o=o+Math.imul(O,$)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(P,Q)|0,o=o+Math.imul(P,ee)|0,n=n+Math.imul(T,re)|0,i=(i=i+Math.imul(T,ne)|0)+Math.imul(I,re)|0,o=o+Math.imul(I,ne)|0,n=n+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,se)|0)+Math.imul(A,oe)|0,o=o+Math.imul(A,se)|0,n=n+Math.imul(M,ue)|0,i=(i=i+Math.imul(M,fe)|0)+Math.imul(k,ue)|0,o=o+Math.imul(k,fe)|0,n=n+Math.imul(w,he)|0,i=(i=i+Math.imul(w,de)|0)+Math.imul(_,he)|0,o=o+Math.imul(_,de)|0;var Ae=(f+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,be)|0)+Math.imul(v,pe)|0))<<13)|0;f=((o=o+Math.imul(v,be)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(q,Z),i=(i=Math.imul(q,$))+Math.imul(U,Z)|0,o=Math.imul(U,$),n=n+Math.imul(R,Q)|0,i=(i=i+Math.imul(R,ee)|0)+Math.imul(O,Q)|0,o=o+Math.imul(O,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(P,re)|0,o=o+Math.imul(P,ne)|0,n=n+Math.imul(T,oe)|0,i=(i=i+Math.imul(T,se)|0)+Math.imul(I,oe)|0,o=o+Math.imul(I,se)|0,n=n+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(A,ue)|0,o=o+Math.imul(A,fe)|0,n=n+Math.imul(M,he)|0,i=(i=i+Math.imul(M,de)|0)+Math.imul(k,he)|0,o=o+Math.imul(k,de)|0;var je=(f+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,be)|0)+Math.imul(_,pe)|0))<<13)|0;f=((o=o+Math.imul(_,be)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,n=Math.imul(q,Q),i=(i=Math.imul(q,ee))+Math.imul(U,Q)|0,o=Math.imul(U,ee),n=n+Math.imul(R,re)|0,i=(i=i+Math.imul(R,ne)|0)+Math.imul(O,re)|0,o=o+Math.imul(O,ne)|0,n=n+Math.imul(C,oe)|0,i=(i=i+Math.imul(C,se)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,se)|0,n=n+Math.imul(T,ue)|0,i=(i=i+Math.imul(T,fe)|0)+Math.imul(I,ue)|0,o=o+Math.imul(I,fe)|0,n=n+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(A,he)|0,o=o+Math.imul(A,de)|0;var Te=(f+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,be)|0)+Math.imul(k,pe)|0))<<13)|0;f=((o=o+Math.imul(k,be)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(q,re),i=(i=Math.imul(q,ne))+Math.imul(U,re)|0,o=Math.imul(U,ne),n=n+Math.imul(R,oe)|0,i=(i=i+Math.imul(R,se)|0)+Math.imul(O,oe)|0,o=o+Math.imul(O,se)|0,n=n+Math.imul(C,ue)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,fe)|0,n=n+Math.imul(T,he)|0,i=(i=i+Math.imul(T,de)|0)+Math.imul(I,he)|0,o=o+Math.imul(I,de)|0;var Ie=(f+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,be)|0)+Math.imul(A,pe)|0))<<13)|0;f=((o=o+Math.imul(A,be)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(q,oe),i=(i=Math.imul(q,se))+Math.imul(U,oe)|0,o=Math.imul(U,se),n=n+Math.imul(R,ue)|0,i=(i=i+Math.imul(R,fe)|0)+Math.imul(O,ue)|0,o=o+Math.imul(O,fe)|0,n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var Be=(f+(n=n+Math.imul(T,pe)|0)|0)+((8191&(i=(i=i+Math.imul(T,be)|0)+Math.imul(I,pe)|0))<<13)|0;f=((o=o+Math.imul(I,be)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(q,ue),i=(i=Math.imul(q,fe))+Math.imul(U,ue)|0,o=Math.imul(U,fe),n=n+Math.imul(R,he)|0,i=(i=i+Math.imul(R,de)|0)+Math.imul(O,he)|0,o=o+Math.imul(O,de)|0;var Ce=(f+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,be)|0)+Math.imul(P,pe)|0))<<13)|0;f=((o=o+Math.imul(P,be)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(q,he),i=(i=Math.imul(q,de))+Math.imul(U,he)|0,o=Math.imul(U,de);var Pe=(f+(n=n+Math.imul(R,pe)|0)|0)+((8191&(i=(i=i+Math.imul(R,be)|0)+Math.imul(O,pe)|0))<<13)|0;f=((o=o+Math.imul(O,be)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863;var Ne=(f+(n=Math.imul(q,pe))|0)+((8191&(i=(i=Math.imul(q,be))+Math.imul(U,pe)|0))<<13)|0;return f=((o=Math.imul(U,be))+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,u[0]=me,u[1]=ye,u[2]=ve,u[3]=ge,u[4]=we,u[5]=_e,u[6]=xe,u[7]=Me,u[8]=ke,u[9]=Se,u[10]=Ee,u[11]=Ae,u[12]=je,u[13]=Te,u[14]=Ie,u[15]=Be,u[16]=Ce,u[17]=Pe,u[18]=Ne,0!==f&&(u[19]=f,r.length++),r};function a(e,t,r){return(new u).mulp(e,t,r)}function u(e,t){this.x=e,this.y=t}Math.imul||(o=i),y.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?o(this,e,t):r<63?i(this,e,t):r<1024?function(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,o=0;o>>26)|0)>>>26,s&=67108863}r.words[o]=a,n=s,s=i}return 0!==n?r.words[o]=n:r.length--,r.strip()}(this,e,t):a(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),r=y.prototype._countBits(e)-1,n=0;n>=1;return n},u.prototype.permute=function(e,t,r,n,i,o){for(var s=0;s>>=1)i++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,t+=n/67108864|0,t+=i>>>26,this.words[r]=67108863&i}return 0!==t&&(this.words[r]=t,this.length++),this},y.prototype.muln=function(e){return this.clone().imuln(e)},y.prototype.sqr=function(){return this.mul(this)},y.prototype.isqr=function(){return this.imul(this.clone())},y.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i}return t}(e);if(0===t.length)return new y(1);for(var r=this,n=0;n>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;0<=t;t--)this.words[t+n]=this.words[t];for(t=0;t>>i<o)for(this.length-=o,u=0;u>>i,f=c&s}return a&&0!==f&&(a.words[a.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},y.prototype.ishrn=function(e,t,r){return m(0===this.negative),this.iushrn(e,t,r)},y.prototype.shln=function(e){return this.clone().ishln(e)},y.prototype.ushln=function(e){return this.clone().iushln(e)},y.prototype.shrn=function(e){return this.clone().ishrn(e)},y.prototype.ushrn=function(e){return this.clone().iushrn(e)},y.prototype.testn=function(e){m("number"==typeof e&&0<=e);var t=e%26,r=(e-t)/26,n=1<>>t<>26)-(a/67108864|0),this.words[n+r]=67108863&i}for(;n>26,this.words[n+r]=67108863&i;if(0===s)return this.strip();for(m(-1===s),n=s=0;n>26,this.words[n]=67108863&i;return this.negative=1,this.strip()},y.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var s,a=n.length-i.length;if("mod"!==t){(s=new y(null)).length=a+1,s.words=new Array(s.length);for(var u=0;uthis.length||this.cmp(e)<0?{div:new y(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new y(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new y(this.modn(e.words[0]))}:this._wordDiv(e,t);var n,i,o},y.prototype.div=function(e){return this.divmod(e,"div",!1).div},y.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},y.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},y.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),o=r.cmp(n);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},y.prototype.modn=function(e){m(e<=67108863);for(var t=(1<<26)%e,r=0,n=this.length-1;0<=n;n--)r=(t*r+(0|this.words[n]))%e;return r},y.prototype.idivn=function(e){m(e<=67108863);for(var t=0,r=this.length-1;0<=r;r--){var n=(0|this.words[r])+67108864*t;this.words[r]=n/e|0,t=n%e}return this.strip()},y.prototype.divn=function(e){return this.clone().idivn(e)},y.prototype.egcd=function(e){m(0===e.negative),m(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new y(1),i=new y(0),o=new y(0),s=new y(1),a=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++a;for(var u=r.clone(),f=t.clone();!t.isZero();){for(var c=0,h=1;0==(t.words[0]&h)&&c<26;++c,h<<=1);if(0>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},y.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},y.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this.strip(),1e.length)return 1;if(this.lengththis.n;);var n=t>>22,i=o}i>>>=22,0===(e.words[n-10]=i)&&10>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},y._prime=function(e){if(f[e])return f[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new v;else if("p192"===e)t=new g;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new w}return f[e]=t},_.prototype._verify1=function(e){m(0===e.negative,"red works only with positives"),m(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){m(0==(e.negative|t.negative),"red works only with positives"),m(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return 0<=r.cmp(this.m)&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(m(t%2==1),3===t){var r=this.m.add(new y(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),i=0;!n.isZero()&&0===n.andln(1);)i++,n.iushrn(1);m(!n.isZero());var o=new y(1).toRed(this),s=o.redNeg(),a=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new y(2*u*u).toRed(this);0!==this.pow(u,a).cmp(s);)u.redIAdd(s);for(var f=this.pow(u,n),c=this.pow(e,n.addn(1).iushrn(1)),h=this.pow(e,n),d=i;0!==h.cmp(o);){for(var l=h,p=0;0!==l.cmp(o);p++)l=l.redSqr();m(p>f&1;i!==r[0]&&(i=this.sqr(i)),0!==c||0!==o?(o<<=1,o|=c,(4===++s||0===n&&0===f)&&(i=this.mul(i,r[o]),o=s=0)):s=0}a=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},y.mont=function(e){return new x(e)},r(x,_),x.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},x.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},x.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new y(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return 0<=i.cmp(this.m)?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},x.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],231:[function(e,t,r){t.exports=function(e){if("string"!=typeof e)throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+(void 0===e?"undefined":_typeof(e))+", while checking isHexPrefixed.");return"0x"===e.slice(0,2)}},{}],232:[function(e,_,t){(function(g,w){!function(){var e="object"===("undefined"==typeof window?"undefined":_typeof(window))?window:{};!e.JS_SHA3_NO_NODE_JS&&"object"===(void 0===g?"undefined":_typeof(g))&&g.versions&&g.versions.node&&(e=w);for(var t=!e.JS_SHA3_NO_COMMON_JS&&"object"===(void 0===_?"undefined":_typeof(_))&&_.exports,u="0123456789abcdef".split(""),c=[0,8,16,24],ce=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],r=[224,256,384,512],o=["hex","buffer","arrayBuffer","array"],s=function(t,r,n){return function(e){return new y(t,r,t).update(e)[n]()}},a=function(r,n,i){return function(e,t){return new y(r,n,t).update(e)[i]()}},n=function(e,t){var r=s(e,t,"hex");r.create=function(){return new y(e,t,e)},r.update=function(e){return r.create().update(e)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}y.prototype.update=function(e){var t="string"!=typeof e;t&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e));for(var r,n,i=e.length,o=this.blocks,s=this.byteCount,a=this.blockCount,u=0,f=this.s;u>2]|=e[u]<>2]|=n<>2]|=(192|n>>6)<>2]|=(224|n>>12)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];s%t==0&&(v(r),o=0)}return i&&(e=r[o],0>4&15]+u[15&e]),1>12&15]+u[e>>8&15]),2>20&15]+u[e>>16&15])),a},y.prototype.buffer=y.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,o=0,s=0,a=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(a);for(var u=new Uint32Array(e);s>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;a%r==0&&v(n)}return o&&(e=a<<2,t=n[s],0>8&255),2>16&255)),u};var v=function(e){var t,r,n,i,o,s,a,u,f,c,h,d,l,p,b,m,y,v,g,w,_,x,M,k,S,E,A,j,T,I,B,C,P,N,R,O,L,q,U,D,F,H,z,K,V,G,W,X,J,Z,$,Y,Q,ee,te,re,ne,ie,oe,se,ae,ue,fe;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],a=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],f=e[5]^e[15]^e[25]^e[35]^e[45],c=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|a>>>31),r=(l=e[9]^e[19]^e[29]^e[39]^e[49])^(a<<1|s>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(u<<1|f>>>31),r=o^(f<<1|u>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=s^(c<<1|h>>>31),r=a^(h<<1|c>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=u^(d<<1|l>>>31),r=f^(l<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=c^(i<<1|o>>>31),r=h^(o<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,p=e[0],b=e[1],G=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,j=e[20]<<3|e[21]>>>29,T=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ae=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,z=e[41]<<18|e[40]>>>14,N=e[2]<<1|e[3]>>>31,R=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,X=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,I=e[33]<<13|e[32]>>>19,B=e[32]<<13|e[33]>>>19,ue=e[42]<<2|e[43]>>>30,fe=e[43]<<2|e[42]>>>30,ee=e[5]<<30|e[4]>>>2,te=e[4]<<30|e[5]>>>2,O=e[14]<<6|e[15]>>>26,L=e[15]<<6|e[14]>>>26,v=e[25]<<11|e[24]>>>21,g=e[24]<<11|e[25]>>>21,Z=e[34]<<15|e[35]>>>17,$=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,k=e[6]<<28|e[7]>>>4,S=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ne=e[16]<<23|e[17]>>>9,q=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,w=e[36]<<21|e[37]>>>11,_=e[37]<<21|e[36]>>>11,Y=e[47]<<24|e[46]>>>8,Q=e[46]<<24|e[47]>>>8,K=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,E=e[18]<<20|e[19]>>>12,A=e[19]<<20|e[18]>>>12,ie=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,D=e[38]<<8|e[39]>>>24,F=e[39]<<8|e[38]>>>24,x=e[48]<<14|e[49]>>>18,M=e[49]<<14|e[48]>>>18,e[0]=p^~m&v,e[1]=b^~y&g,e[10]=k^~E&j,e[11]=S^~A&T,e[20]=N^~O&q,e[21]=R^~L&U,e[30]=K^~G&X,e[31]=V^~W&J,e[40]=ee^~re&ie,e[41]=te^~ne&oe,e[2]=m^~v&w,e[3]=y^~g&_,e[12]=E^~j&I,e[13]=A^~T&B,e[22]=O^~q&D,e[23]=L^~U&F,e[32]=G^~X&Z,e[33]=W^~J&$,e[42]=re^~ie&se,e[43]=ne^~oe&ae,e[4]=v^~w&x,e[5]=g^~_&M,e[14]=j^~I&C,e[15]=T^~B&P,e[24]=q^~D&H,e[25]=U^~F&z,e[34]=X^~Z&Y,e[35]=J^~$&Q,e[44]=ie^~se&ue,e[45]=oe^~ae&fe,e[6]=w^~x&p,e[7]=_^~M&b,e[16]=I^~C&k,e[17]=B^~P&S,e[26]=D^~H&N,e[27]=F^~z&R,e[36]=Z^~Y&K,e[37]=$^~Q&V,e[46]=se^~ue&ee,e[47]=ae^~fe&te,e[8]=x^~p&m,e[9]=M^~b&y,e[18]=C^~k&E,e[19]=P^~S&A,e[28]=H^~N&O,e[29]=z^~R&L,e[38]=Y^~K&G,e[39]=Q^~V&W,e[48]=ue^~ee&re,e[49]=fe^~te&ne,e[0]^=ce[n],e[1]^=ce[n+1]};if(t)_.exports=f;else for(d=0;d>t&63|128)}function h(e){if(0==(4294967168&e))return a(e);var t="";return 0==(4294965248&e)?t=a(e>>6&31|192):0==(4294901760&e)?(f(e),t=a(e>>12&15|224),t+=c(e,6)):0==(4292870144&e)&&(t=a(e>>18&7|240),t+=c(e,12),t+=c(e,6)),t+=a(63&e|128)}function d(){if(o<=s)throw Error("Invalid byte index");var e=255&i[s];if(s++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(){var e,t;if(o>>10&1023|55296),t=56320|1023&t),i+=a(t);return i}(r)}};if("function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define(function(){return p});else if(t&&!t.nodeType)if(r)r.exports=p;else{var b={}.hasOwnProperty;for(var m in p)b.call(p,m)&&(t[m]=p[m])}else e.utf8=p}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],241:[function(e,t,r){arguments[4][230][0].apply(r,arguments)},{dup:230}],242:[function(e,t,r){var i=e("underscore"),n=e("ethjs-unit"),o=e("./utils.js"),s=e("./soliditySha3.js"),a=e("randomhex"),u=function(e){if(!o.isHexStrict(e))throw new Error("The parameter must be a valid HEX string.");var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);rn)throw new Error("Supplied uint exceeds width: "+n+" vs "+i.bitLength());if(i.lt(new a(0)))throw new Error("Supplied uint "+i.toString()+" is negative");return n?u.leftPad(i.toString("hex"),n/8*2):i}if(e.startsWith("int")){if(n%8||n<8||256n)throw new Error("Supplied int exceeds width: "+n+" vs "+i.bitLength());return i.lt(new a(0))?i.toTwos(n).toString("hex"):n?u.leftPad(i.toString("hex"),n/8*2):i}throw new Error("Unsupported or invalid type: "+e)},n=function(e){if(o.isArray(e))throw new Error("Autodetection of array types is not supported.");var t,r,n,i="";if(o.isObject(e)&&(e.hasOwnProperty("v")||e.hasOwnProperty("t")||e.hasOwnProperty("value")||e.hasOwnProperty("type"))?(t=e.hasOwnProperty("t")?e.t:e.type,i=e.hasOwnProperty("v")?e.v:e.value):(t=u.toHex(e,!0),i=u.toHex(e),t.startsWith("int")||t.startsWith("uint")||(t="bytes")),!t.startsWith("int")&&!t.startsWith("uint")||"string"!=typeof i||/^(-)?0x/i.test(i)||(i=new a(i)),o.isArray(i)){if(n=/^\D+\d*\[(\d+)\]$/.exec(t),(r=n?parseInt(n[1],10):null)&&i.length!==r)throw new Error(t+" is not matching the given array "+JSON.stringify(i));r=i.length}return o.isArray(i)?i.map(function(e){return s(t,e,r).toString("hex").replace("0x","")}).join(""):s(t,i,r).toString("hex").replace("0x","")};t.exports=function(){var e=Array.prototype.slice.call(arguments),t=o.map(e,n);return u.sha3("0x"+t.join(""))}},{"./utils.js":244,"bn.js":241,underscore:239}],244:[function(e,t,r){var n=e("underscore"),i=e("bn.js"),o=e("number-to-bn"),s=e("utf8"),a=e("eth-lib/lib/hash"),u=function(e){return e instanceof i||e&&e.constructor&&"BN"===e.constructor.name},f=function(e){return e&&e.constructor&&"BigNumber"===e.constructor.name},c=function(t){try{return o.apply(null,arguments)}catch(e){throw new Error(e+' Given value: "'+t+'"')}},h=function(e){return!!/^(0x)?[0-9a-f]{40}$/i.test(e)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(e)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(e))||d(e))},d=function(e){e=e.replace(/^0x/i,"");for(var t=y(e.toLowerCase()).replace(/^0x/i,""),r=0;r<40;r++)if(7>>4).toString(16)),t.push((15&e[r]).toString(16));return"0x"+t.join("")},isHex:function(e){return(n.isString(e)||n.isNumber(e))&&/^(-0x|0x)?[0-9a-f]*$/i.test(e)},isHexStrict:m,leftPad:function(e,t,r){var n=/^0x/i.test(e)||"number"==typeof e,i=0<=t-(e=e.toString(16).replace(/^0x/i,"")).length+1?t-e.length+1:0;return(n?"0x":"")+new Array(i).join(r||"0")+e},rightPad:function(e,t,r){var n=/^0x/i.test(e)||"number"==typeof e,i=0<=t-(e=e.toString(16).replace(/^0x/i,"")).length+1?t-e.length+1:0;return(n?"0x":"")+e+new Array(i).join(r||"0")},toTwosComplement:function(e){return"0x"+c(e).toTwos(256).toString(16,64)},sha3:y}},{"bn.js":241,"eth-lib/lib/hash":219,"number-to-bn":234,underscore:239,utf8:240}],245:[function(e,t,r){var c=e("underscore"),n=e("web3-utils"),o=new(e("ethers/utils/abi-coder"))(function(e,t){return!e.match(/^u?int/)||c.isArray(t)||c.isObject(t)&&"BN"===t.constructor.name?t:t.toString()});function h(){}var i=function(){};i.prototype.encodeFunctionSignature=function(e){return c.isObject(e)&&(e=n._jsonInterfaceMethodToString(e)),n.sha3(e).slice(0,10)},i.prototype.encodeEventSignature=function(e){return c.isObject(e)&&(e=n._jsonInterfaceMethodToString(e)),n.sha3(e)},i.prototype.encodeParameter=function(e,t){return this.encodeParameters([e],[t])},i.prototype.encodeParameters=function(e,t){return o.encode(e,t)},i.prototype.encodeFunctionCall=function(e,t){return this.encodeFunctionSignature(e)+this.encodeParameters(e.inputs,t).replace("0x","")},i.prototype.decodeParameter=function(e,t){if(!c.isString(e))throw new Error("Given parameter type is not a string: "+e);return this.decodeParameters([{type:e}],t)[0]},i.prototype.decodeParameters=function(e,t){var r=e;if(console.log("BYTES_STRING","0x"+t.replace(/0x/i,"")),!t||"0x"===t||"0X"===t)throw new Error("Returned values aren't valid, did it run Out of Gas?");console.log("TYPES",r);var n=o.decode(r,"0x"+t.replace(/0x/i,""));console.log("ethersAbiCoderResult: ",n);var i=new h;return i.__length__=0,e.forEach(function(e,t){var r=n[i.__length__];r="0x"===r?null:r,i[t]=r,c.isObject(e)&&e.name&&(i[e.name]=r),i.__length__++}),console.log("FUNCTION_RESULT_MAPPED_TO_RESULT_OBJECT: ",i),i},i.prototype.decodeLog=function(e,t,r){var n=this;r=c.isArray(r)?r:[r],t=t||"";var i=[],o=[],s=0;e.forEach(function(t,e){t.indexed?(o[e]=["bool","int","uint","address","fixed","ufixed"].find(function(e){return-1!==t.type.indexOf(e)})?n.decodeParameter(t.type,r[s]):r[s],s++):i[e]=t});var a=t,u=a?this.decodeParameters(i,a):[],f=new h;return f.__length__=0,e.forEach(function(e,t){f[t]="string"===e.type?"":null,void 0!==u[t]&&(f[t]=u[t]),void 0!==o[t]&&(f[t]=o[t]),e.name&&(f[e.name]=f[t]),f.__length__++}),f};var s=new i;t.exports=s},{"ethers/utils/abi-coder":220,underscore:239,"web3-utils":242}],246:[function(e,t,r){arguments[4][202][0].apply(r,arguments)},{"./register":248,dup:202}],247:[function(e,t,r){arguments[4][203][0].apply(r,arguments)},{dup:203}],248:[function(e,t,r){arguments[4][204][0].apply(r,arguments)},{"./loader":247,dup:204}],249:[function(e,t,r){arguments[4][1][0].apply(r,arguments)},{"./asn1/api":250,"./asn1/base":252,"./asn1/constants":256,"./asn1/decoders":258,"./asn1/encoders":261,"bn.js":263,dup:1}],250:[function(e,t,r){arguments[4][2][0].apply(r,arguments)},{"../asn1":249,dup:2,inherits:348,vm:169}],251:[function(e,t,r){arguments[4][3][0].apply(r,arguments)},{"../base":252,buffer:47,dup:3,inherits:348}],252:[function(e,t,r){arguments[4][4][0].apply(r,arguments)},{"./buffer":251,"./node":253,"./reporter":254,dup:4}],253:[function(e,t,r){arguments[4][5][0].apply(r,arguments)},{"../base":252,dup:5,"minimalistic-assert":352}],254:[function(e,t,r){arguments[4][6][0].apply(r,arguments)},{dup:6,inherits:348}],255:[function(e,t,r){arguments[4][7][0].apply(r,arguments)},{"../constants":256,dup:7}],256:[function(e,t,r){arguments[4][8][0].apply(r,arguments)},{"./der":255,dup:8}],257:[function(e,t,r){arguments[4][9][0].apply(r,arguments)},{"../../asn1":249,dup:9,inherits:348}],258:[function(e,t,r){arguments[4][10][0].apply(r,arguments)},{"./der":257,"./pem":259,dup:10}],259:[function(e,t,r){arguments[4][11][0].apply(r,arguments)},{"./der":257,buffer:47,dup:11,inherits:348}],260:[function(e,t,r){arguments[4][12][0].apply(r,arguments)},{"../../asn1":249,buffer:47,dup:12,inherits:348}],261:[function(e,t,r){arguments[4][13][0].apply(r,arguments)},{"./der":260,"./pem":262,dup:13}],262:[function(e,t,r){arguments[4][14][0].apply(r,arguments)},{"./der":260,dup:14,inherits:348}],263:[function(e,t,r){arguments[4][218][0].apply(r,arguments)},{buffer:17,dup:218}],264:[function(e,t,r){arguments[4][16][0].apply(r,arguments)},{crypto:17,dup:16}],265:[function(e,t,r){arguments[4][18][0].apply(r,arguments)},{dup:18,"safe-buffer":373}],266:[function(e,t,r){arguments[4][19][0].apply(r,arguments)},{"./aes":265,"./ghash":270,"./incr32":271,"buffer-xor":292,"cipher-base":293,dup:19,inherits:348,"safe-buffer":373}],267:[function(e,t,r){arguments[4][20][0].apply(r,arguments)},{"./decrypter":268,"./encrypter":269,"./modes/list.json":279,dup:20}],268:[function(e,t,r){var i=e("./authCipher"),o=e("safe-buffer").Buffer,s=e("./modes"),a=e("./streamCipher"),n=e("cipher-base"),u=e("./aes"),f=e("evp_bytestokey");function c(e,t,r){n.call(this),this._cache=new h,this._last=void 0,this._cipher=new u.AES(t),this._prev=o.from(r),this._mode=e,this._autopadding=!0}function h(){this.cache=o.allocUnsafe(0)}function d(e,t,r){var n=s[e.toLowerCase()];if(!n)throw new TypeError("invalid suite type");if("string"==typeof r&&(r=o.from(r)),"GCM"!==n.mode&&r.length!==n.iv)throw new TypeError("invalid iv length "+r.length);if("string"==typeof t&&(t=o.from(t)),t.length!==n.key/8)throw new TypeError("invalid key length "+t.length);return"stream"===n.type?new a(n.module,t,r,!0):"auth"===n.type?new i(n.module,t,r,!0):new c(n.module,t,r)}e("inherits")(c,n),c.prototype._update=function(e){var t,r;this._cache.add(e);for(var n=[];t=this._cache.get(this._autopadding);)r=this._mode.decrypt(this,t),n.push(r);return o.concat(n)},c.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return function(e){var t=e[15],r=-1;for(;++r=t)throw new Error("invalid sig")}t.exports=function(e,t,r,n,i){var o=b(r);if("ec"===o.type){if("ecdsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=m[r.data.algorithm.curve.join(".")];if(!n)throw new Error("unknown curve "+r.data.algorithm.curve.join("."));var i=new p(n),o=r.data.subjectPrivateKey.data;return i.verify(t,e,o)}(e,t,o)}if("dsa"===o.type){if("dsa"!==n)throw new Error("wrong public key type");return function(e,t,r){var n=r.data.p,i=r.data.q,o=r.data.g,s=r.data.pub_key,a=b.signature.decode(e,"der"),u=a.s,f=a.r;y(u,i),y(f,i);var c=l.mont(n),h=u.invm(i);return 0===o.toRed(c).redPow(new l(t).mul(h).mod(i)).fromRed().mul(s.toRed(c).redPow(f.mul(h).mod(i)).fromRed()).mod(n).mod(i).cmp(f)}(e,t,o)}if("rsa"!==n&&"ecdsa/rsa"!==n)throw new Error("wrong public key type");t=d.concat([i,t]);for(var s=o.modulus.byteLength(),a=[1],u=0;t.length+a.length+2>>2),n=0,i=0;n>5]|=128<>>9<<4)]=t;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s>>32-a,r);var s,a}function h(e,t,r,n,i,o,s){return a(t&r|~t&n,e,t,i,o,s)}function d(e,t,r,n,i,o,s){return a(t&n|r&~n,e,t,i,o,s)}function l(e,t,r,n,i,o,s){return a(t^r^n,e,t,i,o,s)}function p(e,t,r,n,i,o,s){return a(r^(t|~n),e,t,i,o,s)}function b(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}t.exports=function(e){return n(e,i)}},{"./make-hash":296}],298:[function(e,t,r){arguments[4][54][0].apply(r,arguments)},{"./legacy":299,"cipher-base":293,"create-hash/md5":297,dup:54,inherits:348,ripemd160:372,"safe-buffer":373,"sha.js":377}],299:[function(e,t,r){arguments[4][55][0].apply(r,arguments)},{"cipher-base":293,dup:55,inherits:348,"safe-buffer":373}],300:[function(e,t,r){arguments[4][56][0].apply(r,arguments)},{"browserify-cipher":282,"browserify-sign":289,"browserify-sign/algos":286,"create-ecdh":294,"create-hash":295,"create-hmac":298,"diffie-hellman":307,dup:56,pbkdf2:359,"public-encrypt":364,randombytes:370,randomfill:371}],301:[function(e,t,r){arguments[4][57][0].apply(r,arguments)},{"./des/cbc":302,"./des/cipher":303,"./des/des":304,"./des/ede":305,"./des/utils":306,dup:57}],302:[function(e,t,r){arguments[4][58][0].apply(r,arguments)},{dup:58,inherits:348,"minimalistic-assert":352}],303:[function(e,t,r){arguments[4][59][0].apply(r,arguments)},{dup:59,"minimalistic-assert":352}],304:[function(e,t,r){arguments[4][60][0].apply(r,arguments)},{"../des":301,dup:60,inherits:348,"minimalistic-assert":352}],305:[function(e,t,r){arguments[4][61][0].apply(r,arguments)},{"../des":301,dup:61,inherits:348,"minimalistic-assert":352}],306:[function(e,t,r){arguments[4][62][0].apply(r,arguments)},{dup:62}],307:[function(e,t,r){(function(o){var s=e("./lib/generatePrime"),n=e("./lib/primes.json"),a=e("./lib/dh");var u={binary:!0,hex:!0,base64:!0};r.DiffieHellmanGroup=r.createDiffieHellmanGroup=r.getDiffieHellman=function(e){var t=new o(n[e].prime,"hex"),r=new o(n[e].gen,"hex");return new a(t,r)},r.createDiffieHellman=r.DiffieHellman=function e(t,r,n,i){return o.isBuffer(r)||void 0===u[r]?e(t,"binary",r,n):(r=r||"binary",i=i||"binary",n=n||new o([2]),o.isBuffer(n)||(n=new o(n,i)),"number"==typeof t?new a(s(t,n),n,!0):(o.isBuffer(t)||(t=new o(t,r)),new a(t,n,!0)))}}).call(this,e("buffer").Buffer)},{"./lib/dh":308,"./lib/generatePrime":309,"./lib/primes.json":310,buffer:47}],308:[function(b,m,e){(function(o){var s=b("bn.js"),a=new(b("miller-rabin")),u=new s(24),f=new s(11),c=new s(10),h=new s(3),d=new s(7),l=b("./generatePrime"),e=b("randombytes");function n(e,t){return t=t||"utf8",o.isBuffer(e)||(e=new o(e,t)),this._pub=new s(e),this}function i(e,t){return t=t||"utf8",o.isBuffer(e)||(e=new o(e,t)),this._priv=new s(e),this}m.exports=t;var p={};function t(e,t,r){this.setGenerator(t),this.__prime=new s(e),this._prime=s.mont(this.__prime),this._primeLen=e.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,r?(this.setPublicKey=n,this.setPrivateKey=i):this._primeCode=8}function r(e,t){var r=new o(e.toArray());return t?r.toString(t):r}Object.defineProperty(t.prototype,"verifyError",{enumerable:!0,get:function(){return"number"!=typeof this._primeCode&&(this._primeCode=function(e,t){var r=t.toString("hex"),n=[r,e.toString(16)].join("_");if(n in p)return p[n];var i,o=0;if(e.isEven()||!l.simpleSieve||!l.fermatTest(e)||!a.test(e))return o+=1,o+="02"===r||"05"===r?8:4,p[n]=o;switch(a.test(e.shrn(1))||(o+=2),r){case"02":e.mod(u).cmp(f)&&(o+=8);break;case"05":(i=e.mod(c)).cmp(h)&&i.cmp(d)&&(o+=8);break;default:o+=4}return p[n]=o}(this.__prime,this.__gen)),this._primeCode}}),t.prototype.generateKeys=function(){return this._priv||(this._priv=new s(e(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},t.prototype.computeSecret=function(e){var t=(e=(e=new s(e)).toRed(this._prime)).redPow(this._priv).fromRed(),r=new o(t.toArray()),n=this.getPrime();if(r.length=t.length)throw"";var e=t.slice(r,r+2);return e<"80"?(r+=2,"0x"+e):e<"c0"?o():s()},i=function(){var e=parseInt(t.slice(r,r+=2),16)%64;return e<56?e:parseInt(t.slice(r,r+=2*(e-55)),16)},o=function(){var e=i();return"0x"+t.slice(r,r+=2*e)},s=function(){for(var e=2*i()+r,t=[];r=this._blockSize;){for(var i=this._blockOffset;i>>32-t}function u(e,t,r,n,i,o,s){return a(e+(t&r|~t&n)+i+o|0,s)+t|0}function f(e,t,r,n,i,o,s){return a(e+(t&n|r&~n)+i+o|0,s)+t|0}function c(e,t,r,n,i,o,s){return a(e+(t^r^n)+i+o|0,s)+t|0}function h(e,t,r,n,i,o,s){return a(e+(r^(t|~n))+i+o|0,s)+t|0}e(n,r),n.prototype._update=function(){for(var e=s,t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d;n=h(n=h(n=h(n=h(n=c(n=c(n=c(n=c(n=f(n=f(n=f(n=f(n=u(n=u(n=u(n=u(n,i=u(i,o=u(o,r=u(r,n,i,o,e[0],3614090360,7),n,i,e[1],3905402710,12),r,n,e[2],606105819,17),o,r,e[3],3250441966,22),i=u(i,o=u(o,r=u(r,n,i,o,e[4],4118548399,7),n,i,e[5],1200080426,12),r,n,e[6],2821735955,17),o,r,e[7],4249261313,22),i=u(i,o=u(o,r=u(r,n,i,o,e[8],1770035416,7),n,i,e[9],2336552879,12),r,n,e[10],4294925233,17),o,r,e[11],2304563134,22),i=u(i,o=u(o,r=u(r,n,i,o,e[12],1804603682,7),n,i,e[13],4254626195,12),r,n,e[14],2792965006,17),o,r,e[15],1236535329,22),i=f(i,o=f(o,r=f(r,n,i,o,e[1],4129170786,5),n,i,e[6],3225465664,9),r,n,e[11],643717713,14),o,r,e[0],3921069994,20),i=f(i,o=f(o,r=f(r,n,i,o,e[5],3593408605,5),n,i,e[10],38016083,9),r,n,e[15],3634488961,14),o,r,e[4],3889429448,20),i=f(i,o=f(o,r=f(r,n,i,o,e[9],568446438,5),n,i,e[14],3275163606,9),r,n,e[3],4107603335,14),o,r,e[8],1163531501,20),i=f(i,o=f(o,r=f(r,n,i,o,e[13],2850285829,5),n,i,e[2],4243563512,9),r,n,e[7],1735328473,14),o,r,e[12],2368359562,20),i=c(i,o=c(o,r=c(r,n,i,o,e[5],4294588738,4),n,i,e[8],2272392833,11),r,n,e[11],1839030562,16),o,r,e[14],4259657740,23),i=c(i,o=c(o,r=c(r,n,i,o,e[1],2763975236,4),n,i,e[4],1272893353,11),r,n,e[7],4139469664,16),o,r,e[10],3200236656,23),i=c(i,o=c(o,r=c(r,n,i,o,e[13],681279174,4),n,i,e[0],3936430074,11),r,n,e[3],3572445317,16),o,r,e[6],76029189,23),i=c(i,o=c(o,r=c(r,n,i,o,e[9],3654602809,4),n,i,e[12],3873151461,11),r,n,e[15],530742520,16),o,r,e[2],3299628645,23),i=h(i,o=h(o,r=h(r,n,i,o,e[0],4096336452,6),n,i,e[7],1126891415,10),r,n,e[14],2878612391,15),o,r,e[5],4237533241,21),i=h(i,o=h(o,r=h(r,n,i,o,e[12],1700485571,6),n,i,e[3],2399980690,10),r,n,e[10],4293915773,15),o,r,e[1],2240044497,21),i=h(i,o=h(o,r=h(r,n,i,o,e[8],1873313359,6),n,i,e[15],4264355552,10),r,n,e[6],2734768916,15),o,r,e[13],1309151649,21),i=h(i,o=h(o,r=h(r,n,i,o,e[4],4149444226,6),n,i,e[11],3174756917,10),r,n,e[2],718787259,15),o,r,e[9],3951481745,21),this._a=this._a+r|0,this._b=this._b+n|0,this._c=this._c+i|0,this._d=this._d+o|0},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56o?t=i(t):t.lengths||0<=new f(t).cmp(o.modulus))throw new Error("decryption error");i=r?b(new f(t),o):l(t,o);var a=new c(s-i.length);if(a.fill(0),i=c.concat([a,i],s),4===n)return function(e,t){e.modulus;var r=e.modulus.byteLength(),n=(t.length,p("sha1").update(new c("")).digest()),i=n.length;if(0!==t[0])throw new Error("decryption error");var o=t.slice(1,i+1),s=t.slice(i+1),a=d(o,h(s,i)),u=d(s,h(a,r-i-1));if(function(e,t){e=new c(e),t=new c(t);var r=0,n=e.length;e.length!==t.length&&(r++,n=Math.min(e.length,t.length));var i=-1;for(;++i=t.length){o++;break}var s=t.slice(2,i-1);t.slice(i-1,i);("0002"!==n.toString("hex")&&!r||"0001"!==n.toString("hex")&&r)&&o++;s.length<8&&o++;if(o)throw new Error("decryption error");return t.slice(i)}(0,i,r);if(3===n)return i;throw new Error("unknown padding")}}).call(this,e("buffer").Buffer)},{"./mgf":365,"./withPublic":368,"./xor":369,"bn.js":263,"browserify-rsa":285,buffer:47,"create-hash":295,"parse-asn1":358}],367:[function(e,t,r){(function(d){var s=e("parse-asn1"),l=e("randombytes"),p=e("create-hash"),b=e("./mgf"),m=e("./xor"),y=e("bn.js"),a=e("./withPublic"),u=e("browserify-rsa");t.exports=function(e,t,r){var n;n=e.padding?e.padding:r?1:4;var i,o=s(e);if(4===n)i=function(e,t){var r=e.modulus.byteLength(),n=t.length,i=p("sha1").update(new d("")).digest(),o=i.length,s=2*o;if(r-s-2>>32-t}function p(e,t,r,n,i,o,s,a){return l(e+(t^r^n)+o+s|0,a)+i|0}function b(e,t,r,n,i,o,s,a){return l(e+(t&r|~t&n)+o+s|0,a)+i|0}function m(e,t,r,n,i,o,s,a){return l(e+((t|~r)^n)+o+s|0,a)+i|0}function y(e,t,r,n,i,o,s,a){return l(e+(t&n|r&~n)+o+s|0,a)+i|0}function v(e,t,r,n,i,o,s,a){return l(e+(t^(r|~n))+o+s|0,a)+i|0}e(n,r),n.prototype._update=function(){for(var e=new Array(16),t=0;t<16;++t)e[t]=this._block.readInt32LE(4*t);var r=this._a,n=this._b,i=this._c,o=this._d,s=this._e;s=p(s,r=p(r,n,i,o,s,e[0],0,11),n,i=l(i,10),o,e[1],0,14),n=p(n=l(n,10),i=p(i,o=p(o,s,r,n,i,e[2],0,15),s,r=l(r,10),n,e[3],0,12),o,s=l(s,10),r,e[4],0,5),o=p(o=l(o,10),s=p(s,r=p(r,n,i,o,s,e[5],0,8),n,i=l(i,10),o,e[6],0,7),r,n=l(n,10),i,e[7],0,9),r=p(r=l(r,10),n=p(n,i=p(i,o,s,r,n,e[8],0,11),o,s=l(s,10),r,e[9],0,13),i,o=l(o,10),s,e[10],0,14),i=p(i=l(i,10),o=p(o,s=p(s,r,n,i,o,e[11],0,15),r,n=l(n,10),i,e[12],0,6),s,r=l(r,10),n,e[13],0,7),s=b(s=l(s,10),r=p(r,n=p(n,i,o,s,r,e[14],0,9),i,o=l(o,10),s,e[15],0,8),n,i=l(i,10),o,e[7],1518500249,7),n=b(n=l(n,10),i=b(i,o=b(o,s,r,n,i,e[4],1518500249,6),s,r=l(r,10),n,e[13],1518500249,8),o,s=l(s,10),r,e[1],1518500249,13),o=b(o=l(o,10),s=b(s,r=b(r,n,i,o,s,e[10],1518500249,11),n,i=l(i,10),o,e[6],1518500249,9),r,n=l(n,10),i,e[15],1518500249,7),r=b(r=l(r,10),n=b(n,i=b(i,o,s,r,n,e[3],1518500249,15),o,s=l(s,10),r,e[12],1518500249,7),i,o=l(o,10),s,e[0],1518500249,12),i=b(i=l(i,10),o=b(o,s=b(s,r,n,i,o,e[9],1518500249,15),r,n=l(n,10),i,e[5],1518500249,9),s,r=l(r,10),n,e[2],1518500249,11),s=b(s=l(s,10),r=b(r,n=b(n,i,o,s,r,e[14],1518500249,7),i,o=l(o,10),s,e[11],1518500249,13),n,i=l(i,10),o,e[8],1518500249,12),n=m(n=l(n,10),i=m(i,o=m(o,s,r,n,i,e[3],1859775393,11),s,r=l(r,10),n,e[10],1859775393,13),o,s=l(s,10),r,e[14],1859775393,6),o=m(o=l(o,10),s=m(s,r=m(r,n,i,o,s,e[4],1859775393,7),n,i=l(i,10),o,e[9],1859775393,14),r,n=l(n,10),i,e[15],1859775393,9),r=m(r=l(r,10),n=m(n,i=m(i,o,s,r,n,e[8],1859775393,13),o,s=l(s,10),r,e[1],1859775393,15),i,o=l(o,10),s,e[2],1859775393,14),i=m(i=l(i,10),o=m(o,s=m(s,r,n,i,o,e[7],1859775393,8),r,n=l(n,10),i,e[0],1859775393,13),s,r=l(r,10),n,e[6],1859775393,6),s=m(s=l(s,10),r=m(r,n=m(n,i,o,s,r,e[13],1859775393,5),i,o=l(o,10),s,e[11],1859775393,12),n,i=l(i,10),o,e[5],1859775393,7),n=y(n=l(n,10),i=y(i,o=m(o,s,r,n,i,e[12],1859775393,5),s,r=l(r,10),n,e[1],2400959708,11),o,s=l(s,10),r,e[9],2400959708,12),o=y(o=l(o,10),s=y(s,r=y(r,n,i,o,s,e[11],2400959708,14),n,i=l(i,10),o,e[10],2400959708,15),r,n=l(n,10),i,e[0],2400959708,14),r=y(r=l(r,10),n=y(n,i=y(i,o,s,r,n,e[8],2400959708,15),o,s=l(s,10),r,e[12],2400959708,9),i,o=l(o,10),s,e[4],2400959708,8),i=y(i=l(i,10),o=y(o,s=y(s,r,n,i,o,e[13],2400959708,9),r,n=l(n,10),i,e[3],2400959708,14),s,r=l(r,10),n,e[7],2400959708,5),s=y(s=l(s,10),r=y(r,n=y(n,i,o,s,r,e[15],2400959708,6),i,o=l(o,10),s,e[14],2400959708,8),n,i=l(i,10),o,e[5],2400959708,6),n=v(n=l(n,10),i=y(i,o=y(o,s,r,n,i,e[6],2400959708,5),s,r=l(r,10),n,e[2],2400959708,12),o,s=l(s,10),r,e[4],2840853838,9),o=v(o=l(o,10),s=v(s,r=v(r,n,i,o,s,e[0],2840853838,15),n,i=l(i,10),o,e[5],2840853838,5),r,n=l(n,10),i,e[9],2840853838,11),r=v(r=l(r,10),n=v(n,i=v(i,o,s,r,n,e[7],2840853838,6),o,s=l(s,10),r,e[12],2840853838,8),i,o=l(o,10),s,e[2],2840853838,13),i=v(i=l(i,10),o=v(o,s=v(s,r,n,i,o,e[10],2840853838,12),r,n=l(n,10),i,e[14],2840853838,5),s,r=l(r,10),n,e[1],2840853838,12),s=v(s=l(s,10),r=v(r,n=v(n,i,o,s,r,e[3],2840853838,13),i,o=l(o,10),s,e[8],2840853838,14),n,i=l(i,10),o,e[11],2840853838,11),n=v(n=l(n,10),i=v(i,o=v(o,s,r,n,i,e[6],2840853838,8),s,r=l(r,10),n,e[15],2840853838,5),o,s=l(s,10),r,e[13],2840853838,6),o=l(o,10);var a=this._a,u=this._b,f=this._c,c=this._d,h=this._e;h=v(h,a=v(a,u,f,c,h,e[5],1352829926,8),u,f=l(f,10),c,e[14],1352829926,9),u=v(u=l(u,10),f=v(f,c=v(c,h,a,u,f,e[7],1352829926,9),h,a=l(a,10),u,e[0],1352829926,11),c,h=l(h,10),a,e[9],1352829926,13),c=v(c=l(c,10),h=v(h,a=v(a,u,f,c,h,e[2],1352829926,15),u,f=l(f,10),c,e[11],1352829926,15),a,u=l(u,10),f,e[4],1352829926,5),a=v(a=l(a,10),u=v(u,f=v(f,c,h,a,u,e[13],1352829926,7),c,h=l(h,10),a,e[6],1352829926,7),f,c=l(c,10),h,e[15],1352829926,8),f=v(f=l(f,10),c=v(c,h=v(h,a,u,f,c,e[8],1352829926,11),a,u=l(u,10),f,e[1],1352829926,14),h,a=l(a,10),u,e[10],1352829926,14),h=y(h=l(h,10),a=v(a,u=v(u,f,c,h,a,e[3],1352829926,12),f,c=l(c,10),h,e[12],1352829926,6),u,f=l(f,10),c,e[6],1548603684,9),u=y(u=l(u,10),f=y(f,c=y(c,h,a,u,f,e[11],1548603684,13),h,a=l(a,10),u,e[3],1548603684,15),c,h=l(h,10),a,e[7],1548603684,7),c=y(c=l(c,10),h=y(h,a=y(a,u,f,c,h,e[0],1548603684,12),u,f=l(f,10),c,e[13],1548603684,8),a,u=l(u,10),f,e[5],1548603684,9),a=y(a=l(a,10),u=y(u,f=y(f,c,h,a,u,e[10],1548603684,11),c,h=l(h,10),a,e[14],1548603684,7),f,c=l(c,10),h,e[15],1548603684,7),f=y(f=l(f,10),c=y(c,h=y(h,a,u,f,c,e[8],1548603684,12),a,u=l(u,10),f,e[12],1548603684,7),h,a=l(a,10),u,e[4],1548603684,6),h=y(h=l(h,10),a=y(a,u=y(u,f,c,h,a,e[9],1548603684,15),f,c=l(c,10),h,e[1],1548603684,13),u,f=l(f,10),c,e[2],1548603684,11),u=m(u=l(u,10),f=m(f,c=m(c,h,a,u,f,e[15],1836072691,9),h,a=l(a,10),u,e[5],1836072691,7),c,h=l(h,10),a,e[1],1836072691,15),c=m(c=l(c,10),h=m(h,a=m(a,u,f,c,h,e[3],1836072691,11),u,f=l(f,10),c,e[7],1836072691,8),a,u=l(u,10),f,e[14],1836072691,6),a=m(a=l(a,10),u=m(u,f=m(f,c,h,a,u,e[6],1836072691,6),c,h=l(h,10),a,e[9],1836072691,14),f,c=l(c,10),h,e[11],1836072691,12),f=m(f=l(f,10),c=m(c,h=m(h,a,u,f,c,e[8],1836072691,13),a,u=l(u,10),f,e[12],1836072691,5),h,a=l(a,10),u,e[2],1836072691,14),h=m(h=l(h,10),a=m(a,u=m(u,f,c,h,a,e[10],1836072691,13),f,c=l(c,10),h,e[0],1836072691,13),u,f=l(f,10),c,e[4],1836072691,7),u=b(u=l(u,10),f=b(f,c=m(c,h,a,u,f,e[13],1836072691,5),h,a=l(a,10),u,e[8],2053994217,15),c,h=l(h,10),a,e[6],2053994217,5),c=b(c=l(c,10),h=b(h,a=b(a,u,f,c,h,e[4],2053994217,8),u,f=l(f,10),c,e[1],2053994217,11),a,u=l(u,10),f,e[3],2053994217,14),a=b(a=l(a,10),u=b(u,f=b(f,c,h,a,u,e[11],2053994217,14),c,h=l(h,10),a,e[15],2053994217,6),f,c=l(c,10),h,e[0],2053994217,14),f=b(f=l(f,10),c=b(c,h=b(h,a,u,f,c,e[5],2053994217,6),a,u=l(u,10),f,e[12],2053994217,9),h,a=l(a,10),u,e[2],2053994217,12),h=b(h=l(h,10),a=b(a,u=b(u,f,c,h,a,e[13],2053994217,9),f,c=l(c,10),h,e[9],2053994217,12),u,f=l(f,10),c,e[7],2053994217,5),u=p(u=l(u,10),f=b(f,c=b(c,h,a,u,f,e[10],2053994217,15),h,a=l(a,10),u,e[14],2053994217,8),c,h=l(h,10),a,e[12],0,8),c=p(c=l(c,10),h=p(h,a=p(a,u,f,c,h,e[15],0,5),u,f=l(f,10),c,e[10],0,12),a,u=l(u,10),f,e[4],0,9),a=p(a=l(a,10),u=p(u,f=p(f,c,h,a,u,e[1],0,12),c,h=l(h,10),a,e[5],0,5),f,c=l(c,10),h,e[8],0,14),f=p(f=l(f,10),c=p(c,h=p(h,a,u,f,c,e[7],0,6),a,u=l(u,10),f,e[6],0,8),h,a=l(a,10),u,e[2],0,13),h=p(h=l(h,10),a=p(a,u=p(u,f,c,h,a,e[13],0,6),f,c=l(c,10),h,e[14],0,5),u,f=l(f,10),c,e[0],0,15),u=p(u=l(u,10),f=p(f,c=p(c,h,a,u,f,e[3],0,13),h,a=l(a,10),u,e[9],0,11),c,h=l(h,10),a,e[11],0,11),c=l(c,10);var d=this._b+i+c|0;this._b=this._c+o+h|0,this._c=this._d+s+a|0,this._d=this._e+r+u|0,this._e=this._a+n+f|0,this._a=d},n.prototype._digest=function(){this._block[this._blockOffset++]=128,56 0 and a power of 2");if(2147483647/128/n>>32-t}function w(e){var t;for(t=0;t<16;t++)c[t]=(255&e[4*t+0])<<0,c[t]|=(255&e[4*t+1])<<8,c[t]|=(255&e[4*t+2])<<16,c[t]|=(255&e[4*t+3])<<24;for(k(c,0,h,0,16),t=8;0>0&255,e[r+1]=c[t]>>8&255,e[r+2]=c[t]>>16&255,e[r+3]=c[t]>>24&255}}function _(e,t,r,n,i){for(var o=0;o=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=8*this._len;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=4294967295&r,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var o=this._hash();return e?o.toString(e):o},n.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=n},{"safe-buffer":373}],377:[function(e,t,r){arguments[4][151][0].apply(r,arguments)},{"./sha":378,"./sha1":379,"./sha224":380,"./sha256":381,"./sha384":382,"./sha512":383,dup:151}],378:[function(e,t,r){arguments[4][152][0].apply(r,arguments)},{"./hash":376,dup:152,inherits:348,"safe-buffer":373}],379:[function(e,t,r){arguments[4][153][0].apply(r,arguments)},{"./hash":376,dup:153,inherits:348,"safe-buffer":373}],380:[function(e,t,r){arguments[4][154][0].apply(r,arguments)},{"./hash":376,"./sha256":381,dup:154,inherits:348,"safe-buffer":373}],381:[function(e,t,r){arguments[4][155][0].apply(r,arguments)},{"./hash":376,dup:155,inherits:348,"safe-buffer":373}],382:[function(e,t,r){arguments[4][156][0].apply(r,arguments)},{"./hash":376,"./sha512":383,dup:156,inherits:348,"safe-buffer":373}],383:[function(e,t,r){arguments[4][157][0].apply(r,arguments)},{"./hash":376,dup:157,inherits:348,"safe-buffer":373}],384:[function(e,t,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],385:[function(e,i,t){(function(e){var t;if(e.crypto&&crypto.getRandomValues){var r=new Uint8Array(16);t=function(){return crypto.getRandomValues(r),r}}if(!t){var n=new Array(16);t=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}i.exports=t}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],386:[function(e,t,r){for(var s=e("./rng"),i=[],o={},n=0;n<256;n++)i[n]=(n+256).toString(16).substr(1),o[i[n]]=n;function l(e,t){var r=t||0,n=i;return n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+"-"+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]+n[e[r++]]}var a=s(),p=[1|a[0],a[1],a[2],a[3],a[4],a[5]],b=16383&(a[6]<<8|a[7]),m=0,y=0;function u(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"==e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||s)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var o=0;o<16;o++)t[n+o]=i[o];return t||l(i)}var f=u;f.v1=function(e,t,r){var n=t&&r||0,i=t||[],o=void 0!==(e=e||{}).clockseq?e.clockseq:b,s=void 0!==e.msecs?e.msecs:(new Date).getTime(),a=void 0!==e.nsecs?e.nsecs:y+1,u=s-m+(a-y)/1e4;if(u<0&&void 0===e.clockseq&&(o=o+1&16383),(u<0||m>>24&255,i[n++]=f>>>16&255,i[n++]=f>>>8&255,i[n++]=255&f;var c=s/4294967296*1e4&268435455;i[n++]=c>>>8&255,i[n++]=255&c,i[n++]=c>>>24&15|16,i[n++]=c>>>16&255,i[n++]=o>>>8|128,i[n++]=255&o;for(var h=e.node||p,d=0;d<6;d++)i[n+d]=h[d];return t||l(i)},f.v4=u,f.parse=function(e,t,r){var n=t&&r||0,i=0;for(t=t||[],e.toLowerCase().replace(/[0-9a-f]{2}/g,function(e){i<16&&(t[n+i++]=o[e])});i<16;)t[n+i++]=0;return t},f.unparse=l,t.exports=f},{"./rng":385}],387:[function(s,a,e){(function(e,d){var l=s("underscore"),r=s("web3-core"),n=s("web3-core-method"),p=s("any-promise"),b=s("eth-lib/lib/account"),m=s("eth-lib/lib/hash"),y=s("eth-lib/lib/rlp"),v=s("eth-lib/lib/nat"),g=s("eth-lib/lib/bytes"),w=s(void 0===e?"crypto-browserify":"crypto"),_=s("scrypt.js"),x=s("uuid"),M=s("web3-utils"),k=s("web3-core-helpers"),i=function(e){return l.isUndefined(e)||l.isNull(e)},S=function(e){for(;e&&e.startsWith("0x0");)e="0x"+e.slice(3);return e},E=function(e){return e.length%2==1&&(e=e.replace("0x","0x0")),e},t=function(){var t=this;r.packageInit(this,arguments),delete this.BatchRequest,delete this.extend;var e=[new n({name:"getId",call:"net_version",params:0,outputFormatter:M.hexToNumber}),new n({name:"getGasPrice",call:"eth_gasPrice",params:0}),new n({name:"getTransactionCount",call:"eth_getTransactionCount",params:2,inputFormatter:[function(e){if(M.isAddress(e))return e;throw new Error("Address "+e+' is not a valid address to get the "transactionCount".')},function(){return"latest"}]})];this._ethereumCall={},l.each(e,function(e){e.attachToObject(t._ethereumCall),e.setRequestManager(t._requestManager)}),this.wallet=new o(this)};function o(e){this._accounts=e,this.length=0,this.defaultKeyName="web3js_wallet"}t.prototype._addAccountFunctions=function(r){var n=this;return r.signTransaction=function(e,t){return n.signTransaction(e,r.privateKey,t)},r.sign=function(e){return n.sign(e,r.privateKey)},r.encrypt=function(e,t){return n.encrypt(r.privateKey,e,t)},r},t.prototype.create=function(e){return this._addAccountFunctions(b.create(e||M.randomHex(32)))},t.prototype.privateKeyToAccount=function(e){return this._addAccountFunctions(b.fromPrivate(e))},t.prototype.signTransaction=function(t,u,f){var c,h=!1;if(f=f||function(){},!t)return h=new Error("No transaction object given!"),f(h),p.reject(h);function r(e){if(e.gas||e.gasLimit||(h=new Error('"gas" is missing')),(e.nonce<0||e.gas<0||e.gasPrice<0||e.chainId<0)&&(h=new Error("Gas, gasPrice, nonce or chainId is lower than 0")),h)return f(h),p.reject(new Error('"gas" is missing'));try{var t=e=k.formatters.inputCallFormatter(e);t.to=e.to||"0x",t.data=e.data||"0x",t.value=e.value||"0x",t.chainId=M.numberToHex(e.chainId);var r=y.encode([g.fromNat(t.nonce),g.fromNat(t.gasPrice),g.fromNat(t.gas),t.to.toLowerCase(),g.fromNat(t.value),t.data,g.fromNat(t.chainId||"0x1"),"0x","0x"]),n=m.keccak256(r),i=b.makeSigner(2*v.toNumber(t.chainId||"0x1")+35)(m.keccak256(r),u),o=y.decode(r).slice(0,6).concat(b.decodeSignature(i));o[6]=E(S(o[6])),o[7]=E(S(o[7])),o[8]=E(S(o[8]));var s=y.encode(o),a=y.decode(s);c={messageHash:n,v:S(a[6]),r:S(a[7]),s:S(a[8]),rawTransaction:s}}catch(e){return f(e),p.reject(e)}return f(null,c),c}return void 0!==t.nonce&&void 0!==t.chainId&&void 0!==t.gasPrice?p.resolve(r(t)):p.all([i(t.chainId)?this._ethereumCall.getId():t.chainId,i(t.gasPrice)?this._ethereumCall.getGasPrice():t.gasPrice,i(t.nonce)?this._ethereumCall.getTransactionCount(this.privateKeyToAccount(u).address):t.nonce]).then(function(e){if(i(e[0])||i(e[1])||i(e[2]))throw new Error('One of the values "chainId", "gasPrice", or "nonce" couldn\'t be fetched: '+JSON.stringify(e));return r(l.extend(t,{chainId:e[0],gasPrice:e[1],nonce:e[2]}))})},t.prototype.recoverTransaction=function(e){var t=y.decode(e),r=b.encodeSignature(t.slice(6,9)),n=g.toNumber(t[6]),i=n<35?[]:[g.fromNumber(n-35>>1),"0x","0x"],o=t.slice(0,6).concat(i),s=y.encode(o);return b.recover(m.keccak256(s),r)},t.prototype.hashMessage=function(e){var t=M.isHexStrict(e)?M.hexToBytes(e):e,r=d.from(t),n="Ethereum Signed Message:\n"+t.length,i=d.from(n),o=d.concat([i,r]);return m.keccak256s(o)},t.prototype.sign=function(e,t){var r=this.hashMessage(e),n=b.sign(r,t),i=b.decodeSignature(n);return{message:e,messageHash:r,v:i[0],r:i[1],s:i[2],signature:n}},t.prototype.recover=function(e,t,r){var n=[].slice.apply(arguments);return l.isObject(e)?this.recover(e.messageHash,b.encodeSignature([e.v,e.r,e.s]),!0):(r||(e=this.hashMessage(e)),4<=n.length?(r=n.slice(-1)[0],r=!!l.isBoolean(r)&&!!r,this.recover(e,b.encodeSignature(n.slice(1,4)),r)):b.recover(e,t))},t.prototype.decrypt=function(e,t,r){if(!l.isString(t))throw new Error("No password given.");var n,i,o=l.isObject(e)?e:JSON.parse(r?e.toLowerCase():e);if(3!==o.version)throw new Error("Not a valid V3 wallet");if("scrypt"===o.crypto.kdf)i=o.crypto.kdfparams,n=_(new d(t),new d(i.salt,"hex"),i.n,i.r,i.p,i.dklen);else{if("pbkdf2"!==o.crypto.kdf)throw new Error("Unsupported key derivation scheme");if("hmac-sha256"!==(i=o.crypto.kdfparams).prf)throw new Error("Unsupported parameters to PBKDF2");n=w.pbkdf2Sync(new d(t),new d(i.salt,"hex"),i.c,i.dklen,"sha256")}var s=new d(o.crypto.ciphertext,"hex");if(M.sha3(d.concat([n.slice(16,32),s])).replace("0x","")!==o.crypto.mac)throw new Error("Key derivation failed - possibly wrong password");var a=w.createDecipheriv(o.crypto.cipher,n.slice(0,16),new d(o.crypto.cipherparams.iv,"hex")),u="0x"+d.concat([a.update(s),a.final()]).toString("hex");return this.privateKeyToAccount(u)},t.prototype.encrypt=function(e,t,r){var n,i=this.privateKeyToAccount(e),o=(r=r||{}).salt||w.randomBytes(32),s=r.iv||w.randomBytes(16),a=r.kdf||"scrypt",u={dklen:r.dklen||32,salt:o.toString("hex")};if("pbkdf2"===a)u.c=r.c||262144,u.prf="hmac-sha256",n=w.pbkdf2Sync(new d(t),o,u.c,u.dklen,"sha256");else{if("scrypt"!==a)throw new Error("Unsupported kdf");u.n=r.n||8192,u.r=r.r||8,u.p=r.p||1,n=_(new d(t),o,u.n,u.r,u.p,u.dklen)}var f=w.createCipheriv(r.cipher||"aes-128-ctr",n.slice(0,16),s);if(!f)throw new Error("Unsupported cipher");var c=d.concat([f.update(new d(i.privateKey.replace("0x",""),"hex")),f.final()]),h=M.sha3(d.concat([n.slice(16,32),new d(c,"hex")])).replace("0x","");return{version:3,id:x.v4({random:r.uuid||w.randomBytes(16)}),address:i.address.toLowerCase().replace("0x",""),crypto:{ciphertext:c.toString("hex"),cipherparams:{iv:s.toString("hex")},cipher:r.cipher||"aes-128-ctr",kdf:a,kdfparams:u,mac:h.toString("hex")}}},o.prototype._findSafeIndex=function(e){return e=e||0,l.has(this,e)?this._findSafeIndex(e+1):e},o.prototype._currentIndexes=function(){return Object.keys(this).map(function(e){return parseInt(e)}).filter(function(e){return e<9e20})},o.prototype.create=function(e,t){for(var r=0;re.highestBlock-200&&(t._isSyncing=!1,t.emit("changed",t._isSyncing),s.isFunction(t.callback)&&t.callback(null,t._isSyncing,t))},500))}}}})];o.forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager,t.accounts),e.defaultBlock=t.defaultBlock,e.defaultAccount=t.defaultAccount})};a.addProviders(i),t.exports=i},{"./getNetworkType.js":394,underscore:393,"web3-core":217,"web3-core-helpers":199,"web3-core-method":201,"web3-core-subscriptions":214,"web3-eth-abi":245,"web3-eth-accounts":387,"web3-eth-contract":389,"web3-eth-iban":391,"web3-eth-personal":392,"web3-net":396,"web3-utils":421}],396:[function(e,t,r){var n=e("web3-core"),i=e("web3-core-method"),o=e("web3-utils"),s=function(){var t=this;n.packageInit(this,arguments),[new i({name:"getId",call:"net_version",params:0,outputFormatter:o.hexToNumber}),new i({name:"isListening",call:"net_listening",params:0}),new i({name:"getPeerCount",call:"net_peerCount",params:0,outputFormatter:o.hexToNumber})].forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)})};n.addProviders(s),t.exports=s},{"web3-core":217,"web3-core-method":201,"web3-utils":421}],397:[function(e,t,r){!function(){function i(e,t,r,n){return this instanceof i?(this.domain=e||void 0,this.path=t||"/",this.secure=!!r,this.script=!!n,this):new i(e,t,r,n)}function u(e,t,r){return e instanceof u?e:this instanceof u?(this.name=null,this.value=null,this.expiration_date=1/0,this.path=String(r||"/"),this.explicit_path=!1,this.domain=t||null,this.explicit_domain=!1,this.secure=!1,this.noscript=!1,e&&this.parse(e,t,r),this):new u(e,t,r)}i.All=Object.freeze(Object.create(null)),r.CookieAccessInfo=i,(r.Cookie=u).prototype.toString=function(){var e=[this.name+"="+this.value];return this.expiration_date!==1/0&&e.push("expires="+new Date(this.expiration_date).toGMTString()),this.domain&&e.push("domain="+this.domain),this.path&&e.push("path="+this.path),this.secure&&e.push("secure"),this.noscript&&e.push("httponly"),e.join("; ")},u.prototype.toValueString=function(){return this.name+"="+this.value};var s=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;function e(){var o,s;return this instanceof e?(o=Object.create(null),this.setCookie=function(e,t,r){var n,i;if(n=(e=new u(e,t,r)).expiration_date<=Date.now(),void 0!==o[e.name]){for(s=o[e.name],i=0;ih&&(G("Max buffer length exceeded: textNode"),i=Math.max(i,N.length)),R.length>h&&(G("Max buffer length exceeded: numberNode"),i=Math.max(i,R.length)),P=h-i+z);var i}),e(ae).on(function(){if(q==l)return f({}),c(),void(L=!0);q===p&&0===H||G("Unexpected end");N!==J&&(f(N),c(),N=J);L=!0})}var e,t,o,P,N,R,O,L,q,U,D,F=(e=l(function(e){return e.unshift(/^/),(t=RegExp(e.map(n("source")).join(""))).exec.bind(t);var t}),P=e(t=/(\$?)/,/([\w-_]+|\*)/,o=/(?:{([\w ]*?)})?/),N=e(t,/\["([^"]+)"\]/,o),R=e(t,/\[(\d+|\*)\]/,o),O=e(t,/()/,/{([\w ]*?)}/),L=e(/\.\./),q=e(/\./),U=e(t,/!/),D=e(/$/),function(e){return e(y(P,N,R,O),L,q,U,D)});function H(e,t){return{key:e,node:t}}var z=n("key"),K=n("node"),V={};function G(e){var i=e(Y).emit,t=e(Q).emit,u=e(ie).emit,r=e(ne).emit;function f(e,t,r){K(A(e))[t]=r}function c(e,t,r){e&&f(e,t,r);var n=E(H(t,r),e);return i(n),n}var n={};return n[ce]=function(e,t){if(!e)return u(t),c(e,V,t);var r,n,i,o=(n=t,i=K(A(r=e)),_(h,i)?c(r,x(i),n):r),s=j(o),a=z(A(o));return f(s,a,t),E(H(a,t),s)},n[he]=function(e){return t(e),j(e)||r(K(A(e)))},n[fe]=c,n}var W=F(function(e,t,r,n,i){var o=m(z,A),s=m(K,A);function a(e,t){return!!t[1]?v(e,A):e}function u(e){if(e==w)return w;return v(function(e){return o(e)!=V},m(e,j))}function f(){return function(e){return o(e)==V}}function c(e,t,r,n,i){var o,s=e(r);if(s){var a=(o=s,B(function(e,t){return t(e,o)},n,t));return i(r.substr(x(s[0])),a)}}function h(e,t){return b(c,e,t)}var d=y(h(e,I(a,function(e,t){var r=t[3];return r?v(m(b(S,T(r.split(/\W+/))),s),e):e},function(e,t){var r=t[2];return v(r&&"*"!=r?function(e){return o(e)==r}:w,e)},u)),h(t,I(function(e){if(e==w)return w;var t=f(),r=e,n=u(function(e){return i(e)}),i=y(t,r,n);return i})),h(r,I()),h(n,I(a,f)),h(i,I(function(r){return function(e){var t=r(e);return!0===t?A(e):t}})),function(e){throw X('"'+e+'" could not be tokenised')});function l(e,t){return t}function p(e,t){return d(e,t,e?p:l)}return function(t){try{return p(t,w)}catch(e){throw X('Could not compile "'+t+'" because '+e.message)}}});function Z(n,i,r){var o,s;function a(t){return function(e){return e.id==t}}return{on:function(e,t){var r={listener:e,id:t||e};return i&&i.emit(n,e,r.id),o=E(r,o),s=E(e,s),this},emit:function(){!function e(t,r){t&&(A(t).apply(null,r),e(j(t),r))}(s,arguments)},un:function(e){var t;o=c(o,a(e),function(e){t=e}),t&&(s=c(s,function(e){return e==t.listener}),r&&r.emit(n,t.listener,t.id))},listeners:function(){return s},hasListener:function(e){return k(function e(t,r){return r&&(t(A(r))?A(r):e(t,j(r)))}(e?a(e):w,o))}}}var $=1,Y=$++,Q=$++,ee=$++,te=$++,re="fail",ne=$++,ie=$++,oe="start",se="data",ae="end",ue=$++,fe=$++,ce=$++,he=$++;function de(e,t,r){try{var n=u.parse(t)}catch(e){}return{statusCode:e,body:t,jsonBody:n,thrown:r}}function le(n,i){var o={node:n(Q),path:n(Y)};function s(t,r,o){var s=n(t).emit;r.on(function(e){var t,r,n,i=o(e);!1!==i&&(t=s,r=K(i),n=C(e),t(r,a(j(f(z,n))),a(f(K,n))))},t),n("removeListener").on(function(e){e==t&&(n(e).listeners()||r.un(t))})}n("newListener").on(function(e){var t=/(node|path):(.*)/.exec(e);if(t){var r=o[t[1]];r.hasListener(e)||s(e,r,i(t[2]))}})}function pe(o,e){var i,s=/^(node|path):./,a=o(ne),u=o(te).emit,f=o(ee).emit,t=l(function(e,t){if(i[e])d(t,i[e]);else{var r=o(e),n=t[0];s.test(e)?c(r,n):r.on(n)}return i});function c(t,e,r){r=r||e;var n=h(e);return t.on(function(){var e=!1;i.forget=function(){e=!0},d(arguments,n),delete i.forget,e&&t.un(r)},r),i}function h(e){return function(){try{return e.apply(i,arguments)}catch(e){setTimeout(function(){throw e})}}}function n(e,t,r){var n,i;"node"==e?(i=r,n=function(){var e=i.apply(this,arguments);k(e)&&(e==ye.drop?u():f(e))}):n=r,c(o(e+":"+t),n,r)}function r(e,t,r){return M(t)?n(e,t,r):function(e,t){for(var r in t)n(e,r,t[r])}(e,t),i}return o(ie).on(function(e){var t;i.root=(t=e,function(){return t})}),o(oe).on(function(e,t){i.header=function(e){return e?t[e]:t}}),i={on:t,addListener:t,removeListener:function(e,t,r){if("done"==e)a.un(t);else if("node"==e||"path"==e)o.un(e+":"+t,r);else{var n=t;o(e).un(n)}return i},emit:o.emit,node:b(r,"node"),path:b(r,"path"),done:b(c,a),start:b(function(e,t){return o(e).on(h(t),t),i},oe),fail:o(re).on,abort:o(ue).emit,header:g,root:g,source:e}}function be(e,t,r,n,i){var o=function(){var t={},r=i("newListener"),n=i("removeListener");function i(e){return t[e]=Z(e,r,n)}function o(e){return t[e]||i(e)}return["emit","on","un"].forEach(function(r){o[r]=l(function(e,t){d(t,o(e)[r])})}),o}();return t&&function(t,n,e,r,i,o,s){var a,u=t(se).emit,f=t(re).emit,c=0,h=!0;function d(){var e=n.responseText,t=e.substr(c);t&&u(t),c=x(e)}t(ue).on(function(){n.onreadystatechange=null,n.abort()}),"onprogress"in n&&(n.onprogress=d),n.onreadystatechange=function(){function e(){try{h&&t(oe).emit(n.status,(e=n.getAllResponseHeaders(),r={},e&&e.split("\r\n").forEach(function(e){var t=e.indexOf(": ");r[e.substring(0,t)]=e.substring(t+2)}),r)),h=!1}catch(e){}var e,r}switch(n.readyState){case 2:case 3:return e();case 4:e(),2==String(n.status)[0]?(d(),t(ae).emit()):f(de(n.status,n.responseText))}};try{for(var l in n.open(e,r,!0),o)n.setRequestHeader(l,o[l]);(function(t,e){function r(e){return e.port||{"http:":80,"https:":443}[e.protocol||t.protocol]}return!!(e.protocol&&e.protocol!=t.protocol||e.host&&e.host!=t.host||e.host&&r(e)!=r(t))})(p.location,{protocol:(a=/(\w+:)?(?:\/\/)([\w.-]+)?(?::(\d+))?\/?/.exec(r)||[])[1]||"",host:a[2]||"",port:a[3]||""})||n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.withCredentials=s,n.send(i)}catch(e){p.setTimeout(b(f,de(J,J,e)),0)}}(o,new XMLHttpRequest,e,t,r,n,i),s(o),function(t,r){var i,n={};function e(t){return function(e){i=t(i,e)}}for(var o in r)t(o).on(e(r[o]),n);t(ee).on(function(e){var t=A(i),r=z(t),n=j(i);n&&(K(A(n))[r]=e)}),t(te).on(function(){var e=A(i),t=z(e),r=j(i);r&&delete K(A(r))[t]}),t(ue).on(function(){for(var e in r)t(e).un(n)})}(o,G(o)),le(o,W),pe(o,t)}function me(e,t,r,n,i,o,s){return i=i?u.parse(u.stringify(i)):{},n?M(n)||(n=u.stringify(n),i["Content-Type"]=i["Content-Type"]||"application/json"):n=null,e(r||"GET",(a=t,!1===s&&(-1==a.indexOf("?")?a+="?":a+="&",a+="_="+(new Date).getTime()),a),n,i,o||!1);var a}function ye(e){var t=I("resume","pause","pipe"),r=b(S,t);return e?r(e)||M(e)?me(be,e):me(be,e.url,e.method,e.body,e.headers,e.withCredentials,e.cached):be()}ye.drop=function(){return ye.drop},"function"==typeof define&&define.amd?define("oboe",[],function(){return ye}):"object"===(void 0===ge?"undefined":_typeof(ge))?ve.exports=ye:p.oboe=ye}(function(){try{return window}catch(e){return self}}(),Object,Array,Error,JSON)},{}],406:[function(e,t,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],407:[function(e,t,r){var i=e("underscore"),o=e("web3-core-helpers").errors,s=e("oboe"),n=function(e,t){var n=this;this.responseCallbacks={},this.notificationCallbacks=[],this.path=e,this.connection=t.connect({path:this.path}),this.addDefaultEvents();var r=function(t){var r=null;i.isArray(t)?t.forEach(function(e){n.responseCallbacks[e.id]&&(r=e.id)}):r=t.id,r||-1===t.method.indexOf("_subscription")?n.responseCallbacks[r]&&(n.responseCallbacks[r](null,t),delete n.responseCallbacks[r]):n.notificationCallbacks.forEach(function(e){i.isFunction(e)&&e(t)})};"Socket"===t.constructor.name?s(this.connection).done(r):this.connection.on("data",function(e){n._parseResponse(e.toString()).forEach(r)})};n.prototype.addDefaultEvents=function(){var e=this;this.connection.on("connect",function(){}),this.connection.on("error",function(){e._timeout()}),this.connection.on("end",function(){e._timeout()}),this.connection.on("timeout",function(){e._timeout()})},n.prototype._parseResponse=function(e){var r=this,n=[];return e.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){r.lastChunk&&(t=r.lastChunk+t);var e=null;try{e=JSON.parse(t)}catch(e){return r.lastChunk=t,clearTimeout(r.lastChunkTimeout),void(r.lastChunkTimeout=setTimeout(function(){throw r._timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(r.lastChunkTimeout),r.lastChunk=null,e&&n.push(e)}),n},n.prototype._addResponseCallback=function(e,t){var r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n},n.prototype._timeout=function(){for(var e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](o.InvalidConnection("on IPC")),delete this.responseCallbacks[e])},n.prototype.reconnect=function(){this.connection.connect({path:this.path})},n.prototype.send=function(e,t){this.connection.writable||this.connection.connect({path:this.path}),this.connection.write(JSON.stringify(e)),this._addResponseCallback(e,t)},n.prototype.on=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");switch(e){case"data":this.notificationCallbacks.push(t);break;default:this.connection.on(e,t)}},n.prototype.once=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");this.connection.once(e,t)},n.prototype.removeListener=function(e,r){var n=this;switch(e){case"data":this.notificationCallbacks.forEach(function(e,t){e===r&&n.notificationCallbacks.splice(t,1)});break;default:this.connection.removeListener(e,r)}},n.prototype.removeAllListeners=function(e){switch(e){case"data":this.notificationCallbacks=[];break;default:this.connection.removeAllListeners(e)}},n.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.connection.removeAllListeners("error"),this.connection.removeAllListeners("end"),this.connection.removeAllListeners("timeout"),this.addDefaultEvents()},t.exports=n},{oboe:405,underscore:406,"web3-core-helpers":199}],408:[function(e,t,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],409:[function(i,c,e){(function(t){var s=i("underscore"),o=i("web3-core-helpers").errors,a=null,u=null,f=null;if("undefined"!=typeof window&&void 0!==window.WebSocket)a=window.WebSocket,u=btoa,f=function(e){return new URL(e)};else{a=i("websocket").w3cwebsocket,u=function(e){return t(e).toString("base64")};var e=i("url");if(e.URL){var r=e.URL;f=function(e){return new r(e)}}else f=i("url").parse}var n=function(e,t){var n=this;this.responseCallbacks={},this.notificationCallbacks=[],t=t||{},this._customTimeout=t.timeout;var r=f(e),i=t.headers||{},o=t.protocol||void 0;r.username&&r.password&&(i.authorization="Basic "+u(r.username+":"+r.password)),this.connection=new a(e,o,void 0,i),this.addDefaultEvents(),this.connection.onmessage=function(e){var t="string"==typeof e.data?e.data:"";n._parseResponse(t).forEach(function(t){var r=null;s.isArray(t)?t.forEach(function(e){n.responseCallbacks[e.id]&&(r=e.id)}):r=t.id,r||-1===t.method.indexOf("_subscription")?n.responseCallbacks[r]&&(n.responseCallbacks[r](null,t),delete n.responseCallbacks[r]):n.notificationCallbacks.forEach(function(e){s.isFunction(e)&&e(t)})})}};n.prototype.addDefaultEvents=function(){var e=this;this.connection.onerror=function(){e._timeout()},this.connection.onclose=function(){e._timeout(),e.reset()}},n.prototype._parseResponse=function(e){var r=this,n=[];return e.replace(/\}[\n\r]?\{/g,"}|--|{").replace(/\}\][\n\r]?\[\{/g,"}]|--|[{").replace(/\}[\n\r]?\[\{/g,"}|--|[{").replace(/\}\][\n\r]?\{/g,"}]|--|{").split("|--|").forEach(function(t){r.lastChunk&&(t=r.lastChunk+t);var e=null;try{e=JSON.parse(t)}catch(e){return r.lastChunk=t,clearTimeout(r.lastChunkTimeout),void(r.lastChunkTimeout=setTimeout(function(){throw r._timeout(),o.InvalidResponse(t)},15e3))}clearTimeout(r.lastChunkTimeout),r.lastChunk=null,e&&n.push(e)}),n},n.prototype._addResponseCallback=function(e,t){var r=e.id||e[0].id,n=e.method||e[0].method;this.responseCallbacks[r]=t,this.responseCallbacks[r].method=n;var i=this;this._customTimeout&&setTimeout(function(){i.responseCallbacks[r]&&(i.responseCallbacks[r](o.ConnectionTimeout(i._customTimeout)),delete i.responseCallbacks[r])},this._customTimeout)},n.prototype._timeout=function(){for(var e in this.responseCallbacks)this.responseCallbacks.hasOwnProperty(e)&&(this.responseCallbacks[e](o.InvalidConnection("on WS")),delete this.responseCallbacks[e])},n.prototype.send=function(e,t){var r=this;if(this.connection.readyState!==this.connection.CONNECTING){if(this.connection.readyState!==this.connection.OPEN)return console.error("connection not open on send()"),"function"==typeof this.connection.onerror?this.connection.onerror(new Error("connection not open")):console.error("no error callback"),void t(new Error("connection not open"));this.connection.send(JSON.stringify(e)),this._addResponseCallback(e,t)}else setTimeout(function(){r.send(e,t)},10)},n.prototype.on=function(e,t){if("function"!=typeof t)throw new Error("The second parameter callback must be a function.");switch(e){case"data":this.notificationCallbacks.push(t);break;case"connect":this.connection.onopen=t;break;case"end":this.connection.onclose=t;break;case"error":this.connection.onerror=t}},n.prototype.removeListener=function(e,r){var n=this;switch(e){case"data":this.notificationCallbacks.forEach(function(e,t){e===r&&n.notificationCallbacks.splice(t,1)})}},n.prototype.removeAllListeners=function(e){switch(e){case"data":this.notificationCallbacks=[];break;case"connect":this.connection.onopen=null;break;case"end":this.connection.onclose=null;break;case"error":this.connection.onerror=null}},n.prototype.reset=function(){this._timeout(),this.notificationCallbacks=[],this.addDefaultEvents()},c.exports=n}).call(this,i("buffer").Buffer)},{buffer:47,underscore:408,url:166,"web3-core-helpers":199,websocket:45}],410:[function(e,t,r){var n=e("web3-core"),i=e("web3-core-subscriptions").subscriptions,o=e("web3-core-method"),s=e("web3-net"),a=function(){var t=this;n.packageInit(this,arguments);var e=this.setProvider;this.setProvider=function(){e.apply(t,arguments),t.net.setProvider.apply(t,arguments)},this.clearSubscriptions=t._requestManager.clearSubscriptions,this.net=new s(this.currentProvider),[new i({name:"subscribe",type:"shh",subscriptions:{messages:{params:1}}}),new o({name:"getVersion",call:"shh_version",params:0}),new o({name:"getInfo",call:"shh_info",params:0}),new o({name:"setMaxMessageSize",call:"shh_setMaxMessageSize",params:1}),new o({name:"setMinPoW",call:"shh_setMinPoW",params:1}),new o({name:"markTrustedPeer",call:"shh_markTrustedPeer",params:1}),new o({name:"newKeyPair",call:"shh_newKeyPair",params:0}),new o({name:"addPrivateKey",call:"shh_addPrivateKey",params:1}),new o({name:"deleteKeyPair",call:"shh_deleteKeyPair",params:1}),new o({name:"hasKeyPair",call:"shh_hasKeyPair",params:1}),new o({name:"getPublicKey",call:"shh_getPublicKey",params:1}),new o({name:"getPrivateKey",call:"shh_getPrivateKey",params:1}),new o({name:"newSymKey",call:"shh_newSymKey",params:0}),new o({name:"addSymKey",call:"shh_addSymKey",params:1}),new o({name:"generateSymKeyFromPassword",call:"shh_generateSymKeyFromPassword",params:1}),new o({name:"hasSymKey",call:"shh_hasSymKey",params:1}),new o({name:"getSymKey",call:"shh_getSymKey",params:1}),new o({name:"deleteSymKey",call:"shh_deleteSymKey",params:1}),new o({name:"newMessageFilter",call:"shh_newMessageFilter",params:1}),new o({name:"getFilterMessages",call:"shh_getFilterMessages",params:1}),new o({name:"deleteMessageFilter",call:"shh_deleteMessageFilter",params:1}),new o({name:"post",call:"shh_post",params:1,inputFormatter:[null]})].forEach(function(e){e.attachToObject(t),e.setRequestManager(t._requestManager)})};n.addProviders(a),t.exports=a},{"web3-core":217,"web3-core-method":201,"web3-core-subscriptions":214,"web3-net":396}],411:[function(e,t,r){arguments[4][173][0].apply(r,arguments)},{dup:173}],412:[function(e,t,r){arguments[4][229][0].apply(r,arguments)},{"bn.js":"BN",dup:229,"number-to-bn":414}],413:[function(e,t,r){arguments[4][231][0].apply(r,arguments)},{dup:231}],414:[function(e,t,r){arguments[4][234][0].apply(r,arguments)},{"bn.js":"BN",dup:234,"strip-hex-prefix":418}],415:[function(e,t,r){arguments[4][235][0].apply(r,arguments)},{dup:235}],416:[function(e,t,r){arguments[4][236][0].apply(r,arguments)},{crypto:415,dup:236}],417:[function(e,t,r){arguments[4][237][0].apply(r,arguments)},{"./crypto.js":416,dup:237}],418:[function(e,t,r){arguments[4][238][0].apply(r,arguments)},{dup:238,"is-hex-prefixed":413}],419:[function(e,t,r){arguments[4][185][0].apply(r,arguments)},{dup:185}],420:[function(e,v,g){(function(y){!function(e){var t="object"==(void 0===g?"undefined":_typeof(g))&&g,r="object"==(void 0===v?"undefined":_typeof(v))&&v&&v.exports==t&&v,n="object"==(void 0===y?"undefined":_typeof(y))&&y;n.global!==n&&n.window!==n||(e=n);var i,o,s,a=String.fromCharCode;function u(e){for(var t,r,n=[],i=0,o=e.length;i>t&63|128)}function h(e){if(0==(4294967168&e))return a(e);var t="";return 0==(4294965248&e)?t=a(e>>6&31|192):0==(4294901760&e)?(f(e),t=a(e>>12&15|224),t+=c(e,6)):0==(4292870144&e)&&(t=a(e>>18&7|240),t+=c(e,12),t+=c(e,6)),t+=a(63&e|128)}function d(){if(o<=s)throw Error("Invalid byte index");var e=255&i[s];if(s++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function l(){var e,t;if(o>>10&1023|55296),t=56320|1023&t),i+=a(t);return i}(r)}};if("function"==typeof define&&"object"==_typeof(define.amd)&&define.amd)define(function(){return p});else if(t&&!t.nodeType)if(r)r.exports=p;else{var b={}.hasOwnProperty;for(var m in p)b.call(p,m)&&(t[m]=p[m])}else e.utf8=p}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],421:[function(e,t,r){var a=e("underscore"),n=e("ethjs-unit"),o=e("./utils.js"),i=e("./soliditySha3.js"),s=e("randomhex"),u=function i(o,e){var s=[];return e.forEach(function(e){if("object"===_typeof(e.components)){if("tuple"!==e.type.substring(0,5))throw new Error("components found but type is not tuple; report on GitHub");var t="",r=e.type.indexOf("[");0<=r&&(t=e.type.substring(r));var n=i(o,e.components);a.isArray(n)&&o?s.push("tuple("+n.join(",")+")"+t):o?s.push("("+n+")"):s.push("("+n.join(",")+")"+t)}else s.push(e.type)}),s},f=function(e){if(!o.isHexStrict(e))throw new Error("The parameter must be a valid HEX string.");var t="",r=0,n=e.length;for("0x"===e.substring(0,2)&&(r=2);r=2.2.7 <3" + } + }, + "abbrev": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", + "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "dev": true + }, + "acorn": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", + "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", + "dev": true + }, + "acorn-dynamic-import": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", + "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", + "dev": true, + "requires": { + "acorn": "^5.0.0" + } + }, + "acorn-node": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.5.2.tgz", + "integrity": "sha512-krFKvw/d1F17AN3XZbybIUzEY4YEPNiGo05AfP3dBlfVKrMHETKpgjpuZkSF8qDNt9UkQcqj7am8yJLseklCMg==", + "dev": true, + "requires": { + "acorn": "^5.7.1", + "acorn-dynamic-import": "^3.0.0", + "xtend": "^4.0.1" + } + }, + "add-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/add-stream/-/add-stream-1.0.0.tgz", + "integrity": "sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=", + "dev": true + }, + "aes-js": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-0.2.4.tgz", + "integrity": "sha1-lLiBq3FyhtAV+iGeCPtmcJ3aWj0=", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-colors": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz", + "integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==", + "dev": true, + "requires": { + "ansi-wrap": "^0.1.0" + } + }, + "ansi-cyan": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-cyan/-/ansi-cyan-0.1.1.tgz", + "integrity": "sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-gray": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-gray/-/ansi-gray-0.1.1.tgz", + "integrity": "sha1-KWLPVOyXksSFEKPetSRDaGHvclE=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-red": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ansi-red/-/ansi-red-0.1.1.tgz", + "integrity": "sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw=", + "dev": true, + "requires": { + "ansi-wrap": "0.1.0" + } + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "ansi-wrap": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz", + "integrity": "sha1-qCJQ3bABXponyoLoLqYDu/pF768=", + "dev": true + }, + "aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "are-we-there-yet": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", + "dev": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-differ": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE=", + "dev": true + }, + "array-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", + "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", + "dev": true + }, + "array-filter": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", + "dev": true + }, + "array-find-index": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", + "integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=", + "dev": true + }, + "array-ify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", + "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", + "dev": true + }, + "array-map": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", + "dev": true + }, + "array-reduce": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "dev": true + }, + "array-slice": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-1.1.0.tgz", + "integrity": "sha512-B1qMD3RBP7O8o0H2KbrXDyB0IccejMF15+87Lvlor12ONPRHP6gTjXMNkt/d3ZuOGbAe66hFmaCfECI24Ufp6w==", + "dev": true + }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "^1.0.1" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "dev": true + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assert-plus": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "dev": true + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", + "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", + "dev": true + }, + "aws-sign2": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "dev": true + }, + "aws4": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz", + "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w==", + "dev": true + }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "requires": { + "chalk": "^1.1.3", + "esutils": "^2.0.2", + "js-tokens": "^3.0.2" + } + }, + "babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" + }, + "dependencies": { + "convert-source-map": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", + "integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU=", + "dev": true + } + } + }, + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + } + } + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true, + "requires": { + "babel-helper-explode-assignable-expression": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true, + "requires": { + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true, + "requires": { + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", + "dev": true + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true, + "requires": { + "babel-helper-remap-async-to-generator": "^6.24.1", + "babel-plugin-syntax-async-functions": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "lodash": "^4.17.4" + } + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true, + "requires": { + "babel-helper-define-map": "^6.24.1", + "babel-helper-function-name": "^6.24.1", + "babel-helper-optimise-call-expression": "^6.24.1", + "babel-helper-replace-supers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true, + "requires": { + "babel-helper-function-name": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.2", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz", + "integrity": "sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q==", + "dev": true, + "requires": { + "babel-plugin-transform-strict-mode": "^6.24.1", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-types": "^6.26.0" + } + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true, + "requires": { + "babel-helper-hoist-variables": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true, + "requires": { + "babel-plugin-transform-es2015-modules-amd": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true, + "requires": { + "babel-helper-replace-supers": "^6.24.1", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true, + "requires": { + "babel-helper-call-delegate": "^6.24.1", + "babel-helper-get-function-arity": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1", + "babel-traverse": "^6.24.1", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true, + "requires": { + "babel-helper-regex": "^6.24.1", + "babel-runtime": "^6.22.0", + "regexpu-core": "^2.0.0" + } + }, + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "dev": true, + "requires": { + "babel-helper-builder-binary-assignment-operator-visitor": "^6.24.1", + "babel-plugin-syntax-exponentiation-operator": "^6.8.0", + "babel-runtime": "^6.22.0" + } + }, + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "dev": true, + "requires": { + "regenerator-transform": "^0.10.0" + } + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-types": "^6.24.1" + } + }, + "babel-preset-env": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.7.0.tgz", + "integrity": "sha512-9OR2afuKDneX2/q2EurSftUYM0xGu4O2D9adAhVfADDhrYDaxXV0rBbevVYoY9n6nyX1PmQW/0jtpJvUNr9CHg==", + "dev": true, + "requires": { + "babel-plugin-check-es2015-constants": "^6.22.0", + "babel-plugin-syntax-trailing-function-commas": "^6.22.0", + "babel-plugin-transform-async-to-generator": "^6.22.0", + "babel-plugin-transform-es2015-arrow-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoped-functions": "^6.22.0", + "babel-plugin-transform-es2015-block-scoping": "^6.23.0", + "babel-plugin-transform-es2015-classes": "^6.23.0", + "babel-plugin-transform-es2015-computed-properties": "^6.22.0", + "babel-plugin-transform-es2015-destructuring": "^6.23.0", + "babel-plugin-transform-es2015-duplicate-keys": "^6.22.0", + "babel-plugin-transform-es2015-for-of": "^6.23.0", + "babel-plugin-transform-es2015-function-name": "^6.22.0", + "babel-plugin-transform-es2015-literals": "^6.22.0", + "babel-plugin-transform-es2015-modules-amd": "^6.22.0", + "babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", + "babel-plugin-transform-es2015-modules-systemjs": "^6.23.0", + "babel-plugin-transform-es2015-modules-umd": "^6.23.0", + "babel-plugin-transform-es2015-object-super": "^6.22.0", + "babel-plugin-transform-es2015-parameters": "^6.23.0", + "babel-plugin-transform-es2015-shorthand-properties": "^6.22.0", + "babel-plugin-transform-es2015-spread": "^6.22.0", + "babel-plugin-transform-es2015-sticky-regex": "^6.22.0", + "babel-plugin-transform-es2015-template-literals": "^6.22.0", + "babel-plugin-transform-es2015-typeof-symbol": "^6.23.0", + "babel-plugin-transform-es2015-unicode-regex": "^6.22.0", + "babel-plugin-transform-exponentiation-operator": "^6.22.0", + "babel-plugin-transform-regenerator": "^6.22.0", + "browserslist": "^3.2.6", + "invariant": "^2.2.2", + "semver": "^5.3.0" + } + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" + } + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true, + "requires": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + } + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base-x": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-1.1.0.tgz", + "integrity": "sha1-QtPXF0dPnqAiB/bRqh9CaRPut6w=", + "dev": true + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "dev": true, + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "beeper": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", + "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", + "dev": true + }, + "bignumber.js": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-4.1.0.tgz", + "integrity": "sha512-eJzYkFYy9L4JzXsbymsFn3p54D+llV27oTQ+ziJG7WFRheJcNZilgVXMG0LoZtlQSKBsJdWtLFqOD0u+U0jZKA==", + "dev": true + }, + "binaryextensions": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-1.0.1.tgz", + "integrity": "sha1-HmN0iLNbWL2l9HdL+WpSEqjJB1U=", + "dev": true + }, + "bindings": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.3.0.tgz", + "integrity": "sha512-DpLh5EzMR2kzvX1KIlVC0VkC3iZtHKTgdtZ0a3pglBZdaQFjt5S9g9xd1lE+YvXyfd6mtCeRnrUfOLYiTMlNSw==", + "dev": true + }, + "bip66": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "bluebird": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.3.1.tgz", + "integrity": "sha1-+Xrhlw9B2FF3KDBT6aEgFg5mxh0=", + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, + "boom": { + "version": "2.10.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "bower": { + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/bower/-/bower-1.8.4.tgz", + "integrity": "sha1-54dqB23rgTf30GUl3F6MZtuC8oo=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browser-pack": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", + "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "combine-source-map": "~0.8.0", + "defined": "^1.0.0", + "safe-buffer": "^5.1.1", + "through2": "^2.0.0", + "umd": "^3.0.0" + } + }, + "browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "dev": true, + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "browserify": { + "version": "14.5.0", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.5.0.tgz", + "integrity": "sha512-gKfOsNQv/toWz+60nSPfYzuwSEdzvV2WdxrVPUbPD/qui44rAkB3t3muNtmmGYHqrG56FGwX9SUEQmzNLAeS7g==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^1.11.0", + "browserify-zlib": "~0.2.0", + "buffer": "^5.0.2", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.5.1", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.0", + "domain-browser": "~1.1.0", + "duplexer2": "~0.1.2", + "events": "~1.1.0", + "glob": "^7.1.0", + "has": "^1.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "^1.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.0.0", + "labeled-stream-splicer": "^2.0.0", + "module-deps": "^4.0.8", + "os-browserify": "~0.3.0", + "parents": "^1.0.1", + "path-browserify": "~0.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^2.0.0", + "stream-http": "^2.0.0", + "string_decoder": "~1.0.0", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", + "tty-browserify": "~0.0.0", + "url": "~0.11.0", + "util": "~0.10.1", + "vm-browserify": "~0.0.1", + "xtend": "^4.0.0" + } + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.1.tgz", + "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "dev": true, + "requires": { + "js-sha3": "^0.3.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "browserslist": { + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-3.2.8.tgz", + "integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30000844", + "electron-to-chromium": "^1.3.47" + } + }, + "bs58": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-3.1.0.tgz", + "integrity": "sha1-1MJjiL9IBMrHFBQbGUWqR+XrJI4=", + "dev": true, + "requires": { + "base-x": "^1.1.0" + } + }, + "bs58check": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-1.3.4.tgz", + "integrity": "sha1-xSVABzdJEXcU+gQsMEfrj5FRy/g=", + "dev": true, + "requires": { + "bs58": "^3.1.0", + "create-hash": "^1.1.0" + } + }, + "buffer": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.1.0.tgz", + "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", + "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "byline": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/byline/-/byline-5.0.0.tgz", + "integrity": "sha1-dBxSFkaOrcRXsDQQEYrXfejB3bE=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "cached-path-relative": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.1.tgz", + "integrity": "sha1-0JxLUoAKpMB44t2BqGmqyQ0uVOc=", + "dev": true + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true, + "optional": true + }, + "camelcase-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz", + "integrity": "sha1-oqpfsa9oh1glnDLBQUJteJI7m3c=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "map-obj": "^2.0.0", + "quick-lru": "^1.0.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + }, + "caniuse-lite": { + "version": "1.0.30000861", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000861.tgz", + "integrity": "sha512-aeEQ4kyd41qCl8XFbCjWgVBI3EOd66M9sC43MFn0kuD/vcrNqvoIAlKon4xdp8yMCYvVjdCltI3lgArj8I6cNA==", + "dev": true + }, + "capture-stack-trace": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.0.tgz", + "integrity": "sha1-Sm+gc5nCa7pH8LJJa00PtAjFVQ0=", + "dev": true + }, + "caseless": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz", + "integrity": "sha1-cVuW6phBWTzDMGeSP17GDr2k99c=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "dev": true, + "requires": { + "assertion-error": "^1.0.1", + "check-error": "^1.0.1", + "deep-eql": "^3.0.0", + "get-func-name": "^2.0.0", + "pathval": "^1.0.0", + "type-detect": "^4.0.0" + } + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "ci-info": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.1.3.tgz", + "integrity": "sha512-SK/846h/Rcy8q9Z9CAwGBLfCJ6EkjJWdpelWDufQpqVDYq2Wnnv8zlSO6AMQap02jvhVruKKpEtQOufo3pFhLg==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cli": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cli/-/cli-1.0.1.tgz", + "integrity": "sha1-IoF1NPJL+klQw01TLUjsvGIbjBQ=", + "dev": true, + "requires": { + "exit": "0.1.2", + "glob": "^7.1.1" + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "^2.0.0" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "optional": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true, + "optional": true + } + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "clone-stats": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "integrity": "sha1-uI+UqCzzi4eR1YBG6kAprYjKmdE=", + "dev": true + }, + "cmd-shim": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-2.0.2.tgz", + "integrity": "sha1-b8vamUg6j9FdfTChlspp1oii79s=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "mkdirp": "~0.5.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "coinstring": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/coinstring/-/coinstring-2.3.0.tgz", + "integrity": "sha1-zbYzY6lhUCQEolr7gsLibV/2J6Q=", + "dev": true, + "requires": { + "bs58": "^2.0.1", + "create-hash": "^1.1.1" + }, + "dependencies": { + "bs58": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-2.0.1.tgz", + "integrity": "sha1-VZCNWPGYKrogCPob7Y+RmYopv40=", + "dev": true + } + } + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "dev": true, + "requires": { + "color-name": "1.1.1" + } + }, + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", + "dev": true + }, + "color-support": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", + "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", + "dev": true + }, + "columnify": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz", + "integrity": "sha1-Rzfd8ce2mop8NAVweC6UfuyOeLs=", + "dev": true, + "requires": { + "strip-ansi": "^3.0.0", + "wcwidth": "^1.0.0" + } + }, + "combine-source-map": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", + "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", + "dev": true, + "requires": { + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" + } + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "command-join": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/command-join/-/command-join-2.0.0.tgz", + "integrity": "sha1-Uui5hPSHLZUv8b3IuYOX0nxxRM8=", + "dev": true + }, + "commander": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==", + "dev": true + }, + "compare-func": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/compare-func/-/compare-func-1.3.2.tgz", + "integrity": "sha1-md0LpFfh+bxyKxLAjsM+6rMfpkg=", + "dev": true, + "requires": { + "array-ify": "^1.0.0", + "dot-prop": "^3.0.0" + } + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz", + "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "~2.0.0", + "typedarray": "~0.0.5" + }, + "dependencies": { + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "readable-stream": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "^0.1.4" + } + }, + "console-control-strings": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "dev": true + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "conventional-changelog": { + "version": "1.1.24", + "resolved": "https://registry.npmjs.org/conventional-changelog/-/conventional-changelog-1.1.24.tgz", + "integrity": "sha512-2WcSUst4Y3Z4hHvoMTWXMJr/DmgVdLiMOVY1Kak2LfFz+GIz2KDp5naqbFesYbfXPmaZ5p491dO0FWZIJoJw1Q==", + "dev": true, + "requires": { + "conventional-changelog-angular": "^1.6.6", + "conventional-changelog-atom": "^0.2.8", + "conventional-changelog-codemirror": "^0.3.8", + "conventional-changelog-core": "^2.0.11", + "conventional-changelog-ember": "^0.3.12", + "conventional-changelog-eslint": "^1.0.9", + "conventional-changelog-express": "^0.3.6", + "conventional-changelog-jquery": "^0.1.0", + "conventional-changelog-jscs": "^0.1.0", + "conventional-changelog-jshint": "^0.3.8", + "conventional-changelog-preset-loader": "^1.1.8" + } + }, + "conventional-changelog-angular": { + "version": "1.6.6", + "resolved": "https://registry.npmjs.org/conventional-changelog-angular/-/conventional-changelog-angular-1.6.6.tgz", + "integrity": "sha512-suQnFSqCxRwyBxY68pYTsFkG0taIdinHLNEAX5ivtw8bCRnIgnpvcHmlR/yjUyZIrNPYAoXlY1WiEKWgSE4BNg==", + "dev": true, + "requires": { + "compare-func": "^1.3.1", + "q": "^1.5.1" + } + }, + "conventional-changelog-atom": { + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-atom/-/conventional-changelog-atom-0.2.8.tgz", + "integrity": "sha512-8pPZqhMbrnltNBizjoDCb/Sz85KyUXNDQxuAEYAU5V/eHn0okMBVjqc8aHWYpHrytyZWvMGbayOlDv7i8kEf6g==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-cli": { + "version": "1.3.22", + "resolved": "https://registry.npmjs.org/conventional-changelog-cli/-/conventional-changelog-cli-1.3.22.tgz", + "integrity": "sha512-pnjdIJbxjkZ5VdAX/H1wndr1G10CY8MuZgnXuJhIHglOXfIrXygb7KZC836GW9uo1u8PjEIvIw/bKX0lOmOzZg==", + "dev": true, + "requires": { + "add-stream": "^1.0.0", + "conventional-changelog": "^1.1.24", + "lodash": "^4.2.1", + "meow": "^4.0.0", + "tempfile": "^1.1.1" + } + }, + "conventional-changelog-codemirror": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-codemirror/-/conventional-changelog-codemirror-0.3.8.tgz", + "integrity": "sha512-3HFZKtBXTaUCHvz7ai6nk2+psRIkldDoNzCsom0egDtVmPsvvHZkzjynhdQyULfacRSsBTaiQ0ol6nBOL4dDiQ==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-core": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/conventional-changelog-core/-/conventional-changelog-core-2.0.11.tgz", + "integrity": "sha512-HvTE6RlqeEZ/NFPtQeFLsIDOLrGP3bXYr7lFLMhCVsbduF1MXIe8OODkwMFyo1i9ku9NWBwVnVn0jDmIFXjDRg==", + "dev": true, + "requires": { + "conventional-changelog-writer": "^3.0.9", + "conventional-commits-parser": "^2.1.7", + "dateformat": "^3.0.0", + "get-pkg-repo": "^1.0.0", + "git-raw-commits": "^1.3.6", + "git-remote-origin-url": "^2.0.0", + "git-semver-tags": "^1.3.6", + "lodash": "^4.2.1", + "normalize-package-data": "^2.3.5", + "q": "^1.5.1", + "read-pkg": "^1.1.0", + "read-pkg-up": "^1.0.1", + "through2": "^2.0.0" + }, + "dependencies": { + "dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "conventional-changelog-ember": { + "version": "0.3.12", + "resolved": "https://registry.npmjs.org/conventional-changelog-ember/-/conventional-changelog-ember-0.3.12.tgz", + "integrity": "sha512-mmJzA7uzbrOqeF89dMMi6z17O07ORTXlTMArnLG9ZTX4oLaKNolUlxFUFlFm9JUoVWajVpaHQWjxH1EOQ+ARoQ==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-eslint": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-eslint/-/conventional-changelog-eslint-1.0.9.tgz", + "integrity": "sha512-h87nfVh2fdk9fJIvz26wCBsbDC/KxqCc5wSlNMZbXcARtbgNbNDIF7Y7ctokFdnxkzVdaHsbINkh548T9eBA7Q==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-express": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/conventional-changelog-express/-/conventional-changelog-express-0.3.6.tgz", + "integrity": "sha512-3iWVtBJZ9RnRnZveNDzOD8QRn6g6vUif0qVTWWyi5nUIAbuN1FfPVyKdAlJJfp5Im+dE8Kiy/d2SpaX/0X678Q==", + "dev": true, + "requires": { + "q": "^1.5.1" + } + }, + "conventional-changelog-jquery": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-jquery/-/conventional-changelog-jquery-0.1.0.tgz", + "integrity": "sha1-Agg5cWLjhGmG5xJztsecW1+A9RA=", + "dev": true, + "requires": { + "q": "^1.4.1" + } + }, + "conventional-changelog-jscs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/conventional-changelog-jscs/-/conventional-changelog-jscs-0.1.0.tgz", + "integrity": "sha1-BHnrRDzH1yxYvwvPDvHURKkvDlw=", + "dev": true, + "requires": { + "q": "^1.4.1" + } + }, + "conventional-changelog-jshint": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-jshint/-/conventional-changelog-jshint-0.3.8.tgz", + "integrity": "sha512-hn9QU4ZI/5V50wKPJNPGT4gEWgiBFpV6adieILW4MaUFynuDYOvQ71EMSj3EznJyKi/KzuXpc9dGmX8njZMjig==", + "dev": true, + "requires": { + "compare-func": "^1.3.1", + "q": "^1.5.1" + } + }, + "conventional-changelog-preset-loader": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/conventional-changelog-preset-loader/-/conventional-changelog-preset-loader-1.1.8.tgz", + "integrity": "sha512-MkksM4G4YdrMlT2MbTsV2F6LXu/hZR0Tc/yenRrDIKRwBl/SP7ER4ZDlglqJsCzLJi4UonBc52Bkm5hzrOVCcw==", + "dev": true + }, + "conventional-changelog-writer": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/conventional-changelog-writer/-/conventional-changelog-writer-3.0.9.tgz", + "integrity": "sha512-n9KbsxlJxRQsUnK6wIBRnARacvNnN4C/nxnxCkH+B/R1JS2Fa+DiP1dU4I59mEDEjgnFaN2+9wr1P1s7GYB5/Q==", + "dev": true, + "requires": { + "compare-func": "^1.3.1", + "conventional-commits-filter": "^1.1.6", + "dateformat": "^3.0.0", + "handlebars": "^4.0.2", + "json-stringify-safe": "^5.0.1", + "lodash": "^4.2.1", + "meow": "^4.0.0", + "semver": "^5.5.0", + "split": "^1.0.0", + "through2": "^2.0.0" + }, + "dependencies": { + "dateformat": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-3.0.3.tgz", + "integrity": "sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==", + "dev": true + } + } + }, + "conventional-commits-filter": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/conventional-commits-filter/-/conventional-commits-filter-1.1.6.tgz", + "integrity": "sha512-KcDgtCRKJCQhyk6VLT7zR+ZOyCnerfemE/CsR3iQpzRRFbLEs0Y6rwk3mpDvtOh04X223z+1xyJ582Stfct/0Q==", + "dev": true, + "requires": { + "is-subset": "^0.1.1", + "modify-values": "^1.0.0" + } + }, + "conventional-commits-parser": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-2.1.7.tgz", + "integrity": "sha512-BoMaddIEJ6B4QVMSDu9IkVImlGOSGA1I2BQyOZHeLQ6qVOJLcLKn97+fL6dGbzWEiqDzfH4OkcveULmeq2MHFQ==", + "dev": true, + "requires": { + "JSONStream": "^1.0.4", + "is-text-path": "^1.0.0", + "lodash": "^4.2.1", + "meow": "^4.0.0", + "split2": "^2.0.0", + "through2": "^2.0.0", + "trim-off-newlines": "^1.0.0" + } + }, + "conventional-recommended-bump": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/conventional-recommended-bump/-/conventional-recommended-bump-1.2.1.tgz", + "integrity": "sha512-oJjG6DkRgtnr/t/VrPdzmf4XZv8c4xKVJrVT4zrSHd92KEL+EYxSbYoKq8lQ7U5yLMw7130wrcQTLRjM/T+d4w==", + "dev": true, + "requires": { + "concat-stream": "^1.4.10", + "conventional-commits-filter": "^1.1.1", + "conventional-commits-parser": "^2.1.1", + "git-raw-commits": "^1.3.0", + "git-semver-tags": "^1.3.0", + "meow": "^3.3.0", + "object-assign": "^4.0.1" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + } + } + }, + "convert-source-map": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", + "dev": true + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.5.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", + "integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw==", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "coveralls": { + "version": "2.13.3", + "resolved": "https://registry.npmjs.org/coveralls/-/coveralls-2.13.3.tgz", + "integrity": "sha512-iiAmn+l1XqRwNLXhW8Rs5qHZRFMYp9ZIPjEOVRpC/c4so6Y/f4/lFi0FfR5B9cCqgyhkJ5cZmbvcVRfP8MHchw==", + "dev": true, + "requires": { + "js-yaml": "3.6.1", + "lcov-parse": "0.0.10", + "log-driver": "1.2.5", + "minimist": "1.2.0", + "request": "2.79.0" + } + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "^1.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + } + } + }, + "cryptiles": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "dev": true, + "requires": { + "boom": "2.x.x" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "crypto-js": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-3.1.8.tgz", + "integrity": "sha1-cV8HC/YBTyrpkqmLOSkli3E/CNU=", + "dev": true + }, + "currently-unhandled": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz", + "integrity": "sha1-mI3zP+qxke95mmE2nddsF635V+o=", + "dev": true, + "requires": { + "array-find-index": "^1.0.1" + } + }, + "dargs": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/dargs/-/dargs-4.1.0.tgz", + "integrity": "sha1-A6nbtLXC8Tm/FK5T8LiipqhvThc=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "dateformat": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-2.2.0.tgz", + "integrity": "sha1-QGXiATz5+5Ft39gu+1Bq1MZ2kGI=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decamelize-keys": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.0.tgz", + "integrity": "sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=", + "dev": true, + "requires": { + "decamelize": "^1.1.0", + "map-obj": "^1.0.0" + }, + "dependencies": { + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + } + } + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "dedent": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", + "integrity": "sha1-JJXduvbrh0q7Dhvp3yLS5aVEMmw=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "del": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-3.0.0.tgz", + "integrity": "sha1-U+z2mf/LyzljdpGrE7rxYIGXZuU=", + "dev": true, + "requires": { + "globby": "^6.1.0", + "is-path-cwd": "^1.0.0", + "is-path-in-cwd": "^1.0.0", + "p-map": "^1.1.1", + "pify": "^3.0.0", + "rimraf": "^2.2.8" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "delegates": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "dev": true + }, + "deprecated": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/deprecated/-/deprecated-0.0.1.tgz", + "integrity": "sha1-+cmvVGSvoeepcUWKi97yqpTVuxk=", + "dev": true + }, + "deps-sort": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", + "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "shasum": "^1.0.0", + "subarg": "^1.0.0", + "through2": "^2.0.0" + } + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "detect-file": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", + "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "detective": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", + "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", + "dev": true, + "requires": { + "acorn": "^5.2.1", + "defined": "^1.0.0" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "dev": true + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "dom-serializer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", + "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", + "dev": true, + "requires": { + "domelementtype": "~1.1.1", + "entities": "~1.1.1" + }, + "dependencies": { + "domelementtype": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", + "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", + "dev": true + }, + "entities": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", + "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", + "dev": true + } + } + }, + "domain-browser": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", + "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=", + "dev": true + }, + "domelementtype": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", + "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", + "dev": true + }, + "domhandler": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", + "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", + "dev": true, + "requires": { + "domelementtype": "1" + } + }, + "domutils": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", + "dev": true, + "requires": { + "dom-serializer": "0", + "domelementtype": "1" + } + }, + "dot-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-3.0.0.tgz", + "integrity": "sha1-G3CK8JSknJoOfbyteQq6U52sEXc=", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "drbg.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", + "dev": true, + "requires": { + "browserify-aes": "^1.0.6", + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4" + } + }, + "duplexer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", + "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=", + "dev": true + }, + "duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "dev": true, + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "electron-to-chromium": { + "version": "1.3.50", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.50.tgz", + "integrity": "sha1-dDi3b5K0G5GfP73TUPvQdX2s3fc=", + "dev": true + }, + "elliptic": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", + "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "end-of-stream": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz", + "integrity": "sha1-jhdyBsPICDfYVjLouTWd/osvbq8=", + "dev": true, + "requires": { + "once": "~1.3.0" + }, + "dependencies": { + "once": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", + "integrity": "sha1-suJhVXzkwxTsgwTz+oJmPkKXyiA=", + "dev": true, + "requires": { + "wrappy": "1" + } + } + } + }, + "entities": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", + "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=", + "dev": true + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "escodegen": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", + "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "dev": true, + "requires": { + "esprima": "^2.7.1", + "estraverse": "^1.9.1", + "esutils": "^2.0.2", + "optionator": "^0.8.1", + "source-map": "~0.2.0" + }, + "dependencies": { + "source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", + "dev": true, + "optional": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "estraverse": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", + "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "ethereumjs-util": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz", + "integrity": "sha1-PpQosxfuvaPXJg2FT93alUsfG8Y=", + "dev": true, + "requires": { + "bn.js": "^4.8.0", + "create-hash": "^1.1.2", + "keccakjs": "^0.2.0", + "rlp": "^2.0.0", + "secp256k1": "^3.0.1" + } + }, + "ethereumjs-wallet": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz", + "integrity": "sha1-gnY7Fpfuenlr5xVdqd+0my+Yz9s=", + "dev": true, + "requires": { + "aes-js": "^0.2.3", + "bs58check": "^1.0.8", + "ethereumjs-util": "^4.4.0", + "hdkey": "^0.7.0", + "scrypt.js": "^0.2.0", + "utf8": "^2.1.1", + "uuid": "^2.0.1" + }, + "dependencies": { + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", + "dev": true + } + } + }, + "ethjs-signer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ethjs-signer/-/ethjs-signer-0.1.1.tgz", + "integrity": "sha1-Cvd5YeKe5FhgOqvTZguIaNM4ZEE=", + "dev": true, + "requires": { + "elliptic": "6.3.2", + "js-sha3": "0.5.5", + "number-to-bn": "1.1.0", + "rlp": "2.0.0", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "elliptic": { + "version": "6.3.2", + "resolved": "http://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz", + "integrity": "sha1-5MgeCCnPCmWrcOmYuCMnI7XBvEg=", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + } + }, + "js-sha3": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.5.tgz", + "integrity": "sha1-uvDA6MVK1ZA0R9+Wreekobynmko=", + "dev": true + }, + "rlp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.0.0.tgz", + "integrity": "sha1-nbOE/0uJqPYVY9kjldhiWxjzr7A=", + "dev": true + } + } + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "execa": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.8.0.tgz", + "integrity": "sha1-2NdrvBtVIX7RkP1t1J08d07PyNo=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "exorcist": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/exorcist/-/exorcist-0.4.0.tgz", + "integrity": "sha1-EjD/3t2SSPQvvM+LSkTUyrKePGQ=", + "dev": true, + "requires": { + "minimist": "0.0.5", + "mold-source-map": "~0.4.0", + "nave": "~0.5.1" + }, + "dependencies": { + "minimist": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz", + "integrity": "sha1-16oye87PUY+RBqxrjwA/o7zqhWY=", + "dev": true + } + } + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-tilde": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", + "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", + "dev": true, + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "external-editor": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", + "dev": true + }, + "fancy-log": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fancy-log/-/fancy-log-1.3.2.tgz", + "integrity": "sha1-9BEl49hPLn2JpD0G2VjI94vha+E=", + "dev": true, + "requires": { + "ansi-gray": "^0.1.1", + "color-support": "^1.1.3", + "time-stamp": "^1.0.0" + } + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5" + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "find-index": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", + "integrity": "sha1-Z101iyyjiS15Whq0cjL4tuLg3eQ=", + "dev": true + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "findup-sync": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-2.0.0.tgz", + "integrity": "sha1-kyaxSIwi0aYIhlCoaQGy2akKLLw=", + "dev": true, + "requires": { + "detect-file": "^1.0.0", + "is-glob": "^3.1.0", + "micromatch": "^3.0.4", + "resolve-dir": "^1.0.1" + } + }, + "fined": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fined/-/fined-1.1.0.tgz", + "integrity": "sha1-s33IRLdqL15wgeiE98CuNE8VNHY=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "is-plain-object": "^2.0.3", + "object.defaults": "^1.1.0", + "object.pick": "^1.2.0", + "parse-filepath": "^1.0.1" + } + }, + "first-chunk-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/first-chunk-stream/-/first-chunk-stream-1.0.0.tgz", + "integrity": "sha1-Wb+1DNkF9g18OUzT2ayqtOatk04=", + "dev": true + }, + "flagged-respawn": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/flagged-respawn/-/flagged-respawn-1.0.0.tgz", + "integrity": "sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c=", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-1.0.0.tgz", + "integrity": "sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "dev": true + }, + "form-data": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs-extra": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", + "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + } + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "gauge": { + "version": "2.7.4", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "dev": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "gaze": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/gaze/-/gaze-0.5.2.tgz", + "integrity": "sha1-QLcJU30k0dRXZ9takIaJ3+aaxE8=", + "dev": true, + "requires": { + "globule": "~0.1.0" + } + }, + "generate-function": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", + "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", + "dev": true + }, + "generate-object-property": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", + "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", + "dev": true, + "requires": { + "is-property": "^1.0.0" + } + }, + "get-assigned-identifiers": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", + "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==", + "dev": true + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-pkg-repo": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", + "integrity": "sha1-xztInAbYDMVTbCyFP54FIyBWly0=", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "meow": "^3.3.0", + "normalize-package-data": "^2.3.0", + "parse-github-repo-url": "^1.3.0", + "through2": "^2.0.0" + }, + "dependencies": { + "camelcase": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-2.1.1.tgz", + "integrity": "sha1-fB0W1nmhu+WcoCys7PsBHiAfWh8=", + "dev": true + }, + "camelcase-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz", + "integrity": "sha1-MIvur/3ygRkFHvodkyITyRuPkuc=", + "dev": true, + "requires": { + "camelcase": "^2.0.0", + "map-obj": "^1.0.0" + } + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "map-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", + "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", + "dev": true + }, + "meow": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-3.7.0.tgz", + "integrity": "sha1-cstmi0JSKCkKu/qFaJJYcwioAfs=", + "dev": true, + "requires": { + "camelcase-keys": "^2.0.0", + "decamelize": "^1.1.2", + "loud-rejection": "^1.0.0", + "map-obj": "^1.0.1", + "minimist": "^1.1.3", + "normalize-package-data": "^2.3.4", + "object-assign": "^4.0.1", + "read-pkg-up": "^1.0.1", + "redent": "^1.0.0", + "trim-newlines": "^1.0.0" + } + }, + "redent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-1.0.0.tgz", + "integrity": "sha1-z5Fqsf1fHxbfsggi3W7H9zDCr94=", + "dev": true, + "requires": { + "indent-string": "^2.1.0", + "strip-indent": "^1.0.1" + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "dev": true, + "requires": { + "get-stdin": "^4.0.1" + } + }, + "trim-newlines": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz", + "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", + "dev": true + } + } + }, + "get-port": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz", + "integrity": "sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw=", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "git-raw-commits": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-1.3.6.tgz", + "integrity": "sha512-svsK26tQ8vEKnMshTDatSIQSMDdz8CxIIqKsvPqbtV23Etmw6VNaFAitu8zwZ0VrOne7FztwPyRLxK7/DIUTQg==", + "dev": true, + "requires": { + "dargs": "^4.0.1", + "lodash.template": "^4.0.2", + "meow": "^4.0.0", + "split2": "^2.0.0", + "through2": "^2.0.0" + }, + "dependencies": { + "lodash.template": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz", + "integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0", + "lodash.templatesettings": "^4.0.0" + } + }, + "lodash.templatesettings": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz", + "integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=", + "dev": true, + "requires": { + "lodash._reinterpolate": "~3.0.0" + } + } + } + }, + "git-remote-origin-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", + "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", + "dev": true, + "requires": { + "gitconfiglocal": "^1.0.0", + "pify": "^2.3.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "git-semver-tags": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/git-semver-tags/-/git-semver-tags-1.3.6.tgz", + "integrity": "sha512-2jHlJnln4D/ECk9FxGEBh3k44wgYdWjWDtMmJPaecjoRmxKo3Y1Lh8GMYuOPu04CHw86NTAODchYjC5pnpMQig==", + "dev": true, + "requires": { + "meow": "^4.0.0", + "semver": "^5.5.0" + } + }, + "gitconfiglocal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", + "integrity": "sha1-QdBF84UaXqiPA/JMocYXgRRGS5s=", + "dev": true, + "requires": { + "ini": "^1.3.2" + } + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", + "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", + "dev": true, + "requires": { + "is-glob": "^3.1.0", + "path-dirname": "^1.0.0" + } + }, + "glob-stream": { + "version": "3.1.18", + "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-3.1.18.tgz", + "integrity": "sha1-kXCl8St5Awb9/lmPMT+PeVT9FDs=", + "dev": true, + "requires": { + "glob": "^4.3.1", + "glob2base": "^0.0.12", + "minimatch": "^2.0.1", + "ordered-read-streams": "^0.1.0", + "through2": "^0.6.1", + "unique-stream": "^1.0.0" + }, + "dependencies": { + "glob": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-4.5.3.tgz", + "integrity": "sha1-xstz0yJsHv7wTePFbQEvAzd+4V8=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^2.0.1", + "once": "^1.3.0" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "minimatch": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", + "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "dev": true, + "requires": { + "brace-expansion": "^1.0.0" + } + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "dev": true, + "requires": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + } + } + } + }, + "glob-watcher": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/glob-watcher/-/glob-watcher-0.0.6.tgz", + "integrity": "sha1-uVtKjfdLOcgymLDAXJeLTZo7cQs=", + "dev": true, + "requires": { + "gaze": "^0.5.1" + } + }, + "glob2base": { + "version": "0.0.12", + "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", + "integrity": "sha1-nUGbPijxLoOjYhZKJ3BVkiycDVY=", + "dev": true, + "requires": { + "find-index": "^0.1.1" + } + }, + "global-modules": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", + "dev": true, + "requires": { + "global-prefix": "^1.0.1", + "is-windows": "^1.0.1", + "resolve-dir": "^1.0.0" + } + }, + "global-prefix": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", + "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.2", + "homedir-polyfill": "^1.0.1", + "ini": "^1.3.4", + "is-windows": "^1.0.1", + "which": "^1.2.14" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", + "dev": true, + "requires": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "dependencies": { + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + } + } + }, + "globule": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/globule/-/globule-0.1.0.tgz", + "integrity": "sha1-2cjt3h2nnRJaFRt5UzuXhnY0auU=", + "dev": true, + "requires": { + "glob": "~3.1.21", + "lodash": "~1.0.1", + "minimatch": "~0.2.11" + }, + "dependencies": { + "glob": { + "version": "3.1.21", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.1.21.tgz", + "integrity": "sha1-0p4KBV3qUTj00H7UDomC6DwgZs0=", + "dev": true, + "requires": { + "graceful-fs": "~1.2.0", + "inherits": "1", + "minimatch": "~0.2.11" + } + }, + "graceful-fs": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.3.tgz", + "integrity": "sha1-FaSAaldUfLLS2/J/QuiajDRRs2Q=", + "dev": true + }, + "inherits": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz", + "integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js=", + "dev": true + }, + "lodash": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz", + "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE=", + "dev": true + }, + "minimatch": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz", + "integrity": "sha1-x054BXT2PG+aCQ6Q775u9TpqdWo=", + "dev": true, + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + } + } + }, + "glogg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/glogg/-/glogg-1.0.1.tgz", + "integrity": "sha512-ynYqXLoluBKf9XGR1gA59yEJisIL7YHEH4xr3ZziHB5/yl4qWfaK8Js9jGe6gBGCSCKVqiyO30WnRZADvemUNw==", + "dev": true, + "requires": { + "sparkles": "^1.0.0" + } + }, + "got": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "^3.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-redirect": "^1.0.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "lowercase-keys": "^1.0.0", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "unzip-response": "^2.0.1", + "url-parse-lax": "^1.0.0" + } + }, + "graceful-fs": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-3.0.11.tgz", + "integrity": "sha1-dhPHeKGv6mLyXGMKCG1/Osu92Bg=", + "dev": true, + "requires": { + "natives": "^1.1.0" + } + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "gulp": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/gulp/-/gulp-3.9.1.tgz", + "integrity": "sha1-VxzkWSjdQK9lFPxAEYZgFsE4RbQ=", + "dev": true, + "requires": { + "archy": "^1.0.0", + "chalk": "^1.0.0", + "deprecated": "^0.0.1", + "gulp-util": "^3.0.0", + "interpret": "^1.0.0", + "liftoff": "^2.1.0", + "minimist": "^1.1.0", + "orchestrator": "^0.3.0", + "pretty-hrtime": "^1.0.0", + "semver": "^4.1.0", + "tildify": "^1.0.0", + "v8flags": "^2.0.2", + "vinyl-fs": "^0.3.0" + }, + "dependencies": { + "semver": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", + "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", + "dev": true + } + } + }, + "gulp-babel": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/gulp-babel/-/gulp-babel-6.1.3.tgz", + "integrity": "sha512-tm15R3rt4gO59WXCuqrwf4QXJM9VIJC+0J2NPYSC6xZn+cZRD5y5RPGAiHaDxCJq7Rz5BDljlrk3cEjWADF+wQ==", + "dev": true, + "requires": { + "babel-core": "^6.23.1", + "object-assign": "^4.0.1", + "plugin-error": "^1.0.1", + "replace-ext": "0.0.1", + "through2": "^2.0.0", + "vinyl-sourcemaps-apply": "^0.2.0" + } + }, + "gulp-jshint": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/gulp-jshint/-/gulp-jshint-2.1.0.tgz", + "integrity": "sha512-sP3NK8Y/1e58O0PH9t6s7DAr/lKDSUbIY207oWSeufM6/VclB7jJrIBcPCsyhrFTCDUl9DauePbt6VqP2vPM5w==", + "dev": true, + "requires": { + "lodash": "^4.12.0", + "minimatch": "^3.0.3", + "plugin-error": "^0.1.2", + "rcloader": "^0.2.2", + "through2": "^2.0.0" + }, + "dependencies": { + "arr-diff": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-1.1.0.tgz", + "integrity": "sha1-aHwydYFjWI/vfeezb6vklesaOZo=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1", + "array-slice": "^0.2.3" + } + }, + "arr-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-2.1.0.tgz", + "integrity": "sha1-IPnqtexw9cfSFbEHexw5Fh0pLH0=", + "dev": true + }, + "array-slice": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", + "integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=", + "dev": true + }, + "extend-shallow": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-1.1.4.tgz", + "integrity": "sha1-Gda/lN/AnXa6cR85uHLSH/TdkHE=", + "dev": true, + "requires": { + "kind-of": "^1.1.0" + } + }, + "kind-of": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", + "dev": true + }, + "plugin-error": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-0.1.2.tgz", + "integrity": "sha1-O5uzM1zPAPQl4HQ34ZJ2ln2kes4=", + "dev": true, + "requires": { + "ansi-cyan": "^0.1.1", + "ansi-red": "^0.1.1", + "arr-diff": "^1.0.1", + "arr-union": "^2.0.1", + "extend-shallow": "^1.1.2" + } + } + } + }, + "gulp-rename": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.3.0.tgz", + "integrity": "sha512-nEuZB7/9i0IZ8AXORTizl2QLP9tcC9uWc/s329zElBLJw1CfOhmMXBxwVlCRKjDyrWuhVP0uBKl61KeQ32TiCg==", + "dev": true + }, + "gulp-replace": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/gulp-replace/-/gulp-replace-0.6.1.tgz", + "integrity": "sha1-Eb+Mj85TPjPi9qjy9DC5VboL4GY=", + "dev": true, + "requires": { + "istextorbinary": "1.0.2", + "readable-stream": "^2.0.1", + "replacestream": "^4.0.0" + } + }, + "gulp-streamify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/gulp-streamify/-/gulp-streamify-1.0.2.tgz", + "integrity": "sha1-ANazgU1IbAiPeHOO0HZqvBY4nk0=", + "dev": true, + "requires": { + "plexer": "1.0.1" + } + }, + "gulp-uglify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/gulp-uglify/-/gulp-uglify-3.0.0.tgz", + "integrity": "sha1-DfAzHXKg0wLj434QlIXd3zPG0co=", + "dev": true, + "requires": { + "gulplog": "^1.0.0", + "has-gulplog": "^0.1.0", + "lodash": "^4.13.1", + "make-error-cause": "^1.1.1", + "through2": "^2.0.0", + "uglify-js": "^3.0.5", + "vinyl-sourcemaps-apply": "^0.2.0" + } + }, + "gulp-util": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.8.tgz", + "integrity": "sha1-AFTh50RQLifATBh8PsxQXdVLu08=", + "dev": true, + "requires": { + "array-differ": "^1.0.0", + "array-uniq": "^1.0.2", + "beeper": "^1.0.0", + "chalk": "^1.0.0", + "dateformat": "^2.0.0", + "fancy-log": "^1.1.0", + "gulplog": "^1.0.0", + "has-gulplog": "^0.1.0", + "lodash._reescape": "^3.0.0", + "lodash._reevaluate": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.template": "^3.0.0", + "minimist": "^1.1.0", + "multipipe": "^0.1.2", + "object-assign": "^3.0.0", + "replace-ext": "0.0.1", + "through2": "^2.0.0", + "vinyl": "^0.5.0" + }, + "dependencies": { + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=", + "dev": true + } + } + }, + "gulplog": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/gulplog/-/gulplog-1.0.0.tgz", + "integrity": "sha1-4oxNRdBey77YGDY86PnFkmIp/+U=", + "dev": true, + "requires": { + "glogg": "^1.0.0" + } + }, + "handlebars": { + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz", + "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=", + "dev": true, + "requires": { + "async": "^1.4.0", + "optimist": "^0.6.1", + "source-map": "^0.4.4", + "uglify-js": "^2.6" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + }, + "uglify-js": { + "version": "2.8.29", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", + "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=", + "dev": true, + "optional": true, + "requires": { + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "optional": true + } + } + } + } + }, + "har-validator": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-2.0.6.tgz", + "integrity": "sha1-zcvAgYgmWtEZtqWnyKtw7s+10n0=", + "dev": true, + "requires": { + "chalk": "^1.1.1", + "commander": "^2.9.0", + "is-my-json-valid": "^2.12.4", + "pinkie-promise": "^2.0.0" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "has-gulplog": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/has-gulplog/-/has-gulplog-0.1.0.tgz", + "integrity": "sha1-ZBTIKRNpfaUVkDl9r7EvIpZ4Ec4=", + "dev": true, + "requires": { + "sparkles": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash.js": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.4.tgz", + "integrity": "sha512-A6RlQvvZEtFS5fLU43IDu0QUmBy+fDO9VMdTXvufKwIkt/rFfvICAViCax5fbDO4zdNzaC3/27ZhKUok5bAJyw==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "hawk": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "dev": true, + "requires": { + "boom": "2.x.x", + "cryptiles": "2.x.x", + "hoek": "2.x.x", + "sntp": "1.x.x" + } + }, + "hdkey": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/hdkey/-/hdkey-0.7.1.tgz", + "integrity": "sha1-yu5L6BqneSHpCbjSKN0PKayu5jI=", + "dev": true, + "requires": { + "coinstring": "^2.0.0", + "secp256k1": "^3.0.1" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hoek": { + "version": "2.16.3", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" + } + }, + "homedir-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", + "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "dev": true, + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "hosted-git-info": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.1.tgz", + "integrity": "sha512-Ba4+0M4YvIDUUsprMjhVTU1yN9F2/LJSAl69ZpzaLT4l4j5mwTS6jqqW9Ojvj6lKz/veqPzpJBqGbXspOb533A==", + "dev": true + }, + "htmlescape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", + "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", + "dev": true + }, + "htmlparser2": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", + "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", + "dev": true, + "requires": { + "domelementtype": "1", + "domhandler": "2.3", + "domutils": "1.5", + "entities": "1.0", + "readable-stream": "1.1" + }, + "dependencies": { + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "http-signature": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "dev": true, + "requires": { + "assert-plus": "^0.2.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "iconv-lite": { + "version": "0.4.23", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", + "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indent-string": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-3.2.0.tgz", + "integrity": "sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "inline-source-map": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", + "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", + "dev": true, + "requires": { + "source-map": "~0.5.3" + } + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.0.4", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rx-lite": "^4.0.8", + "rx-lite-aggregates": "^4.0.8", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "insert-module-globals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.0.tgz", + "integrity": "sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "acorn-node": "^1.5.2", + "combine-source-map": "^0.8.0", + "concat-stream": "^1.6.1", + "is-buffer": "^1.1.0", + "path-is-absolute": "^1.0.1", + "process": "~0.11.0", + "through2": "^2.0.0", + "undeclared-identifiers": "^1.1.2", + "xtend": "^4.0.0" + }, + "dependencies": { + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + } + } + }, + "interpret": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", + "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", + "dev": true + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-absolute": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", + "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", + "dev": true, + "requires": { + "is-relative": "^1.0.0", + "is-windows": "^1.0.1" + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "^1.0.0" + } + }, + "is-ci": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.1.0.tgz", + "integrity": "sha512-c7TnwxLePuqIlxHgr7xtxzycJPegNHFuIrBkwbf8hc58//+Op1CqFkyS+xnIMkwn9UsJIwc174BIjkyBmSpjKg==", + "dev": true, + "requires": { + "ci-info": "^1.0.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "dev": true, + "requires": { + "is-extglob": "^2.1.0" + } + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=", + "dev": true + }, + "is-my-ip-valid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-my-ip-valid/-/is-my-ip-valid-1.0.0.tgz", + "integrity": "sha512-gmh/eWXROncUzRnIa1Ubrt5b8ep/MGSnfAUI3aRp+sqTCs1tv1Isl8d8F6JmkN3dXKc3ehZMrtiPN9eL03NuaQ==", + "dev": true + }, + "is-my-json-valid": { + "version": "2.17.2", + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.17.2.tgz", + "integrity": "sha512-IBhBslgngMQN8DDSppmgDv7RNrlFotuuDsKcrCP3+HbFaVivIBU7u9oiiErw8sH4ynx3+gOGQ3q2otkgiSi6kg==", + "dev": true, + "requires": { + "generate-function": "^2.0.0", + "generate-object-property": "^1.1.0", + "is-my-ip-valid": "^1.0.0", + "jsonpointer": "^4.0.0", + "xtend": "^4.0.0" + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "dev": true, + "requires": { + "is-path-inside": "^1.0.0" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "is-property": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", + "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", + "dev": true + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-relative": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", + "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", + "dev": true, + "requires": { + "is-unc-path": "^1.0.0" + } + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-subset": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-subset/-/is-subset-0.1.1.tgz", + "integrity": "sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY=", + "dev": true + }, + "is-text-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", + "integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=", + "dev": true, + "requires": { + "text-extensions": "^1.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-unc-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", + "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", + "dev": true, + "requires": { + "unc-path-regex": "^0.1.2" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "dev": true + }, + "istanbul": { + "version": "0.4.5", + "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", + "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "dev": true, + "requires": { + "abbrev": "1.0.x", + "async": "1.x", + "escodegen": "1.8.x", + "esprima": "2.7.x", + "glob": "^5.0.15", + "handlebars": "^4.0.1", + "js-yaml": "3.x", + "mkdirp": "0.5.x", + "nopt": "3.x", + "once": "1.x", + "resolve": "1.1.x", + "supports-color": "^3.1.0", + "which": "^1.1.1", + "wordwrap": "^1.0.0" + }, + "dependencies": { + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + } + } + }, + "istextorbinary": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-1.0.2.tgz", + "integrity": "sha1-rOGTVNGpoBc+/rEITOD4ewrX3s8=", + "dev": true, + "requires": { + "binaryextensions": "~1.0.0", + "textextensions": "~1.0.0" + } + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=", + "dev": true + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "js-yaml": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", + "integrity": "sha1-bl/mfYsgXOTSL60Ft3geja3MSzA=", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^2.6.0" + } + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "dev": true, + "optional": true + }, + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, + "jshint": { + "version": "2.9.5", + "resolved": "https://registry.npmjs.org/jshint/-/jshint-2.9.5.tgz", + "integrity": "sha1-HnJSkVzmgbQIJ+4UJIxG006apiw=", + "dev": true, + "requires": { + "cli": "~1.0.0", + "console-browserify": "1.1.x", + "exit": "0.1.x", + "htmlparser2": "3.8.x", + "lodash": "3.7.x", + "minimatch": "~3.0.2", + "shelljs": "0.3.x", + "strip-json-comments": "1.0.x" + }, + "dependencies": { + "lodash": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.7.0.tgz", + "integrity": "sha1-Nni9irmVBXwHreg27S7wh9qBHUU=", + "dev": true + } + } + }, + "json-parse-better-errors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", + "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", + "dev": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "dev": true + }, + "json-stable-stringify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", + "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true, + "optional": true + } + } + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "jsonpointer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", + "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", + "dev": true + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "dev": true, + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "dev": true, + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "labeled-stream-splicer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.1.tgz", + "integrity": "sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "isarray": "^2.0.4", + "stream-splicer": "^2.0.0" + }, + "dependencies": { + "isarray": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.4.tgz", + "integrity": "sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA==", + "dev": true + } + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true, + "optional": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true, + "requires": { + "invert-kv": "^1.0.0" + } + }, + "lcov-parse": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-0.0.10.tgz", + "integrity": "sha1-GwuP+ayceIklBYK3C3ExXZ2m2aM=", + "dev": true + }, + "lerna": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/lerna/-/lerna-2.11.0.tgz", + "integrity": "sha512-kgM6zwe2P2tR30MYvgiLLW+9buFCm6E7o8HnRlhTgm70WVBvXVhydqv+q/MF2HrVZkCawfVtCfetyQmtd4oHhQ==", + "dev": true, + "requires": { + "async": "^1.5.0", + "chalk": "^2.1.0", + "cmd-shim": "^2.0.2", + "columnify": "^1.5.4", + "command-join": "^2.0.0", + "conventional-changelog-cli": "^1.3.13", + "conventional-recommended-bump": "^1.2.1", + "dedent": "^0.7.0", + "execa": "^0.8.0", + "find-up": "^2.1.0", + "fs-extra": "^4.0.1", + "get-port": "^3.2.0", + "glob": "^7.1.2", + "glob-parent": "^3.1.0", + "globby": "^6.1.0", + "graceful-fs": "^4.1.11", + "hosted-git-info": "^2.5.0", + "inquirer": "^3.2.2", + "is-ci": "^1.0.10", + "load-json-file": "^4.0.0", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "npmlog": "^4.1.2", + "p-finally": "^1.0.0", + "package-json": "^4.0.1", + "path-exists": "^3.0.0", + "read-cmd-shim": "^1.0.1", + "read-pkg": "^3.0.0", + "rimraf": "^2.6.1", + "safe-buffer": "^5.1.1", + "semver": "^5.4.1", + "signal-exit": "^3.0.2", + "slash": "^1.0.0", + "strong-log-transformer": "^1.0.6", + "temp-write": "^3.3.0", + "write-file-atomic": "^2.3.0", + "write-json-file": "^2.2.0", + "write-pkg": "^3.1.0", + "yargs": "^8.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wrap-ansi": "^2.0.0" + }, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + }, + "dependencies": { + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "strip-bom": "^3.0.0" + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + } + } + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true, + "requires": { + "camelcase": "^4.1.0", + "cliui": "^3.2.0", + "decamelize": "^1.1.1", + "get-caller-file": "^1.0.1", + "os-locale": "^2.0.0", + "read-pkg-up": "^2.0.0", + "require-directory": "^2.1.1", + "require-main-filename": "^1.0.1", + "set-blocking": "^2.0.0", + "string-width": "^2.0.0", + "which-module": "^2.0.0", + "y18n": "^3.2.1", + "yargs-parser": "^7.0.0" + } + } + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "liftoff": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/liftoff/-/liftoff-2.5.0.tgz", + "integrity": "sha1-IAkpG7Mc6oYbvxCnwVooyvdcMew=", + "dev": true, + "requires": { + "extend": "^3.0.0", + "findup-sync": "^2.0.0", + "fined": "^1.0.1", + "flagged-respawn": "^1.0.0", + "is-plain-object": "^2.0.4", + "object.map": "^1.0.0", + "rechoir": "^0.6.2", + "resolve": "^1.1.7" + } + }, + "load-json-file": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", + "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + } + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basetostring": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basetostring/-/lodash._basetostring-3.0.1.tgz", + "integrity": "sha1-0YYdh3+CSlL2aYMtyvPuFVZqB9U=", + "dev": true + }, + "lodash._basevalues": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._basevalues/-/lodash._basevalues-3.0.0.tgz", + "integrity": "sha1-W3dXYoAr3j0yl1A+JjAIIP32Ybc=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash._reescape": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz", + "integrity": "sha1-Kx1vXf4HyKNVdT5fJ/rH8c3hYWo=", + "dev": true + }, + "lodash._reevaluate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reevaluate/-/lodash._reevaluate-3.0.0.tgz", + "integrity": "sha1-WLx0xAZklTrgsSTYBpltrKQx4u0=", + "dev": true + }, + "lodash._reinterpolate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", + "integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=", + "dev": true + }, + "lodash._root": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._root/-/lodash._root-3.0.1.tgz", + "integrity": "sha1-+6HEUkwZ7ppfgTa0YJ8BfPTe1pI=", + "dev": true + }, + "lodash.assign": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", + "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", + "dev": true + }, + "lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "dev": true + }, + "lodash.escape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash.escape/-/lodash.escape-3.2.0.tgz", + "integrity": "sha1-mV7g3BjBtIzJLv+ucaEKq1tIdpg=", + "dev": true, + "requires": { + "lodash._root": "^3.0.0" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.isobject": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", + "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", + "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==", + "dev": true + }, + "lodash.restparam": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/lodash.restparam/-/lodash.restparam-3.6.1.tgz", + "integrity": "sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU=", + "dev": true + }, + "lodash.template": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-3.6.2.tgz", + "integrity": "sha1-+M3sxhaaJVvpCYrosMU9N4kx0U8=", + "dev": true, + "requires": { + "lodash._basecopy": "^3.0.0", + "lodash._basetostring": "^3.0.0", + "lodash._basevalues": "^3.0.0", + "lodash._isiterateecall": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0", + "lodash.keys": "^3.0.0", + "lodash.restparam": "^3.0.0", + "lodash.templatesettings": "^3.0.0" + } + }, + "lodash.templatesettings": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-3.1.1.tgz", + "integrity": "sha1-+zB4RHU7Zrnxr6VOJix0UwfbqOU=", + "dev": true, + "requires": { + "lodash._reinterpolate": "^3.0.0", + "lodash.escape": "^3.0.0" + } + }, + "log-driver": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.5.tgz", + "integrity": "sha1-euTsJXMC/XkNVXyxDJcQDYV7AFY=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "requires": { + "js-tokens": "^3.0.0" + } + }, + "loud-rejection": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", + "integrity": "sha1-W0b4AUft7leIcPCG0Eghz5mOVR8=", + "dev": true, + "requires": { + "currently-unhandled": "^0.4.1", + "signal-exit": "^3.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=", + "dev": true + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "make-error": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz", + "integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==", + "dev": true + }, + "make-error-cause": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-1.2.2.tgz", + "integrity": "sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=", + "dev": true, + "requires": { + "make-error": "^1.2.0" + } + }, + "make-iterator": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/make-iterator/-/make-iterator-1.0.1.tgz", + "integrity": "sha512-pxiuXh0iVEq7VM7KMIhs5gxsfxCux2URptUQaXo4iZZJxBAzTPOLE2BumO5dbfVYq/hBJFBR/a1mFDmOx5AGmw==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-2.0.0.tgz", + "integrity": "sha1-plzSkIepJZi4eRJXpSPgISIqwfk=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "md5.js": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "meow": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/meow/-/meow-4.0.1.tgz", + "integrity": "sha512-xcSBHD5Z86zaOc+781KrupuHAzeGXSLtiAOmBsiLDiPSaYSB6hdew2ng9EBAnZ62jagG9MHAOdxpDi/lWBFJ/A==", + "dev": true, + "requires": { + "camelcase-keys": "^4.0.0", + "decamelize-keys": "^1.0.0", + "loud-rejection": "^1.0.0", + "minimist": "^1.1.3", + "minimist-options": "^3.0.1", + "normalize-package-data": "^2.3.4", + "read-pkg-up": "^3.0.0", + "redent": "^2.0.0", + "trim-newlines": "^2.0.0" + }, + "dependencies": { + "read-pkg-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-3.0.0.tgz", + "integrity": "sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=", + "dev": true, + "requires": { + "find-up": "^2.0.0", + "read-pkg": "^3.0.0" + } + } + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", + "dev": true + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "dev": true, + "requires": { + "mime-db": "~1.33.0" + } + }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "minimist-options": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-3.0.2.tgz", + "integrity": "sha512-FyBrT/d0d4+uiZRbqznPXqw3IpZZG3gl3wKWiX784FycUKVwBt0uLBFkQrtE4tZOrgo78nZp2jnKz3L65T5LdQ==", + "dev": true, + "requires": { + "arrify": "^1.0.1", + "is-plain-obj": "^1.1.0" + } + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "dev": true, + "requires": { + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" + }, + "dependencies": { + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "modify-values": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/modify-values/-/modify-values-1.0.1.tgz", + "integrity": "sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==", + "dev": true + }, + "module-deps": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz", + "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "browser-resolve": "^1.7.0", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.5.0", + "defined": "^1.0.0", + "detective": "^4.0.0", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.3", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "mold-source-map": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/mold-source-map/-/mold-source-map-0.4.0.tgz", + "integrity": "sha1-z2fgsxxHq5uttcnCVlGGISe7gxc=", + "dev": true, + "requires": { + "convert-source-map": "^1.1.0", + "through": "~2.2.7" + }, + "dependencies": { + "through": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/through/-/through-2.2.7.tgz", + "integrity": "sha1-bo4hIAGR1OtqmfbwEN9Gqhxusr0=", + "dev": true + } + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "multipipe": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz", + "integrity": "sha1-Ko8t33Du1WTf8tV/HhoTfZ8FB4s=", + "dev": true, + "requires": { + "duplexer2": "0.0.2" + }, + "dependencies": { + "duplexer2": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.0.2.tgz", + "integrity": "sha1-xhTc9n4vsUmVqRcR5aYX6KYKMds=", + "dev": true, + "requires": { + "readable-stream": "~1.1.9" + } + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==", + "dev": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "natives": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.4.tgz", + "integrity": "sha512-Q29yeg9aFKwhLVdkTAejM/HvYG0Y1Am1+HUkFQGn5k2j8GS+v60TVmZh6nujpEAj/qql+wGUrlryO8bF+b1jEg==", + "dev": true + }, + "nave": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/nave/-/nave-0.5.3.tgz", + "integrity": "sha1-Ws7HI3WFblx2yDvSGmjXE+tfG6Q=", + "dev": true + }, + "nopt": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", + "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "^2.1.4", + "is-builtin-module": "^1.0.0", + "semver": "2 || 3 || 4 || 5", + "validate-npm-package-license": "^3.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "npmlog": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", + "dev": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "number-to-bn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.1.0.tgz", + "integrity": "sha1-UaM4fFvGgDWrQFjGJhMvdn2dCL8=", + "dev": true, + "requires": { + "bn.js": "4.11.6", + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + }, + "dependencies": { + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=", + "dev": true + } + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.defaults": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/object.defaults/-/object.defaults-1.1.0.tgz", + "integrity": "sha1-On+GgzS0B96gbaFtiNXNKeQ1/s8=", + "dev": true, + "requires": { + "array-each": "^1.0.1", + "array-slice": "^1.0.0", + "for-own": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "object.map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.map/-/object.map-1.0.1.tgz", + "integrity": "sha1-z4Plncj8wK1fQlDh94s7gb2AHTc=", + "dev": true, + "requires": { + "for-own": "^1.0.0", + "make-iterator": "^1.0.0" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "^1.0.0" + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } + }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "~0.1.3", + "fast-levenshtein": "~2.0.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + } + }, + "orchestrator": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/orchestrator/-/orchestrator-0.3.8.tgz", + "integrity": "sha1-FOfp4nZPcxX7rBhOUGx6pt+UrX4=", + "dev": true, + "requires": { + "end-of-stream": "~0.1.5", + "sequencify": "~0.0.7", + "stream-consume": "~0.1.0" + } + }, + "ordered-read-streams": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-0.1.0.tgz", + "integrity": "sha1-/VZamvjrRHO6abbtijQ1LLVS8SY=", + "dev": true + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true, + "requires": { + "execa": "^0.7.0", + "lcid": "^1.0.0", + "mem": "^1.1.0" + }, + "dependencies": { + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + } + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "p-map": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", + "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", + "dev": true + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "^6.7.1", + "registry-auth-token": "^3.0.1", + "registry-url": "^3.0.3", + "semver": "^5.1.0" + } + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", + "dev": true + }, + "parents": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", + "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", + "dev": true, + "requires": { + "path-platform": "~0.11.15" + } + }, + "parse-asn1": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", + "dev": true, + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" + } + }, + "parse-filepath": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-filepath/-/parse-filepath-1.0.2.tgz", + "integrity": "sha1-pjISf1Oq89FYdvWHLz/6x2PWyJE=", + "dev": true, + "requires": { + "is-absolute": "^1.0.0", + "map-cache": "^0.2.0", + "path-root": "^0.1.1" + } + }, + "parse-github-repo-url": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/parse-github-repo-url/-/parse-github-repo-url-1.4.1.tgz", + "integrity": "sha1-nn2LslKmy2ukJZUGC3v23z28H1A=", + "dev": true + }, + "parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=", + "dev": true, + "requires": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", + "dev": true + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true + }, + "path-dirname": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", + "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-platform": { + "version": "0.11.15", + "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", + "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", + "dev": true + }, + "path-root": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/path-root/-/path-root-0.1.1.tgz", + "integrity": "sha1-mkpoFMrBwM1zNgqV8yCDyOpHRbc=", + "dev": true, + "requires": { + "path-root-regex": "^0.1.0" + } + }, + "path-root-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/path-root-regex/-/path-root-regex-0.1.2.tgz", + "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", + "dev": true + }, + "path-type": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", + "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "pbkdf2": { + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", + "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "plexer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/plexer/-/plexer-1.0.1.tgz", + "integrity": "sha1-qAG2Ur+BRXOXlepNO/CvlGwwwN0=", + "dev": true, + "requires": { + "isstream": "^0.1.2", + "readable-stream": "^2.0.2" + } + }, + "plugin-error": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", + "integrity": "sha512-L1zP0dk7vGweZME2i+EeakvUNqSrdiI3F91TwEoYiGrAfUXmVv6fJIq4g82PAXxNsWOp0J7ZqQy/3Szz0ajTxA==", + "dev": true, + "requires": { + "ansi-colors": "^1.0.1", + "arr-diff": "^4.0.0", + "arr-union": "^3.1.0", + "extend-shallow": "^3.0.2" + } + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "pretty-hrtime": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", + "dev": true + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "public-encrypt": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", + "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "q": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", + "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=", + "dev": true + }, + "qs": { + "version": "6.3.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.3.2.tgz", + "integrity": "sha1-51vV9uJoEioqDgvaYwslUMFmUCw=", + "dev": true + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "quick-lru": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-1.1.0.tgz", + "integrity": "sha1-Q2CxfGETatOAeDl/8RQW4Ybc+7g=", + "dev": true + }, + "randombytes": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + } + } + }, + "rcfinder": { + "version": "0.1.9", + "resolved": "https://registry.npmjs.org/rcfinder/-/rcfinder-0.1.9.tgz", + "integrity": "sha1-8+gPOH3fmugK4wpBADKWQuroERU=", + "dev": true, + "requires": { + "lodash.clonedeep": "^4.3.2" + } + }, + "rcloader": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/rcloader/-/rcloader-0.2.2.tgz", + "integrity": "sha1-WNIpi0YtC5v9ITPSoex0+9cFxxc=", + "dev": true, + "requires": { + "lodash.assign": "^4.2.0", + "lodash.isobject": "^3.0.2", + "lodash.merge": "^4.6.0", + "rcfinder": "^0.1.6" + } + }, + "read-cmd-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-1.0.1.tgz", + "integrity": "sha1-LV0Vd4ajfAVdIgd8MsU/gynpHHs=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + } + } + }, + "read-only-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", + "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "read-pkg": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz", + "integrity": "sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=", + "dev": true, + "requires": { + "load-json-file": "^4.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^3.0.0" + } + }, + "read-pkg-up": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", + "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", + "dev": true, + "requires": { + "find-up": "^1.0.0", + "read-pkg": "^1.0.0" + }, + "dependencies": { + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "load-json-file": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", + "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "parse-json": "^2.2.0", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "strip-bom": "^2.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "^2.0.0" + } + }, + "path-type": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", + "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "read-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", + "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", + "dev": true, + "requires": { + "load-json-file": "^1.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^1.0.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + } + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "redent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-2.0.0.tgz", + "integrity": "sha1-wbIAe0LVfrE4kHmzyDM2OdXhzKo=", + "dev": true, + "requires": { + "indent-string": "^3.0.0", + "strip-indent": "^2.0.0" + } + }, + "regenerate": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", + "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", + "dev": true + }, + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "dev": true, + "requires": { + "babel-runtime": "^6.18.0", + "babel-types": "^6.19.0", + "private": "^0.1.6" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true, + "requires": { + "regenerate": "^1.2.1", + "regjsgen": "^0.2.0", + "regjsparser": "^0.1.4" + } + }, + "registry-auth-token": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz", + "integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==", + "dev": true, + "requires": { + "rc": "^1.1.6", + "safe-buffer": "^5.0.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "^1.0.1" + } + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + } + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true, + "requires": { + "is-finite": "^1.0.0" + } + }, + "replace-ext": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-0.0.1.tgz", + "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", + "dev": true + }, + "replacestream": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz", + "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.3", + "object-assign": "^4.0.1", + "readable-stream": "^2.0.2" + } + }, + "request": { + "version": "2.79.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.79.0.tgz", + "integrity": "sha1-Tf5b9r6LjNw3/Pk+BLZVd3InEN4=", + "dev": true, + "requires": { + "aws-sign2": "~0.6.0", + "aws4": "^1.2.1", + "caseless": "~0.11.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.0", + "forever-agent": "~0.6.1", + "form-data": "~2.1.1", + "har-validator": "~2.0.6", + "hawk": "~3.1.3", + "http-signature": "~1.1.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.7", + "oauth-sign": "~0.8.1", + "qs": "~6.3.0", + "stringstream": "~0.0.4", + "tough-cookie": "~2.3.0", + "tunnel-agent": "~0.4.1", + "uuid": "^3.0.0" + } + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-like": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/require-like/-/require-like-0.1.2.tgz", + "integrity": "sha1-rW8wwTvs15cBDEaK+ndcDAprR/o=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, + "resolve-dir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", + "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", + "dev": true, + "requires": { + "expand-tilde": "^2.0.0", + "global-modules": "^1.0.0" + } + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "^2.0.0", + "signal-exit": "^3.0.2" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "optional": true, + "requires": { + "align-text": "^0.1.1" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "rlp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.1.0.tgz", + "integrity": "sha512-93U7IKH5j7nmXFVg19MeNBGzQW5uXW1pmCuKY8veeKIhYTE32C2d0mOegfiIAfXcHOKJjjPlJisn8iHDF5AezA==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.1" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "*" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "sandboxed-module": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/sandboxed-module/-/sandboxed-module-2.0.3.tgz", + "integrity": "sha1-x+VFkzm7y6KMUwPusz9ug4e/upY=", + "dev": true, + "requires": { + "require-like": "0.1.2", + "stack-trace": "0.0.9" + } + }, + "scrypt": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", + "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", + "dev": true, + "requires": { + "nan": "^2.0.8" + } + }, + "scrypt.js": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/scrypt.js/-/scrypt.js-0.2.0.tgz", + "integrity": "sha1-r40UZbcemZARC+38WTuUeeA6ito=", + "dev": true, + "requires": { + "scrypt": "^6.0.2", + "scryptsy": "^1.2.1" + } + }, + "scryptsy": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-1.2.1.tgz", + "integrity": "sha1-oyJfpLJST4AnAHYeKFW987LZIWM=", + "dev": true, + "requires": { + "pbkdf2": "^3.0.3" + } + }, + "secp256k1": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.5.0.tgz", + "integrity": "sha512-e5QIJl8W7Y4tT6LHffVcZAxJjvpgE5Owawv6/XCYPQljE9aP2NFFddQ8OYMKhdLshNu88FfL3qCN3/xYkXGRsA==", + "dev": true, + "requires": { + "bindings": "^1.2.1", + "bip66": "^1.1.3", + "bn.js": "^4.11.3", + "create-hash": "^1.1.2", + "drbg.js": "^1.0.1", + "elliptic": "^6.2.3", + "nan": "^2.2.1", + "safe-buffer": "^5.1.0" + } + }, + "semver": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", + "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", + "dev": true + }, + "sequencify": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/sequencify/-/sequencify-0.0.7.tgz", + "integrity": "sha1-kM/xnQLgcCf9dn9erT57ldHnOAw=", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "dev": true, + "requires": { + "nan": "2.10.0" + } + }, + "shasum": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", + "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", + "dev": true, + "requires": { + "json-stable-stringify": "~0.0.0", + "sha.js": "~2.4.4" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shell-quote": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", + "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", + "dev": true, + "requires": { + "array-filter": "~0.0.0", + "array-map": "~0.0.0", + "array-reduce": "~0.0.0", + "jsonify": "~0.0.0" + } + }, + "shelljs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz", + "integrity": "sha1-NZbmMHp4FUT1kfN9phg2DzHbV7E=", + "dev": true + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "sntp": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "dev": true, + "requires": { + "hoek": "2.x.x" + } + }, + "sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "sparkles": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sparkles/-/sparkles-1.0.1.tgz", + "integrity": "sha512-dSO0DDYUahUt/0/pD/Is3VIm5TGJjludZ0HVymmhYF6eNA53PVLhnUk0znSYbH8IYBuJdCE+1luR22jNLMaQdw==", + "dev": true + }, + "spdx-correct": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", + "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", + "dev": true, + "requires": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", + "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", + "dev": true + }, + "split": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz", + "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==", + "dev": true, + "requires": { + "through": "2" + } + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "split2": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-2.2.0.tgz", + "integrity": "sha512-RAb22TG39LhI31MbreBgIuKiIKhVsawfTgEGqKHTK87aG+ul/PB8Sqoi3I7kVdRWiCfrKxK3uo4/YUkpNvhPbw==", + "dev": true, + "requires": { + "through2": "^2.0.2" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, + "sshpk": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", + "dev": true, + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "stack-trace": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz", + "integrity": "sha1-qPbq7KkGdMMz58Q5U/J1tFFRBpU=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", + "dev": true, + "requires": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "stream-consume": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.1.tgz", + "integrity": "sha512-tNa3hzgkjEP7XbCkbRXe1jpg+ievoa0O4SCFlMOYEscGSS4JJsckGL8swUyAa/ApGU3Ae4t6Honor4HhL+tRyg==", + "dev": true + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-splicer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.0.tgz", + "integrity": "sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "stringstream": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", + "integrity": "sha512-87GEBAkegbBcweToUrdzf3eLhWNg06FJTebl4BVJz/JgWy8CvEr9dRtX5qWphiynMSQlxxi+QqN0z5T32SLlhA==", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-1.0.0.tgz", + "integrity": "sha1-hbiGLzhEtabV7IRnqTWYFzo295Q=", + "dev": true, + "requires": { + "first-chunk-stream": "^1.0.0", + "is-utf8": "^0.2.0" + } + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "dev": true, + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "strip-indent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-2.0.0.tgz", + "integrity": "sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g=", + "dev": true + }, + "strip-json-comments": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.4.tgz", + "integrity": "sha1-HhX7ysl9Pumb8tc7TGVrCCu6+5E=", + "dev": true + }, + "strong-log-transformer": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/strong-log-transformer/-/strong-log-transformer-1.0.6.tgz", + "integrity": "sha1-9/uTdYpppXEUAYEnfuoMLrEwH6M=", + "dev": true, + "requires": { + "byline": "^5.0.0", + "duplexer": "^0.1.1", + "minimist": "^0.1.0", + "moment": "^2.6.0", + "through": "^2.3.4" + }, + "dependencies": { + "minimist": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.1.0.tgz", + "integrity": "sha1-md9lelJXTCHJBXSX33QnkLK0wN4=", + "dev": true + } + } + }, + "subarg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", + "dev": true, + "requires": { + "minimist": "^1.1.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "syntax-error": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", + "dev": true, + "requires": { + "acorn-node": "^1.2.0" + } + }, + "temp-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", + "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", + "dev": true + }, + "temp-write": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/temp-write/-/temp-write-3.4.0.tgz", + "integrity": "sha1-jP9jD7fp2gXwR8dM5M5NaFRX1JI=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "is-stream": "^1.1.0", + "make-dir": "^1.0.0", + "pify": "^3.0.0", + "temp-dir": "^1.0.0", + "uuid": "^3.0.1" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + } + } + }, + "tempfile": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tempfile/-/tempfile-1.1.1.tgz", + "integrity": "sha1-W8xOrsxKsscH2LwR2ZzMmiyyh/I=", + "dev": true, + "requires": { + "os-tmpdir": "^1.0.0", + "uuid": "^2.0.1" + }, + "dependencies": { + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", + "dev": true + } + } + }, + "text-extensions": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-1.7.0.tgz", + "integrity": "sha512-AKXZeDq230UaSzaO5s3qQUZOaC7iKbzq0jOFL614R7d9R593HLqAOL0cYoqLdkNrjBSOdmoQI06yigq1TSBXAg==", + "dev": true + }, + "textextensions": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-1.0.2.tgz", + "integrity": "sha1-ZUhjk+4fK7A5pgy7oFsLaL2VAdI=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + } + }, + "tildify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", + "integrity": "sha1-3OwD9V3Km3qj5bBPIYF+tW5jWIo=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0" + } + }, + "time-stamp": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/time-stamp/-/time-stamp-1.1.0.tgz", + "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", + "dev": true + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "timers-browserify": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", + "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", + "dev": true, + "requires": { + "process": "~0.11.0" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "~1.0.2" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "dev": true, + "requires": { + "punycode": "^1.4.1" + } + }, + "trim-newlines": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-2.0.0.tgz", + "integrity": "sha1-tAPQuRvlDDMd/EuC7s6yLD3hbSA=", + "dev": true + }, + "trim-off-newlines": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz", + "integrity": "sha1-n5up2e+odkw4dpi8v+sshI8RrbM=", + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", + "dev": true + }, + "tunnel-agent": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz", + "integrity": "sha1-Y3PbdpCf5XDgjXNYM2Xtgop07us=", + "dev": true + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "dev": true, + "optional": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "~1.1.2" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "uglify-js": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.2.tgz", + "integrity": "sha512-/kVQDzwiE9Vy7Y63eMkMozF4jIt0C2+xHctF9YpqNWdE/NLOuMurshkpoYGUlAbeYhACPv0HJPIHJul0Ak4/uw==", + "dev": true, + "requires": { + "commander": "~2.15.0", + "source-map": "~0.6.1" + }, + "dependencies": { + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true, + "optional": true + }, + "umd": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", + "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", + "dev": true + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "dev": true + }, + "undeclared-identifiers": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.2.tgz", + "integrity": "sha512-13EaeocO4edF/3JKime9rD7oB6QI8llAGhgn5fKOPyfkJbRb6NFv9pYV6dFEmpa4uRjKeBqLZP8GpuzqHlKDMQ==", + "dev": true, + "requires": { + "acorn-node": "^1.3.0", + "get-assigned-identifiers": "^1.2.0", + "simple-concat": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "underscore": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", + "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==", + "dev": true + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unique-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-1.0.0.tgz", + "integrity": "sha1-1ZpKdUJ0R9mqbJHnAmP40mpLEEs=", + "dev": true + }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + } + }, + "use": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", + "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "dev": true + }, + "utf8": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", + "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=", + "dev": true + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "uuid": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", + "dev": true + }, + "v8flags": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", + "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", + "dev": true, + "requires": { + "user-home": "^1.1.1" + } + }, + "validate-npm-package-license": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", + "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", + "dev": true, + "requires": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "dev": true, + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "dev": true + } + } + }, + "vinyl": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", + "integrity": "sha1-sEVbOPxeDPMNQyUTLkYZcMIJHN4=", + "dev": true, + "requires": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + } + }, + "vinyl-fs": { + "version": "0.3.14", + "resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-0.3.14.tgz", + "integrity": "sha1-mmhRzhysHBzqX+hsCTHWIMLPqeY=", + "dev": true, + "requires": { + "defaults": "^1.0.0", + "glob-stream": "^3.1.5", + "glob-watcher": "^0.0.6", + "graceful-fs": "^3.0.0", + "mkdirp": "^0.5.0", + "strip-bom": "^1.0.0", + "through2": "^0.6.1", + "vinyl": "^0.4.0" + }, + "dependencies": { + "clone": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + }, + "readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=", + "dev": true, + "requires": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + } + }, + "vinyl": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", + "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", + "dev": true, + "requires": { + "clone": "^0.2.0", + "clone-stats": "^0.0.1" + } + } + } + }, + "vinyl-source-stream": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vinyl-source-stream/-/vinyl-source-stream-1.1.2.tgz", + "integrity": "sha1-YrU6E1YQqJbpjKlr7jqH8Aio54A=", + "dev": true, + "requires": { + "through2": "^2.0.3", + "vinyl": "^0.4.3" + }, + "dependencies": { + "clone": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "integrity": "sha1-xhJqkK1Pctv1rNskPMN3JP6T/B8=", + "dev": true + }, + "vinyl": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", + "integrity": "sha1-LzVsh6VQolVGHza76ypbqL94SEc=", + "dev": true, + "requires": { + "clone": "^0.2.0", + "clone-stats": "^0.0.1" + } + } + } + }, + "vinyl-sourcemaps-apply": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz", + "integrity": "sha1-q2VJ1h0XLCsbh75cUI0jnI74dwU=", + "dev": true, + "requires": { + "source-map": "^0.5.1" + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wide-align": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", + "dev": true, + "requires": { + "string-width": "^1.0.2 || 2" + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true, + "optional": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "requires": { + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + }, + "dependencies": { + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + } + } + }, + "write-json-file": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-json-file/-/write-json-file-2.3.0.tgz", + "integrity": "sha1-K2TIozAE1UuGmMdtWFp3zrYdoy8=", + "dev": true, + "requires": { + "detect-indent": "^5.0.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "pify": "^3.0.0", + "sort-keys": "^2.0.0", + "write-file-atomic": "^2.0.0" + }, + "dependencies": { + "detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + } + } + }, + "write-pkg": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/write-pkg/-/write-pkg-3.2.0.tgz", + "integrity": "sha512-tX2ifZ0YqEFOF1wjRW2Pk93NLsj02+n1UP5RvO6rCs0K6R2g1padvf006cY74PQJKMGS2r42NK7FD0dG6Y6paw==", + "dev": true, + "requires": { + "sort-keys": "^2.0.0", + "write-json-file": "^2.2.0" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "optional": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + } + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + }, + "dependencies": { + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + } + } + } + } +} diff --git a/packages/web3-bzz/package-lock.json b/packages/web3-bzz/package-lock.json new file mode 100644 index 00000000000..00a92c3e069 --- /dev/null +++ b/packages/web3-bzz/package-lock.json @@ -0,0 +1,1780 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "accepts": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", + "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", + "requires": { + "mime-types": "~2.1.16", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "base64-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.2.1.tgz", + "integrity": "sha512-dwVUVIXsBZXwTuwnXI9RK8sBmgq09NDHzyR9SAph9eqk76gKK2JSQmZARC2zRC81JC2QTtxD0ARU5qTS25gIGw==" + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bl": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.1.tgz", + "integrity": "sha1-ysMo977kVzDUBLaSID/LWQ4XLV4=", + "requires": { + "readable-stream": "^2.0.5" + } + }, + "block-stream": { + "version": "0.0.9", + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "requires": { + "inherits": "~2.0.0" + } + }, + "bluebird": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", + "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==" + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.1", + "http-errors": "~1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "~2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "~1.6.15" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "requires": { + "hoek": "4.x.x" + } + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.0.8.tgz", + "integrity": "sha512-xXvjQhVNz50v2nPeoOsNqWCLGfiv4ji/gXZM28jnVwdLJxH4mFyqgqCKfaK9zf1KUbG6zTkjLOy7ou+jSMarGA==", + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" + }, + "buffer-to-arraybuffer": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.2.tgz", + "integrity": "sha1-0NgFZNwxhmoZdlFUh7OrYg23yEk=", + "requires": { + "tape": "^3.0.3" + } + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", + "requires": { + "graceful-readlink": ">= 1.0.0" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.x.x" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.x.x" + } + } + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "decompress": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.0.tgz", + "integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=", + "requires": { + "decompress-tar": "^4.0.0", + "decompress-tarbz2": "^4.0.0", + "decompress-targz": "^4.0.0", + "decompress-unzip": "^4.0.1", + "graceful-fs": "^4.1.10", + "make-dir": "^1.0.0", + "pify": "^2.3.0", + "strip-dirs": "^2.0.0" + } + }, + "decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "requires": { + "mimic-response": "^1.0.0" + } + }, + "decompress-tar": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", + "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", + "requires": { + "file-type": "^5.2.0", + "is-stream": "^1.1.0", + "tar-stream": "^1.5.2" + } + }, + "decompress-tarbz2": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", + "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", + "requires": { + "decompress-tar": "^4.1.0", + "file-type": "^6.1.0", + "is-stream": "^1.1.0", + "seek-bzip": "^1.0.5", + "unbzip2-stream": "^1.0.9" + }, + "dependencies": { + "file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==" + } + } + }, + "decompress-targz": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", + "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", + "requires": { + "decompress-tar": "^4.1.1", + "file-type": "^5.2.0", + "is-stream": "^1.1.0" + } + }, + "decompress-unzip": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", + "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "requires": { + "file-type": "^3.8.0", + "get-stream": "^2.2.0", + "pify": "^2.3.0", + "yauzl": "^2.4.2" + }, + "dependencies": { + "file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" + }, + "get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", + "requires": { + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + } + } + } + }, + "deep-equal": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.2.2.tgz", + "integrity": "sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0=" + }, + "defined": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz", + "integrity": "sha1-817qfXBekzuvE7LwOz+D2SFAOz4=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", + "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", + "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=" + }, + "end-of-stream": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", + "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", + "requires": { + "once": "^1.4.0" + } + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "express": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.2.tgz", + "integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=", + "requires": { + "accepts": "~1.3.4", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.1", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.0", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.2", + "qs": "6.5.1", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.1", + "serve-static": "1.13.1", + "setprototypeof": "1.1.0", + "statuses": "~1.3.1", + "type-is": "~1.6.15", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fd-slicer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", + "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "requires": { + "pend": "~1.2.0" + } + }, + "file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=" + }, + "finalhandler": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "for-each": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", + "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", + "requires": { + "is-function": "~1.0.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "fs-extra": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-2.1.2.tgz", + "integrity": "sha1-BGxwFjzvmq1GsOSn+kZ/si1x3jU=", + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0" + } + }, + "fs-promise": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/fs-promise/-/fs-promise-2.0.3.tgz", + "integrity": "sha1-9k5PhUvPaJqovdy6JokW2z20aFQ=", + "requires": { + "any-promise": "^1.3.0", + "fs-extra": "^2.0.0", + "mz": "^2.6.0", + "thenify-all": "^1.6.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "fstream": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "requires": { + "graceful-fs": "^4.1.2", + "inherits": "~2.0.0", + "mkdirp": ">=0.5 0", + "rimraf": "2" + } + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "requires": { + "inherits": "2", + "minimatch": "0.3" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "got": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", + "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", + "requires": { + "decompress-response": "^3.2.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-plain-obj": "^1.1.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "p-cancelable": "^0.3.0", + "p-timeout": "^1.1.1", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "url-parse-lax": "^1.0.0", + "url-to-options": "^1.0.1" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } + }, + "has-symbol-support-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.1.tgz", + "integrity": "sha512-JkaetveU7hFbqnAC1EV1sF4rlojU2D4Usc5CmS69l6NfmPDnpnFUegzFg33eDkkpNCxZ0mQp65HwUDrNFS/8MA==" + }, + "has-to-string-tag-x": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", + "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", + "requires": { + "has-symbol-support-x": "^1.4.1" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.x.x", + "cryptiles": "3.x.x", + "hoek": "4.x.x", + "sntp": "2.x.x" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hoek": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": ">= 1.3.1 < 2" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, + "ieee754": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz", + "integrity": "sha1-vjPUCsEO8ZJnAfbwii2G+/0a0+Q=" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz", + "integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A=" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-natural-number": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", + "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" + }, + "is-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", + "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=" + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "isurl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", + "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", + "requires": { + "has-to-string-tag-x": "^1.2.0", + "is-object": "^1.0.1" + } + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=", + "requires": { + "graceful-fs": "^4.1.6" + } + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=" + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" + }, + "make-dir": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.1.0.tgz", + "integrity": "sha512-0Pkui4wLJ7rxvmfUvs87skoEaxmu0hCUApF8nonzpl7q//FWp9zu8W61Scz4sd/kUiqDxvUhtoam2efDyiBzcA==", + "requires": { + "pify": "^3.0.0" + }, + "dependencies": { + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" + } + } + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "requires": { + "mime-db": "~1.30.0" + } + }, + "mimic-response": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.0.tgz", + "integrity": "sha1-3z02Uqc/3ta5sLJBRub9BSNTRY4=" + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", + "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + } + }, + "mkdirp-promise": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", + "integrity": "sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE=", + "requires": { + "mkdirp": "*" + } + }, + "mock-fs": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.4.2.tgz", + "integrity": "sha512-dF+yxZSojSiI8AXGoxj5qdFWpucndc54Ug+TwlpHFaV7j22MGG+OML2+FVa6xAZtjb/OFFQhOC37Jegx2GbEwA==" + }, + "mout": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/mout/-/mout-0.11.1.tgz", + "integrity": "sha1-ujYR318OWx/7/QEWa48C0fX6K5k=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "requires": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-inspect": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-0.4.0.tgz", + "integrity": "sha1-9RV8EWwUVbJDsG7pdwM5LFrYn+w=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "p-cancelable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", + "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" + }, + "p-timeout": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", + "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", + "requires": { + "p-finally": "^1.0.0" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" + }, + "pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "requires": { + "pinkie": "^2.0.0" + } + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" + }, + "proxy-addr": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", + "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.5.2" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "query-string": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-2.4.2.tgz", + "integrity": "sha1-fbBmZCCAS6qSrp8miWKFWnYUPfs=", + "requires": { + "strict-uri-encode": "^1.0.0" + } + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + } + }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" + } + }, + "request": { + "version": "2.83.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "hawk": "~6.0.2", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "stringstream": "~0.0.5", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "resumer": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", + "integrity": "sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=", + "requires": { + "through": "~2.3.4" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "requires": { + "glob": "^7.0.5" + }, + "dependencies": { + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + } + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "seek-bzip": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", + "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", + "requires": { + "commander": "~2.8.1" + } + }, + "send": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", + "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.1", + "destroy": "~1.0.4", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.3.1" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "serve-static": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", + "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", + "requires": { + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.1" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, + "simple-get": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-1.4.3.tgz", + "integrity": "sha1-6XVe2kB+ltpAxeUVjJ6jezO+y+s=", + "requires": { + "once": "^1.3.1", + "unzip-response": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "requires": { + "hoek": "4.x.x" + } + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, + "strip-dirs": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", + "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", + "requires": { + "is-natural-number": "^4.0.1" + } + }, + "swarm-js": { + "version": "0.1.37", + "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.37.tgz", + "integrity": "sha512-G8gi5fcXP/2upwiuOShJ258sIufBVztekgobr3cVgYXObZwJ5AXLqZn52AI+/ffft29pJexF9WNdUxjlkVehoQ==", + "requires": { + "bluebird": "^3.5.0", + "buffer": "^5.0.5", + "decompress": "^4.0.0", + "eth-lib": "^0.1.26", + "fs-extra": "^2.1.2", + "fs-promise": "^2.0.0", + "got": "^7.1.0", + "mime-types": "^2.1.16", + "mkdirp-promise": "^5.0.1", + "mock-fs": "^4.1.0", + "setimmediate": "^1.0.5", + "tar.gz": "^1.0.5", + "xhr-request-promise": "^0.1.2" + } + }, + "tape": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-3.6.1.tgz", + "integrity": "sha1-SJPdU+KApfWMDOswwsDrs7zVHh8=", + "requires": { + "deep-equal": "~0.2.0", + "defined": "~0.0.0", + "glob": "~3.2.9", + "inherits": "~2.0.1", + "object-inspect": "~0.4.0", + "resumer": "~0.0.0", + "through": "~2.3.4" + } + }, + "tar": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "requires": { + "block-stream": "*", + "fstream": "^1.0.2", + "inherits": "2" + } + }, + "tar-stream": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.5.5.tgz", + "integrity": "sha512-mQdgLPc/Vjfr3VWqWbfxW8yQNiJCbAZ+Gf6GDu1Cy0bdb33ofyiNGBtAY96jHFhDuivCwgW1H9DgTON+INiXgg==", + "requires": { + "bl": "^1.0.0", + "end-of-stream": "^1.0.0", + "readable-stream": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "tar.gz": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/tar.gz/-/tar.gz-1.0.7.tgz", + "integrity": "sha512-uhGatJvds/3diZrETqMj4RxBR779LKlIE74SsMcn5JProZsfs9j0QBwWO1RW+IWNJxS2x8Zzra1+AW6OQHWphg==", + "requires": { + "bluebird": "^2.9.34", + "commander": "^2.8.1", + "fstream": "^1.0.8", + "mout": "^0.11.0", + "tar": "^2.1.1" + }, + "dependencies": { + "bluebird": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=" + } + } + }, + "thenify": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", + "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", + "requires": { + "any-promise": "^1.0.0" + } + }, + "thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha1-GhkY1ALY/D+Y+/I02wvMjMEOlyY=", + "requires": { + "thenify": ">= 3.1.0 < 4" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" + }, + "tough-cookie": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "requires": { + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "type-is": { + "version": "1.6.15", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", + "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.15" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "unbzip2-stream": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.2.5.tgz", + "integrity": "sha512-izD3jxT8xkzwtXRUZjtmRwKnZoeECrfZ8ra/ketwOcusbZEp4mjULMnJOCfTDZBgGQAAY1AJ/IgxcwkavcX9Og==", + "requires": { + "buffer": "^3.0.1", + "through": "^2.3.6" + }, + "dependencies": { + "base64-js": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz", + "integrity": "sha1-EQHpVE9KdrG8OybUUsqW16NeeXg=" + }, + "buffer": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz", + "integrity": "sha1-pyyTb3e5a/UvX357RnGAYoVR3vs=", + "requires": { + "base64-js": "0.0.8", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + } + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "unzip-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz", + "integrity": "sha1-uYTwh3/AqJwsdzzB73tbIytbBv4=" + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "requires": { + "prepend-http": "^1.0.1" + } + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "url-to-options": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", + "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=" + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.4.1.tgz", + "integrity": "sha512-pAIU5vBr9Hiy5cpFIbPnwf0C18ZF86DBsZKrlsf87N5De/JbA6RJ83UP/cv+aljl4S40iRVMqP4pr4sF9Dnj0A==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.0.1.tgz", + "integrity": "sha1-g/CKSyC+7Geowcco6BAvTJ7svdo=", + "requires": { + "buffer-to-arraybuffer": "0.0.2", + "object-assign": "^3.0.0", + "query-string": "^2.4.0", + "simple-get": "^1.4.3", + "timed-out": "^2.0.0", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + }, + "dependencies": { + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=" + }, + "timed-out": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-2.0.0.tgz", + "integrity": "sha1-84sK6B03R9YoAB9B2vxlKs5nHAo=" + } + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + }, + "yauzl": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.9.1.tgz", + "integrity": "sha1-qBmB6nCleUYTOIPwKcWCGok1mn8=", + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.0.1" + } + } + } +} diff --git a/packages/web3-core-promievent/package-lock.json b/packages/web3-core-promievent/package-lock.json new file mode 100644 index 00000000000..0a44477c27f --- /dev/null +++ b/packages/web3-core-promievent/package-lock.json @@ -0,0 +1,16 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" + }, + "eventemitter3": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-1.1.1.tgz", + "integrity": "sha1-R3hr2qCHyvext15zq8XH1UAVjNA=" + } + } +} diff --git a/packages/web3-eth-contract/src/index.js b/packages/web3-eth-contract/src/index.js index 8a3b54e8d1e..7708bc3675a 100644 --- a/packages/web3-eth-contract/src/index.js +++ b/packages/web3-eth-contract/src/index.js @@ -459,6 +459,8 @@ Contract.prototype._decodeMethodReturn = function (outputs, returnValues) { returnValues = returnValues.length >= 2 ? returnValues.slice(2) : returnValues; var result = abi.decodeParameters(outputs, returnValues); + console.log('CONTRACT_OBJECT_RESULT: ', result); + if (result.__length__ === 1) { return result[0]; } else { diff --git a/packages/web3-eth/package-lock.json b/packages/web3-eth/package-lock.json new file mode 100644 index 00000000000..07f47fab5fe --- /dev/null +++ b/packages/web3-eth/package-lock.json @@ -0,0 +1,11 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } +} diff --git a/packages/web3-providers-http/package-lock.json b/packages/web3-providers-http/package-lock.json new file mode 100644 index 00000000000..598587c4f91 --- /dev/null +++ b/packages/web3-providers-http/package-lock.json @@ -0,0 +1,19 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" + }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "requires": { + "cookiejar": "^2.1.1" + } + } + } +} diff --git a/packages/web3-providers-ipc/package-lock.json b/packages/web3-providers-ipc/package-lock.json new file mode 100644 index 00000000000..793afba94c3 --- /dev/null +++ b/packages/web3-providers-ipc/package-lock.json @@ -0,0 +1,24 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "http-https": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", + "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" + }, + "oboe": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.3.tgz", + "integrity": "sha1-K0hl29Rr6BIlcT9Om/5Lz09oCk8=", + "requires": { + "http-https": "^1.0.0" + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + } + } +} diff --git a/packages/web3-providers-ws/package-lock.json b/packages/web3-providers-ws/package-lock.json new file mode 100644 index 00000000000..806722b8c47 --- /dev/null +++ b/packages/web3-providers-ws/package-lock.json @@ -0,0 +1,57 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "websocket": { + "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", + "from": "git://github.com/frozeman/WebSocket-Node.git#browserifyCompatible", + "requires": { + "debug": "^2.2.0", + "nan": "^2.3.3", + "typedarray-to-buffer": "^3.1.2", + "yaeti": "^0.0.6" + } + }, + "yaeti": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", + "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" + } + } +} diff --git a/packages/web3-utils/package-lock.json b/packages/web3-utils/package-lock.json new file mode 100644 index 00000000000..63061854959 --- /dev/null +++ b/packages/web3-utils/package-lock.json @@ -0,0 +1,1158 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "accepts": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz", + "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", + "requires": { + "mime-types": "~2.1.16", + "negotiator": "0.6.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "^4.6.0", + "fast-deep-equal": "^1.0.0", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.3.0" + } + }, + "array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" + }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "^0.14.3" + } + }, + "bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha1-UzRK2xRhehP26N0s4okF0cC6MhU=" + }, + "body-parser": { + "version": "1.18.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.2.tgz", + "integrity": "sha1-h2eKGdhLR9hZuDGZvVm84iKxBFQ=", + "requires": { + "bytes": "3.0.0", + "content-type": "~1.0.4", + "debug": "2.6.9", + "depd": "~1.1.1", + "http-errors": "~1.6.2", + "iconv-lite": "0.4.19", + "on-finished": "~2.3.0", + "qs": "6.5.1", + "raw-body": "2.3.2", + "type-is": "~1.6.15" + } + }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "requires": { + "hoek": "4.x.x" + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "browserify-sha3": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", + "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", + "requires": { + "js-sha3": "^0.3.1" + } + }, + "buffer-to-arraybuffer": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.2.tgz", + "integrity": "sha1-0NgFZNwxhmoZdlFUh7OrYg23yEk=", + "requires": { + "tape": "^3.0.3" + } + }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ=" + }, + "content-type": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", + "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" + }, + "cookie": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz", + "integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s=" + }, + "cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + }, + "cors": { + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.4.tgz", + "integrity": "sha1-K9OB8usgECAQXNUOpZ2mMJBpRoY=", + "requires": { + "object-assign": "^4", + "vary": "^1" + } + }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.x.x" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.x.x" + } + } + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "requires": { + "ms": "2.0.0" + } + }, + "deep-equal": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-0.2.2.tgz", + "integrity": "sha1-hLdFiW80xoTpjyzg5Cq69Du6AX0=" + }, + "defined": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-0.0.0.tgz", + "integrity": "sha1-817qfXBekzuvE7LwOz+D2SFAOz4=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "depd": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", + "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" + }, + "destroy": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", + "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" + }, + "dom-walk": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", + "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" + }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "~0.1.0" + } + }, + "ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" + }, + "elliptic": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", + "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "encodeurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz", + "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=" + }, + "escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" + }, + "etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" + }, + "eth-lib": { + "version": "0.1.27", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", + "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "requires": { + "bn.js": "^4.11.6", + "elliptic": "^6.4.0", + "keccakjs": "^0.2.1", + "nano-json-stream-parser": "^0.1.2", + "servify": "^0.1.12", + "ws": "^3.0.0", + "xhr-request-promise": "^0.1.2" + } + }, + "ethjs-unit": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-unit/-/ethjs-unit-0.1.6.tgz", + "integrity": "sha1-xmWSHkduh7ziqdWIpv4EBbLEFpk=", + "requires": { + "bn.js": "4.11.6", + "number-to-bn": "1.7.0" + } + }, + "express": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.16.2.tgz", + "integrity": "sha1-41xt/i1kt9ygpc1PIXgb4ymeB2w=", + "requires": { + "accepts": "~1.3.4", + "array-flatten": "1.1.1", + "body-parser": "1.18.2", + "content-disposition": "0.5.2", + "content-type": "~1.0.4", + "cookie": "0.3.1", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "~1.1.1", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.1.0", + "fresh": "0.5.2", + "merge-descriptors": "1.0.1", + "methods": "~1.1.2", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "path-to-regexp": "0.1.7", + "proxy-addr": "~2.0.2", + "qs": "6.5.1", + "range-parser": "~1.2.0", + "safe-buffer": "5.1.1", + "send": "0.16.1", + "serve-static": "1.13.1", + "setprototypeof": "1.1.0", + "statuses": "~1.3.1", + "type-is": "~1.6.15", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "dependencies": { + "setprototypeof": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", + "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" + }, + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz", + "integrity": "sha1-liVqO8l1WV6zbYLpkp0GDYk0Of8=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "finalhandler": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.0.tgz", + "integrity": "sha1-zgtoVbRYU+eRsvzGgARtiCU91/U=", + "requires": { + "debug": "2.6.9", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "on-finished": "~2.3.0", + "parseurl": "~1.3.2", + "statuses": "~1.3.1", + "unpipe": "~1.0.0" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "for-each": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", + "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", + "requires": { + "is-function": "~1.0.0" + } + }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.1.tgz", + "integrity": "sha1-b7lPvXGIUwbXPRXMSX/kzE7NRL8=", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.5", + "mime-types": "^2.1.12" + } + }, + "forwarded": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", + "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" + }, + "fresh": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", + "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" + }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, + "glob": { + "version": "3.2.11", + "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", + "integrity": "sha1-Spc/Y1uRkPcV0QmH1cAP0oFevj0=", + "requires": { + "inherits": "2", + "minimatch": "0.3" + } + }, + "global": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", + "integrity": "sha1-52mJJopsdMOJCLEwWxD8DjlOnQ8=", + "requires": { + "min-document": "^2.19.0", + "process": "~0.5.1" + } + }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "^5.1.0", + "har-schema": "^2.0.0" + } + }, + "hash.js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz", + "integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.0" + } + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.x.x", + "cryptiles": "3.x.x", + "hoek": "4.x.x", + "sntp": "2.x.x" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "hoek": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", + "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" + }, + "http-errors": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.2.tgz", + "integrity": "sha1-CgAsyFcHGSp+eUbO7cERVfYOxzY=", + "requires": { + "depd": "1.1.1", + "inherits": "2.0.3", + "setprototypeof": "1.0.3", + "statuses": ">= 1.3.1 < 2" + }, + "dependencies": { + "depd": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.1.tgz", + "integrity": "sha1-V4O04cRZ8G+lyif5kfPQbnoxA1k=" + } + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" + }, + "ipaddr.js": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.5.2.tgz", + "integrity": "sha1-1LUFvemUaYfM8PxY2QEP+WB+P6A=" + }, + "is-function": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-function/-/is-function-1.0.1.tgz", + "integrity": "sha1-Es+5i2W1fdPRk6MSH19uL0N2ArU=" + }, + "is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "js-sha3": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, + "keccakjs": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", + "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", + "requires": { + "browserify-sha3": "^0.0.1", + "sha3": "^1.1.0" + } + }, + "lru-cache": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz", + "integrity": "sha1-bUUk6LlV+V1PW1iFHOId1y+06VI=" + }, + "media-typer": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" + }, + "merge-descriptors": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", + "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" + }, + "methods": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", + "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" + }, + "mime": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.4.1.tgz", + "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" + }, + "mime-db": { + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.30.0.tgz", + "integrity": "sha1-dMZD2i3Z1qRTmZY0ZbJtXKfXHwE=" + }, + "mime-types": { + "version": "2.1.17", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.17.tgz", + "integrity": "sha1-Cdejk/A+mVp5+K+Fe3Cp4KsWVXo=", + "requires": { + "mime-db": "~1.30.0" + } + }, + "min-document": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/min-document/-/min-document-2.19.0.tgz", + "integrity": "sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=", + "requires": { + "dom-walk": "^0.1.0" + } + }, + "minimalistic-assert": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.0.tgz", + "integrity": "sha1-cCvi3aazf0g2vLP121ZkG2Sh09M=" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "minimatch": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz", + "integrity": "sha1-J12O2qxPG7MyZHIInnlJyDlGmd0=", + "requires": { + "lru-cache": "2", + "sigmund": "~1.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.10.0.tgz", + "integrity": "sha512-bAdJv7fBLhWC+/Bls0Oza+mvTaNQtP+1RyhhhvD95pgUJz6XM5IzgmxOkItJ9tkoCiplvAnXI1tNmmUD/eScyA==" + }, + "nano-json-stream-parser": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", + "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" + }, + "negotiator": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", + "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + }, + "number-to-bn": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", + "integrity": "sha1-uzYjWS9+X54AMLGXe9QaDFP+HqA=", + "requires": { + "bn.js": "4.11.6", + "strip-hex-prefix": "1.0.0" + } + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "object-inspect": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-0.4.0.tgz", + "integrity": "sha1-9RV8EWwUVbJDsG7pdwM5LFrYn+w=" + }, + "on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "requires": { + "ee-first": "1.1.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "parse-headers": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.1.tgz", + "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", + "requires": { + "for-each": "^0.3.2", + "trim": "0.0.1" + } + }, + "parseurl": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", + "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + }, + "path-to-regexp": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", + "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" + }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "process": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", + "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" + }, + "proxy-addr": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.2.tgz", + "integrity": "sha1-ZXFQT0e7mI7IGAJT+F3X4UlSvew=", + "requires": { + "forwarded": "~0.1.2", + "ipaddr.js": "1.5.2" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, + "query-string": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-2.4.2.tgz", + "integrity": "sha1-fbBmZCCAS6qSrp8miWKFWnYUPfs=", + "requires": { + "strict-uri-encode": "^1.0.0" + } + }, + "randomhex": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", + "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" + }, + "range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + }, + "raw-body": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.2.tgz", + "integrity": "sha1-vNYMd9Prk83gBQKVw/N5OJvIj4k=", + "requires": { + "bytes": "3.0.0", + "http-errors": "1.6.2", + "iconv-lite": "0.4.19", + "unpipe": "1.0.0" + } + }, + "request": { + "version": "2.83.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.6.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.5", + "extend": "~3.0.1", + "forever-agent": "~0.6.1", + "form-data": "~2.3.1", + "har-validator": "~5.0.3", + "hawk": "~6.0.2", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.17", + "oauth-sign": "~0.8.2", + "performance-now": "^2.1.0", + "qs": "~6.5.1", + "safe-buffer": "^5.1.1", + "stringstream": "~0.0.5", + "tough-cookie": "~2.3.3", + "tunnel-agent": "^0.6.0", + "uuid": "^3.1.0" + } + }, + "resumer": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", + "integrity": "sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k=", + "requires": { + "through": "~2.3.4" + } + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" + }, + "send": { + "version": "0.16.1", + "resolved": "https://registry.npmjs.org/send/-/send-0.16.1.tgz", + "integrity": "sha512-ElCLJdJIKPk6ux/Hocwhk7NFHpI3pVm/IZOYWqUmoxcgeyM+MpxHHKhb8QmlJDX1pU6WrgaHBkVNm73Sv7uc2A==", + "requires": { + "debug": "2.6.9", + "depd": "~1.1.1", + "destroy": "~1.0.4", + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "~1.6.2", + "mime": "1.4.1", + "ms": "2.0.0", + "on-finished": "~2.3.0", + "range-parser": "~1.2.0", + "statuses": "~1.3.1" + }, + "dependencies": { + "statuses": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz", + "integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4=" + } + } + }, + "serve-static": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.13.1.tgz", + "integrity": "sha512-hSMUZrsPa/I09VYFJwa627JJkNs0NrfL1Uzuup+GqHfToR2KcsXFymXSV90hoyw3M+msjFuQly+YzIH/q0MGlQ==", + "requires": { + "encodeurl": "~1.0.1", + "escape-html": "~1.0.3", + "parseurl": "~1.3.2", + "send": "0.16.1" + } + }, + "servify": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", + "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", + "requires": { + "body-parser": "^1.16.0", + "cors": "^2.8.1", + "express": "^4.14.0", + "request": "^2.79.0", + "xhr": "^2.3.3" + } + }, + "setprototypeof": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz", + "integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ=" + }, + "sha3": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", + "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", + "requires": { + "nan": "2.10.0" + } + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, + "simple-get": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-1.4.3.tgz", + "integrity": "sha1-6XVe2kB+ltpAxeUVjJ6jezO+y+s=", + "requires": { + "once": "^1.3.1", + "unzip-response": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "requires": { + "hoek": "4.x.x" + } + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "tweetnacl": "~0.14.0" + } + }, + "statuses": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", + "integrity": "sha512-zhSCtt8v2NDrRlPQpCNtw/heZLtfUDqxBM1udqikb/Hbk52LK4nQSwr10u77iopCW5LsyHpuXS0GnEc48mLeew==" + }, + "strict-uri-encode": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", + "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=" + }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, + "strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha1-DF8VX+8RUTczd96du1iNoFUA428=", + "requires": { + "is-hex-prefixed": "1.0.0" + } + }, + "tape": { + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-3.6.1.tgz", + "integrity": "sha1-SJPdU+KApfWMDOswwsDrs7zVHh8=", + "requires": { + "deep-equal": "~0.2.0", + "defined": "~0.0.0", + "glob": "~3.2.9", + "inherits": "~2.0.1", + "object-inspect": "~0.4.0", + "resumer": "~0.0.0", + "through": "~2.3.4" + } + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + }, + "timed-out": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-2.0.0.tgz", + "integrity": "sha1-84sK6B03R9YoAB9B2vxlKs5nHAo=" + }, + "tough-cookie": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", + "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "requires": { + "punycode": "^1.4.1" + } + }, + "trim": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", + "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=" + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "type-is": { + "version": "1.6.15", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz", + "integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=", + "requires": { + "media-typer": "0.3.0", + "mime-types": "~2.1.15" + } + }, + "ultron": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", + "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, + "unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" + }, + "unzip-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-1.0.2.tgz", + "integrity": "sha1-uYTwh3/AqJwsdzzB73tbIytbBv4=" + }, + "url-set-query": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", + "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" + }, + "utf8": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" + }, + "utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + }, + "uuid": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", + "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" + }, + "vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", + "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", + "requires": { + "async-limiter": "~1.0.0", + "safe-buffer": "~5.1.0", + "ultron": "~1.1.0" + } + }, + "xhr": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.4.1.tgz", + "integrity": "sha512-pAIU5vBr9Hiy5cpFIbPnwf0C18ZF86DBsZKrlsf87N5De/JbA6RJ83UP/cv+aljl4S40iRVMqP4pr4sF9Dnj0A==", + "requires": { + "global": "~4.3.0", + "is-function": "^1.0.1", + "parse-headers": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "xhr-request": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/xhr-request/-/xhr-request-1.0.1.tgz", + "integrity": "sha1-g/CKSyC+7Geowcco6BAvTJ7svdo=", + "requires": { + "buffer-to-arraybuffer": "0.0.2", + "object-assign": "^3.0.0", + "query-string": "^2.4.0", + "simple-get": "^1.4.3", + "timed-out": "^2.0.0", + "url-set-query": "^1.0.0", + "xhr": "^2.0.4" + }, + "dependencies": { + "object-assign": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", + "integrity": "sha1-m+3VygiXlJvKR+f/QIBi1Un1h/I=" + } + } + }, + "xhr-request-promise": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/xhr-request-promise/-/xhr-request-promise-0.1.2.tgz", + "integrity": "sha1-NDxE0e53JrhkgGloLQ+EDIO0Jh0=", + "requires": { + "xhr-request": "^1.0.1" + } + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=" + } + } +}