From 2e7b34d51e9a97e4433d90fe39c603fe1a587e93 Mon Sep 17 00:00:00 2001 From: David Wright Date: Fri, 7 Oct 2022 15:43:42 -0700 Subject: [PATCH 1/6] Trezor downstream updates --- .gitignore | 2 + dist/wallet-address-validator.js | 1304 +++++++++++++++++++++++--- dist/wallet-address-validator.min.js | 2 +- package.json | 370 +++++--- src/ae_validator.js | 22 + src/ardr_validator.js | 11 + src/atom_validator.js | 16 + src/binance_validator.js | 9 + src/currencies.js | 763 ++++++++++++++- src/hbar_validator.js | 16 + src/icx_validator.js | 15 + src/iost_validator.js | 8 + src/iota_validator.js | 14 + src/nxt_validator.js | 10 + src/steem_validator.js | 26 + src/sys_validator.js | 9 + src/zil_validator.js | 17 + test/wallet_address_validator.js | 116 ++- yarn.lock | 5 + 19 files changed, 2454 insertions(+), 281 deletions(-) create mode 100644 src/ae_validator.js create mode 100644 src/ardr_validator.js create mode 100644 src/atom_validator.js create mode 100644 src/binance_validator.js create mode 100644 src/hbar_validator.js create mode 100644 src/icx_validator.js create mode 100644 src/iost_validator.js create mode 100644 src/iota_validator.js create mode 100644 src/nxt_validator.js create mode 100644 src/steem_validator.js create mode 100644 src/sys_validator.js create mode 100644 src/zil_validator.js diff --git a/.gitignore b/.gitignore index b6e6fb35..019aa20e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules bower_components .idea .DS_Store +*.swo +*.swp diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 1c49f314..4498e3b1 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -119,7 +119,7 @@ function base (ALPHABET) { } module.exports = base -},{"safe-buffer":36}],2:[function(require,module,exports){ +},{"safe-buffer":37}],2:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -273,6 +273,178 @@ function fromByteArray (uint8) { } },{}],3:[function(require,module,exports){ +'use strict'; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bech32m = exports.bech32 = void 0; +const ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'; +const ALPHABET_MAP = {}; +for (let z = 0; z < ALPHABET.length; z++) { + const x = ALPHABET.charAt(z); + ALPHABET_MAP[x] = z; +} +function polymodStep(pre) { + const b = pre >> 25; + return (((pre & 0x1ffffff) << 5) ^ + (-((b >> 0) & 1) & 0x3b6a57b2) ^ + (-((b >> 1) & 1) & 0x26508e6d) ^ + (-((b >> 2) & 1) & 0x1ea119fa) ^ + (-((b >> 3) & 1) & 0x3d4233dd) ^ + (-((b >> 4) & 1) & 0x2a1462b3)); +} +function prefixChk(prefix) { + let chk = 1; + for (let i = 0; i < prefix.length; ++i) { + const c = prefix.charCodeAt(i); + if (c < 33 || c > 126) + return 'Invalid prefix (' + prefix + ')'; + chk = polymodStep(chk) ^ (c >> 5); + } + chk = polymodStep(chk); + for (let i = 0; i < prefix.length; ++i) { + const v = prefix.charCodeAt(i); + chk = polymodStep(chk) ^ (v & 0x1f); + } + return chk; +} +function convert(data, inBits, outBits, pad) { + let value = 0; + let bits = 0; + const maxV = (1 << outBits) - 1; + const result = []; + for (let i = 0; i < data.length; ++i) { + value = (value << inBits) | data[i]; + bits += inBits; + while (bits >= outBits) { + bits -= outBits; + result.push((value >> bits) & maxV); + } + } + if (pad) { + if (bits > 0) { + result.push((value << (outBits - bits)) & maxV); + } + } + else { + if (bits >= inBits) + return 'Excess padding'; + if ((value << (outBits - bits)) & maxV) + return 'Non-zero padding'; + } + return result; +} +function toWords(bytes) { + return convert(bytes, 8, 5, true); +} +function fromWordsUnsafe(words) { + const res = convert(words, 5, 8, false); + if (Array.isArray(res)) + return res; +} +function fromWords(words) { + const res = convert(words, 5, 8, false); + if (Array.isArray(res)) + return res; + throw new Error(res); +} +function getLibraryFromEncoding(encoding) { + let ENCODING_CONST; + if (encoding === 'bech32') { + ENCODING_CONST = 1; + } + else { + ENCODING_CONST = 0x2bc830a3; + } + function encode(prefix, words, LIMIT) { + LIMIT = LIMIT || 90; + if (prefix.length + 7 + words.length > LIMIT) + throw new TypeError('Exceeds length limit'); + prefix = prefix.toLowerCase(); + // determine chk mod + let chk = prefixChk(prefix); + if (typeof chk === 'string') + throw new Error(chk); + let result = prefix + '1'; + for (let i = 0; i < words.length; ++i) { + const x = words[i]; + if (x >> 5 !== 0) + throw new Error('Non 5-bit word'); + chk = polymodStep(chk) ^ x; + result += ALPHABET.charAt(x); + } + for (let i = 0; i < 6; ++i) { + chk = polymodStep(chk); + } + chk ^= ENCODING_CONST; + for (let i = 0; i < 6; ++i) { + const v = (chk >> ((5 - i) * 5)) & 0x1f; + result += ALPHABET.charAt(v); + } + return result; + } + function __decode(str, LIMIT) { + LIMIT = LIMIT || 90; + if (str.length < 8) + return str + ' too short'; + if (str.length > LIMIT) + return 'Exceeds length limit'; + // don't allow mixed case + const lowered = str.toLowerCase(); + const uppered = str.toUpperCase(); + if (str !== lowered && str !== uppered) + return 'Mixed-case string ' + str; + str = lowered; + const split = str.lastIndexOf('1'); + if (split === -1) + return 'No separator character for ' + str; + if (split === 0) + return 'Missing prefix for ' + str; + const prefix = str.slice(0, split); + const wordChars = str.slice(split + 1); + if (wordChars.length < 6) + return 'Data too short'; + let chk = prefixChk(prefix); + if (typeof chk === 'string') + return chk; + const words = []; + for (let i = 0; i < wordChars.length; ++i) { + const c = wordChars.charAt(i); + const v = ALPHABET_MAP[c]; + if (v === undefined) + return 'Unknown character ' + c; + chk = polymodStep(chk) ^ v; + // not in the checksum? + if (i + 6 >= wordChars.length) + continue; + words.push(v); + } + if (chk !== ENCODING_CONST) + return 'Invalid checksum for ' + str; + return { prefix, words }; + } + function decodeUnsafe(str, LIMIT) { + const res = __decode(str, LIMIT); + if (typeof res === 'object') + return res; + } + function decode(str, LIMIT) { + const res = __decode(str, LIMIT); + if (typeof res === 'object') + return res; + throw new Error(res); + } + return { + decodeUnsafe, + decode, + encode, + toWords, + fromWordsUnsafe, + fromWords, + }; +} +exports.bech32 = getLibraryFromEncoding('bech32'); +exports.bech32m = getLibraryFromEncoding('bech32m'); + +},{}],4:[function(require,module,exports){ (function (Buffer){(function (){ /* bignumber.js v1.3.0 https://github.com/MikeMcl/bignumber.js/LICENCE */ @@ -2390,7 +2562,7 @@ P['valueOf'] = function () { module.exports = BigNumber; }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":4}],4:[function(require,module,exports){ +},{"buffer":5}],5:[function(require,module,exports){ /*! * The buffer module from node.js, for the browser. * @@ -4169,7 +4341,7 @@ function numberIsNaN (obj) { return obj !== obj // eslint-disable-line no-self-compare } -},{"base64-js":2,"ieee754":31}],5:[function(require,module,exports){ +},{"base64-js":2,"ieee754":32}],6:[function(require,module,exports){ /* * The MIT License (MIT) * @@ -4577,62 +4749,62 @@ else if (!global.CBOR) })(this); -},{}],6:[function(require,module,exports){ +},{}],7:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc1').default; -},{"./es6/crc1":17}],7:[function(require,module,exports){ +},{"./es6/crc1":18}],8:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc16').default; -},{"./es6/crc16":18}],8:[function(require,module,exports){ +},{"./es6/crc16":19}],9:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc16ccitt').default; -},{"./es6/crc16ccitt":19}],9:[function(require,module,exports){ +},{"./es6/crc16ccitt":20}],10:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc16kermit').default; -},{"./es6/crc16kermit":20}],10:[function(require,module,exports){ +},{"./es6/crc16kermit":21}],11:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc16modbus').default; -},{"./es6/crc16modbus":21}],11:[function(require,module,exports){ +},{"./es6/crc16modbus":22}],12:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc16xmodem').default; -},{"./es6/crc16xmodem":22}],12:[function(require,module,exports){ +},{"./es6/crc16xmodem":23}],13:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc24').default; -},{"./es6/crc24":23}],13:[function(require,module,exports){ +},{"./es6/crc24":24}],14:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc32').default; -},{"./es6/crc32":24}],14:[function(require,module,exports){ +},{"./es6/crc32":25}],15:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc8').default; -},{"./es6/crc8":25}],15:[function(require,module,exports){ +},{"./es6/crc8":26}],16:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crc81wire').default; -},{"./es6/crc81wire":26}],16:[function(require,module,exports){ +},{"./es6/crc81wire":27}],17:[function(require,module,exports){ 'use strict'; module.exports = require('./es6/crcjam').default; -},{"./es6/crcjam":27}],17:[function(require,module,exports){ +},{"./es6/crcjam":28}],18:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4668,7 +4840,7 @@ var crc1 = (0, _define_crc2.default)('crc1', function (buf, previous) { exports.default = crc1; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],18:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],19:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4708,7 +4880,7 @@ var crc16 = (0, _define_crc2.default)('crc-16', function (buf, previous) { exports.default = crc16; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],19:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],20:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4748,7 +4920,7 @@ var crc16ccitt = (0, _define_crc2.default)('ccitt', function (buf, previous) { exports.default = crc16ccitt; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],20:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],21:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4788,7 +4960,7 @@ var crc16kermit = (0, _define_crc2.default)('kermit', function (buf, previous) { exports.default = crc16kermit; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],21:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],22:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4828,7 +5000,7 @@ var crc16modbus = (0, _define_crc2.default)('crc-16-modbus', function (buf, prev exports.default = crc16modbus; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],22:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],23:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4871,7 +5043,7 @@ var crc16xmodem = (0, _define_crc2.default)('xmodem', function (buf, previous) { exports.default = crc16xmodem; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],23:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],24:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4911,7 +5083,7 @@ var crc24 = (0, _define_crc2.default)('crc-24', function (buf, previous) { exports.default = crc24; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],24:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],25:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4951,7 +5123,7 @@ var crc32 = (0, _define_crc2.default)('crc-32', function (buf, previous) { exports.default = crc32; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],25:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],26:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -4991,7 +5163,7 @@ var crc8 = (0, _define_crc2.default)('crc-8', function (buf, previous) { exports.default = crc8; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],26:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],27:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5031,7 +5203,7 @@ var crc81wire = (0, _define_crc2.default)('dallas-1-wire', function (buf, previo exports.default = crc81wire; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],27:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],28:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5073,7 +5245,7 @@ var crcjam = (0, _define_crc2.default)('jam', function (buf) { exports.default = crcjam; -},{"./create_buffer":28,"./define_crc":29,"buffer":4}],28:[function(require,module,exports){ +},{"./create_buffer":29,"./define_crc":30,"buffer":5}],29:[function(require,module,exports){ 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -5089,7 +5261,7 @@ function (val) { exports.default = createBuffer; -},{"buffer":4}],29:[function(require,module,exports){ +},{"buffer":5}],30:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { @@ -5107,7 +5279,7 @@ exports.default = function (model, calc) { return fn; }; -},{}],30:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ 'use strict'; module.exports = { @@ -5124,7 +5296,7 @@ module.exports = { crcjam: require('./crcjam') }; -},{"./crc1":6,"./crc16":7,"./crc16_ccitt":8,"./crc16_kermit":9,"./crc16_modbus":10,"./crc16_xmodem":11,"./crc24":12,"./crc32":13,"./crc8":14,"./crc8_1wire":15,"./crcjam":16}],31:[function(require,module,exports){ +},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = (nBytes * 8) - mLen - 1 @@ -5210,7 +5382,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],32:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ (function (process,global){(function (){ /* * [js-sha512]{@link https://github.com/emn178/js-sha512} @@ -6141,7 +6313,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { })(); }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":35}],33:[function(require,module,exports){ +},{"_process":36}],34:[function(require,module,exports){ /* A JavaScript implementation of the SHA family of hashes, as defined in FIPS PUB 180-4 and FIPS PUB 202, as well as the corresponding @@ -6187,7 +6359,7 @@ new a(c[56],1575990012),new a(c[57],1125592928),new a(c[58],2716904306),new a(c[ 2618297676),new a(1288033470,3409855158),new a(1501505948,4234509866),new a(1607167915,987167468),new a(1816402316,1246189591)];Z=[new a(0,1),new a(0,32898),new a(2147483648,32906),new a(2147483648,2147516416),new a(0,32907),new a(0,2147483649),new a(2147483648,2147516545),new a(2147483648,32777),new a(0,138),new a(0,136),new a(0,2147516425),new a(0,2147483658),new a(0,2147516555),new a(2147483648,139),new a(2147483648,32905),new a(2147483648,32771),new a(2147483648,32770),new a(2147483648,128),new a(0, 32778),new a(2147483648,2147483658),new a(2147483648,2147516545),new a(2147483648,32896),new a(0,2147483649),new a(2147483648,2147516424)];Y=[[0,36,3,41,18],[1,44,10,45,2],[62,6,43,15,61],[28,55,25,21,56],[27,20,39,8,14]];"function"===typeof define&&define.amd?define(function(){return C}):"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(module.exports=C),exports=C):aa.jsSHA=C})(this); -},{}],34:[function(require,module,exports){ +},{}],35:[function(require,module,exports){ (function (global){(function (){ /** * Lodash (Custom Build) @@ -8039,7 +8211,7 @@ function stubFalse() { module.exports = isEqual; }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],35:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -8225,7 +8397,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],36:[function(require,module,exports){ +},{}],37:[function(require,module,exports){ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') var Buffer = buffer.Buffer @@ -8289,7 +8461,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size) } -},{"buffer":4}],37:[function(require,module,exports){ +},{"buffer":5}],38:[function(require,module,exports){ var cbor = require('cbor-js'); var CRC = require('crc'); var base58 = require('./crypto/base58'); @@ -8335,7 +8507,31 @@ module.exports = { } }; -},{"./bip173_validator":41,"./crypto/base58":44,"cbor-js":5,"crc":30}],38:[function(require,module,exports){ +},{"./bip173_validator":46,"./crypto/base58":49,"cbor-js":6,"crc":31}],39:[function(require,module,exports){ +var base58 = require('./crypto/base58') + +const ALLOWED_CHARS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' + +var regexp = new RegExp('^(ak_)([' + ALLOWED_CHARS + ']+)$') // Begins with ak_ followed by + +module.exports = { + isValidAddress: function (address, currency, networkType) { + let match = regexp.exec(address) + if (match !== null) { + return this.verifyChecksum(match[2]) + } else { + return false + } + }, + + verifyChecksum: function (address) { + var decoded = base58.decode(address) + decoded.splice(-4, 4) // remove last 4 elements. Why is base 58 adding them? + return decoded.length === 32 + }, +} + +},{"./crypto/base58":49}],40:[function(require,module,exports){ const cryptoUtils = require('./crypto/utils'); const ALGORAND_CHECKSUM_BYTE_LENGTH = 4; @@ -8365,7 +8561,38 @@ module.exports = { } } -},{"./crypto/utils":52}],39:[function(require,module,exports){ +},{"./crypto/utils":57}],41:[function(require,module,exports){ +const ardorRegex = new RegExp('^ARDOR(-[A-Z0-9]{4}){3}(-[A-Z0-9]{5})$') + +module.exports = { + isValidAddress: function (address, currency, networkType) { + if (!ardorRegex.test(address)) { + return false + } + + return true + }, +} + +},{}],42:[function(require,module,exports){ +const { bech32 } = require('bech32'); + +const ALLOWED_CHARS = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' + +var regexp = new RegExp('^(cosmos)1([' + ALLOWED_CHARS + ']+)$') // cosmos + bech32 separated by '1' + +module.exports = { + isValidAddress: function (address, currency, networkType) { + return regexp.exec(address) !== null; + }, + + verifyChecksum: function (address) { + const decoded = bech32.decode(address); + return decoded && decoded.words.length === 32; + }, +} + +},{"bech32":3}],43:[function(require,module,exports){ const base58 = require('./crypto/base58'); // simple base58 validator. Just checks if it can be decoded. @@ -8399,7 +8626,7 @@ module.exports = { } }; -},{"./crypto/base58":44}],40:[function(require,module,exports){ +},{"./crypto/base58":49}],44:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var bech32 = require('./crypto/bech32'); var BTCValidator = require('./bitcoin_validator'); @@ -8449,7 +8676,18 @@ module.exports = { } } -},{"./bitcoin_validator":42,"./crypto/bech32":45,"./crypto/utils":52}],41:[function(require,module,exports){ +},{"./bitcoin_validator":47,"./crypto/bech32":50,"./crypto/utils":57}],45:[function(require,module,exports){ +module.exports = { + isValidAddress: function (address) { + var binanceAddress = address.slice(address.indexOf('bnb')); + if (binanceAddress.length !== 42) { + return false; + } + return true; + }, +}; + +},{}],46:[function(require,module,exports){ var bech32 = require('./crypto/bech32'); // bip 173 bech 32 addresses (https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) @@ -8479,7 +8717,7 @@ module.exports = { } }; -},{"./crypto/bech32":45}],42:[function(require,module,exports){ +},{"./crypto/bech32":50}],47:[function(require,module,exports){ (function (Buffer){(function (){ var base58 = require('./crypto/base58'); var segwit = require('./crypto/segwit_addr'); @@ -8571,7 +8809,7 @@ module.exports = { }; }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/base58":44,"./crypto/segwit_addr":50,"./crypto/utils":52,"buffer":4}],43:[function(require,module,exports){ +},{"./crypto/base58":49,"./crypto/segwit_addr":55,"./crypto/utils":57,"buffer":5}],48:[function(require,module,exports){ var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; /** @@ -8638,7 +8876,7 @@ module.exports = { b32decode: b32decode, b32encode: b32encode }; -},{}],44:[function(require,module,exports){ +},{}],49:[function(require,module,exports){ // Base58 encoding/decoding // Originally written by Mike Hearn for BitcoinJ // Copyright (c) 2011 Google Inc @@ -8686,7 +8924,7 @@ module.exports = { } }; -},{}],45:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ // Copyright (c) 2017, 2021 Pieter Wuille // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -8820,7 +9058,7 @@ function decode (bechString, enc) { return {hrp: hrp, data: data.slice(0, data.length - 6)}; } -},{}],46:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ /* JavaScript BigInteger library version 0.9.1 http://silentmatt.com/biginteger/ @@ -10271,7 +10509,7 @@ function decode (bechString, enc) { exports.JSBigInt = BigInteger; // exports.BigInteger changed to exports.JSBigInt })(typeof exports !== 'undefined' ? exports : this); -},{}],47:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ (function (Buffer){(function (){ 'use strict'; @@ -10463,7 +10701,7 @@ Blake256.prototype.digest = function (encoding) { module.exports = Blake256; }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":4}],48:[function(require,module,exports){ +},{"buffer":5}],53:[function(require,module,exports){ 'use strict'; /** @@ -10741,7 +10979,7 @@ function toHex (n) { module.exports = Blake2b; -},{}],49:[function(require,module,exports){ +},{}],54:[function(require,module,exports){ var JSBigInt = require('./biginteger')['JSBigInt']; /** @@ -10968,7 +11206,7 @@ var cnBase58 = (function () { return b58; })(); module.exports = cnBase58; -},{"./biginteger":46}],50:[function(require,module,exports){ +},{"./biginteger":51}],55:[function(require,module,exports){ // Copyright (c) 2017, 2021 Pieter Wuille // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -11093,7 +11331,7 @@ module.exports = { isValidAddress: isValidAddress, }; -},{"./bech32":45}],51:[function(require,module,exports){ +},{"./bech32":50}],56:[function(require,module,exports){ (function (process,global){(function (){ /** * [js-sha3]{@link https://github.com/emn178/js-sha3} @@ -11737,7 +11975,7 @@ var f = function (s) { module.exports = methods; }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":35}],52:[function(require,module,exports){ +},{"_process":36}],57:[function(require,module,exports){ (function (Buffer){(function (){ var jsSHA = require('jssha'); var sha512256 = require('js-sha512').sha512_256 @@ -11873,7 +12111,7 @@ module.exports = { } }).call(this)}).call(this,require("buffer").Buffer) -},{"./base32":43,"./base58":44,"./blake256":47,"./blake2b":48,"./sha3":51,"browserify-bignum":3,"buffer":4,"js-sha512":32,"jssha":33}],53:[function(require,module,exports){ +},{"./base32":48,"./base58":49,"./blake256":52,"./blake2b":53,"./sha3":56,"browserify-bignum":4,"buffer":5,"js-sha512":33,"jssha":34}],58:[function(require,module,exports){ var XRPValidator = require('./ripple_validator'); var ETHValidator = require('./ethereum_validator'); var BTCValidator = require('./bitcoin_validator'); @@ -11893,12 +12131,26 @@ var AlgoValidator = require('./algo_validator'); var DotValidator = require('./dot_validator'); var BIP173Validator = require('./bip173_validator') var Base58Validator = require('./base58_validator') - -// defines P2PKH and P2SH address types for standard (prod) and testnet networks +// from trezor +var AEValidator = require('./ae_validator'); +var ARDRValidator = require('./ardr_validator'); +var ATOMValidator = require('./atom_validator'); +var BinanceValidator = require('./binance_validator'); +var HBARValidator = require('./hbar_validator'); +var ICXValidator = require('./icx_validator'); +var IOSTValidator = require('./iost_validator'); +// var IOTAValidator = require('./iota_validator'); +var NXTValidator = require('./nxt_validator'); +var STEEMValidator = require('./steem_validator'); +var SYSValidator = require('./sys_validator'); +var ZILValidator = require('./zil_validator'); + +// defines P2PKH, P2SH and bech32 address types for standard (prod) and testnet networks var CURRENCIES = [{ name: 'Bitcoin', symbol: 'btc', - addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4', '3c', '26'] }, + segwitHrp: { prod: 'bc', testnet: 'tb', regtest: 'bcrt' }, + addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4', '3c', '26'], regtest: ['6f', 'c4', '3c', '26'] }, bech32Hrp: { prod: ['bc'], testnet: ['tb'] }, validator: BTCValidator }, { @@ -11908,14 +12160,26 @@ var CURRENCIES = [{ addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, validator: BCHValidator }, { + name: 'Bitcoin Diamond', + symbol: 'bcd', + validator: BTCValidator, + addressTypes: { prod: ['00'] } + }, { name: 'Bitcoin SV', symbol: 'bsv', regexp: '^[qQ]{1}[0-9a-zA-Z]{41}$', addressTypes: { prod: ['00', '05'], testnet: ['6f', 'c4'] }, validator: BCHValidator + }, { + name: 'Fujicoin', + symbol: 'fjc', + segwitHrp: { prod: 'fc', testnet: 'tf' }, + addressTypes: { prod: ['24', '10'], testnet: ['4a', 'c4'] }, + validator: BTCValidator, }, { name: 'LiteCoin', symbol: 'ltc', + segwitHrp: { prod: 'ltc', testnet: 'tltc' }, addressTypes: { prod: ['30', '05', '32'], testnet: ['6f', 'c4', '3a'] }, bech32Hrp: { prod: ['ltc'], testnet: ['tltc'] }, validator: BTCValidator @@ -11964,6 +12228,10 @@ var CURRENCIES = [{ symbol: 'nmc', addressTypes: { prod: ['34'], testnet: [] }, validator: BTCValidator + }, { + name: 'NXT', + symbol: 'nxt', + validator: NXTValidator, }, { name: 'BioCoin', symbol: 'bio', @@ -11980,10 +12248,10 @@ var CURRENCIES = [{ addressTypes: { prod: ['0x', '47', '71', '05'], testnet: ['6f', 'c4'] }, bech32Hrp: { prod: ['vtc'], testnet: ['tvtc'] }, validator: BTCValidator - }, { name: 'BitcoinGold', symbol: 'btg', + segwitHrp: { prod: 'btg', testnet: 'tbtg' }, addressTypes: { prod: ['26', '17'], testnet: ['6f', 'c4'] }, validator: BTCValidator }, { @@ -12049,6 +12317,7 @@ var CURRENCIES = [{ }, { name: 'GameCredits', symbol: 'game', + segwitHrp: { prod: 'game', prod: 'tgame' }, addressTypes: { prod: ['26', '05'], testnet: [] }, validator: ETHValidator }, { @@ -12064,11 +12333,13 @@ var CURRENCIES = [{ }, { name: 'MonaCoin', symbol: 'mona', - addressTypes: { prod: ['32', '37'], testnet: [] }, + segwitHrp: { prod: 'mona', prod: 'tmona' }, + addressTypes: { prod: ['32', '37'], testnet: ['6f', '75'] }, validator: BTCValidator }, { name: 'DigiByte', symbol: 'dgb', + segwitHrp: { prod: 'dgb' }, addressTypes: { prod: ['1e', '3f'], testnet: [] }, bech32Hrp: { prod: ['dgb', 'S'], testnet: [] }, validator: BTCValidator @@ -12099,6 +12370,7 @@ var CURRENCIES = [{ }, { name: 'Qtum', symbol: 'qtum', + segwitHrp: { prod: 'qc', prod: 'tq' }, addressTypes: { prod: ['3a', '32'], testnet: ['78', '6e'] }, validator: BTCValidator }, { @@ -12109,6 +12381,23 @@ var CURRENCIES = [{ hashFunction: 'blake256keccak256', regex: /^[a-zA-Z0-9]{35}$/, validator: BTCValidator + }, { + name: 'Ontology', + symbol: 'ont', + validator: BTCValidator, + addressTypes: { prod: ['17', '41'] } + }, { + name: 'Ravencoin', + symbol: 'rvn', + validator: BTCValidator, + addressTypes: { prod: ['3c'] } + }, { + name: 'Groestlcoin', + symbol: 'grs', + addressTypes: { prod: ['24', '05'], testnet: ['6f', 'c4'] }, + segwitHrp: { prod: 'grs', testnet: 'tgrs' }, + hashFunction: 'groestl512x2', + validator: BTCValidator }, { name: 'Ethereum', symbol: 'eth', @@ -12160,6 +12449,10 @@ var CURRENCIES = [{ name: 'Civic', symbol: 'cvc', validator: ETHValidator + }, { + name: 'Own', // Rebranded from Chainium + symbol: 'chx', + validator: ETHValidator, }, { name: 'District0x', symbol: 'dnt', @@ -12256,6 +12549,118 @@ var CURRENCIES = [{ name: 'Storm', symbol: 'storm', validator: ETHValidator + }, { + name: 'FirstBlood', + symbol: '1st', + validator: ETHValidator, + }, { + name: 'Arcblock', + symbol: 'abt', + validator: ETHValidator, + }, { + name: 'Abyss Token', + symbol: 'abyss', + validator: ETHValidator, + }, { + name: 'adToken', + symbol: 'adt', + validator: ETHValidator, + }, { + name: 'AdEx', + symbol: 'adx', + validator: ETHValidator, + }, { + name: 'SingularityNET', + symbol: 'agi', + validator: ETHValidator, + }, { + name: 'Ambrosus', + symbol: 'amb', + validator: ETHValidator, + }, { + name: 'Ankr', + symbol: 'ankr', + validator: ETHValidator, + }, { + name: 'AppCoins', + symbol: 'appc', + validator: ETHValidator, + }, { + name: 'Cosmos', + symbol: 'atom', + validator: ATOMValidator, + }, { + name: 'Aeron', + symbol: 'arn', + validator: ETHValidator, + }, { + name: 'Aeternity', + symbol: 'ae', + validator: AEValidator, + }, { + name: 'ATLANT', + symbol: 'atl', + validator: ETHValidator, + }, { + name: 'aXpire', + symbol: 'axpr', + validator: ETHValidator, + }, { + name: 'Band Protocol', + symbol: 'band', + validator: ETHValidator, + }, { + name: 'Blockmason Credit Protocol', + symbol: 'bcpt', + validator: ETHValidator, + }, { + name: 'BitDegree', + symbol: 'bdg', + validator: ETHValidator, + }, { + name: 'BetterBetting', + symbol: 'betr', + validator: ETHValidator, + }, { + name: 'Bluzelle', + symbol: 'blz', + validator: ETHValidator, + }, { + name: 'Bread', + symbol: 'brd', + validator: ETHValidator, + }, { + name: 'Blocktrade Token', + symbol: 'btt', + validator: ETHValidator, + }, { + name: 'Binance USD', + symbol: 'busd', + validator: ETHValidator, + }, { + name: 'CryptoBossCoin', + symbol: 'cbc', + validator: ETHValidator, + }, { + name: 'Blox', + symbol: 'cdt', + validator: ETHValidator, + }, { + name: 'Celer Network', + symbol: 'celr', + validator: ETHValidator, + }, { + name: 'Chiliz', + symbol: 'chz', + validator: ETHValidator, + }, { + name: 'Coinlancer', + symbol: 'cl', + validator: ETHValidator, + }, { + name: 'Cindicator', + symbol: 'cnd', + validator: ETHValidator, }, { name: 'Nano', symbol: 'nano', @@ -12300,24 +12705,18 @@ var CURRENCIES = [{ name: 'Stellar', symbol: 'xlm', validator: XLMValidator, - }, { - name: 'BTU Protocol', - symbol: 'btu', - validator: ETHValidator, }, { name: 'Crypto.com Coin', symbol: 'cro', bech32Hrp: { prod: ['cro'], testnet: ['tcro']}, validator: BIP173Validator, - }, { - name: 'Multi-collateral DAI', - symbol: 'dai', - validator: ETHValidator, - }, { - name: 'Enjin Coin', - symbol: 'enj', - validator: ETHValidator, - }, { + }, + // { + // name: 'Crypto.com Coin', + // symbol: 'cro', + // validator: ETHValidator, + // }, + { name: 'HedgeTrade', symbol: 'hedg', validator: ETHValidator, @@ -12333,10 +12732,6 @@ var CURRENCIES = [{ name: 'Loom Network', symbol: 'loom', validator: ETHValidator, - }, { - name: 'Maker', - symbol: 'mkr', - validator: ETHValidator, }, { name: 'Metal', symbol: 'mtl', @@ -12373,6 +12768,94 @@ var CURRENCIES = [{ name: 'Tezos', symbol: 'xtz', validator: XTZValidator + }, { + name: 'Cocos-BCX', + symbol: 'cocos', + validator: ETHValidator, + }, { + name: 'COS', + symbol: 'cos', + validator: ETHValidator, + }, { + name: 'Cosmo Coin', + symbol: 'cosm', + validator: ETHValidator, + }, { + name: 'Covesting', + symbol: 'cov', + validator: ETHValidator, + }, { + name: 'Crypterium', + symbol: 'crpt', + validator: ETHValidator, + }, { + name: 'Daneel', + symbol: 'dan', + validator: ETHValidator, + }, { + name: 'Streamr DATAcoin', + symbol: 'data', + validator: ETHValidator, + }, { + name: 'Dentacoin', + symbol: 'dcn', + validator: ETHValidator, + }, { + name: 'Dent', + symbol: 'dent', + validator: ETHValidator, + }, { + name: 'DigixDAO', + symbol: 'dgd', + validator: ETHValidator, + }, { + name: 'Digitex Futures', + symbol: 'dgtx', + validator: ETHValidator, + }, { + name: 'Agrello', + symbol: 'dlt', + validator: ETHValidator, + }, { + name: 'Dock', + symbol: 'dock', + validator: ETHValidator, + }, { + name: 'DomRaider', + symbol: 'drt', + validator: ETHValidator, + }, { + name: 'Dusk Network', + symbol: 'dusk', + validator: ETHValidator, + }, { + name: 'Edgeless', + symbol: 'edg', + validator: ETHValidator, + }, { + name: 'Eidoo', + symbol: 'edo', + validator: ETHValidator, + }, { + name: 'Electrify.Asia', + symbol: 'elec', + validator: ETHValidator, + }, { + name: 'aelf', + symbol: 'elf', + validator: ETHValidator, + }, { + name: 'Enigma', + symbol: 'eng', + validator: ETHValidator, + }, { + name: 'STASIS EURO', + symbol: 'eurs', + validator: ETHValidator, + }, { + name: 'Everex', + symbol: 'evx', + validator: ETHValidator, }, { name: 'VeChain', symbol: 'vet', @@ -12458,11 +12941,6 @@ var CURRENCIES = [{ symbol: 'matic', validator: ETHValidator }, - { - name: 'Decentraland', - symbol: 'mana', - validator: ETHValidator - }, { name: 'Solana', symbol: 'sol', @@ -12471,8 +12949,44 @@ var CURRENCIES = [{ minLength: 43 }, { - name: 'Binance', - symbol: 'bnb', + name: 'Fortuna', + symbol: 'fota', + validator: ETHValidator, + }, { + name: 'Fantom', + symbol: 'ftm', + validator: ETHValidator, + }, { + name: 'Etherparty', + symbol: 'fuel', + validator: ETHValidator, + }, { + name: 'Gifto', + symbol: 'gto', + validator: ETHValidator, + }, { + name: 'Gemini Dollar', + symbol: 'gusd', + validator: ETHValidator, + }, { + name: 'Genesis Vision', + symbol: 'gvt', + validator: ETHValidator, + }, { + name: 'Humaniq', + symbol: 'hmq', + validator: ETHValidator, + }, { + name: 'Holo', + symbol: 'hot', + validator: ETHValidator, + }, { + name: 'HOQU', + symbol: 'hqx', + validator: ETHValidator, + }, { + name: 'Huobi Token', + symbol: 'ht', validator: ETHValidator, }, { @@ -12480,35 +12994,466 @@ var CURRENCIES = [{ symbol: 'avax', validator: ETHValidator, }, -]; - - - module.exports = { - getByNameOrSymbol: function (currencyNameOrSymbol) { - var nameOrSymbol = currencyNameOrSymbol.toLowerCase(); - return CURRENCIES.find(function (currency) { - return currency.name.toLowerCase() === nameOrSymbol || currency.symbol.toLowerCase() === nameOrSymbol - }); + { + name: 'Ardor', + symbol: 'ardr', + validator: ARDRValidator, }, - getAll: function () { - return CURRENCIES; - } -}; - -////spit out details for readme.md -// CURRENCIES -// .sort((a, b) => a.name.toUpperCase() > b.name.toUpperCase() ? 1 : -1) -// .forEach(c => console.log(`* ${c.name}/${c.symbol} \`'${c.name}'\` or \`'${c.symbol}'\` `)); - -////spit out keywords for package.json -// CURRENCIES -// .sort((a, b) => a.name.toUpperCase() > b.name.toUpperCase() ? 1 : -1) -// .forEach(c => console.log(`"${c.name}","${c.symbol}",`)); -// - - -},{"./ada_validator":37,"./algo_validator":38,"./base58_validator":39,"./bch_validator":40,"./bip173_validator":41,"./bitcoin_validator":42,"./dot_validator":54,"./eos_validator":55,"./ethereum_validator":56,"./lisk_validator":57,"./monero_validator":58,"./nano_validator":59,"./nem_validator":60,"./ripple_validator":61,"./siacoin_validator":62,"./stellar_validator":63,"./tezos_validator":64,"./tron_validator":65,"./usdt_validator":66}],54:[function(require,module,exports){ -const cryptoUtils = require('./crypto/utils'); + { + name: 'Hedera Hashgraph', + symbol: 'hbar', + validator: HBARValidator, + }, + { + name: 'ICON', + symbol: 'icx', + validator: ICXValidator, + }, { + name: 'Internet of Services', + symbol: 'IOST', + validator: IOSTValidator, + }, + // disable iota validation for now + // { + // name: 'Iota', + // symbol: 'iota', + // validator: IOTAValidator, + // }, + { + name: 'IHT Real Estate Protocol', + symbol: 'iht', + validator: ETHValidator, + }, { + name: 'Insolar', + symbol: 'ins', + validator: ETHValidator, + }, { + name: 'IoTeX', + symbol: 'iotx', + validator: ETHValidator, + }, { + name: 'BitKan', + symbol: 'kan', + validator: ETHValidator, + }, { + name: 'Kcash', + symbol: 'kcash', + validator: ETHValidator, + }, { + name: 'KEY', + symbol: 'key', + validator: ETHValidator, + }, { + name: 'KickToken', + symbol: 'kick', + validator: ETHValidator, + }, { + name: 'Kyber Network', + symbol: 'knc', + validator: ETHValidator, + }, { + name: 'Lambda', + symbol: 'lamb', + validator: ETHValidator, + }, { + name: 'Aave', + symbol: 'lend', + validator: ETHValidator, + }, { + name: 'LinkEye', + symbol: 'let', + validator: ETHValidator, + }, { + name: 'LIFE', + symbol: 'life', + validator: ETHValidator, + }, { + name: 'LockTrip', + symbol: 'loc', + validator: ETHValidator, + }, { + name: 'Loopring', + symbol: 'lrc', + validator: ETHValidator, + }, { + name: 'Lunyr', + symbol: 'lun', + validator: ETHValidator, + }, { + name: 'Decentraland', + symbol: 'mana', + validator: ETHValidator, + }, { + name: 'Matic Network', + symbol: 'matic', + validator: ETHValidator, + }, { + name: 'MCO', + symbol: 'mco', + validator: ETHValidator, + }, { + name: 'Moeda Loyalty Points', + symbol: 'mda', + validator: ETHValidator, + }, { + name: 'Measurable Data Token', + symbol: 'mdt', + validator: ETHValidator, + }, { + name: 'Mainframe', + symbol: 'mft', + validator: ETHValidator, + }, { + name: 'Mithril', + symbol: 'mith', + validator: ETHValidator, + }, { + name: 'Molecular Future', + symbol: 'mof', + validator: ETHValidator, + }, { + name: 'Monetha', + symbol: 'mth', + validator: ETHValidator, + }, { + name: 'Mysterium', + symbol: 'myst', + validator: ETHValidator, + }, { + name: 'Nucleus Vision', + symbol: 'ncash', + validator: ETHValidator, + }, { + name: 'Nexo', + symbol: 'nexo', + validator: ETHValidator, + }, { + name: 'NAGA', + symbol: 'ngc', + validator: ETHValidator, + }, { + name: 'Noah Coin', + symbol: 'noah', + validator: ETHValidator, + }, { + name: 'Pundi X', + symbol: 'npxs', + validator: ETHValidator, + }, { + name: 'NetKoin', + symbol: 'ntk', + validator: ETHValidator, + }, { + name: 'OAX', + symbol: 'oax', + validator: ETHValidator, + }, { + name: 'Menlo One', + symbol: 'one', + validator: ETHValidator, + }, { + name: 'SoMee.Social', + symbol: 'ong', + validator: ETHValidator, + }, { + name: 'ORS Group', + symbol: 'ors', + validator: ETHValidator, + }, { + name: 'OST', + symbol: 'ost', + validator: ETHValidator, + }, { + name: 'Patron', + symbol: 'pat', + validator: ETHValidator, + }, { + name: 'Peculium', + symbol: 'pcl', + validator: ETHValidator, + }, { + name: 'Perlin', + symbol: 'perl', + validator: ETHValidator, + }, { + name: 'Pillar', + symbol: 'plr', + validator: ETHValidator, + }, { + name: 'PumaPay', + symbol: 'pma', + validator: ETHValidator, + }, { + name: 'Po.et', + symbol: 'poe', + validator: ETHValidator, + }, { + name: 'Power Ledger', + symbol: 'powr', + validator: ETHValidator, + }, { + name: 'Populous', + symbol: 'ppt', + validator: ETHValidator, + }, { + name: 'Presearch', + symbol: 'pre', + validator: ETHValidator, + }, { + name: 'Patientory', + symbol: 'ptoy', + validator: ETHValidator, + }, { + name: 'QuarkChain', + symbol: 'qkc', + validator: ETHValidator, + }, { + name: 'Quantstamp', + symbol: 'qsp', + validator: ETHValidator, + }, { + name: 'Revain', + symbol: 'r', + validator: ETHValidator, + }, { + name: 'Raiden Network Token', + symbol: 'rdn', + validator: ETHValidator, + }, { + name: 'Ren', + symbol: 'ren', + validator: ETHValidator, + }, { + name: 'Request', + symbol: 'req', + validator: ETHValidator, + }, { + name: 'Refereum', + symbol: 'rfr', + validator: ETHValidator, + }, { + name: 'SiaCashCoin', + symbol: 'scc', + validator: ETHValidator, + }, { + name: 'Sentinel', + symbol: 'sent', + validator: ETHValidator, + }, { + name: 'SkinCoin', + symbol: 'skin', + validator: ETHValidator, + }, { + name: 'SunContract', + symbol: 'snc', + validator: ETHValidator, + }, { + name: 'SingularDTV', + symbol: 'sngls', + validator: ETHValidator, + }, { + name: 'SONM', + symbol: 'snm', + validator: ETHValidator, + }, { + name: 'All Sports', + symbol: 'soc', + validator: ETHValidator, + }, { + name: 'SIRIN LABS Token', + symbol: 'srn', + validator: ETHValidator, + }, { + name: 'Stox', + symbol: 'stx', + validator: ETHValidator, + }, { + name: 'Substratum', + symbol: 'sub', + validator: ETHValidator, + }, { + name: 'SwftCoin', + symbol: 'swftc', + validator: ETHValidator, + }, { + name: 'Lamden', + symbol: 'tau', + validator: ETHValidator, + }, { + name: 'Telcoin', + symbol: 'tel', + validator: ETHValidator, + }, { + name: 'Chronobank', + symbol: 'time', + validator: ETHValidator, + }, { + name: 'Monolith', + symbol: 'tkn', + validator: ETHValidator, + }, { + name: 'Time New Bank', + symbol: 'tnb', + validator: ETHValidator, + }, { + name: 'Tierion', + symbol: 'tnt', + validator: ETHValidator, + }, { + name: 'Tripio', + symbol: 'trio', + validator: ETHValidator, + }, { + name: 'WeTrust', + symbol: 'trst', + validator: ETHValidator, + }, { + name: 'USDT ERC-20', + symbol: 'usdt20', + validator: ETHValidator, + }, { + name: 'Utrust', + symbol: 'utk', + validator: ETHValidator, + }, { + name: 'BLOCKv', + symbol: 'vee', + validator: ETHValidator, + }, { + name: 'VIBE', + symbol: 'vibe', + validator: ETHValidator, + }, { + name: 'Tael', + symbol: 'wabi', + validator: ETHValidator, + }, { + name: 'WePower', + symbol: 'wpr', + validator: ETHValidator, + }, { + name: 'Waltonchain', + symbol: 'wtc', + validator: ETHValidator, + }, { + name: 'BlitzPredict', + symbol: 'xbp', + validator: ETHValidator, + }, { + name: 'CryptoFranc', + symbol: 'xchf', + validator: ETHValidator, + }, { + name: 'Exchange Union', + symbol: 'xuc', + validator: ETHValidator, + }, { + name: 'YOU COIN', + symbol: 'you', + validator: ETHValidator, + }, { + name: 'Zap', + symbol: 'zap', + validator: ETHValidator, + }, { + name: 'loki', + symbol: 'loki', + addressTypes: { prod: ['114', '115', '116'], testnet: [] }, + iAddressTypes: { prod: ['115'], testnet: [] }, + validator: XMRValidator + }, { + name: 'STEEM', + symbol: 'steem', + validator: STEEMValidator + }, { + name: 'Syscoin', + symbol: 'sys', + addressTypes: { prod: ['3f'] }, + validator: SYSValidator + }, { + name: 'Scopuly', + symbol: 'sky', + validator: XLMValidator, + }, { + name: 'BTU Protocol', + symbol: 'btu', + validator: ETHValidator, + },{ + name: 'Multi-collateral DAI', + symbol: 'dai', + validator: ETHValidator, + }, { + name: 'Enjin Coin', + symbol: 'enj', + validator: ETHValidator, + }, { + name: 'Maker', + symbol: 'mkr', + validator: ETHValidator, + }, + // { + // name: 'PitisCoin', + // symbol: 'pts', # FIXME: symbol collides with ProtoShares + // validator: BTCValidator, + // }, + { + name: 'Luniverse', + symbol: 'luniverse', + validator: ETHValidator, + }, { + name: 'Binance Smart Chain', + symbol: 'bsc', + validator: ETHValidator, + }, + { + name: 'Binance', + symbol: 'bnb', + validator: BinanceValidator, + }, + { + name: 'EOS', + symbol: 'eos', + validator: EOSValidator, + }, { + name: 'Verge', + symbol: 'xvg', + addressTypes: { prod: ['1e'], testnet: ['6F'] }, + validator: BTCValidator, + }, + { + name: 'Zilliqa', + symbol: 'zil', + validator: ZILValidator + } +]; + + + module.exports = { + getByNameOrSymbol: function (currencyNameOrSymbol) { + var nameOrSymbol = currencyNameOrSymbol.toLowerCase(); + return CURRENCIES.find(function (currency) { + return currency.name.toLowerCase() === nameOrSymbol || currency.symbol.toLowerCase() === nameOrSymbol + }); + }, + getAll: function () { + return CURRENCIES; + } +}; + +////spit out details for readme.md +// CURRENCIES +// .sort((a, b) => a.name.toUpperCase() > b.name.toUpperCase() ? 1 : -1) +// .forEach(c => console.log(`* ${c.name}/${c.symbol} \`'${c.name}'\` or \`'${c.symbol}'\` `)); + +////spit out keywords for package.json +// CURRENCIES +// .sort((a, b) => a.name.toUpperCase() > b.name.toUpperCase() ? 1 : -1) +// .forEach(c => console.log(`"${c.name}","${c.symbol}",`)); +// + + +},{"./ada_validator":38,"./ae_validator":39,"./algo_validator":40,"./ardr_validator":41,"./atom_validator":42,"./base58_validator":43,"./bch_validator":44,"./binance_validator":45,"./bip173_validator":46,"./bitcoin_validator":47,"./dot_validator":59,"./eos_validator":60,"./ethereum_validator":61,"./hbar_validator":62,"./icx_validator":63,"./iost_validator":64,"./lisk_validator":65,"./monero_validator":66,"./nano_validator":67,"./nem_validator":68,"./nxt_validator":69,"./ripple_validator":70,"./siacoin_validator":71,"./steem_validator":72,"./stellar_validator":73,"./sys_validator":74,"./tezos_validator":75,"./tron_validator":76,"./usdt_validator":77,"./zil_validator":79}],59:[function(require,module,exports){ +const cryptoUtils = require('./crypto/utils'); // from https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58) const addressFormats = [ @@ -12568,7 +13513,7 @@ module.exports = { } } -},{"./crypto/utils":52}],55:[function(require,module,exports){ +},{"./crypto/utils":57}],60:[function(require,module,exports){ function isValidEOSAddress (address, currency, networkType) { var regex = /^[a-z0-9.]+$/g // Must be numbers, lowercase letters and decimal points only if (address.search(regex) !== -1 && address.length === 12) { @@ -12584,7 +13529,7 @@ module.exports = { } } -},{}],56:[function(require,module,exports){ +},{}],61:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); module.exports = { @@ -12620,7 +13565,52 @@ module.exports = { } }; -},{"./crypto/utils":52}],57:[function(require,module,exports){ +},{"./crypto/utils":57}],62:[function(require,module,exports){ +function isValidHBarAddress (address) { + const split = address.split('.') + if (split[0] !== '0' || split[1] !== '0') { + return false + } + if (split[2].length <= 6 && /^\d+$/g.test(split[2])) { + return true + } +} + +module.exports = { + isValidAddress: function (address, currency, networkType) { + return isValidHBarAddress(address) + }, +} + + +},{}],63:[function(require,module,exports){ +function isValidICXAddress (address, currency, networkType) { + var regex = /^hx[0-9a-f]{40}$/g // Begins with hx followed by 40 hex chars + if (address.search(regex) !== -1) { + return true + } else { + return false + } +} + +module.exports = { + isValidAddress: function (address, currency, networkType) { + return isValidICXAddress(address, currency, networkType) + }, +} + + +},{}],64:[function(require,module,exports){ +const iostRegex = new RegExp('^[a-z0-9_]{5,11}$') + +module.exports = { + isValidAddress: function (address, currency, networkType) { + return iostRegex.test(address) + }, +} + + +},{}],65:[function(require,module,exports){ (function (Buffer){(function (){ var cryptoUtils = require('./crypto/utils'); @@ -12642,7 +13632,7 @@ module.exports = { } }; }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/utils":52,"buffer":4}],58:[function(require,module,exports){ +},{"./crypto/utils":57,"buffer":5}],66:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils') var cnBase58 = require('./crypto/cnBase58') @@ -12708,7 +13698,7 @@ module.exports = { } } -},{"./crypto/cnBase58":49,"./crypto/utils":52}],59:[function(require,module,exports){ +},{"./crypto/cnBase58":54,"./crypto/utils":57}],67:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var baseX = require('base-x'); @@ -12737,7 +13727,7 @@ module.exports = { } }; -},{"./crypto/utils":52,"base-x":1}],60:[function(require,module,exports){ +},{"./crypto/utils":57,"base-x":1}],68:[function(require,module,exports){ (function (Buffer){(function (){ var cryptoUtils = require('./crypto/utils'); @@ -12764,7 +13754,19 @@ module.exports = { } }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/utils":52,"buffer":4}],61:[function(require,module,exports){ +},{"./crypto/utils":57,"buffer":5}],69:[function(require,module,exports){ +const nxtRegex = new RegExp("^NXT(-[A-Z0-9]{4}){3}-[A-Z0-9]{5}$"); + +module.exports = { + isValidAddress: function (address, currency, networkType) { + if (!nxtRegex.test(address)) { + return false; + } + return true; + }, +}; + +},{}],70:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var baseX = require('base-x'); @@ -12794,7 +13796,7 @@ module.exports = { } }; -},{"./crypto/utils":52,"base-x":1}],62:[function(require,module,exports){ +},{"./crypto/utils":57,"base-x":1}],71:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils') var isEqual = require('lodash.isequal') @@ -12824,7 +13826,35 @@ module.exports = { } } -},{"./crypto/utils":52,"lodash.isequal":34}],63:[function(require,module,exports){ +},{"./crypto/utils":57,"lodash.isequal":35}],72:[function(require,module,exports){ +const accountRegex = new RegExp('^[a-z0-9-.]{3,}$') +const segmentRegex = new RegExp('^[a-z][a-z0-9-]+[a-z0-9]$') +const doubleDashRegex = new RegExp('--') + +module.exports = { + isValidAddress: function (address, currency, networkType) { + if (!accountRegex.test(address)) { + return false; + } + let segments = address.split('.') + for (let i = 0; i < segments.length; i++) { + let segment = segments[i] + if (segment.length < 3) { + return false; + } + if (!segmentRegex.test(segment)) { + return false; + } + if (doubleDashRegex.test(segment)) { + return false; + } + } + return true; + }, +} + + +},{}],73:[function(require,module,exports){ var baseX = require('base-x'); var crc = require('crc'); var cryptoUtils = require('./crypto/utils'); @@ -12864,7 +13894,18 @@ module.exports = { } }; -},{"./crypto/utils":52,"base-x":1,"crc":30}],64:[function(require,module,exports){ +},{"./crypto/utils":57,"base-x":1,"crc":31}],74:[function(require,module,exports){ +const BTCValidator = require('./bitcoin_validator'); +var regexp = new RegExp('^sys1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}$') + +module.exports = { + isValidAddress: function (address, currency, networkType) { + return regexp.test(address) || BTCValidator.isValidAddress(address, currency, networkType) + }, +} + + +},{"./bitcoin_validator":47}],75:[function(require,module,exports){ const base58 = require('./crypto/base58'); const cryptoUtils = require('./crypto/utils'); @@ -12902,7 +13943,7 @@ module.exports = { isValidAddress }; -},{"./crypto/base58":44,"./crypto/utils":52}],65:[function(require,module,exports){ +},{"./crypto/base58":49,"./crypto/utils":57}],76:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); function decodeBase58Address(base58Sting) { @@ -12966,7 +14007,7 @@ module.exports = { } }; -},{"./crypto/utils":52}],66:[function(require,module,exports){ +},{"./crypto/utils":57}],77:[function(require,module,exports){ var BTCValidator = require('./bitcoin_validator'); var ETHValidator = require('./ethereum_validator'); @@ -12989,7 +14030,7 @@ module.exports = { } }; -},{"./bitcoin_validator":42,"./ethereum_validator":56}],67:[function(require,module,exports){ +},{"./bitcoin_validator":47,"./ethereum_validator":61}],78:[function(require,module,exports){ var currencies = require('./currencies'); var DEFAULT_CURRENCY_NAME = 'bitcoin'; @@ -13016,5 +14057,24 @@ module.exports = { } }; -},{"./currencies":53}]},{},[67])(67) +},{"./currencies":58}],79:[function(require,module,exports){ +const { bech32 } = require('bech32'); + +const ALLOWED_CHARS = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' + +var regexp = new RegExp('^(zil)1([' + ALLOWED_CHARS + ']+)$') // zil + bech32 separated by '1' + +module.exports = { + isValidAddress: function (address, currency, networkType) { + let match = regexp.exec(address) + if (!match) { + return false; + } + const decoded = bech32.decode(address); + return decoded && decoded.words.length === 32; + }, +} + + +},{"bech32":3}]},{},[78])(78) }); diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index 5703072a..b56a509c 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==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).WAValidator=t()}}(function(){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 h=r[a]={exports:{}};e[a][0].call(h.exports,function(t){return i(e[a][1][t]||t)},h,h.exports,t,e,r,n)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,h=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var l=0,d=a-1;(0!==c||l>>0,h[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");o=l,r++}for(var p=a-o;p!==a&&0===h[p];)p++;var y=n.allocUnsafe(i+(a-p));y.fill(0,0,i);for(var v=i;p!==a;)y[v++]=h[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,i=0,o=0,a=e.length;o!==a&&0===e[o];)o++,r++;for(var f=(a-o)*h+1>>>0,c=new Uint8Array(f);o!==a;){for(var l=e[o],d=0,p=f-1;(0!==l||d>>0,c[p]=l%s>>>0,l=l/s>>>0;if(0!==l)throw new Error("Non-zero carry");i=d,o++}for(var y=f-i;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=i[t.charCodeAt(c)]<<2|i[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=i[t.charCodeAt(c)]<<10|i[t.charCodeAt(c+1)]<<4|i[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],a=0,s=r-i;as?s:a+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function h(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},{}],3:[function(t,e,r){(function(t){(function(){var r,n=20,i=4,o=-7,a=21,s=-1e9,u=1e9,f=!0,h=parseInt,c=g.prototype,l="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=g(1);function g(t,e){var o,a,h,c,v,m,_=this;if(!(_ instanceof g))return new g(t,e);if(t instanceof g){if(d=0,e===o)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(h="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),m=t,e===o&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,i);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(b(e,2),v=p.test(t)):(c="["+l.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(h&&(t.replace(/^0\.0*|\./,"").length>15&&b(m,0),h=!h),t=w(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(b(m,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&b(m,3),_.s=null),void(d=0)}for((o=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(o<0&&(o=a),o+=+t.slice(a+1),t=t.substring(0,a)):o<0&&(o=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,h&&e>15&&t.slice(a).length>15&&b(m,0),d=0,(o-=a+1)>u)_.c=_.e=null;else if(a==e||oe-1&&(null==u[i+1]&&(u[i+1]=0),u[i+1]+=u[i]/e^0,u[i]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(i=t.length-i-1,o=h(new g(r).pow(i).toF(),10),a=h((s=t.split("."))[1]),s=h(s[0]),u=(f=m(a,o,a.length-o.length,n,e,1&s[s.length-1])).c,i=f.e){for(;++i;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[i=s.length-1]m?1:-1;else for(d=-1,l=0;++dw[d]?1:-1;break}if(!(l<0))break;for(h=m==f?e:p;m;){if(w[--m]k&&A(_,n,o,a,null!=w[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==i[0]?n+1:r?e:t.e+n+1;i.length1?(i.splice(1,0,"."),i.join("")):i[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,o){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,h=a[f],c=o||f<0||null!=a[f+1];if(o=i<4?(null!=h||c)&&(0==i||2==i&&!s||3==i&&s):h>u||h==u&&(4==i||c||6==i&&(1&a[f-1]||!e&&n)||7==i&&!s||8==i&&s),f<1||!a[0])return a.length=0,a.push(0),o?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,o)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=i;return i=r,(t=new g(t)).c&&A(t,e,10),i=n,t}g.ROUND_UP=0,g.ROUND_DOWN=1,g.ROUND_CEIL=2,g.ROUND_FLOOR=3,g.ROUND_HALF_UP=4,g.ROUND_HALF_DOWN=5,g.ROUND_HALF_EVEN=6,g.ROUND_HALF_CEIL=7,g.ROUND_HALF_FLOOR=8,g.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var i=[],o=0;on)||h(t)!=t&&0!==t)},w=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return w(e="DECIMAL_PLACES")&&(g(t,0,1e9)?n=0|t:b(t,e,v)),l[e]=n,w(e="ROUNDING_MODE")&&(g(t,0,8)?i=0|t:b(t,e,v)),l[e]=i,w(e="EXPONENTIAL_AT")&&(g(t,-1e9,1e9)?o=-(a=~~(t<0?-t:+t)):!r&&t&&g(t[0],-1e9,0)&&g(t[1],0,1e9)?(o=~~t[0],a=~~t[1]):b(t,e,v,1)),l[e]=[o,a],w(e="RANGE")&&(g(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&g(t[0],-1e9,-1)&&g(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):b(t,e,v,1,1)),l[e]=[s,u],w(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,h=(f=!!t)?parseInt:parseFloat):b(t,e,v,0,0,1)),l[e]=f,l},c.abs=c.absoluteValue=function(){var t=new g(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,i=n.c,o=(d=-d,t=new g(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=i&&!i[0],e=o&&!o[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!i||!o)return e?0:!i^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=i.length)<(f=o.length)?u:f;++ao[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,i=this.s,o=(d=2,t=new g(t,e)).c,a=t.e,s=t.s,u=i==s?1:-1;return(n||r&&r[0])&&(a||o&&o[0])?m(r,o,n-a,u,10):new g(i&&s&&(r?!o||r[0]!=o[0]:o)?r&&0==r[0]||!o?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,o,a,u=this,f=u.s;if(e=(d=8,t=new g(t,e)).s,!f||!e)return new g(NaN);if(f!=e)return t.s=-e,u.plus(t);var h=u.c,c=u.e,l=t.c,p=t.e;if(!c||!p){if(!h||!l)return h?(t.s=-e,t):new g(l?u:NaN);if(!h[0]||!l[0])return l[0]?(t.s=-e,t):new g(h[0]?u:3==i?-0:0)}if(h=h.slice(),f=c-p){for((r=(a=f<0)?(f=-f,h):(p=c,l)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(o=((a=h.length0)for(;e--;h[o++]=0);for(e=l.length;e>f;){if(h[--e]0?(s=o,f):(i=-i,a)).reverse();i--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),i=f.length,e=0;i;e=(a[--i]=a[i]+f[i]+e)/10^0,a[i]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),i=a.length;0==a[--i];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new g(this),i=new g(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||h(t)!=t&&0!==t&&!(e=NaN))&&!b(t,"exponent","pow")||!e)return new g(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(i=i.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(i):i},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||h(t)!=t)&&!b(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||h(e)!=e&&0!==e)&&!b(e,"mode","round")?i:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,o,a=this,s=a.c,u=a.s,f=a.e,h=n,c=i,l=new g("0.5");if(1!==u||!s||!s[0])return new g(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),i=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new g(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new g(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(o=e,e=l.times(o.plus(a.div(o))),o.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=h+a;f>a;e=r[f]+o[a]*i[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&h.copy(i,4+(128&h[0]?1:0)),128&h[0]&&(i[4]=0),i[0]=n&255<<24,i[1]=n&255<<16,i[2]=65280&n,i[3]=255&n;var o=this.lt(0);if(o)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||h(t)!=t&&0!==t)&&!b(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,i,s=this;return null==t||((r=t<0||t>1e9)||h(t)!=t&&0!==t)&&!b(t,"decimal places","toF")||(i=s.e+(0|t)),e=o,t=a,o=-(a=1/0),i==n?n=s.toS():(n=_(s,i),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),o=e,a=t,n},c.toFraction=c.toFr=function(t){var e,o,a,s,h,c,l,p=s=new g(v),y=a=new g("0"),w=this,m=w.c,_=u,A=n,x=i,E=new g(v);if(!m)return w.toS();for(l=E.e=m.length-w.e-1,(null==t||(!(d=12,c=new g(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=l>0?E:p),u=1/0,c=new g(m.join("")),n=0,i=1;e=c.div(E),1!=(h=s.plus(e.times(y))).cmp(t);)s=y,y=h,p=a.plus(e.times(h=p)),a=h,E=c.minus(e.times(h=E)),c=h;return h=t.minus(s).div(y),a=a.plus(h.times(p)),s=s.plus(h.times(y)),a.s=p.s=w.s,n=2*l,i=x,o=p.div(y).minus(w).abs().cmp(a.div(s).minus(w).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,o},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||h(t)!=t)&&!b(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,i,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=o||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(i=n.length,u>0)if(++u>i)for(u-=i;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)b(t,"base","toS");else if("0"==(n=w(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=g}).call(this)}).call(this,t("buffer").Buffer)},{buffer:4}],4:[function(t,e,r){"use strict";var n=t("base64-js"),i=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return h(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return 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 d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return N(t).length;default:if(i)return n?-1:M(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(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),P(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:v(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):v(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function v(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 h=-1;for(o=r;os&&(r=s-u),o=r;o>=0;o--){for(var c=!0,l=0;li&&(n=i):n=i;var o=e.length;n>o/2&&(n=o/2);for(var a=0;a>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+c<=r)switch(c){case 1:f<128&&(h=f);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&f)<<6|63&o)>127&&(h=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)&&(h=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&&(h=u)}null===h?(h=65533,c=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return B(this,e,r);case"latin1":case"binary":return S(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,i){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);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(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var o=i-n,a=r-e,u=Math.min(o,a),f=this.slice(n,i),h=t.slice(e,r),c=0;c>>=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=!1;;)switch(n){case"hex":return g(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return w(this,t,e,r);case"latin1":case"binary":return m(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function B(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 L(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 O(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||O(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,o){return e=+e,r>>>=0,o||O(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,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||T(t,e,this.length);for(var n=this[t],i=1,o=0;++o>>=0,e>>>=0,r||T(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||T(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(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||T(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||T(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||T(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||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||T(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||T(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||T(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||T(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||T(t,4,this.length),i.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(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)||L(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)||L(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||L(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||L(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||L(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||L(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||L(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);L(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);L(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||L(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||L(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||L(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||L(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||L(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--o)t[o+e]=this[o+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=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 N(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:31}],5:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),i=Math.pow(2,32),o=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,i=s+t;r>2,f=0;f>6),i.push(128|63&a)):a<55296?(i.push(224|a>>12),i.push(128|a>>6&63),i.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,i.push(240|a>>18),i.push(128|a>>12&63),i.push(128|a>>6&63),i.push(128|63&a))}return l(3,i.length),c(i);default:var d;if(Array.isArray(e))for(l(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof o&&(o=function(){return r});var g=function t(){var i,l,g=h(),b=g>>5,w=31&g;if(7===b)switch(w){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),i=32768&r,o=31744&r,a=1023&r;if(31744===o)o=261120;else if(0!==o)o+=114688;else if(0!==a)return a*n;return e.setUint32(0,i<<16|o<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((l=p(w))<0&&(b<2||6=0;)_+=l,m.push(f(l));var A=new Uint8Array(_),x=0;for(i=0;i=0;)v(E,l);else v(E,l);return String.fromCharCode.apply(null,E);case 4:var k;if(l<0)for(k=[];!d();)k.push(t());else for(k=new Array(l),i=0;i>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:65535,o=0;o>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:0,o=0;o>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:65535,o=0;o>8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=o(t("./create_buffer"));function o(t){return t&&t.__esModule?t:{default:t}}var a=(0,o(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:0,o=0;o>>8&255;a^=255&t[o],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":28,"./define_crc":29,buffer:4}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=void 0!==e?~~e:11994318,o=0;o>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=0===e?0:-1^~~e,o=0;o>>8}return-1^r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=a(t("./create_buffer")),o=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,o.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=~~e,o=0;o1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,i.default)(t));for(var r=0===e?0:~~e,o=0;o>>8}return r});r.default=u},{"./create_buffer":28,"./define_crc":29,buffer:4}],28:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),i=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=i},{buffer:4}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],30:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":6,"./crc16":7,"./crc16_ccitt":8,"./crc16_kermit":9,"./crc16_modbus":10,"./crc16_xmodem":11,"./crc24":12,"./crc32":13,"./crc8":14,"./crc8_1wire":15,"./crcjam":16}],31:[function(t,e,r){r.read=function(t,e,r,n,i){var o,a,s=8*i-n-1,u=(1<>1,h=-7,c=r?i-1:0,l=r?-1:1,d=t[e+c];for(c+=l,o=d&(1<<-h)-1,d>>=-h,h+=s;h>0;o=256*o+t[e+c],c+=l,h-=8);for(a=o&(1<<-h)-1,o>>=-h,h+=n;h>0;a=256*a+t[e+c],c+=l,h-=8);if(0===o)o=1-f;else{if(o===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),o-=f}return(d?-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,h=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,p=n?1:-1,y=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=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?l/u:l*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=h?(s=0,a=h):a+c>=1?(s=(e*u-1)*Math.pow(2,i),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,i),a=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],32:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",i="object"==typeof window,o=i?window:{};o.JS_SHA512_NO_WINDOW&&(i=!1);var a=!i&&"object"==typeof self;!o.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?o=r:a&&(o=self);var s=!o.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!o.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),h=[-2147483648,8388608,32768,128],c=[24,16,8,0],l=[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],d=["hex","array","digest","arrayBuffer"],p=[];!o.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!o.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new w(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new w(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[h++]=128|63&s):s<55296||s>=57344?(f[h++]=224|s>>12,f[h++]=128|s>>6&63,f[h++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[h++]=240|s>>18,f[h++]=128|s>>12&63,f[h++]=128|s>>6&63,f[h++]=128|63&s);t=f}t.length>128&&(t=new w(e,!0).update(t).array());var l=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;l[c]=92^p,d[c]=54^p}w.call(this,e,r),this.update(d),this.oKeyPad=l,this.inner=!0,this.sharedMemory=r}w.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var i,o,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(f[o>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=128?(this.block=f[32],this.start=o-128,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},w.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=h[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},w.prototype.hash=function(){var t,e,r,n,i,o,a,s,u,f,h,c,d,p,y,v,g,b,w,m,_,A,x,E,k,B=this.h0h,S=this.h0l,C=this.h1h,U=this.h1l,T=this.h2h,L=this.h2l,O=this.h3h,I=this.h3l,R=this.h4h,j=this.h4l,H=this.h5h,M=this.h5l,N=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((m=V[t-30])>>>1|(_=V[t-29])<<31)^(m>>>8|_<<24)^m>>>7,r=(_>>>1|m<<31)^(_>>>8|m<<24)^(_>>>7|m<<25),n=((m=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|m<<3)^m>>>6,i=(_>>>19|m<<13)^(m>>>29|_<<3)^(_>>>6|m<<26),m=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(m>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&m)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(i>>>16)+((o=(65535&x)+(65535&_)+(65535&r)+(65535&i))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&o;var D=B,$=S,q=C,Y=U,X=T,J=L,W=O,Z=I,G=R,K=j,Q=H,tt=M,et=N,rt=z,nt=F,it=P;for(v=q&X,g=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),i=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),b=(f=D&q)^D&X^v,w=(h=$&Y)^$&J^g,E=G&Q^~G&et,k=K&tt^~K&rt,m=V[t],_=V[t+1],m=(u=((A=l[t])>>>16)+(m>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&m)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=l[t+1])>>>16)+(_>>>16)+(k>>>16)+(i>>>16)+(it>>>16)+((o=(65535&x)+(65535&_)+(65535&k)+(65535&i)+(65535&it))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&o,A=(u=(b>>>16)+(e>>>16)+((s=(65535&b)+(65535&e)+((a=(w>>>16)+(r>>>16)+((o=(65535&w)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&o,nt=(u=(W>>>16)+(m>>>16)+((s=(65535&W)+(65535&m)+((a=(Z>>>16)+(_>>>16)+((o=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,it=a<<16|65535&o,e=((W=(u=(A>>>16)+(m>>>16)+((s=(65535&A)+(65535&m)+((a=(x>>>16)+(_>>>16)+((o=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&o)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|it<<18)^(nt>>>18|it<<14)^(it>>>9|nt<<23),i=(it>>>14|nt<<18)^(it>>>18|nt<<14)^(nt>>>9|it<<23),b=(c=W&D)^W&q^f,w=(d=Z&$)^Z&Y^h,E=nt&G^~nt&Q,k=it&K^~it&tt,m=V[t+2],_=V[t+3],m=(u=((A=l[t+2])>>>16)+(m>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&m)+(65535&E)+(65535&n)+(65535&et)+((a=((x=l[t+3])>>>16)+(_>>>16)+(k>>>16)+(i>>>16)+(rt>>>16)+((o=(65535&x)+(65535&_)+(65535&k)+(65535&i)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&o,A=(u=(b>>>16)+(e>>>16)+((s=(65535&b)+(65535&e)+((a=(w>>>16)+(r>>>16)+((o=(65535&w)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&o,et=(u=(X>>>16)+(m>>>16)+((s=(65535&X)+(65535&m)+((a=(J>>>16)+(_>>>16)+((o=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&o,e=((X=(u=(A>>>16)+(m>>>16)+((s=(65535&A)+(65535&m)+((a=(x>>>16)+(_>>>16)+((o=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&o)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),i=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),b=(p=X&W)^X&D^c,w=(y=J&Z)^J&$^d,E=et&nt^~et&G,k=rt&it^~rt&K,m=V[t+4],_=V[t+5],m=(u=((A=l[t+4])>>>16)+(m>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&m)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=l[t+5])>>>16)+(_>>>16)+(k>>>16)+(i>>>16)+(tt>>>16)+((o=(65535&x)+(65535&_)+(65535&k)+(65535&i)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&o,A=(u=(b>>>16)+(e>>>16)+((s=(65535&b)+(65535&e)+((a=(w>>>16)+(r>>>16)+((o=(65535&w)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&o,Q=(u=(q>>>16)+(m>>>16)+((s=(65535&q)+(65535&m)+((a=(Y>>>16)+(_>>>16)+((o=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&o,e=((q=(u=(A>>>16)+(m>>>16)+((s=(65535&A)+(65535&m)+((a=(x>>>16)+(_>>>16)+((o=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&o)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),i=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),b=(v=q&X)^q&W^p,w=(g=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&it,m=V[t+6],_=V[t+7],m=(u=((A=l[t+6])>>>16)+(m>>>16)+(E>>>16)+(n>>>16)+(G>>>16)+((s=(65535&A)+(65535&m)+(65535&E)+(65535&n)+(65535&G)+((a=((x=l[t+7])>>>16)+(_>>>16)+(k>>>16)+(i>>>16)+(K>>>16)+((o=(65535&x)+(65535&_)+(65535&k)+(65535&i)+(65535&K))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&o,A=(u=(b>>>16)+(e>>>16)+((s=(65535&b)+(65535&e)+((a=(w>>>16)+(r>>>16)+((o=(65535&w)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&o,G=(u=(D>>>16)+(m>>>16)+((s=(65535&D)+(65535&m)+((a=($>>>16)+(_>>>16)+((o=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,K=a<<16|65535&o,D=(u=(A>>>16)+(m>>>16)+((s=(65535&A)+(65535&m)+((a=(x>>>16)+(_>>>16)+((o=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&o;u=(B>>>16)+(D>>>16)+((s=(65535&B)+(65535&D)+((a=(S>>>16)+($>>>16)+((o=(65535&S)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&o,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(U>>>16)+(Y>>>16)+((o=(65535&U)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&o,u=(T>>>16)+(X>>>16)+((s=(65535&T)+(65535&X)+((a=(L>>>16)+(J>>>16)+((o=(65535&L)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&o,u=(O>>>16)+(W>>>16)+((s=(65535&O)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((o=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&o,u=(R>>>16)+(G>>>16)+((s=(65535&R)+(65535&G)+((a=(j>>>16)+(K>>>16)+((o=(65535&j)+(65535&K))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&o,u=(H>>>16)+(Q>>>16)+((s=(65535&H)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((o=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&o,u=(N>>>16)+(et>>>16)+((s=(65535&N)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((o=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&o,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(it>>>16)+((o=(65535&P)+(65535&it))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&o},w.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,i=this.h2h,o=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,h=this.h4l,c=this.h5h,l=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,g=this.bits,b=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return g>=256&&(b+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),g>=384&&(b+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]),512==g&&(b+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),b},w.prototype.toString=w.prototype.hex,w.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,i=this.h2h,o=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,h=this.h5h,c=this.h5l,l=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,g=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,i>>24&255,i>>16&255,i>>8&255,255&i,o>>24&255,o>>16&255,o>>8&255,255&o,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&g.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&g.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,h>>24&255,h>>16&255,h>>8&255,255&h,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&g.push(l>>24&255,l>>16&255,l>>8&255,255&l,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),g},w.prototype.array=w.prototype.digest,w.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},w.prototype.clone=function(){var t=new w(this.bits,!1);return this.copyTo(t),t},w.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;eb)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=N,v=z,d=160,g=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,i){var o,a;if("SHA-224"===t||"SHA-256"===t)o=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");o=31+(r+129>>>10<<5),a=32}for(;e.length<=o;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[o]=4294967295&r,e[o-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},S=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,B=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,B=!0}v=function(t,e,r,n,i){var o,a=C,s=[],u=(r=p)>>>5,f=0,h=e>>>5;for(o=0;o=r;o+=u)n=P(t.slice(o,o+u),n),e-=r;for(t=t.slice(o),e%=r;t.length>>3)>>2]^=a<=i));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}o=l(e,n,S),i=M(t),this.setHMACKey=function(e,r,o){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===B)throw Error("SHAKE is not supported for HMAC");for(e=(r=l(r,n=(o||{}).encoding||"UTF8",S)(e)).binLen,r=r.value,o=(a=p>>>3)/4-1,a>>5;for(t=(e=o(t,m,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,o,l,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(l=c(r),!0===B){if(-1===l.shakeLen)throw Error("shakeLen must be specified in options");d=l.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,S,l)};break;case"B64":n=function(t){return s(t,d,S,l)};break;case"BYTES":n=function(t){return u(t,d,S)};break;case"ARRAYBUFFER":try{o=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,S)};break;case"UINT8ARRAY":try{o=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return h(t,d,S)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(m.slice(),_,w,g(i),d),o=1;o>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,o,l,b;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(l=c(r),e){case"HEX":n=function(t){return a(t,d,S,l)};break;case"B64":n=function(t){return s(t,d,S,l)};break;case"BYTES":n=function(t){return u(t,d,S)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,S)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return h(t,d,S)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return o=v(m.slice(),_,w,g(i),d),b=y(E,M(t)),n(b=v(o,d,p,b,d))}}function i(t,e){this.a=t,this.b=e}function o(t,e,r,n){var i,o,a,s,u;for(e=e||[0],o=(r=r||0)>>>3,u=-1===n?3:0,i=0;i>>2,e.length<=a&&e.push(0),e[a]|=t[i]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var i,o,a,s="";for(e/=8,a=-1===r?3:0,i=0;i>>2]>>>8*(a+i%4*r),s+="0123456789abcdef".charAt(o>>>4&15)+"0123456789abcdef".charAt(15&o);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var i,o,a,s,u="",f=e/8;for(s=-1===r?3:0,i=0;i>>2]:0,a=i+2>>2]:0,a=(t[i>>>2]>>>8*(s+i%4*r)&255)<<16|(o>>>8*(s+(i+1)%4*r)&255)<<8|a>>>8*(s+(i+2)%4*r)&255,o=0;4>o;o+=1)u+=8*i+6*o<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-o)&63):n.b64Pad;return u}function u(t,e,r){var n,i,o,a="";for(e/=8,o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255,a+=String.fromCharCode(i);return a}function f(t,e,r){e/=8;var n,i,o,a=new ArrayBuffer(e);for(o=new Uint8Array(a),i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255;return a}function h(t,e,r){e/=8;var n,i,o=new Uint8Array(e);for(i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255;return o}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function l(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var i,o,a,s,u,f,h=t.length;if(0!=h%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,i=0;i>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=o<<8*(f+s%4*r)}return{value:e,binLen:4*h+n}};break;case"TEXT":t=function(t,n,i){var o,a,s,u,f,h,c,l,d=0;if(n=n||[0],f=(i=i||0)>>>3,"UTF8"===e)for(l=-1===r?3:0,s=0;s(o=t.charCodeAt(s))?a.push(o):2048>o?(a.push(192|o>>>6),a.push(128|63&o)):55296>o||57344<=o?a.push(224|o>>>12,128|o>>>6&63,128|63&o):(s+=1,o=65536+((1023&o)<<10|1023&t.charCodeAt(s)),a.push(240|o>>>18,128|o>>>12&63,128|o>>>6&63,128|63&o)),u=0;u>>2;n.length<=h;)n.push(0);n[h]|=a[u]<<8*(l+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(l=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),h=(c=d+f)>>>2;n.length<=h;)n.push(0);n[h]|=o<<8*(l+c%4*r),d+=2}return{value:n,binLen:8*d+i}};break;case"B64":t=function(t,e,n){var i,o,a,s,u,f,h,c,l=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(o=t.indexOf("="),t=t.replace(/\=/g,""),-1!==o&&o=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,N=this.h4l,H=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=N,Q=H,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(N>>>16)+(G>>>16)+((i=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(H>>>16)+(Q>>>16)+((s=(65535&H)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i { + valid('ak_AT2bs7LkqwKbPUj5waoqq1E7QYgRzXUbaBanDHXDVsaCJ8gRA', 'ae') + valid('ak_8QxnP9qXP3NpA4fskYZE7P1GfHzKZAMmoNuok7jJC5NqVYi21', 'ae') + }); + + it('should return true for correct Ardor addresses', () => { + valid('ARDOR-HFNE-E2VE-SMV3-DCRZ8', 'ardr') + }); + it('should return true for correct siacoin addresses', function () { valid( 'a9b01c85163638682b170d82de02b8bb99ba86092e9ab1b0d25111284fe618e93456915820f1', @@ -633,6 +652,7 @@ describe('WAValidator.validate()', function () { valid('0xa7E43b445cF68CAa143a884AF673121447F29EAe', 'vet'); valid('0x46B8aABa5Eaa84Dc074c350eD57D8b3c35B90E09', 'VeChain'); valid('0x6d57D1697277C9Bb01A5265EC00558A639CA308A', 'VET'); + valid('0x1374A7E9d5Ed5CFF9c56a0e57B3d8a836a378715', 'vet') }); it('should return true for correct algo addresses', function () { @@ -844,6 +864,48 @@ describe('WAValidator.validate()', function () { valid('G4qGCGF4vWGPzYi2pxc2Djvgv3j8NiWaHQMgTVebCX6W', 'sol'); }); + it('should return true for correct Cosmos addresses', () => { + valid('cosmos1xxkueklal9vejv9unqu80w9vptyepfa95pd53u', 'atom') + }); + + it('should return true for correct HashGraph addresses', () => { + valid('0.0.10819', 'hbar') + valid('0.0.13458', 'hbar') + valid('0.0.16952', 'hbar') + }); + + it('should return true for incorrect ICON addresses', () => { + valid('hxf5a52d659df00ef0517921647516daaf7502a728', 'icx') + }); + + it('should return true for correct IOST addresses', () => { + valid('binanceiost', 'iost') + }); + + it('should return true for incorrect NXT addresses', () => { + valid('NXT-799W-TN9C-GL3Q-D3PXU', 'nxt') + valid('NXT-TMVC-69YC-SJB4-8YCH7', 'nxt') + }); + + it('should return true for correct STEEM addresses', () => { + valid('disconnect', 'steem'); + }); + + it('should return true for correct Syscoin addresses', () => { + valid('SdzKyvhD2Y3xJvGVSfx96NXszq6x9BZX34', 'sys') + valid('SSSBZDMVxuZyEMW4s6ar79Cf9UKqy6ZCwf', 'sys') + valid('SUQ4gsnsTUeYJgTLsQ3siryr9HfHp95p12', 'sys') + valid('SdzKyvhD2Y3xJvGVSfx96NXszq6x9BZX34', 'sys') + valid('SbmNaK9hVn9BUoPoPtTmXogfGfZd5Mophm', 'sys') + valid('SQUDdLog219Hpcz6Zss4uXg6xU1pAcnbLF', 'sys') + valid('STxiBMedbmA28ip1QMooZaTBHxyiwVSCSr', 'sys') + valid('SV4yxaugDJB6WXT5hNJwN1Pz6M8TjrMmJ6', 'sys') + }); + + it('should return true for correct Zilliqa addresses', () => { + valid('zil1pk6fe395e9lfkglv0m70daezm5en0t62hty7f7', 'zil') + }); + }); describe('invalid results', function () { @@ -1541,6 +1603,46 @@ describe('invalid results', function () { invalid('CxDDSH8gS7jecsxaRL8Txf8H5kqesLXAEAEgp76Yz632J9M', 'dot'); }); + it('should return false for incorrect binance smart chain address', function () { + // this is a bep-2 address + invalid('bnb1xlvns0n2mxh77mzaspn2hgav4rr4m8eerfju38', 'bsc'); + }); + + it('should return false for incorrect Cosmos addresses', () => { + invalid('cosmo15v50ymp6n5dn73erkqtmq0u8adpl8d3ujv2e74', 'atom') + invalid('cosmos25v50ymp6n5dn73erkqtmq0u8adpl8d3ujv2e74', 'atom') + invalid('cosmos15v50ymp6n5dn73erkQtmq0u8adpl8d3ujv2e74', 'atom') + }); + + it('should return false for incorrect HashGraph addresses', () => { + invalid('1.0.10819', 'hbar') + }); + + it('should return false for incorrect ICON addresses', () => { + invalid('gxde8ba8fd110625a0c47ecf29de308b8f5bd20ed6', 'icx') + invalid('hxde8ba8fd110625a0c47ecf29de308b8f5bd20eD6', 'icx') + }); + + it('should return true for correct IOST addresses', () => { + invalid('rekt', 'iost') + }); + + it('should return false for incorrect NXT addresses', () => { + invalid('NXT-799W-TN9C-GL3Q', 'nxt') + invalid('NEXT-799W-TN9C-GL3Q', 'nxt') + }); + + it('should return false for incorrect STEEM addresses', () => { + invalid('meet--crypto8', 'steem'); + invalid('me.etcrypto8', 'steem'); + invalid('met.8etcrypto8', 'steem'); + invalid('me', 'steem'); + invalid('.', 'steem'); + }); + + it('should return false for incorrect Zilliqa addresses', () => { + invalid('0xda816e2122a8a39b0926bfa84edd3d42477e9efE', 'zil') + }); }); diff --git a/yarn.lock b/yarn.lock index b747a1cd..42f85862 100644 --- a/yarn.lock +++ b/yarn.lock @@ -210,6 +210,11 @@ base64id@2.0.0, base64id@~2.0.0: resolved "https://registry.yarnpkg.com/base64id/-/base64id-2.0.0.tgz#2770ac6bc47d312af97a8bf9a634342e0cd25cb6" integrity sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog== +bech32@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/bech32/-/bech32-2.0.0.tgz#078d3686535075c8c79709f054b1b226a133b355" + integrity sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg== + binary-extensions@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" From c4b12cea8db2bee84bddb6cf998220030b1bae7c Mon Sep 17 00:00:00 2001 From: David Wright Date: Fri, 7 Oct 2022 16:01:53 -0700 Subject: [PATCH 2/6] minor cleanup --- dist/wallet-address-validator.js | 98 +++++++++++----------------- dist/wallet-address-validator.min.js | 2 +- src/currencies.js | 98 +++++++++++----------------- test/wallet_address_validator.js | 7 +- 4 files changed, 81 insertions(+), 124 deletions(-) diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 4498e3b1..0e172f39 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -12705,6 +12705,10 @@ var CURRENCIES = [{ name: 'Stellar', symbol: 'xlm', validator: XLMValidator, + }, { + name: 'BTU Protocol', + symbol: 'btu', + validator: ETHValidator, }, { name: 'Crypto.com Coin', symbol: 'cro', @@ -12717,6 +12721,14 @@ var CURRENCIES = [{ // validator: ETHValidator, // }, { + name: 'Multi-collateral DAI', + symbol: 'dai', + validator: ETHValidator, + }, { + name: 'Enjin Coin', + symbol: 'enj', + validator: ETHValidator, + }, { name: 'HedgeTrade', symbol: 'hedg', validator: ETHValidator, @@ -12732,6 +12744,10 @@ var CURRENCIES = [{ name: 'Loom Network', symbol: 'loom', validator: ETHValidator, + }, { + name: 'Maker', + symbol: 'mkr', + validator: ETHValidator, }, { name: 'Metal', symbol: 'mtl', @@ -12860,95 +12876,81 @@ var CURRENCIES = [{ name: 'VeChain', symbol: 'vet', validator: ETHValidator - }, - { + }, { name: 'StormX', symbol: 'stmx', validator: ETHValidator - }, - { + }, { name: 'AugurV2', symbol: 'repv2', validator: ETHValidator - }, - { + }, { name: 'FirmaChain', symbol: 'fct', validator: ETHValidator - }, - { + }, { name: 'BlockTrade', symbol: 'btt', validator: ETHValidator - }, - { + }, { name: 'Quantum Resistant Ledger', symbol: 'qrl', validator: ETHValidator - }, - { + }, { name: 'Serve', symbol: 'serv', validator: ETHValidator - }, - { + }, { name: 'Tap', symbol: 'xtp', validator: ETHValidator - }, - { + }, { name: 'Compound', symbol: 'comp', validator: ETHValidator - }, - { + }, { name: 'Paxos', symbol: 'pax', validator: ETHValidator - }, - { + }, { name: 'USD Coin', symbol: 'usdc', validator: ETHValidator - }, - { + }, { name: 'CUSD', symbol: 'cusd', validator: ETHValidator - }, - { + }, { name: 'Algorand', symbol: 'algo', validator: AlgoValidator - }, - { + }, { name: 'Polkadot', symbol: 'dot', validator: DotValidator - }, - { + }, { name: 'Uniswap Coin', symbol: 'uni', validator: ETHValidator - }, - { + }, { name: 'Aave Coin', symbol: 'aave', validator: ETHValidator - }, - { + }, { name: 'Matic', symbol: 'matic', validator: ETHValidator - }, - { + }, { + name: 'Decentraland', + symbol: 'mana', + validator: ETHValidator, + }, { name: 'Solana', symbol: 'sol', validator: Base58Validator, maxLength: 44, minLength: 43 - }, - { + }, { name: 'Fortuna', symbol: 'fota', validator: ETHValidator, @@ -13079,14 +13081,6 @@ var CURRENCIES = [{ name: 'Lunyr', symbol: 'lun', validator: ETHValidator, - }, { - name: 'Decentraland', - symbol: 'mana', - validator: ETHValidator, - }, { - name: 'Matic Network', - symbol: 'matic', - validator: ETHValidator, }, { name: 'MCO', symbol: 'mco', @@ -13374,22 +13368,6 @@ var CURRENCIES = [{ name: 'Scopuly', symbol: 'sky', validator: XLMValidator, - }, { - name: 'BTU Protocol', - symbol: 'btu', - validator: ETHValidator, - },{ - name: 'Multi-collateral DAI', - symbol: 'dai', - validator: ETHValidator, - }, { - name: 'Enjin Coin', - symbol: 'enj', - validator: ETHValidator, - }, { - name: 'Maker', - symbol: 'mkr', - validator: ETHValidator, }, // { // name: 'PitisCoin', diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index b56a509c..a38992ae 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==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).WAValidator=t()}}(function(){return function(){return function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return o(e[a][1][t]||t)},l,l.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,N=this.h4l,H=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=N,Q=H,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(N>>>16)+(G>>>16)+((i=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(H>>>16)+(Q>>>16)+((s=(65535&H)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,N=this.h4l,H=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=N,Q=H,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(N>>>16)+(G>>>16)+((i=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(H>>>16)+(Q>>>16)+((s=(65535&H)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i { + it('should return true for correct Ardor addresses', () => { valid('ARDOR-HFNE-E2VE-SMV3-DCRZ8', 'ardr') }); @@ -874,8 +874,9 @@ describe('WAValidator.validate()', function () { valid('0.0.16952', 'hbar') }); - it('should return true for incorrect ICON addresses', () => { + it('should return true for correct ICON addresses', () => { valid('hxf5a52d659df00ef0517921647516daaf7502a728', 'icx') + valid('hx7498b6b4b6da57f8880332aea80555aa6b115bd6', 'icx') }); it('should return true for correct IOST addresses', () => { @@ -1604,7 +1605,7 @@ describe('invalid results', function () { }); it('should return false for incorrect binance smart chain address', function () { - // this is a bep-2 address + // this is a bep-2 binance address (bnb) invalid('bnb1xlvns0n2mxh77mzaspn2hgav4rr4m8eerfju38', 'bsc'); }); From 2309f0279b4cf9c6f7701e2b99e7c121219abd62 Mon Sep 17 00:00:00 2001 From: David Wright Date: Fri, 7 Oct 2022 17:42:34 -0700 Subject: [PATCH 3/6] updated readme --- README.md | 187 +++++++++++++- dist/wallet-address-validator.js | 29 +-- dist/wallet-address-validator.min.js | 2 +- package.json | 369 +++++++++------------------ src/currencies.js | 29 +-- 5 files changed, 329 insertions(+), 287 deletions(-) diff --git a/README.md b/README.md index 2b7799ae..a13a77b8 100644 --- a/README.md +++ b/README.md @@ -33,100 +33,257 @@ npm install multicoin-address-validator ### Supported crypto currencies * 0x/zrx `'0x'` or `'zrx'` +* ATLANT/atl `'ATLANT'` or `'atl'` +* AXpire/axpr `'aXpire'` or `'axpr'` * Aave Coin/aave `'Aave Coin'` or `'aave'` * Algorand/algo `'Algorand'` or `'algo'` +* Aave/lend `'Aave'` or `'lend'` +* Abyss Token/abyss `'Abyss Token'` or `'abyss'` +* AdEx/adx `'AdEx'` or `'adx'` +* AdToken/adt `'adToken'` or `'adt'` +* Aelf/elf `'aelf'` or `'elf'` +* Aeron/arn `'Aeron'` or `'arn'` +* Aeternity/ae `'Aeternity'` or `'ae'` +* Agrello/dlt `'Agrello'` or `'dlt'` +* Alg or and/algo `'Alg or and'` or `'algo'` +* All Sp or ts/soc `'All Sp or ts'` or `'soc'` +* Ambrosus/amb `'Ambrosus'` or `'amb'` +* Ankr/ankr `'Ankr'` or `'ankr'` +* AppCoins/appc `'AppCoins'` or `'appc'` * Aragon/ant `'Aragon'` or `'ant'` +* Arcblock/abt `'Arcblock'` or `'abt'` +* Ard or /ardr `'Ard or '` or `'ardr'` * Augur/rep `'Augur'` or `'rep'` * AugurV2/repv2 `'AugurV2'` or `'repv2'` * AuroraCoin/aur `'AuroraCoin'` or `'aur'` +* Aur or aCoin/aur `'Aur or aCoin'` or `'aur'` * Avalanche/avax `'Avalanche'` or `'avax'` * Bancor/bnt `'Bancor'` or `'bnt'` +* BLOCKv/vee `'BLOCKv'` or `'vee'` +* BTU Protocol/btu `'BTU Protocol'` or `'btu'` +* Banc or /bnt `'Banc or '` or `'bnt'` +* Band Protocol/band `'Band Protocol'` or `'band'` * Bankex/bkx `'Bankex'` or `'bkx'` * Basic Attention Token/bat `'Basic Attention Token'` or `'bat'` * BeaverCoin/bvc `'BeaverCoin'` or `'bvc'` +* BetterBetting/betr `'BetterBetting'` or `'betr'` +* Binance Smart Chain/bsc `'Binance Smart Chain'` or `'bsc'` +* Binance USD/busd `'Binance USD'` or `'busd'` * Binance/bnb `'Binance'` or `'bnb'` * BioCoin/bio `'BioCoin'` or `'bio'` * Bitcoin/btc `'Bitcoin'` or `'btc'` +* BitDegree/bdg `'BitDegree'` or `'bdg'` +* BitKan/kan `'BitKan'` or `'kan'` +* Bitcoin Diamond/bcd `'Bitcoin Diamond or `'bcd'` * Bitcoin SV/bsv `'Bitcoin SV'` or `'bsv'` +* Bitcoin/btc `'Bitcoin'` or `'btc'` * BitcoinCash/bch `'BitcoinCash'` or `'bch'` * BitcoinGold/btg `'BitcoinGold'` or `'btg'` * BitcoinPrivate/btcp `'BitcoinPrivate'` or `'btcp'` +* BitcoinPrivate/btcp `'BitcoinPrivate or `'btcp'` * BitcoinZ/btcz `'BitcoinZ'` or `'btcz'` +* BlitzPredict/xbp `'BlitzPredict'` or `'xbp'` * BlockTrade/btt `'BlockTrade'` or `'btt'` * BTU Protocol/btu `'BTU Protocol'` or `'btu'` +* Blockmason Credit Protocol/bcpt `'Blockmason Credit Protocol'` or `'bcpt'` +* Blocktrade Token/btt `'Blocktrade Token'` or `'btt'` +* Blox/cdt `'Blox'` or `'cdt'` +* Bluzelle/blz `'Bluzelle'` or `'blz'` +* Bread/brd `'Bread'` or `'brd'` +* COS/cos `'COS'` or `'cos'` +* CUSD/cusd `'CUSD'` or `'cusd'` * Callisto/clo `'Callisto'` or `'clo'` * Cardano/ada `'Cardano'` or `'ada'` +* Celer Netw or k/celr `'Celer Netw or k'` or `'celr'` * Chainlink/link `'Chainlink'` or `'link'` +* Chiliz/chz `'Chiliz'` or `'chz'` +* Chronobank/time `'Chronobank'` or `'time'` +* Cindicat or /cnd `'Cindicat or '` or `'cnd'` * Civic/cvc `'Civic'` or `'cvc'` +* Cocos-BCX/cocos `'Cocos-BCX'` or `'cocos'` +* Coinlancer/cl `'Coinlancer'` or `'cl'` * Compound/comp `'Compound'` or `'comp'` +* Cosmo Coin/cosm `'Cosmo Coin'` or `'cosm'` +* Cosmos/atom `'Cosmos'` or `'atom'` +* Covesting/cov `'Covesting'` or `'cov'` * Cred/lba `'Cred'` or `'lba'` +* Crypterium/crpt `'Crypterium'` or `'crpt'` * Crypto.com Coin/cro `'Crypto.com Coin'` or `'cro'` * CUSD/cusd `'CUSD'` or `'cusd'` +* CryptoBossCoin/cbc `'CryptoBossCoin'` or `'cbc'` +* CryptoFranc/xchf `'CryptoFranc'` or `'xchf'` +* Daneel/dan `'Daneel'` or `'dan'` * Dash/dash `'Dash'` or `'dash'` * Decentraland/mana `'Decentraland'` or `'mana'` * Decred/dcr `'Decred'` or `'dcr'` +* Dent/dent `'Dent'` or `'dent'` +* Dentacoin/dcn `'Dentacoin'` or `'dcn'` * DigiByte/dgb `'DigiByte'` or `'dgb'` +* Digitex Futures/dgtx `'Digitex Futures'` or `'dgtx'` +* DigixDAO/dgd `'DigixDAO'` or `'dgd'` * District0x/dnt `'District0x'` or `'dnt'` +* Dock/dock `'Dock'` or `'dock'` * DogeCoin/doge `'DogeCoin'` or `'doge'` * Enjin Coin/enj `'Enjin Coin'` or `'enj'` +* DomRaider/drt `'DomRaider'` or `'drt'` +* Dusk Netw or k/dusk `'Dusk Netw or k'` or `'dusk'` * EOS/eos `'EOS'` or `'eos'` +* Edgeless/edg `'Edgeless'` or `'edg'` +* Eidoo/edo `'Eidoo'` or `'edo'` +* Electrify.Asia/elec `'Electrify.Asia or `'elec'` +* Enigma/eng `'Enigma'` or `'eng'` +* Enjin Coin/enj `'Enjin Coin'` or `'enj'` +* EtherZero/etz `'EtherZero'` or `'etz'` * Ethereum/eth `'Ethereum'` or `'eth'` * EthereumClassic/etc `'EthereumClassic'` or `'etc'` +* EthereumClassic/etc `'EthereumClassic or `'etc'` * EthereumPow/ethw `'EthereumPow'` or `'ethw'` * EtherZero/etz `'EtherZero'` or `'etz'` +* Etherparty/fuel `'Etherparty'` or `'fuel'` +* Everex/evx `'Everex'` or `'evx'` +* Exchange Union/xuc `'Exchange Union'` or `'xuc'` * Expanse/exp `'Expanse'` or `'exp'` +* Fantom/ftm `'Fantom'` or `'ftm'` * FirmaChain/fct `'FirmaChain'` or `'fct'` +* FirstBlood/1st `'FirstBlood'` or `'1st'` +* F or tuna/fota `'F or tuna'` or `'fota'` * FreiCoin/frc `'FreiCoin'` or `'frc'` +* Fujicoin/fjc `'Fujicoin'` or `'fjc'` * GameCredits/game `'GameCredits'` or `'game'` * GarliCoin/grlc `'GarliCoin'` or `'grlc'` +* Gemini Dollar/gusd `'Gemini Dollar'` or `'gusd'` +* Genesis Vision/gvt `'Genesis Vision or `'gvt'` +* Gifto/gto `'Gifto'` or `'gto'` * Gnosis/gno `'Gnosis'` or `'gno'` * Golem/glm `'Golem'` or `'glm'` * Golem (GNT)/gnt `'Golem (GNT)'` or `'gnt'` +* Golem/glm `'Golem'` or `'glm'` +* Groestlcoin/grs `'Groestlcoin'` or `'grs'` +* HOQU/hqx `'HOQU'` or `'hqx'` +* Hedera Hashgraph/hbar `'Hedera Hashgraph'` or `'hbar'` * HedgeTrade/hedg `'HedgeTrade'` or `'hedg'` +* Holo/hot `'Holo'` or `'hot'` +* Humaniq/hmq `'Humaniq'` or `'hmq'` +* Huobi Token/ht `'Huobi Token'` or `'ht'` * Hush/hush `'Hush'` or `'hush'` * HyperSpace/xsc `'HyperSpace'` or `'xsc'` * iExec RLC/rlc `'iExec RLC'` or `'rlc'` +* ICON/icx `'ICON'` or `'icx'` +* IExec RLC/rlc `'iExec RLC'` or `'rlc'` +* IHT Real Estate Protocol/iht `'IHT Real Estate Protocol'` or `'iht'` +* Insolar/ins `'Insolar'` or `'ins'` +* Internet of Services/IOST `'Internet of Services'` or `'IOST'` +* IoTeX/iotx `'IoTeX'` or `'iotx'` +* KEY/key `'KEY'` or `'key'` +* Kcash/kcash `'Kcash'` or `'kcash'` +* KickToken/kick `'KickToken'` or `'kick'` * Komodo/kmd `'Komodo'` or `'kmd'` +* Kyber Netw or k/knc `'Kyber Netw or k'` or `'knc'` * LBRY Credits/lbc `'LBRY Credits'` or `'lbc'` +* LIFE/life `'LIFE'` or `'life'` +* Lambda/lamb `'Lambda'` or `'lamb'` +* Lamden/tau `'Lamden'` or `'tau'` +* LinkEye/let `'LinkEye'` or `'let'` * Lisk/lsk `'Lisk'` or `'lsk'` * LiteCoin/ltc `'LiteCoin'` or `'ltc'` * loki/loki `'loki'` or `'loki'` * Loom Network/loom `'Loom Network'` or `'loom'` +* LockTrip/loc `'LockTrip'` or `'loc'` +* Loki/loki `'loki'` or `'loki'` +* Loom Netw or k/loom `'Loom Netw or k'` or `'loom'` +* Loopring/lrc `'Loopring'` or `'lrc'` +* Luniverse/luniverse' `'Luniverse'` or `'luniverse'` +* Lunyr/lun `'Lunyr'` or `'lun'` +* MCO/mco `'MCO'` or `'mco'` +* Mainframe/mft `'Mainframe'` or `'mft'` * Maker/mkr `'Maker'` or `'mkr'` * Matchpool/gup `'Matchpool'` or `'gup'` * Matic/matic `'Matic'` or `'matic'` +* Measurable Data Token/mdt `'Measurable Data Token'` or `'mdt'` * MegaCoin/mec `'MegaCoin'` or `'mec'` * Melon/mln `'Melon'` or `'mln'` +* Menlo One/one `'Menlo One'` or `'one'` * Metal/mtl `'Metal'` or `'mtl'` +* Mithril/mith `'Mithril'` or `'mith'` +* Moeda Loyalty Points/mda `'Moeda Loyalty Points'` or `'mda'` +* Molecular Future/mof `'Molecular Future'` or `'mof'` * MonaCoin/mona `'MonaCoin'` or `'mona'` * Monero/xmr `'Monero'` or `'xmr'` +* Monetha/mth `'Monetha'` or `'mth'` +* Monolith/tkn `'Monolith'` or `'tkn'` * Multi-collateral DAI/dai `'Multi-collateral DAI'` or `'dai'` +* Mysterium/myst `'Mysterium'` or `'myst'` +* NAGA/ngc `'NAGA'` or `'ngc'` +* NXT/nxt `'NXT'` or `'nxt'` * NameCoin/nmc `'NameCoin'` or `'nmc'` * Nano/nano `'Nano'` or `'nano'` * Nem/xem `'Nem'` or `'xem'` * Neo/neo `'Neo'` or `'neo'` * NeoGas/gas `'NeoGas'` or `'gas'` +* NetKoin/ntk `'NetKoin'` or `'ntk'` +* Nexo/nexo `'Nexo'` or `'nexo'` +* Noah Coin/noah `'Noah Coin'` or `'noah'` +* Nucleus Vision/ncash `'Nucleus Vision'` or `'ncash'` * Numeraire/nmr `'Numeraire'` or `'nmr'` +* OAX/oax `'OAX'` or `'oax'` +* ORS Group/ or s `'ORS Group'` or `' or s'` +* OST/ost `'OST'` or `'ost'` * Ocean Protocol/ocean `'Ocean Protocol'` or `'ocean'` * Odyssey/ocn `'Odyssey'` or `'ocn'` * OmiseGO/omg `'OmiseGO'` or `'omg'` +* Ontology/ont `'Ontology'` or `'ont'` +* Own (Chainium)/chx `'Own (Chainium)'` or `'chx'` +* PIVX/pivx `'PIVX'` or `'pivx'` +* Patient or y/ptoy `'Patient or y'` or `'ptoy'` +* Patron/pat `'Patron'` or `'pat'` * Paxos/pax `'Paxos'` or `'pax'` +* Peculium/pcl `'Peculium'` or `'pcl'` * PeerCoin/ppc `'PeerCoin'` or `'ppc'` * PIVX/pivx `'PIVX'` or `'pivx'` +* Perlin/perl `'Perlin'` or `'perl'` +* Pillar/plr `'Pillar'` or `'plr'` +* Po.et/poe `'Po.et'` or `'poe'` * Polkadot/dot `'Polkadot'` or `'dot'` * Polymath/poly `'Polymath'` or `'poly'` +* Populous/ppt `'Populous'` or `'ppt'` +* Power Ledger/powr `'Power Ledger'` or `'powr'` +* Presearch/pre `'Presearch'` or `'pre'` * PrimeCoin/xpm `'PrimeCoin'` or `'xpm'` * ProtoShares/pts `'ProtoShares'` or `'pts'` +* PumaPay/pma `'PumaPay'` or `'pma'` +* Pundi X/npxs `'Pundi X'` or `'npxs'` * Qtum/qtum `'Qtum'` or `'qtum'` * Quant/qnt `'Quant'` or `'qnt'` * Quantum Resistant Ledger/qrl `'Quantum Resistant Ledger'` or `'qrl'` +* Quantstamp/qsp `'Quantstamp'` or `'qsp'` +* Quantum Resistant `'Ledger/qrl Quantum Resistant Ledger` or 'qrl'` +* QuarkChain/qkc `'QuarkChain'` or `'qkc'` * RaiBlocks/xrb `'RaiBlocks'` or `'xrb'` * Ripio Credit Network/rcn `'Ripio Credit Network'` or `'rcn'` +* Raiden Netw or k Token/rdn `'Raiden Netw or k Token'` or `'rdn'` +* Ravencoin/rvn `'Ravencoin'` or `'rvn'` +* Refereum/rfr `'Refereum'` or `'rfr'` +* Ren/ren `'Ren'` or `'ren'` +* Request/req `'Request'` or `'req'` +* Revain/r `'Revain'` or `'r'` +* Ripio Credit Netw or k/rcn `'Ripio Credit Netw or k'` or `'rcn'` * Ripple/xrp `'Ripple'` or `'xrp'` +* SIRIN LABS Token/srn `'SIRIN LABS Token'` or `'srn'` +* SOLVE/solve `'SOLVE'` or `'solve'` +* SONM/snm `'SONM'` or `'snm'` +* STASIS EURO/eurs `'STASIS EURO'` or `'eurs'` +* STEEM/steem `'STEEM'` or `'steem'` * Salt/salt `'Salt'` or `'salt'` +* Scopuly/sky `'Scopuly'` or `'sky'` +* Sentinel/sent `'Sentinel'` or `'sent'` * Serve/serv `'Serve'` or `'serv'` +* SiaCashCoin/scc `'SiaCashCoin'` or `'scc'` * Siacoin/sc `'Siacoin'` or `'sc'` +* SingularDTV/sngls `'SingularDTV'` or `'sngls'` +* SingularityNET/agi `'SingularityNET'` or `'agi'` +* SkinCoin/skin `'SkinCoin'` or `'skin'` * SnowGem/sng `'SnowGem'` or `'sng'` +* SoMee.Social/ong `'SoMee.Social'` or `'ong'` * Solana/sol `'Solana'` or `'sol'` * SolarCoin/slr `'SolarCoin'` or `'slr'` * SOLVE/solve `'SOLVE'` or `'solve'` @@ -139,25 +296,51 @@ npm install multicoin-address-validator * Swarm City/swt `'Swarm City'` or `'swt'` * Synthetix Network/snx `'Synthetix Network'` or `'snx'` * Tap/xtp `'Tap'` or `'xtp'` +* St or j/st or j `'St or j'` or `'st or j'` +* St or m/st or m `'St or m'` or `'st or m'` +* St or mX/stmx `'St or mX'` or `'stmx'` +* Stox/stx `'Stox'` or `'stx'` +* Streamr DATAcoin/data `'Streamr DATAcoin'` or `'data'` +* Substratum/sub `'Substratum'` or `'sub'` +* SunContract/snc `'SunContract'` or `'snc'` +* Swarm City/swt `'Swarm City or `'swt'` +* SwftCoin/swftc `'SwftCoin'` or `'swftc'` +* Synthetix Netw or k/snx `'Synthetix Netw or k'` or `'snx'` +* Syscoin/sys `'Syscoin'` or `'sys'` * TEMCO/temco `'TEMCO'` or `'temco'` +* Tael/wabi `'Tael'` or `'wabi'` +* Tap/xtp `'Tap'` or `'xtp'` +* Telcoin/tel `'Telcoin'` or `'tel'` * TenX/pay `'TenX'` or `'pay'` * Tether/usdt `'Tether'` or `'usdt'` * Tezos/xtz `'Tezos'` or `'xtz'` +* Tierion/tnt `'Tierion'` or `'tnt'` +* Time New Bank/tnb `'Time New Bank'` or `'tnb'` +* Tripio/trio `'Tripio'` or `'trio'` * Tron/trx `'Tron'` or `'trx'` * TrueUSD/tusd `'TrueUSD'` or `'tusd'` * Uniswap Coin/uni `'Uniswap Coin'` or `'uni'` * USD Coin/usdc `'USD Coin'` or `'usdc'` +* USDT ERC-20/usdt20 `'USDT ERC-20'` or `'usdt20'` +* Uniswap Coin/uni `'Uniswap Coin'` or `'uni'` +* Utrust/utk `'Utrust'` or `'utk'` +* VIBE/vibe `'VIBE'` or `'vibe'` * VeChain/vet `'VeChain'` or `'vet'` +* Verge/xvg `'Verge'` or `'xvg'` * VertCoin/vtc `'VertCoin'` or `'vtc'` * Viberate/vib `'Viberate'` or `'vib'` * VoteCoin/vot `'VoteCoin'` or `'vot'` +* Waltonchain/wtc `'Waltonchain'` or `'wtc'` * Waves/waves `'Waves'` or `'waves'` +* WePower/wpr `'WePower'` or `'wpr'` +* WeTrust/trst `'WeTrust'` or `'trst'` * Wings/wings `'Wings'` or `'wings'` +* YOU COIN/you `'YOU COIN'` or `'you'` * ZCash/zec `'ZCash'` or `'zec'` * ZClassic/zcl `'ZClassic'` or `'zcl'` +* Zap/zap `'Zap'` or `'zap'` * ZenCash/zen `'ZenCash'` or `'zen'` - - +* Zilliqa/zil `'Zilliqa'` or `'zil'` ### Usage example diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 0e172f39..2246c015 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -12714,13 +12714,7 @@ var CURRENCIES = [{ symbol: 'cro', bech32Hrp: { prod: ['cro'], testnet: ['tcro']}, validator: BIP173Validator, - }, - // { - // name: 'Crypto.com Coin', - // symbol: 'cro', - // validator: ETHValidator, - // }, - { + }, { name: 'Multi-collateral DAI', symbol: 'dai', validator: ETHValidator, @@ -12950,6 +12944,14 @@ var CURRENCIES = [{ validator: Base58Validator, maxLength: 44, minLength: 43 + }, { + name: 'Binance', + symbol: 'bnb', + validator: BinanceValidator, + }, { + name: 'Binance Smart Chain', + symbol: 'bsc', + validator: ETHValidator, }, { name: 'Fortuna', symbol: 'fota', @@ -13379,16 +13381,6 @@ var CURRENCIES = [{ symbol: 'luniverse', validator: ETHValidator, }, { - name: 'Binance Smart Chain', - symbol: 'bsc', - validator: ETHValidator, - }, - { - name: 'Binance', - symbol: 'bnb', - validator: BinanceValidator, - }, - { name: 'EOS', symbol: 'eos', validator: EOSValidator, @@ -13397,8 +13389,7 @@ var CURRENCIES = [{ symbol: 'xvg', addressTypes: { prod: ['1e'], testnet: ['6F'] }, validator: BTCValidator, - }, - { + }, { name: 'Zilliqa', symbol: 'zil', validator: ZILValidator diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index a38992ae..eba738ed 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==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).WAValidator=t()}}(function(){return function(){return function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return o(e[a][1][t]||t)},l,l.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,N=this.h4l,H=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=N,Q=H,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(N>>>16)+(G>>>16)+((i=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(H>>>16)+(Q>>>16)+((s=(65535&H)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,N=this.h4l,H=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=N,Q=H,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(N>>>16)+(G>>>16)+((i=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(H>>>16)+(Q>>>16)+((s=(65535&H)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i Date: Fri, 7 Oct 2022 23:06:55 -0700 Subject: [PATCH 4/6] adding chia validation --- README.md | 1 + dist/wallet-address-validator.js | 110 +++++++++++++++++---------- dist/wallet-address-validator.min.js | 2 +- src/chia_validator.js | 21 +++++ src/currencies.js | 9 ++- test/wallet_address_validator.js | 14 ++++ 6 files changed, 115 insertions(+), 42 deletions(-) create mode 100644 src/chia_validator.js diff --git a/README.md b/README.md index a13a77b8..b032b304 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,7 @@ npm install multicoin-address-validator * Cardano/ada `'Cardano'` or `'ada'` * Celer Netw or k/celr `'Celer Netw or k'` or `'celr'` * Chainlink/link `'Chainlink'` or `'link'` +* Chia/xch `'Chia'` or `'xch'` * Chiliz/chz `'Chiliz'` or `'chz'` * Chronobank/time `'Chronobank'` or `'time'` * Cindicat or /cnd `'Cindicat or '` or `'cnd'` diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 2246c015..2f5c3dcd 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -8507,7 +8507,7 @@ module.exports = { } }; -},{"./bip173_validator":46,"./crypto/base58":49,"cbor-js":6,"crc":31}],39:[function(require,module,exports){ +},{"./bip173_validator":46,"./crypto/base58":50,"cbor-js":6,"crc":31}],39:[function(require,module,exports){ var base58 = require('./crypto/base58') const ALLOWED_CHARS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' @@ -8531,7 +8531,7 @@ module.exports = { }, } -},{"./crypto/base58":49}],40:[function(require,module,exports){ +},{"./crypto/base58":50}],40:[function(require,module,exports){ const cryptoUtils = require('./crypto/utils'); const ALGORAND_CHECKSUM_BYTE_LENGTH = 4; @@ -8561,7 +8561,7 @@ module.exports = { } } -},{"./crypto/utils":57}],41:[function(require,module,exports){ +},{"./crypto/utils":58}],41:[function(require,module,exports){ const ardorRegex = new RegExp('^ARDOR(-[A-Z0-9]{4}){3}(-[A-Z0-9]{5})$') module.exports = { @@ -8626,7 +8626,7 @@ module.exports = { } }; -},{"./crypto/base58":49}],44:[function(require,module,exports){ +},{"./crypto/base58":50}],44:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var bech32 = require('./crypto/bech32'); var BTCValidator = require('./bitcoin_validator'); @@ -8676,7 +8676,7 @@ module.exports = { } } -},{"./bitcoin_validator":47,"./crypto/bech32":50,"./crypto/utils":57}],45:[function(require,module,exports){ +},{"./bitcoin_validator":47,"./crypto/bech32":51,"./crypto/utils":58}],45:[function(require,module,exports){ module.exports = { isValidAddress: function (address) { var binanceAddress = address.slice(address.indexOf('bnb')); @@ -8717,7 +8717,7 @@ module.exports = { } }; -},{"./crypto/bech32":50}],47:[function(require,module,exports){ +},{"./crypto/bech32":51}],47:[function(require,module,exports){ (function (Buffer){(function (){ var base58 = require('./crypto/base58'); var segwit = require('./crypto/segwit_addr'); @@ -8809,7 +8809,30 @@ module.exports = { }; }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/base58":49,"./crypto/segwit_addr":55,"./crypto/utils":57,"buffer":5}],48:[function(require,module,exports){ +},{"./crypto/base58":50,"./crypto/segwit_addr":56,"./crypto/utils":58,"buffer":5}],48:[function(require,module,exports){ +var bech32 = require('./crypto/bech32'); + +const isValidAddress = function(address) { + // hack to validate testnet address + if (address && address.substring(0, 4) === 'txch') { + // remove leading 't' - now can validate + address = address.substring(1, address.length); + } + + const decoded = bech32.decode(address, bech32.encodings.BECH32M); + + if (decoded && decoded.hrp.toLowerCase() === 'xch') { + return true + } + + return false +} + +module.exports = { + isValidAddress +}; + +},{"./crypto/bech32":51}],49:[function(require,module,exports){ var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; /** @@ -8876,7 +8899,7 @@ module.exports = { b32decode: b32decode, b32encode: b32encode }; -},{}],49:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ // Base58 encoding/decoding // Originally written by Mike Hearn for BitcoinJ // Copyright (c) 2011 Google Inc @@ -8924,7 +8947,7 @@ module.exports = { } }; -},{}],50:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ // Copyright (c) 2017, 2021 Pieter Wuille // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -9058,7 +9081,7 @@ function decode (bechString, enc) { return {hrp: hrp, data: data.slice(0, data.length - 6)}; } -},{}],51:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ /* JavaScript BigInteger library version 0.9.1 http://silentmatt.com/biginteger/ @@ -10509,7 +10532,7 @@ function decode (bechString, enc) { exports.JSBigInt = BigInteger; // exports.BigInteger changed to exports.JSBigInt })(typeof exports !== 'undefined' ? exports : this); -},{}],52:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ (function (Buffer){(function (){ 'use strict'; @@ -10701,7 +10724,7 @@ Blake256.prototype.digest = function (encoding) { module.exports = Blake256; }).call(this)}).call(this,require("buffer").Buffer) -},{"buffer":5}],53:[function(require,module,exports){ +},{"buffer":5}],54:[function(require,module,exports){ 'use strict'; /** @@ -10979,7 +11002,7 @@ function toHex (n) { module.exports = Blake2b; -},{}],54:[function(require,module,exports){ +},{}],55:[function(require,module,exports){ var JSBigInt = require('./biginteger')['JSBigInt']; /** @@ -11206,7 +11229,7 @@ var cnBase58 = (function () { return b58; })(); module.exports = cnBase58; -},{"./biginteger":51}],55:[function(require,module,exports){ +},{"./biginteger":52}],56:[function(require,module,exports){ // Copyright (c) 2017, 2021 Pieter Wuille // // Permission is hereby granted, free of charge, to any person obtaining a copy @@ -11331,7 +11354,7 @@ module.exports = { isValidAddress: isValidAddress, }; -},{"./bech32":50}],56:[function(require,module,exports){ +},{"./bech32":51}],57:[function(require,module,exports){ (function (process,global){(function (){ /** * [js-sha3]{@link https://github.com/emn178/js-sha3} @@ -11975,7 +11998,7 @@ var f = function (s) { module.exports = methods; }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":36}],57:[function(require,module,exports){ +},{"_process":36}],58:[function(require,module,exports){ (function (Buffer){(function (){ var jsSHA = require('jssha'); var sha512256 = require('js-sha512').sha512_256 @@ -12111,7 +12134,7 @@ module.exports = { } }).call(this)}).call(this,require("buffer").Buffer) -},{"./base32":48,"./base58":49,"./blake256":52,"./blake2b":53,"./sha3":56,"browserify-bignum":4,"buffer":5,"js-sha512":33,"jssha":34}],58:[function(require,module,exports){ +},{"./base32":49,"./base58":50,"./blake256":53,"./blake2b":54,"./sha3":57,"browserify-bignum":4,"buffer":5,"js-sha512":33,"jssha":34}],59:[function(require,module,exports){ var XRPValidator = require('./ripple_validator'); var ETHValidator = require('./ethereum_validator'); var BTCValidator = require('./bitcoin_validator'); @@ -12131,6 +12154,8 @@ var AlgoValidator = require('./algo_validator'); var DotValidator = require('./dot_validator'); var BIP173Validator = require('./bip173_validator') var Base58Validator = require('./base58_validator') +// Chia +var ChiaValidator = require('./chia_validator') // from trezor var AEValidator = require('./ae_validator'); var ARDRValidator = require('./ardr_validator'); @@ -13393,7 +13418,12 @@ var CURRENCIES = [{ name: 'Zilliqa', symbol: 'zil', validator: ZILValidator - } + }, { + name: 'Chia', + symbol: 'xch', + addressTypes: { prod: ['xch'], testnet: ['txch'] }, + validator: ChiaValidator + } ]; @@ -13421,7 +13451,7 @@ var CURRENCIES = [{ // -},{"./ada_validator":38,"./ae_validator":39,"./algo_validator":40,"./ardr_validator":41,"./atom_validator":42,"./base58_validator":43,"./bch_validator":44,"./binance_validator":45,"./bip173_validator":46,"./bitcoin_validator":47,"./dot_validator":59,"./eos_validator":60,"./ethereum_validator":61,"./hbar_validator":62,"./icx_validator":63,"./iost_validator":64,"./lisk_validator":65,"./monero_validator":66,"./nano_validator":67,"./nem_validator":68,"./nxt_validator":69,"./ripple_validator":70,"./siacoin_validator":71,"./steem_validator":72,"./stellar_validator":73,"./sys_validator":74,"./tezos_validator":75,"./tron_validator":76,"./usdt_validator":77,"./zil_validator":79}],59:[function(require,module,exports){ +},{"./ada_validator":38,"./ae_validator":39,"./algo_validator":40,"./ardr_validator":41,"./atom_validator":42,"./base58_validator":43,"./bch_validator":44,"./binance_validator":45,"./bip173_validator":46,"./bitcoin_validator":47,"./chia_validator":48,"./dot_validator":60,"./eos_validator":61,"./ethereum_validator":62,"./hbar_validator":63,"./icx_validator":64,"./iost_validator":65,"./lisk_validator":66,"./monero_validator":67,"./nano_validator":68,"./nem_validator":69,"./nxt_validator":70,"./ripple_validator":71,"./siacoin_validator":72,"./steem_validator":73,"./stellar_validator":74,"./sys_validator":75,"./tezos_validator":76,"./tron_validator":77,"./usdt_validator":78,"./zil_validator":80}],60:[function(require,module,exports){ const cryptoUtils = require('./crypto/utils'); // from https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58) @@ -13482,7 +13512,7 @@ module.exports = { } } -},{"./crypto/utils":57}],60:[function(require,module,exports){ +},{"./crypto/utils":58}],61:[function(require,module,exports){ function isValidEOSAddress (address, currency, networkType) { var regex = /^[a-z0-9.]+$/g // Must be numbers, lowercase letters and decimal points only if (address.search(regex) !== -1 && address.length === 12) { @@ -13498,7 +13528,7 @@ module.exports = { } } -},{}],61:[function(require,module,exports){ +},{}],62:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); module.exports = { @@ -13534,7 +13564,7 @@ module.exports = { } }; -},{"./crypto/utils":57}],62:[function(require,module,exports){ +},{"./crypto/utils":58}],63:[function(require,module,exports){ function isValidHBarAddress (address) { const split = address.split('.') if (split[0] !== '0' || split[1] !== '0') { @@ -13552,7 +13582,7 @@ module.exports = { } -},{}],63:[function(require,module,exports){ +},{}],64:[function(require,module,exports){ function isValidICXAddress (address, currency, networkType) { var regex = /^hx[0-9a-f]{40}$/g // Begins with hx followed by 40 hex chars if (address.search(regex) !== -1) { @@ -13569,7 +13599,7 @@ module.exports = { } -},{}],64:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ const iostRegex = new RegExp('^[a-z0-9_]{5,11}$') module.exports = { @@ -13579,7 +13609,7 @@ module.exports = { } -},{}],65:[function(require,module,exports){ +},{}],66:[function(require,module,exports){ (function (Buffer){(function (){ var cryptoUtils = require('./crypto/utils'); @@ -13601,7 +13631,7 @@ module.exports = { } }; }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/utils":57,"buffer":5}],66:[function(require,module,exports){ +},{"./crypto/utils":58,"buffer":5}],67:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils') var cnBase58 = require('./crypto/cnBase58') @@ -13667,7 +13697,7 @@ module.exports = { } } -},{"./crypto/cnBase58":54,"./crypto/utils":57}],67:[function(require,module,exports){ +},{"./crypto/cnBase58":55,"./crypto/utils":58}],68:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var baseX = require('base-x'); @@ -13696,7 +13726,7 @@ module.exports = { } }; -},{"./crypto/utils":57,"base-x":1}],68:[function(require,module,exports){ +},{"./crypto/utils":58,"base-x":1}],69:[function(require,module,exports){ (function (Buffer){(function (){ var cryptoUtils = require('./crypto/utils'); @@ -13723,7 +13753,7 @@ module.exports = { } }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/utils":57,"buffer":5}],69:[function(require,module,exports){ +},{"./crypto/utils":58,"buffer":5}],70:[function(require,module,exports){ const nxtRegex = new RegExp("^NXT(-[A-Z0-9]{4}){3}-[A-Z0-9]{5}$"); module.exports = { @@ -13735,7 +13765,7 @@ module.exports = { }, }; -},{}],70:[function(require,module,exports){ +},{}],71:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var baseX = require('base-x'); @@ -13765,7 +13795,7 @@ module.exports = { } }; -},{"./crypto/utils":57,"base-x":1}],71:[function(require,module,exports){ +},{"./crypto/utils":58,"base-x":1}],72:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils') var isEqual = require('lodash.isequal') @@ -13795,7 +13825,7 @@ module.exports = { } } -},{"./crypto/utils":57,"lodash.isequal":35}],72:[function(require,module,exports){ +},{"./crypto/utils":58,"lodash.isequal":35}],73:[function(require,module,exports){ const accountRegex = new RegExp('^[a-z0-9-.]{3,}$') const segmentRegex = new RegExp('^[a-z][a-z0-9-]+[a-z0-9]$') const doubleDashRegex = new RegExp('--') @@ -13823,7 +13853,7 @@ module.exports = { } -},{}],73:[function(require,module,exports){ +},{}],74:[function(require,module,exports){ var baseX = require('base-x'); var crc = require('crc'); var cryptoUtils = require('./crypto/utils'); @@ -13863,7 +13893,7 @@ module.exports = { } }; -},{"./crypto/utils":57,"base-x":1,"crc":31}],74:[function(require,module,exports){ +},{"./crypto/utils":58,"base-x":1,"crc":31}],75:[function(require,module,exports){ const BTCValidator = require('./bitcoin_validator'); var regexp = new RegExp('^sys1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}$') @@ -13874,7 +13904,7 @@ module.exports = { } -},{"./bitcoin_validator":47}],75:[function(require,module,exports){ +},{"./bitcoin_validator":47}],76:[function(require,module,exports){ const base58 = require('./crypto/base58'); const cryptoUtils = require('./crypto/utils'); @@ -13912,7 +13942,7 @@ module.exports = { isValidAddress }; -},{"./crypto/base58":49,"./crypto/utils":57}],76:[function(require,module,exports){ +},{"./crypto/base58":50,"./crypto/utils":58}],77:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); function decodeBase58Address(base58Sting) { @@ -13976,7 +14006,7 @@ module.exports = { } }; -},{"./crypto/utils":57}],77:[function(require,module,exports){ +},{"./crypto/utils":58}],78:[function(require,module,exports){ var BTCValidator = require('./bitcoin_validator'); var ETHValidator = require('./ethereum_validator'); @@ -13999,7 +14029,7 @@ module.exports = { } }; -},{"./bitcoin_validator":47,"./ethereum_validator":61}],78:[function(require,module,exports){ +},{"./bitcoin_validator":47,"./ethereum_validator":62}],79:[function(require,module,exports){ var currencies = require('./currencies'); var DEFAULT_CURRENCY_NAME = 'bitcoin'; @@ -14026,7 +14056,7 @@ module.exports = { } }; -},{"./currencies":58}],79:[function(require,module,exports){ +},{"./currencies":59}],80:[function(require,module,exports){ const { bech32 } = require('bech32'); const ALLOWED_CHARS = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' @@ -14045,5 +14075,5 @@ module.exports = { } -},{"bech32":3}]},{},[78])(78) +},{"bech32":3}]},{},[79])(79) }); diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index eba738ed..9b12e1c1 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==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).WAValidator=t()}}(function(){return function(){return function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return o(e[a][1][t]||t)},l,l.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(N,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,N=this.h4l,H=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=N,Q=H,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(N>>>16)+(G>>>16)+((i=(65535&N)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(H>>>16)+(Q>>>16)+((s=(65535&H)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,H=this.h4l,N=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=H,Q=N,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(H>>>16)+(G>>>16)+((i=(65535&H)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(N>>>16)+(Q>>>16)+((s=(65535&N)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i { + valid('xch16rdrw2lktf729jtz0kc0hjuzr65akgx9d56j74f0xfsemp08njuq2a4j5e', 'xch') + valid('xch1ed7yctrag8s5su35qs6pxjzfzwng9hnt3txd5gvkkr0rg9serq4sp9g6n5', 'xch') + valid('xch1w0mjfntrxz79uacsfarm4jukqegewcgzyduw8k9fcc70lnls24ms8gax6y', 'xch') + // testnet + valid('txch16rdrw2lktf729jtz0kc0hjuzr65akgx9d56j74f0xfsemp08njuq2a4j5e', 'xch') + }); + }); describe('invalid results', function () { @@ -1645,6 +1653,12 @@ describe('invalid results', function () { invalid('0xda816e2122a8a39b0926bfa84edd3d42477e9efE', 'zil') }); + it('should return false for correct Chia addresses', () => { + invalid('zil1pk6fe395e9lfkglv0m70daezm5en0t62hty7f7', 'xch') + invalid('bnb1ed7yctrag8s5su35qs6pxjzfzwng9hnt3txd5gvkkr0rg9serq4sp9g6n5', 'xch') + invalid('thisisnotvalid0923492349239492349003jasdf90asd9adf92022123hnk3', 'xch') + }); + }); From 60d6e6e0b33539d893526630376c8fb64ef9bc17 Mon Sep 17 00:00:00 2001 From: David Wright Date: Sat, 8 Oct 2022 01:01:56 -0700 Subject: [PATCH 5/6] add harmony one and xrpl --- dist/wallet-address-validator.js | 87 +++++++--- dist/wallet-address-validator.min.js | 2 +- package.json | 246 +++++++++++++-------------- src/currencies.js | 27 ++- src/harmony_validator.js | 20 +++ test/wallet_address_validator.js | 20 ++- 6 files changed, 246 insertions(+), 156 deletions(-) create mode 100644 src/harmony_validator.js diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 2f5c3dcd..2f778a17 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -12156,6 +12156,8 @@ var BIP173Validator = require('./bip173_validator') var Base58Validator = require('./base58_validator') // Chia var ChiaValidator = require('./chia_validator') +// Harmony +var HarmonyValidator = require('./harmony_validator') // from trezor var AEValidator = require('./ae_validator'); var ARDRValidator = require('./ardr_validator'); @@ -12377,6 +12379,10 @@ var CURRENCIES = [{ name: 'Ripple', symbol: 'xrp', validator: XRPValidator, + }, { + name: 'XRPL', + symbol: 'xrpl', + validator: XRPValidator, }, { name: 'Dash', symbol: 'dash', @@ -12973,6 +12979,10 @@ var CURRENCIES = [{ name: 'Binance', symbol: 'bnb', validator: BinanceValidator, + }, { + name: 'BinanceChain', + symbol: 'bnb', + validator: BinanceValidator, }, { name: 'Binance Smart Chain', symbol: 'bsc', @@ -13168,11 +13178,13 @@ var CURRENCIES = [{ name: 'OAX', symbol: 'oax', validator: ETHValidator, - }, { - name: 'Menlo One', - symbol: 'one', - validator: ETHValidator, - }, { + }, + // { + // name: 'Menlo One', + // symbol: 'one', // clashes with Harmony one + // validator: ETHValidator, + // }, + { name: 'SoMee.Social', symbol: 'ong', validator: ETHValidator, @@ -13421,8 +13433,11 @@ var CURRENCIES = [{ }, { name: 'Chia', symbol: 'xch', - addressTypes: { prod: ['xch'], testnet: ['txch'] }, validator: ChiaValidator + }, { + name: 'Harmony', + symbol: 'one', + validator: HarmonyValidator } ]; @@ -13451,7 +13466,7 @@ var CURRENCIES = [{ // -},{"./ada_validator":38,"./ae_validator":39,"./algo_validator":40,"./ardr_validator":41,"./atom_validator":42,"./base58_validator":43,"./bch_validator":44,"./binance_validator":45,"./bip173_validator":46,"./bitcoin_validator":47,"./chia_validator":48,"./dot_validator":60,"./eos_validator":61,"./ethereum_validator":62,"./hbar_validator":63,"./icx_validator":64,"./iost_validator":65,"./lisk_validator":66,"./monero_validator":67,"./nano_validator":68,"./nem_validator":69,"./nxt_validator":70,"./ripple_validator":71,"./siacoin_validator":72,"./steem_validator":73,"./stellar_validator":74,"./sys_validator":75,"./tezos_validator":76,"./tron_validator":77,"./usdt_validator":78,"./zil_validator":80}],60:[function(require,module,exports){ +},{"./ada_validator":38,"./ae_validator":39,"./algo_validator":40,"./ardr_validator":41,"./atom_validator":42,"./base58_validator":43,"./bch_validator":44,"./binance_validator":45,"./bip173_validator":46,"./bitcoin_validator":47,"./chia_validator":48,"./dot_validator":60,"./eos_validator":61,"./ethereum_validator":62,"./harmony_validator":63,"./hbar_validator":64,"./icx_validator":65,"./iost_validator":66,"./lisk_validator":67,"./monero_validator":68,"./nano_validator":69,"./nem_validator":70,"./nxt_validator":71,"./ripple_validator":72,"./siacoin_validator":73,"./steem_validator":74,"./stellar_validator":75,"./sys_validator":76,"./tezos_validator":77,"./tron_validator":78,"./usdt_validator":79,"./zil_validator":81}],60:[function(require,module,exports){ const cryptoUtils = require('./crypto/utils'); // from https://github.com/paritytech/substrate/wiki/External-Address-Format-(SS58) @@ -13565,6 +13580,28 @@ module.exports = { }; },{"./crypto/utils":58}],63:[function(require,module,exports){ +var bech32 = require('./crypto/bech32'); +var ETHValidator = require('./ethereum_validator'); + +const isValidAddress = function(address) { + if (address && address.substring(0, 3) !== 'one') { + return ETHValidator.isValidAddress(address); + } + + const decoded = bech32.decode(address, bech32.encodings.BECH32); + + if (decoded && decoded.hrp.toLowerCase() === 'one') { + return true; + } + + return false; +} + +module.exports = { + isValidAddress +}; + +},{"./crypto/bech32":51,"./ethereum_validator":62}],64:[function(require,module,exports){ function isValidHBarAddress (address) { const split = address.split('.') if (split[0] !== '0' || split[1] !== '0') { @@ -13582,7 +13619,7 @@ module.exports = { } -},{}],64:[function(require,module,exports){ +},{}],65:[function(require,module,exports){ function isValidICXAddress (address, currency, networkType) { var regex = /^hx[0-9a-f]{40}$/g // Begins with hx followed by 40 hex chars if (address.search(regex) !== -1) { @@ -13599,7 +13636,7 @@ module.exports = { } -},{}],65:[function(require,module,exports){ +},{}],66:[function(require,module,exports){ const iostRegex = new RegExp('^[a-z0-9_]{5,11}$') module.exports = { @@ -13609,7 +13646,7 @@ module.exports = { } -},{}],66:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ (function (Buffer){(function (){ var cryptoUtils = require('./crypto/utils'); @@ -13631,7 +13668,7 @@ module.exports = { } }; }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/utils":58,"buffer":5}],67:[function(require,module,exports){ +},{"./crypto/utils":58,"buffer":5}],68:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils') var cnBase58 = require('./crypto/cnBase58') @@ -13697,7 +13734,7 @@ module.exports = { } } -},{"./crypto/cnBase58":55,"./crypto/utils":58}],68:[function(require,module,exports){ +},{"./crypto/cnBase58":55,"./crypto/utils":58}],69:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var baseX = require('base-x'); @@ -13726,7 +13763,7 @@ module.exports = { } }; -},{"./crypto/utils":58,"base-x":1}],69:[function(require,module,exports){ +},{"./crypto/utils":58,"base-x":1}],70:[function(require,module,exports){ (function (Buffer){(function (){ var cryptoUtils = require('./crypto/utils'); @@ -13753,7 +13790,7 @@ module.exports = { } }).call(this)}).call(this,require("buffer").Buffer) -},{"./crypto/utils":58,"buffer":5}],70:[function(require,module,exports){ +},{"./crypto/utils":58,"buffer":5}],71:[function(require,module,exports){ const nxtRegex = new RegExp("^NXT(-[A-Z0-9]{4}){3}-[A-Z0-9]{5}$"); module.exports = { @@ -13765,7 +13802,7 @@ module.exports = { }, }; -},{}],71:[function(require,module,exports){ +},{}],72:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); var baseX = require('base-x'); @@ -13795,7 +13832,7 @@ module.exports = { } }; -},{"./crypto/utils":58,"base-x":1}],72:[function(require,module,exports){ +},{"./crypto/utils":58,"base-x":1}],73:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils') var isEqual = require('lodash.isequal') @@ -13825,7 +13862,7 @@ module.exports = { } } -},{"./crypto/utils":58,"lodash.isequal":35}],73:[function(require,module,exports){ +},{"./crypto/utils":58,"lodash.isequal":35}],74:[function(require,module,exports){ const accountRegex = new RegExp('^[a-z0-9-.]{3,}$') const segmentRegex = new RegExp('^[a-z][a-z0-9-]+[a-z0-9]$') const doubleDashRegex = new RegExp('--') @@ -13853,7 +13890,7 @@ module.exports = { } -},{}],74:[function(require,module,exports){ +},{}],75:[function(require,module,exports){ var baseX = require('base-x'); var crc = require('crc'); var cryptoUtils = require('./crypto/utils'); @@ -13893,7 +13930,7 @@ module.exports = { } }; -},{"./crypto/utils":58,"base-x":1,"crc":31}],75:[function(require,module,exports){ +},{"./crypto/utils":58,"base-x":1,"crc":31}],76:[function(require,module,exports){ const BTCValidator = require('./bitcoin_validator'); var regexp = new RegExp('^sys1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{39}$') @@ -13904,7 +13941,7 @@ module.exports = { } -},{"./bitcoin_validator":47}],76:[function(require,module,exports){ +},{"./bitcoin_validator":47}],77:[function(require,module,exports){ const base58 = require('./crypto/base58'); const cryptoUtils = require('./crypto/utils'); @@ -13942,7 +13979,7 @@ module.exports = { isValidAddress }; -},{"./crypto/base58":50,"./crypto/utils":58}],77:[function(require,module,exports){ +},{"./crypto/base58":50,"./crypto/utils":58}],78:[function(require,module,exports){ var cryptoUtils = require('./crypto/utils'); function decodeBase58Address(base58Sting) { @@ -14006,7 +14043,7 @@ module.exports = { } }; -},{"./crypto/utils":58}],78:[function(require,module,exports){ +},{"./crypto/utils":58}],79:[function(require,module,exports){ var BTCValidator = require('./bitcoin_validator'); var ETHValidator = require('./ethereum_validator'); @@ -14029,7 +14066,7 @@ module.exports = { } }; -},{"./bitcoin_validator":47,"./ethereum_validator":62}],79:[function(require,module,exports){ +},{"./bitcoin_validator":47,"./ethereum_validator":62}],80:[function(require,module,exports){ var currencies = require('./currencies'); var DEFAULT_CURRENCY_NAME = 'bitcoin'; @@ -14056,7 +14093,7 @@ module.exports = { } }; -},{"./currencies":59}],80:[function(require,module,exports){ +},{"./currencies":59}],81:[function(require,module,exports){ const { bech32 } = require('bech32'); const ALLOWED_CHARS = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l' @@ -14075,5 +14112,5 @@ module.exports = { } -},{"bech32":3}]},{},[79])(79) +},{"bech32":3}]},{},[80])(80) }); diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index 9b12e1c1..d2c9384b 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==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).WAValidator=t()}}(function(){return function(){return function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return o(e[a][1][t]||t)},l,l.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,H=this.h4l,N=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=H,Q=N,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(H>>>16)+(G>>>16)+((i=(65535&H)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(N>>>16)+(Q>>>16)+((s=(65535&N)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,H=this.h4l,N=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=H,Q=N,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(H>>>16)+(G>>>16)+((i=(65535&H)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(N>>>16)+(Q>>>16)+((s=(65535&N)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i { + it('should return false for incorrect Chia addresses', () => { invalid('zil1pk6fe395e9lfkglv0m70daezm5en0t62hty7f7', 'xch') invalid('bnb1ed7yctrag8s5su35qs6pxjzfzwng9hnt3txd5gvkkr0rg9serq4sp9g6n5', 'xch') invalid('thisisnotvalid0923492349239492349003jasdf90asd9adf92022123hnk3', 'xch') }); + it('should return false for incorrect Harmony addresses', () => { + invalid('0x000000000000000000000000000000000000000', 'one'); + invalid('tone1gu0kda66ly3c5taz8w3rsc44j4csn7epatrzvl', 'one'); + invalid('xone1fdv7u7rll9epgcqv9xxh9lhwq427nsqlr5wca5', 'one'); + }); + }); From 6c52d40d3c2e6ba7cd6c1963143b5d7d0961fe70 Mon Sep 17 00:00:00 2001 From: David Wright Date: Sun, 9 Oct 2022 00:01:20 -0700 Subject: [PATCH 6/6] Fix Chia testnet validation; add DigitalBits --- README.md | 2 ++ dist/wallet-address-validator.js | 14 +++++++------- dist/wallet-address-validator.min.js | 2 +- src/chia_validator.js | 10 +++------- src/currencies.js | 4 ++++ test/wallet_address_validator.js | 11 ++++++++++- 6 files changed, 27 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index b032b304..bce56025 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ npm install multicoin-address-validator * Dent/dent `'Dent'` or `'dent'` * Dentacoin/dcn `'Dentacoin'` or `'dcn'` * DigiByte/dgb `'DigiByte'` or `'dgb'` +* DigitalBits/xdb `'DigitalBits'` or `'xdb'` * Digitex Futures/dgtx `'Digitex Futures'` or `'dgtx'` * DigixDAO/dgd `'DigixDAO'` or `'dgd'` * District0x/dnt `'District0x'` or `'dnt'` @@ -160,6 +161,7 @@ npm install multicoin-address-validator * Golem (GNT)/gnt `'Golem (GNT)'` or `'gnt'` * Golem/glm `'Golem'` or `'glm'` * Groestlcoin/grs `'Groestlcoin'` or `'grs'` +* Harmony/one `'Harmony'` or `'one'` * HOQU/hqx `'HOQU'` or `'hqx'` * Hedera Hashgraph/hbar `'Hedera Hashgraph'` or `'hbar'` * HedgeTrade/hedg `'HedgeTrade'` or `'hedg'` diff --git a/dist/wallet-address-validator.js b/dist/wallet-address-validator.js index 2f778a17..527ff76c 100644 --- a/dist/wallet-address-validator.js +++ b/dist/wallet-address-validator.js @@ -8812,16 +8812,12 @@ module.exports = { },{"./crypto/base58":50,"./crypto/segwit_addr":56,"./crypto/utils":58,"buffer":5}],48:[function(require,module,exports){ var bech32 = require('./crypto/bech32'); -const isValidAddress = function(address) { - // hack to validate testnet address - if (address && address.substring(0, 4) === 'txch') { - // remove leading 't' - now can validate - address = address.substring(1, address.length); - } +const validHrp = ['xch', 'txch'] +const isValidAddress = function(address) { const decoded = bech32.decode(address, bech32.encodings.BECH32M); - if (decoded && decoded.hrp.toLowerCase() === 'xch') { + if (decoded && validHrp.includes(decoded.hrp.toLowerCase())) { return true } @@ -13438,6 +13434,10 @@ var CURRENCIES = [{ name: 'Harmony', symbol: 'one', validator: HarmonyValidator + }, { + name: 'DigitalBits', + symbol: 'xdb', + validator: XLMValidator } ]; diff --git a/dist/wallet-address-validator.min.js b/dist/wallet-address-validator.min.js index d2c9384b..0415a3f0 100644 --- a/dist/wallet-address-validator.min.js +++ b/dist/wallet-address-validator.min.js @@ -1 +1 @@ -!function(t){if("object"==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).WAValidator=t()}}(function(){return function(){return function t(e,r,n){function o(a,s){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return o(e[a][1][t]||t)},l,l.exports,t,e,r,n)}return r[a].exports}for(var i="function"==typeof require&&require,a=0;a=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,H=this.h4l,N=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=H,Q=N,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(H>>>16)+(G>>>16)+((i=(65535&H)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(N>>>16)+(Q>>>16)+((s=(65535&N)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(a);t[r];){var c=e[t.charCodeAt(r)];if(255===c)return;for(var h=0,d=a-1;(0!==c||h>>0,l[d]=c%256>>>0,c=c/256>>>0;if(0!==c)throw new Error("Non-zero carry");i=h,r++}for(var p=a-i;p!==a&&0===l[p];)p++;var y=n.allocUnsafe(o+(a-p));y.fill(0,0,o);for(var v=o;p!==a;)y[v++]=l[p++];return y}return{encode:function(e){if((Array.isArray(e)||e instanceof Uint8Array)&&(e=n.from(e)),!n.isBuffer(e))throw new TypeError("Expected Buffer");if(0===e.length)return"";for(var r=0,o=0,i=0,a=e.length;i!==a&&0===e[i];)i++,r++;for(var f=(a-i)*l+1>>>0,c=new Uint8Array(f);i!==a;){for(var h=e[i],d=0,p=f-1;(0!==h||d>>0,c[p]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");o=d,i++}for(var y=f-o;y!==f&&0===c[y];)y++;for(var v=u.repeat(r);y0?n-4:n,c=0;c>16&255,s[u++]=e>>8&255,s[u++]=255&e;2===a&&(e=o[t.charCodeAt(c)]<<2|o[t.charCodeAt(c+1)]>>4,s[u++]=255&e);1===a&&(e=o[t.charCodeAt(c)]<<10|o[t.charCodeAt(c+1)]<<4|o[t.charCodeAt(c+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e);return s},r.fromByteArray=function(t){for(var e,r=t.length,o=r%3,i=[],a=0,s=r-o;as?s:a+16383));1===o?(e=t[r-1],i.push(n[e>>2]+n[e<<4&63]+"==")):2===o&&(e=(t[r-2]<<8)+t[r-1],i.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="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");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var o,i,a=[],s=e;s>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bech32m=r.bech32=void 0;const n="qpzry9x8gf2tvdw0s3jn54khce6mua7l",o={};for(let t=0;t>25;return(33554431&t)<<5^996825010&-(e>>0&1)^642813549&-(e>>1&1)^513874426&-(e>>2&1)^1027748829&-(e>>3&1)^705979059&-(e>>4&1)}function a(t){let e=1;for(let r=0;r126)return"Invalid prefix ("+t+")";e=i(e)^n>>5}e=i(e);for(let r=0;r=r;)i-=r,s.push(o>>i&a);if(n)i>0&&s.push(o<=e)return"Excess padding";if(o<r)return"Exceeds length limit";const n=t.toLowerCase(),s=t.toUpperCase();if(t!==n&&t!==s)return"Mixed-case string "+t;const u=(t=n).lastIndexOf("1");if(-1===u)return"No separator character for "+t;if(0===u)return"Missing prefix for "+t;const f=t.slice(0,u),l=t.slice(u+1);if(l.length<6)return"Data too short";let c=a(f);if("string"==typeof c)return c;const h=[];for(let t=0;t=l.length||h.push(r)}return c!==e?"Invalid checksum for "+t:{prefix:f,words:h}}return e="bech32"===t?1:734539939,{decodeUnsafe:function(t,e){const n=r(t,e);if("object"==typeof n)return n},decode:function(t,e){const n=r(t,e);if("object"==typeof n)return n;throw new Error(n)},encode:function(t,r,o){if(o=o||90,t.length+7+r.length>o)throw new TypeError("Exceeds length limit");let s=a(t=t.toLowerCase());if("string"==typeof s)throw new Error(s);let u=t+"1";for(let t=0;t>5!=0)throw new Error("Non 5-bit word");s=i(s)^e,u+=n.charAt(e)}for(let t=0;t<6;++t)s=i(s);s^=e;for(let t=0;t<6;++t){const e=s>>5*(5-t)&31;u+=n.charAt(e)}return u},toWords:u,fromWordsUnsafe:f,fromWords:l}}r.bech32=c("bech32"),r.bech32m=c("bech32m")},{}],4:[function(t,e,r){(function(t){(function(){var r,n=20,o=4,i=-7,a=21,s=-1e9,u=1e9,f=!0,l=parseInt,c=b.prototype,h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",d=0,p=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=String.prototype.trim||function(){return this.replace(/^\s+|\s+$/g,"")},v=b(1);function b(t,e){var i,a,l,c,v,w,_=this;if(!(_ instanceof b))return new b(t,e);if(t instanceof b){if(d=0,e===i)return _.s=t.s,_.e=t.e,void(_.c=(t=t.c)?t.slice():t);t+=""}if("string"!=typeof t&&(t=(l="number"==typeof t||"[object Number]"==Object.prototype.toString.call(t))&&0===t&&1/t<0?"-0":t+""),w=t,e===i&&p.test(t))_.s="-"==t.charAt(0)?(t=t.slice(1),-1):1;else{if(10==e)return x(t,n,o);if(t=y.call(t).replace(/^\+(?!-)/,""),_.s="-"==t.charAt(0)?(t=t.replace(/^-(?!-)/,""),-1):1,null!=e?e!=(0|e)&&f||(r=!(e>=2&&e<65))?(m(e,2),v=p.test(t)):(c="["+h.slice(0,e|=0)+"]+",t=t.replace(/\.$/,"").replace(/^\./,"0."),(v=new RegExp("^"+c+"(?:\\."+c+")?$",e<37?"i":"").test(t))?(l&&(t.replace(/^0\.0*|\./,"").length>15&&m(w,0),l=!l),t=g(t,10,e,_.s)):"Infinity"!=t&&"NaN"!=t&&(m(w,1,e),t="NaN")):v=p.test(t),!v)return _.c=_.e=null,"Infinity"!=t&&("NaN"!=t&&m(w,3),_.s=null),void(d=0)}for((i=t.indexOf("."))>-1&&(t=t.replace(".","")),(a=t.search(/e/i))>0?(i<0&&(i=a),i+=+t.slice(a+1),t=t.substring(0,a)):i<0&&(i=t.length),a=0;"0"==t.charAt(a);a++);if(e=t.length,l&&e>15&&t.slice(a).length>15&&m(w,0),d=0,(i-=a+1)>u)_.c=_.e=null;else if(a==e||ie-1&&(null==u[o+1]&&(u[o+1]=0),u[o+1]+=u[o]/e^0,u[o]%=e)}return u.reverse()}function c(t){for(var e=0,r=t.length,n="";e-1)if(o=t.length-o-1,i=l(new b(r).pow(o).toF(),10),a=l((s=t.split("."))[1]),s=l(s[0]),u=(f=w(a,i,a.length-i.length,n,e,1&s[s.length-1])).c,o=f.e){for(;++o;u.unshift(0));t=c(s)+"."+c(u)}else u[0]?s[o=s.length-1]w?1:-1;else for(d=-1,h=0;++dg[d]?1:-1;break}if(!(h<0))break;for(l=w==f?e:p;w;){if(g[--w]k&&A(_,n,i,a,null!=g[0]),_.e>u?_.c=_.e=null:_.e++e&&A(t,n,10),n=0==o[0]?n+1:r?e:t.e+n+1;o.length1?(o.splice(1,0,"."),o.join("")):o[0])+(n<0?"e":"e+")+n:t.toS()}function A(t,e,r,n,i){var a=t.c,s=t.s<0,u=r/2,f=t.e+e+1,l=a[f],c=i||f<0||null!=a[f+1];if(i=o<4?(null!=l||c)&&(0==o||2==o&&!s||3==o&&s):l>u||l==u&&(4==o||c||6==o&&(1&a[f-1]||!e&&n)||7==o&&!s||8==o&&s),f<1||!a[0])return a.length=0,a.push(0),i?(a[0]=1,t.e=-e):t.e=0,t;if(a.length=f--,i)for(--r;++a[f]>r;)a[f]=0,f--||(++t.e,a.unshift(1));for(f=a.length;!a[--f];a.pop());return t}function x(t,e,r){var n=o;return o=r,(t=new b(t)).c&&A(t,e,10),o=n,t}b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.fromBuffer=function(t,e){e||(e={});var r={1:"big","-1":"little"}[e.endian]||e.endian||"big",n="auto"===e.size?Math.ceil(t.length):e.size||1;if(t.length%n!=0)throw new RangeError("Buffer length ("+t.length+") must be a multiple of size ("+n+")");for(var o=[],i=0;in)||l(t)!=t&&0!==t)},g=y&&"object"==typeof y?function(){if(y.hasOwnProperty(e))return null!=(t=y[e])}:function(){if(p.length>c)return null!=(t=p[c++])};return g(e="DECIMAL_PLACES")&&(b(t,0,1e9)?n=0|t:m(t,e,v)),h[e]=n,g(e="ROUNDING_MODE")&&(b(t,0,8)?o=0|t:m(t,e,v)),h[e]=o,g(e="EXPONENTIAL_AT")&&(b(t,-1e9,1e9)?i=-(a=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,0)&&b(t[1],0,1e9)?(i=~~t[0],a=~~t[1]):m(t,e,v,1)),h[e]=[i,a],g(e="RANGE")&&(b(t,-1e9,1e9)&&~~t?s=-(u=~~(t<0?-t:+t)):!r&&t&&b(t[0],-1e9,-1)&&b(t[1],1,1e9)?(s=~~t[0],u=~~t[1]):m(t,e,v,1,1)),h[e]=[s,u],g(e="ERRORS")&&(t===!!t||1===t||0===t?(r=d=0,l=(f=!!t)?parseInt:parseFloat):m(t,e,v,0,0,1)),h[e]=f,h},c.abs=c.absoluteValue=function(){var t=new b(this);return t.s<0&&(t.s=1),t},c.bitLength=function(){return this.toString(2).length},c.ceil=function(){return x(this,0,2)},c.comparedTo=c.cmp=function(t,e){var r,n=this,o=n.c,i=(d=-d,t=new b(t,e)).c,a=n.s,s=t.s,u=n.e,f=t.e;if(!a||!s)return null;if(r=o&&!o[0],e=i&&!i[0],r||e)return r?e?0:-s:a;if(a!=s)return a;if(r=a<0,e=u==f,!o||!i)return e?0:!o^r?1:-1;if(!e)return u>f^r?1:-1;for(a=-1,s=(u=o.length)<(f=i.length)?u:f;++ai[a]^r?1:-1;return u==f?0:u>f^r?1:-1},c.dividedBy=c.div=function(t,e){var r=this.c,n=this.e,o=this.s,i=(d=2,t=new b(t,e)).c,a=t.e,s=t.s,u=o==s?1:-1;return(n||r&&r[0])&&(a||i&&i[0])?w(r,i,n-a,u,10):new b(o&&s&&(r?!i||r[0]!=i[0]:i)?r&&0==r[0]||!i?0*u:u/0:NaN)},c.equals=c.eq=function(t,e){return d=3,0===this.cmp(t,e)},c.floor=function(){return x(this,0,3)},c.greaterThan=c.gt=function(t,e){return d=4,this.cmp(t,e)>0},c.greaterThanOrEqualTo=c.gte=c.gt=function(t,e){return d=5,1==(e=this.cmp(t,e))||0===e},c.isFinite=c.isF=function(){return!!this.c},c.isNaN=function(){return!this.s},c.isNegative=c.isNeg=function(){return this.s<0},c.isZero=c.isZ=function(){return!!this.c&&0==this.c[0]},c.lessThan=c.lt=function(t,e){return d=6,this.cmp(t,e)<0},c.lessThanOrEqualTo=c.lte=c.le=function(t,e){return d=7,-1==(e=this.cmp(t,e))||0===e},c.minus=c.sub=function(t,e){var r,n,i,a,u=this,f=u.s;if(e=(d=8,t=new b(t,e)).s,!f||!e)return new b(NaN);if(f!=e)return t.s=-e,u.plus(t);var l=u.c,c=u.e,h=t.c,p=t.e;if(!c||!p){if(!l||!h)return l?(t.s=-e,t):new b(h?u:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new b(l[0]?u:3==o?-0:0)}if(l=l.slice(),f=c-p){for((r=(a=f<0)?(f=-f,l):(p=c,h)).reverse(),e=f;e--;r.push(0));r.reverse()}else for(i=((a=l.length0)for(;e--;l[i++]=0);for(e=h.length;e>f;){if(l[--e]0?(s=i,f):(o=-o,a)).reverse();o--;r.push(0));r.reverse()}for(a.length-f.length<0&&(r=f,f=a,a=r),o=f.length,e=0;o;e=(a[--o]=a[o]+f[o]+e)/10^0,a[o]%=10);for(e&&(a.unshift(e),++s>u&&(a=s=null)),o=a.length;0==a[--o];a.pop());return t.c=a,t.e=s,t},c.toPower=c.pow=function(t){var e=0*t==0?0|t:t,n=new b(this),o=new b(v);if(((r=t<-1e6||t>1e6)&&(e=1*t/0)||l(t)!=t&&0!==t&&!(e=NaN))&&!m(t,"exponent","pow")||!e)return new b(Math.pow(n.toS(),e));for(e=e<0?-e:e;1&e&&(o=o.times(n)),e>>=1;)n=n.times(n);return t<0?v.div(o):o},c.powm=function(t,e){return this.pow(t).mod(e)},c.round=function(t,e){return x(this,t=null==t||((r=t<0||t>1e9)||l(t)!=t)&&!m(t,"decimal places","round")?0:0|t,e=null==e||((r=e<0||e>8)||l(e)!=e&&0!==e)&&!m(e,"mode","round")?o:0|e)},c.squareRoot=c.sqrt=function(){var t,e,r,i,a=this,s=a.c,u=a.s,f=a.e,l=n,c=o,h=new b("0.5");if(1!==u||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?a:1/0);for(u=Math.sqrt(a.toS()),o=1,0==u||u==1/0?((t=s.join("")).length+f&1||(t+="0"),(e=new b(Math.sqrt(t)+"")).c||(e.c=[1]),e.e=((f+1)/2|0)-(f<0||1&f)):e=new b(t=u.toString()),(u=(r=e.e)+(n+=4))<3&&(u=0),f=u;;)if(i=e,e=h.times(i.plus(a.div(i))),i.c.slice(0,u).join("")===e.c.slice(0,u).join("")){if(9!=(s=e.c)[u-=t&&e.ef-2&&(s.length=f-2),e.times(e).eq(a)))){for(;s.length-1;a--){for(e=0,f=l+a;f>a;e=r[f]+i[a]*o[f-a-1]+e,r[f--]=e%10|0,e=e/10|0);e&&(r[f]=(r[f]+e)%10)}for(e&&++t.e,!r[0]&&r.shift(),f=r.length;!r[--f];r.pop());return t.c=t.e>u?t.e=null:t.e0&&l.copy(o,4+(128&l[0]?1:0)),128&l[0]&&(o[4]=0),o[0]=n&255<<24,o[1]=n&255<<16,o[2]=65280&n,o[3]=255&n;var i=this.lt(0);if(i)for(var a=4;a0}).forEach(function(t,e){for(var r=0;r1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toE"))&&this.c?this.c.length-1:0|t,1)},c.toFixed=c.toF=function(t){var e,n,o,s=this;return null==t||((r=t<0||t>1e9)||l(t)!=t&&0!==t)&&!m(t,"decimal places","toF")||(o=s.e+(0|t)),e=i,t=a,i=-(a=1/0),o==n?n=s.toS():(n=_(s,o),s.s<0&&s.c&&(s.c[0]?n.indexOf("-")<0&&(n="-"+n):n=n.replace(/^-/,""))),i=e,a=t,n},c.toFraction=c.toFr=function(t){var e,i,a,s,l,c,h,p=s=new b(v),y=a=new b("0"),g=this,w=g.c,_=u,A=n,x=o,E=new b(v);if(!w)return g.toS();for(h=E.e=w.length-g.e-1,(null==t||(!(d=12,c=new b(t)).s||(r=c.cmp(p)<0||!c.c)||f&&c.e0)&&(t=h>0?E:p),u=1/0,c=new b(w.join("")),n=0,o=1;e=c.div(E),1!=(l=s.plus(e.times(y))).cmp(t);)s=y,y=l,p=a.plus(e.times(l=p)),a=l,E=c.minus(e.times(l=E)),c=l;return l=t.minus(s).div(y),a=a.plus(l.times(p)),s=s.plus(l.times(y)),a.s=p.s=g.s,n=2*h,o=x,i=p.div(y).minus(g).abs().cmp(a.div(s).minus(g).abs())<1?[p.toS(),y.toS()]:[a.toS(),s.toS()],u=_,n=A,i},c.toPrecision=c.toP=function(t){return null==t||((r=t<1||t>1e9)||l(t)!=t)&&!m(t,"precision","toP")?this.toS():_(this,0|--t,2)},c.toString=c.toS=function(t){var e,n,o,s=this,u=s.e;if(null===u)n=s.s?"Infinity":"NaN";else{if(t===e&&(u<=i||u>=a))return _(s,s.c.length-1,1);if(n=s.c.join(""),u<0){for(;++u;n="0"+n);n="0."+n}else if(o=n.length,u>0)if(++u>o)for(u-=o;u--;n+="0");else u1)n=e+"."+n.slice(1);else if("0"==e)return e;if(null!=t)if((r=!(t>=2&&t<65))||t!=(0|t)&&f)m(t,"base","toS");else if("0"==(n=g(n,0|t,10,s.s)))return n}return s.s<0?"-"+n:n},c.valueOf=function(){return this.toS()},e.exports=b}).call(this)}).call(this,t("buffer").Buffer)},{buffer:5}],5:[function(t,e,r){"use strict";var n=t("base64-js"),o=t("ieee754");r.Buffer=s,r.SlowBuffer=function(t){+t!=t&&(t=0);return s.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function a(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');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 TypeError('The "string" argument must be of type string. Received type number');return l(t)}return u(t,e,r)}function u(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|d(t,e),n=a(r),o=n.write(t,e);o!==r&&(n=n.slice(0,o));return n}(t,e);if(ArrayBuffer.isView(t))return c(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(F(t,ArrayBuffer)||t&&F(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function d(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||F(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return M(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(o)return n?-1:M(t).length;e=(""+e).toLowerCase(),o=!0}}function p(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,o){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),P(r=+r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof e&&(e=s.from(e,n)),s.isBuffer(e))return 0===e.length?-1:v(t,e,r,n,o);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):v(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function v(t,e,r,n,o){var i,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(o){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var c=!0,h=0;ho&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function E(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o239?4:f>223?3:f>191?2:1;if(o+c<=r)switch(c){case 1:f<128&&(l=f);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&f)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&f)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,c=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),o+=c}return function(t){var e=t.length;if(e<=k)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 C(this,e,r);case"utf8":case"utf-8":return E(this,e,r);case"ascii":return S(this,e,r);case"latin1":case"binary":return B(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,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 t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),""},s.prototype.compare=function(t,e,r,n,o){if(F(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),e<0||r>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&e>=r)return 0;if(n>=o)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,o>>>=0,this===t)return 0;for(var i=o-n,a=r-e,u=Math.min(i,a),f=this.slice(n,o),l=t.slice(e,r),c=0;c>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,t,e,r);case"utf8":case"utf-8":return m(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return _(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function S(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;on)&&(r=n);for(var o="",i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||et.length)throw new RangeError("Index out of range")}function L(t,e,r,n,o,i){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,i){return e=+e,r>>>=0,i||L(t,0,r,4),o.write(t,e,r,n,23,4),r+4}function R(t,e,r,n,i){return e=+e,r>>>=0,i||L(t,0,r,8),o.write(t,e,r,n,52,8),r+8}s.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i>>=0,e>>>=0,r||U(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},s.prototype.readUInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),this[t]},s.prototype.readUInt16LE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]|this[t+1]<<8},s.prototype.readUInt16BE=function(t,e){return t>>>=0,e||U(t,2,this.length),this[t]<<8|this[t+1]},s.prototype.readUInt32LE=function(t,e){return t>>>=0,e||U(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||U(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||U(t,e,this.length);for(var n=this[t],o=1,i=0;++i=(o*=128)&&(n-=Math.pow(2,8*e)),n},s.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||U(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},s.prototype.readInt8=function(t,e){return t>>>=0,e||U(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},s.prototype.readInt16LE=function(t,e){t>>>=0,e||U(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||U(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||U(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||U(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||U(t,4,this.length),o.read(this,t,!0,23,4)},s.prototype.readFloatBE=function(t,e){return t>>>=0,e||U(t,4,this.length),o.read(this,t,!1,23,4)},s.prototype.readDoubleLE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!0,52,8)},s.prototype.readDoubleBE=function(t,e){return t>>>=0,e||U(t,8,this.length),o.read(this,t,!1,52,8)},s.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i>>=0,r>>>=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},s.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i>0)-s&255;return e+r},s.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);O(this,t,e,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+r},s.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||O(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||O(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||O(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||O(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||O(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 R(this,t,e,!0,r)},s.prototype.writeDoubleBE=function(t,e,r){return R(this,t,e,!1,r)},s.prototype.copy=function(t,e,r,n){if(!s.isBuffer(t))throw new TypeError("argument should be a Buffer");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("Index out of range");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 Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return o},s.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!s.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var o=t.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(t=o)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function j(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(H,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var o=0;o=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function F(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function P(t){return t!=t}},{"base64-js":2,ieee754:32}],6:[function(t,e,r){!function(t,r){"use strict";var n=Math.pow(2,-24),o=Math.pow(2,32),i=Math.pow(2,53);var a={encode:function(t){var e,n=new ArrayBuffer(256),a=new DataView(n),s=0;function u(t){for(var r=n.byteLength,o=s+t;r>2,f=0;f>6),o.push(128|63&a)):a<55296?(o.push(224|a>>12),o.push(128|a>>6&63),o.push(128|63&a)):(a=(1023&a)<<10,a|=1023&e.charCodeAt(++n),a+=65536,o.push(240|a>>18),o.push(128|a>>12&63),o.push(128|a>>6&63),o.push(128|63&a))}return h(3,o.length),c(o);default:var d;if(Array.isArray(e))for(h(4,d=e.length),n=0;n>5!==t)throw"Invalid indefinite length element";return r}function v(t,e){for(var r=0;r>10),t.push(56320|1023&n))}}"function"!=typeof e&&(e=function(t){return t}),"function"!=typeof i&&(i=function(){return r});var b=function t(){var o,h,b=l(),m=b>>5,g=31&b;if(7===m)switch(g){case 25:return function(){var t=new ArrayBuffer(4),e=new DataView(t),r=c(),o=32768&r,i=31744&r,a=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==a)return a*n;return e.setUint32(0,o<<16|i<<13|a<<13),e.getFloat32(0)}();case 26:return u(a.getFloat32(s),4);case 27:return u(a.getFloat64(s),8)}if((h=p(g))<0&&(m<2||6=0;)_+=h,w.push(f(h));var A=new Uint8Array(_),x=0;for(o=0;o=0;)v(E,h);else v(E,h);return String.fromCharCode.apply(null,E);case 4:var k;if(h<0)for(k=[];!d();)k.push(t());else for(k=new Array(h),o=0;o>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("ccitt",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],21:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,4489,8978,12955,17956,22445,25910,29887,35912,40385,44890,48851,51820,56293,59774,63735,4225,264,13203,8730,22181,18220,30135,25662,40137,36160,49115,44626,56045,52068,63999,59510,8450,12427,528,5017,26406,30383,17460,21949,44362,48323,36440,40913,60270,64231,51324,55797,12675,8202,4753,792,30631,26158,21685,17724,48587,44098,40665,36688,64495,60006,55549,51572,16900,21389,24854,28831,1056,5545,10034,14011,52812,57285,60766,64727,34920,39393,43898,47859,21125,17164,29079,24606,5281,1320,14259,9786,57037,53060,64991,60502,39145,35168,48123,43634,25350,29327,16404,20893,9506,13483,1584,6073,61262,65223,52316,56789,43370,47331,35448,39921,29575,25102,20629,16668,13731,9258,5809,1848,65487,60998,56541,52564,47595,43106,39673,35696,33800,38273,42778,46739,49708,54181,57662,61623,2112,6601,11090,15067,20068,24557,28022,31999,38025,34048,47003,42514,53933,49956,61887,57398,6337,2376,15315,10842,24293,20332,32247,27774,42250,46211,34328,38801,58158,62119,49212,53685,10562,14539,2640,7129,28518,32495,19572,24061,46475,41986,38553,34576,62383,57894,53437,49460,14787,10314,6865,2904,32743,28270,23797,19836,50700,55173,58654,62615,32808,37281,41786,45747,19012,23501,26966,30943,3168,7657,12146,16123,54925,50948,62879,58390,37033,33056,46011,41522,23237,19276,31191,26718,7393,3432,16371,11898,59150,63111,50204,54677,41258,45219,33336,37809,27462,31439,18516,23005,11618,15595,3696,8185,63375,58886,54429,50452,45483,40994,37561,33584,31687,27214,22741,18780,15843,11370,7921,3960];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("kermit",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],22:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,49345,49537,320,49921,960,640,49729,50689,1728,1920,51009,1280,50625,50305,1088,52225,3264,3456,52545,3840,53185,52865,3648,2560,51905,52097,2880,51457,2496,2176,51265,55297,6336,6528,55617,6912,56257,55937,6720,7680,57025,57217,8e3,56577,7616,7296,56385,5120,54465,54657,5440,55041,6080,5760,54849,53761,4800,4992,54081,4352,53697,53377,4160,61441,12480,12672,61761,13056,62401,62081,12864,13824,63169,63361,14144,62721,13760,13440,62529,15360,64705,64897,15680,65281,16320,16e3,65089,64001,15040,15232,64321,14592,63937,63617,14400,10240,59585,59777,10560,60161,11200,10880,59969,60929,11968,12160,61249,11520,60865,60545,11328,58369,9408,9600,58689,9984,59329,59009,9792,8704,58049,58241,9024,57601,8640,8320,57409,40961,24768,24960,41281,25344,41921,41601,25152,26112,42689,42881,26432,42241,26048,25728,42049,27648,44225,44417,27968,44801,28608,28288,44609,43521,27328,27520,43841,26880,43457,43137,26688,30720,47297,47489,31040,47873,31680,31360,47681,48641,32448,32640,48961,32e3,48577,48257,31808,46081,29888,30080,46401,30464,47041,46721,30272,29184,45761,45953,29504,45313,29120,28800,45121,20480,37057,37249,20800,37633,21440,21120,37441,38401,22208,22400,38721,21760,38337,38017,21568,39937,23744,23936,40257,24320,40897,40577,24128,23040,39617,39809,23360,39169,22976,22656,38977,34817,18624,18816,35137,19200,35777,35457,19008,19968,36545,36737,20288,36097,19904,19584,35905,17408,33985,34177,17728,34561,18368,18048,34369,33281,17088,17280,33601,16640,33217,32897,16448];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-16-modbus",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:65535,i=0;i>8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],23:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=i(t("./create_buffer"));function i(t){return t&&t.__esModule?t:{default:t}}var a=(0,i(t("./define_crc")).default)("xmodem",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:0,i=0;i>>8&255;a^=255&t[i],r=r<<8&65535,r^=a^=a>>>4,r^=a=a<<5&65535,r^=a=a<<7&65535}return r});r.default=a},{"./create_buffer":29,"./define_crc":30,buffer:5}],24:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,8801531,9098509,825846,9692897,1419802,1651692,10452759,10584377,2608578,2839604,11344079,3303384,11807523,12104405,4128302,12930697,4391538,5217156,13227903,5679208,13690003,14450021,5910942,6606768,14844747,15604413,6837830,16197969,7431594,8256604,16494759,840169,9084178,8783076,18463,10434312,1670131,1434117,9678590,11358416,2825259,2590173,10602790,4109873,12122826,11821884,3289031,13213536,5231515,4409965,12912278,5929345,14431610,13675660,5693559,6823513,15618722,14863188,6588335,16513208,8238147,7417269,16212302,1680338,10481449,9664223,1391140,9061683,788936,36926,8838341,12067563,4091408,3340262,11844381,2868234,11372785,10555655,2579964,14478683,5939616,5650518,13661357,5180346,13190977,12967607,4428364,8219746,16457881,16234863,7468436,15633027,6866552,6578062,14816117,1405499,9649856,10463030,1698765,8819930,55329,803287,9047340,11858690,3325945,4072975,12086004,2561507,10574104,11387118,2853909,13647026,5664841,5958079,14460228,4446803,12949160,13176670,5194661,7454091,16249200,16476294,8201341,14834538,6559633,6852199,15647388,3360676,11864927,12161705,4185682,10527045,2551230,2782280,11286707,9619101,1346150,1577872,10379115,73852,8875143,9172337,899466,16124205,7357910,8182816,16421083,6680524,14918455,15678145,6911546,5736468,13747439,14507289,5968354,12873461,4334094,5159928,13170435,4167245,12180150,11879232,3346363,11301036,2767959,2532769,10545498,10360692,1596303,1360505,9604738,913813,9157998,8856728,92259,16439492,8164415,7343561,16138546,6897189,15692510,14936872,6662099,5986813,14488838,13733104,5750795,13156124,5174247,4352529,12855018,2810998,11315341,10498427,2522496,12124823,4148844,3397530,11901793,9135439,862644,110658,8912057,1606574,10407765,9590435,1317464,15706879,6940164,6651890,14889737,8145950,16384229,16161043,7394792,5123014,13133629,12910283,4370992,14535975,5997020,5707818,13718737,2504095,10516836,11329682,2796649,11916158,3383173,4130419,12143240,8893606,129117,876971,9121104,1331783,9576124,10389322,1625009,14908182,6633453,6925851,15721184,7380471,16175372,16402682,8127489,4389423,12891860,13119266,5137369,13704398,5722165,6015427,14517560];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-24",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=void 0!==e?~~e:11994318,i=0;i>16^a)]^r<<8)}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],25:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-32",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:-1^~~e,i=0;i>>8}return-1^r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],26:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=a(t("./create_buffer")),i=a(t("./define_crc"));function a(t){return t&&t.__esModule?t:{default:t}}var s=[0,7,14,9,28,27,18,21,56,63,54,49,36,35,42,45,112,119,126,121,108,107,98,101,72,79,70,65,84,83,90,93,224,231,238,233,252,251,242,245,216,223,214,209,196,195,202,205,144,151,158,153,140,139,130,133,168,175,166,161,180,179,186,189,199,192,201,206,219,220,213,210,255,248,241,246,227,228,237,234,183,176,185,190,171,172,165,162,143,136,129,134,147,148,157,154,39,32,41,46,59,60,53,50,31,24,17,22,3,4,13,10,87,80,89,94,75,76,69,66,111,104,97,102,115,116,125,122,137,142,135,128,149,146,155,156,177,182,191,184,173,170,163,164,249,254,247,240,229,226,235,236,193,198,207,200,221,218,211,212,105,110,103,96,117,114,123,124,81,86,95,88,77,74,67,68,25,30,23,16,5,2,11,12,33,38,47,40,61,58,51,52,78,73,64,71,82,85,92,91,118,113,120,127,106,109,100,99,62,57,48,55,34,37,44,43,6,1,8,15,26,29,20,19,174,169,160,167,178,181,188,187,150,145,152,159,138,141,132,131,222,217,208,215,194,197,204,203,230,225,232,239,250,253,244,243];"undefined"!=typeof Int32Array&&(s=new Int32Array(s));var u=(0,i.default)("crc-8",function(t,e){n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=~~e,i=0;i1&&void 0!==arguments[1]?arguments[1]:-1;n.Buffer.isBuffer(t)||(t=(0,o.default)(t));for(var r=0===e?0:~~e,i=0;i>>8}return r});r.default=u},{"./create_buffer":29,"./define_crc":30,buffer:5}],29:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("buffer"),o=n.Buffer.from&&n.Buffer.alloc&&n.Buffer.allocUnsafe&&n.Buffer.allocUnsafeSlow?n.Buffer.from:function(t){return new n.Buffer(t)};r.default=o},{buffer:5}],30:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e){var r=function(t,r){return e(t,r)>>>0};return r.signed=e,r.unsigned=r,r.model=t,r}},{}],31:[function(t,e,r){"use strict";e.exports={crc1:t("./crc1"),crc8:t("./crc8"),crc81wire:t("./crc8_1wire"),crc16:t("./crc16"),crc16ccitt:t("./crc16_ccitt"),crc16modbus:t("./crc16_modbus"),crc16xmodem:t("./crc16_xmodem"),crc16kermit:t("./crc16_kermit"),crc24:t("./crc24"),crc32:t("./crc32"),crcjam:t("./crcjam")}},{"./crc1":7,"./crc16":8,"./crc16_ccitt":9,"./crc16_kermit":10,"./crc16_modbus":11,"./crc16_xmodem":12,"./crc24":13,"./crc32":14,"./crc8":15,"./crc8_1wire":16,"./crcjam":17}],32:[function(t,e,r){r.read=function(t,e,r,n,o){var i,a,s=8*o-n-1,u=(1<>1,l=-7,c=r?o-1:0,h=r?-1:1,d=t[e+c];for(c+=h,i=d&(1<<-l)-1,d>>=-l,l+=s;l>0;i=256*i+t[e+c],c+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=n;l>0;a=256*a+t[e+c],c+=h,l-=8);if(0===i)i=1-f;else{if(i===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,n),i-=f}return(d?-1:1)*a*Math.pow(2,i-n)},r.write=function(t,e,r,n,o,i){var a,s,u,f=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:i-1,p=n?1:-1,y=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=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+c>=1?h/u:h*Math.pow(2,1-c))*u>=2&&(a++,u/=2),a+c>=l?(s=0,a=l):a+c>=1?(s=(e*u-1)*Math.pow(2,o),a+=c):(s=e*Math.pow(2,c-1)*Math.pow(2,o),a=0));o>=8;t[r+d]=255&s,d+=p,s/=256,o-=8);for(a=a<0;t[r+d]=255&a,d+=p,a/=256,f-=8);t[r+d-p]|=128*y}},{}],33:[function(t,e,r){(function(t,r){(function(){!function(){"use strict";var n="input is invalid type",o="object"==typeof window,i=o?window:{};i.JS_SHA512_NO_WINDOW&&(o=!1);var a=!o&&"object"==typeof self;!i.JS_SHA512_NO_NODE_JS&&"object"==typeof t&&t.versions&&t.versions.node?i=r:a&&(i=self);var s=!i.JS_SHA512_NO_COMMON_JS&&"object"==typeof e&&e.exports,u=!i.JS_SHA512_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],h=[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],d=["hex","array","digest","arrayBuffer"],p=[];!i.JS_SHA512_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!u||!i.JS_SHA512_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var y=function(t,e){return function(r){return new g(e,!0).update(r)[t]()}},v=function(t){var e=y("hex",t);e.create=function(){return new g(t)},e.update=function(t){return e.create().update(t)};for(var r=0;r>6,f[l++]=128|63&s):s<55296||s>=57344?(f[l++]=224|s>>12,f[l++]=128|s>>6&63,f[l++]=128|63&s):(s=65536+((1023&s)<<10|1023&t.charCodeAt(++c)),f[l++]=240|s>>18,f[l++]=128|s>>12&63,f[l++]=128|s>>6&63,f[l++]=128|63&s);t=f}t.length>128&&(t=new g(e,!0).update(t).array());var h=[],d=[];for(c=0;c<128;++c){var p=t[c]||0;h[c]=92^p,d[c]=54^p}g.call(this,e,r),this.update(d),this.oKeyPad=h,this.inner=!0,this.sharedMemory=r}g.prototype.update=function(t){if(this.finalized)throw new Error("finalize already called");var e,r=typeof t;if("string"!==r){if("object"!==r)throw new Error(n);if(null===t)throw new Error(n);if(u&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||u&&ArrayBuffer.isView(t)))throw new Error(n);e=!0}for(var o,i,a=0,s=t.length,f=this.blocks;a>2]|=t[a]<>2]|=o<>2]|=(192|o>>6)<>2]|=(128|63&o)<=57344?(f[i>>2]|=(224|o>>12)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<>2]|=(240|o>>18)<>2]|=(128|o>>12&63)<>2]|=(128|o>>6&63)<>2]|=(128|63&o)<=128?(this.block=f[32],this.start=i-128,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this},g.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[32]=this.block,t[e>>2]|=l[3&e],this.block=t[32],e>=112&&(this.hashed||this.hash(),t[0]=this.block,t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=t[16]=t[17]=t[18]=t[19]=t[20]=t[21]=t[22]=t[23]=t[24]=t[25]=t[26]=t[27]=t[28]=t[29]=t[30]=t[31]=t[32]=0),t[30]=this.hBytes<<3|this.bytes>>>29,t[31]=this.bytes<<3,this.hash()}},g.prototype.hash=function(){var t,e,r,n,o,i,a,s,u,f,l,c,d,p,y,v,b,m,g,w,_,A,x,E,k,S=this.h0h,B=this.h0l,C=this.h1h,T=this.h1l,U=this.h2h,O=this.h2l,L=this.h3h,I=this.h3l,R=this.h4h,H=this.h4l,N=this.h5h,M=this.h5l,j=this.h6h,z=this.h6l,F=this.h7h,P=this.h7l,V=this.blocks;for(t=32;t<160;t+=2)e=((w=V[t-30])>>>1|(_=V[t-29])<<31)^(w>>>8|_<<24)^w>>>7,r=(_>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25),n=((w=V[t-4])>>>19|(_=V[t-3])<<13)^(_>>>29|w<<3)^w>>>6,o=(_>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26),w=V[t-32],_=V[t-31],u=((A=V[t-14])>>>16)+(w>>>16)+(e>>>16)+(n>>>16)+((s=(65535&A)+(65535&w)+(65535&e)+(65535&n)+((a=((x=V[t-13])>>>16)+(_>>>16)+(r>>>16)+(o>>>16)+((i=(65535&x)+(65535&_)+(65535&r)+(65535&o))>>>16))>>>16))>>>16),V[t]=u<<16|65535&s,V[t+1]=a<<16|65535&i;var D=S,$=B,q=C,Y=T,X=U,J=O,W=L,Z=I,K=R,G=H,Q=N,tt=M,et=j,rt=z,nt=F,ot=P;for(v=q&X,b=Y&J,t=0;t<160;t+=8)e=(D>>>28|$<<4)^($>>>2|D<<30)^($>>>7|D<<25),r=($>>>28|D<<4)^(D>>>2|$<<30)^(D>>>7|$<<25),n=(K>>>14|G<<18)^(K>>>18|G<<14)^(G>>>9|K<<23),o=(G>>>14|K<<18)^(G>>>18|K<<14)^(K>>>9|G<<23),m=(f=D&q)^D&X^v,g=(l=$&Y)^$&J^b,E=K&Q^~K&et,k=G&tt^~G&rt,w=V[t],_=V[t+1],w=(u=((A=h[t])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(nt>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&nt)+((a=((x=h[t+1])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(ot>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&ot))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,nt=(u=(W>>>16)+(w>>>16)+((s=(65535&W)+(65535&w)+((a=(Z>>>16)+(_>>>16)+((i=(65535&Z)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,ot=a<<16|65535&i,e=((W=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Z=a<<16|65535&i)<<4)^(Z>>>2|W<<30)^(Z>>>7|W<<25),r=(Z>>>28|W<<4)^(W>>>2|Z<<30)^(W>>>7|Z<<25),n=(nt>>>14|ot<<18)^(nt>>>18|ot<<14)^(ot>>>9|nt<<23),o=(ot>>>14|nt<<18)^(ot>>>18|nt<<14)^(nt>>>9|ot<<23),m=(c=W&D)^W&q^f,g=(d=Z&$)^Z&Y^l,E=nt&K^~nt&Q,k=ot&G^~ot&tt,w=V[t+2],_=V[t+3],w=(u=((A=h[t+2])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(et>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&et)+((a=((x=h[t+3])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(rt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&rt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,et=(u=(X>>>16)+(w>>>16)+((s=(65535&X)+(65535&w)+((a=(J>>>16)+(_>>>16)+((i=(65535&J)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,rt=a<<16|65535&i,e=((X=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(J=a<<16|65535&i)<<4)^(J>>>2|X<<30)^(J>>>7|X<<25),r=(J>>>28|X<<4)^(X>>>2|J<<30)^(X>>>7|J<<25),n=(et>>>14|rt<<18)^(et>>>18|rt<<14)^(rt>>>9|et<<23),o=(rt>>>14|et<<18)^(rt>>>18|et<<14)^(et>>>9|rt<<23),m=(p=X&W)^X&D^c,g=(y=J&Z)^J&$^d,E=et&nt^~et&K,k=rt&ot^~rt&G,w=V[t+4],_=V[t+5],w=(u=((A=h[t+4])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(Q>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&Q)+((a=((x=h[t+5])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(tt>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&tt))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,Q=(u=(q>>>16)+(w>>>16)+((s=(65535&q)+(65535&w)+((a=(Y>>>16)+(_>>>16)+((i=(65535&Y)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,tt=a<<16|65535&i,e=((q=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s)>>>28|(Y=a<<16|65535&i)<<4)^(Y>>>2|q<<30)^(Y>>>7|q<<25),r=(Y>>>28|q<<4)^(q>>>2|Y<<30)^(q>>>7|Y<<25),n=(Q>>>14|tt<<18)^(Q>>>18|tt<<14)^(tt>>>9|Q<<23),o=(tt>>>14|Q<<18)^(tt>>>18|Q<<14)^(Q>>>9|tt<<23),m=(v=q&X)^q&W^p,g=(b=Y&J)^Y&Z^y,E=Q&et^~Q&nt,k=tt&rt^~tt&ot,w=V[t+6],_=V[t+7],w=(u=((A=h[t+6])>>>16)+(w>>>16)+(E>>>16)+(n>>>16)+(K>>>16)+((s=(65535&A)+(65535&w)+(65535&E)+(65535&n)+(65535&K)+((a=((x=h[t+7])>>>16)+(_>>>16)+(k>>>16)+(o>>>16)+(G>>>16)+((i=(65535&x)+(65535&_)+(65535&k)+(65535&o)+(65535&G))>>>16))>>>16))>>>16))<<16|65535&s,_=a<<16|65535&i,A=(u=(m>>>16)+(e>>>16)+((s=(65535&m)+(65535&e)+((a=(g>>>16)+(r>>>16)+((i=(65535&g)+(65535&r))>>>16))>>>16))>>>16))<<16|65535&s,x=a<<16|65535&i,K=(u=(D>>>16)+(w>>>16)+((s=(65535&D)+(65535&w)+((a=($>>>16)+(_>>>16)+((i=(65535&$)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,G=a<<16|65535&i,D=(u=(A>>>16)+(w>>>16)+((s=(65535&A)+(65535&w)+((a=(x>>>16)+(_>>>16)+((i=(65535&x)+(65535&_))>>>16))>>>16))>>>16))<<16|65535&s,$=a<<16|65535&i;u=(S>>>16)+(D>>>16)+((s=(65535&S)+(65535&D)+((a=(B>>>16)+($>>>16)+((i=(65535&B)+(65535&$))>>>16))>>>16))>>>16),this.h0h=u<<16|65535&s,this.h0l=a<<16|65535&i,u=(C>>>16)+(q>>>16)+((s=(65535&C)+(65535&q)+((a=(T>>>16)+(Y>>>16)+((i=(65535&T)+(65535&Y))>>>16))>>>16))>>>16),this.h1h=u<<16|65535&s,this.h1l=a<<16|65535&i,u=(U>>>16)+(X>>>16)+((s=(65535&U)+(65535&X)+((a=(O>>>16)+(J>>>16)+((i=(65535&O)+(65535&J))>>>16))>>>16))>>>16),this.h2h=u<<16|65535&s,this.h2l=a<<16|65535&i,u=(L>>>16)+(W>>>16)+((s=(65535&L)+(65535&W)+((a=(I>>>16)+(Z>>>16)+((i=(65535&I)+(65535&Z))>>>16))>>>16))>>>16),this.h3h=u<<16|65535&s,this.h3l=a<<16|65535&i,u=(R>>>16)+(K>>>16)+((s=(65535&R)+(65535&K)+((a=(H>>>16)+(G>>>16)+((i=(65535&H)+(65535&G))>>>16))>>>16))>>>16),this.h4h=u<<16|65535&s,this.h4l=a<<16|65535&i,u=(N>>>16)+(Q>>>16)+((s=(65535&N)+(65535&Q)+((a=(M>>>16)+(tt>>>16)+((i=(65535&M)+(65535&tt))>>>16))>>>16))>>>16),this.h5h=u<<16|65535&s,this.h5l=a<<16|65535&i,u=(j>>>16)+(et>>>16)+((s=(65535&j)+(65535&et)+((a=(z>>>16)+(rt>>>16)+((i=(65535&z)+(65535&rt))>>>16))>>>16))>>>16),this.h6h=u<<16|65535&s,this.h6l=a<<16|65535&i,u=(F>>>16)+(nt>>>16)+((s=(65535&F)+(65535&nt)+((a=(P>>>16)+(ot>>>16)+((i=(65535&P)+(65535&ot))>>>16))>>>16))>>>16),this.h7h=u<<16|65535&s,this.h7l=a<<16|65535&i},g.prototype.hex=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,l=this.h4l,c=this.h5h,h=this.h5l,d=this.h6h,p=this.h6l,y=this.h7h,v=this.h7l,b=this.bits,m=f[t>>28&15]+f[t>>24&15]+f[t>>20&15]+f[t>>16&15]+f[t>>12&15]+f[t>>8&15]+f[t>>4&15]+f[15&t]+f[e>>28&15]+f[e>>24&15]+f[e>>20&15]+f[e>>16&15]+f[e>>12&15]+f[e>>8&15]+f[e>>4&15]+f[15&e]+f[r>>28&15]+f[r>>24&15]+f[r>>20&15]+f[r>>16&15]+f[r>>12&15]+f[r>>8&15]+f[r>>4&15]+f[15&r]+f[n>>28&15]+f[n>>24&15]+f[n>>20&15]+f[n>>16&15]+f[n>>12&15]+f[n>>8&15]+f[n>>4&15]+f[15&n]+f[o>>28&15]+f[o>>24&15]+f[o>>20&15]+f[o>>16&15]+f[o>>12&15]+f[o>>8&15]+f[o>>4&15]+f[15&o]+f[i>>28&15]+f[i>>24&15]+f[i>>20&15]+f[i>>16&15]+f[i>>12&15]+f[i>>8&15]+f[i>>4&15]+f[15&i]+f[a>>28&15]+f[a>>24&15]+f[a>>20&15]+f[a>>16&15]+f[a>>12&15]+f[a>>8&15]+f[a>>4&15]+f[15&a];return b>=256&&(m+=f[s>>28&15]+f[s>>24&15]+f[s>>20&15]+f[s>>16&15]+f[s>>12&15]+f[s>>8&15]+f[s>>4&15]+f[15&s]),b>=384&&(m+=f[u>>28&15]+f[u>>24&15]+f[u>>20&15]+f[u>>16&15]+f[u>>12&15]+f[u>>8&15]+f[u>>4&15]+f[15&u]+f[l>>28&15]+f[l>>24&15]+f[l>>20&15]+f[l>>16&15]+f[l>>12&15]+f[l>>8&15]+f[l>>4&15]+f[15&l]+f[c>>28&15]+f[c>>24&15]+f[c>>20&15]+f[c>>16&15]+f[c>>12&15]+f[c>>8&15]+f[c>>4&15]+f[15&c]+f[h>>28&15]+f[h>>24&15]+f[h>>20&15]+f[h>>16&15]+f[h>>12&15]+f[h>>8&15]+f[h>>4&15]+f[15&h]),512==b&&(m+=f[d>>28&15]+f[d>>24&15]+f[d>>20&15]+f[d>>16&15]+f[d>>12&15]+f[d>>8&15]+f[d>>4&15]+f[15&d]+f[p>>28&15]+f[p>>24&15]+f[p>>20&15]+f[p>>16&15]+f[p>>12&15]+f[p>>8&15]+f[p>>4&15]+f[15&p]+f[y>>28&15]+f[y>>24&15]+f[y>>20&15]+f[y>>16&15]+f[y>>12&15]+f[y>>8&15]+f[y>>4&15]+f[15&y]+f[v>>28&15]+f[v>>24&15]+f[v>>20&15]+f[v>>16&15]+f[v>>12&15]+f[v>>8&15]+f[v>>4&15]+f[15&v]),m},g.prototype.toString=g.prototype.hex,g.prototype.digest=function(){this.finalize();var t=this.h0h,e=this.h0l,r=this.h1h,n=this.h1l,o=this.h2h,i=this.h2l,a=this.h3h,s=this.h3l,u=this.h4h,f=this.h4l,l=this.h5h,c=this.h5l,h=this.h6h,d=this.h6l,p=this.h7h,y=this.h7l,v=this.bits,b=[t>>24&255,t>>16&255,t>>8&255,255&t,e>>24&255,e>>16&255,e>>8&255,255&e,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o,i>>24&255,i>>16&255,i>>8&255,255&i,a>>24&255,a>>16&255,a>>8&255,255&a];return v>=256&&b.push(s>>24&255,s>>16&255,s>>8&255,255&s),v>=384&&b.push(u>>24&255,u>>16&255,u>>8&255,255&u,f>>24&255,f>>16&255,f>>8&255,255&f,l>>24&255,l>>16&255,l>>8&255,255&l,c>>24&255,c>>16&255,c>>8&255,255&c),512==v&&b.push(h>>24&255,h>>16&255,h>>8&255,255&h,d>>24&255,d>>16&255,d>>8&255,255&d,p>>24&255,p>>16&255,p>>8&255,255&p,y>>24&255,y>>16&255,y>>8&255,255&y),b},g.prototype.array=g.prototype.digest,g.prototype.arrayBuffer=function(){this.finalize();var t=this.bits,e=new ArrayBuffer(t/8),r=new DataView(e);return r.setUint32(0,this.h0h),r.setUint32(4,this.h0l),r.setUint32(8,this.h1h),r.setUint32(12,this.h1l),r.setUint32(16,this.h2h),r.setUint32(20,this.h2l),r.setUint32(24,this.h3h),t>=256&&r.setUint32(28,this.h3l),t>=384&&(r.setUint32(32,this.h4h),r.setUint32(36,this.h4l),r.setUint32(40,this.h5h),r.setUint32(44,this.h5l)),512==t&&(r.setUint32(48,this.h6h),r.setUint32(52,this.h6l),r.setUint32(56,this.h7h),r.setUint32(60,this.h7l)),e},g.prototype.clone=function(){var t=new g(this.bits,!1);return this.copyTo(t),t},g.prototype.copyTo=function(t){var e=0,r=["h0h","h0l","h1h","h1l","h2h","h2l","h3h","h3l","h4h","h4l","h5h","h5l","h6h","h6l","h7h","h7l","start","bytes","hBytes","finalized","hashed","lastByteIndex"];for(e=0;em)throw Error("numRounds must a integer >= 1");if("SHA-1"===t)p=512,y=j,v=z,d=160,b=function(t){return t.slice()};else if(0===t.lastIndexOf("SHA-",0))if(y=function(e,r){return F(e,r,t)},v=function(e,r,n,o){var i,a;if("SHA-224"===t||"SHA-256"===t)i=15+(r+65>>>9<<4),a=16;else{if("SHA-384"!==t&&"SHA-512"!==t)throw Error("Unexpected error in SHA-2 implementation");i=31+(r+129>>>10<<5),a=32}for(;e.length<=i;)e.push(0);for(e[r>>>5]|=128<<24-r%32,r+=n,e[i]=4294967295&r,e[i-1]=r/4294967296|0,n=e.length,r=0;re;e+=1)r[e]=t[e].slice();return r},B=1,"SHA3-224"===t)p=1152,d=224;else if("SHA3-256"===t)p=1088,d=256;else if("SHA3-384"===t)p=832,d=384;else if("SHA3-512"===t)p=576,d=512;else if("SHAKE128"===t)p=1344,d=-1,C=31,S=!0;else{if("SHAKE256"!==t)throw Error("Chosen SHA variant is not supported");p=1088,d=-1,C=31,S=!0}v=function(t,e,r,n,o){var i,a=C,s=[],u=(r=p)>>>5,f=0,l=e>>>5;for(i=0;i=r;i+=u)n=P(t.slice(i,i+u),n),e-=r;for(t=t.slice(i),e%=r;t.length>>3)>>2]^=a<=o));)s.push(t.a),0==64*(f+=1)%r&&(P(null,n),f=0);return s}}i=h(e,n,B),o=M(t),this.setHMACKey=function(e,r,i){var a;if(!0===A)throw Error("HMAC key already set");if(!0===k)throw Error("Cannot set HMAC key after calling update");if(!0===S)throw Error("SHAKE is not supported for HMAC");for(e=(r=h(r,n=(i||{}).encoding||"UTF8",B)(e)).binLen,r=r.value,i=(a=p>>>3)/4-1,a>>5;for(t=(e=i(t,w,_)).binLen,r=e.value,e=t>>>5,n=0;n>>5),_=t%p,k=!0},this.getHash=function(e,r){var n,i,h,p;if(!0===A)throw Error("Cannot call getHash after setting HMAC key");if(h=c(r),!0===S){if(-1===h.shakeLen)throw Error("shakeLen must be specified in options");d=h.shakeLen}switch(e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{i=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{i=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}for(p=v(w.slice(),_,g,b(o),d),i=1;i>>24-d%32),p=v(p,d,0,M(t),d);return n(p)},this.getHMAC=function(e,r){var n,i,h,m;if(!1===A)throw Error("Cannot call getHMAC without first setting HMAC key");switch(h=c(r),e){case"HEX":n=function(t){return a(t,d,B,h)};break;case"B64":n=function(t){return s(t,d,B,h)};break;case"BYTES":n=function(t){return u(t,d,B)};break;case"ARRAYBUFFER":try{n=new ArrayBuffer(0)}catch(t){throw Error("ARRAYBUFFER not supported by this environment")}n=function(t){return f(t,d,B)};break;case"UINT8ARRAY":try{n=new Uint8Array(0)}catch(t){throw Error("UINT8ARRAY not supported by this environment")}n=function(t){return l(t,d,B)};break;default:throw Error("outputFormat must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY")}return i=v(w.slice(),_,g,b(o),d),m=y(E,M(t)),n(m=v(i,d,p,m,d))}}function o(t,e){this.a=t,this.b=e}function i(t,e,r,n){var o,i,a,s,u;for(e=e||[0],i=(r=r||0)>>>3,u=-1===n?3:0,o=0;o>>2,e.length<=a&&e.push(0),e[a]|=t[o]<<8*(u+s%4*n);return{value:e,binLen:8*t.length+r}}function a(t,e,r,n){var o,i,a,s="";for(e/=8,a=-1===r?3:0,o=0;o>>2]>>>8*(a+o%4*r),s+="0123456789abcdef".charAt(i>>>4&15)+"0123456789abcdef".charAt(15&i);return n.outputUpper?s.toUpperCase():s}function s(t,e,r,n){var o,i,a,s,u="",f=e/8;for(s=-1===r?3:0,o=0;o>>2]:0,a=o+2>>2]:0,a=(t[o>>>2]>>>8*(s+o%4*r)&255)<<16|(i>>>8*(s+(o+1)%4*r)&255)<<8|a>>>8*(s+(o+2)%4*r)&255,i=0;4>i;i+=1)u+=8*o+6*i<=e?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a>>>6*(3-i)&63):n.b64Pad;return u}function u(t,e,r){var n,o,i,a="";for(e/=8,i=-1===r?3:0,n=0;n>>2]>>>8*(i+n%4*r)&255,a+=String.fromCharCode(o);return a}function f(t,e,r){e/=8;var n,o,i,a=new ArrayBuffer(e);for(i=new Uint8Array(a),o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return a}function l(t,e,r){e/=8;var n,o,i=new Uint8Array(e);for(o=-1===r?3:0,n=0;n>>2]>>>8*(o+n%4*r)&255;return i}function c(t){var e={outputUpper:!1,b64Pad:"=",shakeLen:-1};if(t=t||{},e.outputUpper=t.outputUpper||!1,!0===t.hasOwnProperty("b64Pad")&&(e.b64Pad=t.b64Pad),!0===t.hasOwnProperty("shakeLen")){if(0!=t.shakeLen%8)throw Error("shakeLen must be a multiple of 8");e.shakeLen=t.shakeLen}if("boolean"!=typeof e.outputUpper)throw Error("Invalid outputUpper formatting option");if("string"!=typeof e.b64Pad)throw Error("Invalid b64Pad formatting option");return e}function h(t,e,r){switch(e){case"UTF8":case"UTF16BE":case"UTF16LE":break;default:throw Error("encoding must be UTF8, UTF16BE, or UTF16LE")}switch(t){case"HEX":t=function(t,e,n){var o,i,a,s,u,f,l=t.length;if(0!=l%2)throw Error("String of HEX type must be in byte increments");for(e=e||[0],u=(n=n||0)>>>3,f=-1===r?3:0,o=0;o>>1)+u)>>>2;e.length<=a;)e.push(0);e[a]|=i<<8*(f+s%4*r)}return{value:e,binLen:4*l+n}};break;case"TEXT":t=function(t,n,o){var i,a,s,u,f,l,c,h,d=0;if(n=n||[0],f=(o=o||0)>>>3,"UTF8"===e)for(h=-1===r?3:0,s=0;s(i=t.charCodeAt(s))?a.push(i):2048>i?(a.push(192|i>>>6),a.push(128|63&i)):55296>i||57344<=i?a.push(224|i>>>12,128|i>>>6&63,128|63&i):(s+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(s)),a.push(240|i>>>18,128|i>>>12&63,128|i>>>6&63,128|63&i)),u=0;u>>2;n.length<=l;)n.push(0);n[l]|=a[u]<<8*(h+c%4*r),d+=1}else if("UTF16BE"===e||"UTF16LE"===e)for(h=-1===r?2:0,a="UTF16LE"===e&&1!==r||"UTF16LE"!==e&&1===r,s=0;s>>8),l=(c=d+f)>>>2;n.length<=l;)n.push(0);n[l]|=i<<8*(h+c%4*r),d+=2}return{value:n,binLen:8*d+o}};break;case"B64":t=function(t,e,n){var o,i,a,s,u,f,l,c,h=0;if(-1===t.search(/^[a-zA-Z0-9=+\/]+$/))throw Error("Invalid character in base-64 string");if(i=t.indexOf("="),t=t.replace(/\=/g,""),-1!==i&&i {