From ba96dca6b0262b543fc48b306965ef0a58330689 Mon Sep 17 00:00:00 2001 From: Angela Date: Thu, 17 Mar 2022 14:57:33 -0400 Subject: [PATCH] Add files via upload --- metamaskConnectr/DESCRIPTION | 20 + metamaskConnectr/NAMESPACE | 6 + metamaskConnectr/R/metamaskConnect.R | 24 + .../metamaskConnect/metamaskConnect.js | 61311 ++++++++++++++++ .../metamaskConnect/metamaskConnect.js.map | 1 + metamaskConnectr/man/metamaskConnect.Rd | 11 + 6 files changed, 61373 insertions(+) create mode 100644 metamaskConnectr/DESCRIPTION create mode 100644 metamaskConnectr/NAMESPACE create mode 100644 metamaskConnectr/R/metamaskConnect.R create mode 100644 metamaskConnectr/inst/www/metamaskConnectr/metamaskConnect/metamaskConnect.js create mode 100644 metamaskConnectr/inst/www/metamaskConnectr/metamaskConnect/metamaskConnect.js.map create mode 100644 metamaskConnectr/man/metamaskConnect.Rd diff --git a/metamaskConnectr/DESCRIPTION b/metamaskConnectr/DESCRIPTION new file mode 100644 index 0000000..9d7f41d --- /dev/null +++ b/metamaskConnectr/DESCRIPTION @@ -0,0 +1,20 @@ +Package: metamaskConnectr +Title: What the Package Does (One Line, Title Case) +Version: 0.0.0.9000 +Authors@R: + person(given = "First", + family = "Last", + role = c("aut", "cre"), + email = "first.last@example.com", + comment = c(ORCID = "YOUR-ORCID-ID")) +Description: What the package does (one paragraph). +License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a + license +Encoding: UTF-8 +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.1.1 +Imports: htmltools, reactR, shiny +NeedsCompilation: no +Packaged: 2022-02-14 21:40:31 UTC; angelaminster +Author: First Last [aut, cre] (YOUR-ORCID-ID) +Maintainer: First Last diff --git a/metamaskConnectr/NAMESPACE b/metamaskConnectr/NAMESPACE new file mode 100644 index 0000000..e26de07 --- /dev/null +++ b/metamaskConnectr/NAMESPACE @@ -0,0 +1,6 @@ +# Generated by roxygen2: do not edit by hand + +export(metamaskConnect) +importFrom(htmltools,htmlDependency) +importFrom(htmltools,tags) +importFrom(reactR,createReactShinyInput) diff --git a/metamaskConnectr/R/metamaskConnect.R b/metamaskConnectr/R/metamaskConnect.R new file mode 100644 index 0000000..004fabf --- /dev/null +++ b/metamaskConnectr/R/metamaskConnect.R @@ -0,0 +1,24 @@ +#' +#' +#' +#' +#' @importFrom reactR createReactShinyInput +#' @importFrom htmltools htmlDependency tags +#' +#' @export +metamaskConnect <- function(inputId, default = "") { + reactR::createReactShinyInput( + inputId, + "metamaskConnect", + htmltools::htmlDependency( + name = "metamaskConnect-input", + version = "1.0.0", + src = "www/metamaskConnectr/metamaskConnect", + package = "metamaskConnectr", + script = "metamaskConnect.js" + ), + default, + list(), + htmltools::tags$div + ) +} diff --git a/metamaskConnectr/inst/www/metamaskConnectr/metamaskConnect/metamaskConnect.js b/metamaskConnectr/inst/www/metamaskConnectr/metamaskConnect/metamaskConnect.js new file mode 100644 index 0000000..d876d80 --- /dev/null +++ b/metamaskConnectr/inst/www/metamaskConnectr/metamaskConnect/metamaskConnect.js @@ -0,0 +1,61311 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; +/******/ +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = "./srcjs/metamaskConnect.jsx"); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./node_modules/@ethersproject/abi/lib.esm/_version.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/_version.js ***! + \*************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "abi/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/abi-coder.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/abi-coder.js ***! + \**************************************************************/ +/*! exports provided: AbiCoder, defaultAbiCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbiCoder", function() { return AbiCoder; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultAbiCoder", function() { return defaultAbiCoder; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/abi/lib.esm/_version.js"); +/* harmony import */ var _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./coders/abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); +/* harmony import */ var _coders_address__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./coders/address */ "./node_modules/@ethersproject/abi/lib.esm/coders/address.js"); +/* harmony import */ var _coders_array__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./coders/array */ "./node_modules/@ethersproject/abi/lib.esm/coders/array.js"); +/* harmony import */ var _coders_boolean__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./coders/boolean */ "./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js"); +/* harmony import */ var _coders_bytes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./coders/bytes */ "./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js"); +/* harmony import */ var _coders_fixed_bytes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./coders/fixed-bytes */ "./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js"); +/* harmony import */ var _coders_null__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./coders/null */ "./node_modules/@ethersproject/abi/lib.esm/coders/null.js"); +/* harmony import */ var _coders_number__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./coders/number */ "./node_modules/@ethersproject/abi/lib.esm/coders/number.js"); +/* harmony import */ var _coders_string__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./coders/string */ "./node_modules/@ethersproject/abi/lib.esm/coders/string.js"); +/* harmony import */ var _coders_tuple__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./coders/tuple */ "./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js"); +/* harmony import */ var _fragments__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./fragments */ "./node_modules/@ethersproject/abi/lib.esm/fragments.js"); + // See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"](_version__WEBPACK_IMPORTED_MODULE_3__["version"]); + + + + + + + + + + + +var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); +var AbiCoder = /*#__PURE__*/function () { + function AbiCoder(coerceFunc) { + _classCallCheck(this, AbiCoder); + + logger.checkNew(this instanceof AbiCoder ? this.constructor : void 0, AbiCoder); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(this, "coerceFunc", coerceFunc || null); + } + + _createClass(AbiCoder, [{ + key: "_getCoder", + value: function _getCoder(param) { + var _this = this; + + switch (param.baseType) { + case "address": + return new _coders_address__WEBPACK_IMPORTED_MODULE_5__["AddressCoder"](param.name); + + case "bool": + return new _coders_boolean__WEBPACK_IMPORTED_MODULE_7__["BooleanCoder"](param.name); + + case "string": + return new _coders_string__WEBPACK_IMPORTED_MODULE_12__["StringCoder"](param.name); + + case "bytes": + return new _coders_bytes__WEBPACK_IMPORTED_MODULE_8__["BytesCoder"](param.name); + + case "array": + return new _coders_array__WEBPACK_IMPORTED_MODULE_6__["ArrayCoder"](this._getCoder(param.arrayChildren), param.arrayLength, param.name); + + case "tuple": + return new _coders_tuple__WEBPACK_IMPORTED_MODULE_13__["TupleCoder"]((param.components || []).map(function (component) { + return _this._getCoder(component); + }), param.name); + + case "": + return new _coders_null__WEBPACK_IMPORTED_MODULE_10__["NullCoder"](param.name); + } // u?int[0-9]* + + + var match = param.type.match(paramTypeNumber); + + if (match) { + var size = parseInt(match[2] || "256"); + + if (size === 0 || size > 256 || size % 8 !== 0) { + logger.throwArgumentError("invalid " + match[1] + " bit length", "param", param); + } + + return new _coders_number__WEBPACK_IMPORTED_MODULE_11__["NumberCoder"](size / 8, match[1] === "int", param.name); + } // bytes[0-9]+ + + + match = param.type.match(paramTypeBytes); + + if (match) { + var _size = parseInt(match[1]); + + if (_size === 0 || _size > 32) { + logger.throwArgumentError("invalid bytes length", "param", param); + } + + return new _coders_fixed_bytes__WEBPACK_IMPORTED_MODULE_9__["FixedBytesCoder"](_size, param.name); + } + + return logger.throwArgumentError("invalid type", "type", param.type); + } + }, { + key: "_getWordSize", + value: function _getWordSize() { + return 32; + } + }, { + key: "_getReader", + value: function _getReader(data, allowLoose) { + return new _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_4__["Reader"](data, this._getWordSize(), this.coerceFunc, allowLoose); + } + }, { + key: "_getWriter", + value: function _getWriter() { + return new _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_4__["Writer"](this._getWordSize()); + } + }, { + key: "getDefaultValue", + value: function getDefaultValue(types) { + var _this2 = this; + + var coders = types.map(function (type) { + return _this2._getCoder(_fragments__WEBPACK_IMPORTED_MODULE_14__["ParamType"].from(type)); + }); + var coder = new _coders_tuple__WEBPACK_IMPORTED_MODULE_13__["TupleCoder"](coders, "_"); + return coder.defaultValue(); + } + }, { + key: "encode", + value: function encode(types, values) { + var _this3 = this; + + if (types.length !== values.length) { + logger.throwError("types/values length mismatch", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.INVALID_ARGUMENT, { + count: { + types: types.length, + values: values.length + }, + value: { + types: types, + values: values + } + }); + } + + var coders = types.map(function (type) { + return _this3._getCoder(_fragments__WEBPACK_IMPORTED_MODULE_14__["ParamType"].from(type)); + }); + var coder = new _coders_tuple__WEBPACK_IMPORTED_MODULE_13__["TupleCoder"](coders, "_"); + + var writer = this._getWriter(); + + coder.encode(writer, values); + return writer.data; + } + }, { + key: "decode", + value: function decode(types, data, loose) { + var _this4 = this; + + var coders = types.map(function (type) { + return _this4._getCoder(_fragments__WEBPACK_IMPORTED_MODULE_14__["ParamType"].from(type)); + }); + var coder = new _coders_tuple__WEBPACK_IMPORTED_MODULE_13__["TupleCoder"](coders, "_"); + return coder.decode(this._getReader(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(data), loose)); + } + }]); + + return AbiCoder; +}(); +var defaultAbiCoder = new AbiCoder(); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js ***! + \**************************************************************************/ +/*! exports provided: checkResultErrors, Coder, Writer, Reader */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkResultErrors", function() { return checkResultErrors; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Coder", function() { return Coder; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Writer", function() { return Writer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reader", function() { return Reader; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../_version */ "./node_modules/@ethersproject/abi/lib.esm/_version.js"); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"](_version__WEBPACK_IMPORTED_MODULE_4__["version"]); +function checkResultErrors(result) { + // Find the first error (if any) + var errors = []; + + var checkErrors = function checkErrors(path, object) { + if (!Array.isArray(object)) { + return; + } + + for (var key in object) { + var childPath = path.slice(); + childPath.push(key); + + try { + checkErrors(childPath, object[key]); + } catch (error) { + errors.push({ + path: childPath, + error: error + }); + } + } + }; + + checkErrors([], result); + return errors; +} +var Coder = /*#__PURE__*/function () { + function Coder(name, type, localName, dynamic) { + _classCallCheck(this, Coder); + + // @TODO: defineReadOnly these + this.name = name; + this.type = type; + this.localName = localName; + this.dynamic = dynamic; + } + + _createClass(Coder, [{ + key: "_throwError", + value: function _throwError(message, value) { + logger.throwArgumentError(message, this.localName, value); + } + }]); + + return Coder; +}(); +var Writer = /*#__PURE__*/function () { + function Writer(wordSize) { + _classCallCheck(this, Writer); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "wordSize", wordSize || 32); + this._data = []; + this._dataLength = 0; + this._padding = new Uint8Array(wordSize); + } + + _createClass(Writer, [{ + key: "data", + get: function get() { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexConcat"])(this._data); + } + }, { + key: "length", + get: function get() { + return this._dataLength; + } + }, { + key: "_writeData", + value: function _writeData(data) { + this._data.push(data); + + this._dataLength += data.length; + return data.length; + } + }, { + key: "appendWriter", + value: function appendWriter(writer) { + return this._writeData(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["concat"])(writer._data)); + } // Arrayish items; padded on the right to wordSize + + }, { + key: "writeBytes", + value: function writeBytes(value) { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(value); + var paddingOffset = bytes.length % this.wordSize; + + if (paddingOffset) { + bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["concat"])([bytes, this._padding.slice(paddingOffset)]); + } + + return this._writeData(bytes); + } + }, { + key: "_getValue", + value: function _getValue(value) { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value)); + + if (bytes.length > this.wordSize) { + logger.throwError("value out-of-bounds", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"].errors.BUFFER_OVERRUN, { + length: this.wordSize, + offset: bytes.length + }); + } + + if (bytes.length % this.wordSize) { + bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["concat"])([this._padding.slice(bytes.length % this.wordSize), bytes]); + } + + return bytes; + } // BigNumberish items; padded on the left to wordSize + + }, { + key: "writeValue", + value: function writeValue(value) { + return this._writeData(this._getValue(value)); + } + }, { + key: "writeUpdatableValue", + value: function writeUpdatableValue() { + var _this = this; + + var offset = this._data.length; + + this._data.push(this._padding); + + this._dataLength += this.wordSize; + return function (value) { + _this._data[offset] = _this._getValue(value); + }; + } + }]); + + return Writer; +}(); +var Reader = /*#__PURE__*/function () { + function Reader(data, wordSize, coerceFunc, allowLoose) { + _classCallCheck(this, Reader); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "_data", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(data)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "wordSize", wordSize || 32); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "_coerceFunc", coerceFunc); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "allowLoose", allowLoose); + this._offset = 0; + } + + _createClass(Reader, [{ + key: "data", + get: function get() { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(this._data); + } + }, { + key: "consumed", + get: function get() { + return this._offset; + } // The default Coerce function + + }, { + key: "coerce", + value: function coerce(name, value) { + if (this._coerceFunc) { + return this._coerceFunc(name, value); + } + + return Reader.coerce(name, value); + } + }, { + key: "_peekBytes", + value: function _peekBytes(offset, length, loose) { + var alignedLength = Math.ceil(length / this.wordSize) * this.wordSize; + + if (this._offset + alignedLength > this._data.length) { + if (this.allowLoose && loose && this._offset + length <= this._data.length) { + alignedLength = length; + } else { + logger.throwError("data out-of-bounds", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"].errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + + return this._data.slice(this._offset, this._offset + alignedLength); + } + }, { + key: "subReader", + value: function subReader(offset) { + return new Reader(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + } + }, { + key: "readBytes", + value: function readBytes(length, loose) { + var bytes = this._peekBytes(0, length, !!loose); + + this._offset += bytes.length; // @TODO: Make sure the length..end bytes are all 0? + + return bytes.slice(0, length); + } + }, { + key: "readValue", + value: function readValue() { + return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(this.readBytes(this.wordSize)); + } + }], [{ + key: "coerce", + value: function coerce(name, value) { + var match = name.match("^u?int([0-9]+)$"); + + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + + return value; + } + }]); + + return Reader; +}(); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/address.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/address.js ***! + \*******************************************************************/ +/*! exports provided: AddressCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AddressCoder", function() { return AddressCoder; }); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + +var AddressCoder = /*#__PURE__*/function (_Coder) { + _inherits(AddressCoder, _Coder); + + var _super = _createSuper(AddressCoder); + + function AddressCoder(localName) { + _classCallCheck(this, AddressCoder); + + return _super.call(this, "address", "address", localName, false); + } + + _createClass(AddressCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + }, { + key: "encode", + value: function encode(writer, value) { + try { + value = Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(value); + } catch (error) { + this._throwError(error.message, value); + } + + return writer.writeValue(value); + } + }, { + key: "decode", + value: function decode(reader) { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexZeroPad"])(reader.readValue().toHexString(), 20)); + } + }]); + + return AddressCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_2__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js ***! + \*********************************************************************/ +/*! exports provided: AnonymousCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnonymousCoder", function() { return AnonymousCoder; }); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + // Clones the functionality of an existing Coder, but without a localName + +var AnonymousCoder = /*#__PURE__*/function (_Coder) { + _inherits(AnonymousCoder, _Coder); + + var _super = _createSuper(AnonymousCoder); + + function AnonymousCoder(coder) { + var _this; + + _classCallCheck(this, AnonymousCoder); + + _this = _super.call(this, coder.name, coder.type, undefined, coder.dynamic); + _this.coder = coder; + return _this; + } + + _createClass(AnonymousCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return this.coder.defaultValue(); + } + }, { + key: "encode", + value: function encode(writer, value) { + return this.coder.encode(writer, value); + } + }, { + key: "decode", + value: function decode(reader) { + return this.coder.decode(reader); + } + }]); + + return AnonymousCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_0__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/array.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/array.js ***! + \*****************************************************************/ +/*! exports provided: pack, unpack, ArrayCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pack", function() { return pack; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unpack", function() { return unpack; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayCoder", function() { return ArrayCoder; }); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../_version */ "./node_modules/@ethersproject/abi/lib.esm/_version.js"); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); +/* harmony import */ var _anonymous__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./anonymous */ "./node_modules/@ethersproject/abi/lib.esm/coders/anonymous.js"); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"](_version__WEBPACK_IMPORTED_MODULE_1__["version"]); + + +function pack(writer, coders, values) { + var arrayValues = null; + + if (Array.isArray(values)) { + arrayValues = values; + } else if (values && _typeof(values) === "object") { + var unique = {}; + arrayValues = coders.map(function (coder) { + var name = coder.localName; + + if (!name) { + logger.throwError("cannot encode object for signature with missing names", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"].errors.INVALID_ARGUMENT, { + argument: "values", + coder: coder, + value: values + }); + } + + if (unique[name]) { + logger.throwError("cannot encode object for signature with duplicate names", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"].errors.INVALID_ARGUMENT, { + argument: "values", + coder: coder, + value: values + }); + } + + unique[name] = true; + return values[name]; + }); + } else { + logger.throwArgumentError("invalid tuple value", "tuple", values); + } + + if (coders.length !== arrayValues.length) { + logger.throwArgumentError("types/value length mismatch", "tuple", values); + } + + var staticWriter = new _abstract_coder__WEBPACK_IMPORTED_MODULE_2__["Writer"](writer.wordSize); + var dynamicWriter = new _abstract_coder__WEBPACK_IMPORTED_MODULE_2__["Writer"](writer.wordSize); + var updateFuncs = []; + coders.forEach(function (coder, index) { + var value = arrayValues[index]; + + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + var dynamicOffset = dynamicWriter.length; // Encode the dynamic value into the dynamicWriter + + coder.encode(dynamicWriter, value); // Prepare to populate the correct offset once we are done + + var updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push(function (baseOffset) { + updateFunc(baseOffset + dynamicOffset); + }); + } else { + coder.encode(staticWriter, value); + } + }); // Backfill all the dynamic offsets, now that we know the static length + + updateFuncs.forEach(function (func) { + func(staticWriter.length); + }); + var length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +function unpack(reader, coders) { + var values = []; // A reader anchored to this base + + var baseReader = reader.subReader(0); + coders.forEach(function (coder) { + var value = null; + + if (coder.dynamic) { + var offset = reader.readValue(); + var offsetReader = baseReader.subReader(offset.toNumber()); + + try { + value = coder.decode(offsetReader); + } catch (error) { + // Cannot recover from this + if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"].errors.BUFFER_OVERRUN) { + throw error; + } + + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } else { + try { + value = coder.decode(reader); + } catch (error) { + // Cannot recover from this + if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"].errors.BUFFER_OVERRUN) { + throw error; + } + + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + + if (value != undefined) { + values.push(value); + } + }); // We only output named properties for uniquely named coders + + var uniqueNames = coders.reduce(function (accum, coder) { + var name = coder.localName; + + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + + accum[name]++; + } + + return accum; + }, {}); // Add any named parameters (i.e. tuples) + + coders.forEach(function (coder, index) { + var name = coder.localName; + + if (!name || uniqueNames[name] !== 1) { + return; + } + + if (name === "length") { + name = "_length"; + } + + if (values[name] != null) { + return; + } + + var value = values[index]; + + if (value instanceof Error) { + Object.defineProperty(values, name, { + enumerable: true, + get: function get() { + throw value; + } + }); + } else { + values[name] = value; + } + }); + + var _loop = function _loop(i) { + var value = values[i]; + + if (value instanceof Error) { + Object.defineProperty(values, i, { + enumerable: true, + get: function get() { + throw value; + } + }); + } + }; + + for (var i = 0; i < values.length; i++) { + _loop(i); + } + + return Object.freeze(values); +} +var ArrayCoder = /*#__PURE__*/function (_Coder) { + _inherits(ArrayCoder, _Coder); + + var _super = _createSuper(ArrayCoder); + + function ArrayCoder(coder, length, localName) { + var _this; + + _classCallCheck(this, ArrayCoder); + + var type = coder.type + "[" + (length >= 0 ? length : "") + "]"; + var dynamic = length === -1 || coder.dynamic; + _this = _super.call(this, "array", type, localName, dynamic); + _this.coder = coder; + _this.length = length; + return _this; + } + + _createClass(ArrayCoder, [{ + key: "defaultValue", + value: function defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + var defaultChild = this.coder.defaultValue(); + var result = []; + + for (var i = 0; i < this.length; i++) { + result.push(defaultChild); + } + + return result; + } + }, { + key: "encode", + value: function encode(writer, value) { + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + + var count = this.length; + + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + + logger.checkArgumentCount(value.length, count, "coder array" + (this.localName ? " " + this.localName : "")); + var coders = []; + + for (var i = 0; i < value.length; i++) { + coders.push(this.coder); + } + + return pack(writer, coders, value); + } + }, { + key: "decode", + value: function decode(reader) { + var count = this.length; + + if (count === -1) { + count = reader.readValue().toNumber(); // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + + if (count * 32 > reader._data.length) { + logger.throwError("insufficient data length", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"].errors.BUFFER_OVERRUN, { + length: reader._data.length, + count: count + }); + } + } + + var coders = []; + + for (var i = 0; i < count; i++) { + coders.push(new _anonymous__WEBPACK_IMPORTED_MODULE_3__["AnonymousCoder"](this.coder)); + } + + return reader.coerce(this.name, unpack(reader, coders)); + } + }]); + + return ArrayCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_2__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/boolean.js ***! + \*******************************************************************/ +/*! exports provided: BooleanCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BooleanCoder", function() { return BooleanCoder; }); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + +var BooleanCoder = /*#__PURE__*/function (_Coder) { + _inherits(BooleanCoder, _Coder); + + var _super = _createSuper(BooleanCoder); + + function BooleanCoder(localName) { + _classCallCheck(this, BooleanCoder); + + return _super.call(this, "bool", "bool", localName, false); + } + + _createClass(BooleanCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return false; + } + }, { + key: "encode", + value: function encode(writer, value) { + return writer.writeValue(value ? 1 : 0); + } + }, { + key: "decode", + value: function decode(reader) { + return reader.coerce(this.type, !reader.readValue().isZero()); + } + }]); + + return BooleanCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_0__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js ***! + \*****************************************************************/ +/*! exports provided: DynamicBytesCoder, BytesCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DynamicBytesCoder", function() { return DynamicBytesCoder; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BytesCoder", function() { return BytesCoder; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + +var DynamicBytesCoder = /*#__PURE__*/function (_Coder) { + _inherits(DynamicBytesCoder, _Coder); + + var _super = _createSuper(DynamicBytesCoder); + + function DynamicBytesCoder(type, localName) { + _classCallCheck(this, DynamicBytesCoder); + + return _super.call(this, type, type, localName, true); + } + + _createClass(DynamicBytesCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return "0x"; + } + }, { + key: "encode", + value: function encode(writer, value) { + value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(value); + var length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + }, { + key: "decode", + value: function decode(reader) { + return reader.readBytes(reader.readValue().toNumber(), true); + } + }]); + + return DynamicBytesCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_1__["Coder"]); +var BytesCoder = /*#__PURE__*/function (_DynamicBytesCoder) { + _inherits(BytesCoder, _DynamicBytesCoder); + + var _super2 = _createSuper(BytesCoder); + + function BytesCoder(localName) { + _classCallCheck(this, BytesCoder); + + return _super2.call(this, "bytes", localName); + } + + _createClass(BytesCoder, [{ + key: "decode", + value: function decode(reader) { + return reader.coerce(this.name, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(_get(_getPrototypeOf(BytesCoder.prototype), "decode", this).call(this, reader))); + } + }]); + + return BytesCoder; +}(DynamicBytesCoder); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/fixed-bytes.js ***! + \***********************************************************************/ +/*! exports provided: FixedBytesCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FixedBytesCoder", function() { return FixedBytesCoder; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + // @TODO: Merge this with bytes + +var FixedBytesCoder = /*#__PURE__*/function (_Coder) { + _inherits(FixedBytesCoder, _Coder); + + var _super = _createSuper(FixedBytesCoder); + + function FixedBytesCoder(size, localName) { + var _this; + + _classCallCheck(this, FixedBytesCoder); + + var name = "bytes" + String(size); + _this = _super.call(this, name, name, localName, false); + _this.size = size; + return _this; + } + + _createClass(FixedBytesCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); + } + }, { + key: "encode", + value: function encode(writer, value) { + var data = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(value); + + if (data.length !== this.size) { + this._throwError("incorrect data length", value); + } + + return writer.writeBytes(data); + } + }, { + key: "decode", + value: function decode(reader) { + return reader.coerce(this.name, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(reader.readBytes(this.size))); + } + }]); + + return FixedBytesCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_1__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/null.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/null.js ***! + \****************************************************************/ +/*! exports provided: NullCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NullCoder", function() { return NullCoder; }); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + +var NullCoder = /*#__PURE__*/function (_Coder) { + _inherits(NullCoder, _Coder); + + var _super = _createSuper(NullCoder); + + function NullCoder(localName) { + _classCallCheck(this, NullCoder); + + return _super.call(this, "null", "", localName, false); + } + + _createClass(NullCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return null; + } + }, { + key: "encode", + value: function encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + + return writer.writeBytes([]); + } + }, { + key: "decode", + value: function decode(reader) { + reader.readBytes(0); + return reader.coerce(this.name, null); + } + }]); + + return NullCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_0__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/number.js": +/*!******************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/number.js ***! + \******************************************************************/ +/*! exports provided: NumberCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberCoder", function() { return NumberCoder; }); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js"); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + +var NumberCoder = /*#__PURE__*/function (_Coder) { + _inherits(NumberCoder, _Coder); + + var _super = _createSuper(NumberCoder); + + function NumberCoder(size, signed, localName) { + var _this; + + _classCallCheck(this, NumberCoder); + + var name = (signed ? "int" : "uint") + size * 8; + _this = _super.call(this, name, name, localName, false); + _this.size = size; + _this.signed = signed; + return _this; + } + + _createClass(NumberCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return 0; + } + }, { + key: "encode", + value: function encode(writer, value) { + var v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(value); // Check bounds are safe for encoding + + var maxUintValue = _ethersproject_constants__WEBPACK_IMPORTED_MODULE_1__["MaxUint256"].mask(writer.wordSize * 8); + + if (this.signed) { + var bounds = maxUintValue.mask(this.size * 8 - 1); + + if (v.gt(bounds) || v.lt(bounds.add(_ethersproject_constants__WEBPACK_IMPORTED_MODULE_1__["One"]).mul(_ethersproject_constants__WEBPACK_IMPORTED_MODULE_1__["NegativeOne"]))) { + this._throwError("value out-of-bounds", value); + } + } else if (v.lt(_ethersproject_constants__WEBPACK_IMPORTED_MODULE_1__["Zero"]) || v.gt(maxUintValue.mask(this.size * 8))) { + this._throwError("value out-of-bounds", value); + } + + v = v.toTwos(this.size * 8).mask(this.size * 8); + + if (this.signed) { + v = v.fromTwos(this.size * 8).toTwos(8 * writer.wordSize); + } + + return writer.writeValue(v); + } + }, { + key: "decode", + value: function decode(reader) { + var value = reader.readValue().mask(this.size * 8); + + if (this.signed) { + value = value.fromTwos(this.size * 8); + } + + return reader.coerce(this.name, value); + } + }]); + + return NumberCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_2__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/string.js": +/*!******************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/string.js ***! + \******************************************************************/ +/*! exports provided: StringCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringCoder", function() { return StringCoder; }); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bytes */ "./node_modules/@ethersproject/abi/lib.esm/coders/bytes.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + +var StringCoder = /*#__PURE__*/function (_DynamicBytesCoder) { + _inherits(StringCoder, _DynamicBytesCoder); + + var _super = _createSuper(StringCoder); + + function StringCoder(localName) { + _classCallCheck(this, StringCoder); + + return _super.call(this, "string", localName); + } + + _createClass(StringCoder, [{ + key: "defaultValue", + value: function defaultValue() { + return ""; + } + }, { + key: "encode", + value: function encode(writer, value) { + return _get(_getPrototypeOf(StringCoder.prototype), "encode", this).call(this, writer, Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__["toUtf8Bytes"])(value)); + } + }, { + key: "decode", + value: function decode(reader) { + return Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_0__["toUtf8String"])(_get(_getPrototypeOf(StringCoder.prototype), "decode", this).call(this, reader)); + } + }]); + + return StringCoder; +}(_bytes__WEBPACK_IMPORTED_MODULE_1__["DynamicBytesCoder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/coders/tuple.js ***! + \*****************************************************************/ +/*! exports provided: TupleCoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TupleCoder", function() { return TupleCoder; }); +/* harmony import */ var _abstract_coder__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); +/* harmony import */ var _array__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./array */ "./node_modules/@ethersproject/abi/lib.esm/coders/array.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + +var TupleCoder = /*#__PURE__*/function (_Coder) { + _inherits(TupleCoder, _Coder); + + var _super = _createSuper(TupleCoder); + + function TupleCoder(coders, localName) { + var _this; + + _classCallCheck(this, TupleCoder); + + var dynamic = false; + var types = []; + coders.forEach(function (coder) { + if (coder.dynamic) { + dynamic = true; + } + + types.push(coder.type); + }); + var type = "tuple(" + types.join(",") + ")"; + _this = _super.call(this, "tuple", type, localName, dynamic); + _this.coders = coders; + return _this; + } + + _createClass(TupleCoder, [{ + key: "defaultValue", + value: function defaultValue() { + var values = []; + this.coders.forEach(function (coder) { + values.push(coder.defaultValue()); + }); // We only output named properties for uniquely named coders + + var uniqueNames = this.coders.reduce(function (accum, coder) { + var name = coder.localName; + + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + + accum[name]++; + } + + return accum; + }, {}); // Add named values + + this.coders.forEach(function (coder, index) { + var name = coder.localName; + + if (!name || uniqueNames[name] !== 1) { + return; + } + + if (name === "length") { + name = "_length"; + } + + if (values[name] != null) { + return; + } + + values[name] = values[index]; + }); + return Object.freeze(values); + } + }, { + key: "encode", + value: function encode(writer, value) { + return Object(_array__WEBPACK_IMPORTED_MODULE_1__["pack"])(writer, this.coders, value); + } + }, { + key: "decode", + value: function decode(reader) { + return reader.coerce(this.name, Object(_array__WEBPACK_IMPORTED_MODULE_1__["unpack"])(reader, this.coders)); + } + }]); + + return TupleCoder; +}(_abstract_coder__WEBPACK_IMPORTED_MODULE_0__["Coder"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/fragments.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/fragments.js ***! + \**************************************************************/ +/*! exports provided: FormatTypes, ParamType, Fragment, EventFragment, ConstructorFragment, FunctionFragment, ErrorFragment */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormatTypes", function() { return FormatTypes; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParamType", function() { return ParamType; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return Fragment; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventFragment", function() { return EventFragment; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConstructorFragment", function() { return ConstructorFragment; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionFragment", function() { return FunctionFragment; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorFragment", function() { return ErrorFragment; }); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/abi/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"](_version__WEBPACK_IMPORTED_MODULE_3__["version"]); +; +var _constructorGuard = {}; +var ModifiersBytes = { + calldata: true, + memory: true, + storage: true +}; +var ModifiersNest = { + calldata: true, + memory: true +}; + +function checkModifier(type, name) { + if (type === "bytes" || type === "string") { + if (ModifiersBytes[name]) { + return true; + } + } else if (type === "address") { + if (name === "payable") { + return true; + } + } else if (type.indexOf("[") >= 0 || type === "tuple") { + if (ModifiersNest[name]) { + return true; + } + } + + if (ModifiersBytes[name] || name === "payable") { + logger.throwArgumentError("invalid modifier", "name", name); + } + + return false; +} // @TODO: Make sure that children of an indexed tuple are marked with a null indexed + + +function parseParamType(param, allowIndexed) { + var originalParam = param; + + function throwError(i) { + logger.throwArgumentError("unexpected character at position ".concat(i), "param", param); + } + + param = param.replace(/\s/g, " "); + + function newNode(parent) { + var node = { + type: "", + name: "", + parent: parent, + state: { + allowType: true + } + }; + + if (allowIndexed) { + node.indexed = false; + } + + return node; + } + + var parent = { + type: "", + name: "", + state: { + allowType: true + } + }; + var node = parent; + + for (var i = 0; i < param.length; i++) { + var c = param[i]; + + switch (c) { + case "(": + if (node.state.allowType && node.type === "") { + node.type = "tuple"; + } else if (!node.state.allowParams) { + throwError(i); + } + + node.state.allowType = false; + node.type = verifyType(node.type); + node.components = [newNode(node)]; + node = node.components[0]; + break; + + case ")": + delete node.state; + + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i); + } + + node.indexed = true; + node.name = ""; + } + + if (checkModifier(node.type, node.name)) { + node.name = ""; + } + + node.type = verifyType(node.type); + var child = node; + node = node.parent; + + if (!node) { + throwError(i); + } + + delete child.parent; + node.state.allowParams = false; + node.state.allowName = true; + node.state.allowArray = true; + break; + + case ",": + delete node.state; + + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i); + } + + node.indexed = true; + node.name = ""; + } + + if (checkModifier(node.type, node.name)) { + node.name = ""; + } + + node.type = verifyType(node.type); + var sibling = newNode(node.parent); //{ type: "", name: "", parent: node.parent, state: { allowType: true } }; + + node.parent.components.push(sibling); + delete node.parent; + node = sibling; + break; + // Hit a space... + + case " ": + // If reading type, the type is done and may read a param or name + if (node.state.allowType) { + if (node.type !== "") { + node.type = verifyType(node.type); + delete node.state.allowType; + node.state.allowName = true; + node.state.allowParams = true; + } + } // If reading name, the name is done + + + if (node.state.allowName) { + if (node.name !== "") { + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(i); + } + + if (node.indexed) { + throwError(i); + } + + node.indexed = true; + node.name = ""; + } else if (checkModifier(node.type, node.name)) { + node.name = ""; + } else { + node.state.allowName = false; + } + } + } + + break; + + case "[": + if (!node.state.allowArray) { + throwError(i); + } + + node.type += c; + node.state.allowArray = false; + node.state.allowName = false; + node.state.readArray = true; + break; + + case "]": + if (!node.state.readArray) { + throwError(i); + } + + node.type += c; + node.state.readArray = false; + node.state.allowArray = true; + node.state.allowName = true; + break; + + default: + if (node.state.allowType) { + node.type += c; + node.state.allowParams = true; + node.state.allowArray = true; + } else if (node.state.allowName) { + node.name += c; + delete node.state.allowArray; + } else if (node.state.readArray) { + node.type += c; + } else { + throwError(i); + } + + } + } + + if (node.parent) { + logger.throwArgumentError("unexpected eof", "param", param); + } + + delete parent.state; + + if (node.name === "indexed") { + if (!allowIndexed) { + throwError(originalParam.length - 7); + } + + if (node.indexed) { + throwError(originalParam.length - 7); + } + + node.indexed = true; + node.name = ""; + } else if (checkModifier(node.type, node.name)) { + node.name = ""; + } + + parent.type = verifyType(parent.type); + return parent; +} + +function populate(object, params) { + for (var key in params) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(object, key, params[key]); + } +} + +var FormatTypes = Object.freeze({ + // Bare formatting, as is needed for computing a sighash of an event or function + sighash: "sighash", + // Human-Readable with Minimal spacing and without names (compact human-readable) + minimal: "minimal", + // Human-Readable with nice spacing, including all names + full: "full", + // JSON-format a la Solidity + json: "json" +}); +var paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/); +var ParamType = /*#__PURE__*/function () { + function ParamType(constructorGuard, params) { + _classCallCheck(this, ParamType); + + if (constructorGuard !== _constructorGuard) { + logger.throwError("use fromString", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "new ParamType()" + }); + } + + populate(this, params); + var match = this.type.match(paramTypeArray); + + if (match) { + populate(this, { + arrayLength: parseInt(match[2] || "-1"), + arrayChildren: ParamType.fromObject({ + type: match[1], + components: this.components + }), + baseType: "array" + }); + } else { + populate(this, { + arrayLength: null, + arrayChildren: null, + baseType: this.components != null ? "tuple" : this.type + }); + } + + this._isParamType = true; + Object.freeze(this); + } // Format the parameter fragment + // - sighash: "(uint256,address)" + // - minimal: "tuple(uint256,address) indexed" + // - full: "tuple(uint256 foo, address bar) indexed baz" + + + _createClass(ParamType, [{ + key: "format", + value: function format(_format) { + if (!_format) { + _format = FormatTypes.sighash; + } + + if (!FormatTypes[_format]) { + logger.throwArgumentError("invalid format type", "format", _format); + } + + if (_format === FormatTypes.json) { + var _result = { + type: this.baseType === "tuple" ? "tuple" : this.type, + name: this.name || undefined + }; + + if (typeof this.indexed === "boolean") { + _result.indexed = this.indexed; + } + + if (this.components) { + _result.components = this.components.map(function (comp) { + return JSON.parse(comp.format(_format)); + }); + } + + return JSON.stringify(_result); + } + + var result = ""; // Array + + if (this.baseType === "array") { + result += this.arrayChildren.format(_format); + result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]"; + } else { + if (this.baseType === "tuple") { + if (_format !== FormatTypes.sighash) { + result += this.type; + } + + result += "(" + this.components.map(function (comp) { + return comp.format(_format); + }).join(_format === FormatTypes.full ? ", " : ",") + ")"; + } else { + result += this.type; + } + } + + if (_format !== FormatTypes.sighash) { + if (this.indexed === true) { + result += " indexed"; + } + + if (_format === FormatTypes.full && this.name) { + result += " " + this.name; + } + } + + return result; + } + }], [{ + key: "from", + value: function from(value, allowIndexed) { + if (typeof value === "string") { + return ParamType.fromString(value, allowIndexed); + } + + return ParamType.fromObject(value); + } + }, { + key: "fromObject", + value: function fromObject(value) { + if (ParamType.isParamType(value)) { + return value; + } + + return new ParamType(_constructorGuard, { + name: value.name || null, + type: verifyType(value.type), + indexed: value.indexed == null ? null : !!value.indexed, + components: value.components ? value.components.map(ParamType.fromObject) : null + }); + } + }, { + key: "fromString", + value: function fromString(value, allowIndexed) { + function ParamTypify(node) { + return ParamType.fromObject({ + name: node.name, + type: node.type, + indexed: node.indexed, + components: node.components + }); + } + + return ParamTypify(parseParamType(value, !!allowIndexed)); + } + }, { + key: "isParamType", + value: function isParamType(value) { + return !!(value != null && value._isParamType); + } + }]); + + return ParamType; +}(); +; + +function parseParams(value, allowIndex) { + return splitNesting(value).map(function (param) { + return ParamType.fromString(param, allowIndex); + }); +} + +var Fragment = /*#__PURE__*/function () { + function Fragment(constructorGuard, params) { + _classCallCheck(this, Fragment); + + if (constructorGuard !== _constructorGuard) { + logger.throwError("use a static from method", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "new Fragment()" + }); + } + + populate(this, params); + this._isFragment = true; + Object.freeze(this); + } + + _createClass(Fragment, null, [{ + key: "from", + value: function from(value) { + if (Fragment.isFragment(value)) { + return value; + } + + if (typeof value === "string") { + return Fragment.fromString(value); + } + + return Fragment.fromObject(value); + } + }, { + key: "fromObject", + value: function fromObject(value) { + if (Fragment.isFragment(value)) { + return value; + } + + switch (value.type) { + case "function": + return FunctionFragment.fromObject(value); + + case "event": + return EventFragment.fromObject(value); + + case "constructor": + return ConstructorFragment.fromObject(value); + + case "error": + return ErrorFragment.fromObject(value); + + case "fallback": + case "receive": + // @TODO: Something? Maybe return a FunctionFragment? A custom DefaultFunctionFragment? + return null; + } + + return logger.throwArgumentError("invalid fragment object", "value", value); + } + }, { + key: "fromString", + value: function fromString(value) { + // Make sure the "returns" is surrounded by a space and all whitespace is exactly one space + value = value.replace(/\s/g, " "); + value = value.replace(/\(/g, " (").replace(/\)/g, ") ").replace(/\s+/g, " "); + value = value.trim(); + + if (value.split(" ")[0] === "event") { + return EventFragment.fromString(value.substring(5).trim()); + } else if (value.split(" ")[0] === "function") { + return FunctionFragment.fromString(value.substring(8).trim()); + } else if (value.split("(")[0].trim() === "constructor") { + return ConstructorFragment.fromString(value.trim()); + } else if (value.split(" ")[0] === "error") { + return ErrorFragment.fromString(value.substring(5).trim()); + } + + return logger.throwArgumentError("unsupported fragment", "value", value); + } + }, { + key: "isFragment", + value: function isFragment(value) { + return !!(value && value._isFragment); + } + }]); + + return Fragment; +}(); +var EventFragment = /*#__PURE__*/function (_Fragment) { + _inherits(EventFragment, _Fragment); + + var _super = _createSuper(EventFragment); + + function EventFragment() { + _classCallCheck(this, EventFragment); + + return _super.apply(this, arguments); + } + + _createClass(EventFragment, [{ + key: "format", + value: function format(_format2) { + if (!_format2) { + _format2 = FormatTypes.sighash; + } + + if (!FormatTypes[_format2]) { + logger.throwArgumentError("invalid format type", "format", _format2); + } + + if (_format2 === FormatTypes.json) { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map(function (input) { + return JSON.parse(input.format(_format2)); + }) + }); + } + + var result = ""; + + if (_format2 !== FormatTypes.sighash) { + result += "event "; + } + + result += this.name + "(" + this.inputs.map(function (input) { + return input.format(_format2); + }).join(_format2 === FormatTypes.full ? ", " : ",") + ") "; + + if (_format2 !== FormatTypes.sighash) { + if (this.anonymous) { + result += "anonymous "; + } + } + + return result.trim(); + } + }], [{ + key: "from", + value: function from(value) { + if (typeof value === "string") { + return EventFragment.fromString(value); + } + + return EventFragment.fromObject(value); + } + }, { + key: "fromObject", + value: function fromObject(value) { + if (EventFragment.isEventFragment(value)) { + return value; + } + + if (value.type !== "event") { + logger.throwArgumentError("invalid event object", "value", value); + } + + var params = { + name: verifyIdentifier(value.name), + anonymous: value.anonymous, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + type: "event" + }; + return new EventFragment(_constructorGuard, params); + } + }, { + key: "fromString", + value: function fromString(value) { + var match = value.match(regexParen); + + if (!match) { + logger.throwArgumentError("invalid event string", "value", value); + } + + var anonymous = false; + match[3].split(" ").forEach(function (modifier) { + switch (modifier.trim()) { + case "anonymous": + anonymous = true; + break; + + case "": + break; + + default: + logger.warn("unknown modifier: " + modifier); + } + }); + return EventFragment.fromObject({ + name: match[1].trim(), + anonymous: anonymous, + inputs: parseParams(match[2], true), + type: "event" + }); + } + }, { + key: "isEventFragment", + value: function isEventFragment(value) { + return value && value._isFragment && value.type === "event"; + } + }]); + + return EventFragment; +}(Fragment); + +function parseGas(value, params) { + params.gas = null; + var comps = value.split("@"); + + if (comps.length !== 1) { + if (comps.length > 2) { + logger.throwArgumentError("invalid human-readable ABI signature", "value", value); + } + + if (!comps[1].match(/^[0-9]+$/)) { + logger.throwArgumentError("invalid human-readable ABI signature gas", "value", value); + } + + params.gas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(comps[1]); + return comps[0]; + } + + return value; +} + +function parseModifiers(value, params) { + params.constant = false; + params.payable = false; + params.stateMutability = "nonpayable"; + value.split(" ").forEach(function (modifier) { + switch (modifier.trim()) { + case "constant": + params.constant = true; + break; + + case "payable": + params.payable = true; + params.stateMutability = "payable"; + break; + + case "nonpayable": + params.payable = false; + params.stateMutability = "nonpayable"; + break; + + case "pure": + params.constant = true; + params.stateMutability = "pure"; + break; + + case "view": + params.constant = true; + params.stateMutability = "view"; + break; + + case "external": + case "public": + case "": + break; + + default: + console.log("unknown modifier: " + modifier); + } + }); +} + +function verifyState(value) { + var result = { + constant: false, + payable: true, + stateMutability: "payable" + }; + + if (value.stateMutability != null) { + result.stateMutability = value.stateMutability; // Set (and check things are consistent) the constant property + + result.constant = result.stateMutability === "view" || result.stateMutability === "pure"; + + if (value.constant != null) { + if (!!value.constant !== result.constant) { + logger.throwArgumentError("cannot have constant function with mutability " + result.stateMutability, "value", value); + } + } // Set (and check things are consistent) the payable property + + + result.payable = result.stateMutability === "payable"; + + if (value.payable != null) { + if (!!value.payable !== result.payable) { + logger.throwArgumentError("cannot have payable function with mutability " + result.stateMutability, "value", value); + } + } + } else if (value.payable != null) { + result.payable = !!value.payable; // If payable we can assume non-constant; otherwise we can't assume + + if (value.constant == null && !result.payable && value.type !== "constructor") { + logger.throwArgumentError("unable to determine stateMutability", "value", value); + } + + result.constant = !!value.constant; + + if (result.constant) { + result.stateMutability = "view"; + } else { + result.stateMutability = result.payable ? "payable" : "nonpayable"; + } + + if (result.payable && result.constant) { + logger.throwArgumentError("cannot have constant payable function", "value", value); + } + } else if (value.constant != null) { + result.constant = !!value.constant; + result.payable = !result.constant; + result.stateMutability = result.constant ? "view" : "payable"; + } else if (value.type !== "constructor") { + logger.throwArgumentError("unable to determine stateMutability", "value", value); + } + + return result; +} + +var ConstructorFragment = /*#__PURE__*/function (_Fragment2) { + _inherits(ConstructorFragment, _Fragment2); + + var _super2 = _createSuper(ConstructorFragment); + + function ConstructorFragment() { + _classCallCheck(this, ConstructorFragment); + + return _super2.apply(this, arguments); + } + + _createClass(ConstructorFragment, [{ + key: "format", + value: function format(_format3) { + if (!_format3) { + _format3 = FormatTypes.sighash; + } + + if (!FormatTypes[_format3]) { + logger.throwArgumentError("invalid format type", "format", _format3); + } + + if (_format3 === FormatTypes.json) { + return JSON.stringify({ + type: "constructor", + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : undefined, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : undefined, + inputs: this.inputs.map(function (input) { + return JSON.parse(input.format(_format3)); + }) + }); + } + + if (_format3 === FormatTypes.sighash) { + logger.throwError("cannot format a constructor for sighash", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "format(sighash)" + }); + } + + var result = "constructor(" + this.inputs.map(function (input) { + return input.format(_format3); + }).join(_format3 === FormatTypes.full ? ", " : ",") + ") "; + + if (this.stateMutability && this.stateMutability !== "nonpayable") { + result += this.stateMutability + " "; + } + + return result.trim(); + } + }], [{ + key: "from", + value: function from(value) { + if (typeof value === "string") { + return ConstructorFragment.fromString(value); + } + + return ConstructorFragment.fromObject(value); + } + }, { + key: "fromObject", + value: function fromObject(value) { + if (ConstructorFragment.isConstructorFragment(value)) { + return value; + } + + if (value.type !== "constructor") { + logger.throwArgumentError("invalid constructor object", "value", value); + } + + var state = verifyState(value); + + if (state.constant) { + logger.throwArgumentError("constructor cannot be constant", "value", value); + } + + var params = { + name: null, + type: value.type, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + payable: state.payable, + stateMutability: state.stateMutability, + gas: value.gas ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(value.gas) : null + }; + return new ConstructorFragment(_constructorGuard, params); + } + }, { + key: "fromString", + value: function fromString(value) { + var params = { + type: "constructor" + }; + value = parseGas(value, params); + var parens = value.match(regexParen); + + if (!parens || parens[1].trim() !== "constructor") { + logger.throwArgumentError("invalid constructor string", "value", value); + } + + params.inputs = parseParams(parens[2].trim(), false); + parseModifiers(parens[3].trim(), params); + return ConstructorFragment.fromObject(params); + } + }, { + key: "isConstructorFragment", + value: function isConstructorFragment(value) { + return value && value._isFragment && value.type === "constructor"; + } + }]); + + return ConstructorFragment; +}(Fragment); +var FunctionFragment = /*#__PURE__*/function (_ConstructorFragment) { + _inherits(FunctionFragment, _ConstructorFragment); + + var _super3 = _createSuper(FunctionFragment); + + function FunctionFragment() { + _classCallCheck(this, FunctionFragment); + + return _super3.apply(this, arguments); + } + + _createClass(FunctionFragment, [{ + key: "format", + value: function format(_format4) { + if (!_format4) { + _format4 = FormatTypes.sighash; + } + + if (!FormatTypes[_format4]) { + logger.throwArgumentError("invalid format type", "format", _format4); + } + + if (_format4 === FormatTypes.json) { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : undefined, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : undefined, + inputs: this.inputs.map(function (input) { + return JSON.parse(input.format(_format4)); + }), + outputs: this.outputs.map(function (output) { + return JSON.parse(output.format(_format4)); + }) + }); + } + + var result = ""; + + if (_format4 !== FormatTypes.sighash) { + result += "function "; + } + + result += this.name + "(" + this.inputs.map(function (input) { + return input.format(_format4); + }).join(_format4 === FormatTypes.full ? ", " : ",") + ") "; + + if (_format4 !== FormatTypes.sighash) { + if (this.stateMutability) { + if (this.stateMutability !== "nonpayable") { + result += this.stateMutability + " "; + } + } else if (this.constant) { + result += "view "; + } + + if (this.outputs && this.outputs.length) { + result += "returns (" + this.outputs.map(function (output) { + return output.format(_format4); + }).join(", ") + ") "; + } + + if (this.gas != null) { + result += "@" + this.gas.toString() + " "; + } + } + + return result.trim(); + } + }], [{ + key: "from", + value: function from(value) { + if (typeof value === "string") { + return FunctionFragment.fromString(value); + } + + return FunctionFragment.fromObject(value); + } + }, { + key: "fromObject", + value: function fromObject(value) { + if (FunctionFragment.isFunctionFragment(value)) { + return value; + } + + if (value.type !== "function") { + logger.throwArgumentError("invalid function object", "value", value); + } + + var state = verifyState(value); + var params = { + type: value.type, + name: verifyIdentifier(value.name), + constant: state.constant, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + outputs: value.outputs ? value.outputs.map(ParamType.fromObject) : [], + payable: state.payable, + stateMutability: state.stateMutability, + gas: value.gas ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(value.gas) : null + }; + return new FunctionFragment(_constructorGuard, params); + } + }, { + key: "fromString", + value: function fromString(value) { + var params = { + type: "function" + }; + value = parseGas(value, params); + var comps = value.split(" returns "); + + if (comps.length > 2) { + logger.throwArgumentError("invalid function string", "value", value); + } + + var parens = comps[0].match(regexParen); + + if (!parens) { + logger.throwArgumentError("invalid function signature", "value", value); + } + + params.name = parens[1].trim(); + + if (params.name) { + verifyIdentifier(params.name); + } + + params.inputs = parseParams(parens[2], false); + parseModifiers(parens[3].trim(), params); // We have outputs + + if (comps.length > 1) { + var returns = comps[1].match(regexParen); + + if (returns[1].trim() != "" || returns[3].trim() != "") { + logger.throwArgumentError("unexpected tokens", "value", value); + } + + params.outputs = parseParams(returns[2], false); + } else { + params.outputs = []; + } + + return FunctionFragment.fromObject(params); + } + }, { + key: "isFunctionFragment", + value: function isFunctionFragment(value) { + return value && value._isFragment && value.type === "function"; + } + }]); + + return FunctionFragment; +}(ConstructorFragment); //export class StructFragment extends Fragment { +//} + +function checkForbidden(fragment) { + var sig = fragment.format(); + + if (sig === "Error(string)" || sig === "Panic(uint256)") { + logger.throwArgumentError("cannot specify user defined ".concat(sig, " error"), "fragment", fragment); + } + + return fragment; +} + +var ErrorFragment = /*#__PURE__*/function (_Fragment3) { + _inherits(ErrorFragment, _Fragment3); + + var _super4 = _createSuper(ErrorFragment); + + function ErrorFragment() { + _classCallCheck(this, ErrorFragment); + + return _super4.apply(this, arguments); + } + + _createClass(ErrorFragment, [{ + key: "format", + value: function format(_format5) { + if (!_format5) { + _format5 = FormatTypes.sighash; + } + + if (!FormatTypes[_format5]) { + logger.throwArgumentError("invalid format type", "format", _format5); + } + + if (_format5 === FormatTypes.json) { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map(function (input) { + return JSON.parse(input.format(_format5)); + }) + }); + } + + var result = ""; + + if (_format5 !== FormatTypes.sighash) { + result += "error "; + } + + result += this.name + "(" + this.inputs.map(function (input) { + return input.format(_format5); + }).join(_format5 === FormatTypes.full ? ", " : ",") + ") "; + return result.trim(); + } + }], [{ + key: "from", + value: function from(value) { + if (typeof value === "string") { + return ErrorFragment.fromString(value); + } + + return ErrorFragment.fromObject(value); + } + }, { + key: "fromObject", + value: function fromObject(value) { + if (ErrorFragment.isErrorFragment(value)) { + return value; + } + + if (value.type !== "error") { + logger.throwArgumentError("invalid error object", "value", value); + } + + var params = { + type: value.type, + name: verifyIdentifier(value.name), + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [] + }; + return checkForbidden(new ErrorFragment(_constructorGuard, params)); + } + }, { + key: "fromString", + value: function fromString(value) { + var params = { + type: "error" + }; + var parens = value.match(regexParen); + + if (!parens) { + logger.throwArgumentError("invalid error signature", "value", value); + } + + params.name = parens[1].trim(); + + if (params.name) { + verifyIdentifier(params.name); + } + + params.inputs = parseParams(parens[2], false); + return checkForbidden(ErrorFragment.fromObject(params)); + } + }, { + key: "isErrorFragment", + value: function isErrorFragment(value) { + return value && value._isFragment && value.type === "error"; + } + }]); + + return ErrorFragment; +}(Fragment); + +function verifyType(type) { + // These need to be transformed to their full description + if (type.match(/^uint($|[^1-9])/)) { + type = "uint256" + type.substring(4); + } else if (type.match(/^int($|[^1-9])/)) { + type = "int256" + type.substring(3); + } // @TODO: more verification + + + return type; +} // See: https://github.com/ethereum/solidity/blob/1f8f1a3db93a548d0555e3e14cfc55a10e25b60e/docs/grammar/SolidityLexer.g4#L234 + + +var regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); + +function verifyIdentifier(value) { + if (!value || !value.match(regexIdentifier)) { + logger.throwArgumentError("invalid identifier \"".concat(value, "\""), "value", value); + } + + return value; +} + +var regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"); + +function splitNesting(value) { + value = value.trim(); + var result = []; + var accum = ""; + var depth = 0; + + for (var offset = 0; offset < value.length; offset++) { + var c = value[offset]; + + if (c === "," && depth === 0) { + result.push(accum); + accum = ""; + } else { + accum += c; + + if (c === "(") { + depth++; + } else if (c === ")") { + depth--; + + if (depth === -1) { + logger.throwArgumentError("unbalanced parenthesis", "value", value); + } + } + } + } + + if (accum) { + result.push(accum); + } + + return result; +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/index.js ***! + \**********************************************************/ +/*! exports provided: ConstructorFragment, ErrorFragment, EventFragment, Fragment, FunctionFragment, ParamType, FormatTypes, AbiCoder, defaultAbiCoder, Interface, Indexed, checkResultErrors, LogDescription, TransactionDescription */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _fragments__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fragments */ "./node_modules/@ethersproject/abi/lib.esm/fragments.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConstructorFragment", function() { return _fragments__WEBPACK_IMPORTED_MODULE_0__["ConstructorFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ErrorFragment", function() { return _fragments__WEBPACK_IMPORTED_MODULE_0__["ErrorFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EventFragment", function() { return _fragments__WEBPACK_IMPORTED_MODULE_0__["EventFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return _fragments__WEBPACK_IMPORTED_MODULE_0__["Fragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionFragment", function() { return _fragments__WEBPACK_IMPORTED_MODULE_0__["FunctionFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ParamType", function() { return _fragments__WEBPACK_IMPORTED_MODULE_0__["ParamType"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormatTypes", function() { return _fragments__WEBPACK_IMPORTED_MODULE_0__["FormatTypes"]; }); + +/* harmony import */ var _abi_coder__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./abi-coder */ "./node_modules/@ethersproject/abi/lib.esm/abi-coder.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbiCoder", function() { return _abi_coder__WEBPACK_IMPORTED_MODULE_1__["AbiCoder"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultAbiCoder", function() { return _abi_coder__WEBPACK_IMPORTED_MODULE_1__["defaultAbiCoder"]; }); + +/* harmony import */ var _interface__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./interface */ "./node_modules/@ethersproject/abi/lib.esm/interface.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Interface", function() { return _interface__WEBPACK_IMPORTED_MODULE_2__["Interface"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Indexed", function() { return _interface__WEBPACK_IMPORTED_MODULE_2__["Indexed"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "checkResultErrors", function() { return _interface__WEBPACK_IMPORTED_MODULE_2__["checkResultErrors"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LogDescription", function() { return _interface__WEBPACK_IMPORTED_MODULE_2__["LogDescription"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TransactionDescription", function() { return _interface__WEBPACK_IMPORTED_MODULE_2__["TransactionDescription"]; }); + + + + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/abi/lib.esm/interface.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/abi/lib.esm/interface.js ***! + \**************************************************************/ +/*! exports provided: checkResultErrors, LogDescription, TransactionDescription, ErrorDescription, Indexed, Interface */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogDescription", function() { return LogDescription; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransactionDescription", function() { return TransactionDescription; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorDescription", function() { return ErrorDescription; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Indexed", function() { return Indexed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Interface", function() { return Interface; }); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/hash */ "./node_modules/@ethersproject/hash/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _abi_coder__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./abi-coder */ "./node_modules/@ethersproject/abi/lib.esm/abi-coder.js"); +/* harmony import */ var _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./coders/abstract-coder */ "./node_modules/@ethersproject/abi/lib.esm/coders/abstract-coder.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "checkResultErrors", function() { return _coders_abstract_coder__WEBPACK_IMPORTED_MODULE_7__["checkResultErrors"]; }); + +/* harmony import */ var _fragments__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fragments */ "./node_modules/@ethersproject/abi/lib.esm/fragments.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/abi/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_9__["Logger"](_version__WEBPACK_IMPORTED_MODULE_10__["version"]); + +var LogDescription = /*#__PURE__*/function (_Description) { + _inherits(LogDescription, _Description); + + var _super = _createSuper(LogDescription); + + function LogDescription() { + _classCallCheck(this, LogDescription); + + return _super.apply(this, arguments); + } + + return _createClass(LogDescription); +}(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["Description"]); +var TransactionDescription = /*#__PURE__*/function (_Description2) { + _inherits(TransactionDescription, _Description2); + + var _super2 = _createSuper(TransactionDescription); + + function TransactionDescription() { + _classCallCheck(this, TransactionDescription); + + return _super2.apply(this, arguments); + } + + return _createClass(TransactionDescription); +}(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["Description"]); +var ErrorDescription = /*#__PURE__*/function (_Description3) { + _inherits(ErrorDescription, _Description3); + + var _super3 = _createSuper(ErrorDescription); + + function ErrorDescription() { + _classCallCheck(this, ErrorDescription); + + return _super3.apply(this, arguments); + } + + return _createClass(ErrorDescription); +}(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["Description"]); +var Indexed = /*#__PURE__*/function (_Description4) { + _inherits(Indexed, _Description4); + + var _super4 = _createSuper(Indexed); + + function Indexed() { + _classCallCheck(this, Indexed); + + return _super4.apply(this, arguments); + } + + _createClass(Indexed, null, [{ + key: "isIndexed", + value: function isIndexed(value) { + return !!(value && value._isIndexed); + } + }]); + + return Indexed; +}(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["Description"]); +var BuiltinErrors = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: true + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"] + } +}; + +function wrapAccessError(property, error) { + var wrap = new Error("deferred error during ABI decoding triggered accessing ".concat(property)); + wrap.error = error; + return wrap; +} +/* +function checkNames(fragment: Fragment, type: "input" | "output", params: Array): void { + params.reduce((accum, param) => { + if (param.name) { + if (accum[param.name]) { + logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format("full") }`, "fragment", fragment); + } + accum[param.name] = true; + } + return accum; + }, <{ [ name: string ]: boolean }>{ }); +} +*/ + + +var Interface = /*#__PURE__*/function () { + function Interface(fragments) { + var _this = this; + + _classCallCheck(this, Interface); + + logger.checkNew(this instanceof Interface ? this.constructor : void 0, Interface); + var abi = []; + + if (typeof fragments === "string") { + abi = JSON.parse(fragments); + } else { + abi = fragments; + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "fragments", abi.map(function (fragment) { + return _fragments__WEBPACK_IMPORTED_MODULE_8__["Fragment"].from(fragment); + }).filter(function (fragment) { + return fragment != null; + })); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "_abiCoder", Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["getStatic"])(this instanceof Interface ? this.constructor : void 0, "getAbiCoder")()); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "functions", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "errors", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "events", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "structs", {}); // Add all fragments by their signature + + this.fragments.forEach(function (fragment) { + var bucket = null; + + switch (fragment.type) { + case "constructor": + if (_this.deploy) { + logger.warn("duplicate definition - constructor"); + return; + } //checkNames(fragment, "input", fragment.inputs); + + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(_this, "deploy", fragment); + return; + + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = _this.functions; + break; + + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = _this.events; + break; + + case "error": + bucket = _this.errors; + break; + + default: + return; + } + + var signature = fragment.format(); + + if (bucket[signature]) { + logger.warn("duplicate definition - " + signature); + return; + } + + bucket[signature] = fragment; + }); // If we do not have a constructor add a default + + if (!this.deploy) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "deploy", _fragments__WEBPACK_IMPORTED_MODULE_8__["ConstructorFragment"].from({ + payable: false, + type: "constructor" + })); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "_isInterface", true); + } + + _createClass(Interface, [{ + key: "format", + value: function format(_format) { + if (!_format) { + _format = _fragments__WEBPACK_IMPORTED_MODULE_8__["FormatTypes"].full; + } + + if (_format === _fragments__WEBPACK_IMPORTED_MODULE_8__["FormatTypes"].sighash) { + logger.throwArgumentError("interface does not support formatting sighash", "format", _format); + } + + var abi = this.fragments.map(function (fragment) { + return fragment.format(_format); + }); // We need to re-bundle the JSON fragments a bit + + if (_format === _fragments__WEBPACK_IMPORTED_MODULE_8__["FormatTypes"].json) { + return JSON.stringify(abi.map(function (j) { + return JSON.parse(j); + })); + } + + return abi; + } // Sub-classes can override these to handle other blockchains + + }, { + key: "getFunction", + value: // Find a function definition by any means necessary (unless it is ambiguous) + function getFunction(nameOrSignatureOrSighash) { + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(nameOrSignatureOrSighash)) { + for (var name in this.functions) { + if (nameOrSignatureOrSighash === this.getSighash(name)) { + return this.functions[name]; + } + } + + logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + } // It is a bare name, look up the function (will return null if ambiguous) + + + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var _name = nameOrSignatureOrSighash.trim(); + + var matching = Object.keys(this.functions).filter(function (f) { + return f.split("(" + /* fix:) */ + )[0] === _name; + }); + + if (matching.length === 0) { + logger.throwArgumentError("no matching function", "name", _name); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching functions", "name", _name); + } + + return this.functions[matching[0]]; + } // Normalize the signature and lookup the function + + + var result = this.functions[_fragments__WEBPACK_IMPORTED_MODULE_8__["FunctionFragment"].fromString(nameOrSignatureOrSighash).format()]; + + if (!result) { + logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + } + + return result; + } // Find an event definition by any means necessary (unless it is ambiguous) + + }, { + key: "getEvent", + value: function getEvent(nameOrSignatureOrTopic) { + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(nameOrSignatureOrTopic)) { + var topichash = nameOrSignatureOrTopic.toLowerCase(); + + for (var name in this.events) { + if (topichash === this.getEventTopic(name)) { + return this.events[name]; + } + } + + logger.throwArgumentError("no matching event", "topichash", topichash); + } // It is a bare name, look up the function (will return null if ambiguous) + + + if (nameOrSignatureOrTopic.indexOf("(") === -1) { + var _name2 = nameOrSignatureOrTopic.trim(); + + var matching = Object.keys(this.events).filter(function (f) { + return f.split("(" + /* fix:) */ + )[0] === _name2; + }); + + if (matching.length === 0) { + logger.throwArgumentError("no matching event", "name", _name2); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching events", "name", _name2); + } + + return this.events[matching[0]]; + } // Normalize the signature and lookup the function + + + var result = this.events[_fragments__WEBPACK_IMPORTED_MODULE_8__["EventFragment"].fromString(nameOrSignatureOrTopic).format()]; + + if (!result) { + logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + } + + return result; + } // Find a function definition by any means necessary (unless it is ambiguous) + + }, { + key: "getError", + value: function getError(nameOrSignatureOrSighash) { + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(nameOrSignatureOrSighash)) { + var getSighash = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["getStatic"])(this.constructor, "getSighash"); + + for (var name in this.errors) { + var error = this.errors[name]; + + if (nameOrSignatureOrSighash === getSighash(error)) { + return this.errors[name]; + } + } + + logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + } // It is a bare name, look up the function (will return null if ambiguous) + + + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var _name3 = nameOrSignatureOrSighash.trim(); + + var matching = Object.keys(this.errors).filter(function (f) { + return f.split("(" + /* fix:) */ + )[0] === _name3; + }); + + if (matching.length === 0) { + logger.throwArgumentError("no matching error", "name", _name3); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching errors", "name", _name3); + } + + return this.errors[matching[0]]; + } // Normalize the signature and lookup the function + + + var result = this.errors[_fragments__WEBPACK_IMPORTED_MODULE_8__["FunctionFragment"].fromString(nameOrSignatureOrSighash).format()]; + + if (!result) { + logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + } + + return result; + } // Get the sighash (the bytes4 selector) used by Solidity to identify a function + + }, { + key: "getSighash", + value: function getSighash(fragment) { + if (typeof fragment === "string") { + try { + fragment = this.getFunction(fragment); + } catch (error) { + try { + fragment = this.getError(fragment); + } catch (_) { + throw error; + } + } + } + + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["getStatic"])(this.constructor, "getSighash")(fragment); + } // Get the topic (the bytes32 hash) used by Solidity to identify an event + + }, { + key: "getEventTopic", + value: function getEventTopic(eventFragment) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["getStatic"])(this.constructor, "getEventTopic")(eventFragment); + } + }, { + key: "_decodeParams", + value: function _decodeParams(params, data) { + return this._abiCoder.decode(params, data); + } + }, { + key: "_encodeParams", + value: function _encodeParams(params, values) { + return this._abiCoder.encode(params, values); + } + }, { + key: "encodeDeploy", + value: function encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + }, { + key: "decodeErrorResult", + value: function decodeErrorResult(fragment, data) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(data); + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(bytes.slice(0, 4)) !== this.getSighash(fragment)) { + logger.throwArgumentError("data signature does not match error ".concat(fragment.name, "."), "data", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(bytes)); + } + + return this._decodeParams(fragment.inputs, bytes.slice(4)); + } + }, { + key: "encodeErrorResult", + value: function encodeErrorResult(fragment, values) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["concat"])([this.getSighash(fragment), this._encodeParams(fragment.inputs, values || [])])); + } // Decode the data for a function call (e.g. tx.data) + + }, { + key: "decodeFunctionData", + value: function decodeFunctionData(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(data); + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { + logger.throwArgumentError("data signature does not match function ".concat(functionFragment.name, "."), "data", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(bytes)); + } + + return this._decodeParams(functionFragment.inputs, bytes.slice(4)); + } // Encode the data for a function call (e.g. tx.data) + + }, { + key: "encodeFunctionData", + value: function encodeFunctionData(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["concat"])([this.getSighash(functionFragment), this._encodeParams(functionFragment.inputs, values || [])])); + } // Decode the result from a function call (e.g. from eth_call) + + }, { + key: "decodeFunctionResult", + value: function decodeFunctionResult(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(data); + var reason = null; + var errorArgs = null; + var errorName = null; + var errorSignature = null; + + switch (bytes.length % this._abiCoder._getWordSize()) { + case 0: + try { + return this._abiCoder.decode(functionFragment.outputs, bytes); + } catch (error) {} + + break; + + case 4: + { + var selector = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(bytes.slice(0, 4)); + var builtin = BuiltinErrors[selector]; + + if (builtin) { + errorArgs = this._abiCoder.decode(builtin.inputs, bytes.slice(4)); + errorName = builtin.name; + errorSignature = builtin.signature; + + if (builtin.reason) { + reason = errorArgs[0]; + } + } else { + try { + var error = this.getError(selector); + errorArgs = this._abiCoder.decode(error.inputs, bytes.slice(4)); + errorName = error.name; + errorSignature = error.format(); + } catch (error) { + console.log(error); + } + } + + break; + } + } + + return logger.throwError("call revert exception", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_9__["Logger"].errors.CALL_EXCEPTION, { + method: functionFragment.format(), + errorArgs: errorArgs, + errorName: errorName, + errorSignature: errorSignature, + reason: reason + }); + } // Encode the result for a function call (e.g. for eth_call) + + }, { + key: "encodeFunctionResult", + value: function encodeFunctionResult(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(this._abiCoder.encode(functionFragment.outputs, values || [])); + } // Create the filter for the event with search criteria (e.g. for eth_filterLog) + + }, { + key: "encodeFilterTopics", + value: function encodeFilterTopics(eventFragment, values) { + var _this2 = this; + + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + + if (values.length > eventFragment.inputs.length) { + logger.throwError("too many arguments for " + eventFragment.format(), _ethersproject_logger__WEBPACK_IMPORTED_MODULE_9__["Logger"].errors.UNEXPECTED_ARGUMENT, { + argument: "values", + value: values + }); + } + + var topics = []; + + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + + var encodeTopic = function encodeTopic(param, value) { + if (param.type === "string") { + return Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__["id"])(value); + } else if (param.type === "bytes") { + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(value)); + } // Check addresses are valid + + + if (param.type === "address") { + _this2._abiCoder.encode(["address"], [value]); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(value), 32); + }; + + values.forEach(function (value, index) { + var param = eventFragment.inputs[index]; + + if (!param.indexed) { + if (value != null) { + logger.throwArgumentError("cannot filter non-indexed parameters; must be null", "contract." + param.name, value); + } + + return; + } + + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", "contract." + param.name, value); + } else if (Array.isArray(value)) { + topics.push(value.map(function (value) { + return encodeTopic(param, value); + })); + } else { + topics.push(encodeTopic(param, value)); + } + }); // Trim off trailing nulls + + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + + return topics; + } + }, { + key: "encodeEventLog", + value: function encodeEventLog(eventFragment, values) { + var _this3 = this; + + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + + var topics = []; + var dataTypes = []; + var dataValues = []; + + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + + if (values.length !== eventFragment.inputs.length) { + logger.throwArgumentError("event arguments/values mismatch", "values", values); + } + + eventFragment.inputs.forEach(function (param, index) { + var value = values[index]; + + if (param.indexed) { + if (param.type === "string") { + topics.push(Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__["id"])(value)); + } else if (param.type === "bytes") { + topics.push(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(value)); + } else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } else { + topics.push(_this3._abiCoder.encode([param.type], [value])); + } + } else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this._abiCoder.encode(dataTypes, dataValues), + topics: topics + }; + } // Decode a filter for the event and the search criteria + + }, { + key: "decodeEventLog", + value: function decodeEventLog(eventFragment, data, topics) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + + if (topics != null && !eventFragment.anonymous) { + var topicHash = this.getEventTopic(eventFragment); + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { + logger.throwError("fragment/topic mismatch", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_9__["Logger"].errors.INVALID_ARGUMENT, { + argument: "topics[0]", + expected: topicHash, + value: topics[0] + }); + } + + topics = topics.slice(1); + } + + var indexed = []; + var nonIndexed = []; + var dynamic = []; + eventFragment.inputs.forEach(function (param, index) { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(_fragments__WEBPACK_IMPORTED_MODULE_8__["ParamType"].fromObject({ + type: "bytes32", + name: param.name + })); + dynamic.push(true); + } else { + indexed.push(param); + dynamic.push(false); + } + } else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + var resultIndexed = topics != null ? this._abiCoder.decode(indexed, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["concat"])(topics)) : null; + + var resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true); + + var result = []; + var nonIndexedIndex = 0, + indexedIndex = 0; + eventFragment.inputs.forEach(function (param, index) { + if (param.indexed) { + if (resultIndexed == null) { + result[index] = new Indexed({ + _isIndexed: true, + hash: null + }); + } else if (dynamic[index]) { + result[index] = new Indexed({ + _isIndexed: true, + hash: resultIndexed[indexedIndex++] + }); + } else { + try { + result[index] = resultIndexed[indexedIndex++]; + } catch (error) { + result[index] = error; + } + } + } else { + try { + result[index] = resultNonIndexed[nonIndexedIndex++]; + } catch (error) { + result[index] = error; + } + } // Add the keyword argument if named and safe + + + if (param.name && result[param.name] == null) { + var value = result[index]; // Make error named values throw on access + + if (value instanceof Error) { + Object.defineProperty(result, param.name, { + enumerable: true, + get: function get() { + throw wrapAccessError("property ".concat(JSON.stringify(param.name)), value); + } + }); + } else { + result[param.name] = value; + } + } + }); // Make all error indexed values throw on access + + var _loop = function _loop(i) { + var value = result[i]; + + if (value instanceof Error) { + Object.defineProperty(result, i, { + enumerable: true, + get: function get() { + throw wrapAccessError("index ".concat(i), value); + } + }); + } + }; + + for (var i = 0; i < result.length; i++) { + _loop(i); + } + + return Object.freeze(result); + } // Given a transaction, find the matching function fragment (if any) and + // determine all its properties and call parameters + + }, { + key: "parseTransaction", + value: function parseTransaction(tx) { + var fragment = this.getFunction(tx.data.substring(0, 10).toLowerCase()); + + if (!fragment) { + return null; + } + + return new TransactionDescription({ + args: this._abiCoder.decode(fragment.inputs, "0x" + tx.data.substring(10)), + functionFragment: fragment, + name: fragment.name, + signature: fragment.format(), + sighash: this.getSighash(fragment), + value: _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(tx.value || "0") + }); + } // @TODO + //parseCallResult(data: BytesLike): ?? + // Given an event log, find the matching event fragment (if any) and + // determine all its properties and values + + }, { + key: "parseLog", + value: function parseLog(log) { + var fragment = this.getEvent(log.topics[0]); + + if (!fragment || fragment.anonymous) { + return null; + } // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + + + return new LogDescription({ + eventFragment: fragment, + name: fragment.name, + signature: fragment.format(), + topic: this.getEventTopic(fragment), + args: this.decodeEventLog(fragment, log.data, log.topics) + }); + } + }, { + key: "parseError", + value: function parseError(data) { + var hexData = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(data); + var fragment = this.getError(hexData.substring(0, 10).toLowerCase()); + + if (!fragment) { + return null; + } + + return new ErrorDescription({ + args: this._abiCoder.decode(fragment.inputs, "0x" + hexData.substring(10)), + errorFragment: fragment, + name: fragment.name, + signature: fragment.format(), + sighash: this.getSighash(fragment) + }); + } + /* + static from(value: Array | string | Interface) { + if (Interface.isInterface(value)) { + return value; + } + if (typeof(value) === "string") { + return new Interface(JSON.parse(value)); + } + return new Interface(value); + } + */ + + }], [{ + key: "getAbiCoder", + value: function getAbiCoder() { + return _abi_coder__WEBPACK_IMPORTED_MODULE_6__["defaultAbiCoder"]; + } + }, { + key: "getAddress", + value: function getAddress(address) { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(address); + } + }, { + key: "getSighash", + value: function getSighash(fragment) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexDataSlice"])(Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__["id"])(fragment.format()), 0, 4); + } + }, { + key: "getEventTopic", + value: function getEventTopic(eventFragment) { + return Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__["id"])(eventFragment.format()); + } + }, { + key: "isInterface", + value: function isInterface(value) { + return !!(value && value._isInterface); + } + }]); + + return Interface; +}(); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abstract-provider/lib.esm/_version.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@ethersproject/abstract-provider/lib.esm/_version.js ***! + \***************************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "abstract-provider/5.5.1"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/abstract-provider/lib.esm/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/@ethersproject/abstract-provider/lib.esm/index.js ***! + \************************************************************************/ +/*! exports provided: ForkEvent, BlockForkEvent, TransactionForkEvent, TransactionOrderForkEvent, Provider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ForkEvent", function() { return ForkEvent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BlockForkEvent", function() { return BlockForkEvent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransactionForkEvent", function() { return TransactionForkEvent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransactionOrderForkEvent", function() { return TransactionOrderForkEvent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Provider", function() { return Provider; }); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/abstract-provider/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"](_version__WEBPACK_IMPORTED_MODULE_4__["version"]); +; +; //export type CallTransactionable = { +// call(transaction: TransactionRequest): Promise; +//}; + +var ForkEvent = /*#__PURE__*/function (_Description) { + _inherits(ForkEvent, _Description); + + var _super = _createSuper(ForkEvent); + + function ForkEvent() { + _classCallCheck(this, ForkEvent); + + return _super.apply(this, arguments); + } + + _createClass(ForkEvent, null, [{ + key: "isForkEvent", + value: function isForkEvent(value) { + return !!(value && value._isForkEvent); + } + }]); + + return ForkEvent; +}(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["Description"]); +var BlockForkEvent = /*#__PURE__*/function (_ForkEvent) { + _inherits(BlockForkEvent, _ForkEvent); + + var _super2 = _createSuper(BlockForkEvent); + + function BlockForkEvent(blockHash, expiry) { + _classCallCheck(this, BlockForkEvent); + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(blockHash, 32)) { + logger.throwArgumentError("invalid blockHash", "blockHash", blockHash); + } + + return _super2.call(this, { + _isForkEvent: true, + _isBlockForkEvent: true, + expiry: expiry || 0, + blockHash: blockHash + }); + } + + return _createClass(BlockForkEvent); +}(ForkEvent); +var TransactionForkEvent = /*#__PURE__*/function (_ForkEvent2) { + _inherits(TransactionForkEvent, _ForkEvent2); + + var _super3 = _createSuper(TransactionForkEvent); + + function TransactionForkEvent(hash, expiry) { + _classCallCheck(this, TransactionForkEvent); + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(hash, 32)) { + logger.throwArgumentError("invalid transaction hash", "hash", hash); + } + + return _super3.call(this, { + _isForkEvent: true, + _isTransactionForkEvent: true, + expiry: expiry || 0, + hash: hash + }); + } + + return _createClass(TransactionForkEvent); +}(ForkEvent); +var TransactionOrderForkEvent = /*#__PURE__*/function (_ForkEvent3) { + _inherits(TransactionOrderForkEvent, _ForkEvent3); + + var _super4 = _createSuper(TransactionOrderForkEvent); + + function TransactionOrderForkEvent(beforeHash, afterHash, expiry) { + _classCallCheck(this, TransactionOrderForkEvent); + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(beforeHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash); + } + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(afterHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash); + } + + return _super4.call(this, { + _isForkEvent: true, + _isTransactionOrderForkEvent: true, + expiry: expiry || 0, + beforeHash: beforeHash, + afterHash: afterHash + }); + } + + return _createClass(TransactionOrderForkEvent); +}(ForkEvent); /////////////////////////////// +// Exported Abstracts + +var Provider = /*#__PURE__*/function () { + function Provider() { + _classCallCheck(this, Provider); + + logger.checkAbstract(this instanceof Provider ? this.constructor : void 0, Provider); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "_isProvider", true); + } + + _createClass(Provider, [{ + key: "getFeeData", + value: function getFeeData() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var _yield$resolvePropert, block, gasPrice, maxFeePerGas, maxPriorityFeePerGas; + + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["resolveProperties"])({ + block: this.getBlock("latest"), + gasPrice: this.getGasPrice()["catch"](function (error) { + // @TODO: Why is this now failing on Calaveras? + //console.log(error); + return null; + }) + }); + + case 2: + _yield$resolvePropert = _context.sent; + block = _yield$resolvePropert.block; + gasPrice = _yield$resolvePropert.gasPrice; + maxFeePerGas = null, maxPriorityFeePerGas = null; + + if (block && block.baseFeePerGas) { + // We may want to compute this more accurately in the future, + // using the formula "check if the base fee is correct". + // See: https://eips.ethereum.org/EIPS/eip-1559 + maxPriorityFeePerGas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("2500000000"); + maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); + } + + return _context.abrupt("return", { + maxFeePerGas: maxFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + gasPrice: gasPrice + }); + + case 8: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + } // Alias for "on" + + }, { + key: "addListener", + value: function addListener(eventName, listener) { + return this.on(eventName, listener); + } // Alias for "off" + + }, { + key: "removeListener", + value: function removeListener(eventName, listener) { + return this.off(eventName, listener); + } + }], [{ + key: "isProvider", + value: function isProvider(value) { + return !!(value && value._isProvider); + } + }]); + + return Provider; +}(); + +/***/ }), + +/***/ "./node_modules/@ethersproject/abstract-signer/lib.esm/_version.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@ethersproject/abstract-signer/lib.esm/_version.js ***! + \*************************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "abstract-signer/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/abstract-signer/lib.esm/index.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@ethersproject/abstract-signer/lib.esm/index.js ***! + \**********************************************************************/ +/*! exports provided: Signer, VoidSigner */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Signer", function() { return Signer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VoidSigner", function() { return VoidSigner; }); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/abstract-signer/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); +var allowedTransactionKeys = ["accessList", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value"]; +var forwardErrors = [_ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.INSUFFICIENT_FUNDS, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.NONCE_EXPIRED, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.REPLACEMENT_UNDERPRICED]; +; +; +var Signer = /*#__PURE__*/function () { + /////////////////// + // Sub-classes MUST call super + function Signer() { + _classCallCheck(this, Signer); + + logger.checkAbstract(this instanceof Signer ? this.constructor : void 0, Signer); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(this, "_isSigner", true); + } /////////////////// + // Sub-classes MAY override these + + + _createClass(Signer, [{ + key: "getBalance", + value: function getBalance(blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + this._checkProvider("getBalance"); + + _context.next = 3; + return this.provider.getBalance(this.getAddress(), blockTag); + + case 3: + return _context.abrupt("return", _context.sent); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + } + }, { + key: "getTransactionCount", + value: function getTransactionCount(blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + this._checkProvider("getTransactionCount"); + + _context2.next = 3; + return this.provider.getTransactionCount(this.getAddress(), blockTag); + + case 3: + return _context2.abrupt("return", _context2.sent); + + case 4: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + } // Populates "from" if unspecified, and estimates the gas for the transaction + + }, { + key: "estimateGas", + value: function estimateGas(transaction) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + var tx; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + this._checkProvider("estimateGas"); + + _context3.next = 3; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["resolveProperties"])(this.checkTransaction(transaction)); + + case 3: + tx = _context3.sent; + _context3.next = 6; + return this.provider.estimateGas(tx); + + case 6: + return _context3.abrupt("return", _context3.sent); + + case 7: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + } // Populates "from" if unspecified, and calls with the transaction + + }, { + key: "call", + value: function call(transaction, blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + var tx; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + this._checkProvider("call"); + + _context4.next = 3; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["resolveProperties"])(this.checkTransaction(transaction)); + + case 3: + tx = _context4.sent; + _context4.next = 6; + return this.provider.call(tx, blockTag); + + case 6: + return _context4.abrupt("return", _context4.sent); + + case 7: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + } // Populates all fields in a transaction, signs it and sends it to the network + + }, { + key: "sendTransaction", + value: function sendTransaction(transaction) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { + var tx, signedTx; + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + this._checkProvider("sendTransaction"); + + _context5.next = 3; + return this.populateTransaction(transaction); + + case 3: + tx = _context5.sent; + _context5.next = 6; + return this.signTransaction(tx); + + case 6: + signedTx = _context5.sent; + _context5.next = 9; + return this.provider.sendTransaction(signedTx); + + case 9: + return _context5.abrupt("return", _context5.sent); + + case 10: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + } + }, { + key: "getChainId", + value: function getChainId() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { + var network; + return regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + this._checkProvider("getChainId"); + + _context6.next = 3; + return this.provider.getNetwork(); + + case 3: + network = _context6.sent; + return _context6.abrupt("return", network.chainId); + + case 5: + case "end": + return _context6.stop(); + } + } + }, _callee6, this); + })); + } + }, { + key: "getGasPrice", + value: function getGasPrice() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { + return regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + this._checkProvider("getGasPrice"); + + _context7.next = 3; + return this.provider.getGasPrice(); + + case 3: + return _context7.abrupt("return", _context7.sent); + + case 4: + case "end": + return _context7.stop(); + } + } + }, _callee7, this); + })); + } + }, { + key: "getFeeData", + value: function getFeeData() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee8() { + return regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + this._checkProvider("getFeeData"); + + _context8.next = 3; + return this.provider.getFeeData(); + + case 3: + return _context8.abrupt("return", _context8.sent); + + case 4: + case "end": + return _context8.stop(); + } + } + }, _callee8, this); + })); + } + }, { + key: "resolveName", + value: function resolveName(name) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee9() { + return regeneratorRuntime.wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + this._checkProvider("resolveName"); + + _context9.next = 3; + return this.provider.resolveName(name); + + case 3: + return _context9.abrupt("return", _context9.sent); + + case 4: + case "end": + return _context9.stop(); + } + } + }, _callee9, this); + })); + } // Checks a transaction does not contain invalid keys and if + // no "from" is provided, populates it. + // - does NOT require a provider + // - adds "from" is not present + // - returns a COPY (safe to mutate the result) + // By default called from: (overriding these prevents it) + // - call + // - estimateGas + // - populateTransaction (and therefor sendTransaction) + + }, { + key: "checkTransaction", + value: function checkTransaction(transaction) { + for (var key in transaction) { + if (allowedTransactionKeys.indexOf(key) === -1) { + logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); + } + } + + var tx = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["shallowCopy"])(transaction); + + if (tx.from == null) { + tx.from = this.getAddress(); + } else { + // Make sure any provided address matches this signer + tx.from = Promise.all([Promise.resolve(tx.from), this.getAddress()]).then(function (result) { + if (result[0].toLowerCase() !== result[1].toLowerCase()) { + logger.throwArgumentError("from address mismatch", "transaction", transaction); + } + + return result[0]; + }); + } + + return tx; + } // Populates ALL keys for a transaction and checks that "from" matches + // this Signer. Should be used by sendTransaction but NOT by signTransaction. + // By default called from: (overriding these prevents it) + // - sendTransaction + // + // Notes: + // - We allow gasPrice for EIP-1559 as long as it matches maxFeePerGas + + }, { + key: "populateTransaction", + value: function populateTransaction(transaction) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee11() { + var _this = this; + + var tx, hasEip1559, feeData, gasPrice; + return regeneratorRuntime.wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + _context11.next = 2; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["resolveProperties"])(this.checkTransaction(transaction)); + + case 2: + tx = _context11.sent; + + if (tx.to != null) { + tx.to = Promise.resolve(tx.to).then(function (to) { + return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee10() { + var address; + return regeneratorRuntime.wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + if (!(to == null)) { + _context10.next = 2; + break; + } + + return _context10.abrupt("return", null); + + case 2: + _context10.next = 4; + return this.resolveName(to); + + case 4: + address = _context10.sent; + + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + + return _context10.abrupt("return", address); + + case 7: + case "end": + return _context10.stop(); + } + } + }, _callee10, this); + })); + }); // Prevent this error from causing an UnhandledPromiseException + + tx.to["catch"](function (error) {}); + } // Do not allow mixing pre-eip-1559 and eip-1559 properties + + + hasEip1559 = tx.maxFeePerGas != null || tx.maxPriorityFeePerGas != null; + + if (tx.gasPrice != null && (tx.type === 2 || hasEip1559)) { + logger.throwArgumentError("eip-1559 transaction do not support gasPrice", "transaction", transaction); + } else if ((tx.type === 0 || tx.type === 1) && hasEip1559) { + logger.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "transaction", transaction); + } + + if (!((tx.type === 2 || tx.type == null) && tx.maxFeePerGas != null && tx.maxPriorityFeePerGas != null)) { + _context11.next = 10; + break; + } + + // Fully-formed EIP-1559 transaction (skip getFeeData) + tx.type = 2; + _context11.next = 18; + break; + + case 10: + if (!(tx.type === 0 || tx.type === 1)) { + _context11.next = 14; + break; + } + + // Explicit Legacy or EIP-2930 transaction + // Populate missing gasPrice + if (tx.gasPrice == null) { + tx.gasPrice = this.getGasPrice(); + } + + _context11.next = 18; + break; + + case 14: + _context11.next = 16; + return this.getFeeData(); + + case 16: + feeData = _context11.sent; + + if (tx.type == null) { + // We need to auto-detect the intended type of this transaction... + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + // Upgrade transaction from null to eip-1559 + tx.type = 2; + + if (tx.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + gasPrice = tx.gasPrice; + delete tx.gasPrice; + tx.maxFeePerGas = gasPrice; + tx.maxPriorityFeePerGas = gasPrice; + } else { + // Populate missing fee data + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + // ...but they are trying to use EIP-1559 properties + if (hasEip1559) { + logger.throwError("network does not support EIP-1559", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "populateTransaction" + }); + } // Populate missing fee data + + + if (tx.gasPrice == null) { + tx.gasPrice = feeData.gasPrice; + } // Explicitly set untyped transaction to legacy + + + tx.type = 0; + } else { + // getFeeData has failed us. + logger.throwError("failed to get consistent fee data", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "signer.getFeeData" + }); + } + } else if (tx.type === 2) { + // Explicitly using EIP-1559 + // Populate missing fee data + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + + case 18: + if (tx.nonce == null) { + tx.nonce = this.getTransactionCount("pending"); + } + + if (tx.gasLimit == null) { + tx.gasLimit = this.estimateGas(tx)["catch"](function (error) { + if (forwardErrors.indexOf(error.code) >= 0) { + throw error; + } + + return logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNPREDICTABLE_GAS_LIMIT, { + error: error, + tx: tx + }); + }); + } + + if (tx.chainId == null) { + tx.chainId = this.getChainId(); + } else { + tx.chainId = Promise.all([Promise.resolve(tx.chainId), this.getChainId()]).then(function (results) { + if (results[1] !== 0 && results[0] !== results[1]) { + logger.throwArgumentError("chainId address mismatch", "transaction", transaction); + } + + return results[0]; + }); + } + + _context11.next = 23; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["resolveProperties"])(tx); + + case 23: + return _context11.abrupt("return", _context11.sent); + + case 24: + case "end": + return _context11.stop(); + } + } + }, _callee11, this); + })); + } /////////////////// + // Sub-classes SHOULD leave these alone + + }, { + key: "_checkProvider", + value: function _checkProvider(operation) { + if (!this.provider) { + logger.throwError("missing provider", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: operation || "_checkProvider" + }); + } + } + }], [{ + key: "isSigner", + value: function isSigner(value) { + return !!(value && value._isSigner); + } + }]); + + return Signer; +}(); +var VoidSigner = /*#__PURE__*/function (_Signer) { + _inherits(VoidSigner, _Signer); + + var _super = _createSuper(VoidSigner); + + function VoidSigner(address, provider) { + var _this2; + + _classCallCheck(this, VoidSigner); + + logger.checkNew(this instanceof VoidSigner ? this.constructor : void 0, VoidSigner); + _this2 = _super.call(this); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this2), "address", address); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this2), "provider", provider || null); + return _this2; + } + + _createClass(VoidSigner, [{ + key: "getAddress", + value: function getAddress() { + return Promise.resolve(this.address); + } + }, { + key: "_fail", + value: function _fail(message, operation) { + return Promise.resolve().then(function () { + logger.throwError(message, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: operation + }); + }); + } + }, { + key: "signMessage", + value: function signMessage(message) { + return this._fail("VoidSigner cannot sign messages", "signMessage"); + } + }, { + key: "signTransaction", + value: function signTransaction(transaction) { + return this._fail("VoidSigner cannot sign transactions", "signTransaction"); + } + }, { + key: "_signTypedData", + value: function _signTypedData(domain, types, value) { + return this._fail("VoidSigner cannot sign typed data", "signTypedData"); + } + }, { + key: "connect", + value: function connect(provider) { + return new VoidSigner(this.address, provider); + } + }]); + + return VoidSigner; +}(Signer); + +/***/ }), + +/***/ "./node_modules/@ethersproject/address/lib.esm/_version.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@ethersproject/address/lib.esm/_version.js ***! + \*****************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "address/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/address/lib.esm/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/address/lib.esm/index.js ***! + \**************************************************************/ +/*! exports provided: getAddress, isAddress, getIcapAddress, getContractAddress, getCreate2Address */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAddress", function() { return getAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAddress", function() { return isAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getIcapAddress", function() { return getIcapAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getContractAddress", function() { return getContractAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCreate2Address", function() { return getCreate2Address; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/rlp */ "./node_modules/@ethersproject/rlp/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/address/lib.esm/_version.js"); + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"](_version__WEBPACK_IMPORTED_MODULE_5__["version"]); + +function getChecksumAddress(address) { + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["isHexString"])(address, 20)) { + logger.throwArgumentError("invalid address", "address", address); + } + + address = address.toLowerCase(); + var chars = address.substring(2).split(""); + var expanded = new Uint8Array(40); + + for (var i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + + var hashed = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__["keccak256"])(expanded)); + + for (var _i = 0; _i < 40; _i += 2) { + if (hashed[_i >> 1] >> 4 >= 8) { + chars[_i] = chars[_i].toUpperCase(); + } + + if ((hashed[_i >> 1] & 0x0f) >= 8) { + chars[_i + 1] = chars[_i + 1].toUpperCase(); + } + } + + return "0x" + chars.join(""); +} // Shims for environments that are missing some required constants and functions + + +var MAX_SAFE_INTEGER = 0x1fffffffffffff; + +function log10(x) { + if (Math.log10) { + return Math.log10(x); + } + + return Math.log(x) / Math.LN10; +} // See: https://en.wikipedia.org/wiki/International_Bank_Account_Number +// Create lookup table + + +var ibanLookup = {}; + +for (var i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); +} + +for (var _i2 = 0; _i2 < 26; _i2++) { + ibanLookup[String.fromCharCode(65 + _i2)] = String(10 + _i2); +} // How many decimal digits can we process? (for 64-bit float, this is 15) + + +var safeDigits = Math.floor(log10(MAX_SAFE_INTEGER)); + +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + var expanded = address.split("").map(function (c) { + return ibanLookup[c]; + }).join(""); // Javascript can handle integers safely up to 15 (decimal) digits + + while (expanded.length >= safeDigits) { + var block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + + var checksum = String(98 - parseInt(expanded, 10) % 97); + + while (checksum.length < 2) { + checksum = "0" + checksum; + } + + return checksum; +} + +; +function getAddress(address) { + var result = null; + + if (typeof address !== "string") { + logger.throwArgumentError("invalid address", "address", address); + } + + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (address.substring(0, 2) !== "0x") { + address = "0x" + address; + } + + result = getChecksumAddress(address); // It is a checksummed address with a bad checksum + + if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { + logger.throwArgumentError("bad address checksum", "address", address); + } // Maybe ICAP? (we only support direct mode) + + } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + if (address.substring(2, 4) !== ibanChecksum(address)) { + logger.throwArgumentError("bad icap checksum", "address", address); + } + + result = Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["_base36To16"])(address.substring(4)); + + while (result.length < 40) { + result = "0" + result; + } + + result = getChecksumAddress("0x" + result); + } else { + logger.throwArgumentError("invalid address", "address", address); + } + + return result; +} +function isAddress(address) { + try { + getAddress(address); + return true; + } catch (error) {} + + return false; +} +function getIcapAddress(address) { + var base36 = Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["_base16To36"])(getAddress(address).substring(2)).toUpperCase(); + + while (base36.length < 30) { + base36 = "0" + base36; + } + + return "XE" + ibanChecksum("XE00" + base36) + base36; +} // http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed + +function getContractAddress(transaction) { + var from = null; + + try { + from = getAddress(transaction.from); + } catch (error) { + logger.throwArgumentError("missing from address", "transaction", transaction); + } + + var nonce = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["stripZeros"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(transaction.nonce).toHexString())); + return getAddress(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexDataSlice"])(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__["keccak256"])(Object(_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_3__["encode"])([from, nonce])), 12)); +} +function getCreate2Address(from, salt, initCodeHash) { + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexDataLength"])(salt) !== 32) { + logger.throwArgumentError("salt must be 32 bytes", "salt", salt); + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexDataLength"])(initCodeHash) !== 32) { + logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); + } + + return getAddress(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexDataSlice"])(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["concat"])(["0xff", getAddress(from), salt, initCodeHash])), 12)); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/base64/lib.esm/base64.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/base64/lib.esm/base64.js ***! + \**************************************************************/ +/*! exports provided: decode, encode */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decode", function() { return decode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encode", function() { return encode; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); + + + +function decode(textData) { + textData = atob(textData); + var data = []; + + for (var i = 0; i < textData.length; i++) { + data.push(textData.charCodeAt(i)); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(data); +} +function encode(data) { + data = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(data); + var textData = ""; + + for (var i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + + return btoa(textData); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/base64/lib.esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/base64/lib.esm/index.js ***! + \*************************************************************/ +/*! exports provided: decode, encode */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base64 */ "./node_modules/@ethersproject/base64/lib.esm/base64.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "decode", function() { return _base64__WEBPACK_IMPORTED_MODULE_0__["decode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "encode", function() { return _base64__WEBPACK_IMPORTED_MODULE_0__["encode"]; }); + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/basex/lib.esm/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@ethersproject/basex/lib.esm/index.js ***! + \************************************************************/ +/*! exports provided: BaseX, Base32, Base58 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseX", function() { return BaseX; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Base32", function() { return Base32; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Base58", function() { return Base58; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +/** + * var basex = require("base-x"); + * + * This implementation is heavily based on base-x. The main reason to + * deviate was to prevent the dependency of Buffer. + * + * Contributors: + * + * base-x encoding + * Forked from https://github.com/cryptocoinjs/bs58 + * Originally written by Mike Hearn for BitcoinJ + * Copyright (c) 2011 Google Inc + * Ported to JavaScript by Stefan Thomas + * Merged Buffer refactorings from base58-native by Stephen Pair + * Copyright (c) 2013 BitPay Inc + * + * The MIT License (MIT) + * + * Copyright base-x contributors (c) 2016 + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + + +var BaseX = /*#__PURE__*/function () { + function BaseX(alphabet) { + _classCallCheck(this, BaseX); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(this, "alphabet", alphabet); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(this, "base", alphabet.length); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(this, "_alphabetMap", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(this, "_leader", alphabet.charAt(0)); // pre-compute lookup table + + for (var i = 0; i < alphabet.length; i++) { + this._alphabetMap[alphabet.charAt(i)] = i; + } + } + + _createClass(BaseX, [{ + key: "encode", + value: function encode(value) { + var source = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(value); + + if (source.length === 0) { + return ""; + } + + var digits = [0]; + + for (var i = 0; i < source.length; ++i) { + var carry = source[i]; + + for (var j = 0; j < digits.length; ++j) { + carry += digits[j] << 8; + digits[j] = carry % this.base; + carry = carry / this.base | 0; + } + + while (carry > 0) { + digits.push(carry % this.base); + carry = carry / this.base | 0; + } + } + + var string = ""; // deal with leading zeros + + for (var k = 0; source[k] === 0 && k < source.length - 1; ++k) { + string += this._leader; + } // convert digits to a string + + + for (var q = digits.length - 1; q >= 0; --q) { + string += this.alphabet[digits[q]]; + } + + return string; + } + }, { + key: "decode", + value: function decode(value) { + if (typeof value !== "string") { + throw new TypeError("Expected String"); + } + + var bytes = []; + + if (value.length === 0) { + return new Uint8Array(bytes); + } + + bytes.push(0); + + for (var i = 0; i < value.length; i++) { + var _byte = this._alphabetMap[value[i]]; + + if (_byte === undefined) { + throw new Error("Non-base" + this.base + " character"); + } + + var carry = _byte; + + for (var j = 0; j < bytes.length; ++j) { + carry += bytes[j] * this.base; + bytes[j] = carry & 0xff; + carry >>= 8; + } + + while (carry > 0) { + bytes.push(carry & 0xff); + carry >>= 8; + } + } // deal with leading zeros + + + for (var k = 0; value[k] === this._leader && k < value.length - 1; ++k) { + bytes.push(0); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(new Uint8Array(bytes.reverse())); + } + }]); + + return BaseX; +}(); +var Base32 = new BaseX("abcdefghijklmnopqrstuvwxyz234567"); +var Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); + //console.log(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj")) +//console.log(Base58.encode(Base58.decode("Qmd2V777o5XvJbYMeMb8k2nU5f8d3ciUQ5YpYuWhzv8iDj"))) + +/***/ }), + +/***/ "./node_modules/@ethersproject/bignumber/lib.esm/_version.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/bignumber/lib.esm/_version.js ***! + \*******************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "bignumber/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js": +/*!********************************************************************!*\ + !*** ./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js ***! + \********************************************************************/ +/*! exports provided: isBigNumberish, BigNumber, _base36To16, _base16To36 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBigNumberish", function() { return isBigNumberish; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BigNumber", function() { return BigNumber; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_base36To16", function() { return _base36To16; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_base16To36", function() { return _base16To36; }); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js"); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/bignumber/lib.esm/_version.js"); + +/** + * BigNumber + * + * A wrapper around the BN.js object. We use the BN.js library + * because it is used by elliptic, so it is required regardless. + * + */ + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + +var BN = bn_js__WEBPACK_IMPORTED_MODULE_0___default.a.BN; + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"](_version__WEBPACK_IMPORTED_MODULE_3__["version"]); +var _constructorGuard = {}; +var MAX_SAFE = 0x1fffffffffffff; +function isBigNumberish(value) { + return value != null && (BigNumber.isBigNumber(value) || typeof value === "number" && value % 1 === 0 || typeof value === "string" && !!value.match(/^-?[0-9]+$/) || Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(value) || typeof value === "bigint" || Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isBytes"])(value)); +} // Only warn about passing 10 into radix once + +var _warnedToStringRadix = false; +var BigNumber = /*#__PURE__*/function () { + function BigNumber(constructorGuard, hex) { + _classCallCheck(this, BigNumber); + + logger.checkNew(this instanceof BigNumber ? this.constructor : void 0, BigNumber); + + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot call constructor directly; use BigNumber.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "new (BigNumber)" + }); + } + + this._hex = hex; + this._isBigNumber = true; + Object.freeze(this); + } + + _createClass(BigNumber, [{ + key: "fromTwos", + value: function fromTwos(value) { + return toBigNumber(toBN(this).fromTwos(value)); + } + }, { + key: "toTwos", + value: function toTwos(value) { + return toBigNumber(toBN(this).toTwos(value)); + } + }, { + key: "abs", + value: function abs() { + if (this._hex[0] === "-") { + return BigNumber.from(this._hex.substring(1)); + } + + return this; + } + }, { + key: "add", + value: function add(other) { + return toBigNumber(toBN(this).add(toBN(other))); + } + }, { + key: "sub", + value: function sub(other) { + return toBigNumber(toBN(this).sub(toBN(other))); + } + }, { + key: "div", + value: function div(other) { + var o = BigNumber.from(other); + + if (o.isZero()) { + throwFault("division by zero", "div"); + } + + return toBigNumber(toBN(this).div(toBN(other))); + } + }, { + key: "mul", + value: function mul(other) { + return toBigNumber(toBN(this).mul(toBN(other))); + } + }, { + key: "mod", + value: function mod(other) { + var value = toBN(other); + + if (value.isNeg()) { + throwFault("cannot modulo negative values", "mod"); + } + + return toBigNumber(toBN(this).umod(value)); + } + }, { + key: "pow", + value: function pow(other) { + var value = toBN(other); + + if (value.isNeg()) { + throwFault("cannot raise to negative values", "pow"); + } + + return toBigNumber(toBN(this).pow(value)); + } + }, { + key: "and", + value: function and(other) { + var value = toBN(other); + + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'and' negative values", "and"); + } + + return toBigNumber(toBN(this).and(value)); + } + }, { + key: "or", + value: function or(other) { + var value = toBN(other); + + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'or' negative values", "or"); + } + + return toBigNumber(toBN(this).or(value)); + } + }, { + key: "xor", + value: function xor(other) { + var value = toBN(other); + + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'xor' negative values", "xor"); + } + + return toBigNumber(toBN(this).xor(value)); + } + }, { + key: "mask", + value: function mask(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot mask negative values", "mask"); + } + + return toBigNumber(toBN(this).maskn(value)); + } + }, { + key: "shl", + value: function shl(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shl"); + } + + return toBigNumber(toBN(this).shln(value)); + } + }, { + key: "shr", + value: function shr(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shr"); + } + + return toBigNumber(toBN(this).shrn(value)); + } + }, { + key: "eq", + value: function eq(other) { + return toBN(this).eq(toBN(other)); + } + }, { + key: "lt", + value: function lt(other) { + return toBN(this).lt(toBN(other)); + } + }, { + key: "lte", + value: function lte(other) { + return toBN(this).lte(toBN(other)); + } + }, { + key: "gt", + value: function gt(other) { + return toBN(this).gt(toBN(other)); + } + }, { + key: "gte", + value: function gte(other) { + return toBN(this).gte(toBN(other)); + } + }, { + key: "isNegative", + value: function isNegative() { + return this._hex[0] === "-"; + } + }, { + key: "isZero", + value: function isZero() { + return toBN(this).isZero(); + } + }, { + key: "toNumber", + value: function toNumber() { + try { + return toBN(this).toNumber(); + } catch (error) { + throwFault("overflow", "toNumber", this.toString()); + } + + return null; + } + }, { + key: "toBigInt", + value: function toBigInt() { + try { + return BigInt(this.toString()); + } catch (e) {} + + return logger.throwError("this platform does not support BigInt", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.UNSUPPORTED_OPERATION, { + value: this.toString() + }); + } + }, { + key: "toString", + value: function toString() { + // Lots of people expect this, which we do not support, so check (See: #889) + if (arguments.length > 0) { + if (arguments[0] === 10) { + if (!_warnedToStringRadix) { + _warnedToStringRadix = true; + logger.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); + } + } else if (arguments[0] === 16) { + logger.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.UNEXPECTED_ARGUMENT, {}); + } else { + logger.throwError("BigNumber.toString does not accept parameters", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.UNEXPECTED_ARGUMENT, {}); + } + } + + return toBN(this).toString(10); + } + }, { + key: "toHexString", + value: function toHexString() { + return this._hex; + } + }, { + key: "toJSON", + value: function toJSON(key) { + return { + type: "BigNumber", + hex: this.toHexString() + }; + } + }], [{ + key: "from", + value: function from(value) { + if (value instanceof BigNumber) { + return value; + } + + if (typeof value === "string") { + if (value.match(/^-?0x[0-9a-f]+$/i)) { + return new BigNumber(_constructorGuard, toHex(value)); + } + + if (value.match(/^-?[0-9]+$/)) { + return new BigNumber(_constructorGuard, toHex(new BN(value))); + } + + return logger.throwArgumentError("invalid BigNumber string", "value", value); + } + + if (typeof value === "number") { + if (value % 1) { + throwFault("underflow", "BigNumber.from", value); + } + + if (value >= MAX_SAFE || value <= -MAX_SAFE) { + throwFault("overflow", "BigNumber.from", value); + } + + return BigNumber.from(String(value)); + } + + var anyValue = value; + + if (typeof anyValue === "bigint") { + return BigNumber.from(anyValue.toString()); + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isBytes"])(anyValue)) { + return BigNumber.from(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(anyValue)); + } + + if (anyValue) { + // Hexable interface (takes priority) + if (anyValue.toHexString) { + var hex = anyValue.toHexString(); + + if (typeof hex === "string") { + return BigNumber.from(hex); + } + } else { + // For now, handle legacy JSON-ified values (goes away in v6) + var _hex = anyValue._hex; // New-form JSON + + if (_hex == null && anyValue.type === "BigNumber") { + _hex = anyValue.hex; + } + + if (typeof _hex === "string") { + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(_hex) || _hex[0] === "-" && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isHexString"])(_hex.substring(1))) { + return BigNumber.from(_hex); + } + } + } + } + + return logger.throwArgumentError("invalid BigNumber value", "value", value); + } + }, { + key: "isBigNumber", + value: function isBigNumber(value) { + return !!(value && value._isBigNumber); + } + }]); + + return BigNumber; +}(); // Normalize the hex string + +function toHex(value) { + // For BN, call on the hex string + if (typeof value !== "string") { + return toHex(value.toString(16)); + } // If negative, prepend the negative sign to the normalized positive value + + + if (value[0] === "-") { + // Strip off the negative sign + value = value.substring(1); // Cannot have multiple negative signs (e.g. "--0x04") + + if (value[0] === "-") { + logger.throwArgumentError("invalid hex", "value", value); + } // Call toHex on the positive component + + + value = toHex(value); // Do not allow "-0x00" + + if (value === "0x00") { + return value; + } // Negate the value + + + return "-" + value; + } // Add a "0x" prefix if missing + + + if (value.substring(0, 2) !== "0x") { + value = "0x" + value; + } // Normalize zero + + + if (value === "0x") { + return "0x00"; + } // Make the string even length + + + if (value.length % 2) { + value = "0x0" + value.substring(2); + } // Trim to smallest even-length string + + + while (value.length > 4 && value.substring(0, 4) === "0x00") { + value = "0x" + value.substring(4); + } + + return value; +} + +function toBigNumber(value) { + return BigNumber.from(toHex(value)); +} + +function toBN(value) { + var hex = BigNumber.from(value).toHexString(); + + if (hex[0] === "-") { + return new BN("-" + hex.substring(3), 16); + } + + return new BN(hex.substring(2), 16); +} + +function throwFault(fault, operation, value) { + var params = { + fault: fault, + operation: operation + }; + + if (value != null) { + params.value = value; + } + + return logger.throwError(fault, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"].errors.NUMERIC_FAULT, params); +} // value should have no prefix + + +function _base36To16(value) { + return new BN(value, 36).toString(16); +} // value should have no prefix + +function _base16To36(value) { + return new BN(value, 16).toString(36); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js ***! + \**********************************************************************/ +/*! exports provided: formatFixed, parseFixed, FixedFormat, FixedNumber */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatFixed", function() { return formatFixed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseFixed", function() { return parseFixed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FixedFormat", function() { return FixedFormat; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FixedNumber", function() { return FixedNumber; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/bignumber/lib.esm/_version.js"); +/* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); + +var _constructorGuard = {}; +var Zero = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(0); +var NegativeOne = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(-1); + +function throwFault(message, fault, operation, value) { + var params = { + fault: fault, + operation: operation + }; + + if (value !== undefined) { + params.value = value; + } + + return logger.throwError(message, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.NUMERIC_FAULT, params); +} // Constant to pull zeros from for multipliers + + +var zeros = "0"; + +while (zeros.length < 256) { + zeros += zeros; +} // Returns a string "1" followed by decimal "0"s + + +function getMultiplier(decimals) { + if (typeof decimals !== "number") { + try { + decimals = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(decimals).toNumber(); + } catch (e) {} + } + + if (typeof decimals === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) { + return "1" + zeros.substring(0, decimals); + } + + return logger.throwArgumentError("invalid decimal size", "decimals", decimals); +} + +function formatFixed(value, decimals) { + if (decimals == null) { + decimals = 0; + } + + var multiplier = getMultiplier(decimals); // Make sure wei is a big number (convert as necessary) + + value = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(value); + var negative = value.lt(Zero); + + if (negative) { + value = value.mul(NegativeOne); + } + + var fraction = value.mod(multiplier).toString(); + + while (fraction.length < multiplier.length - 1) { + fraction = "0" + fraction; + } // Strip training 0 + + + fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1]; + var whole = value.div(multiplier).toString(); + + if (multiplier.length === 1) { + value = whole; + } else { + value = whole + "." + fraction; + } + + if (negative) { + value = "-" + value; + } + + return value; +} +function parseFixed(value, decimals) { + if (decimals == null) { + decimals = 0; + } + + var multiplier = getMultiplier(decimals); + + if (typeof value !== "string" || !value.match(/^-?[0-9.]+$/)) { + logger.throwArgumentError("invalid decimal value", "value", value); + } // Is it negative? + + + var negative = value.substring(0, 1) === "-"; + + if (negative) { + value = value.substring(1); + } + + if (value === ".") { + logger.throwArgumentError("missing value", "value", value); + } // Split it into a whole and fractional part + + + var comps = value.split("."); + + if (comps.length > 2) { + logger.throwArgumentError("too many decimal points", "value", value); + } + + var whole = comps[0], + fraction = comps[1]; + + if (!whole) { + whole = "0"; + } + + if (!fraction) { + fraction = "0"; + } // Trim trailing zeros + + + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } // Check the fraction doesn't exceed our decimals size + + + if (fraction.length > multiplier.length - 1) { + throwFault("fractional component exceeds decimals", "underflow", "parseFixed"); + } // If decimals is 0, we have an empty string for fraction + + + if (fraction === "") { + fraction = "0"; + } // Fully pad the string with zeros to get to wei + + + while (fraction.length < multiplier.length - 1) { + fraction += "0"; + } + + var wholeValue = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(whole); + var fractionValue = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(fraction); + var wei = wholeValue.mul(multiplier).add(fractionValue); + + if (negative) { + wei = wei.mul(NegativeOne); + } + + return wei; +} +var FixedFormat = /*#__PURE__*/function () { + function FixedFormat(constructorGuard, signed, width, decimals) { + _classCallCheck(this, FixedFormat); + + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "new FixedFormat" + }); + } + + this.signed = signed; + this.width = width; + this.decimals = decimals; + this.name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + this._multiplier = getMultiplier(decimals); + Object.freeze(this); + } + + _createClass(FixedFormat, null, [{ + key: "from", + value: function from(value) { + if (value instanceof FixedFormat) { + return value; + } + + if (typeof value === "number") { + value = "fixed128x".concat(value); + } + + var signed = true; + var width = 128; + var decimals = 18; + + if (typeof value === "string") { + if (value === "fixed") {// defaults... + } else if (value === "ufixed") { + signed = false; + } else { + var match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + + if (!match) { + logger.throwArgumentError("invalid fixed format", "format", value); + } + + signed = match[1] !== "u"; + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } else if (value) { + var check = function check(key, type, defaultValue) { + if (value[key] == null) { + return defaultValue; + } + + if (_typeof(value[key]) !== type) { + logger.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]); + } + + return value[key]; + }; + + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + + if (width % 8) { + logger.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width); + } + + if (decimals > 80) { + logger.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals); + } + + return new FixedFormat(_constructorGuard, signed, width, decimals); + } + }]); + + return FixedFormat; +}(); +var FixedNumber = /*#__PURE__*/function () { + function FixedNumber(constructorGuard, hex, value, format) { + _classCallCheck(this, FixedNumber); + + logger.checkNew(this instanceof FixedNumber ? this.constructor : void 0, FixedNumber); + + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "new FixedFormat" + }); + } + + this.format = format; + this._hex = hex; + this._value = value; + this._isFixedNumber = true; + Object.freeze(this); + } + + _createClass(FixedNumber, [{ + key: "_checkFormat", + value: function _checkFormat(other) { + if (this.format.name !== other.format.name) { + logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); + } + } + }, { + key: "addUnsafe", + value: function addUnsafe(other) { + this._checkFormat(other); + + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format); + } + }, { + key: "subUnsafe", + value: function subUnsafe(other) { + this._checkFormat(other); + + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format); + } + }, { + key: "mulUnsafe", + value: function mulUnsafe(other) { + this._checkFormat(other); + + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format); + } + }, { + key: "divUnsafe", + value: function divUnsafe(other) { + this._checkFormat(other); + + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format); + } + }, { + key: "floor", + value: function floor() { + var comps = this.toString().split("."); + + if (comps.length === 1) { + comps.push("0"); + } + + var result = FixedNumber.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + + if (this.isNegative() && hasFraction) { + result = result.subUnsafe(ONE.toFormat(result.format)); + } + + return result; + } + }, { + key: "ceiling", + value: function ceiling() { + var comps = this.toString().split("."); + + if (comps.length === 1) { + comps.push("0"); + } + + var result = FixedNumber.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + + if (!this.isNegative() && hasFraction) { + result = result.addUnsafe(ONE.toFormat(result.format)); + } + + return result; + } // @TODO: Support other rounding algorithms + + }, { + key: "round", + value: function round(decimals) { + if (decimals == null) { + decimals = 0; + } // If we are already in range, we're done + + + var comps = this.toString().split("."); + + if (comps.length === 1) { + comps.push("0"); + } + + if (decimals < 0 || decimals > 80 || decimals % 1) { + logger.throwArgumentError("invalid decimal count", "decimals", decimals); + } + + if (comps[1].length <= decimals) { + return this; + } + + var factor = FixedNumber.from("1" + zeros.substring(0, decimals), this.format); + var bump = BUMP.toFormat(this.format); + return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); + } + }, { + key: "isZero", + value: function isZero() { + return this._value === "0.0" || this._value === "0"; + } + }, { + key: "isNegative", + value: function isNegative() { + return this._value[0] === "-"; + } + }, { + key: "toString", + value: function toString() { + return this._value; + } + }, { + key: "toHexString", + value: function toHexString(width) { + if (width == null) { + return this._hex; + } + + if (width % 8) { + logger.throwArgumentError("invalid byte width", "width", width); + } + + var hex = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexZeroPad"])(hex, width / 8); + } + }, { + key: "toUnsafeFloat", + value: function toUnsafeFloat() { + return parseFloat(this.toString()); + } + }, { + key: "toFormat", + value: function toFormat(format) { + return FixedNumber.fromString(this._value, format); + } + }], [{ + key: "fromValue", + value: function fromValue(value, decimals, format) { + // If decimals looks more like a format, and there is no format, shift the parameters + if (format == null && decimals != null && !Object(_bignumber__WEBPACK_IMPORTED_MODULE_3__["isBigNumberish"])(decimals)) { + format = decimals; + decimals = null; + } + + if (decimals == null) { + decimals = 0; + } + + if (format == null) { + format = "fixed"; + } + + return FixedNumber.fromString(formatFixed(value, decimals), FixedFormat.from(format)); + } + }, { + key: "fromString", + value: function fromString(value, format) { + if (format == null) { + format = "fixed"; + } + + var fixedFormat = FixedFormat.from(format); + var numeric = parseFixed(value, fixedFormat.decimals); + + if (!fixedFormat.signed && numeric.lt(Zero)) { + throwFault("unsigned value cannot be negative", "overflow", "value", value); + } + + var hex = null; + + if (fixedFormat.signed) { + hex = numeric.toTwos(fixedFormat.width).toHexString(); + } else { + hex = numeric.toHexString(); + hex = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexZeroPad"])(hex, fixedFormat.width / 8); + } + + var decimal = formatFixed(numeric, fixedFormat.decimals); + return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat); + } + }, { + key: "fromBytes", + value: function fromBytes(value, format) { + if (format == null) { + format = "fixed"; + } + + var fixedFormat = FixedFormat.from(format); + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(value).length > fixedFormat.width / 8) { + throw new Error("overflow"); + } + + var numeric = _bignumber__WEBPACK_IMPORTED_MODULE_3__["BigNumber"].from(value); + + if (fixedFormat.signed) { + numeric = numeric.fromTwos(fixedFormat.width); + } + + var hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString(); + var decimal = formatFixed(numeric, fixedFormat.decimals); + return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat); + } + }, { + key: "from", + value: function from(value, format) { + if (typeof value === "string") { + return FixedNumber.fromString(value, format); + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["isBytes"])(value)) { + return FixedNumber.fromBytes(value, format); + } + + try { + return FixedNumber.fromValue(value, 0, format); + } catch (error) { + // Allow NUMERIC_FAULT to bubble up + if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.INVALID_ARGUMENT) { + throw error; + } + } + + return logger.throwArgumentError("invalid FixedNumber value", "value", value); + } + }, { + key: "isFixedNumber", + value: function isFixedNumber(value) { + return !!(value && value._isFixedNumber); + } + }]); + + return FixedNumber; +}(); +var ONE = FixedNumber.from(1); +var BUMP = FixedNumber.from("0.5"); + +/***/ }), + +/***/ "./node_modules/@ethersproject/bignumber/lib.esm/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/bignumber/lib.esm/index.js ***! + \****************************************************************/ +/*! exports provided: BigNumber, formatFixed, FixedFormat, FixedNumber, parseFixed, _base16To36, _base36To16 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/bignumber.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BigNumber", function() { return _bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"]; }); + +/* harmony import */ var _fixednumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fixednumber */ "./node_modules/@ethersproject/bignumber/lib.esm/fixednumber.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatFixed", function() { return _fixednumber__WEBPACK_IMPORTED_MODULE_1__["formatFixed"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FixedFormat", function() { return _fixednumber__WEBPACK_IMPORTED_MODULE_1__["FixedFormat"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FixedNumber", function() { return _fixednumber__WEBPACK_IMPORTED_MODULE_1__["FixedNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseFixed", function() { return _fixednumber__WEBPACK_IMPORTED_MODULE_1__["parseFixed"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_base16To36", function() { return _bignumber__WEBPACK_IMPORTED_MODULE_0__["_base16To36"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_base36To16", function() { return _bignumber__WEBPACK_IMPORTED_MODULE_0__["_base36To16"]; }); + + + // Internal methods used by address + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/bytes/lib.esm/_version.js": +/*!***************************************************************!*\ + !*** ./node_modules/@ethersproject/bytes/lib.esm/_version.js ***! + \***************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "bytes/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/bytes/lib.esm/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@ethersproject/bytes/lib.esm/index.js ***! + \************************************************************/ +/*! exports provided: isBytesLike, isBytes, arrayify, concat, stripZeros, zeroPad, isHexString, hexlify, hexDataLength, hexDataSlice, hexConcat, hexValue, hexStripZeros, hexZeroPad, splitSignature, joinSignature */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBytesLike", function() { return isBytesLike; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBytes", function() { return isBytes; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arrayify", function() { return arrayify; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return concat; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stripZeros", function() { return stripZeros; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zeroPad", function() { return zeroPad; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isHexString", function() { return isHexString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexlify", function() { return hexlify; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexDataLength", function() { return hexDataLength; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexDataSlice", function() { return hexDataSlice; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexConcat", function() { return hexConcat; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexValue", function() { return hexValue; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexStripZeros", function() { return hexStripZeros; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexZeroPad", function() { return hexZeroPad; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitSignature", function() { return splitSignature; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "joinSignature", function() { return joinSignature; }); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/bytes/lib.esm/_version.js"); + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"](_version__WEBPACK_IMPORTED_MODULE_1__["version"]); /////////////////////////////// + +function isHexable(value) { + return !!value.toHexString; +} + +function addSlice(array) { + if (array.slice) { + return array; + } + + array.slice = function () { + var args = Array.prototype.slice.call(arguments); + return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args))); + }; + + return array; +} + +function isBytesLike(value) { + return isHexString(value) && !(value.length % 2) || isBytes(value); +} + +function isInteger(value) { + return typeof value === "number" && value == value && value % 1 === 0; +} + +function isBytes(value) { + if (value == null) { + return false; + } + + if (value.constructor === Uint8Array) { + return true; + } + + if (typeof value === "string") { + return false; + } + + if (!isInteger(value.length) || value.length < 0) { + return false; + } + + for (var i = 0; i < value.length; i++) { + var v = value[i]; + + if (!isInteger(v) || v < 0 || v >= 256) { + return false; + } + } + + return true; +} +function arrayify(value, options) { + if (!options) { + options = {}; + } + + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid arrayify value"); + var result = []; + + while (value) { + result.unshift(value & 0xff); + value = parseInt(String(value / 256)); + } + + if (result.length === 0) { + result.push(0); + } + + return addSlice(new Uint8Array(result)); + } + + if (options.allowMissingPrefix && typeof value === "string" && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + + if (isHexable(value)) { + value = value.toHexString(); + } + + if (isHexString(value)) { + var hex = value.substring(2); + + if (hex.length % 2) { + if (options.hexPad === "left") { + hex = "0x0" + hex.substring(2); + } else if (options.hexPad === "right") { + hex += "0"; + } else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + + var _result = []; + + for (var i = 0; i < hex.length; i += 2) { + _result.push(parseInt(hex.substring(i, i + 2), 16)); + } + + return addSlice(new Uint8Array(_result)); + } + + if (isBytes(value)) { + return addSlice(new Uint8Array(value)); + } + + return logger.throwArgumentError("invalid arrayify value", "value", value); +} +function concat(items) { + var objects = items.map(function (item) { + return arrayify(item); + }); + var length = objects.reduce(function (accum, item) { + return accum + item.length; + }, 0); + var result = new Uint8Array(length); + objects.reduce(function (offset, object) { + result.set(object, offset); + return offset + object.length; + }, 0); + return addSlice(result); +} +function stripZeros(value) { + var result = arrayify(value); + + if (result.length === 0) { + return result; + } // Find the first non-zero entry + + + var start = 0; + + while (start < result.length && result[start] === 0) { + start++; + } // If we started with zeros, strip them + + + if (start) { + result = result.slice(start); + } + + return result; +} +function zeroPad(value, length) { + value = arrayify(value); + + if (value.length > length) { + logger.throwArgumentError("value out of range", "value", arguments[0]); + } + + var result = new Uint8Array(length); + result.set(value, length - value.length); + return addSlice(result); +} +function isHexString(value, length) { + if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + + if (length && value.length !== 2 + 2 * length) { + return false; + } + + return true; +} +var HexCharacters = "0123456789abcdef"; +function hexlify(value, options) { + if (!options) { + options = {}; + } + + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid hexlify value"); + var hex = ""; + + while (value) { + hex = HexCharacters[value & 0xf] + hex; + value = Math.floor(value / 16); + } + + if (hex.length) { + if (hex.length % 2) { + hex = "0" + hex; + } + + return "0x" + hex; + } + + return "0x00"; + } + + if (typeof value === "bigint") { + value = value.toString(16); + + if (value.length % 2) { + return "0x0" + value; + } + + return "0x" + value; + } + + if (options.allowMissingPrefix && typeof value === "string" && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + + if (isHexable(value)) { + return value.toHexString(); + } + + if (isHexString(value)) { + if (value.length % 2) { + if (options.hexPad === "left") { + value = "0x0" + value.substring(2); + } else if (options.hexPad === "right") { + value += "0"; + } else { + logger.throwArgumentError("hex data is odd-length", "value", value); + } + } + + return value.toLowerCase(); + } + + if (isBytes(value)) { + var result = "0x"; + + for (var i = 0; i < value.length; i++) { + var v = value[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + + return result; + } + + return logger.throwArgumentError("invalid hexlify value", "value", value); +} +/* +function unoddify(value: BytesLike | Hexable | number): BytesLike | Hexable | number { + if (typeof(value) === "string" && value.length % 2 && value.substring(0, 2) === "0x") { + return "0x0" + value.substring(2); + } + return value; +} +*/ + +function hexDataLength(data) { + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + return null; + } + + return (data.length - 2) / 2; +} +function hexDataSlice(data, offset, endOffset) { + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + logger.throwArgumentError("invalid hexData", "value", data); + } + + offset = 2 + 2 * offset; + + if (endOffset != null) { + return "0x" + data.substring(offset, 2 + 2 * endOffset); + } + + return "0x" + data.substring(offset); +} +function hexConcat(items) { + var result = "0x"; + items.forEach(function (item) { + result += hexlify(item).substring(2); + }); + return result; +} +function hexValue(value) { + var trimmed = hexStripZeros(hexlify(value, { + hexPad: "left" + })); + + if (trimmed === "0x") { + return "0x0"; + } + + return trimmed; +} +function hexStripZeros(value) { + if (typeof value !== "string") { + value = hexlify(value); + } + + if (!isHexString(value)) { + logger.throwArgumentError("invalid hex string", "value", value); + } + + value = value.substring(2); + var offset = 0; + + while (offset < value.length && value[offset] === "0") { + offset++; + } + + return "0x" + value.substring(offset); +} +function hexZeroPad(value, length) { + if (typeof value !== "string") { + value = hexlify(value); + } else if (!isHexString(value)) { + logger.throwArgumentError("invalid hex string", "value", value); + } + + if (value.length > 2 * length + 2) { + logger.throwArgumentError("value out of range", "value", arguments[1]); + } + + while (value.length < 2 * length + 2) { + value = "0x0" + value.substring(2); + } + + return value; +} +function splitSignature(signature) { + var result = { + r: "0x", + s: "0x", + _vs: "0x", + recoveryParam: 0, + v: 0 + }; + + if (isBytesLike(signature)) { + var bytes = arrayify(signature); + + if (bytes.length !== 65) { + logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature); + } // Get the r, s and v + + + result.r = hexlify(bytes.slice(0, 32)); + result.s = hexlify(bytes.slice(32, 64)); + result.v = bytes[64]; // Allow a recid to be used as the v + + if (result.v < 27) { + if (result.v === 0 || result.v === 1) { + result.v += 27; + } else { + logger.throwArgumentError("signature invalid v byte", "signature", signature); + } + } // Compute recoveryParam from v + + + result.recoveryParam = 1 - result.v % 2; // Compute _vs from recoveryParam and s + + if (result.recoveryParam) { + bytes[32] |= 0x80; + } + + result._vs = hexlify(bytes.slice(32, 64)); + } else { + result.r = signature.r; + result.s = signature.s; + result.v = signature.v; + result.recoveryParam = signature.recoveryParam; + result._vs = signature._vs; // If the _vs is available, use it to populate missing s, v and recoveryParam + // and verify non-missing s, v and recoveryParam + + if (result._vs != null) { + var _vs2 = zeroPad(arrayify(result._vs), 32); + + result._vs = hexlify(_vs2); // Set or check the recid + + var recoveryParam = _vs2[0] >= 128 ? 1 : 0; + + if (result.recoveryParam == null) { + result.recoveryParam = recoveryParam; + } else if (result.recoveryParam !== recoveryParam) { + logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); + } // Set or check the s + + + _vs2[0] &= 0x7f; + var s = hexlify(_vs2); + + if (result.s == null) { + result.s = s; + } else if (result.s !== s) { + logger.throwArgumentError("signature v mismatch _vs", "signature", signature); + } + } // Use recid and v to populate each other + + + if (result.recoveryParam == null) { + if (result.v == null) { + logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature); + } else if (result.v === 0 || result.v === 1) { + result.recoveryParam = result.v; + } else { + result.recoveryParam = 1 - result.v % 2; + } + } else { + if (result.v == null) { + result.v = 27 + result.recoveryParam; + } else { + var recId = result.v === 0 || result.v === 1 ? result.v : 1 - result.v % 2; + + if (result.recoveryParam !== recId) { + logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + } + } + } + + if (result.r == null || !isHexString(result.r)) { + logger.throwArgumentError("signature missing or invalid r", "signature", signature); + } else { + result.r = hexZeroPad(result.r, 32); + } + + if (result.s == null || !isHexString(result.s)) { + logger.throwArgumentError("signature missing or invalid s", "signature", signature); + } else { + result.s = hexZeroPad(result.s, 32); + } + + var vs = arrayify(result.s); + + if (vs[0] >= 128) { + logger.throwArgumentError("signature s out of range", "signature", signature); + } + + if (result.recoveryParam) { + vs[0] |= 0x80; + } + + var _vs = hexlify(vs); + + if (result._vs) { + if (!isHexString(result._vs)) { + logger.throwArgumentError("signature invalid _vs", "signature", signature); + } + + result._vs = hexZeroPad(result._vs, 32); + } // Set or check the _vs + + + if (result._vs == null) { + result._vs = _vs; + } else if (result._vs !== _vs) { + logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature); + } + } + + return result; +} +function joinSignature(signature) { + signature = splitSignature(signature); + return hexlify(concat([signature.r, signature.s, signature.recoveryParam ? "0x1c" : "0x1b"])); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/constants/lib.esm/addresses.js": +/*!********************************************************************!*\ + !*** ./node_modules/@ethersproject/constants/lib.esm/addresses.js ***! + \********************************************************************/ +/*! exports provided: AddressZero */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AddressZero", function() { return AddressZero; }); +var AddressZero = "0x0000000000000000000000000000000000000000"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/constants/lib.esm/bignumbers.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@ethersproject/constants/lib.esm/bignumbers.js ***! + \*********************************************************************/ +/*! exports provided: NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256, MinInt256, MaxInt256 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NegativeOne", function() { return NegativeOne; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Zero", function() { return Zero; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "One", function() { return One; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Two", function() { return Two; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WeiPerEther", function() { return WeiPerEther; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MaxUint256", function() { return MaxUint256; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MinInt256", function() { return MinInt256; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MaxInt256", function() { return MaxInt256; }); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); + +var NegativeOne = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(-1); +var Zero = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(0); +var One = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(1); +var Two = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(2); +var WeiPerEther = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("1000000000000000000"); +var MaxUint256 = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +var MinInt256 = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("-0x8000000000000000000000000000000000000000000000000000000000000000"); +var MaxInt256 = /*#__PURE__*/_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + + +/***/ }), + +/***/ "./node_modules/@ethersproject/constants/lib.esm/hashes.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@ethersproject/constants/lib.esm/hashes.js ***! + \*****************************************************************/ +/*! exports provided: HashZero */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashZero", function() { return HashZero; }); +var HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/constants/lib.esm/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/constants/lib.esm/index.js ***! + \****************************************************************/ +/*! exports provided: AddressZero, NegativeOne, Zero, One, Two, WeiPerEther, MaxUint256, MinInt256, MaxInt256, HashZero, EtherSymbol */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _addresses__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./addresses */ "./node_modules/@ethersproject/constants/lib.esm/addresses.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AddressZero", function() { return _addresses__WEBPACK_IMPORTED_MODULE_0__["AddressZero"]; }); + +/* harmony import */ var _bignumbers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bignumbers */ "./node_modules/@ethersproject/constants/lib.esm/bignumbers.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NegativeOne", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["NegativeOne"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Zero", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["Zero"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "One", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["One"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Two", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["Two"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WeiPerEther", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["WeiPerEther"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MaxUint256", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["MaxUint256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MinInt256", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["MinInt256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MaxInt256", function() { return _bignumbers__WEBPACK_IMPORTED_MODULE_1__["MaxInt256"]; }); + +/* harmony import */ var _hashes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hashes */ "./node_modules/@ethersproject/constants/lib.esm/hashes.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HashZero", function() { return _hashes__WEBPACK_IMPORTED_MODULE_2__["HashZero"]; }); + +/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./strings */ "./node_modules/@ethersproject/constants/lib.esm/strings.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EtherSymbol", function() { return _strings__WEBPACK_IMPORTED_MODULE_3__["EtherSymbol"]; }); + + + + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/constants/lib.esm/strings.js": +/*!******************************************************************!*\ + !*** ./node_modules/@ethersproject/constants/lib.esm/strings.js ***! + \******************************************************************/ +/*! exports provided: EtherSymbol */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EtherSymbol", function() { return EtherSymbol; }); +// NFKC (composed) // (decomposed) +var EtherSymbol = "\u039E"; // "\uD835\uDF63"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/contracts/lib.esm/_version.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/contracts/lib.esm/_version.js ***! + \*******************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "contracts/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/contracts/lib.esm/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/contracts/lib.esm/index.js ***! + \****************************************************************/ +/*! exports provided: BaseContract, Contract, ContractFactory */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseContract", function() { return BaseContract; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Contract", function() { return Contract; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContractFactory", function() { return ContractFactory; }); +/* harmony import */ var _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/abi */ "./node_modules/@ethersproject/abi/lib.esm/index.js"); +/* harmony import */ var _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/abstract-provider */ "./node_modules/@ethersproject/abstract-provider/lib.esm/index.js"); +/* harmony import */ var _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/abstract-signer */ "./node_modules/@ethersproject/abstract-signer/lib.esm/index.js"); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/contracts/lib.esm/_version.js"); + + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"](_version__WEBPACK_IMPORTED_MODULE_9__["version"]); +; +; /////////////////////////////// + +var allowedTransactionKeys = { + chainId: true, + data: true, + from: true, + gasLimit: true, + gasPrice: true, + nonce: true, + to: true, + value: true, + type: true, + accessList: true, + maxFeePerGas: true, + maxPriorityFeePerGas: true, + customData: true +}; + +function resolveName(resolver, nameOrPromise) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var name, address; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return nameOrPromise; + + case 2: + name = _context.sent; + + if (typeof name !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", name); + } // If it is already an address, just use it (after adding checksum) + + + _context.prev = 4; + return _context.abrupt("return", Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_3__["getAddress"])(name)); + + case 8: + _context.prev = 8; + _context.t0 = _context["catch"](4); + + case 10: + if (!resolver) { + logger.throwError("a provider or signer is needed to resolve ENS names", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "resolveName" + }); + } + + _context.next = 13; + return resolver.resolveName(name); + + case 13: + address = _context.sent; + + if (address == null) { + logger.throwArgumentError("resolver or addr is not configured for ENS name", "name", name); + } + + return _context.abrupt("return", address); + + case 16: + case "end": + return _context.stop(); + } + } + }, _callee, null, [[4, 8]]); + })); +} // Recursively replaces ENS names with promises to resolve the name and resolves all properties + + +function resolveAddresses(resolver, value, paramType) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!Array.isArray(paramType)) { + _context2.next = 4; + break; + } + + _context2.next = 3; + return Promise.all(paramType.map(function (paramType, index) { + return resolveAddresses(resolver, Array.isArray(value) ? value[index] : value[paramType.name], paramType); + })); + + case 3: + return _context2.abrupt("return", _context2.sent); + + case 4: + if (!(paramType.type === "address")) { + _context2.next = 8; + break; + } + + _context2.next = 7; + return resolveName(resolver, value); + + case 7: + return _context2.abrupt("return", _context2.sent); + + case 8: + if (!(paramType.type === "tuple")) { + _context2.next = 12; + break; + } + + _context2.next = 11; + return resolveAddresses(resolver, value, paramType.components); + + case 11: + return _context2.abrupt("return", _context2.sent); + + case 12: + if (!(paramType.baseType === "array")) { + _context2.next = 18; + break; + } + + if (Array.isArray(value)) { + _context2.next = 15; + break; + } + + return _context2.abrupt("return", Promise.reject(logger.makeError("invalid value for array", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.INVALID_ARGUMENT, { + argument: "value", + value: value + }))); + + case 15: + _context2.next = 17; + return Promise.all(value.map(function (v) { + return resolveAddresses(resolver, v, paramType.arrayChildren); + })); + + case 17: + return _context2.abrupt("return", _context2.sent); + + case 18: + return _context2.abrupt("return", value); + + case 19: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); +} + +function populateTransaction(contract, fragment, args) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + var _this = this; + + var overrides, resolved, data, tx, ro, intrinsic, bytes, i, roValue, leftovers; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + // If an extra argument is given, it is overrides + overrides = {}; + + if (args.length === fragment.inputs.length + 1 && _typeof(args[args.length - 1]) === "object") { + overrides = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["shallowCopy"])(args.pop()); + } // Make sure the parameter count matches + + + logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); // Populate "from" override (allow promises) + + if (contract.signer) { + if (overrides.from) { + // Contracts with a Signer are from the Signer's frame-of-reference; + // but we allow overriding "from" if it matches the signer + overrides.from = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["resolveProperties"])({ + override: resolveName(contract.signer, overrides.from), + signer: contract.signer.getAddress() + }).then(function (check) { + return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_3__["getAddress"])(check.signer) !== check.override) { + logger.throwError("Contract with a Signer cannot override from", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "overrides.from" + }); + } + + return _context3.abrupt("return", check.override); + + case 2: + case "end": + return _context3.stop(); + } + } + }, _callee3); + })); + }); + } else { + overrides.from = contract.signer.getAddress(); + } + } else if (overrides.from) { + overrides.from = resolveName(contract.provider, overrides.from); //} else { + // Contracts without a signer can override "from", and if + // unspecified the zero address is used + //overrides.from = AddressZero; + } // Wait for all dependencies to be resolved (prefer the signer over the provider) + + + _context4.next = 6; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["resolveProperties"])({ + args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), + address: contract.resolvedAddress, + overrides: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["resolveProperties"])(overrides) || {} + }); + + case 6: + resolved = _context4.sent; + // The ABI coded transaction + data = contract["interface"].encodeFunctionData(fragment, resolved.args); + tx = { + data: data, + to: resolved.address + }; // Resolved Overrides + + ro = resolved.overrides; // Populate simple overrides + + if (ro.nonce != null) { + tx.nonce = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(ro.nonce).toNumber(); + } + + if (ro.gasLimit != null) { + tx.gasLimit = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(ro.gasLimit); + } + + if (ro.gasPrice != null) { + tx.gasPrice = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(ro.gasPrice); + } + + if (ro.maxFeePerGas != null) { + tx.maxFeePerGas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(ro.maxFeePerGas); + } + + if (ro.maxPriorityFeePerGas != null) { + tx.maxPriorityFeePerGas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(ro.maxPriorityFeePerGas); + } + + if (ro.from != null) { + tx.from = ro.from; + } + + if (ro.type != null) { + tx.type = ro.type; + } + + if (ro.accessList != null) { + tx.accessList = Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_7__["accessListify"])(ro.accessList); + } // If there was no "gasLimit" override, but the ABI specifies a default, use it + + + if (tx.gasLimit == null && fragment.gas != null) { + // Compute the intrinsic gas cost for this transaction + // @TODO: This is based on the yellow paper as of Petersburg; this is something + // we may wish to parameterize in v6 as part of the Network object. Since this + // is always a non-nil to address, we can ignore G_create, but may wish to add + // similar logic to the ContractFactory. + intrinsic = 21000; + bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__["arrayify"])(data); + + for (i = 0; i < bytes.length; i++) { + intrinsic += 4; + + if (bytes[i]) { + intrinsic += 64; + } + } + + tx.gasLimit = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(fragment.gas).add(intrinsic); + } // Populate "value" override + + + if (ro.value) { + roValue = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(ro.value); + + if (!roValue.isZero() && !fragment.payable) { + logger.throwError("non-payable method cannot override value", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: overrides.value + }); + } + + tx.value = roValue; + } + + if (ro.customData) { + tx.customData = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["shallowCopy"])(ro.customData); + } // Remove the overrides + + + delete overrides.nonce; + delete overrides.gasLimit; + delete overrides.gasPrice; + delete overrides.from; + delete overrides.value; + delete overrides.type; + delete overrides.accessList; + delete overrides.maxFeePerGas; + delete overrides.maxPriorityFeePerGas; + delete overrides.customData; // Make sure there are no stray overrides, which may indicate a + // typo or using an unsupported key. + + leftovers = Object.keys(overrides).filter(function (key) { + return overrides[key] != null; + }); + + if (leftovers.length) { + logger.throwError("cannot override ".concat(leftovers.map(function (l) { + return JSON.stringify(l); + }).join(",")), _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "overrides", + overrides: leftovers + }); + } + + return _context4.abrupt("return", tx); + + case 34: + case "end": + return _context4.stop(); + } + } + }, _callee4); + })); +} + +function buildPopulate(contract, fragment) { + return function () { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return populateTransaction(contract, fragment, args); + }; +} + +function buildEstimate(contract, fragment) { + var signerOrProvider = contract.signer || contract.provider; + return function () { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { + var tx; + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + if (!signerOrProvider) { + logger.throwError("estimate require a provider or signer", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "estimateGas" + }); + } + + _context5.next = 3; + return populateTransaction(contract, fragment, args); + + case 3: + tx = _context5.sent; + _context5.next = 6; + return signerOrProvider.estimateGas(tx); + + case 6: + return _context5.abrupt("return", _context5.sent); + + case 7: + case "end": + return _context5.stop(); + } + } + }, _callee5); + })); + }; +} + +function addContractWait(contract, tx) { + var wait = tx.wait.bind(tx); + + tx.wait = function (confirmations) { + return wait(confirmations).then(function (receipt) { + receipt.events = receipt.logs.map(function (log) { + var event = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["deepCopy"])(log); + var parsed = null; + + try { + parsed = contract["interface"].parseLog(log); + } catch (e) {} // Successfully parsed the event log; include it + + + if (parsed) { + event.args = parsed.args; + + event.decode = function (data, topics) { + return contract["interface"].decodeEventLog(parsed.eventFragment, data, topics); + }; + + event.event = parsed.name; + event.eventSignature = parsed.signature; + } // Useful operations + + + event.removeListener = function () { + return contract.provider; + }; + + event.getBlock = function () { + return contract.provider.getBlock(receipt.blockHash); + }; + + event.getTransaction = function () { + return contract.provider.getTransaction(receipt.transactionHash); + }; + + event.getTransactionReceipt = function () { + return Promise.resolve(receipt); + }; + + return event; + }); + return receipt; + }); + }; +} + +function buildCall(contract, fragment, collapseSimple) { + var signerOrProvider = contract.signer || contract.provider; + return function () { + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { + var blockTag, overrides, tx, result, value; + return regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + // Extract the "blockTag" override if present + blockTag = undefined; + + if (!(args.length === fragment.inputs.length + 1 && _typeof(args[args.length - 1]) === "object")) { + _context6.next = 9; + break; + } + + overrides = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["shallowCopy"])(args.pop()); + + if (!(overrides.blockTag != null)) { + _context6.next = 7; + break; + } + + _context6.next = 6; + return overrides.blockTag; + + case 6: + blockTag = _context6.sent; + + case 7: + delete overrides.blockTag; + args.push(overrides); + + case 9: + if (!(contract.deployTransaction != null)) { + _context6.next = 12; + break; + } + + _context6.next = 12; + return contract._deployed(blockTag); + + case 12: + _context6.next = 14; + return populateTransaction(contract, fragment, args); + + case 14: + tx = _context6.sent; + _context6.next = 17; + return signerOrProvider.call(tx, blockTag); + + case 17: + result = _context6.sent; + _context6.prev = 18; + value = contract["interface"].decodeFunctionResult(fragment, result); + + if (collapseSimple && fragment.outputs.length === 1) { + value = value[0]; + } + + return _context6.abrupt("return", value); + + case 24: + _context6.prev = 24; + _context6.t0 = _context6["catch"](18); + + if (_context6.t0.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.CALL_EXCEPTION) { + _context6.t0.address = contract.address; + _context6.t0.args = args; + _context6.t0.transaction = tx; + } + + throw _context6.t0; + + case 28: + case "end": + return _context6.stop(); + } + } + }, _callee6, null, [[18, 24]]); + })); + }; +} + +function buildSend(contract, fragment) { + return function () { + for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { + var txRequest, tx; + return regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + if (!contract.signer) { + logger.throwError("sending a transaction requires a signer", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "sendTransaction" + }); + } // If the contract was just deployed, wait until it is mined + + + if (!(contract.deployTransaction != null)) { + _context7.next = 4; + break; + } + + _context7.next = 4; + return contract._deployed(); + + case 4: + _context7.next = 6; + return populateTransaction(contract, fragment, args); + + case 6: + txRequest = _context7.sent; + _context7.next = 9; + return contract.signer.sendTransaction(txRequest); + + case 9: + tx = _context7.sent; + // Tweak the tx.wait so the receipt has extra properties + addContractWait(contract, tx); + return _context7.abrupt("return", tx); + + case 12: + case "end": + return _context7.stop(); + } + } + }, _callee7); + })); + }; +} + +function buildDefault(contract, fragment, collapseSimple) { + if (fragment.constant) { + return buildCall(contract, fragment, collapseSimple); + } + + return buildSend(contract, fragment); +} + +function getEventTag(filter) { + if (filter.address && (filter.topics == null || filter.topics.length === 0)) { + return "*"; + } + + return (filter.address || "*") + "@" + (filter.topics ? filter.topics.map(function (topic) { + if (Array.isArray(topic)) { + return topic.join("|"); + } + + return topic; + }).join(":") : ""); +} + +var RunningEvent = /*#__PURE__*/function () { + function RunningEvent(tag, filter) { + _classCallCheck(this, RunningEvent); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "tag", tag); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "filter", filter); + this._listeners = []; + } + + _createClass(RunningEvent, [{ + key: "addListener", + value: function addListener(listener, once) { + this._listeners.push({ + listener: listener, + once: once + }); + } + }, { + key: "removeListener", + value: function removeListener(listener) { + var done = false; + this._listeners = this._listeners.filter(function (item) { + if (done || item.listener !== listener) { + return true; + } + + done = true; + return false; + }); + } + }, { + key: "removeAllListeners", + value: function removeAllListeners() { + this._listeners = []; + } + }, { + key: "listeners", + value: function listeners() { + return this._listeners.map(function (i) { + return i.listener; + }); + } + }, { + key: "listenerCount", + value: function listenerCount() { + return this._listeners.length; + } + }, { + key: "run", + value: function run(args) { + var _this2 = this; + + var listenerCount = this.listenerCount(); + this._listeners = this._listeners.filter(function (item) { + var argsCopy = args.slice(); // Call the callback in the next event loop + + setTimeout(function () { + item.listener.apply(_this2, argsCopy); + }, 0); // Reschedule it if it not "once" + + return !item.once; + }); + return listenerCount; + } + }, { + key: "prepareEvent", + value: function prepareEvent(event) {} // Returns the array that will be applied to an emit + + }, { + key: "getEmit", + value: function getEmit(event) { + return [event]; + } + }]); + + return RunningEvent; +}(); + +var ErrorRunningEvent = /*#__PURE__*/function (_RunningEvent) { + _inherits(ErrorRunningEvent, _RunningEvent); + + var _super = _createSuper(ErrorRunningEvent); + + function ErrorRunningEvent() { + _classCallCheck(this, ErrorRunningEvent); + + return _super.call(this, "error", null); + } + + return _createClass(ErrorRunningEvent); +}(RunningEvent); // @TODO Fragment should inherit Wildcard? and just override getEmit? +// or have a common abstract super class, with enough constructor +// options to configure both. +// A Fragment Event will populate all the properties that Wildcard +// will, and additionally dereference the arguments when emitting + + +var FragmentRunningEvent = /*#__PURE__*/function (_RunningEvent2) { + _inherits(FragmentRunningEvent, _RunningEvent2); + + var _super2 = _createSuper(FragmentRunningEvent); + + function FragmentRunningEvent(address, contractInterface, fragment, topics) { + var _this3; + + _classCallCheck(this, FragmentRunningEvent); + + var filter = { + address: address + }; + var topic = contractInterface.getEventTopic(fragment); + + if (topics) { + if (topic !== topics[0]) { + logger.throwArgumentError("topic mismatch", "topics", topics); + } + + filter.topics = topics.slice(); + } else { + filter.topics = [topic]; + } + + _this3 = _super2.call(this, getEventTag(filter), filter); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_assertThisInitialized(_this3), "address", address); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_assertThisInitialized(_this3), "interface", contractInterface); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_assertThisInitialized(_this3), "fragment", fragment); + return _this3; + } + + _createClass(FragmentRunningEvent, [{ + key: "prepareEvent", + value: function prepareEvent(event) { + var _this4 = this; + + _get(_getPrototypeOf(FragmentRunningEvent.prototype), "prepareEvent", this).call(this, event); + + event.event = this.fragment.name; + event.eventSignature = this.fragment.format(); + + event.decode = function (data, topics) { + return _this4["interface"].decodeEventLog(_this4.fragment, data, topics); + }; + + try { + event.args = this["interface"].decodeEventLog(this.fragment, event.data, event.topics); + } catch (error) { + event.args = null; + event.decodeError = error; + } + } + }, { + key: "getEmit", + value: function getEmit(event) { + var errors = Object(_ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["checkResultErrors"])(event.args); + + if (errors.length) { + throw errors[0].error; + } + + var args = (event.args || []).slice(); + args.push(event); + return args; + } + }]); + + return FragmentRunningEvent; +}(RunningEvent); // A Wildcard Event will attempt to populate: +// - event The name of the event name +// - eventSignature The full signature of the event +// - decode A function to decode data and topics +// - args The decoded data and topics + + +var WildcardRunningEvent = /*#__PURE__*/function (_RunningEvent3) { + _inherits(WildcardRunningEvent, _RunningEvent3); + + var _super3 = _createSuper(WildcardRunningEvent); + + function WildcardRunningEvent(address, contractInterface) { + var _this5; + + _classCallCheck(this, WildcardRunningEvent); + + _this5 = _super3.call(this, "*", { + address: address + }); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_assertThisInitialized(_this5), "address", address); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_assertThisInitialized(_this5), "interface", contractInterface); + return _this5; + } + + _createClass(WildcardRunningEvent, [{ + key: "prepareEvent", + value: function prepareEvent(event) { + var _this6 = this; + + _get(_getPrototypeOf(WildcardRunningEvent.prototype), "prepareEvent", this).call(this, event); + + try { + var parsed = this["interface"].parseLog(event); + event.event = parsed.name; + event.eventSignature = parsed.signature; + + event.decode = function (data, topics) { + return _this6["interface"].decodeEventLog(parsed.eventFragment, data, topics); + }; + + event.args = parsed.args; + } catch (error) {// No matching event + } + } + }]); + + return WildcardRunningEvent; +}(RunningEvent); + +var BaseContract = /*#__PURE__*/function () { + function BaseContract(addressOrName, contractInterface, signerOrProvider) { + var _this7 = this; + + _classCallCheck(this, BaseContract); + + logger.checkNew(this instanceof BaseContract ? this.constructor : void 0, Contract); // @TODO: Maybe still check the addressOrName looks like a valid address or name? + //address = getAddress(address); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "interface", Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["getStatic"])(this instanceof BaseContract ? this.constructor : void 0, "getInterface")(contractInterface)); + + if (signerOrProvider == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "provider", null); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "signer", null); + } else if (_ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__["Signer"].isSigner(signerOrProvider)) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "provider", signerOrProvider.provider || null); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "signer", signerOrProvider); + } else if (_ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_1__["Provider"].isProvider(signerOrProvider)) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "provider", signerOrProvider); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "signer", null); + } else { + logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "callStatic", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "estimateGas", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "functions", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "populateTransaction", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "filters", {}); + { + var uniqueFilters = {}; + Object.keys(this["interface"].events).forEach(function (eventSignature) { + var event = _this7["interface"].events[eventSignature]; + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.filters, eventSignature, function () { + for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; + } + + return { + address: _this7.address, + topics: _this7["interface"].encodeFilterTopics(event, args) + }; + }); + + if (!uniqueFilters[event.name]) { + uniqueFilters[event.name] = []; + } + + uniqueFilters[event.name].push(eventSignature); + }); + Object.keys(uniqueFilters).forEach(function (name) { + var filters = uniqueFilters[name]; + + if (filters.length === 1) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.filters, name, _this7.filters[filters[0]]); + } else { + logger.warn("Duplicate definition of ".concat(name, " (").concat(filters.join(", "), ")")); + } + }); + } + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "_runningEvents", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "_wrappedEmits", {}); + + if (addressOrName == null) { + logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "address", addressOrName); + + if (this.provider) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "resolvedAddress", resolveName(this.provider, addressOrName)); + } else { + try { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "resolvedAddress", Promise.resolve(Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_3__["getAddress"])(addressOrName))); + } catch (error) { + // Without a provider, we cannot use ENS names + logger.throwError("provider is required to use ENS name as contract address", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "new Contract" + }); + } + } + + var uniqueNames = {}; + var uniqueSignatures = {}; + Object.keys(this["interface"].functions).forEach(function (signature) { + var fragment = _this7["interface"].functions[signature]; // Check that the signature is unique; if not the ABI generation has + // not been cleaned or may be incorrectly generated + + if (uniqueSignatures[signature]) { + logger.warn("Duplicate ABI entry for ".concat(JSON.stringify(signature))); + return; + } + + uniqueSignatures[signature] = true; // Track unique names; we only expose bare named functions if they + // are ambiguous + + { + var name = fragment.name; + + if (!uniqueNames["%".concat(name)]) { + uniqueNames["%".concat(name)] = []; + } + + uniqueNames["%".concat(name)].push(signature); + } + + if (_this7[signature] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7, signature, buildDefault(_this7, fragment, true)); + } // We do not collapse simple calls on this bucket, which allows + // frameworks to safely use this without introspection as well as + // allows decoding error recovery. + + + if (_this7.functions[signature] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.functions, signature, buildDefault(_this7, fragment, false)); + } + + if (_this7.callStatic[signature] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.callStatic, signature, buildCall(_this7, fragment, true)); + } + + if (_this7.populateTransaction[signature] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.populateTransaction, signature, buildPopulate(_this7, fragment)); + } + + if (_this7.estimateGas[signature] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.estimateGas, signature, buildEstimate(_this7, fragment)); + } + }); + Object.keys(uniqueNames).forEach(function (name) { + // Ambiguous names to not get attached as bare names + var signatures = uniqueNames[name]; + + if (signatures.length > 1) { + return; + } // Strip off the leading "%" used for prototype protection + + + name = name.substring(1); + var signature = signatures[0]; // If overwriting a member property that is null, swallow the error + + try { + if (_this7[name] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7, name, _this7[signature]); + } + } catch (e) {} + + if (_this7.functions[name] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.functions, name, _this7.functions[signature]); + } + + if (_this7.callStatic[name] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.callStatic, name, _this7.callStatic[signature]); + } + + if (_this7.populateTransaction[name] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.populateTransaction, name, _this7.populateTransaction[signature]); + } + + if (_this7.estimateGas[name] == null) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(_this7.estimateGas, name, _this7.estimateGas[signature]); + } + }); + } + + _createClass(BaseContract, [{ + key: "deployed", + value: // @TODO: Allow timeout? + function deployed() { + return this._deployed(); + } + }, { + key: "_deployed", + value: function _deployed(blockTag) { + var _this8 = this; + + if (!this._deployedPromise) { + // If we were just deployed, we know the transaction we should occur in + if (this.deployTransaction) { + this._deployedPromise = this.deployTransaction.wait().then(function () { + return _this8; + }); + } else { + // @TODO: Once we allow a timeout to be passed in, we will wait + // up to that many blocks for getCode + // Otherwise, poll for our code to be deployed + this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function (code) { + if (code === "0x") { + logger.throwError("contract not deployed", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + contractAddress: _this8.address, + operation: "getDeployed" + }); + } + + return _this8; + }); + } + } + + return this._deployedPromise; + } // @TODO: + // estimateFallback(overrides?: TransactionRequest): Promise + // @TODO: + // estimateDeploy(bytecode: string, ...args): Promise + + }, { + key: "fallback", + value: function fallback(overrides) { + var _this9 = this; + + if (!this.signer) { + logger.throwError("sending a transactions require a signer", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "sendTransaction(fallback)" + }); + } + + var tx = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["shallowCopy"])(overrides || {}); + ["from", "to"].forEach(function (key) { + if (tx[key] == null) { + return; + } + + logger.throwError("cannot override " + key, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: key + }); + }); + tx.to = this.resolvedAddress; + return this.deployed().then(function () { + return _this9.signer.sendTransaction(tx); + }); + } // Reconnect to a different signer or provider + + }, { + key: "connect", + value: function connect(signerOrProvider) { + if (typeof signerOrProvider === "string") { + signerOrProvider = new _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__["VoidSigner"](signerOrProvider, this.provider); + } + + var contract = new this.constructor(this.address, this["interface"], signerOrProvider); + + if (this.deployTransaction) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(contract, "deployTransaction", this.deployTransaction); + } + + return contract; + } // Re-attach to a different on-chain instance of this contract + + }, { + key: "attach", + value: function attach(addressOrName) { + return new this.constructor(addressOrName, this["interface"], this.signer || this.provider); + } + }, { + key: "_normalizeRunningEvent", + value: function _normalizeRunningEvent(runningEvent) { + // Already have an instance of this event running; we can re-use it + if (this._runningEvents[runningEvent.tag]) { + return this._runningEvents[runningEvent.tag]; + } + + return runningEvent; + } + }, { + key: "_getRunningEvent", + value: function _getRunningEvent(eventName) { + if (typeof eventName === "string") { + // Listen for "error" events (if your contract has an error event, include + // the full signature to bypass this special event keyword) + if (eventName === "error") { + return this._normalizeRunningEvent(new ErrorRunningEvent()); + } // Listen for any event that is registered + + + if (eventName === "event") { + return this._normalizeRunningEvent(new RunningEvent("event", null)); + } // Listen for any event + + + if (eventName === "*") { + return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this["interface"])); + } // Get the event Fragment (throws if ambiguous/unknown event) + + + var fragment = this["interface"].getEvent(eventName); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this["interface"], fragment)); + } // We have topics to filter by... + + + if (eventName.topics && eventName.topics.length > 0) { + // Is it a known topichash? (throws if no matching topichash) + try { + var topic = eventName.topics[0]; + + if (typeof topic !== "string") { + throw new Error("invalid topic"); // @TODO: May happen for anonymous events + } + + var _fragment = this["interface"].getEvent(topic); + + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this["interface"], _fragment, eventName.topics)); + } catch (error) {} // Filter by the unknown topichash + + + var filter = { + address: this.address, + topics: eventName.topics + }; + return this._normalizeRunningEvent(new RunningEvent(getEventTag(filter), filter)); + } + + return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this["interface"])); + } + }, { + key: "_checkRunningEvents", + value: function _checkRunningEvents(runningEvent) { + if (runningEvent.listenerCount() === 0) { + delete this._runningEvents[runningEvent.tag]; // If we have a poller for this, remove it + + var emit = this._wrappedEmits[runningEvent.tag]; + + if (emit && runningEvent.filter) { + this.provider.off(runningEvent.filter, emit); + delete this._wrappedEmits[runningEvent.tag]; + } + } + } // Subclasses can override this to gracefully recover + // from parse errors if they wish + + }, { + key: "_wrapEvent", + value: function _wrapEvent(runningEvent, log, listener) { + var _this10 = this; + + var event = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["deepCopy"])(log); + + event.removeListener = function () { + if (!listener) { + return; + } + + runningEvent.removeListener(listener); + + _this10._checkRunningEvents(runningEvent); + }; + + event.getBlock = function () { + return _this10.provider.getBlock(log.blockHash); + }; + + event.getTransaction = function () { + return _this10.provider.getTransaction(log.transactionHash); + }; + + event.getTransactionReceipt = function () { + return _this10.provider.getTransactionReceipt(log.transactionHash); + }; // This may throw if the topics and data mismatch the signature + + + runningEvent.prepareEvent(event); + return event; + } + }, { + key: "_addEventListener", + value: function _addEventListener(runningEvent, listener, once) { + var _this11 = this; + + if (!this.provider) { + logger.throwError("events require a provider or a signer with a provider", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "once" + }); + } + + runningEvent.addListener(listener, once); // Track this running event and its listeners (may already be there; but no hard in updating) + + this._runningEvents[runningEvent.tag] = runningEvent; // If we are not polling the provider, start polling + + if (!this._wrappedEmits[runningEvent.tag]) { + var wrappedEmit = function wrappedEmit(log) { + var event = _this11._wrapEvent(runningEvent, log, listener); // Try to emit the result for the parameterized event... + + + if (event.decodeError == null) { + try { + var args = runningEvent.getEmit(event); + + _this11.emit.apply(_this11, [runningEvent.filter].concat(_toConsumableArray(args))); + } catch (error) { + event.decodeError = error.error; + } + } // Always emit "event" for fragment-base events + + + if (runningEvent.filter != null) { + _this11.emit("event", event); + } // Emit "error" if there was an error + + + if (event.decodeError != null) { + _this11.emit("error", event.decodeError, event); + } + }; + + this._wrappedEmits[runningEvent.tag] = wrappedEmit; // Special events, like "error" do not have a filter + + if (runningEvent.filter != null) { + this.provider.on(runningEvent.filter, wrappedEmit); + } + } + } + }, { + key: "queryFilter", + value: function queryFilter(event, fromBlockOrBlockhash, toBlock) { + var _this12 = this; + + var runningEvent = this._getRunningEvent(event); + + var filter = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["shallowCopy"])(runningEvent.filter); + + if (typeof fromBlockOrBlockhash === "string" && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__["isHexString"])(fromBlockOrBlockhash, 32)) { + if (toBlock != null) { + logger.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock); + } + + filter.blockHash = fromBlockOrBlockhash; + } else { + filter.fromBlock = fromBlockOrBlockhash != null ? fromBlockOrBlockhash : 0; + filter.toBlock = toBlock != null ? toBlock : "latest"; + } + + return this.provider.getLogs(filter).then(function (logs) { + return logs.map(function (log) { + return _this12._wrapEvent(runningEvent, log, null); + }); + }); + } + }, { + key: "on", + value: function on(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, false); + + return this; + } + }, { + key: "once", + value: function once(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, true); + + return this; + } + }, { + key: "emit", + value: function emit(eventName) { + if (!this.provider) { + return false; + } + + var runningEvent = this._getRunningEvent(eventName); + + for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { + args[_key6 - 1] = arguments[_key6]; + } + + var result = runningEvent.run(args) > 0; // May have drained all the "once" events; check for living events + + this._checkRunningEvents(runningEvent); + + return result; + } + }, { + key: "listenerCount", + value: function listenerCount(eventName) { + var _this13 = this; + + if (!this.provider) { + return 0; + } + + if (eventName == null) { + return Object.keys(this._runningEvents).reduce(function (accum, key) { + return accum + _this13._runningEvents[key].listenerCount(); + }, 0); + } + + return this._getRunningEvent(eventName).listenerCount(); + } + }, { + key: "listeners", + value: function listeners(eventName) { + var _this14 = this; + + if (!this.provider) { + return []; + } + + if (eventName == null) { + var _ret = function () { + var result = []; + + for (var tag in _this14._runningEvents) { + _this14._runningEvents[tag].listeners().forEach(function (listener) { + result.push(listener); + }); + } + + return { + v: result + }; + }(); + + if (_typeof(_ret) === "object") return _ret.v; + } + + return this._getRunningEvent(eventName).listeners(); + } + }, { + key: "removeAllListeners", + value: function removeAllListeners(eventName) { + if (!this.provider) { + return this; + } + + if (eventName == null) { + for (var tag in this._runningEvents) { + var _runningEvent = this._runningEvents[tag]; + + _runningEvent.removeAllListeners(); + + this._checkRunningEvents(_runningEvent); + } + + return this; + } // Delete any listeners + + + var runningEvent = this._getRunningEvent(eventName); + + runningEvent.removeAllListeners(); + + this._checkRunningEvents(runningEvent); + + return this; + } + }, { + key: "off", + value: function off(eventName, listener) { + if (!this.provider) { + return this; + } + + var runningEvent = this._getRunningEvent(eventName); + + runningEvent.removeListener(listener); + + this._checkRunningEvents(runningEvent); + + return this; + } + }, { + key: "removeListener", + value: function removeListener(eventName, listener) { + return this.off(eventName, listener); + } + }], [{ + key: "getContractAddress", + value: function getContractAddress(transaction) { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_3__["getContractAddress"])(transaction); + } + }, { + key: "getInterface", + value: function getInterface(contractInterface) { + if (_ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["Interface"].isInterface(contractInterface)) { + return contractInterface; + } + + return new _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["Interface"](contractInterface); + } + }, { + key: "isIndexed", + value: function isIndexed(value) { + return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["Indexed"].isIndexed(value); + } + }]); + + return BaseContract; +}(); +var Contract = /*#__PURE__*/function (_BaseContract) { + _inherits(Contract, _BaseContract); + + var _super4 = _createSuper(Contract); + + function Contract() { + _classCallCheck(this, Contract); + + return _super4.apply(this, arguments); + } + + return _createClass(Contract); +}(BaseContract); +var ContractFactory = /*#__PURE__*/function () { + function ContractFactory(contractInterface, bytecode, signer) { + _classCallCheck(this, ContractFactory); + + var bytecodeHex = null; + + if (typeof bytecode === "string") { + bytecodeHex = bytecode; + } else if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__["isBytes"])(bytecode)) { + bytecodeHex = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__["hexlify"])(bytecode); + } else if (bytecode && typeof bytecode.object === "string") { + // Allow the bytecode object from the Solidity compiler + bytecodeHex = bytecode.object; + } else { + // Crash in the next verification step + bytecodeHex = "!"; + } // Make sure it is 0x prefixed + + + if (bytecodeHex.substring(0, 2) !== "0x") { + bytecodeHex = "0x" + bytecodeHex; + } // Make sure the final result is valid bytecode + + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__["isHexString"])(bytecodeHex) || bytecodeHex.length % 2) { + logger.throwArgumentError("invalid bytecode", "bytecode", bytecode); + } // If we have a signer, make sure it is valid + + + if (signer && !_ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__["Signer"].isSigner(signer)) { + logger.throwArgumentError("invalid signer", "signer", signer); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "bytecode", bytecodeHex); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "interface", Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["getStatic"])(this instanceof ContractFactory ? this.constructor : void 0, "getInterface")(contractInterface)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(this, "signer", signer || null); + } // @TODO: Future; rename to populateTransaction? + + + _createClass(ContractFactory, [{ + key: "getDeployTransaction", + value: function getDeployTransaction() { + var tx = {}; // If we have 1 additional argument, we allow transaction overrides + + for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + args[_key7] = arguments[_key7]; + } + + if (args.length === this["interface"].deploy.inputs.length + 1 && _typeof(args[args.length - 1]) === "object") { + tx = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["shallowCopy"])(args.pop()); + + for (var key in tx) { + if (!allowedTransactionKeys[key]) { + throw new Error("unknown transaction override " + key); + } + } + } // Do not allow these to be overridden in a deployment transaction + + + ["data", "from", "to"].forEach(function (key) { + if (tx[key] == null) { + return; + } + + logger.throwError("cannot override " + key, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: key + }); + }); + + if (tx.value) { + var value = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_4__["BigNumber"].from(tx.value); + + if (!value.isZero() && !this["interface"].deploy.payable) { + logger.throwError("non-payable constructor cannot override value", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: tx.value + }); + } + } // Make sure the call matches the constructor signature + + + logger.checkArgumentCount(args.length, this["interface"].deploy.inputs.length, " in Contract constructor"); // Set the data to the bytecode + the encoded constructor arguments + + tx.data = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__["hexlify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_5__["concat"])([this.bytecode, this["interface"].encodeDeploy(args)])); + return tx; + } + }, { + key: "deploy", + value: function deploy() { + for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { + args[_key8] = arguments[_key8]; + } + + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee8() { + var overrides, params, unsignedTx, tx, address, contract; + return regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + overrides = {}; // If 1 extra parameter was passed in, it contains overrides + + if (args.length === this["interface"].deploy.inputs.length + 1) { + overrides = args.pop(); + } // Make sure the call matches the constructor signature + + + logger.checkArgumentCount(args.length, this["interface"].deploy.inputs.length, " in Contract constructor"); // Resolve ENS names and promises in the arguments + + _context8.next = 5; + return resolveAddresses(this.signer, args, this["interface"].deploy.inputs); + + case 5: + params = _context8.sent; + params.push(overrides); // Get the deployment transaction (with optional overrides) + + unsignedTx = this.getDeployTransaction.apply(this, _toConsumableArray(params)); // Send the deployment transaction + + _context8.next = 10; + return this.signer.sendTransaction(unsignedTx); + + case 10: + tx = _context8.sent; + address = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["getStatic"])(this.constructor, "getContractAddress")(tx); + contract = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["getStatic"])(this.constructor, "getContract")(address, this["interface"], this.signer); // Add the modified wait that wraps events + + addContractWait(contract, tx); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["defineReadOnly"])(contract, "deployTransaction", tx); + return _context8.abrupt("return", contract); + + case 16: + case "end": + return _context8.stop(); + } + } + }, _callee8, this); + })); + } + }, { + key: "attach", + value: function attach(address) { + return this.constructor.getContract(address, this["interface"], this.signer); + } + }, { + key: "connect", + value: function connect(signer) { + return new this.constructor(this["interface"], this.bytecode, signer); + } + }], [{ + key: "fromSolidity", + value: function fromSolidity(compilerOutput, signer) { + if (compilerOutput == null) { + logger.throwError("missing compiler output", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.MISSING_ARGUMENT, { + argument: "compilerOutput" + }); + } + + if (typeof compilerOutput === "string") { + compilerOutput = JSON.parse(compilerOutput); + } + + var abi = compilerOutput.abi; + var bytecode = null; + + if (compilerOutput.bytecode) { + bytecode = compilerOutput.bytecode; + } else if (compilerOutput.evm && compilerOutput.evm.bytecode) { + bytecode = compilerOutput.evm.bytecode; + } + + return new this(abi, bytecode, signer); + } + }, { + key: "getInterface", + value: function getInterface(contractInterface) { + return Contract.getInterface(contractInterface); + } + }, { + key: "getContractAddress", + value: function getContractAddress(tx) { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_3__["getContractAddress"])(tx); + } + }, { + key: "getContract", + value: function getContract(address, contractInterface, signer) { + return new Contract(address, contractInterface, signer); + } + }]); + + return ContractFactory; +}(); + +/***/ }), + +/***/ "./node_modules/@ethersproject/hash/lib.esm/_version.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/hash/lib.esm/_version.js ***! + \**************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "hash/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/hash/lib.esm/id.js": +/*!********************************************************!*\ + !*** ./node_modules/@ethersproject/hash/lib.esm/id.js ***! + \********************************************************/ +/*! exports provided: id */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "id", function() { return id; }); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); + + +function id(text) { + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_0__["keccak256"])(Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__["toUtf8Bytes"])(text)); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/hash/lib.esm/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@ethersproject/hash/lib.esm/index.js ***! + \***********************************************************/ +/*! exports provided: id, namehash, isValidName, messagePrefix, hashMessage, _TypedDataEncoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _id__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./id */ "./node_modules/@ethersproject/hash/lib.esm/id.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "id", function() { return _id__WEBPACK_IMPORTED_MODULE_0__["id"]; }); + +/* harmony import */ var _namehash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./namehash */ "./node_modules/@ethersproject/hash/lib.esm/namehash.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "namehash", function() { return _namehash__WEBPACK_IMPORTED_MODULE_1__["namehash"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidName", function() { return _namehash__WEBPACK_IMPORTED_MODULE_1__["isValidName"]; }); + +/* harmony import */ var _message__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./message */ "./node_modules/@ethersproject/hash/lib.esm/message.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "messagePrefix", function() { return _message__WEBPACK_IMPORTED_MODULE_2__["messagePrefix"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hashMessage", function() { return _message__WEBPACK_IMPORTED_MODULE_2__["hashMessage"]; }); + +/* harmony import */ var _typed_data__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./typed-data */ "./node_modules/@ethersproject/hash/lib.esm/typed-data.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_TypedDataEncoder", function() { return _typed_data__WEBPACK_IMPORTED_MODULE_3__["TypedDataEncoder"]; }); + + + + + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/hash/lib.esm/message.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/hash/lib.esm/message.js ***! + \*************************************************************/ +/*! exports provided: messagePrefix, hashMessage */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "messagePrefix", function() { return messagePrefix; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hashMessage", function() { return hashMessage; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); + + + +var messagePrefix = "\x19Ethereum Signed Message:\n"; +function hashMessage(message) { + if (typeof message === "string") { + message = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__["toUtf8Bytes"])(message); + } + + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_1__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["concat"])([Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__["toUtf8Bytes"])(messagePrefix), Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_2__["toUtf8Bytes"])(String(message.length)), message])); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/hash/lib.esm/namehash.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/hash/lib.esm/namehash.js ***! + \**************************************************************/ +/*! exports provided: isValidName, namehash */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidName", function() { return isValidName; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "namehash", function() { return namehash; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/hash/lib.esm/_version.js"); + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"](_version__WEBPACK_IMPORTED_MODULE_4__["version"]); +var Zeros = new Uint8Array(32); +Zeros.fill(0); +var Partition = new RegExp("^((.*)\\.)?([^.]+)$"); +function isValidName(name) { + try { + var comps = name.split("."); + + for (var i = 0; i < comps.length; i++) { + if (Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__["nameprep"])(comps[i]).length === 0) { + throw new Error("empty"); + } + } + + return true; + } catch (error) {} + + return false; +} +function namehash(name) { + /* istanbul ignore if */ + if (typeof name !== "string") { + logger.throwArgumentError("invalid ENS name; not a string", "name", name); + } + + var current = name; + var result = Zeros; + + while (current.length) { + var partition = current.match(Partition); + + if (partition == null || partition[2] === "") { + logger.throwArgumentError("invalid ENS address; missing component", "name", name); + } + + var label = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__["toUtf8Bytes"])(Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__["nameprep"])(partition[3])); + result = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["concat"])([result, Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__["keccak256"])(label)])); + current = partition[2] || ""; + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(result); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/hash/lib.esm/typed-data.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/hash/lib.esm/typed-data.js ***! + \****************************************************************/ +/*! exports provided: TypedDataEncoder */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TypedDataEncoder", function() { return TypedDataEncoder; }); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/hash/lib.esm/_version.js"); +/* harmony import */ var _id__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./id */ "./node_modules/@ethersproject/hash/lib.esm/id.js"); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"](_version__WEBPACK_IMPORTED_MODULE_6__["version"]); + +var padding = new Uint8Array(32); +padding.fill(0); +var NegativeOne = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(-1); +var Zero = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(0); +var One = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(1); +var MaxUint256 = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + +function hexPadRight(value) { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(value); + var padOffset = bytes.length % 32; + + if (padOffset) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexConcat"])([bytes, padding.slice(padOffset)]); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(bytes); +} + +var hexTrue = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(One.toHexString(), 32); +var hexFalse = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(Zero.toHexString(), 32); +var domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; +var domainFieldNames = ["name", "version", "chainId", "verifyingContract", "salt"]; + +function checkString(key) { + return function (value) { + if (typeof value !== "string") { + logger.throwArgumentError("invalid domain value for ".concat(JSON.stringify(key)), "domain.".concat(key), value); + } + + return value; + }; +} + +var domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function chainId(value) { + try { + return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value).toString(); + } catch (error) {} + + return logger.throwArgumentError("invalid domain value for \"chainId\"", "domain.chainId", value); + }, + verifyingContract: function verifyingContract(value) { + try { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(value).toLowerCase(); + } catch (error) {} + + return logger.throwArgumentError("invalid domain value \"verifyingContract\"", "domain.verifyingContract", value); + }, + salt: function salt(value) { + try { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(value); + + if (bytes.length !== 32) { + throw new Error("bad length"); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(bytes); + } catch (error) {} + + return logger.throwArgumentError("invalid domain value \"salt\"", "domain.salt", value); + } +}; + +function getBaseEncoder(type) { + // intXX and uintXX + { + var match = type.match(/^(u?)int(\d*)$/); + + if (match) { + var signed = match[1] === ""; + var width = parseInt(match[2] || "256"); + + if (width % 8 !== 0 || width > 256 || match[2] && match[2] !== String(width)) { + logger.throwArgumentError("invalid numeric width", "type", type); + } + + var boundsUpper = MaxUint256.mask(signed ? width - 1 : width); + var boundsLower = signed ? boundsUpper.add(One).mul(NegativeOne) : Zero; + return function (value) { + var v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value); + + if (v.lt(boundsLower) || v.gt(boundsUpper)) { + logger.throwArgumentError("value out-of-bounds for ".concat(type), "value", value); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(v.toTwos(256).toHexString(), 32); + }; + } + } // bytesXX + + { + var _match = type.match(/^bytes(\d+)$/); + + if (_match) { + var _width = parseInt(_match[1]); + + if (_width === 0 || _width > 32 || _match[1] !== String(_width)) { + logger.throwArgumentError("invalid bytes width", "type", type); + } + + return function (value) { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(value); + + if (bytes.length !== _width) { + logger.throwArgumentError("invalid length for ".concat(type), "value", value); + } + + return hexPadRight(value); + }; + } + } + + switch (type) { + case "address": + return function (value) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(value), 32); + }; + + case "bool": + return function (value) { + return !value ? hexFalse : hexTrue; + }; + + case "bytes": + return function (value) { + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__["keccak256"])(value); + }; + + case "string": + return function (value) { + return Object(_id__WEBPACK_IMPORTED_MODULE_7__["id"])(value); + }; + } + + return null; +} + +function encodeType(name, fields) { + return "".concat(name, "(").concat(fields.map(function (_ref) { + var name = _ref.name, + type = _ref.type; + return type + " " + name; + }).join(","), ")"); +} + +var TypedDataEncoder = /*#__PURE__*/function () { + function TypedDataEncoder(types) { + _classCallCheck(this, TypedDataEncoder); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(this, "types", Object.freeze(Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["deepCopy"])(types))); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(this, "_encoderCache", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(this, "_types", {}); // Link struct types to their direct child structs + + var links = {}; // Link structs to structs which contain them as a child + + var parents = {}; // Link all subtypes within a given struct + + var subtypes = {}; + Object.keys(types).forEach(function (type) { + links[type] = {}; + parents[type] = []; + subtypes[type] = {}; + }); + + var _loop = function _loop(name) { + var uniqueNames = {}; + types[name].forEach(function (field) { + // Check each field has a unique name + if (uniqueNames[field.name]) { + logger.throwArgumentError("duplicate variable name ".concat(JSON.stringify(field.name), " in ").concat(JSON.stringify(name)), "types", types); + } + + uniqueNames[field.name] = true; // Get the base type (drop any array specifiers) + + var baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; + + if (baseType === name) { + logger.throwArgumentError("circular type reference to ".concat(JSON.stringify(baseType)), "types", types); + } // Is this a base encoding type? + + + var encoder = getBaseEncoder(baseType); + + if (encoder) { + return; + } + + if (!parents[baseType]) { + logger.throwArgumentError("unknown type ".concat(JSON.stringify(baseType)), "types", types); + } // Add linkage + + + parents[baseType].push(name); + links[name][baseType] = true; + }); + }; + + for (var name in types) { + _loop(name); + } // Deduce the primary type + + + var primaryTypes = Object.keys(parents).filter(function (n) { + return parents[n].length === 0; + }); + + if (primaryTypes.length === 0) { + logger.throwArgumentError("missing primary type", "types", types); + } else if (primaryTypes.length > 1) { + logger.throwArgumentError("ambiguous primary types or unused types: ".concat(primaryTypes.map(function (t) { + return JSON.stringify(t); + }).join(", ")), "types", types); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(this, "primaryType", primaryTypes[0]); // Check for circular type references + + function checkCircular(type, found) { + if (found[type]) { + logger.throwArgumentError("circular type reference to ".concat(JSON.stringify(type)), "types", types); + } + + found[type] = true; + Object.keys(links[type]).forEach(function (child) { + if (!parents[child]) { + return; + } // Recursively check children + + + checkCircular(child, found); // Mark all ancestors as having this decendant + + Object.keys(found).forEach(function (subtype) { + subtypes[subtype][child] = true; + }); + }); + delete found[type]; + } + + checkCircular(this.primaryType, {}); // Compute each fully describe type + + for (var _name in subtypes) { + var st = Object.keys(subtypes[_name]); + st.sort(); + this._types[_name] = encodeType(_name, types[_name]) + st.map(function (t) { + return encodeType(t, types[t]); + }).join(""); + } + } + + _createClass(TypedDataEncoder, [{ + key: "getEncoder", + value: function getEncoder(type) { + var encoder = this._encoderCache[type]; + + if (!encoder) { + encoder = this._encoderCache[type] = this._getEncoder(type); + } + + return encoder; + } + }, { + key: "_getEncoder", + value: function _getEncoder(type) { + var _this = this; + + // Basic encoder type (address, bool, uint256, etc) + { + var encoder = getBaseEncoder(type); + + if (encoder) { + return encoder; + } + } // Array + + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + + if (match) { + var subtype = match[1]; + var subEncoder = this.getEncoder(subtype); + var length = parseInt(match[3]); + return function (value) { + if (length >= 0 && value.length !== length) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + + var result = value.map(subEncoder); + + if (_this._types[subtype]) { + result = result.map(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__["keccak256"]); + } + + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexConcat"])(result)); + }; + } // Struct + + + var fields = this.types[type]; + + if (fields) { + var encodedType = Object(_id__WEBPACK_IMPORTED_MODULE_7__["id"])(this._types[type]); + return function (value) { + var values = fields.map(function (_ref2) { + var name = _ref2.name, + type = _ref2.type; + + var result = _this.getEncoder(type)(value[name]); + + if (_this._types[type]) { + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__["keccak256"])(result); + } + + return result; + }); + values.unshift(encodedType); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexConcat"])(values); + }; + } + + return logger.throwArgumentError("unknown type: ".concat(type), "type", type); + } + }, { + key: "encodeType", + value: function encodeType(name) { + var result = this._types[name]; + + if (!result) { + logger.throwArgumentError("unknown type: ".concat(JSON.stringify(name)), "name", name); + } + + return result; + } + }, { + key: "encodeData", + value: function encodeData(type, value) { + return this.getEncoder(type)(value); + } + }, { + key: "hashStruct", + value: function hashStruct(name, value) { + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__["keccak256"])(this.encodeData(name, value)); + } + }, { + key: "encode", + value: function encode(value) { + return this.encodeData(this.primaryType, value); + } + }, { + key: "hash", + value: function hash(value) { + return this.hashStruct(this.primaryType, value); + } + }, { + key: "_visit", + value: function _visit(type, value, callback) { + var _this2 = this; + + // Basic encoder type (address, bool, uint256, etc) + { + var encoder = getBaseEncoder(type); + + if (encoder) { + return callback(type, value); + } + } // Array + + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + + if (match) { + var subtype = match[1]; + var length = parseInt(match[3]); + + if (length >= 0 && value.length !== length) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + + return value.map(function (v) { + return _this2._visit(subtype, v, callback); + }); + } // Struct + + + var fields = this.types[type]; + + if (fields) { + return fields.reduce(function (accum, _ref3) { + var name = _ref3.name, + type = _ref3.type; + accum[name] = _this2._visit(type, value[name], callback); + return accum; + }, {}); + } + + return logger.throwArgumentError("unknown type: ".concat(type), "type", type); + } + }, { + key: "visit", + value: function visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + }], [{ + key: "from", + value: function from(types) { + return new TypedDataEncoder(types); + } + }, { + key: "getPrimaryType", + value: function getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + }, { + key: "hashStruct", + value: function hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + }, { + key: "hashDomain", + value: function hashDomain(domain) { + var domainFields = []; + + for (var name in domain) { + var type = domainFieldTypes[name]; + + if (!type) { + logger.throwArgumentError("invalid typed-data domain key: ".concat(JSON.stringify(name)), "domain", domain); + } + + domainFields.push({ + name: name, + type: type + }); + } + + domainFields.sort(function (a, b) { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { + EIP712Domain: domainFields + }, domain); + } + }, { + key: "encode", + value: function encode(domain, types, value) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexConcat"])(["0x1901", TypedDataEncoder.hashDomain(domain), TypedDataEncoder.from(types).hash(value)]); + } + }, { + key: "hash", + value: function hash(domain, types, value) { + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__["keccak256"])(TypedDataEncoder.encode(domain, types, value)); + } // Replaces all address types with ENS names with their looked up address + + }, { + key: "resolveNames", + value: function resolveNames(domain, types, value, resolveName) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var ensCache, encoder, name; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + // Make a copy to isolate it from the object passed in + domain = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(domain); // Look up all ENS names + + ensCache = {}; // Do we need to look up the domain's verifyingContract? + + if (domain.verifyingContract && !Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } // We are going to use the encoder to visit all the base values + + + encoder = TypedDataEncoder.from(types); // Get a list of all the addresses + + encoder.visit(value, function (type, value) { + if (type === "address" && !Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(value, 20)) { + ensCache[value] = "0x"; + } + + return value; + }); // Lookup each name + + _context.t0 = regeneratorRuntime.keys(ensCache); + + case 6: + if ((_context.t1 = _context.t0()).done) { + _context.next = 13; + break; + } + + name = _context.t1.value; + _context.next = 10; + return resolveName(name); + + case 10: + ensCache[name] = _context.sent; + _context.next = 6; + break; + + case 13: + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } // Replace all ENS names with their address + + + value = encoder.visit(value, function (type, value) { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + + return value; + }); + return _context.abrupt("return", { + domain: domain, + value: value + }); + + case 16: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + } + }, { + key: "getPayload", + value: function getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); // Derive the EIP712Domain Struct reference type + + var domainValues = {}; + var domainTypes = []; + domainFieldNames.forEach(function (name) { + var value = domain[name]; + + if (value == null) { + return; + } + + domainValues[name] = domainChecks[name](value); + domainTypes.push({ + name: name, + type: domainFieldTypes[name] + }); + }); + var encoder = TypedDataEncoder.from(types); + var typesWithDomain = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(types); + + if (typesWithDomain.EIP712Domain) { + logger.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + } else { + typesWithDomain.EIP712Domain = domainTypes; + } // Validate the data structures and types + + + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, function (type, value) { + // bytes + if (type.match(/^bytes(\d*)/)) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(value)); + } // uint or int + + + if (type.match(/^u?int/)) { + return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value).toString(); + } + + switch (type) { + case "address": + return value.toLowerCase(); + + case "bool": + return !!value; + + case "string": + if (typeof value !== "string") { + logger.throwArgumentError("invalid string", "value", value); + } + + return value; + } + + return logger.throwArgumentError("unsupported type", "type", type); + }) + }; + } + }]); + + return TypedDataEncoder; +}(); + +/***/ }), + +/***/ "./node_modules/@ethersproject/hdnode/lib.esm/_version.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/hdnode/lib.esm/_version.js ***! + \****************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "hdnode/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/hdnode/lib.esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/hdnode/lib.esm/index.js ***! + \*************************************************************/ +/*! exports provided: defaultPath, HDNode, mnemonicToSeed, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, getAccountPath */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultPath", function() { return defaultPath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HDNode", function() { return HDNode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mnemonicToSeed", function() { return mnemonicToSeed; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mnemonicToEntropy", function() { return mnemonicToEntropy; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "entropyToMnemonic", function() { return entropyToMnemonic; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidMnemonic", function() { return isValidMnemonic; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAccountPath", function() { return getAccountPath; }); +/* harmony import */ var _ethersproject_basex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/basex */ "./node_modules/@ethersproject/basex/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/pbkdf2 */ "./node_modules/@ethersproject/pbkdf2/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/signing-key */ "./node_modules/@ethersproject/signing-key/lib.esm/index.js"); +/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/index.js"); +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony import */ var _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/wordlists */ "./node_modules/@ethersproject/wordlists/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/hdnode/lib.esm/_version.js"); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_10__["Logger"](_version__WEBPACK_IMPORTED_MODULE_11__["version"]); +var N = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); // "Bitcoin seed" + +var MasterSecret = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["toUtf8Bytes"])("Bitcoin seed"); +var HardenedBit = 0x80000000; // Returns a byte with the MSB bits set + +function getUpperMask(bits) { + return (1 << bits) - 1 << 8 - bits; +} // Returns a byte with the LSB bits set + + +function getLowerMask(bits) { + return (1 << bits) - 1; +} + +function bytes32(value) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexZeroPad"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(value), 32); +} + +function base58check(data) { + return _ethersproject_basex__WEBPACK_IMPORTED_MODULE_0__["Base58"].encode(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["concat"])([data, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexDataSlice"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["sha256"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["sha256"])(data)), 0, 4)])); +} + +function getWordlist(wordlist) { + if (wordlist == null) { + return _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_9__["wordlists"]["en"]; + } + + if (typeof wordlist === "string") { + var words = _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_9__["wordlists"][wordlist]; + + if (words == null) { + logger.throwArgumentError("unknown locale", "wordlist", wordlist); + } + + return words; + } + + return wordlist; +} + +var _constructorGuard = {}; +var defaultPath = "m/44'/60'/0'/0/0"; +; +var HDNode = /*#__PURE__*/function () { + /** + * This constructor should not be called directly. + * + * Please use: + * - fromMnemonic + * - fromSeed + */ + function HDNode(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath) { + _classCallCheck(this, HDNode); + + logger.checkNew(this instanceof HDNode ? this.constructor : void 0, HDNode); + /* istanbul ignore if */ + + if (constructorGuard !== _constructorGuard) { + throw new Error("HDNode constructor cannot be called directly"); + } + + if (privateKey) { + var signingKey = new _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_6__["SigningKey"](privateKey); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "privateKey", signingKey.privateKey); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "publicKey", signingKey.compressedPublicKey); + } else { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "privateKey", null); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "publicKey", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(publicKey)); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "parentFingerprint", parentFingerprint); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "fingerprint", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexDataSlice"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["ripemd160"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["sha256"])(this.publicKey)), 0, 4)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "address", Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_8__["computeAddress"])(this.publicKey)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "chainCode", chainCode); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "index", index); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "depth", depth); + + if (mnemonicOrPath == null) { + // From a source that does not preserve the path (e.g. extended keys) + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "mnemonic", null); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "path", null); + } else if (typeof mnemonicOrPath === "string") { + // From a source that does not preserve the mnemonic (e.g. neutered) + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "mnemonic", null); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "path", mnemonicOrPath); + } else { + // From a fully qualified source + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "mnemonic", mnemonicOrPath); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["defineReadOnly"])(this, "path", mnemonicOrPath.path); + } + } + + _createClass(HDNode, [{ + key: "extendedKey", + get: function get() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + if (this.depth >= 256) { + throw new Error("Depth too large!"); + } + + return base58check(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["concat"])([this.privateKey != null ? "0x0488ADE4" : "0x0488B21E", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(this.depth), this.parentFingerprint, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexZeroPad"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(this.index), 4), this.chainCode, this.privateKey != null ? Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["concat"])(["0x00", this.privateKey]) : this.publicKey])); + } + }, { + key: "neuter", + value: function neuter() { + return new HDNode(_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path); + } + }, { + key: "_derive", + value: function _derive(index) { + if (index > 0xffffffff) { + throw new Error("invalid index - " + String(index)); + } // Base path + + + var path = this.path; + + if (path) { + path += "/" + (index & ~HardenedBit); + } + + var data = new Uint8Array(37); + + if (index & HardenedBit) { + if (!this.privateKey) { + throw new Error("cannot derive child of neutered node"); + } // Data = 0x00 || ser_256(k_par) + + + data.set(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(this.privateKey), 1); // Hardened path + + if (path) { + path += "'"; + } + } else { + // Data = ser_p(point(k_par)) + data.set(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(this.publicKey)); + } // Data += ser_32(i) + + + for (var i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = index >> 24 - i & 0xff; + } + + var I = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["computeHmac"])(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["SupportedAlgorithm"].sha512, this.chainCode, data)); + var IL = I.slice(0, 32); + var IR = I.slice(32); // The private key + + var ki = null; // The public key + + var Ki = null; + + if (this.privateKey) { + ki = bytes32(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(IL).add(this.privateKey).mod(N)); + } else { + var ek = new _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_6__["SigningKey"](Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(IL)); + Ki = ek._addPoint(this.publicKey); + } + + var mnemonicOrPath = path; + var srcMnemonic = this.mnemonic; + + if (srcMnemonic) { + mnemonicOrPath = Object.freeze({ + phrase: srcMnemonic.phrase, + path: path, + locale: srcMnemonic.locale || "en" + }); + } + + return new HDNode(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath); + } + }, { + key: "derivePath", + value: function derivePath(path) { + var components = path.split("/"); + + if (components.length === 0 || components[0] === "m" && this.depth !== 0) { + throw new Error("invalid path - " + path); + } + + if (components[0] === "m") { + components.shift(); + } + + var result = this; + + for (var i = 0; i < components.length; i++) { + var component = components[i]; + + if (component.match(/^[0-9]+'$/)) { + var index = parseInt(component.substring(0, component.length - 1)); + + if (index >= HardenedBit) { + throw new Error("invalid path index - " + component); + } + + result = result._derive(HardenedBit + index); + } else if (component.match(/^[0-9]+$/)) { + var _index = parseInt(component); + + if (_index >= HardenedBit) { + throw new Error("invalid path index - " + component); + } + + result = result._derive(_index); + } else { + throw new Error("invalid path component - " + component); + } + } + + return result; + } + }], [{ + key: "_fromSeed", + value: function _fromSeed(seed, mnemonic) { + var seedArray = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(seed); + + if (seedArray.length < 16 || seedArray.length > 64) { + throw new Error("invalid seed"); + } + + var I = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["computeHmac"])(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["SupportedAlgorithm"].sha512, MasterSecret, seedArray)); + return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic); + } + }, { + key: "fromMnemonic", + value: function fromMnemonic(mnemonic, password, wordlist) { + // If a locale name was passed in, find the associated wordlist + wordlist = getWordlist(wordlist); // Normalize the case and spacing in the mnemonic (throws if the mnemonic is invalid) + + mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist); + return HDNode._fromSeed(mnemonicToSeed(mnemonic, password), { + phrase: mnemonic, + path: "m", + locale: wordlist.locale + }); + } + }, { + key: "fromSeed", + value: function fromSeed(seed) { + return HDNode._fromSeed(seed, null); + } + }, { + key: "fromExtendedKey", + value: function fromExtendedKey(extendedKey) { + var bytes = _ethersproject_basex__WEBPACK_IMPORTED_MODULE_0__["Base58"].decode(extendedKey); + + if (bytes.length !== 82 || base58check(bytes.slice(0, 78)) !== extendedKey) { + logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + } + + var depth = bytes[4]; + var parentFingerprint = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(bytes.slice(5, 9)); + var index = parseInt(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(bytes.slice(9, 13)).substring(2), 16); + var chainCode = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(bytes.slice(13, 45)); + var key = bytes.slice(45, 78); + + switch (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": + case "0x043587cf": + return new HDNode(_constructorGuard, null, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(key), parentFingerprint, chainCode, index, depth, null); + // Private Key + + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + + return new HDNode(_constructorGuard, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null); + } + + return logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + } + }]); + + return HDNode; +}(); +function mnemonicToSeed(mnemonic, password) { + if (!password) { + password = ""; + } + + var salt = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["toUtf8Bytes"])("mnemonic" + password, _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["UnicodeNormalizationForm"].NFKD); + return Object(_ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_4__["pbkdf2"])(Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["toUtf8Bytes"])(mnemonic, _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["UnicodeNormalizationForm"].NFKD), salt, 2048, 64, "sha512"); +} +function mnemonicToEntropy(mnemonic, wordlist) { + wordlist = getWordlist(wordlist); + logger.checkNormalize(); + var words = wordlist.split(mnemonic); + + if (words.length % 3 !== 0) { + throw new Error("invalid mnemonic"); + } + + var entropy = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(new Uint8Array(Math.ceil(11 * words.length / 8))); + var offset = 0; + + for (var i = 0; i < words.length; i++) { + var index = wordlist.getWordIndex(words[i].normalize("NFKD")); + + if (index === -1) { + throw new Error("invalid mnemonic"); + } + + for (var bit = 0; bit < 11; bit++) { + if (index & 1 << 10 - bit) { + entropy[offset >> 3] |= 1 << 7 - offset % 8; + } + + offset++; + } + } + + var entropyBits = 32 * words.length / 3; + var checksumBits = words.length / 3; + var checksumMask = getUpperMask(checksumBits); + var checksum = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["sha256"])(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + + if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { + throw new Error("invalid checksum"); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(entropy.slice(0, entropyBits / 8)); +} +function entropyToMnemonic(entropy, wordlist) { + wordlist = getWordlist(wordlist); + entropy = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(entropy); + + if (entropy.length % 4 !== 0 || entropy.length < 16 || entropy.length > 32) { + throw new Error("invalid entropy"); + } + + var indices = [0]; + var remainingBits = 11; + + for (var i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; // This byte will complete an 11-bit index + } else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> 8 - remainingBits; // Start the next word + + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } // Compute the checksum bits + + + var checksumBits = entropy.length / 4; + var checksum = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_7__["sha256"])(entropy))[0] & getUpperMask(checksumBits); // Shift the checksum into the word indices + + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= checksum >> 8 - checksumBits; + return wordlist.join(indices.map(function (index) { + return wordlist.getWord(index); + })); +} +function isValidMnemonic(mnemonic, wordlist) { + try { + mnemonicToEntropy(mnemonic, wordlist); + return true; + } catch (error) {} + + return false; +} +function getAccountPath(index) { + if (typeof index !== "number" || index < 0 || index >= HardenedBit || index % 1) { + logger.throwArgumentError("invalid account index", "index", index); + } + + return "m/44'/60'/".concat(index, "'/0/0"); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/json-wallets/lib.esm/_version.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@ethersproject/json-wallets/lib.esm/_version.js ***! + \**********************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "json-wallets/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/json-wallets/lib.esm/crowdsale.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@ethersproject/json-wallets/lib.esm/crowdsale.js ***! + \***********************************************************************/ +/*! exports provided: CrowdsaleAccount, decrypt */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CrowdsaleAccount", function() { return CrowdsaleAccount; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decrypt", function() { return decrypt; }); +/* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! aes-js */ "./node_modules/aes-js/index.js"); +/* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aes_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/pbkdf2 */ "./node_modules/@ethersproject/pbkdf2/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/json-wallets/lib.esm/_version.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./utils */ "./node_modules/@ethersproject/json-wallets/lib.esm/utils.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_7__["Logger"](_version__WEBPACK_IMPORTED_MODULE_8__["version"]); + +var CrowdsaleAccount = /*#__PURE__*/function (_Description) { + _inherits(CrowdsaleAccount, _Description); + + var _super = _createSuper(CrowdsaleAccount); + + function CrowdsaleAccount() { + _classCallCheck(this, CrowdsaleAccount); + + return _super.apply(this, arguments); + } + + _createClass(CrowdsaleAccount, [{ + key: "isCrowdsaleAccount", + value: function isCrowdsaleAccount(value) { + return !!(value && value._isCrowdsaleAccount); + } + }]); + + return CrowdsaleAccount; +}(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_6__["Description"]); // See: https://github.com/ethereum/pyethsaletool + +function decrypt(json, password) { + var data = JSON.parse(json); + password = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["getPassword"])(password); // Ethereum Address + + var ethaddr = Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_1__["getAddress"])(Object(_utils__WEBPACK_IMPORTED_MODULE_9__["searchPath"])(data, "ethaddr")); // Encrypted Seed + + var encseed = Object(_utils__WEBPACK_IMPORTED_MODULE_9__["looseArrayify"])(Object(_utils__WEBPACK_IMPORTED_MODULE_9__["searchPath"])(data, "encseed")); + + if (!encseed || encseed.length % 16 !== 0) { + logger.throwArgumentError("invalid encseed", "json", json); + } + + var key = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(Object(_ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_4__["pbkdf2"])(password, password, 2000, 32, "sha256")).slice(0, 16); + var iv = encseed.slice(0, 16); + var encryptedSeed = encseed.slice(16); // Decrypt the seed + + var aesCbc = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.ModeOfOperation.cbc(key, iv); + var seed = aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.padding.pkcs7.strip(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(aesCbc.decrypt(encryptedSeed))); // This wallet format is weird... Convert the binary encoded hex to a string. + + var seedHex = ""; + + for (var i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + + var seedHexBytes = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_5__["toUtf8Bytes"])(seedHex); + var privateKey = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_3__["keccak256"])(seedHexBytes); + return new CrowdsaleAccount({ + _isCrowdsaleAccount: true, + address: ethaddr, + privateKey: privateKey + }); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/json-wallets/lib.esm/index.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/json-wallets/lib.esm/index.js ***! + \*******************************************************************/ +/*! exports provided: decryptCrowdsale, decryptKeystore, decryptKeystoreSync, encryptKeystore, isCrowdsaleWallet, isKeystoreWallet, getJsonWalletAddress, decryptJsonWallet, decryptJsonWalletSync */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decryptJsonWallet", function() { return decryptJsonWallet; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decryptJsonWalletSync", function() { return decryptJsonWalletSync; }); +/* harmony import */ var _crowdsale__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./crowdsale */ "./node_modules/@ethersproject/json-wallets/lib.esm/crowdsale.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "decryptCrowdsale", function() { return _crowdsale__WEBPACK_IMPORTED_MODULE_0__["decrypt"]; }); + +/* harmony import */ var _inspect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./inspect */ "./node_modules/@ethersproject/json-wallets/lib.esm/inspect.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isCrowdsaleWallet", function() { return _inspect__WEBPACK_IMPORTED_MODULE_1__["isCrowdsaleWallet"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isKeystoreWallet", function() { return _inspect__WEBPACK_IMPORTED_MODULE_1__["isKeystoreWallet"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getJsonWalletAddress", function() { return _inspect__WEBPACK_IMPORTED_MODULE_1__["getJsonWalletAddress"]; }); + +/* harmony import */ var _keystore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keystore */ "./node_modules/@ethersproject/json-wallets/lib.esm/keystore.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "decryptKeystore", function() { return _keystore__WEBPACK_IMPORTED_MODULE_2__["decrypt"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "decryptKeystoreSync", function() { return _keystore__WEBPACK_IMPORTED_MODULE_2__["decryptSync"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "encryptKeystore", function() { return _keystore__WEBPACK_IMPORTED_MODULE_2__["encrypt"]; }); + + + + + + + +function decryptJsonWallet(json, password, progressCallback) { + if (Object(_inspect__WEBPACK_IMPORTED_MODULE_1__["isCrowdsaleWallet"])(json)) { + if (progressCallback) { + progressCallback(0); + } + + var account = Object(_crowdsale__WEBPACK_IMPORTED_MODULE_0__["decrypt"])(json, password); + + if (progressCallback) { + progressCallback(1); + } + + return Promise.resolve(account); + } + + if (Object(_inspect__WEBPACK_IMPORTED_MODULE_1__["isKeystoreWallet"])(json)) { + return Object(_keystore__WEBPACK_IMPORTED_MODULE_2__["decrypt"])(json, password, progressCallback); + } + + return Promise.reject(new Error("invalid JSON wallet")); +} + +function decryptJsonWalletSync(json, password) { + if (Object(_inspect__WEBPACK_IMPORTED_MODULE_1__["isCrowdsaleWallet"])(json)) { + return Object(_crowdsale__WEBPACK_IMPORTED_MODULE_0__["decrypt"])(json, password); + } + + if (Object(_inspect__WEBPACK_IMPORTED_MODULE_1__["isKeystoreWallet"])(json)) { + return Object(_keystore__WEBPACK_IMPORTED_MODULE_2__["decryptSync"])(json, password); + } + + throw new Error("invalid JSON wallet"); +} + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/json-wallets/lib.esm/inspect.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@ethersproject/json-wallets/lib.esm/inspect.js ***! + \*********************************************************************/ +/*! exports provided: isCrowdsaleWallet, isKeystoreWallet, getJsonWalletAddress */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isCrowdsaleWallet", function() { return isCrowdsaleWallet; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isKeystoreWallet", function() { return isKeystoreWallet; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getJsonWalletAddress", function() { return getJsonWalletAddress; }); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); + + + +function isCrowdsaleWallet(json) { + var data = null; + + try { + data = JSON.parse(json); + } catch (error) { + return false; + } + + return data.encseed && data.ethaddr; +} +function isKeystoreWallet(json) { + var data = null; + + try { + data = JSON.parse(json); + } catch (error) { + return false; + } + + if (!data.version || parseInt(data.version) !== data.version || parseInt(data.version) !== 3) { + return false; + } // @TODO: Put more checks to make sure it has kdf, iv and all that good stuff + + + return true; +} //export function isJsonWallet(json: string): boolean { +// return (isSecretStorageWallet(json) || isCrowdsaleWallet(json)); +//} + +function getJsonWalletAddress(json) { + if (isCrowdsaleWallet(json)) { + try { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(JSON.parse(json).ethaddr); + } catch (error) { + return null; + } + } + + if (isKeystoreWallet(json)) { + try { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(JSON.parse(json).address); + } catch (error) { + return null; + } + } + + return null; +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/json-wallets/lib.esm/keystore.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@ethersproject/json-wallets/lib.esm/keystore.js ***! + \**********************************************************************/ +/*! exports provided: KeystoreAccount, decryptSync, decrypt, encrypt */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeystoreAccount", function() { return KeystoreAccount; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decryptSync", function() { return decryptSync; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decrypt", function() { return decrypt; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encrypt", function() { return encrypt; }); +/* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! aes-js */ "./node_modules/aes-js/index.js"); +/* harmony import */ var aes_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aes_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var scrypt_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! scrypt-js */ "./node_modules/scrypt-js/scrypt.js"); +/* harmony import */ var scrypt_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(scrypt_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/hdnode */ "./node_modules/@ethersproject/hdnode/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/pbkdf2 */ "./node_modules/@ethersproject/pbkdf2/lib.esm/index.js"); +/* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/random */ "./node_modules/@ethersproject/random/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./utils */ "./node_modules/@ethersproject/json-wallets/lib.esm/utils.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/json-wallets/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_11__["Logger"](_version__WEBPACK_IMPORTED_MODULE_12__["version"]); // Exported Types + +function hasMnemonic(value) { + return value != null && value.mnemonic && value.mnemonic.phrase; +} + +var KeystoreAccount = /*#__PURE__*/function (_Description) { + _inherits(KeystoreAccount, _Description); + + var _super = _createSuper(KeystoreAccount); + + function KeystoreAccount() { + _classCallCheck(this, KeystoreAccount); + + return _super.apply(this, arguments); + } + + _createClass(KeystoreAccount, [{ + key: "isKeystoreAccount", + value: function isKeystoreAccount(value) { + return !!(value && value._isKeystoreAccount); + } + }]); + + return KeystoreAccount; +}(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_8__["Description"]); + +function _decrypt(data, key, ciphertext) { + var cipher = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/cipher"); + + if (cipher === "aes-128-ctr") { + var iv = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["looseArrayify"])(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/cipherparams/iv")); + var counter = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.Counter(iv); + var aesCtr = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.ModeOfOperation.ctr(key, counter); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(aesCtr.decrypt(ciphertext)); + } + + return null; +} + +function _getAccount(data, key) { + var ciphertext = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["looseArrayify"])(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/ciphertext")); + var computedMAC = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([key.slice(16, 32), ciphertext]))).substring(2); + + if (computedMAC !== Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/mac").toLowerCase()) { + throw new Error("invalid password"); + } + + var privateKey = _decrypt(data, key.slice(0, 16), ciphertext); + + if (!privateKey) { + logger.throwError("unsupported cipher", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_11__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "decrypt" + }); + } + + var mnemonicKey = key.slice(32, 64); + var address = Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_9__["computeAddress"])(privateKey); + + if (data.address) { + var check = data.address.toLowerCase(); + + if (check.substring(0, 2) !== "0x") { + check = "0x" + check; + } + + if (Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__["getAddress"])(check) !== address) { + throw new Error("address mismatch"); + } + } + + var account = { + _isKeystoreAccount: true, + address: address, + privateKey: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(privateKey) + }; // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + + if (Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "x-ethers/version") === "0.1") { + var mnemonicCiphertext = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["looseArrayify"])(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "x-ethers/mnemonicCiphertext")); + var mnemonicIv = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["looseArrayify"])(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "x-ethers/mnemonicCounter")); + var mnemonicCounter = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var path = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "x-ethers/path") || _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__["defaultPath"]; + var locale = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "x-ethers/locale") || "en"; + var entropy = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(mnemonicAesCtr.decrypt(mnemonicCiphertext)); + + try { + var mnemonic = Object(_ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__["entropyToMnemonic"])(entropy, locale); + var node = _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__["HDNode"].fromMnemonic(mnemonic, null, locale).derivePath(path); + + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + + account.mnemonic = node.mnemonic; + } catch (error) { + // If we don't have the locale wordlist installed to + // read this mnemonic, just bail and don't set the + // mnemonic + if (error.code !== _ethersproject_logger__WEBPACK_IMPORTED_MODULE_11__["Logger"].errors.INVALID_ARGUMENT || error.argument !== "wordlist") { + throw error; + } + } + } + + return new KeystoreAccount(account); +} + +function pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(Object(_ethersproject_pbkdf2__WEBPACK_IMPORTED_MODULE_6__["pbkdf2"])(passwordBytes, salt, count, dkLen, prfFunc)); +} + +function pbkdf2(passwordBytes, salt, count, dkLen, prfFunc) { + return Promise.resolve(pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc)); +} + +function _computeKdfKey(data, password, pbkdf2Func, scryptFunc, progressCallback) { + var passwordBytes = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["getPassword"])(password); + var kdf = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdf"); + + if (kdf && typeof kdf === "string") { + var throwError = function throwError(name, value) { + return logger.throwArgumentError("invalid key-derivation function parameters", name, value); + }; + + if (kdf.toLowerCase() === "scrypt") { + var salt = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["looseArrayify"])(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/salt")); + var N = parseInt(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/n")); + var r = parseInt(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/r")); + var p = parseInt(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/p")); // Check for all required parameters + + if (!N || !r || !p) { + throwError("kdf", kdf); + } // Make sure N is a power of 2 + + + if ((N & N - 1) !== 0) { + throwError("N", N); + } + + var dkLen = parseInt(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/dklen")); + + if (dkLen !== 32) { + throwError("dklen", dkLen); + } + + return scryptFunc(passwordBytes, salt, N, r, p, 64, progressCallback); + } else if (kdf.toLowerCase() === "pbkdf2") { + var _salt = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["looseArrayify"])(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/salt")); + + var prfFunc = null; + var prf = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/prf"); + + if (prf === "hmac-sha256") { + prfFunc = "sha256"; + } else if (prf === "hmac-sha512") { + prfFunc = "sha512"; + } else { + throwError("prf", prf); + } + + var count = parseInt(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/c")); + + var _dkLen = parseInt(Object(_utils__WEBPACK_IMPORTED_MODULE_10__["searchPath"])(data, "crypto/kdfparams/dklen")); + + if (_dkLen !== 32) { + throwError("dklen", _dkLen); + } + + return pbkdf2Func(passwordBytes, _salt, count, _dkLen, prfFunc); + } + } + + return logger.throwArgumentError("unsupported key-derivation function", "kdf", kdf); +} + +function decryptSync(json, password) { + var data = JSON.parse(json); + + var key = _computeKdfKey(data, password, pbkdf2Sync, scrypt_js__WEBPACK_IMPORTED_MODULE_1___default.a.syncScrypt); + + return _getAccount(data, key); +} +function decrypt(json, password, progressCallback) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var data, key; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + data = JSON.parse(json); + _context.next = 3; + return _computeKdfKey(data, password, pbkdf2, scrypt_js__WEBPACK_IMPORTED_MODULE_1___default.a.scrypt, progressCallback); + + case 3: + key = _context.sent; + return _context.abrupt("return", _getAccount(data, key)); + + case 5: + case "end": + return _context.stop(); + } + } + }, _callee); + })); +} +function encrypt(account, password, options, progressCallback) { + try { + // Check the address matches the private key + if (Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_2__["getAddress"])(account.address) !== Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_9__["computeAddress"])(account.privateKey)) { + throw new Error("address/privateKey mismatch"); + } // Check the mnemonic (if any) matches the private key + + + if (hasMnemonic(account)) { + var mnemonic = account.mnemonic; + var node = _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__["HDNode"].fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__["defaultPath"]); + + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + } + } catch (e) { + return Promise.reject(e); + } // The options are optional, so adjust the call as needed + + + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + + if (!options) { + options = {}; + } + + var privateKey = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(account.privateKey); + var passwordBytes = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["getPassword"])(password); + var entropy = null; + var path = null; + var locale = null; + + if (hasMnemonic(account)) { + var srcMnemonic = account.mnemonic; + entropy = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(Object(_ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__["mnemonicToEntropy"])(srcMnemonic.phrase, srcMnemonic.locale || "en")); + path = srcMnemonic.path || _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_4__["defaultPath"]; + locale = srcMnemonic.locale || "en"; + } + + var client = options.client; + + if (!client) { + client = "ethers.js"; + } // Check/generate the salt + + + var salt = null; + + if (options.salt) { + salt = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(options.salt); + } else { + salt = Object(_ethersproject_random__WEBPACK_IMPORTED_MODULE_7__["randomBytes"])(32); + ; + } // Override initialization vector + + + var iv = null; + + if (options.iv) { + iv = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(options.iv); + + if (iv.length !== 16) { + throw new Error("invalid iv"); + } + } else { + iv = Object(_ethersproject_random__WEBPACK_IMPORTED_MODULE_7__["randomBytes"])(16); + } // Override the uuid + + + var uuidRandom = null; + + if (options.uuid) { + uuidRandom = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(options.uuid); + + if (uuidRandom.length !== 16) { + throw new Error("invalid uuid"); + } + } else { + uuidRandom = Object(_ethersproject_random__WEBPACK_IMPORTED_MODULE_7__["randomBytes"])(16); + } // Override the scrypt password-based key derivation function parameters + + + var N = 1 << 17, + r = 8, + p = 1; + + if (options.scrypt) { + if (options.scrypt.N) { + N = options.scrypt.N; + } + + if (options.scrypt.r) { + r = options.scrypt.r; + } + + if (options.scrypt.p) { + p = options.scrypt.p; + } + } // We take 64 bytes: + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + + + return scrypt_js__WEBPACK_IMPORTED_MODULE_1___default.a.scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then(function (key) { + key = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(key); // This will be used to encrypt the wallet (as per Web3 secret storage) + + var derivedKey = key.slice(0, 16); + var macPrefix = key.slice(16, 32); // This will be used to encrypt the mnemonic phrase (if any) + + var mnemonicKey = key.slice(32, 64); // Encrypt the private key + + var counter = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.Counter(iv); + var aesCtr = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.ModeOfOperation.ctr(derivedKey, counter); + var ciphertext = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(aesCtr.encrypt(privateKey)); // Compute the message authentication code, used to check the password + + var mac = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_5__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([macPrefix, ciphertext])); // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + + var data = { + address: account.address.substring(2).toLowerCase(), + id: Object(_utils__WEBPACK_IMPORTED_MODULE_10__["uuidV4"])(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(iv).substring(2) + }, + ciphertext: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(salt).substring(2), + n: N, + dklen: 32, + p: p, + r: r + }, + mac: mac.substring(2) + } + }; // If we have a mnemonic, encrypt it into the JSON wallet + + if (entropy) { + var mnemonicIv = Object(_ethersproject_random__WEBPACK_IMPORTED_MODULE_7__["randomBytes"])(16); + var mnemonicCounter = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js__WEBPACK_IMPORTED_MODULE_0___default.a.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var mnemonicCiphertext = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(mnemonicAesCtr.encrypt(entropy)); + var now = new Date(); + var timestamp = now.getUTCFullYear() + "-" + Object(_utils__WEBPACK_IMPORTED_MODULE_10__["zpad"])(now.getUTCMonth() + 1, 2) + "-" + Object(_utils__WEBPACK_IMPORTED_MODULE_10__["zpad"])(now.getUTCDate(), 2) + "T" + Object(_utils__WEBPACK_IMPORTED_MODULE_10__["zpad"])(now.getUTCHours(), 2) + "-" + Object(_utils__WEBPACK_IMPORTED_MODULE_10__["zpad"])(now.getUTCMinutes(), 2) + "-" + Object(_utils__WEBPACK_IMPORTED_MODULE_10__["zpad"])(now.getUTCSeconds(), 2) + ".0Z"; + data["x-ethers"] = { + client: client, + gethFilename: "UTC--" + timestamp + "--" + data.address, + mnemonicCounter: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(mnemonicIv).substring(2), + mnemonicCiphertext: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(mnemonicCiphertext).substring(2), + path: path, + locale: locale, + version: "0.1" + }; + } + + return JSON.stringify(data); + }); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/json-wallets/lib.esm/utils.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/json-wallets/lib.esm/utils.js ***! + \*******************************************************************/ +/*! exports provided: looseArrayify, zpad, getPassword, searchPath, uuidV4 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "looseArrayify", function() { return looseArrayify; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zpad", function() { return zpad; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPassword", function() { return getPassword; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "searchPath", function() { return searchPath; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uuidV4", function() { return uuidV4; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); + + + + +function looseArrayify(hexString) { + if (typeof hexString === 'string' && hexString.substring(0, 2) !== '0x') { + hexString = '0x' + hexString; + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(hexString); +} +function zpad(value, length) { + value = String(value); + + while (value.length < length) { + value = '0' + value; + } + + return value; +} +function getPassword(password) { + if (typeof password === 'string') { + return Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__["toUtf8Bytes"])(password, _ethersproject_strings__WEBPACK_IMPORTED_MODULE_1__["UnicodeNormalizationForm"].NFKC); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(password); +} +function searchPath(object, path) { + var currentChild = object; + var comps = path.toLowerCase().split('/'); + + for (var i = 0; i < comps.length; i++) { + // Search for a child object with a case-insensitive matching key + var matchingChild = null; + + for (var key in currentChild) { + if (key.toLowerCase() === comps[i]) { + matchingChild = currentChild[key]; + break; + } + } // Didn't find one. :'( + + + if (matchingChild === null) { + return null; + } // Now check this child... + + + currentChild = matchingChild; + } + + return currentChild; +} // See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + +function uuidV4(randomBytes) { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(randomBytes); // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + + bytes[6] = bytes[6] & 0x0f | 0x40; // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + + bytes[8] = bytes[8] & 0x3f | 0x80; + var value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(bytes); + return [value.substring(2, 10), value.substring(10, 14), value.substring(14, 18), value.substring(18, 22), value.substring(22, 34)].join("-"); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/keccak256/lib.esm/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/keccak256/lib.esm/index.js ***! + \****************************************************************/ +/*! exports provided: keccak256 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keccak256", function() { return keccak256; }); +/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ "./node_modules/js-sha3/src/sha3.js"); +/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); + + + + +function keccak256(data) { + return '0x' + js_sha3__WEBPACK_IMPORTED_MODULE_0___default.a.keccak_256(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(data)); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/logger/lib.esm/_version.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/logger/lib.esm/_version.js ***! + \****************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "logger/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/logger/lib.esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/logger/lib.esm/index.js ***! + \*************************************************************/ +/*! exports provided: LogLevel, ErrorCode, Logger */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogLevel", function() { return LogLevel; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorCode", function() { return ErrorCode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return Logger; }); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/logger/lib.esm/_version.js"); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +var _permanentCensorErrors = false; +var _censorErrors = false; +var LogLevels = { + debug: 1, + "default": 2, + info: 2, + warning: 3, + error: 4, + off: 5 +}; +var _logLevel = LogLevels["default"]; + +var _globalLogger = null; + +function _checkNormalize() { + try { + var missing = []; // Make sure all forms of normalization are supported + + ["NFD", "NFC", "NFKD", "NFKC"].forEach(function (form) { + try { + if ("test".normalize(form) !== "test") { + throw new Error("bad normalize"); + } + + ; + } catch (error) { + missing.push(form); + } + }); + + if (missing.length) { + throw new Error("missing " + missing.join(", ")); + } + + if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) { + throw new Error("broken implementation"); + } + } catch (error) { + return error.message; + } + + return null; +} + +var _normalizeError = _checkNormalize(); + +var LogLevel; + +(function (LogLevel) { + LogLevel["DEBUG"] = "DEBUG"; + LogLevel["INFO"] = "INFO"; + LogLevel["WARNING"] = "WARNING"; + LogLevel["ERROR"] = "ERROR"; + LogLevel["OFF"] = "OFF"; +})(LogLevel || (LogLevel = {})); + +var ErrorCode; + +(function (ErrorCode) { + /////////////////// + // Generic Errors + // Unknown Error + ErrorCode["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; // Not Implemented + + ErrorCode["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; // Unsupported Operation + // - operation + + ErrorCode["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; // Network Error (i.e. Ethereum Network, such as an invalid chain ID) + // - event ("noNetwork" is not re-thrown in provider.ready; otherwise thrown) + + ErrorCode["NETWORK_ERROR"] = "NETWORK_ERROR"; // Some sort of bad response from the server + + ErrorCode["SERVER_ERROR"] = "SERVER_ERROR"; // Timeout + + ErrorCode["TIMEOUT"] = "TIMEOUT"; /////////////////// + // Operational Errors + // Buffer Overrun + + ErrorCode["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; // Numeric Fault + // - operation: the operation being executed + // - fault: the reason this faulted + + ErrorCode["NUMERIC_FAULT"] = "NUMERIC_FAULT"; /////////////////// + // Argument Errors + // Missing new operator to an object + // - name: The name of the class + + ErrorCode["MISSING_NEW"] = "MISSING_NEW"; // Invalid argument (e.g. value is incompatible with type) to a function: + // - argument: The argument name that was invalid + // - value: The value of the argument + + ErrorCode["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; // Missing argument to a function: + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + + ErrorCode["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; // Too many arguments + // - count: The number of arguments received + // - expectedCount: The number of arguments expected + + ErrorCode["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; /////////////////// + // Blockchain Errors + // Call exception + // - transaction: the transaction + // - address?: the contract address + // - args?: The arguments passed into the function + // - method?: The Solidity method signature + // - errorSignature?: The EIP848 error signature + // - errorArgs?: The EIP848 error parameters + // - reason: The reason (only for EIP848 "Error(string)") + + ErrorCode["CALL_EXCEPTION"] = "CALL_EXCEPTION"; // Insufficient funds (< value + gasLimit * gasPrice) + // - transaction: the transaction attempted + + ErrorCode["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; // Nonce has already been used + // - transaction: the transaction attempted + + ErrorCode["NONCE_EXPIRED"] = "NONCE_EXPIRED"; // The replacement fee for the transaction is too low + // - transaction: the transaction attempted + + ErrorCode["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; // The gas limit could not be estimated + // - transaction: the transaction passed to estimateGas + + ErrorCode["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; // The transaction was replaced by one with a higher gas price + // - reason: "cancelled", "replaced" or "repriced" + // - cancelled: true if reason == "cancelled" or reason == "replaced") + // - hash: original transaction hash + // - replacement: the full TransactionsResponse for the replacement + // - receipt: the receipt of the replacement + + ErrorCode["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; +})(ErrorCode || (ErrorCode = {})); + +; +var HEX = "0123456789abcdef"; +var Logger = /*#__PURE__*/function () { + function Logger(version) { + _classCallCheck(this, Logger); + + Object.defineProperty(this, "version", { + enumerable: true, + value: version, + writable: false + }); + } + + _createClass(Logger, [{ + key: "_log", + value: function _log(logLevel, args) { + var level = logLevel.toLowerCase(); + + if (LogLevels[level] == null) { + this.throwArgumentError("invalid log level name", "logLevel", logLevel); + } + + if (_logLevel > LogLevels[level]) { + return; + } + + console.log.apply(console, args); + } + }, { + key: "debug", + value: function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + this._log(Logger.levels.DEBUG, args); + } + }, { + key: "info", + value: function info() { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + this._log(Logger.levels.INFO, args); + } + }, { + key: "warn", + value: function warn() { + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + + this._log(Logger.levels.WARNING, args); + } + }, { + key: "makeError", + value: function makeError(message, code, params) { + // Errors are being censored + if (_censorErrors) { + return this.makeError("censored error", code, {}); + } + + if (!code) { + code = Logger.errors.UNKNOWN_ERROR; + } + + if (!params) { + params = {}; + } + + var messageDetails = []; + Object.keys(params).forEach(function (key) { + var value = params[key]; + + try { + if (value instanceof Uint8Array) { + var hex = ""; + + for (var i = 0; i < value.length; i++) { + hex += HEX[value[i] >> 4]; + hex += HEX[value[i] & 0x0f]; + } + + messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); + } else { + messageDetails.push(key + "=" + JSON.stringify(value)); + } + } catch (error) { + messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); + } + }); + messageDetails.push("code=".concat(code)); + messageDetails.push("version=".concat(this.version)); + var reason = message; + + if (messageDetails.length) { + message += " (" + messageDetails.join(", ") + ")"; + } // @TODO: Any?? + + + var error = new Error(message); + error.reason = reason; + error.code = code; + Object.keys(params).forEach(function (key) { + error[key] = params[key]; + }); + return error; + } + }, { + key: "throwError", + value: function throwError(message, code, params) { + throw this.makeError(message, code, params); + } + }, { + key: "throwArgumentError", + value: function throwArgumentError(message, name, value) { + return this.throwError(message, Logger.errors.INVALID_ARGUMENT, { + argument: name, + value: value + }); + } + }, { + key: "assert", + value: function assert(condition, message, code, params) { + if (!!condition) { + return; + } + + this.throwError(message, code, params); + } + }, { + key: "assertArgument", + value: function assertArgument(condition, message, name, value) { + if (!!condition) { + return; + } + + this.throwArgumentError(message, name, value); + } + }, { + key: "checkNormalize", + value: function checkNormalize(message) { + if (message == null) { + message = "platform missing String.prototype.normalize"; + } + + if (_normalizeError) { + this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "String.prototype.normalize", + form: _normalizeError + }); + } + } + }, { + key: "checkSafeUint53", + value: function checkSafeUint53(value, message) { + if (typeof value !== "number") { + return; + } + + if (message == null) { + message = "value not safe"; + } + + if (value < 0 || value >= 0x1fffffffffffff) { + this.throwError(message, Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value: value + }); + } + + if (value % 1) { + this.throwError(message, Logger.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value: value + }); + } + } + }, { + key: "checkArgumentCount", + value: function checkArgumentCount(count, expectedCount, message) { + if (message) { + message = ": " + message; + } else { + message = ""; + } + + if (count < expectedCount) { + this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, { + count: count, + expectedCount: expectedCount + }); + } + + if (count > expectedCount) { + this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, { + count: count, + expectedCount: expectedCount + }); + } + } + }, { + key: "checkNew", + value: function checkNew(target, kind) { + if (target === Object || target == null) { + this.throwError("missing new", Logger.errors.MISSING_NEW, { + name: kind.name + }); + } + } + }, { + key: "checkAbstract", + value: function checkAbstract(target, kind) { + if (target === kind) { + this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { + name: target.name, + operation: "new" + }); + } else if (target === Object || target == null) { + this.throwError("missing new", Logger.errors.MISSING_NEW, { + name: kind.name + }); + } + } + }], [{ + key: "globalLogger", + value: function globalLogger() { + if (!_globalLogger) { + _globalLogger = new Logger(_version__WEBPACK_IMPORTED_MODULE_0__["version"]); + } + + return _globalLogger; + } + }, { + key: "setCensorship", + value: function setCensorship(censorship, permanent) { + if (!censorship && permanent) { + this.globalLogger().throwError("cannot permanently disable censorship", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + + if (_permanentCensorErrors) { + if (!censorship) { + return; + } + + this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + + _censorErrors = !!censorship; + _permanentCensorErrors = !!permanent; + } + }, { + key: "setLogLevel", + value: function setLogLevel(logLevel) { + var level = LogLevels[logLevel.toLowerCase()]; + + if (level == null) { + Logger.globalLogger().warn("invalid log level - " + logLevel); + return; + } + + _logLevel = level; + } + }, { + key: "from", + value: function from(version) { + return new Logger(version); + } + }]); + + return Logger; +}(); +Logger.errors = ErrorCode; +Logger.levels = LogLevel; + +/***/ }), + +/***/ "./node_modules/@ethersproject/networks/lib.esm/_version.js": +/*!******************************************************************!*\ + !*** ./node_modules/@ethersproject/networks/lib.esm/_version.js ***! + \******************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "networks/5.5.2"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/networks/lib.esm/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/@ethersproject/networks/lib.esm/index.js ***! + \***************************************************************/ +/*! exports provided: getNetwork */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNetwork", function() { return getNetwork; }); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/networks/lib.esm/_version.js"); + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"](_version__WEBPACK_IMPORTED_MODULE_1__["version"]); +; + +function isRenetworkable(value) { + return value && typeof value.renetwork === "function"; +} + +function ethDefaultProvider(network) { + var func = function func(providers, options) { + if (options == null) { + options = {}; + } + + var providerList = []; + + if (providers.InfuraProvider) { + try { + providerList.push(new providers.InfuraProvider(network, options.infura)); + } catch (error) {} + } + + if (providers.EtherscanProvider) { + try { + providerList.push(new providers.EtherscanProvider(network, options.etherscan)); + } catch (error) {} + } + + if (providers.AlchemyProvider) { + try { + providerList.push(new providers.AlchemyProvider(network, options.alchemy)); + } catch (error) {} + } + + if (providers.PocketProvider) { + // These networks are currently faulty on Pocket as their + // network does not handle the Berlin hardfork, which is + // live on these ones. + // @TODO: This goes away once Pocket has upgraded their nodes + var skip = ["goerli", "ropsten", "rinkeby"]; + + try { + var provider = new providers.PocketProvider(network); + + if (provider.network && skip.indexOf(provider.network.name) === -1) { + providerList.push(provider); + } + } catch (error) {} + } + + if (providers.CloudflareProvider) { + try { + providerList.push(new providers.CloudflareProvider(network)); + } catch (error) {} + } + + if (providerList.length === 0) { + return null; + } + + if (providers.FallbackProvider) { + var quorum = 1; + + if (options.quorum != null) { + quorum = options.quorum; + } else if (network === "homestead") { + quorum = 2; + } + + return new providers.FallbackProvider(providerList, quorum); + } + + return providerList[0]; + }; + + func.renetwork = function (network) { + return ethDefaultProvider(network); + }; + + return func; +} + +function etcDefaultProvider(url, network) { + var func = function func(providers, options) { + if (providers.JsonRpcProvider) { + return new providers.JsonRpcProvider(url, network); + } + + return null; + }; + + func.renetwork = function (network) { + return etcDefaultProvider(url, network); + }; + + return func; +} + +var homestead = { + chainId: 1, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "homestead", + _defaultProvider: ethDefaultProvider("homestead") +}; +var ropsten = { + chainId: 3, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "ropsten", + _defaultProvider: ethDefaultProvider("ropsten") +}; +var classicMordor = { + chainId: 63, + name: "classicMordor", + _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor") +}; // See: https://chainlist.org + +var networks = { + unspecified: { + chainId: 0, + name: "unspecified" + }, + homestead: homestead, + mainnet: homestead, + morden: { + chainId: 2, + name: "morden" + }, + ropsten: ropsten, + testnet: ropsten, + rinkeby: { + chainId: 4, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "rinkeby", + _defaultProvider: ethDefaultProvider("rinkeby") + }, + kovan: { + chainId: 42, + name: "kovan", + _defaultProvider: ethDefaultProvider("kovan") + }, + goerli: { + chainId: 5, + ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + name: "goerli", + _defaultProvider: ethDefaultProvider("goerli") + }, + kintsugi: { + chainId: 1337702, + name: "kintsugi" + }, + // ETC (See: #351) + classic: { + chainId: 61, + name: "classic", + _defaultProvider: etcDefaultProvider("https:/\/www.ethercluster.com/etc", "classic") + }, + classicMorden: { + chainId: 62, + name: "classicMorden" + }, + classicMordor: classicMordor, + classicTestnet: classicMordor, + classicKotti: { + chainId: 6, + name: "classicKotti", + _defaultProvider: etcDefaultProvider("https:/\/www.ethercluster.com/kotti", "classicKotti") + }, + xdai: { + chainId: 100, + name: "xdai" + }, + matic: { + chainId: 137, + name: "matic" + }, + maticmum: { + chainId: 80001, + name: "maticmum" + }, + optimism: { + chainId: 10, + name: "optimism" + }, + "optimism-kovan": { + chainId: 69, + name: "optimism-kovan" + }, + "optimism-goerli": { + chainId: 420, + name: "optimism-goerli" + }, + arbitrum: { + chainId: 42161, + name: "arbitrum" + }, + "arbitrum-rinkeby": { + chainId: 421611, + name: "arbitrum-rinkeby" + }, + bnb: { + chainId: 56, + name: "bnb" + }, + bnbt: { + chainId: 97, + name: "bnbt" + } +}; +/** + * getNetwork + * + * Converts a named common networks or chain ID (network ID) to a Network + * and verifies a network is a valid Network.. + */ + +function getNetwork(network) { + // No network (null) + if (network == null) { + return null; + } + + if (typeof network === "number") { + for (var name in networks) { + var _standard = networks[name]; + + if (_standard.chainId === network) { + return { + name: _standard.name, + chainId: _standard.chainId, + ensAddress: _standard.ensAddress || null, + _defaultProvider: _standard._defaultProvider || null + }; + } + } + + return { + chainId: network, + name: "unknown" + }; + } + + if (typeof network === "string") { + var _standard2 = networks[network]; + + if (_standard2 == null) { + return null; + } + + return { + name: _standard2.name, + chainId: _standard2.chainId, + ensAddress: _standard2.ensAddress, + _defaultProvider: _standard2._defaultProvider || null + }; + } + + var standard = networks[network.name]; // Not a standard network; check that it is a valid network in general + + if (!standard) { + if (typeof network.chainId !== "number") { + logger.throwArgumentError("invalid network chainId", "network", network); + } + + return network; + } // Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155) + + + if (network.chainId !== 0 && network.chainId !== standard.chainId) { + logger.throwArgumentError("network chainId mismatch", "network", network); + } // @TODO: In the next major version add an attach function to a defaultProvider + // class and move the _defaultProvider internal to this file (extend Network) + + + var defaultProvider = network._defaultProvider || null; + + if (defaultProvider == null && standard._defaultProvider) { + if (isRenetworkable(standard._defaultProvider)) { + defaultProvider = standard._defaultProvider.renetwork(network); + } else { + defaultProvider = standard._defaultProvider; + } + } // Standard Network (allow overriding the ENS address) + + + return { + name: network.name, + chainId: standard.chainId, + ensAddress: network.ensAddress || standard.ensAddress || null, + _defaultProvider: defaultProvider + }; +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/pbkdf2/lib.esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/pbkdf2/lib.esm/index.js ***! + \*************************************************************/ +/*! exports provided: pbkdf2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _pbkdf2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pbkdf2 */ "./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pbkdf2", function() { return _pbkdf2__WEBPACK_IMPORTED_MODULE_0__["pbkdf2"]; }); + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/pbkdf2/lib.esm/pbkdf2.js ***! + \**************************************************************/ +/*! exports provided: pbkdf2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pbkdf2", function() { return pbkdf2; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/index.js"); + + + + +function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { + password = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(password); + salt = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(salt); + var hLen; + var l = 1; + var DK = new Uint8Array(keylen); + var block1 = new Uint8Array(salt.length + 4); + block1.set(salt); //salt.copy(block1, 0, 0, salt.length) + + var r; + var T; + + for (var i = 1; i <= l; i++) { + //block1.writeUInt32BE(i, salt.length) + block1[salt.length] = i >> 24 & 0xff; + block1[salt.length + 1] = i >> 16 & 0xff; + block1[salt.length + 2] = i >> 8 & 0xff; + block1[salt.length + 3] = i & 0xff; //let U = createHmac(password).update(block1).digest(); + + var U = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__["computeHmac"])(hashAlgorithm, password, block1)); + + if (!hLen) { + hLen = U.length; + T = new Uint8Array(hLen); + l = Math.ceil(keylen / hLen); + r = keylen - (l - 1) * hLen; + } //U.copy(T, 0, 0, hLen) + + + T.set(U); + + for (var j = 1; j < iterations; j++) { + //U = createHmac(password).update(U).digest(); + U = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_1__["computeHmac"])(hashAlgorithm, password, U)); + + for (var k = 0; k < hLen; k++) { + T[k] ^= U[k]; + } + } + + var destPos = (i - 1) * hLen; + var len = i === l ? r : hLen; //T.copy(DK, destPos, 0, len) + + DK.set(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(T).slice(0, len), destPos); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(DK); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/properties/lib.esm/_version.js": +/*!********************************************************************!*\ + !*** ./node_modules/@ethersproject/properties/lib.esm/_version.js ***! + \********************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "properties/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/properties/lib.esm/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@ethersproject/properties/lib.esm/index.js ***! + \*****************************************************************/ +/*! exports provided: defineReadOnly, getStatic, resolveProperties, checkProperties, shallowCopy, deepCopy, Description */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defineReadOnly", function() { return defineReadOnly; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getStatic", function() { return getStatic; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveProperties", function() { return resolveProperties; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "checkProperties", function() { return checkProperties; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shallowCopy", function() { return shallowCopy; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deepCopy", function() { return deepCopy; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Description", function() { return Description; }); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/properties/lib.esm/_version.js"); + + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"](_version__WEBPACK_IMPORTED_MODULE_1__["version"]); +function defineReadOnly(object, name, value) { + Object.defineProperty(object, name, { + enumerable: true, + value: value, + writable: false + }); +} // Crawl up the constructor chain to find a static method + +function getStatic(ctor, key) { + for (var i = 0; i < 32; i++) { + if (ctor[key]) { + return ctor[key]; + } + + if (!ctor.prototype || _typeof(ctor.prototype) !== "object") { + break; + } + + ctor = Object.getPrototypeOf(ctor.prototype).constructor; + } + + return null; +} +function resolveProperties(object) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var promises, results; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + promises = Object.keys(object).map(function (key) { + var value = object[key]; + return Promise.resolve(value).then(function (v) { + return { + key: key, + value: v + }; + }); + }); + _context.next = 3; + return Promise.all(promises); + + case 3: + results = _context.sent; + return _context.abrupt("return", results.reduce(function (accum, result) { + accum[result.key] = result.value; + return accum; + }, {})); + + case 5: + case "end": + return _context.stop(); + } + } + }, _callee); + })); +} +function checkProperties(object, properties) { + if (!object || _typeof(object) !== "object") { + logger.throwArgumentError("invalid object", "object", object); + } + + Object.keys(object).forEach(function (key) { + if (!properties[key]) { + logger.throwArgumentError("invalid object key - " + key, "transaction:" + key, object); + } + }); +} +function shallowCopy(object) { + var result = {}; + + for (var key in object) { + result[key] = object[key]; + } + + return result; +} +var opaque = { + bigint: true, + "boolean": true, + "function": true, + number: true, + string: true +}; + +function _isFrozen(object) { + // Opaque objects are not mutable, so safe to copy by assignment + if (object === undefined || object === null || opaque[_typeof(object)]) { + return true; + } + + if (Array.isArray(object) || _typeof(object) === "object") { + if (!Object.isFrozen(object)) { + return false; + } + + var keys = Object.keys(object); + + for (var i = 0; i < keys.length; i++) { + var value = null; + + try { + value = object[keys[i]]; + } catch (error) { + // If accessing a value triggers an error, it is a getter + // designed to do so (e.g. Result) and is therefore "frozen" + continue; + } + + if (!_isFrozen(value)) { + return false; + } + } + + return true; + } + + return logger.throwArgumentError("Cannot deepCopy ".concat(_typeof(object)), "object", object); +} // Returns a new copy of object, such that no properties may be replaced. +// New properties may be added only to objects. + + +function _deepCopy(object) { + if (_isFrozen(object)) { + return object; + } // Arrays are mutable, so we need to create a copy + + + if (Array.isArray(object)) { + return Object.freeze(object.map(function (item) { + return deepCopy(item); + })); + } + + if (_typeof(object) === "object") { + var result = {}; + + for (var key in object) { + var value = object[key]; + + if (value === undefined) { + continue; + } + + defineReadOnly(result, key, deepCopy(value)); + } + + return result; + } + + return logger.throwArgumentError("Cannot deepCopy ".concat(_typeof(object)), "object", object); +} + +function deepCopy(object) { + return _deepCopy(object); +} +var Description = /*#__PURE__*/_createClass(function Description(info) { + _classCallCheck(this, Description); + + for (var key in info) { + this[key] = deepCopy(info[key]); + } +}); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/_version.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/_version.js ***! + \*******************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "providers/5.5.3"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/alchemy-provider.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/alchemy-provider.js ***! + \***************************************************************************/ +/*! exports provided: AlchemyWebSocketProvider, AlchemyProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AlchemyWebSocketProvider", function() { return AlchemyWebSocketProvider; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AlchemyProvider", function() { return AlchemyProvider; }); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formatter */ "./node_modules/@ethersproject/providers/lib.esm/formatter.js"); +/* harmony import */ var _websocket_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./websocket-provider */ "./node_modules/@ethersproject/providers/lib.esm/websocket-provider.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./url-json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"](_version__WEBPACK_IMPORTED_MODULE_4__["version"]); + // This key was provided to ethers.js by Alchemy to be used by the +// default provider, but it is recommended that for your own +// production environments, that you acquire your own API key at: +// https://dashboard.alchemyapi.io + +var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; +var AlchemyWebSocketProvider = /*#__PURE__*/function (_WebSocketProvider) { + _inherits(AlchemyWebSocketProvider, _WebSocketProvider); + + var _super = _createSuper(AlchemyWebSocketProvider); + + function AlchemyWebSocketProvider(network, apiKey) { + var _this; + + _classCallCheck(this, AlchemyWebSocketProvider); + + var provider = new AlchemyProvider(network, apiKey); + var url = provider.connection.url.replace(/^http/i, "ws").replace(".alchemyapi.", ".ws.alchemyapi."); + _this = _super.call(this, url, provider.network); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this), "apiKey", provider.apiKey); + return _this; + } + + _createClass(AlchemyWebSocketProvider, [{ + key: "isCommunityResource", + value: function isCommunityResource() { + return this.apiKey === defaultApiKey; + } + }]); + + return AlchemyWebSocketProvider; +}(_websocket_provider__WEBPACK_IMPORTED_MODULE_2__["WebSocketProvider"]); +var AlchemyProvider = /*#__PURE__*/function (_UrlJsonRpcProvider) { + _inherits(AlchemyProvider, _UrlJsonRpcProvider); + + var _super2 = _createSuper(AlchemyProvider); + + function AlchemyProvider() { + _classCallCheck(this, AlchemyProvider); + + return _super2.apply(this, arguments); + } + + _createClass(AlchemyProvider, [{ + key: "isCommunityResource", + value: function isCommunityResource() { + return this.apiKey === defaultApiKey; + } + }], [{ + key: "getWebSocketProvider", + value: function getWebSocketProvider(network, apiKey) { + return new AlchemyWebSocketProvider(network, apiKey); + } + }, { + key: "getApiKey", + value: function getApiKey(apiKey) { + if (apiKey == null) { + return defaultApiKey; + } + + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + + return apiKey; + } + }, { + key: "getUrl", + value: function getUrl(network, apiKey) { + var host = null; + + switch (network.name) { + case "homestead": + host = "eth-mainnet.alchemyapi.io/v2/"; + break; + + case "ropsten": + host = "eth-ropsten.alchemyapi.io/v2/"; + break; + + case "rinkeby": + host = "eth-rinkeby.alchemyapi.io/v2/"; + break; + + case "goerli": + host = "eth-goerli.alchemyapi.io/v2/"; + break; + + case "kovan": + host = "eth-kovan.alchemyapi.io/v2/"; + break; + + case "matic": + host = "polygon-mainnet.g.alchemy.com/v2/"; + break; + + case "maticmum": + host = "polygon-mumbai.g.alchemy.com/v2/"; + break; + + case "arbitrum": + host = "arb-mainnet.g.alchemy.com/v2/"; + break; + + case "arbitrum-rinkeby": + host = "arb-rinkeby.g.alchemy.com/v2/"; + break; + + case "optimism": + host = "opt-mainnet.g.alchemy.com/v2/"; + break; + + case "optimism-kovan": + host = "opt-kovan.g.alchemy.com/v2/"; + break; + + default: + logger.throwArgumentError("unsupported network", "network", arguments[0]); + } + + return { + allowGzip: true, + url: "https:/" + "/" + host + apiKey, + throttleCallback: function throttleCallback(attempt, url) { + if (apiKey === defaultApiKey) { + Object(_formatter__WEBPACK_IMPORTED_MODULE_1__["showThrottleMessage"])(); + } + + return Promise.resolve(true); + } + }; + } + }]); + + return AlchemyProvider; +}(_url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_5__["UrlJsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/base-provider.js": +/*!************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/base-provider.js ***! + \************************************************************************/ +/*! exports provided: Event, Resolver, BaseProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Event", function() { return Event; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Resolver", function() { return Resolver; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseProvider", function() { return BaseProvider; }); +/* harmony import */ var _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/abstract-provider */ "./node_modules/@ethersproject/abstract-provider/lib.esm/index.js"); +/* harmony import */ var _ethersproject_basex__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/basex */ "./node_modules/@ethersproject/basex/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js"); +/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/hash */ "./node_modules/@ethersproject/hash/lib.esm/index.js"); +/* harmony import */ var _ethersproject_networks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/networks */ "./node_modules/@ethersproject/networks/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/web */ "./node_modules/@ethersproject/web/lib.esm/index.js"); +/* harmony import */ var bech32__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! bech32 */ "./node_modules/bech32/index.js"); +/* harmony import */ var bech32__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(bech32__WEBPACK_IMPORTED_MODULE_11__); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./formatter */ "./node_modules/@ethersproject/providers/lib.esm/formatter.js"); + + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"](_version__WEBPACK_IMPORTED_MODULE_13__["version"]); + ////////////////////////////// +// Event Serializeing + +function checkTopic(topic) { + if (topic == null) { + return "null"; + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataLength"])(topic) !== 32) { + logger.throwArgumentError("invalid topic", "topic", topic); + } + + return topic.toLowerCase(); +} + +function serializeTopics(topics) { + // Remove trailing null AND-topics; they are redundant + topics = topics.slice(); + + while (topics.length > 0 && topics[topics.length - 1] == null) { + topics.pop(); + } + + return topics.map(function (topic) { + if (Array.isArray(topic)) { + // Only track unique OR-topics + var unique = {}; + topic.forEach(function (topic) { + unique[checkTopic(topic)] = true; + }); // The order of OR-topics does not matter + + var sorted = Object.keys(unique); + sorted.sort(); + return sorted.join("|"); + } else { + return checkTopic(topic); + } + }).join("&"); +} + +function deserializeTopics(data) { + if (data === "") { + return []; + } + + return data.split(/&/g).map(function (topic) { + if (topic === "") { + return []; + } + + var comps = topic.split("|").map(function (topic) { + return topic === "null" ? null : topic; + }); + return comps.length === 1 ? comps[0] : comps; + }); +} + +function getEventTag(eventName) { + if (typeof eventName === "string") { + eventName = eventName.toLowerCase(); + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataLength"])(eventName) === 32) { + return "tx:" + eventName; + } + + if (eventName.indexOf(":") === -1) { + return eventName; + } + } else if (Array.isArray(eventName)) { + return "filter:*:" + serializeTopics(eventName); + } else if (_ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__["ForkEvent"].isForkEvent(eventName)) { + logger.warn("not implemented"); + throw new Error("not implemented"); + } else if (eventName && _typeof(eventName) === "object") { + return "filter:" + (eventName.address || "*") + ":" + serializeTopics(eventName.topics || []); + } + + throw new Error("invalid event - " + eventName); +} ////////////////////////////// +// Helper Object + + +function getTime() { + return new Date().getTime(); +} + +function stall(duration) { + return new Promise(function (resolve) { + setTimeout(resolve, duration); + }); +} ////////////////////////////// +// Provider Object + +/** + * EventType + * - "block" + * - "poll" + * - "didPoll" + * - "pending" + * - "error" + * - "network" + * - filter + * - topics array + * - transaction hash + */ + + +var PollableEvents = ["block", "network", "pending", "poll"]; +var Event = /*#__PURE__*/function () { + function Event(tag, listener, once) { + _classCallCheck(this, Event); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "tag", tag); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "listener", listener); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "once", once); + } + + _createClass(Event, [{ + key: "event", + get: function get() { + switch (this.type) { + case "tx": + return this.hash; + + case "filter": + return this.filter; + } + + return this.tag; + } + }, { + key: "type", + get: function get() { + return this.tag.split(":")[0]; + } + }, { + key: "hash", + get: function get() { + var comps = this.tag.split(":"); + + if (comps[0] !== "tx") { + return null; + } + + return comps[1]; + } + }, { + key: "filter", + get: function get() { + var comps = this.tag.split(":"); + + if (comps[0] !== "filter") { + return null; + } + + var address = comps[1]; + var topics = deserializeTopics(comps[2]); + var filter = {}; + + if (topics.length > 0) { + filter.topics = topics; + } + + if (address && address !== "*") { + filter.address = address; + } + + return filter; + } + }, { + key: "pollable", + value: function pollable() { + return this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0; + } + }]); + + return Event; +}(); +; // https://github.com/satoshilabs/slips/blob/master/slip-0044.md + +var coinInfos = { + "0": { + symbol: "btc", + p2pkh: 0x00, + p2sh: 0x05, + prefix: "bc" + }, + "2": { + symbol: "ltc", + p2pkh: 0x30, + p2sh: 0x32, + prefix: "ltc" + }, + "3": { + symbol: "doge", + p2pkh: 0x1e, + p2sh: 0x16 + }, + "60": { + symbol: "eth", + ilk: "eth" + }, + "61": { + symbol: "etc", + ilk: "eth" + }, + "700": { + symbol: "xdai", + ilk: "eth" + } +}; + +function bytes32ify(value) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexZeroPad"])(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(value).toHexString(), 32); +} // Compute the Base58Check encoded data (checksum is first 4 bytes of sha256d) + + +function base58Encode(data) { + return _ethersproject_basex__WEBPACK_IMPORTED_MODULE_1__["Base58"].encode(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([data, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataSlice"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_8__["sha256"])(Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_8__["sha256"])(data)), 0, 4)])); +} + +var matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +var matchers = [new RegExp("^(https):/\/(.*)$", "i"), new RegExp("^(data):(.*)$", "i"), matcherIpfs, new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i")]; + +function _parseString(result) { + try { + return Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__["toUtf8String"])(_parseBytes(result)); + } catch (error) {} + + return null; +} + +function _parseBytes(result) { + if (result === "0x") { + return null; + } + + var offset = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataSlice"])(result, 0, 32)).toNumber(); + var length = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataSlice"])(result, offset, offset + 32)).toNumber(); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataSlice"])(result, offset + 32, offset + 32 + length); +} // Trim off the ipfs:// prefix and return the default gateway URL + + +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } else { + logger.throwArgumentError("unsupported IPFS format", "link", link); + } + + return "https://gateway.ipfs.io/ipfs/".concat(link); +} + +var Resolver = /*#__PURE__*/function () { + // The resolvedAddress is only for creating a ReverseLookup resolver + function Resolver(provider, address, name, resolvedAddress) { + _classCallCheck(this, Resolver); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "provider", provider); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "name", name); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "address", provider.formatter.address(address)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "_resolvedAddress", resolvedAddress); + } + + _createClass(Resolver, [{ + key: "_fetchBytes", + value: function _fetchBytes(selector, parameters) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var tx; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + // e.g. keccak256("addr(bytes32,uint256)") + tx = { + to: this.address, + data: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexConcat"])([selector, Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["namehash"])(this.name), parameters || "0x"]) + }; + _context.prev = 1; + _context.t0 = _parseBytes; + _context.next = 5; + return this.provider.call(tx); + + case 5: + _context.t1 = _context.sent; + return _context.abrupt("return", (0, _context.t0)(_context.t1)); + + case 9: + _context.prev = 9; + _context.t2 = _context["catch"](1); + + if (!(_context.t2.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.CALL_EXCEPTION)) { + _context.next = 13; + break; + } + + return _context.abrupt("return", null); + + case 13: + return _context.abrupt("return", null); + + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, this, [[1, 9]]); + })); + } + }, { + key: "_getAddress", + value: function _getAddress(coinType, hexBytes) { + var coinInfo = coinInfos[String(coinType)]; + + if (coinInfo == null) { + logger.throwError("unsupported coin type: ".concat(coinType), _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(".concat(coinType, ")") + }); + } + + if (coinInfo.ilk === "eth") { + return this.provider.formatter.address(hexBytes); + } + + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(hexBytes); // P2PKH: OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG + + if (coinInfo.p2pkh != null) { + var p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/); + + if (p2pkh) { + var length = parseInt(p2pkh[1], 16); + + if (p2pkh[2].length === length * 2 && length >= 1 && length <= 75) { + return base58Encode(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([[coinInfo.p2pkh], "0x" + p2pkh[2]])); + } + } + } // P2SH: OP_HASH160 OP_EQUAL + + + if (coinInfo.p2sh != null) { + var p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/); + + if (p2sh) { + var _length = parseInt(p2sh[1], 16); + + if (p2sh[2].length === _length * 2 && _length >= 1 && _length <= 75) { + return base58Encode(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([[coinInfo.p2sh], "0x" + p2sh[2]])); + } + } + } // Bech32 + + + if (coinInfo.prefix != null) { + var _length2 = bytes[1]; // https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program + + var _version = bytes[0]; + + if (_version === 0x00) { + if (_length2 !== 20 && _length2 !== 32) { + _version = -1; + } + } else { + _version = -1; + } + + if (_version >= 0 && bytes.length === 2 + _length2 && _length2 >= 1 && _length2 <= 75) { + var words = bech32__WEBPACK_IMPORTED_MODULE_11___default.a.toWords(bytes.slice(2)); + words.unshift(_version); + return bech32__WEBPACK_IMPORTED_MODULE_11___default.a.encode(coinInfo.prefix, words); + } + } + + return null; + } + }, { + key: "getAddress", + value: function getAddress(coinType) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + var transaction, _hexBytes, hexBytes, address; + + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (coinType == null) { + coinType = 60; + } // If Ethereum, use the standard `addr(bytes32)` + + + if (!(coinType === 60)) { + _context2.next = 17; + break; + } + + _context2.prev = 2; + // keccak256("addr(bytes32)") + transaction = { + to: this.address, + data: "0x3b3b57de" + Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["namehash"])(this.name).substring(2) + }; + _context2.next = 6; + return this.provider.call(transaction); + + case 6: + _hexBytes = _context2.sent; + + if (!(_hexBytes === "0x" || _hexBytes === _ethersproject_constants__WEBPACK_IMPORTED_MODULE_4__["HashZero"])) { + _context2.next = 9; + break; + } + + return _context2.abrupt("return", null); + + case 9: + return _context2.abrupt("return", this.provider.formatter.callAddress(_hexBytes)); + + case 12: + _context2.prev = 12; + _context2.t0 = _context2["catch"](2); + + if (!(_context2.t0.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.CALL_EXCEPTION)) { + _context2.next = 16; + break; + } + + return _context2.abrupt("return", null); + + case 16: + throw _context2.t0; + + case 17: + _context2.next = 19; + return this._fetchBytes("0xf1cb7e06", bytes32ify(coinType)); + + case 19: + hexBytes = _context2.sent; + + if (!(hexBytes == null || hexBytes === "0x")) { + _context2.next = 22; + break; + } + + return _context2.abrupt("return", null); + + case 22: + // Compute the address + address = this._getAddress(coinType, hexBytes); + + if (address == null) { + logger.throwError("invalid or unsupported coin data", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(".concat(coinType, ")"), + coinType: coinType, + data: hexBytes + }); + } + + return _context2.abrupt("return", address); + + case 25: + case "end": + return _context2.stop(); + } + } + }, _callee2, this, [[2, 12]]); + })); + } + }, { + key: "getAvatar", + value: function getAvatar() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + var linkage, avatar, i, match, scheme, selector, owner, comps, addr, tokenId, tokenOwner, balance, tx, metadataUrl, metadata, imageUrl, ipfs; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + linkage = [{ + type: "name", + content: this.name + }]; + _context3.prev = 1; + _context3.next = 4; + return this.getText("avatar"); + + case 4: + avatar = _context3.sent; + + if (!(avatar == null)) { + _context3.next = 7; + break; + } + + return _context3.abrupt("return", null); + + case 7: + i = 0; + + case 8: + if (!(i < matchers.length)) { + _context3.next = 91; + break; + } + + match = avatar.match(matchers[i]); + + if (!(match == null)) { + _context3.next = 12; + break; + } + + return _context3.abrupt("continue", 88); + + case 12: + scheme = match[1].toLowerCase(); + _context3.t0 = scheme; + _context3.next = _context3.t0 === "https" ? 16 : _context3.t0 === "data" ? 18 : _context3.t0 === "ipfs" ? 20 : _context3.t0 === "erc721" ? 22 : _context3.t0 === "erc1155" ? 22 : 88; + break; + + case 16: + linkage.push({ + type: "url", + content: avatar + }); + return _context3.abrupt("return", { + linkage: linkage, + url: avatar + }); + + case 18: + linkage.push({ + type: "data", + content: avatar + }); + return _context3.abrupt("return", { + linkage: linkage, + url: avatar + }); + + case 20: + linkage.push({ + type: "ipfs", + content: avatar + }); + return _context3.abrupt("return", { + linkage: linkage, + url: getIpfsLink(avatar) + }); + + case 22: + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + selector = scheme === "erc721" ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ + type: scheme, + content: avatar + }); // The owner of this name + + _context3.t1 = this._resolvedAddress; + + if (_context3.t1) { + _context3.next = 29; + break; + } + + _context3.next = 28; + return this.getAddress(); + + case 28: + _context3.t1 = _context3.sent; + + case 29: + owner = _context3.t1; + comps = (match[2] || "").split("/"); + + if (!(comps.length !== 2)) { + _context3.next = 33; + break; + } + + return _context3.abrupt("return", null); + + case 33: + _context3.next = 35; + return this.provider.formatter.address(comps[0]); + + case 35: + addr = _context3.sent; + tokenId = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexZeroPad"])(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(comps[1]).toHexString(), 32); // Check that this account owns the token + + if (!(scheme === "erc721")) { + _context3.next = 48; + break; + } + + _context3.t2 = this.provider.formatter; + _context3.next = 41; + return this.provider.call({ + to: addr, + data: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexConcat"])(["0x6352211e", tokenId]) + }); + + case 41: + _context3.t3 = _context3.sent; + tokenOwner = _context3.t2.callAddress.call(_context3.t2, _context3.t3); + + if (!(owner !== tokenOwner)) { + _context3.next = 45; + break; + } + + return _context3.abrupt("return", null); + + case 45: + linkage.push({ + type: "owner", + content: tokenOwner + }); + _context3.next = 57; + break; + + case 48: + if (!(scheme === "erc1155")) { + _context3.next = 57; + break; + } + + _context3.t4 = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"]; + _context3.next = 52; + return this.provider.call({ + to: addr, + data: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexConcat"])(["0x00fdd58e", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexZeroPad"])(owner, 32), tokenId]) + }); + + case 52: + _context3.t5 = _context3.sent; + balance = _context3.t4.from.call(_context3.t4, _context3.t5); + + if (!balance.isZero()) { + _context3.next = 56; + break; + } + + return _context3.abrupt("return", null); + + case 56: + linkage.push({ + type: "balance", + content: balance.toString() + }); + + case 57: + // Call the token contract for the metadata URL + tx = { + to: this.provider.formatter.address(comps[0]), + data: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexConcat"])([selector, tokenId]) + }; + _context3.t6 = _parseString; + _context3.next = 61; + return this.provider.call(tx); + + case 61: + _context3.t7 = _context3.sent; + metadataUrl = (0, _context3.t6)(_context3.t7); + + if (!(metadataUrl == null)) { + _context3.next = 65; + break; + } + + return _context3.abrupt("return", null); + + case 65: + linkage.push({ + type: "metadata-url-base", + content: metadataUrl + }); // ERC-1155 allows a generic {id} in the URL + + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + linkage.push({ + type: "metadata-url-expanded", + content: metadataUrl + }); + } // Transform IPFS metadata links + + + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + + linkage.push({ + type: "metadata-url", + content: metadataUrl + }); // Get the token metadata + + _context3.next = 71; + return Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_10__["fetchJson"])(metadataUrl); + + case 71: + metadata = _context3.sent; + + if (metadata) { + _context3.next = 74; + break; + } + + return _context3.abrupt("return", null); + + case 74: + linkage.push({ + type: "metadata", + content: JSON.stringify(metadata) + }); // Pull the image URL out + + imageUrl = metadata.image; + + if (!(typeof imageUrl !== "string")) { + _context3.next = 78; + break; + } + + return _context3.abrupt("return", null); + + case 78: + if (!imageUrl.match(/^(https:\/\/|data:)/i)) { + _context3.next = 81; + break; + } + + _context3.next = 86; + break; + + case 81: + // Transform IPFS link to gateway + ipfs = imageUrl.match(matcherIpfs); + + if (!(ipfs == null)) { + _context3.next = 84; + break; + } + + return _context3.abrupt("return", null); + + case 84: + linkage.push({ + type: "url-ipfs", + content: imageUrl + }); + imageUrl = getIpfsLink(imageUrl); + + case 86: + linkage.push({ + type: "url", + content: imageUrl + }); + return _context3.abrupt("return", { + linkage: linkage, + url: imageUrl + }); + + case 88: + i++; + _context3.next = 8; + break; + + case 91: + _context3.next = 95; + break; + + case 93: + _context3.prev = 93; + _context3.t8 = _context3["catch"](1); + + case 95: + return _context3.abrupt("return", null); + + case 96: + case "end": + return _context3.stop(); + } + } + }, _callee3, this, [[1, 93]]); + })); + } + }, { + key: "getContentHash", + value: function getContentHash() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + var hexBytes, ipfs, length, swarm; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return this._fetchBytes("0xbc1c58d1"); + + case 2: + hexBytes = _context4.sent; + + if (!(hexBytes == null || hexBytes === "0x")) { + _context4.next = 5; + break; + } + + return _context4.abrupt("return", null); + + case 5: + // IPFS (CID: 1, Type: DAG-PB) + ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + + if (!ipfs) { + _context4.next = 10; + break; + } + + length = parseInt(ipfs[3], 16); + + if (!(ipfs[4].length === length * 2)) { + _context4.next = 10; + break; + } + + return _context4.abrupt("return", "ipfs:/\/" + _ethersproject_basex__WEBPACK_IMPORTED_MODULE_1__["Base58"].encode("0x" + ipfs[1])); + + case 10: + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); + + if (!swarm) { + _context4.next = 14; + break; + } + + if (!(swarm[1].length === 32 * 2)) { + _context4.next = 14; + break; + } + + return _context4.abrupt("return", "bzz:/\/" + swarm[1]); + + case 14: + return _context4.abrupt("return", logger.throwError("invalid or unsupported content hash data", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "getContentHash()", + data: hexBytes + })); + + case 15: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + } + }, { + key: "getText", + value: function getText(key) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { + var keyBytes, hexBytes; + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + // The key encoded as parameter to fetchBytes + keyBytes = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__["toUtf8Bytes"])(key); // The nodehash consumes the first slot, so the string pointer targets + // offset 64, with the length at offset 64 and data starting at offset 96 + + keyBytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]); // Pad to word-size (32 bytes) + + if (keyBytes.length % 32 !== 0) { + keyBytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([keyBytes, Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexZeroPad"])("0x", 32 - key.length % 32)]); + } + + _context5.next = 5; + return this._fetchBytes("0x59d1d43c", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(keyBytes)); + + case 5: + hexBytes = _context5.sent; + + if (!(hexBytes == null || hexBytes === "0x")) { + _context5.next = 8; + break; + } + + return _context5.abrupt("return", null); + + case 8: + return _context5.abrupt("return", Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__["toUtf8String"])(hexBytes)); + + case 9: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + } + }]); + + return Resolver; +}(); +var defaultFormatter = null; +var nextPollId = 1; +var BaseProvider = /*#__PURE__*/function (_Provider) { + _inherits(BaseProvider, _Provider); + + var _super = _createSuper(BaseProvider); + + /** + * ready + * + * A Promise that resolves only once the provider is ready. + * + * Sub-classes that call the super with a network without a chainId + * MUST set this. Standard named networks have a known chainId. + * + */ + function BaseProvider(network) { + var _this; + + _classCallCheck(this, BaseProvider); + + logger.checkNew(this instanceof BaseProvider ? this.constructor : void 0, _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__["Provider"]); + _this = _super.call(this); // Events being listened to + + _this._events = []; + _this._emitted = { + block: -2 + }; + _this.formatter = (this instanceof BaseProvider ? this.constructor : void 0).getFormatter(); // If network is any, this Provider allows the underlying + // network to change dynamically, and we auto-detect the + // current network + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "anyNetwork", network === "any"); + + if (_this.anyNetwork) { + network = _this.detectNetwork(); + } + + if (network instanceof Promise) { + _this._networkPromise = network; // Squash any "unhandled promise" errors; that do not need to be handled + + network["catch"](function (error) {}); // Trigger initial network setting (async) + + _this._ready()["catch"](function (error) {}); + } else { + var knownNetwork = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["getStatic"])(this instanceof BaseProvider ? this.constructor : void 0, "getNetwork")(network); + + if (knownNetwork) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "_network", knownNetwork); + + _this.emit("network", knownNetwork, null); + } else { + logger.throwArgumentError("invalid network", "network", network); + } + } + + _this._maxInternalBlockNumber = -1024; + _this._lastBlockNumber = -2; + _this._pollingInterval = 4000; + _this._fastQueryDate = 0; + return _this; + } + + _createClass(BaseProvider, [{ + key: "_ready", + value: function _ready() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { + var network; + return regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + if (!(this._network == null)) { + _context6.next = 17; + break; + } + + network = null; + + if (!this._networkPromise) { + _context6.next = 11; + break; + } + + _context6.prev = 3; + _context6.next = 6; + return this._networkPromise; + + case 6: + network = _context6.sent; + _context6.next = 11; + break; + + case 9: + _context6.prev = 9; + _context6.t0 = _context6["catch"](3); + + case 11: + if (!(network == null)) { + _context6.next = 15; + break; + } + + _context6.next = 14; + return this.detectNetwork(); + + case 14: + network = _context6.sent; + + case 15: + // This should never happen; every Provider sub-class should have + // suggested a network by here (or have thrown). + if (!network) { + logger.throwError("no network detected", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNKNOWN_ERROR, {}); + } // Possible this call stacked so do not call defineReadOnly again + + + if (this._network == null) { + if (this.anyNetwork) { + this._network = network; + } else { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(this, "_network", network); + } + + this.emit("network", network, null); + } + + case 17: + return _context6.abrupt("return", this._network); + + case 18: + case "end": + return _context6.stop(); + } + } + }, _callee6, this, [[3, 9]]); + })); + } // This will always return the most recently established network. + // For "any", this can change (a "network" event is emitted before + // any change is reflected); otherwise this cannot change + + }, { + key: "ready", + get: function get() { + var _this2 = this; + + return Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_10__["poll"])(function () { + return _this2._ready().then(function (network) { + return network; + }, function (error) { + // If the network isn't running yet, we will wait + if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.NETWORK_ERROR && error.event === "noNetwork") { + return undefined; + } + + throw error; + }); + }); + } // @TODO: Remove this and just create a singleton formatter + + }, { + key: "_getInternalBlockNumber", + value: // Fetches the blockNumber, but will reuse any result that is less + // than maxAge old or has been requested since the last request + function _getInternalBlockNumber(maxAge) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { + var _this3 = this; + + var internalBlockNumber, result, reqTime, checkInternalBlockNumber; + return regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + _context7.next = 2; + return this._ready(); + + case 2: + if (!(maxAge > 0)) { + _context7.next = 20; + break; + } + + case 3: + if (!this._internalBlockNumber) { + _context7.next = 20; + break; + } + + // ..."remember" which fetch we started with + internalBlockNumber = this._internalBlockNumber; + _context7.prev = 5; + _context7.next = 8; + return internalBlockNumber; + + case 8: + result = _context7.sent; + + if (!(getTime() - result.respTime <= maxAge)) { + _context7.next = 11; + break; + } + + return _context7.abrupt("return", result.blockNumber); + + case 11: + return _context7.abrupt("break", 20); + + case 14: + _context7.prev = 14; + _context7.t0 = _context7["catch"](5); + + if (!(this._internalBlockNumber === internalBlockNumber)) { + _context7.next = 18; + break; + } + + return _context7.abrupt("break", 20); + + case 18: + _context7.next = 3; + break; + + case 20: + reqTime = getTime(); + checkInternalBlockNumber = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + blockNumber: this.perform("getBlockNumber", {}), + networkError: this.getNetwork().then(function (network) { + return null; + }, function (error) { + return error; + }) + }).then(function (_ref) { + var blockNumber = _ref.blockNumber, + networkError = _ref.networkError; + + if (networkError) { + // Unremember this bad internal block number + if (_this3._internalBlockNumber === checkInternalBlockNumber) { + _this3._internalBlockNumber = null; + } + + throw networkError; + } + + var respTime = getTime(); + blockNumber = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(blockNumber).toNumber(); + + if (blockNumber < _this3._maxInternalBlockNumber) { + blockNumber = _this3._maxInternalBlockNumber; + } + + _this3._maxInternalBlockNumber = blockNumber; + + _this3._setFastBlockNumber(blockNumber); // @TODO: Still need this? + + + return { + blockNumber: blockNumber, + reqTime: reqTime, + respTime: respTime + }; + }); + this._internalBlockNumber = checkInternalBlockNumber; // Swallow unhandled exceptions; if needed they are handled else where + + checkInternalBlockNumber["catch"](function (error) { + // Don't null the dead (rejected) fetch, if it has already been updated + if (_this3._internalBlockNumber === checkInternalBlockNumber) { + _this3._internalBlockNumber = null; + } + }); + _context7.next = 26; + return checkInternalBlockNumber; + + case 26: + return _context7.abrupt("return", _context7.sent.blockNumber); + + case 27: + case "end": + return _context7.stop(); + } + } + }, _callee7, this, [[5, 14]]); + })); + } + }, { + key: "poll", + value: function poll() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee8() { + var _this4 = this; + + var pollId, runners, blockNumber, i; + return regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + pollId = nextPollId++; // Track all running promises, so we can trigger a post-poll once they are complete + + runners = []; + blockNumber = null; + _context8.prev = 3; + _context8.next = 6; + return this._getInternalBlockNumber(100 + this.pollingInterval / 2); + + case 6: + blockNumber = _context8.sent; + _context8.next = 13; + break; + + case 9: + _context8.prev = 9; + _context8.t0 = _context8["catch"](3); + this.emit("error", _context8.t0); + return _context8.abrupt("return"); + + case 13: + this._setFastBlockNumber(blockNumber); // Emit a poll event after we have the latest (fast) block number + + + this.emit("poll", pollId, blockNumber); // If the block has not changed, meh. + + if (!(blockNumber === this._lastBlockNumber)) { + _context8.next = 18; + break; + } + + this.emit("didPoll", pollId); + return _context8.abrupt("return"); + + case 18: + // First polling cycle, trigger a "block" events + if (this._emitted.block === -2) { + this._emitted.block = blockNumber - 1; + } + + if (Math.abs(this._emitted.block - blockNumber) > 1000) { + logger.warn("network block skew detected; skipping block events (emitted=".concat(this._emitted.block, " blockNumber").concat(blockNumber, ")")); + this.emit("error", logger.makeError("network block skew detected", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.NETWORK_ERROR, { + blockNumber: blockNumber, + event: "blockSkew", + previousBlockNumber: this._emitted.block + })); + this.emit("block", blockNumber); + } else { + // Notify all listener for each block that has passed + for (i = this._emitted.block + 1; i <= blockNumber; i++) { + this.emit("block", i); + } + } // The emitted block was updated, check for obsolete events + + + if (this._emitted.block !== blockNumber) { + this._emitted.block = blockNumber; + Object.keys(this._emitted).forEach(function (key) { + // The block event does not expire + if (key === "block") { + return; + } // The block we were at when we emitted this event + + + var eventBlockNumber = _this4._emitted[key]; // We cannot garbage collect pending transactions or blocks here + // They should be garbage collected by the Provider when setting + // "pending" events + + if (eventBlockNumber === "pending") { + return; + } // Evict any transaction hashes or block hashes over 12 blocks + // old, since they should not return null anyways + + + if (blockNumber - eventBlockNumber > 12) { + delete _this4._emitted[key]; + } + }); + } // First polling cycle + + + if (this._lastBlockNumber === -2) { + this._lastBlockNumber = blockNumber - 1; + } // Find all transaction hashes we are waiting on + + + this._events.forEach(function (event) { + switch (event.type) { + case "tx": + { + var hash = event.hash; + + var runner = _this4.getTransactionReceipt(hash).then(function (receipt) { + if (!receipt || receipt.blockNumber == null) { + return null; + } + + _this4._emitted["t:" + hash] = receipt.blockNumber; + + _this4.emit(hash, receipt); + + return null; + })["catch"](function (error) { + _this4.emit("error", error); + }); + + runners.push(runner); + break; + } + + case "filter": + { + var filter = event.filter; + filter.fromBlock = _this4._lastBlockNumber + 1; + filter.toBlock = blockNumber; + + var _runner = _this4.getLogs(filter).then(function (logs) { + if (logs.length === 0) { + return; + } + + logs.forEach(function (log) { + _this4._emitted["b:" + log.blockHash] = log.blockNumber; + _this4._emitted["t:" + log.transactionHash] = log.blockNumber; + + _this4.emit(filter, log); + }); + })["catch"](function (error) { + _this4.emit("error", error); + }); + + runners.push(_runner); + break; + } + } + }); + + this._lastBlockNumber = blockNumber; // Once all events for this loop have been processed, emit "didPoll" + + Promise.all(runners).then(function () { + _this4.emit("didPoll", pollId); + })["catch"](function (error) { + _this4.emit("error", error); + }); + return _context8.abrupt("return"); + + case 26: + case "end": + return _context8.stop(); + } + } + }, _callee8, this, [[3, 9]]); + })); + } // Deprecated; do not use this + + }, { + key: "resetEventsBlock", + value: function resetEventsBlock(blockNumber) { + this._lastBlockNumber = blockNumber - 1; + + if (this.polling) { + this.poll(); + } + } + }, { + key: "network", + get: function get() { + return this._network; + } // This method should query the network if the underlying network + // can change, such as when connected to a JSON-RPC backend + + }, { + key: "detectNetwork", + value: function detectNetwork() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee9() { + return regeneratorRuntime.wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + return _context9.abrupt("return", logger.throwError("provider does not support network detection", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "provider.detectNetwork" + })); + + case 1: + case "end": + return _context9.stop(); + } + } + }, _callee9); + })); + } + }, { + key: "getNetwork", + value: function getNetwork() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee10() { + var network, currentNetwork, error; + return regeneratorRuntime.wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + _context10.next = 2; + return this._ready(); + + case 2: + network = _context10.sent; + _context10.next = 5; + return this.detectNetwork(); + + case 5: + currentNetwork = _context10.sent; + + if (!(network.chainId !== currentNetwork.chainId)) { + _context10.next = 23; + break; + } + + if (!this.anyNetwork) { + _context10.next = 20; + break; + } + + this._network = currentNetwork; // Reset all internal block number guards and caches + + this._lastBlockNumber = -2; + this._fastBlockNumber = null; + this._fastBlockNumberPromise = null; + this._fastQueryDate = 0; + this._emitted.block = -2; + this._maxInternalBlockNumber = -1024; + this._internalBlockNumber = null; // The "network" event MUST happen before this method resolves + // so any events have a chance to unregister, so we stall an + // additional event loop before returning from /this/ call + + this.emit("network", currentNetwork, network); + _context10.next = 19; + return stall(0); + + case 19: + return _context10.abrupt("return", this._network); + + case 20: + error = logger.makeError("underlying network changed", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.NETWORK_ERROR, { + event: "changed", + network: network, + detectedNetwork: currentNetwork + }); + this.emit("error", error); + throw error; + + case 23: + return _context10.abrupt("return", network); + + case 24: + case "end": + return _context10.stop(); + } + } + }, _callee10, this); + })); + } + }, { + key: "blockNumber", + get: function get() { + var _this5 = this; + + this._getInternalBlockNumber(100 + this.pollingInterval / 2).then(function (blockNumber) { + _this5._setFastBlockNumber(blockNumber); + }, function (error) {}); + + return this._fastBlockNumber != null ? this._fastBlockNumber : -1; + } + }, { + key: "polling", + get: function get() { + return this._poller != null; + }, + set: function set(value) { + var _this6 = this; + + if (value && !this._poller) { + this._poller = setInterval(function () { + _this6.poll(); + }, this.pollingInterval); + + if (!this._bootstrapPoll) { + this._bootstrapPoll = setTimeout(function () { + _this6.poll(); // We block additional polls until the polling interval + // is done, to prevent overwhelming the poll function + + + _this6._bootstrapPoll = setTimeout(function () { + // If polling was disabled, something may require a poke + // since starting the bootstrap poll and it was disabled + if (!_this6._poller) { + _this6.poll(); + } // Clear out the bootstrap so we can do another + + + _this6._bootstrapPoll = null; + }, _this6.pollingInterval); + }, 0); + } + } else if (!value && this._poller) { + clearInterval(this._poller); + this._poller = null; + } + } + }, { + key: "pollingInterval", + get: function get() { + return this._pollingInterval; + }, + set: function set(value) { + var _this7 = this; + + if (typeof value !== "number" || value <= 0 || parseInt(String(value)) != value) { + throw new Error("invalid polling interval"); + } + + this._pollingInterval = value; + + if (this._poller) { + clearInterval(this._poller); + this._poller = setInterval(function () { + _this7.poll(); + }, this._pollingInterval); + } + } + }, { + key: "_getFastBlockNumber", + value: function _getFastBlockNumber() { + var _this8 = this; + + var now = getTime(); // Stale block number, request a newer value + + if (now - this._fastQueryDate > 2 * this._pollingInterval) { + this._fastQueryDate = now; + this._fastBlockNumberPromise = this.getBlockNumber().then(function (blockNumber) { + if (_this8._fastBlockNumber == null || blockNumber > _this8._fastBlockNumber) { + _this8._fastBlockNumber = blockNumber; + } + + return _this8._fastBlockNumber; + }); + } + + return this._fastBlockNumberPromise; + } + }, { + key: "_setFastBlockNumber", + value: function _setFastBlockNumber(blockNumber) { + // Older block, maybe a stale request + if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { + return; + } // Update the time we updated the blocknumber + + + this._fastQueryDate = getTime(); // Newer block number, use it + + if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { + this._fastBlockNumber = blockNumber; + this._fastBlockNumberPromise = Promise.resolve(blockNumber); + } + } + }, { + key: "waitForTransaction", + value: function waitForTransaction(transactionHash, confirmations, timeout) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee11() { + return regeneratorRuntime.wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + return _context11.abrupt("return", this._waitForTransaction(transactionHash, confirmations == null ? 1 : confirmations, timeout || 0, null)); + + case 1: + case "end": + return _context11.stop(); + } + } + }, _callee11, this); + })); + } + }, { + key: "_waitForTransaction", + value: function _waitForTransaction(transactionHash, confirmations, timeout, replaceable) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee14() { + var _this9 = this; + + var receipt; + return regeneratorRuntime.wrap(function _callee14$(_context14) { + while (1) { + switch (_context14.prev = _context14.next) { + case 0: + _context14.next = 2; + return this.getTransactionReceipt(transactionHash); + + case 2: + receipt = _context14.sent; + + if (!((receipt ? receipt.confirmations : 0) >= confirmations)) { + _context14.next = 5; + break; + } + + return _context14.abrupt("return", receipt); + + case 5: + return _context14.abrupt("return", new Promise(function (resolve, reject) { + var cancelFuncs = []; + var done = false; + + var alreadyDone = function alreadyDone() { + if (done) { + return true; + } + + done = true; + cancelFuncs.forEach(function (func) { + func(); + }); + return false; + }; + + var minedHandler = function minedHandler(receipt) { + if (receipt.confirmations < confirmations) { + return; + } + + if (alreadyDone()) { + return; + } + + resolve(receipt); + }; + + _this9.on(transactionHash, minedHandler); + + cancelFuncs.push(function () { + _this9.removeListener(transactionHash, minedHandler); + }); + + if (replaceable) { + var lastBlockNumber = replaceable.startBlock; + var scannedBlock = null; + + var replaceHandler = function replaceHandler(blockNumber) { + return __awaiter(_this9, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee13() { + var _this10 = this; + + return regeneratorRuntime.wrap(function _callee13$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + if (!done) { + _context13.next = 2; + break; + } + + return _context13.abrupt("return"); + + case 2: + _context13.next = 4; + return stall(1000); + + case 4: + this.getTransactionCount(replaceable.from).then(function (nonce) { + return __awaiter(_this10, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee12() { + var mined, block, ti, tx, _receipt, reason; + + return regeneratorRuntime.wrap(function _callee12$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + if (!done) { + _context12.next = 2; + break; + } + + return _context12.abrupt("return"); + + case 2: + if (!(nonce <= replaceable.nonce)) { + _context12.next = 6; + break; + } + + lastBlockNumber = blockNumber; + _context12.next = 41; + break; + + case 6: + _context12.next = 8; + return this.getTransaction(transactionHash); + + case 8: + mined = _context12.sent; + + if (!(mined && mined.blockNumber != null)) { + _context12.next = 11; + break; + } + + return _context12.abrupt("return"); + + case 11: + // First time scanning. We start a little earlier for some + // wiggle room here to handle the eventually consistent nature + // of blockchain (e.g. the getTransactionCount was for a + // different block) + if (scannedBlock == null) { + scannedBlock = lastBlockNumber - 3; + + if (scannedBlock < replaceable.startBlock) { + scannedBlock = replaceable.startBlock; + } + } + + case 12: + if (!(scannedBlock <= blockNumber)) { + _context12.next = 41; + break; + } + + if (!done) { + _context12.next = 15; + break; + } + + return _context12.abrupt("return"); + + case 15: + _context12.next = 17; + return this.getBlockWithTransactions(scannedBlock); + + case 17: + block = _context12.sent; + ti = 0; + + case 19: + if (!(ti < block.transactions.length)) { + _context12.next = 38; + break; + } + + tx = block.transactions[ti]; // Successfully mined! + + if (!(tx.hash === transactionHash)) { + _context12.next = 23; + break; + } + + return _context12.abrupt("return"); + + case 23: + if (!(tx.from === replaceable.from && tx.nonce === replaceable.nonce)) { + _context12.next = 35; + break; + } + + if (!done) { + _context12.next = 26; + break; + } + + return _context12.abrupt("return"); + + case 26: + _context12.next = 28; + return this.waitForTransaction(tx.hash, confirmations); + + case 28: + _receipt = _context12.sent; + + if (!alreadyDone()) { + _context12.next = 31; + break; + } + + return _context12.abrupt("return"); + + case 31: + // The reason we were replaced + reason = "replaced"; + + if (tx.data === replaceable.data && tx.to === replaceable.to && tx.value.eq(replaceable.value)) { + reason = "repriced"; + } else if (tx.data === "0x" && tx.from === tx.to && tx.value.isZero()) { + reason = "cancelled"; + } // Explain why we were replaced + + + // Explain why we were replaced + reject(logger.makeError("transaction was replaced", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.TRANSACTION_REPLACED, { + cancelled: reason === "replaced" || reason === "cancelled", + reason: reason, + replacement: this._wrapTransaction(tx), + hash: transactionHash, + receipt: _receipt + })); + return _context12.abrupt("return"); + + case 35: + ti++; + _context12.next = 19; + break; + + case 38: + scannedBlock++; + _context12.next = 12; + break; + + case 41: + if (!done) { + _context12.next = 43; + break; + } + + return _context12.abrupt("return"); + + case 43: + this.once("block", replaceHandler); + + case 44: + case "end": + return _context12.stop(); + } + } + }, _callee12, this); + })); + }, function (error) { + if (done) { + return; + } + + _this10.once("block", replaceHandler); + }); + + case 5: + case "end": + return _context13.stop(); + } + } + }, _callee13, this); + })); + }; + + if (done) { + return; + } + + _this9.once("block", replaceHandler); + + cancelFuncs.push(function () { + _this9.removeListener("block", replaceHandler); + }); + } + + if (typeof timeout === "number" && timeout > 0) { + var timer = setTimeout(function () { + if (alreadyDone()) { + return; + } + + reject(logger.makeError("timeout exceeded", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.TIMEOUT, { + timeout: timeout + })); + }, timeout); + + if (timer.unref) { + timer.unref(); + } + + cancelFuncs.push(function () { + clearTimeout(timer); + }); + } + })); + + case 6: + case "end": + return _context14.stop(); + } + } + }, _callee14, this); + })); + } + }, { + key: "getBlockNumber", + value: function getBlockNumber() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee15() { + return regeneratorRuntime.wrap(function _callee15$(_context15) { + while (1) { + switch (_context15.prev = _context15.next) { + case 0: + return _context15.abrupt("return", this._getInternalBlockNumber(0)); + + case 1: + case "end": + return _context15.stop(); + } + } + }, _callee15, this); + })); + } + }, { + key: "getGasPrice", + value: function getGasPrice() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee16() { + var result; + return regeneratorRuntime.wrap(function _callee16$(_context16) { + while (1) { + switch (_context16.prev = _context16.next) { + case 0: + _context16.next = 2; + return this.getNetwork(); + + case 2: + _context16.next = 4; + return this.perform("getGasPrice", {}); + + case 4: + result = _context16.sent; + _context16.prev = 5; + return _context16.abrupt("return", _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(result)); + + case 9: + _context16.prev = 9; + _context16.t0 = _context16["catch"](5); + return _context16.abrupt("return", logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.SERVER_ERROR, { + method: "getGasPrice", + result: result, + error: _context16.t0 + })); + + case 12: + case "end": + return _context16.stop(); + } + } + }, _callee16, this, [[5, 9]]); + })); + } + }, { + key: "getBalance", + value: function getBalance(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee17() { + var params, result; + return regeneratorRuntime.wrap(function _callee17$(_context17) { + while (1) { + switch (_context17.prev = _context17.next) { + case 0: + _context17.next = 2; + return this.getNetwork(); + + case 2: + _context17.next = 4; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + }); + + case 4: + params = _context17.sent; + _context17.next = 7; + return this.perform("getBalance", params); + + case 7: + result = _context17.sent; + _context17.prev = 8; + return _context17.abrupt("return", _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(result)); + + case 12: + _context17.prev = 12; + _context17.t0 = _context17["catch"](8); + return _context17.abrupt("return", logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.SERVER_ERROR, { + method: "getBalance", + params: params, + result: result, + error: _context17.t0 + })); + + case 15: + case "end": + return _context17.stop(); + } + } + }, _callee17, this, [[8, 12]]); + })); + } + }, { + key: "getTransactionCount", + value: function getTransactionCount(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee18() { + var params, result; + return regeneratorRuntime.wrap(function _callee18$(_context18) { + while (1) { + switch (_context18.prev = _context18.next) { + case 0: + _context18.next = 2; + return this.getNetwork(); + + case 2: + _context18.next = 4; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + }); + + case 4: + params = _context18.sent; + _context18.next = 7; + return this.perform("getTransactionCount", params); + + case 7: + result = _context18.sent; + _context18.prev = 8; + return _context18.abrupt("return", _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(result).toNumber()); + + case 12: + _context18.prev = 12; + _context18.t0 = _context18["catch"](8); + return _context18.abrupt("return", logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.SERVER_ERROR, { + method: "getTransactionCount", + params: params, + result: result, + error: _context18.t0 + })); + + case 15: + case "end": + return _context18.stop(); + } + } + }, _callee18, this, [[8, 12]]); + })); + } + }, { + key: "getCode", + value: function getCode(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee19() { + var params, result; + return regeneratorRuntime.wrap(function _callee19$(_context19) { + while (1) { + switch (_context19.prev = _context19.next) { + case 0: + _context19.next = 2; + return this.getNetwork(); + + case 2: + _context19.next = 4; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + }); + + case 4: + params = _context19.sent; + _context19.next = 7; + return this.perform("getCode", params); + + case 7: + result = _context19.sent; + _context19.prev = 8; + return _context19.abrupt("return", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(result)); + + case 12: + _context19.prev = 12; + _context19.t0 = _context19["catch"](8); + return _context19.abrupt("return", logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.SERVER_ERROR, { + method: "getCode", + params: params, + result: result, + error: _context19.t0 + })); + + case 15: + case "end": + return _context19.stop(); + } + } + }, _callee19, this, [[8, 12]]); + })); + } + }, { + key: "getStorageAt", + value: function getStorageAt(addressOrName, position, blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee20() { + var params, result; + return regeneratorRuntime.wrap(function _callee20$(_context20) { + while (1) { + switch (_context20.prev = _context20.next) { + case 0: + _context20.next = 2; + return this.getNetwork(); + + case 2: + _context20.next = 4; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag), + position: Promise.resolve(position).then(function (p) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexValue"])(p); + }) + }); + + case 4: + params = _context20.sent; + _context20.next = 7; + return this.perform("getStorageAt", params); + + case 7: + result = _context20.sent; + _context20.prev = 8; + return _context20.abrupt("return", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(result)); + + case 12: + _context20.prev = 12; + _context20.t0 = _context20["catch"](8); + return _context20.abrupt("return", logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.SERVER_ERROR, { + method: "getStorageAt", + params: params, + result: result, + error: _context20.t0 + })); + + case 15: + case "end": + return _context20.stop(); + } + } + }, _callee20, this, [[8, 12]]); + })); + } // This should be called by any subclass wrapping a TransactionResponse + + }, { + key: "_wrapTransaction", + value: function _wrapTransaction(tx, hash, startBlock) { + var _this11 = this; + + if (hash != null && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataLength"])(hash) !== 32) { + throw new Error("invalid response - sendTransaction"); + } + + var result = tx; // Check the hash we expect is the same as the hash the server reported + + if (hash != null && tx.hash !== hash) { + logger.throwError("Transaction hash mismatch from Provider.sendTransaction.", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNKNOWN_ERROR, { + expectedHash: tx.hash, + returnedHash: hash + }); + } + + result.wait = function (confirms, timeout) { + return __awaiter(_this11, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee21() { + var replacement, receipt; + return regeneratorRuntime.wrap(function _callee21$(_context21) { + while (1) { + switch (_context21.prev = _context21.next) { + case 0: + if (confirms == null) { + confirms = 1; + } + + if (timeout == null) { + timeout = 0; + } // Get the details to detect replacement + + + replacement = undefined; + + if (confirms !== 0 && startBlock != null) { + replacement = { + data: tx.data, + from: tx.from, + nonce: tx.nonce, + to: tx.to, + value: tx.value, + startBlock: startBlock + }; + } + + _context21.next = 6; + return this._waitForTransaction(tx.hash, confirms, timeout, replacement); + + case 6: + receipt = _context21.sent; + + if (!(receipt == null && confirms === 0)) { + _context21.next = 9; + break; + } + + return _context21.abrupt("return", null); + + case 9: + // No longer pending, allow the polling loop to garbage collect this + this._emitted["t:" + tx.hash] = receipt.blockNumber; + + if (receipt.status === 0) { + logger.throwError("transaction failed", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.CALL_EXCEPTION, { + transactionHash: tx.hash, + transaction: tx, + receipt: receipt + }); + } + + return _context21.abrupt("return", receipt); + + case 12: + case "end": + return _context21.stop(); + } + } + }, _callee21, this); + })); + }; + + return result; + } + }, { + key: "sendTransaction", + value: function sendTransaction(signedTransaction) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee22() { + var hexTx, tx, blockNumber, hash; + return regeneratorRuntime.wrap(function _callee22$(_context22) { + while (1) { + switch (_context22.prev = _context22.next) { + case 0: + _context22.next = 2; + return this.getNetwork(); + + case 2: + _context22.next = 4; + return Promise.resolve(signedTransaction).then(function (t) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(t); + }); + + case 4: + hexTx = _context22.sent; + tx = this.formatter.transaction(signedTransaction); + + if (tx.confirmations == null) { + tx.confirmations = 0; + } + + _context22.next = 9; + return this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + + case 9: + blockNumber = _context22.sent; + _context22.prev = 10; + _context22.next = 13; + return this.perform("sendTransaction", { + signedTransaction: hexTx + }); + + case 13: + hash = _context22.sent; + return _context22.abrupt("return", this._wrapTransaction(tx, hash, blockNumber)); + + case 17: + _context22.prev = 17; + _context22.t0 = _context22["catch"](10); + _context22.t0.transaction = tx; + _context22.t0.transactionHash = tx.hash; + throw _context22.t0; + + case 22: + case "end": + return _context22.stop(); + } + } + }, _callee22, this, [[10, 17]]); + })); + } + }, { + key: "_getTransactionRequest", + value: function _getTransactionRequest(transaction) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee23() { + var _this12 = this; + + var values, tx; + return regeneratorRuntime.wrap(function _callee23$(_context23) { + while (1) { + switch (_context23.prev = _context23.next) { + case 0: + _context23.next = 2; + return transaction; + + case 2: + values = _context23.sent; + tx = {}; + ["from", "to"].forEach(function (key) { + if (values[key] == null) { + return; + } + + tx[key] = Promise.resolve(values[key]).then(function (v) { + return v ? _this12._getAddress(v) : null; + }); + }); + ["gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "value"].forEach(function (key) { + if (values[key] == null) { + return; + } + + tx[key] = Promise.resolve(values[key]).then(function (v) { + return v ? _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(v) : null; + }); + }); + ["type"].forEach(function (key) { + if (values[key] == null) { + return; + } + + tx[key] = Promise.resolve(values[key]).then(function (v) { + return v != null ? v : null; + }); + }); + + if (values.accessList) { + tx.accessList = this.formatter.accessList(values.accessList); + } + + ["data"].forEach(function (key) { + if (values[key] == null) { + return; + } + + tx[key] = Promise.resolve(values[key]).then(function (v) { + return v ? Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(v) : null; + }); + }); + _context23.t0 = this.formatter; + _context23.next = 12; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])(tx); + + case 12: + _context23.t1 = _context23.sent; + return _context23.abrupt("return", _context23.t0.transactionRequest.call(_context23.t0, _context23.t1)); + + case 14: + case "end": + return _context23.stop(); + } + } + }, _callee23, this); + })); + } + }, { + key: "_getFilter", + value: function _getFilter(filter) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee24() { + var _this13 = this; + + var result; + return regeneratorRuntime.wrap(function _callee24$(_context24) { + while (1) { + switch (_context24.prev = _context24.next) { + case 0: + _context24.next = 2; + return filter; + + case 2: + filter = _context24.sent; + result = {}; + + if (filter.address != null) { + result.address = this._getAddress(filter.address); + } + + ["blockHash", "topics"].forEach(function (key) { + if (filter[key] == null) { + return; + } + + result[key] = filter[key]; + }); + ["fromBlock", "toBlock"].forEach(function (key) { + if (filter[key] == null) { + return; + } + + result[key] = _this13._getBlockTag(filter[key]); + }); + _context24.t0 = this.formatter; + _context24.next = 10; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])(result); + + case 10: + _context24.t1 = _context24.sent; + return _context24.abrupt("return", _context24.t0.filter.call(_context24.t0, _context24.t1)); + + case 12: + case "end": + return _context24.stop(); + } + } + }, _callee24, this); + })); + } + }, { + key: "call", + value: function call(transaction, blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee25() { + var params, result; + return regeneratorRuntime.wrap(function _callee25$(_context25) { + while (1) { + switch (_context25.prev = _context25.next) { + case 0: + _context25.next = 2; + return this.getNetwork(); + + case 2: + _context25.next = 4; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag) + }); + + case 4: + params = _context25.sent; + _context25.next = 7; + return this.perform("call", params); + + case 7: + result = _context25.sent; + _context25.prev = 8; + return _context25.abrupt("return", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexlify"])(result)); + + case 12: + _context25.prev = 12; + _context25.t0 = _context25["catch"](8); + return _context25.abrupt("return", logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.SERVER_ERROR, { + method: "call", + params: params, + result: result, + error: _context25.t0 + })); + + case 15: + case "end": + return _context25.stop(); + } + } + }, _callee25, this, [[8, 12]]); + })); + } + }, { + key: "estimateGas", + value: function estimateGas(transaction) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee26() { + var params, result; + return regeneratorRuntime.wrap(function _callee26$(_context26) { + while (1) { + switch (_context26.prev = _context26.next) { + case 0: + _context26.next = 2; + return this.getNetwork(); + + case 2: + _context26.next = 4; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + transaction: this._getTransactionRequest(transaction) + }); + + case 4: + params = _context26.sent; + _context26.next = 7; + return this.perform("estimateGas", params); + + case 7: + result = _context26.sent; + _context26.prev = 8; + return _context26.abrupt("return", _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(result)); + + case 12: + _context26.prev = 12; + _context26.t0 = _context26["catch"](8); + return _context26.abrupt("return", logger.throwError("bad result from backend", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.SERVER_ERROR, { + method: "estimateGas", + params: params, + result: result, + error: _context26.t0 + })); + + case 15: + case "end": + return _context26.stop(); + } + } + }, _callee26, this, [[8, 12]]); + })); + } + }, { + key: "_getAddress", + value: function _getAddress(addressOrName) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee27() { + var address; + return regeneratorRuntime.wrap(function _callee27$(_context27) { + while (1) { + switch (_context27.prev = _context27.next) { + case 0: + _context27.next = 2; + return addressOrName; + + case 2: + addressOrName = _context27.sent; + + if (typeof addressOrName !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } + + _context27.next = 6; + return this.resolveName(addressOrName); + + case 6: + address = _context27.sent; + + if (address == null) { + logger.throwError("ENS name not configured", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "resolveName(".concat(JSON.stringify(addressOrName), ")") + }); + } + + return _context27.abrupt("return", address); + + case 9: + case "end": + return _context27.stop(); + } + } + }, _callee27, this); + })); + } + }, { + key: "_getBlock", + value: function _getBlock(blockHashOrBlockTag, includeTransactions) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee29() { + var _this14 = this; + + var blockNumber, params; + return regeneratorRuntime.wrap(function _callee29$(_context29) { + while (1) { + switch (_context29.prev = _context29.next) { + case 0: + _context29.next = 2; + return this.getNetwork(); + + case 2: + _context29.next = 4; + return blockHashOrBlockTag; + + case 4: + blockHashOrBlockTag = _context29.sent; + // If blockTag is a number (not "latest", etc), this is the block number + blockNumber = -128; + params = { + includeTransactions: !!includeTransactions + }; + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["isHexString"])(blockHashOrBlockTag, 32)) { + _context29.next = 11; + break; + } + + params.blockHash = blockHashOrBlockTag; + _context29.next = 21; + break; + + case 11: + _context29.prev = 11; + _context29.next = 14; + return this._getBlockTag(blockHashOrBlockTag); + + case 14: + params.blockTag = _context29.sent; + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["isHexString"])(params.blockTag)) { + blockNumber = parseInt(params.blockTag.substring(2), 16); + } + + _context29.next = 21; + break; + + case 18: + _context29.prev = 18; + _context29.t0 = _context29["catch"](11); + logger.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag); + + case 21: + return _context29.abrupt("return", Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_10__["poll"])(function () { + return __awaiter(_this14, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee28() { + var _this15 = this; + + var block, _blockNumber, i, tx, confirmations, blockWithTxs; + + return regeneratorRuntime.wrap(function _callee28$(_context28) { + while (1) { + switch (_context28.prev = _context28.next) { + case 0: + _context28.next = 2; + return this.perform("getBlock", params); + + case 2: + block = _context28.sent; + + if (!(block == null)) { + _context28.next = 11; + break; + } + + if (!(params.blockHash != null)) { + _context28.next = 7; + break; + } + + if (!(this._emitted["b:" + params.blockHash] == null)) { + _context28.next = 7; + break; + } + + return _context28.abrupt("return", null); + + case 7: + if (!(params.blockTag != null)) { + _context28.next = 10; + break; + } + + if (!(blockNumber > this._emitted.block)) { + _context28.next = 10; + break; + } + + return _context28.abrupt("return", null); + + case 10: + return _context28.abrupt("return", undefined); + + case 11: + if (!includeTransactions) { + _context28.next = 34; + break; + } + + _blockNumber = null; + i = 0; + + case 14: + if (!(i < block.transactions.length)) { + _context28.next = 31; + break; + } + + tx = block.transactions[i]; + + if (!(tx.blockNumber == null)) { + _context28.next = 20; + break; + } + + tx.confirmations = 0; + _context28.next = 28; + break; + + case 20: + if (!(tx.confirmations == null)) { + _context28.next = 28; + break; + } + + if (!(_blockNumber == null)) { + _context28.next = 25; + break; + } + + _context28.next = 24; + return this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + + case 24: + _blockNumber = _context28.sent; + + case 25: + // Add the confirmations using the fast block number (pessimistic) + confirmations = _blockNumber - tx.blockNumber + 1; + + if (confirmations <= 0) { + confirmations = 1; + } + + tx.confirmations = confirmations; + + case 28: + i++; + _context28.next = 14; + break; + + case 31: + blockWithTxs = this.formatter.blockWithTransactions(block); + blockWithTxs.transactions = blockWithTxs.transactions.map(function (tx) { + return _this15._wrapTransaction(tx); + }); + return _context28.abrupt("return", blockWithTxs); + + case 34: + return _context28.abrupt("return", this.formatter.block(block)); + + case 35: + case "end": + return _context28.stop(); + } + } + }, _callee28, this); + })); + }, { + oncePoll: this + })); + + case 22: + case "end": + return _context29.stop(); + } + } + }, _callee29, this, [[11, 18]]); + })); + } + }, { + key: "getBlock", + value: function getBlock(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, false); + } + }, { + key: "getBlockWithTransactions", + value: function getBlockWithTransactions(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, true); + } + }, { + key: "getTransaction", + value: function getTransaction(transactionHash) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee31() { + var _this16 = this; + + var params; + return regeneratorRuntime.wrap(function _callee31$(_context31) { + while (1) { + switch (_context31.prev = _context31.next) { + case 0: + _context31.next = 2; + return this.getNetwork(); + + case 2: + _context31.next = 4; + return transactionHash; + + case 4: + transactionHash = _context31.sent; + params = { + transactionHash: this.formatter.hash(transactionHash, true) + }; + return _context31.abrupt("return", Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_10__["poll"])(function () { + return __awaiter(_this16, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee30() { + var result, tx, blockNumber, confirmations; + return regeneratorRuntime.wrap(function _callee30$(_context30) { + while (1) { + switch (_context30.prev = _context30.next) { + case 0: + _context30.next = 2; + return this.perform("getTransaction", params); + + case 2: + result = _context30.sent; + + if (!(result == null)) { + _context30.next = 7; + break; + } + + if (!(this._emitted["t:" + transactionHash] == null)) { + _context30.next = 6; + break; + } + + return _context30.abrupt("return", null); + + case 6: + return _context30.abrupt("return", undefined); + + case 7: + tx = this.formatter.transactionResponse(result); + + if (!(tx.blockNumber == null)) { + _context30.next = 12; + break; + } + + tx.confirmations = 0; + _context30.next = 19; + break; + + case 12: + if (!(tx.confirmations == null)) { + _context30.next = 19; + break; + } + + _context30.next = 15; + return this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + + case 15: + blockNumber = _context30.sent; + // Add the confirmations using the fast block number (pessimistic) + confirmations = blockNumber - tx.blockNumber + 1; + + if (confirmations <= 0) { + confirmations = 1; + } + + tx.confirmations = confirmations; + + case 19: + return _context30.abrupt("return", this._wrapTransaction(tx)); + + case 20: + case "end": + return _context30.stop(); + } + } + }, _callee30, this); + })); + }, { + oncePoll: this + })); + + case 7: + case "end": + return _context31.stop(); + } + } + }, _callee31, this); + })); + } + }, { + key: "getTransactionReceipt", + value: function getTransactionReceipt(transactionHash) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee33() { + var _this17 = this; + + var params; + return regeneratorRuntime.wrap(function _callee33$(_context33) { + while (1) { + switch (_context33.prev = _context33.next) { + case 0: + _context33.next = 2; + return this.getNetwork(); + + case 2: + _context33.next = 4; + return transactionHash; + + case 4: + transactionHash = _context33.sent; + params = { + transactionHash: this.formatter.hash(transactionHash, true) + }; + return _context33.abrupt("return", Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_10__["poll"])(function () { + return __awaiter(_this17, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee32() { + var result, receipt, blockNumber, confirmations; + return regeneratorRuntime.wrap(function _callee32$(_context32) { + while (1) { + switch (_context32.prev = _context32.next) { + case 0: + _context32.next = 2; + return this.perform("getTransactionReceipt", params); + + case 2: + result = _context32.sent; + + if (!(result == null)) { + _context32.next = 7; + break; + } + + if (!(this._emitted["t:" + transactionHash] == null)) { + _context32.next = 6; + break; + } + + return _context32.abrupt("return", null); + + case 6: + return _context32.abrupt("return", undefined); + + case 7: + if (!(result.blockHash == null)) { + _context32.next = 9; + break; + } + + return _context32.abrupt("return", undefined); + + case 9: + receipt = this.formatter.receipt(result); + + if (!(receipt.blockNumber == null)) { + _context32.next = 14; + break; + } + + receipt.confirmations = 0; + _context32.next = 21; + break; + + case 14: + if (!(receipt.confirmations == null)) { + _context32.next = 21; + break; + } + + _context32.next = 17; + return this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + + case 17: + blockNumber = _context32.sent; + // Add the confirmations using the fast block number (pessimistic) + confirmations = blockNumber - receipt.blockNumber + 1; + + if (confirmations <= 0) { + confirmations = 1; + } + + receipt.confirmations = confirmations; + + case 21: + return _context32.abrupt("return", receipt); + + case 22: + case "end": + return _context32.stop(); + } + } + }, _callee32, this); + })); + }, { + oncePoll: this + })); + + case 7: + case "end": + return _context33.stop(); + } + } + }, _callee33, this); + })); + } + }, { + key: "getLogs", + value: function getLogs(filter) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee34() { + var params, logs; + return regeneratorRuntime.wrap(function _callee34$(_context34) { + while (1) { + switch (_context34.prev = _context34.next) { + case 0: + _context34.next = 2; + return this.getNetwork(); + + case 2: + _context34.next = 4; + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])({ + filter: this._getFilter(filter) + }); + + case 4: + params = _context34.sent; + _context34.next = 7; + return this.perform("getLogs", params); + + case 7: + logs = _context34.sent; + logs.forEach(function (log) { + if (log.removed == null) { + log.removed = false; + } + }); + return _context34.abrupt("return", _formatter__WEBPACK_IMPORTED_MODULE_14__["Formatter"].arrayOf(this.formatter.filterLog.bind(this.formatter))(logs)); + + case 10: + case "end": + return _context34.stop(); + } + } + }, _callee34, this); + })); + } + }, { + key: "getEtherPrice", + value: function getEtherPrice() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee35() { + return regeneratorRuntime.wrap(function _callee35$(_context35) { + while (1) { + switch (_context35.prev = _context35.next) { + case 0: + _context35.next = 2; + return this.getNetwork(); + + case 2: + return _context35.abrupt("return", this.perform("getEtherPrice", {})); + + case 3: + case "end": + return _context35.stop(); + } + } + }, _callee35, this); + })); + } + }, { + key: "_getBlockTag", + value: function _getBlockTag(blockTag) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee36() { + var blockNumber; + return regeneratorRuntime.wrap(function _callee36$(_context36) { + while (1) { + switch (_context36.prev = _context36.next) { + case 0: + _context36.next = 2; + return blockTag; + + case 2: + blockTag = _context36.sent; + + if (!(typeof blockTag === "number" && blockTag < 0)) { + _context36.next = 11; + break; + } + + if (blockTag % 1) { + logger.throwArgumentError("invalid BlockTag", "blockTag", blockTag); + } + + _context36.next = 7; + return this._getInternalBlockNumber(100 + 2 * this.pollingInterval); + + case 7: + blockNumber = _context36.sent; + blockNumber += blockTag; + + if (blockNumber < 0) { + blockNumber = 0; + } + + return _context36.abrupt("return", this.formatter.blockTag(blockNumber)); + + case 11: + return _context36.abrupt("return", this.formatter.blockTag(blockTag)); + + case 12: + case "end": + return _context36.stop(); + } + } + }, _callee36, this); + })); + } + }, { + key: "getResolver", + value: function getResolver(name) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee37() { + var address; + return regeneratorRuntime.wrap(function _callee37$(_context37) { + while (1) { + switch (_context37.prev = _context37.next) { + case 0: + _context37.prev = 0; + _context37.next = 3; + return this._getResolver(name); + + case 3: + address = _context37.sent; + + if (!(address == null)) { + _context37.next = 6; + break; + } + + return _context37.abrupt("return", null); + + case 6: + return _context37.abrupt("return", new Resolver(this, address, name)); + + case 9: + _context37.prev = 9; + _context37.t0 = _context37["catch"](0); + + if (!(_context37.t0.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.CALL_EXCEPTION)) { + _context37.next = 13; + break; + } + + return _context37.abrupt("return", null); + + case 13: + throw _context37.t0; + + case 14: + case "end": + return _context37.stop(); + } + } + }, _callee37, this, [[0, 9]]); + })); + } + }, { + key: "_getResolver", + value: function _getResolver(name) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee38() { + var network, transaction; + return regeneratorRuntime.wrap(function _callee38$(_context38) { + while (1) { + switch (_context38.prev = _context38.next) { + case 0: + _context38.next = 2; + return this.getNetwork(); + + case 2: + network = _context38.sent; + + // No ENS... + if (!network.ensAddress) { + logger.throwError("network does not support ENS", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "ENS", + network: network.name + }); + } // keccak256("resolver(bytes32)") + + + transaction = { + to: network.ensAddress, + data: "0x0178b8bf" + Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["namehash"])(name).substring(2) + }; + _context38.prev = 5; + _context38.t0 = this.formatter; + _context38.next = 9; + return this.call(transaction); + + case 9: + _context38.t1 = _context38.sent; + return _context38.abrupt("return", _context38.t0.callAddress.call(_context38.t0, _context38.t1)); + + case 13: + _context38.prev = 13; + _context38.t2 = _context38["catch"](5); + + if (!(_context38.t2.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.CALL_EXCEPTION)) { + _context38.next = 17; + break; + } + + return _context38.abrupt("return", null); + + case 17: + throw _context38.t2; + + case 18: + case "end": + return _context38.stop(); + } + } + }, _callee38, this, [[5, 13]]); + })); + } + }, { + key: "resolveName", + value: function resolveName(name) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee39() { + var resolver; + return regeneratorRuntime.wrap(function _callee39$(_context39) { + while (1) { + switch (_context39.prev = _context39.next) { + case 0: + _context39.next = 2; + return name; + + case 2: + name = _context39.sent; + _context39.prev = 3; + return _context39.abrupt("return", Promise.resolve(this.formatter.address(name))); + + case 7: + _context39.prev = 7; + _context39.t0 = _context39["catch"](3); + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["isHexString"])(name)) { + _context39.next = 11; + break; + } + + throw _context39.t0; + + case 11: + if (typeof name !== "string") { + logger.throwArgumentError("invalid ENS name", "name", name); + } // Get the addr from the resovler + + + _context39.next = 14; + return this.getResolver(name); + + case 14: + resolver = _context39.sent; + + if (resolver) { + _context39.next = 17; + break; + } + + return _context39.abrupt("return", null); + + case 17: + _context39.next = 19; + return resolver.getAddress(); + + case 19: + return _context39.abrupt("return", _context39.sent); + + case 20: + case "end": + return _context39.stop(); + } + } + }, _callee39, this, [[3, 7]]); + })); + } + }, { + key: "lookupAddress", + value: function lookupAddress(address) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee40() { + var reverseName, resolverAddress, bytes, length, name, addr; + return regeneratorRuntime.wrap(function _callee40$(_context40) { + while (1) { + switch (_context40.prev = _context40.next) { + case 0: + _context40.next = 2; + return address; + + case 2: + address = _context40.sent; + address = this.formatter.address(address); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + _context40.next = 7; + return this._getResolver(reverseName); + + case 7: + resolverAddress = _context40.sent; + + if (resolverAddress) { + _context40.next = 10; + break; + } + + return _context40.abrupt("return", null); + + case 10: + _context40.t0 = _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"]; + _context40.next = 13; + return this.call({ + to: resolverAddress, + data: "0x691f3431" + Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["namehash"])(reverseName).substring(2) + }); + + case 13: + _context40.t1 = _context40.sent; + bytes = (0, _context40.t0)(_context40.t1); + + if (!(bytes.length < 32 || !_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(bytes.slice(0, 32)).eq(32))) { + _context40.next = 17; + break; + } + + return _context40.abrupt("return", null); + + case 17: + bytes = bytes.slice(32); // Not a length-prefixed string + + if (!(bytes.length < 32)) { + _context40.next = 20; + break; + } + + return _context40.abrupt("return", null); + + case 20: + // Get the length of the string (from the length-prefix) + length = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_2__["BigNumber"].from(bytes.slice(0, 32)).toNumber(); + bytes = bytes.slice(32); // Length longer than available data + + if (!(length > bytes.length)) { + _context40.next = 24; + break; + } + + return _context40.abrupt("return", null); + + case 24: + name = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_9__["toUtf8String"])(bytes.slice(0, length)); // Make sure the reverse record matches the foward record + + _context40.next = 27; + return this.resolveName(name); + + case 27: + addr = _context40.sent; + + if (!(addr != address)) { + _context40.next = 30; + break; + } + + return _context40.abrupt("return", null); + + case 30: + return _context40.abrupt("return", name); + + case 31: + case "end": + return _context40.stop(); + } + } + }, _callee40, this); + })); + } + }, { + key: "getAvatar", + value: function getAvatar(nameOrAddress) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee41() { + var resolver, address, reverseName, resolverAddress, avatar; + return regeneratorRuntime.wrap(function _callee41$(_context41) { + while (1) { + switch (_context41.prev = _context41.next) { + case 0: + resolver = null; + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["isHexString"])(nameOrAddress)) { + _context41.next = 12; + break; + } + + // Address; reverse lookup + address = this.formatter.address(nameOrAddress); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + _context41.next = 6; + return this._getResolver(reverseName); + + case 6: + resolverAddress = _context41.sent; + + if (resolverAddress) { + _context41.next = 9; + break; + } + + return _context41.abrupt("return", null); + + case 9: + resolver = new Resolver(this, resolverAddress, "_", address); + _context41.next = 17; + break; + + case 12: + _context41.next = 14; + return this.getResolver(nameOrAddress); + + case 14: + resolver = _context41.sent; + + if (resolver) { + _context41.next = 17; + break; + } + + return _context41.abrupt("return", null); + + case 17: + _context41.next = 19; + return resolver.getAvatar(); + + case 19: + avatar = _context41.sent; + + if (!(avatar == null)) { + _context41.next = 22; + break; + } + + return _context41.abrupt("return", null); + + case 22: + return _context41.abrupt("return", avatar.url); + + case 23: + case "end": + return _context41.stop(); + } + } + }, _callee41, this); + })); + } + }, { + key: "perform", + value: function perform(method, params) { + return logger.throwError(method + " not implemented", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.NOT_IMPLEMENTED, { + operation: method + }); + } + }, { + key: "_startEvent", + value: function _startEvent(event) { + this.polling = this._events.filter(function (e) { + return e.pollable(); + }).length > 0; + } + }, { + key: "_stopEvent", + value: function _stopEvent(event) { + this.polling = this._events.filter(function (e) { + return e.pollable(); + }).length > 0; + } + }, { + key: "_addEventListener", + value: function _addEventListener(eventName, listener, once) { + var event = new Event(getEventTag(eventName), listener, once); + + this._events.push(event); + + this._startEvent(event); + + return this; + } + }, { + key: "on", + value: function on(eventName, listener) { + return this._addEventListener(eventName, listener, false); + } + }, { + key: "once", + value: function once(eventName, listener) { + return this._addEventListener(eventName, listener, true); + } + }, { + key: "emit", + value: function emit(eventName) { + var _this18 = this; + + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var result = false; + var stopped = []; + var eventTag = getEventTag(eventName); + this._events = this._events.filter(function (event) { + if (event.tag !== eventTag) { + return true; + } + + setTimeout(function () { + event.listener.apply(_this18, args); + }, 0); + result = true; + + if (event.once) { + stopped.push(event); + return false; + } + + return true; + }); + stopped.forEach(function (event) { + _this18._stopEvent(event); + }); + return result; + } + }, { + key: "listenerCount", + value: function listenerCount(eventName) { + if (!eventName) { + return this._events.length; + } + + var eventTag = getEventTag(eventName); + return this._events.filter(function (event) { + return event.tag === eventTag; + }).length; + } + }, { + key: "listeners", + value: function listeners(eventName) { + if (eventName == null) { + return this._events.map(function (event) { + return event.listener; + }); + } + + var eventTag = getEventTag(eventName); + return this._events.filter(function (event) { + return event.tag === eventTag; + }).map(function (event) { + return event.listener; + }); + } + }, { + key: "off", + value: function off(eventName, listener) { + var _this19 = this; + + if (listener == null) { + return this.removeAllListeners(eventName); + } + + var stopped = []; + var found = false; + var eventTag = getEventTag(eventName); + this._events = this._events.filter(function (event) { + if (event.tag !== eventTag || event.listener != listener) { + return true; + } + + if (found) { + return true; + } + + found = true; + stopped.push(event); + return false; + }); + stopped.forEach(function (event) { + _this19._stopEvent(event); + }); + return this; + } + }, { + key: "removeAllListeners", + value: function removeAllListeners(eventName) { + var _this20 = this; + + var stopped = []; + + if (eventName == null) { + stopped = this._events; + this._events = []; + } else { + var eventTag = getEventTag(eventName); + this._events = this._events.filter(function (event) { + if (event.tag !== eventTag) { + return true; + } + + stopped.push(event); + return false; + }); + } + + stopped.forEach(function (event) { + _this20._stopEvent(event); + }); + return this; + } + }], [{ + key: "getFormatter", + value: function getFormatter() { + if (defaultFormatter == null) { + defaultFormatter = new _formatter__WEBPACK_IMPORTED_MODULE_14__["Formatter"](); + } + + return defaultFormatter; + } // @TODO: Remove this and just use getNetwork + + }, { + key: "getNetwork", + value: function getNetwork(network) { + return Object(_ethersproject_networks__WEBPACK_IMPORTED_MODULE_6__["getNetwork"])(network == null ? "homestead" : network); + } + }]); + + return BaseProvider; +}(_ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__["Provider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/cloudflare-provider.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/cloudflare-provider.js ***! + \******************************************************************************/ +/*! exports provided: CloudflareProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CloudflareProvider", function() { return CloudflareProvider; }); +/* harmony import */ var _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url-json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); +var CloudflareProvider = /*#__PURE__*/function (_UrlJsonRpcProvider) { + _inherits(CloudflareProvider, _UrlJsonRpcProvider); + + var _super2 = _createSuper(CloudflareProvider); + + function CloudflareProvider() { + _classCallCheck(this, CloudflareProvider); + + return _super2.apply(this, arguments); + } + + _createClass(CloudflareProvider, [{ + key: "perform", + value: function perform(method, params) { + var _this = this; + + var _super = Object.create(null, { + perform: { + get: function get() { + return _get(_getPrototypeOf(CloudflareProvider.prototype), "perform", _this); + } + } + }); + + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var block; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(method === "getBlockNumber")) { + _context.next = 5; + break; + } + + _context.next = 3; + return _super.perform.call(this, "getBlock", { + blockTag: "latest" + }); + + case 3: + block = _context.sent; + return _context.abrupt("return", block.number); + + case 5: + return _context.abrupt("return", _super.perform.call(this, method, params)); + + case 6: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + } + }], [{ + key: "getApiKey", + value: function getApiKey(apiKey) { + if (apiKey != null) { + logger.throwArgumentError("apiKey not supported for cloudflare", "apiKey", apiKey); + } + + return null; + } + }, { + key: "getUrl", + value: function getUrl(network, apiKey) { + var host = null; + + switch (network.name) { + case "homestead": + host = "https://cloudflare-eth.com/"; + break; + + default: + logger.throwArgumentError("unsupported network", "network", arguments[0]); + } + + return host; + } + }]); + + return CloudflareProvider; +}(_url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_0__["UrlJsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/etherscan-provider.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/etherscan-provider.js ***! + \*****************************************************************************/ +/*! exports provided: EtherscanProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EtherscanProvider", function() { return EtherscanProvider; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/web */ "./node_modules/@ethersproject/web/lib.esm/index.js"); +/* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./formatter */ "./node_modules/@ethersproject/providers/lib.esm/formatter.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _base_provider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./base-provider */ "./node_modules/@ethersproject/providers/lib.esm/base-provider.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"](_version__WEBPACK_IMPORTED_MODULE_6__["version"]); + // The transaction has already been sanitized by the calls in Provider + +function getTransactionPostData(transaction) { + var result = {}; + + for (var key in transaction) { + if (transaction[key] == null) { + continue; + } + + var value = transaction[key]; + + if (key === "type" && value === 0) { + continue; + } // Quantity-types require no leading zero, unless 0 + + + if ({ + type: true, + gasLimit: true, + gasPrice: true, + maxFeePerGs: true, + maxPriorityFeePerGas: true, + nonce: true, + value: true + }[key]) { + value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexValue"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(value)); + } else if (key === "accessList") { + value = "[" + Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_2__["accessListify"])(value).map(function (set) { + return "{address:\"".concat(set.address, "\",storageKeys:[\"").concat(set.storageKeys.join('","'), "\"]}"); + }).join(",") + "]"; + } else { + value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(value); + } + + result[key] = value; + } + + return result; +} + +function getResult(result) { + // getLogs, getHistory have weird success responses + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + return result.result; + } + + if (result.status != 1 || result.message != "OK") { + var error = new Error("invalid response"); + error.result = JSON.stringify(result); + + if ((result.result || "").toLowerCase().indexOf("rate limit") >= 0) { + error.throttleRetry = true; + } + + throw error; + } + + return result.result; +} + +function getJsonResult(result) { + // This response indicates we are being throttled + if (result && result.status == 0 && result.message == "NOTOK" && (result.result || "").toLowerCase().indexOf("rate limit") >= 0) { + var error = new Error("throttled response"); + error.result = JSON.stringify(result); + error.throttleRetry = true; + throw error; + } + + if (result.jsonrpc != "2.0") { + // @TODO: not any + var _error = new Error("invalid response"); + + _error.result = JSON.stringify(result); + throw _error; + } + + if (result.error) { + // @TODO: not any + var _error2 = new Error(result.error.message || "unknown error"); + + if (result.error.code) { + _error2.code = result.error.code; + } + + if (result.error.data) { + _error2.data = result.error.data; + } + + throw _error2; + } + + return result.result; +} // The blockTag was normalized as a string by the Provider pre-perform operations + + +function checkLogTag(blockTag) { + if (blockTag === "pending") { + throw new Error("pending not supported"); + } + + if (blockTag === "latest") { + return blockTag; + } + + return parseInt(blockTag.substring(2), 16); +} + +var defaultApiKey = "9D13ZE7XSBTJ94N9BNJ2MA33VMAY2YPIRB"; + +function checkError(method, error, transaction) { + // Undo the "convenience" some nodes are attempting to prevent backwards + // incompatibility; maybe for v6 consider forwarding reverts as errors + if (method === "call" && error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.SERVER_ERROR) { + var e = error.error; // Etherscan keeps changing their string + + if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { + // Etherscan prefixes the data like "Reverted 0x1234" + var data = e.data; + + if (data) { + data = "0x" + data.replace(/^.*0x/i, ""); + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["isHexString"])(data)) { + return data; + } + + logger.throwError("missing revert data in call exception", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.CALL_EXCEPTION, { + error: error, + data: "0x" + }); + } + } // Get the message from any nested error structure + + + var message = error.message; + + if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.SERVER_ERROR) { + if (error.error && typeof error.error.message === "string") { + message = error.error.message; + } else if (typeof error.body === "string") { + message = error.body; + } else if (typeof error.responseText === "string") { + message = error.responseText; + } + } + + message = (message || "").toLowerCase(); // "Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 21464000000000 and got: 0" + + if (message.match(/insufficient funds/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.INSUFFICIENT_FUNDS, { + error: error, + method: method, + transaction: transaction + }); + } // "Transaction with the same hash was already imported." + + + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + logger.throwError("nonce has already been used", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.NONCE_EXPIRED, { + error: error, + method: method, + transaction: transaction + }); + } // "Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce." + + + if (message.match(/another transaction with same nonce/)) { + logger.throwError("replacement fee too low", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.REPLACEMENT_UNDERPRICED, { + error: error, + method: method, + transaction: transaction + }); + } + + if (message.match(/execution failed due to an exception|execution reverted/)) { + logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.UNPREDICTABLE_GAS_LIMIT, { + error: error, + method: method, + transaction: transaction + }); + } + + throw error; +} + +var EtherscanProvider = /*#__PURE__*/function (_BaseProvider) { + _inherits(EtherscanProvider, _BaseProvider); + + var _super2 = _createSuper(EtherscanProvider); + + function EtherscanProvider(network, apiKey) { + var _this; + + _classCallCheck(this, EtherscanProvider); + + logger.checkNew(this instanceof EtherscanProvider ? this.constructor : void 0, EtherscanProvider); + _this = _super2.call(this, network); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(_assertThisInitialized(_this), "baseUrl", _this.getBaseUrl()); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(_assertThisInitialized(_this), "apiKey", apiKey || defaultApiKey); + return _this; + } + + _createClass(EtherscanProvider, [{ + key: "getBaseUrl", + value: function getBaseUrl() { + switch (this.network ? this.network.name : "invalid") { + case "homestead": + return "https:/\/api.etherscan.io"; + + case "ropsten": + return "https:/\/api-ropsten.etherscan.io"; + + case "rinkeby": + return "https:/\/api-rinkeby.etherscan.io"; + + case "kovan": + return "https:/\/api-kovan.etherscan.io"; + + case "goerli": + return "https:/\/api-goerli.etherscan.io"; + + default: + } + + return logger.throwArgumentError("unsupported network", "network", name); + } + }, { + key: "getUrl", + value: function getUrl(module, params) { + var query = Object.keys(params).reduce(function (accum, key) { + var value = params[key]; + + if (value != null) { + accum += "&".concat(key, "=").concat(value); + } + + return accum; + }, ""); + var apiKey = this.apiKey ? "&apikey=".concat(this.apiKey) : ""; + return "".concat(this.baseUrl, "/api?module=").concat(module).concat(query).concat(apiKey); + } + }, { + key: "getPostUrl", + value: function getPostUrl() { + return "".concat(this.baseUrl, "/api"); + } + }, { + key: "getPostData", + value: function getPostData(module, params) { + params.module = module; + params.apikey = this.apiKey; + return params; + } + }, { + key: "fetch", + value: function fetch(module, params, post) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var _this2 = this; + + var url, payload, procFunc, connection, payloadStr, result; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + url = post ? this.getPostUrl() : this.getUrl(module, params); + payload = post ? this.getPostData(module, params) : null; + procFunc = module === "proxy" ? getJsonResult : getResult; + this.emit("debug", { + action: "request", + request: url, + provider: this + }); + connection = { + url: url, + throttleSlotInterval: 1000, + throttleCallback: function throttleCallback(attempt, url) { + if (_this2.isCommunityResource()) { + Object(_formatter__WEBPACK_IMPORTED_MODULE_4__["showThrottleMessage"])(); + } + + return Promise.resolve(true); + } + }; + payloadStr = null; + + if (payload) { + connection.headers = { + "content-type": "application/x-www-form-urlencoded; charset=UTF-8" + }; + payloadStr = Object.keys(payload).map(function (key) { + return "".concat(key, "=").concat(payload[key]); + }).join("&"); + } + + _context.next = 9; + return Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_3__["fetchJson"])(connection, payloadStr, procFunc || getJsonResult); + + case 9: + result = _context.sent; + this.emit("debug", { + action: "response", + request: url, + response: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["deepCopy"])(result), + provider: this + }); + return _context.abrupt("return", result); + + case 12: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + } + }, { + key: "detectNetwork", + value: function detectNetwork() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + return _context2.abrupt("return", this.network); + + case 1: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + } + }, { + key: "perform", + value: function perform(method, params) { + var _this3 = this; + + var _super = Object.create(null, { + perform: { + get: function get() { + return _get(_getPrototypeOf(EtherscanProvider.prototype), "perform", _this3); + } + } + }); + + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + var postData, _postData, args, topic0, logs, blocks, i, log, block; + + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.t0 = method; + _context3.next = _context3.t0 === "getBlockNumber" ? 3 : _context3.t0 === "getGasPrice" ? 4 : _context3.t0 === "getBalance" ? 5 : _context3.t0 === "getTransactionCount" ? 6 : _context3.t0 === "getCode" ? 7 : _context3.t0 === "getStorageAt" ? 8 : _context3.t0 === "sendTransaction" ? 9 : _context3.t0 === "getBlock" ? 10 : _context3.t0 === "getTransaction" ? 13 : _context3.t0 === "getTransactionReceipt" ? 14 : _context3.t0 === "call" ? 15 : _context3.t0 === "estimateGas" ? 29 : _context3.t0 === "getLogs" ? 41 : _context3.t0 === "getEtherPrice" ? 65 : 72; + break; + + case 3: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_blockNumber" + })); + + case 4: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_gasPrice" + })); + + case 5: + return _context3.abrupt("return", this.fetch("account", { + action: "balance", + address: params.address, + tag: params.blockTag + })); + + case 6: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_getTransactionCount", + address: params.address, + tag: params.blockTag + })); + + case 7: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_getCode", + address: params.address, + tag: params.blockTag + })); + + case 8: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_getStorageAt", + address: params.address, + position: params.position, + tag: params.blockTag + })); + + case 9: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: params.signedTransaction + }, true)["catch"](function (error) { + return checkError("sendTransaction", error, params.signedTransaction); + })); + + case 10: + if (!params.blockTag) { + _context3.next = 12; + break; + } + + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: params.blockTag, + "boolean": params.includeTransactions ? "true" : "false" + })); + + case 12: + throw new Error("getBlock by blockHash not implemented"); + + case 13: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: params.transactionHash + })); + + case 14: + return _context3.abrupt("return", this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: params.transactionHash + })); + + case 15: + if (!(params.blockTag !== "latest")) { + _context3.next = 17; + break; + } + + throw new Error("EtherscanProvider does not support blockTag for call"); + + case 17: + postData = getTransactionPostData(params.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + _context3.prev = 20; + _context3.next = 23; + return this.fetch("proxy", postData, true); + + case 23: + return _context3.abrupt("return", _context3.sent); + + case 26: + _context3.prev = 26; + _context3.t1 = _context3["catch"](20); + return _context3.abrupt("return", checkError("call", _context3.t1, params.transaction)); + + case 29: + _postData = getTransactionPostData(params.transaction); + _postData.module = "proxy"; + _postData.action = "eth_estimateGas"; + _context3.prev = 32; + _context3.next = 35; + return this.fetch("proxy", _postData, true); + + case 35: + return _context3.abrupt("return", _context3.sent); + + case 38: + _context3.prev = 38; + _context3.t2 = _context3["catch"](32); + return _context3.abrupt("return", checkError("estimateGas", _context3.t2, params.transaction)); + + case 41: + args = { + action: "getLogs" + }; + + if (params.filter.fromBlock) { + args.fromBlock = checkLogTag(params.filter.fromBlock); + } + + if (params.filter.toBlock) { + args.toBlock = checkLogTag(params.filter.toBlock); + } + + if (params.filter.address) { + args.address = params.filter.address; + } // @TODO: We can handle slightly more complicated logs using the logs API + + + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger.throwError("unsupported topic count", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.UNSUPPORTED_OPERATION, { + topics: params.filter.topics + }); + } + + if (params.filter.topics.length === 1) { + topic0 = params.filter.topics[0]; + + if (typeof topic0 !== "string" || topic0.length !== 66) { + logger.throwError("unsupported topic format", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"].errors.UNSUPPORTED_OPERATION, { + topic0: topic0 + }); + } + + args.topic0 = topic0; + } + } + + _context3.next = 48; + return this.fetch("logs", args); + + case 48: + logs = _context3.sent; + // Cache txHash => blockHash + blocks = {}; // Add any missing blockHash to the logs + + i = 0; + + case 51: + if (!(i < logs.length)) { + _context3.next = 64; + break; + } + + log = logs[i]; + + if (!(log.blockHash != null)) { + _context3.next = 55; + break; + } + + return _context3.abrupt("continue", 61); + + case 55: + if (!(blocks[log.blockNumber] == null)) { + _context3.next = 60; + break; + } + + _context3.next = 58; + return this.getBlock(log.blockNumber); + + case 58: + block = _context3.sent; + + if (block) { + blocks[log.blockNumber] = block.hash; + } + + case 60: + log.blockHash = blocks[log.blockNumber]; + + case 61: + i++; + _context3.next = 51; + break; + + case 64: + return _context3.abrupt("return", logs); + + case 65: + if (!(this.network.name !== "homestead")) { + _context3.next = 67; + break; + } + + return _context3.abrupt("return", 0.0); + + case 67: + _context3.t3 = parseFloat; + _context3.next = 70; + return this.fetch("stats", { + action: "ethprice" + }); + + case 70: + _context3.t4 = _context3.sent.ethusd; + return _context3.abrupt("return", (0, _context3.t3)(_context3.t4)); + + case 72: + return _context3.abrupt("break", 73); + + case 73: + return _context3.abrupt("return", _super.perform.call(this, method, params)); + + case 74: + case "end": + return _context3.stop(); + } + } + }, _callee3, this, [[20, 26], [32, 38]]); + })); + } // Note: The `page` page parameter only allows pagination within the + // 10,000 window available without a page and offset parameter + // Error: Result window is too large, PageNo x Offset size must + // be less than or equal to 10000 + + }, { + key: "getHistory", + value: function getHistory(addressOrName, startBlock, endBlock) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + var _this4 = this; + + var params, result; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return this.resolveName(addressOrName); + + case 2: + _context4.t0 = _context4.sent; + _context4.t1 = startBlock == null ? 0 : startBlock; + _context4.t2 = endBlock == null ? 99999999 : endBlock; + params = { + action: "txlist", + address: _context4.t0, + startblock: _context4.t1, + endblock: _context4.t2, + sort: "asc" + }; + _context4.next = 8; + return this.fetch("account", params); + + case 8: + result = _context4.sent; + return _context4.abrupt("return", result.map(function (tx) { + ["contractAddress", "to"].forEach(function (key) { + if (tx[key] == "") { + delete tx[key]; + } + }); + + if (tx.creates == null && tx.contractAddress != null) { + tx.creates = tx.contractAddress; + } + + var item = _this4.formatter.transactionResponse(tx); + + if (tx.timeStamp) { + item.timestamp = parseInt(tx.timeStamp); + } + + return item; + })); + + case 10: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + } + }, { + key: "isCommunityResource", + value: function isCommunityResource() { + return this.apiKey === defaultApiKey; + } + }]); + + return EtherscanProvider; +}(_base_provider__WEBPACK_IMPORTED_MODULE_7__["BaseProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/fallback-provider.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/fallback-provider.js ***! + \****************************************************************************/ +/*! exports provided: FallbackProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FallbackProvider", function() { return FallbackProvider; }); +/* harmony import */ var _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/abstract-provider */ "./node_modules/@ethersproject/abstract-provider/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/random */ "./node_modules/@ethersproject/random/lib.esm/index.js"); +/* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/web */ "./node_modules/@ethersproject/web/lib.esm/index.js"); +/* harmony import */ var _base_provider__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./base-provider */ "./node_modules/@ethersproject/providers/lib.esm/base-provider.js"); +/* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./formatter */ "./node_modules/@ethersproject/providers/lib.esm/formatter.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"](_version__WEBPACK_IMPORTED_MODULE_9__["version"]); + +function now() { + return new Date().getTime(); +} // Returns to network as long as all agree, or null if any is null. +// Throws an error if any two networks do not match. + + +function checkNetworks(networks) { + var result = null; + + for (var i = 0; i < networks.length; i++) { + var network = networks[i]; // Null! We do not know our network; bail. + + if (network == null) { + return null; + } + + if (result) { + // Make sure the network matches the previous networks + if (!(result.name === network.name && result.chainId === network.chainId && (result.ensAddress === network.ensAddress || result.ensAddress == null && network.ensAddress == null))) { + logger.throwArgumentError("provider mismatch", "networks", networks); + } + } else { + result = network; + } + } + + return result; +} + +function median(values, maxDelta) { + values = values.slice().sort(); + var middle = Math.floor(values.length / 2); // Odd length; take the middle + + if (values.length % 2) { + return values[middle]; + } // Even length; take the average of the two middle + + + var a = values[middle - 1], + b = values[middle]; + + if (maxDelta != null && Math.abs(a - b) > maxDelta) { + return null; + } + + return (a + b) / 2; +} + +function serialize(value) { + if (value === null) { + return "null"; + } else if (typeof value === "number" || typeof value === "boolean") { + return JSON.stringify(value); + } else if (typeof value === "string") { + return value; + } else if (_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].isBigNumber(value)) { + return value.toString(); + } else if (Array.isArray(value)) { + return JSON.stringify(value.map(function (i) { + return serialize(i); + })); + } else if (_typeof(value) === "object") { + var keys = Object.keys(value); + keys.sort(); + return "{" + keys.map(function (key) { + var v = value[key]; + + if (typeof v === "function") { + v = "[function]"; + } else { + v = serialize(v); + } + + return JSON.stringify(key) + ":" + v; + }).join(",") + "}"; + } + + throw new Error("unknown value type: " + _typeof(value)); +} // Next request ID to use for emitting debug info + + +var nextRid = 1; +; + +function stall(duration) { + var cancel = null; + var timer = null; + var promise = new Promise(function (resolve) { + cancel = function cancel() { + if (timer) { + clearTimeout(timer); + timer = null; + } + + resolve(); + }; + + timer = setTimeout(cancel, duration); + }); + + var wait = function wait(func) { + promise = promise.then(func); + return promise; + }; + + function getPromise() { + return promise; + } + + return { + cancel: cancel, + getPromise: getPromise, + wait: wait + }; +} + +var ForwardErrors = [_ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.CALL_EXCEPTION, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.INSUFFICIENT_FUNDS, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.NONCE_EXPIRED, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.REPLACEMENT_UNDERPRICED, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNPREDICTABLE_GAS_LIMIT]; +var ForwardProperties = ["address", "args", "errorArgs", "errorSignature", "method", "transaction"]; +; + +function exposeDebugConfig(config, now) { + var result = { + weight: config.weight + }; + Object.defineProperty(result, "provider", { + get: function get() { + return config.provider; + } + }); + + if (config.start) { + result.start = config.start; + } + + if (now) { + result.duration = now - config.start; + } + + if (config.done) { + if (config.error) { + result.error = config.error; + } else { + result.result = config.result || null; + } + } + + return result; +} + +function normalizedTally(normalize, quorum) { + return function (configs) { + // Count the votes for each result + var tally = {}; + configs.forEach(function (c) { + var value = normalize(c.result); + + if (!tally[value]) { + tally[value] = { + count: 0, + result: c.result + }; + } + + tally[value].count++; + }); // Check for a quorum on any given result + + var keys = Object.keys(tally); + + for (var i = 0; i < keys.length; i++) { + var check = tally[keys[i]]; + + if (check.count >= quorum) { + return check.result; + } + } // No quroum + + + return undefined; + }; +} + +function getProcessFunc(provider, method, params) { + var normalize = serialize; + + switch (method) { + case "getBlockNumber": + // Return the median value, unless there is (median + 1) is also + // present, in which case that is probably true and the median + // is going to be stale soon. In the event of a malicious node, + // the lie will be true soon enough. + return function (configs) { + var values = configs.map(function (c) { + return c.result; + }); // Get the median block number + + var blockNumber = median(configs.map(function (c) { + return c.result; + }), 2); + + if (blockNumber == null) { + return undefined; + } + + blockNumber = Math.ceil(blockNumber); // If the next block height is present, its prolly safe to use + + if (values.indexOf(blockNumber + 1) >= 0) { + blockNumber++; + } // Don't ever roll back the blockNumber + + + if (blockNumber >= provider._highestBlockNumber) { + provider._highestBlockNumber = blockNumber; + } + + return provider._highestBlockNumber; + }; + + case "getGasPrice": + // Return the middle (round index up) value, similar to median + // but do not average even entries and choose the higher. + // Malicious actors must compromise 50% of the nodes to lie. + return function (configs) { + var values = configs.map(function (c) { + return c.result; + }); + values.sort(); + return values[Math.floor(values.length / 2)]; + }; + + case "getEtherPrice": + // Returns the median price. Malicious actors must compromise at + // least 50% of the nodes to lie (in a meaningful way). + return function (configs) { + return median(configs.map(function (c) { + return c.result; + })); + }; + // No additional normalizing required; serialize is enough + + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorageAt": + case "call": + case "estimateGas": + case "getLogs": + break; + // We drop the confirmations from transactions as it is approximate + + case "getTransaction": + case "getTransactionReceipt": + normalize = function normalize(tx) { + if (tx == null) { + return null; + } + + tx = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["shallowCopy"])(tx); + tx.confirmations = -1; + return serialize(tx); + }; + + break; + // We drop the confirmations from transactions as it is approximate + + case "getBlock": + // We drop the confirmations from transactions as it is approximate + if (params.includeTransactions) { + normalize = function normalize(block) { + if (block == null) { + return null; + } + + block = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["shallowCopy"])(block); + block.transactions = block.transactions.map(function (tx) { + tx = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["shallowCopy"])(tx); + tx.confirmations = -1; + return tx; + }); + return serialize(block); + }; + } else { + normalize = function normalize(block) { + if (block == null) { + return null; + } + + return serialize(block); + }; + } + + break; + + default: + throw new Error("unknown method: " + method); + } // Return the result if and only if the expected quorum is + // satisfied and agreed upon for the final result. + + + return normalizedTally(normalize, provider.quorum); +} // If we are doing a blockTag query, we need to make sure the backend is +// caught up to the FallbackProvider, before sending a request to it. + + +function waitForSync(config, blockNumber) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var provider; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + provider = config.provider; + + if (!(provider.blockNumber != null && provider.blockNumber >= blockNumber || blockNumber === -1)) { + _context.next = 3; + break; + } + + return _context.abrupt("return", provider); + + case 3: + return _context.abrupt("return", Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_5__["poll"])(function () { + return new Promise(function (resolve, reject) { + setTimeout(function () { + // We are synced + if (provider.blockNumber >= blockNumber) { + return resolve(provider); + } // We're done; just quit + + + // We're done; just quit + if (config.cancelled) { + return resolve(null); + } // Try again, next block + + + // Try again, next block + return resolve(undefined); + }, 0); + }); + }, { + oncePoll: provider + })); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee); + })); +} + +function getRunner(config, currentBlockNumber, method, params) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + var provider, filter; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + provider = config.provider; + _context2.t0 = method; + _context2.next = _context2.t0 === "getBlockNumber" ? 4 : _context2.t0 === "getGasPrice" ? 4 : _context2.t0 === "getEtherPrice" ? 5 : _context2.t0 === "getBalance" ? 8 : _context2.t0 === "getTransactionCount" ? 8 : _context2.t0 === "getCode" ? 8 : _context2.t0 === "getStorageAt" ? 13 : _context2.t0 === "getBlock" ? 18 : _context2.t0 === "call" ? 23 : _context2.t0 === "estimateGas" ? 23 : _context2.t0 === "getTransaction" ? 28 : _context2.t0 === "getTransactionReceipt" ? 28 : _context2.t0 === "getLogs" ? 29 : 35; + break; + + case 4: + return _context2.abrupt("return", provider[method]()); + + case 5: + if (!provider.getEtherPrice) { + _context2.next = 7; + break; + } + + return _context2.abrupt("return", provider.getEtherPrice()); + + case 7: + return _context2.abrupt("break", 35); + + case 8: + if (!(params.blockTag && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(params.blockTag))) { + _context2.next = 12; + break; + } + + _context2.next = 11; + return waitForSync(config, currentBlockNumber); + + case 11: + provider = _context2.sent; + + case 12: + return _context2.abrupt("return", provider[method](params.address, params.blockTag || "latest")); + + case 13: + if (!(params.blockTag && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(params.blockTag))) { + _context2.next = 17; + break; + } + + _context2.next = 16; + return waitForSync(config, currentBlockNumber); + + case 16: + provider = _context2.sent; + + case 17: + return _context2.abrupt("return", provider.getStorageAt(params.address, params.position, params.blockTag || "latest")); + + case 18: + if (!(params.blockTag && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(params.blockTag))) { + _context2.next = 22; + break; + } + + _context2.next = 21; + return waitForSync(config, currentBlockNumber); + + case 21: + provider = _context2.sent; + + case 22: + return _context2.abrupt("return", provider[params.includeTransactions ? "getBlockWithTransactions" : "getBlock"](params.blockTag || params.blockHash)); + + case 23: + if (!(params.blockTag && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(params.blockTag))) { + _context2.next = 27; + break; + } + + _context2.next = 26; + return waitForSync(config, currentBlockNumber); + + case 26: + provider = _context2.sent; + + case 27: + return _context2.abrupt("return", provider[method](params.transaction)); + + case 28: + return _context2.abrupt("return", provider[method](params.transactionHash)); + + case 29: + filter = params.filter; + + if (!(filter.fromBlock && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(filter.fromBlock) || filter.toBlock && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(filter.toBlock))) { + _context2.next = 34; + break; + } + + _context2.next = 33; + return waitForSync(config, currentBlockNumber); + + case 33: + provider = _context2.sent; + + case 34: + return _context2.abrupt("return", provider.getLogs(filter)); + + case 35: + return _context2.abrupt("return", logger.throwError("unknown method error", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNKNOWN_ERROR, { + method: method, + params: params + })); + + case 36: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); +} + +var FallbackProvider = /*#__PURE__*/function (_BaseProvider) { + _inherits(FallbackProvider, _BaseProvider); + + var _super = _createSuper(FallbackProvider); + + function FallbackProvider(providers, quorum) { + var _this; + + _classCallCheck(this, FallbackProvider); + + logger.checkNew(this instanceof FallbackProvider ? this.constructor : void 0, FallbackProvider); + + if (providers.length === 0) { + logger.throwArgumentError("missing providers", "providers", providers); + } + + var providerConfigs = providers.map(function (configOrProvider, index) { + if (_ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__["Provider"].isProvider(configOrProvider)) { + var stallTimeout = Object(_formatter__WEBPACK_IMPORTED_MODULE_7__["isCommunityResource"])(configOrProvider) ? 2000 : 750; + var priority = 1; + return Object.freeze({ + provider: configOrProvider, + weight: 1, + stallTimeout: stallTimeout, + priority: priority + }); + } + + var config = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["shallowCopy"])(configOrProvider); + + if (config.priority == null) { + config.priority = 1; + } + + if (config.stallTimeout == null) { + config.stallTimeout = Object(_formatter__WEBPACK_IMPORTED_MODULE_7__["isCommunityResource"])(configOrProvider) ? 2000 : 750; + } + + if (config.weight == null) { + config.weight = 1; + } + + var weight = config.weight; + + if (weight % 1 || weight > 512 || weight < 1) { + logger.throwArgumentError("invalid weight; must be integer in [1, 512]", "providers[".concat(index, "].weight"), weight); + } + + return Object.freeze(config); + }); + var total = providerConfigs.reduce(function (accum, c) { + return accum + c.weight; + }, 0); + + if (quorum == null) { + quorum = total / 2; + } else if (quorum > total) { + logger.throwArgumentError("quorum will always fail; larger than total weight", "quorum", quorum); + } // Are all providers' networks are known + + + var networkOrReady = checkNetworks(providerConfigs.map(function (c) { + return c.provider.network; + })); // Not all networks are known; we must stall + + if (networkOrReady == null) { + networkOrReady = new Promise(function (resolve, reject) { + setTimeout(function () { + _this.detectNetwork().then(resolve, reject); + }, 0); + }); + } + + _this = _super.call(this, networkOrReady); // Preserve a copy, so we do not get mutated + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["defineReadOnly"])(_assertThisInitialized(_this), "providerConfigs", Object.freeze(providerConfigs)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["defineReadOnly"])(_assertThisInitialized(_this), "quorum", quorum); + _this._highestBlockNumber = -1; + return _this; + } + + _createClass(FallbackProvider, [{ + key: "detectNetwork", + value: function detectNetwork() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + var networks; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return Promise.all(this.providerConfigs.map(function (c) { + return c.provider.getNetwork(); + })); + + case 2: + networks = _context3.sent; + return _context3.abrupt("return", checkNetworks(networks)); + + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + } + }, { + key: "perform", + value: function perform(method, params) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + var _this2 = this; + + var results, _i, result, processFunc, configs, currentBlockNumber, i, first, _loop, _ret; + + return regeneratorRuntime.wrap(function _callee4$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + if (!(method === "sendTransaction")) { + _context5.next = 13; + break; + } + + _context5.next = 3; + return Promise.all(this.providerConfigs.map(function (c) { + return c.provider.sendTransaction(params.signedTransaction).then(function (result) { + return result.hash; + }, function (error) { + return error; + }); + })); + + case 3: + results = _context5.sent; + _i = 0; + + case 5: + if (!(_i < results.length)) { + _context5.next = 12; + break; + } + + result = results[_i]; + + if (!(typeof result === "string")) { + _context5.next = 9; + break; + } + + return _context5.abrupt("return", result); + + case 9: + _i++; + _context5.next = 5; + break; + + case 12: + throw results[0]; + + case 13: + if (!(this._highestBlockNumber === -1 && method !== "getBlockNumber")) { + _context5.next = 16; + break; + } + + _context5.next = 16; + return this.getBlockNumber(); + + case 16: + processFunc = getProcessFunc(this, method, params); // Shuffle the providers and then sort them by their priority; we + // shallowCopy them since we will store the result in them too + + configs = Object(_ethersproject_random__WEBPACK_IMPORTED_MODULE_4__["shuffled"])(this.providerConfigs.map(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["shallowCopy"])); + configs.sort(function (a, b) { + return a.priority - b.priority; + }); + currentBlockNumber = this._highestBlockNumber; + i = 0; + first = true; + _loop = /*#__PURE__*/regeneratorRuntime.mark(function _loop() { + var t0, inflightWeight, _loop2, waiting, results, _result, errors; + + return regeneratorRuntime.wrap(function _loop$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + t0 = now(); // Compute the inflight weight (exclude anything past) + + inflightWeight = configs.filter(function (c) { + return c.runner && t0 - c.start < c.stallTimeout; + }).reduce(function (accum, c) { + return accum + c.weight; + }, 0); // Start running enough to meet quorum + + _loop2 = function _loop2() { + var config = configs[i++]; + var rid = nextRid++; + config.start = now(); + config.staller = stall(config.stallTimeout); + config.staller.wait(function () { + config.staller = null; + }); + config.runner = getRunner(config, currentBlockNumber, method, params).then(function (result) { + config.done = true; + config.result = result; + + if (_this2.listenerCount("debug")) { + _this2.emit("debug", { + action: "request", + rid: rid, + backend: exposeDebugConfig(config, now()), + request: { + method: method, + params: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["deepCopy"])(params) + }, + provider: _this2 + }); + } + }, function (error) { + config.done = true; + config.error = error; + + if (_this2.listenerCount("debug")) { + _this2.emit("debug", { + action: "request", + rid: rid, + backend: exposeDebugConfig(config, now()), + request: { + method: method, + params: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["deepCopy"])(params) + }, + provider: _this2 + }); + } + }); + + if (_this2.listenerCount("debug")) { + _this2.emit("debug", { + action: "request", + rid: rid, + backend: exposeDebugConfig(config, null), + request: { + method: method, + params: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_3__["deepCopy"])(params) + }, + provider: _this2 + }); + } + + inflightWeight += config.weight; + }; + + while (inflightWeight < _this2.quorum && i < configs.length) { + _loop2(); + } // Wait for anything meaningful to finish or stall out + + + waiting = []; + configs.forEach(function (c) { + if (c.done || !c.runner) { + return; + } + + waiting.push(c.runner); + + if (c.staller) { + waiting.push(c.staller.getPromise()); + } + }); + + if (!waiting.length) { + _context4.next = 9; + break; + } + + _context4.next = 9; + return Promise.race(waiting); + + case 9: + // Check the quorum and process the results; the process function + // may additionally decide the quorum is not met + results = configs.filter(function (c) { + return c.done && c.error == null; + }); + + if (!(results.length >= _this2.quorum)) { + _context4.next = 19; + break; + } + + _result = processFunc(results); + + if (!(_result !== undefined)) { + _context4.next = 15; + break; + } + + // Shut down any stallers + configs.forEach(function (c) { + if (c.staller) { + c.staller.cancel(); + } + + c.cancelled = true; + }); + return _context4.abrupt("return", { + v: _result + }); + + case 15: + if (first) { + _context4.next = 18; + break; + } + + _context4.next = 18; + return stall(100).getPromise(); + + case 18: + first = false; + + case 19: + // No result, check for errors that should be forwarded + errors = configs.reduce(function (accum, c) { + if (!c.done || c.error == null) { + return accum; + } + + var code = c.error.code; + + if (ForwardErrors.indexOf(code) >= 0) { + if (!accum[code]) { + accum[code] = { + error: c.error, + weight: 0 + }; + } + + accum[code].weight += c.weight; + } + + return accum; + }, {}); + Object.keys(errors).forEach(function (errorCode) { + var tally = errors[errorCode]; + + if (tally.weight < _this2.quorum) { + return; + } // Shut down any stallers + + + configs.forEach(function (c) { + if (c.staller) { + c.staller.cancel(); + } + + c.cancelled = true; + }); + var e = tally.error; + var props = {}; + ForwardProperties.forEach(function (name) { + if (e[name] == null) { + return; + } + + props[name] = e[name]; + }); + logger.throwError(e.reason || e.message, errorCode, props); + }); // All configs have run to completion; we will never get more data + + if (!(configs.filter(function (c) { + return !c.done; + }).length === 0)) { + _context4.next = 23; + break; + } + + return _context4.abrupt("return", "break"); + + case 23: + case "end": + return _context4.stop(); + } + } + }, _loop); + }); + + case 23: + if (false) {} + + return _context5.delegateYield(_loop(), "t0", 25); + + case 25: + _ret = _context5.t0; + + if (!(_ret === "break")) { + _context5.next = 28; + break; + } + + return _context5.abrupt("break", 32); + + case 28: + if (!(_typeof(_ret) === "object")) { + _context5.next = 30; + break; + } + + return _context5.abrupt("return", _ret.v); + + case 30: + _context5.next = 23; + break; + + case 32: + // Shut down any stallers; shouldn't be any + configs.forEach(function (c) { + if (c.staller) { + c.staller.cancel(); + } + + c.cancelled = true; + }); + return _context5.abrupt("return", logger.throwError("failed to meet quorum", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.SERVER_ERROR, { + method: method, + params: params, + //results: configs.map((c) => c.result), + //errors: configs.map((c) => c.error), + results: configs.map(function (c) { + return exposeDebugConfig(c); + }), + provider: this + })); + + case 34: + case "end": + return _context5.stop(); + } + } + }, _callee4, this); + })); + } + }]); + + return FallbackProvider; +}(_base_provider__WEBPACK_IMPORTED_MODULE_6__["BaseProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/formatter.js": +/*!********************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/formatter.js ***! + \********************************************************************/ +/*! exports provided: Formatter, isCommunityResourcable, isCommunityResource, showThrottleMessage */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Formatter", function() { return Formatter; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isCommunityResourcable", function() { return isCommunityResourcable; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isCommunityResource", function() { return isCommunityResource; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "showThrottleMessage", function() { return showThrottleMessage; }); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_6__["Logger"](_version__WEBPACK_IMPORTED_MODULE_7__["version"]); +var Formatter = /*#__PURE__*/function () { + function Formatter() { + _classCallCheck(this, Formatter); + + logger.checkNew(this instanceof Formatter ? this.constructor : void 0, Formatter); + this.formats = this.getDefaultFormats(); + } + + _createClass(Formatter, [{ + key: "getDefaultFormats", + value: function getDefaultFormats() { + var _this = this; + + var formats = {}; + var address = this.address.bind(this); + var bigNumber = this.bigNumber.bind(this); + var blockTag = this.blockTag.bind(this); + var data = this.data.bind(this); + var hash = this.hash.bind(this); + var hex = this.hex.bind(this); + var number = this.number.bind(this); + var type = this.type.bind(this); + + var strictData = function strictData(v) { + return _this.data(v, true); + }; + + formats.transaction = { + hash: hash, + type: type, + accessList: Formatter.allowNull(this.accessList.bind(this), null), + blockHash: Formatter.allowNull(hash, null), + blockNumber: Formatter.allowNull(number, null), + transactionIndex: Formatter.allowNull(number, null), + confirmations: Formatter.allowNull(number, null), + from: address, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) + // must be set + gasPrice: Formatter.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter.allowNull(bigNumber), + maxFeePerGas: Formatter.allowNull(bigNumber), + gasLimit: bigNumber, + to: Formatter.allowNull(address, null), + value: bigNumber, + nonce: number, + data: data, + r: Formatter.allowNull(this.uint256), + s: Formatter.allowNull(this.uint256), + v: Formatter.allowNull(number), + creates: Formatter.allowNull(address, null), + raw: Formatter.allowNull(data) + }; + formats.transactionRequest = { + from: Formatter.allowNull(address), + nonce: Formatter.allowNull(number), + gasLimit: Formatter.allowNull(bigNumber), + gasPrice: Formatter.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter.allowNull(bigNumber), + maxFeePerGas: Formatter.allowNull(bigNumber), + to: Formatter.allowNull(address), + value: Formatter.allowNull(bigNumber), + data: Formatter.allowNull(strictData), + type: Formatter.allowNull(number), + accessList: Formatter.allowNull(this.accessList.bind(this), null) + }; + formats.receiptLog = { + transactionIndex: number, + blockNumber: number, + transactionHash: hash, + address: address, + topics: Formatter.arrayOf(hash), + data: data, + logIndex: number, + blockHash: hash + }; + formats.receipt = { + to: Formatter.allowNull(this.address, null), + from: Formatter.allowNull(this.address, null), + contractAddress: Formatter.allowNull(address, null), + transactionIndex: number, + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + root: Formatter.allowNull(hex), + gasUsed: bigNumber, + logsBloom: Formatter.allowNull(data), + blockHash: hash, + transactionHash: hash, + logs: Formatter.arrayOf(this.receiptLog.bind(this)), + blockNumber: number, + confirmations: Formatter.allowNull(number, null), + cumulativeGasUsed: bigNumber, + effectiveGasPrice: Formatter.allowNull(bigNumber), + status: Formatter.allowNull(number), + type: type + }; + formats.block = { + hash: hash, + parentHash: hash, + number: number, + timestamp: number, + nonce: Formatter.allowNull(hex), + difficulty: this.difficulty.bind(this), + gasLimit: bigNumber, + gasUsed: bigNumber, + miner: address, + extraData: data, + transactions: Formatter.allowNull(Formatter.arrayOf(hash)), + baseFeePerGas: Formatter.allowNull(bigNumber) + }; + formats.blockWithTransactions = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(formats.block); + formats.blockWithTransactions.transactions = Formatter.allowNull(Formatter.arrayOf(this.transactionResponse.bind(this))); + formats.filter = { + fromBlock: Formatter.allowNull(blockTag, undefined), + toBlock: Formatter.allowNull(blockTag, undefined), + blockHash: Formatter.allowNull(hash, undefined), + address: Formatter.allowNull(address, undefined), + topics: Formatter.allowNull(this.topics.bind(this), undefined) + }; + formats.filterLog = { + blockNumber: Formatter.allowNull(number), + blockHash: Formatter.allowNull(hash), + transactionIndex: number, + removed: Formatter.allowNull(this["boolean"].bind(this)), + address: address, + data: Formatter.allowFalsish(data, "0x"), + topics: Formatter.arrayOf(hash), + transactionHash: hash, + logIndex: number + }; + return formats; + } + }, { + key: "accessList", + value: function accessList(_accessList) { + return Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_5__["accessListify"])(_accessList || []); + } // Requires a BigNumberish that is within the IEEE754 safe integer range; returns a number + // Strict! Used on input. + + }, { + key: "number", + value: function number(_number) { + if (_number === "0x") { + return 0; + } + + return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(_number).toNumber(); + } + }, { + key: "type", + value: function type(number) { + if (number === "0x" || number == null) { + return 0; + } + + return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(number).toNumber(); + } // Strict! Used on input. + + }, { + key: "bigNumber", + value: function bigNumber(value) { + return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value); + } // Requires a boolean, "true" or "false"; returns a boolean + + }, { + key: "boolean", + value: function boolean(value) { + if (typeof value === "boolean") { + return value; + } + + if (typeof value === "string") { + value = value.toLowerCase(); + + if (value === "true") { + return true; + } + + if (value === "false") { + return false; + } + } + + throw new Error("invalid boolean - " + value); + } + }, { + key: "hex", + value: function hex(value, strict) { + if (typeof value === "string") { + if (!strict && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(value)) { + return value.toLowerCase(); + } + } + + return logger.throwArgumentError("invalid hash", "value", value); + } + }, { + key: "data", + value: function data(value, strict) { + var result = this.hex(value, strict); + + if (result.length % 2 !== 0) { + throw new Error("invalid data; odd-length - " + value); + } + + return result; + } // Requires an address + // Strict! Used on input. + + }, { + key: "address", + value: function address(value) { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(value); + } + }, { + key: "callAddress", + value: function callAddress(value) { + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(value, 32)) { + return null; + } + + var address = Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexDataSlice"])(value, 12)); + return address === _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__["AddressZero"] ? null : address; + } + }, { + key: "contractAddress", + value: function contractAddress(value) { + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getContractAddress"])(value); + } // Strict! Used on input. + + }, { + key: "blockTag", + value: function blockTag(_blockTag) { + if (_blockTag == null) { + return "latest"; + } + + if (_blockTag === "earliest") { + return "0x0"; + } + + if (_blockTag === "latest" || _blockTag === "pending") { + return _blockTag; + } + + if (typeof _blockTag === "number" || Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(_blockTag)) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexValue"])(_blockTag); + } + + throw new Error("invalid blockTag"); + } // Requires a hash, optionally requires 0x prefix; returns prefixed lowercase hash. + + }, { + key: "hash", + value: function hash(value, strict) { + var result = this.hex(value, strict); + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexDataLength"])(result) !== 32) { + return logger.throwArgumentError("invalid hash", "value", value); + } + + return result; + } // Returns the difficulty as a number, or if too large (i.e. PoA network) null + + }, { + key: "difficulty", + value: function difficulty(value) { + if (value == null) { + return null; + } + + var v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value); + + try { + return v.toNumber(); + } catch (error) {} + + return null; + } + }, { + key: "uint256", + value: function uint256(value) { + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(value)) { + throw new Error("invalid uint256"); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(value, 32); + } + }, { + key: "_block", + value: function _block(value, format) { + if (value.author != null && value.miner == null) { + value.miner = value.author; + } // The difficulty may need to come from _difficulty in recursed blocks + + + var difficulty = value._difficulty != null ? value._difficulty : value.difficulty; + var result = Formatter.check(format, value); + result._difficulty = difficulty == null ? null : _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(difficulty); + return result; + } + }, { + key: "block", + value: function block(value) { + return this._block(value, this.formats.block); + } + }, { + key: "blockWithTransactions", + value: function blockWithTransactions(value) { + return this._block(value, this.formats.blockWithTransactions); + } // Strict! Used on input. + + }, { + key: "transactionRequest", + value: function transactionRequest(value) { + return Formatter.check(this.formats.transactionRequest, value); + } + }, { + key: "transactionResponse", + value: function transactionResponse(transaction) { + // Rename gas to gasLimit + if (transaction.gas != null && transaction.gasLimit == null) { + transaction.gasLimit = transaction.gas; + } // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + + + if (transaction.to && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(transaction.to).isZero()) { + transaction.to = "0x0000000000000000000000000000000000000000"; + } // Rename input to data + + + if (transaction.input != null && transaction.data == null) { + transaction.data = transaction.input; + } // If to and creates are empty, populate the creates from the transaction + + + if (transaction.to == null && transaction.creates == null) { + transaction.creates = this.contractAddress(transaction); + } + + if ((transaction.type === 1 || transaction.type === 2) && transaction.accessList == null) { + transaction.accessList = []; + } + + var result = Formatter.check(this.formats.transaction, transaction); + + if (transaction.chainId != null) { + var chainId = transaction.chainId; + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(chainId)) { + chainId = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(chainId).toNumber(); + } + + result.chainId = chainId; + } else { + var _chainId = transaction.networkId; // geth-etc returns chainId + + if (_chainId == null && result.v == null) { + _chainId = transaction.chainId; + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(_chainId)) { + _chainId = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(_chainId).toNumber(); + } + + if (typeof _chainId !== "number" && result.v != null) { + _chainId = (result.v - 35) / 2; + + if (_chainId < 0) { + _chainId = 0; + } + + _chainId = parseInt(_chainId); + } + + if (typeof _chainId !== "number") { + _chainId = 0; + } + + result.chainId = _chainId; + } // 0x0000... should actually be null + + + if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") { + result.blockHash = null; + } + + return result; + } + }, { + key: "transaction", + value: function transaction(value) { + return Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_5__["parse"])(value); + } + }, { + key: "receiptLog", + value: function receiptLog(value) { + return Formatter.check(this.formats.receiptLog, value); + } + }, { + key: "receipt", + value: function receipt(value) { + var result = Formatter.check(this.formats.receipt, value); // RSK incorrectly implemented EIP-658, so we munge things a bit here for it + + if (result.root != null) { + if (result.root.length <= 4) { + // Could be 0x00, 0x0, 0x01 or 0x1 + var _value = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(result.root).toNumber(); + + if (_value === 0 || _value === 1) { + // Make sure if both are specified, they match + if (result.status != null && result.status !== _value) { + logger.throwArgumentError("alt-root-status/status mismatch", "value", { + root: result.root, + status: result.status + }); + } + + result.status = _value; + delete result.root; + } else { + logger.throwArgumentError("invalid alt-root-status", "value.root", result.root); + } + } else if (result.root.length !== 66) { + // Must be a valid bytes32 + logger.throwArgumentError("invalid root hash", "value.root", result.root); + } + } + + if (result.status != null) { + result.byzantium = true; + } + + return result; + } + }, { + key: "topics", + value: function topics(value) { + var _this2 = this; + + if (Array.isArray(value)) { + return value.map(function (v) { + return _this2.topics(v); + }); + } else if (value != null) { + return this.hash(value, true); + } + + return null; + } + }, { + key: "filter", + value: function filter(value) { + return Formatter.check(this.formats.filter, value); + } + }, { + key: "filterLog", + value: function filterLog(value) { + return Formatter.check(this.formats.filterLog, value); + } + }], [{ + key: "check", + value: function check(format, object) { + var result = {}; + + for (var key in format) { + try { + var value = format[key](object[key]); + + if (value !== undefined) { + result[key] = value; + } + } catch (error) { + error.checkKey = key; + error.checkValue = object[key]; + throw error; + } + } + + return result; + } // if value is null-ish, nullValue is returned + + }, { + key: "allowNull", + value: function allowNull(format, nullValue) { + return function (value) { + if (value == null) { + return nullValue; + } + + return format(value); + }; + } // If value is false-ish, replaceValue is returned + + }, { + key: "allowFalsish", + value: function allowFalsish(format, replaceValue) { + return function (value) { + if (!value) { + return replaceValue; + } + + return format(value); + }; + } // Requires an Array satisfying check + + }, { + key: "arrayOf", + value: function arrayOf(format) { + return function (array) { + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + + var result = []; + array.forEach(function (value) { + result.push(format(value)); + }); + return result; + }; + } + }]); + + return Formatter; +}(); +function isCommunityResourcable(value) { + return value && typeof value.isCommunityResource === "function"; +} +function isCommunityResource(value) { + return isCommunityResourcable(value) && value.isCommunityResource(); +} // Show the throttle message only once + +var throttleMessage = false; +function showThrottleMessage() { + if (throttleMessage) { + return; + } + + throttleMessage = true; + console.log("========= NOTICE ========="); + console.log("Request-Rate Exceeded (this message will not be repeated)"); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https:/\/docs.ethers.io/api-keys/"); + console.log("=========================="); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/index.js ***! + \****************************************************************/ +/*! exports provided: Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, JsonRpcBatchProvider, NodesmithProvider, PocketProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage, Formatter */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultProvider", function() { return getDefaultProvider; }); +/* harmony import */ var _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/abstract-provider */ "./node_modules/@ethersproject/abstract-provider/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Provider", function() { return _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_0__["Provider"]; }); + +/* harmony import */ var _ethersproject_networks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/networks */ "./node_modules/@ethersproject/networks/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getNetwork", function() { return _ethersproject_networks__WEBPACK_IMPORTED_MODULE_1__["getNetwork"]; }); + +/* harmony import */ var _base_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base-provider */ "./node_modules/@ethersproject/providers/lib.esm/base-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BaseProvider", function() { return _base_provider__WEBPACK_IMPORTED_MODULE_2__["BaseProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Resolver", function() { return _base_provider__WEBPACK_IMPORTED_MODULE_2__["Resolver"]; }); + +/* harmony import */ var _alchemy_provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./alchemy-provider */ "./node_modules/@ethersproject/providers/lib.esm/alchemy-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AlchemyProvider", function() { return _alchemy_provider__WEBPACK_IMPORTED_MODULE_3__["AlchemyProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AlchemyWebSocketProvider", function() { return _alchemy_provider__WEBPACK_IMPORTED_MODULE_3__["AlchemyWebSocketProvider"]; }); + +/* harmony import */ var _cloudflare_provider__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./cloudflare-provider */ "./node_modules/@ethersproject/providers/lib.esm/cloudflare-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CloudflareProvider", function() { return _cloudflare_provider__WEBPACK_IMPORTED_MODULE_4__["CloudflareProvider"]; }); + +/* harmony import */ var _etherscan_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./etherscan-provider */ "./node_modules/@ethersproject/providers/lib.esm/etherscan-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EtherscanProvider", function() { return _etherscan_provider__WEBPACK_IMPORTED_MODULE_5__["EtherscanProvider"]; }); + +/* harmony import */ var _fallback_provider__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./fallback-provider */ "./node_modules/@ethersproject/providers/lib.esm/fallback-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FallbackProvider", function() { return _fallback_provider__WEBPACK_IMPORTED_MODULE_6__["FallbackProvider"]; }); + +/* harmony import */ var _ipc_provider__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./ipc-provider */ "./node_modules/@ethersproject/providers/lib.esm/ipc-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IpcProvider", function() { return _ipc_provider__WEBPACK_IMPORTED_MODULE_7__["IpcProvider"]; }); + +/* harmony import */ var _infura_provider__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./infura-provider */ "./node_modules/@ethersproject/providers/lib.esm/infura-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InfuraProvider", function() { return _infura_provider__WEBPACK_IMPORTED_MODULE_8__["InfuraProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InfuraWebSocketProvider", function() { return _infura_provider__WEBPACK_IMPORTED_MODULE_8__["InfuraWebSocketProvider"]; }); + +/* harmony import */ var _json_rpc_provider__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonRpcProvider", function() { return _json_rpc_provider__WEBPACK_IMPORTED_MODULE_9__["JsonRpcProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonRpcSigner", function() { return _json_rpc_provider__WEBPACK_IMPORTED_MODULE_9__["JsonRpcSigner"]; }); + +/* harmony import */ var _json_rpc_batch_provider__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./json-rpc-batch-provider */ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-batch-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonRpcBatchProvider", function() { return _json_rpc_batch_provider__WEBPACK_IMPORTED_MODULE_10__["JsonRpcBatchProvider"]; }); + +/* harmony import */ var _nodesmith_provider__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./nodesmith-provider */ "./node_modules/@ethersproject/providers/lib.esm/nodesmith-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NodesmithProvider", function() { return _nodesmith_provider__WEBPACK_IMPORTED_MODULE_11__["NodesmithProvider"]; }); + +/* harmony import */ var _pocket_provider__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./pocket-provider */ "./node_modules/@ethersproject/providers/lib.esm/pocket-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PocketProvider", function() { return _pocket_provider__WEBPACK_IMPORTED_MODULE_12__["PocketProvider"]; }); + +/* harmony import */ var _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./url-json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UrlJsonRpcProvider", function() { return _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_13__["UrlJsonRpcProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StaticJsonRpcProvider", function() { return _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_13__["StaticJsonRpcProvider"]; }); + +/* harmony import */ var _web3_provider__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./web3-provider */ "./node_modules/@ethersproject/providers/lib.esm/web3-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Web3Provider", function() { return _web3_provider__WEBPACK_IMPORTED_MODULE_14__["Web3Provider"]; }); + +/* harmony import */ var _websocket_provider__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./websocket-provider */ "./node_modules/@ethersproject/providers/lib.esm/websocket-provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "WebSocketProvider", function() { return _websocket_provider__WEBPACK_IMPORTED_MODULE_15__["WebSocketProvider"]; }); + +/* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./formatter */ "./node_modules/@ethersproject/providers/lib.esm/formatter.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isCommunityResource", function() { return _formatter__WEBPACK_IMPORTED_MODULE_16__["isCommunityResource"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isCommunityResourcable", function() { return _formatter__WEBPACK_IMPORTED_MODULE_16__["isCommunityResourcable"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "showThrottleMessage", function() { return _formatter__WEBPACK_IMPORTED_MODULE_16__["showThrottleMessage"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Formatter", function() { return _formatter__WEBPACK_IMPORTED_MODULE_16__["Formatter"]; }); + +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); + + + + + + + + + + + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_17__["Logger"](_version__WEBPACK_IMPORTED_MODULE_18__["version"]); //////////////////////// +// Helper Functions + +function getDefaultProvider(network, options) { + if (network == null) { + network = "homestead"; + } // If passed a URL, figure out the right type of provider based on the scheme + + + if (typeof network === "string") { + // @TODO: Add support for IpcProvider; maybe if it ends in ".ipc"? + // Handle http and ws (and their secure variants) + var match = network.match(/^(ws|http)s?:/i); + + if (match) { + switch (match[1]) { + case "http": + return new _json_rpc_provider__WEBPACK_IMPORTED_MODULE_9__["JsonRpcProvider"](network); + + case "ws": + return new _websocket_provider__WEBPACK_IMPORTED_MODULE_15__["WebSocketProvider"](network); + + default: + logger.throwArgumentError("unsupported URL scheme", "network", network); + } + } + } + + var n = Object(_ethersproject_networks__WEBPACK_IMPORTED_MODULE_1__["getNetwork"])(network); + + if (!n || !n._defaultProvider) { + logger.throwError("unsupported getDefaultProvider network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_17__["Logger"].errors.NETWORK_ERROR, { + operation: "getDefaultProvider", + network: network + }); + } + + return n._defaultProvider({ + FallbackProvider: _fallback_provider__WEBPACK_IMPORTED_MODULE_6__["FallbackProvider"], + AlchemyProvider: _alchemy_provider__WEBPACK_IMPORTED_MODULE_3__["AlchemyProvider"], + CloudflareProvider: _cloudflare_provider__WEBPACK_IMPORTED_MODULE_4__["CloudflareProvider"], + EtherscanProvider: _etherscan_provider__WEBPACK_IMPORTED_MODULE_5__["EtherscanProvider"], + InfuraProvider: _infura_provider__WEBPACK_IMPORTED_MODULE_8__["InfuraProvider"], + JsonRpcProvider: _json_rpc_provider__WEBPACK_IMPORTED_MODULE_9__["JsonRpcProvider"], + NodesmithProvider: _nodesmith_provider__WEBPACK_IMPORTED_MODULE_11__["NodesmithProvider"], + PocketProvider: _pocket_provider__WEBPACK_IMPORTED_MODULE_12__["PocketProvider"], + Web3Provider: _web3_provider__WEBPACK_IMPORTED_MODULE_14__["Web3Provider"], + IpcProvider: _ipc_provider__WEBPACK_IMPORTED_MODULE_7__["IpcProvider"] + }, options); +} //////////////////////// +// Exports + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/infura-provider.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/infura-provider.js ***! + \**************************************************************************/ +/*! exports provided: InfuraWebSocketProvider, InfuraProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfuraWebSocketProvider", function() { return InfuraWebSocketProvider; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfuraProvider", function() { return InfuraProvider; }); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _websocket_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./websocket-provider */ "./node_modules/@ethersproject/providers/lib.esm/websocket-provider.js"); +/* harmony import */ var _formatter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formatter */ "./node_modules/@ethersproject/providers/lib.esm/formatter.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./url-json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"](_version__WEBPACK_IMPORTED_MODULE_4__["version"]); + +var defaultProjectId = "84842078b09946638c03157f83405213"; +var InfuraWebSocketProvider = /*#__PURE__*/function (_WebSocketProvider) { + _inherits(InfuraWebSocketProvider, _WebSocketProvider); + + var _super = _createSuper(InfuraWebSocketProvider); + + function InfuraWebSocketProvider(network, apiKey) { + var _this; + + _classCallCheck(this, InfuraWebSocketProvider); + + var provider = new InfuraProvider(network, apiKey); + var connection = provider.connection; + + if (connection.password) { + logger.throwError("INFURA WebSocket project secrets unsupported", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "InfuraProvider.getWebSocketProvider()" + }); + } + + var url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + _this = _super.call(this, url, network); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this), "apiKey", provider.projectId); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this), "projectId", provider.projectId); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this), "projectSecret", provider.projectSecret); + return _this; + } + + _createClass(InfuraWebSocketProvider, [{ + key: "isCommunityResource", + value: function isCommunityResource() { + return this.projectId === defaultProjectId; + } + }]); + + return InfuraWebSocketProvider; +}(_websocket_provider__WEBPACK_IMPORTED_MODULE_1__["WebSocketProvider"]); +var InfuraProvider = /*#__PURE__*/function (_UrlJsonRpcProvider) { + _inherits(InfuraProvider, _UrlJsonRpcProvider); + + var _super2 = _createSuper(InfuraProvider); + + function InfuraProvider() { + _classCallCheck(this, InfuraProvider); + + return _super2.apply(this, arguments); + } + + _createClass(InfuraProvider, [{ + key: "isCommunityResource", + value: function isCommunityResource() { + return this.projectId === defaultProjectId; + } + }], [{ + key: "getWebSocketProvider", + value: function getWebSocketProvider(network, apiKey) { + return new InfuraWebSocketProvider(network, apiKey); + } + }, { + key: "getApiKey", + value: function getApiKey(apiKey) { + var apiKeyObj = { + apiKey: defaultProjectId, + projectId: defaultProjectId, + projectSecret: null + }; + + if (apiKey == null) { + return apiKeyObj; + } + + if (typeof apiKey === "string") { + apiKeyObj.projectId = apiKey; + } else if (apiKey.projectSecret != null) { + logger.assertArgument(typeof apiKey.projectId === "string", "projectSecret requires a projectId", "projectId", apiKey.projectId); + logger.assertArgument(typeof apiKey.projectSecret === "string", "invalid projectSecret", "projectSecret", "[REDACTED]"); + apiKeyObj.projectId = apiKey.projectId; + apiKeyObj.projectSecret = apiKey.projectSecret; + } else if (apiKey.projectId) { + apiKeyObj.projectId = apiKey.projectId; + } + + apiKeyObj.apiKey = apiKeyObj.projectId; + return apiKeyObj; + } + }, { + key: "getUrl", + value: function getUrl(network, apiKey) { + var host = null; + + switch (network ? network.name : "unknown") { + case "homestead": + host = "mainnet.infura.io"; + break; + + case "ropsten": + host = "ropsten.infura.io"; + break; + + case "rinkeby": + host = "rinkeby.infura.io"; + break; + + case "kovan": + host = "kovan.infura.io"; + break; + + case "goerli": + host = "goerli.infura.io"; + break; + + case "matic": + host = "polygon-mainnet.infura.io"; + break; + + case "maticmum": + host = "polygon-mumbai.infura.io"; + break; + + case "optimism": + host = "optimism-mainnet.infura.io"; + break; + + case "optimism-kovan": + host = "optimism-kovan.infura.io"; + break; + + case "arbitrum": + host = "arbitrum-mainnet.infura.io"; + break; + + case "arbitrum-rinkeby": + host = "arbitrum-rinkeby.infura.io"; + break; + + default: + logger.throwError("unsupported network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"].errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + + var connection = { + allowGzip: true, + url: "https:/" + "/" + host + "/v3/" + apiKey.projectId, + throttleCallback: function throttleCallback(attempt, url) { + if (apiKey.projectId === defaultProjectId) { + Object(_formatter__WEBPACK_IMPORTED_MODULE_2__["showThrottleMessage"])(); + } + + return Promise.resolve(true); + } + }; + + if (apiKey.projectSecret != null) { + connection.user = ""; + connection.password = apiKey.projectSecret; + } + + return connection; + } + }]); + + return InfuraProvider; +}(_url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_5__["UrlJsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/ipc-provider.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/ipc-provider.js ***! + \***********************************************************************/ +/*! exports provided: IpcProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IpcProvider", function() { return IpcProvider; }); + + +var IpcProvider = null; + + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-batch-provider.js": +/*!**********************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/json-rpc-batch-provider.js ***! + \**********************************************************************************/ +/*! exports provided: JsonRpcBatchProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonRpcBatchProvider", function() { return JsonRpcBatchProvider; }); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/web */ "./node_modules/@ethersproject/web/lib.esm/index.js"); +/* harmony import */ var _json_rpc_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js"); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + // Experimental + +var JsonRpcBatchProvider = /*#__PURE__*/function (_JsonRpcProvider) { + _inherits(JsonRpcBatchProvider, _JsonRpcProvider); + + var _super = _createSuper(JsonRpcBatchProvider); + + function JsonRpcBatchProvider() { + _classCallCheck(this, JsonRpcBatchProvider); + + return _super.apply(this, arguments); + } + + _createClass(JsonRpcBatchProvider, [{ + key: "send", + value: function send(method, params) { + var _this = this; + + var request = { + method: method, + params: params, + id: this._nextId++, + jsonrpc: "2.0" + }; + + if (this._pendingBatch == null) { + this._pendingBatch = []; + } + + var inflightRequest = { + request: request, + resolve: null, + reject: null + }; + var promise = new Promise(function (resolve, reject) { + inflightRequest.resolve = resolve; + inflightRequest.reject = reject; + }); + + this._pendingBatch.push(inflightRequest); + + if (!this._pendingBatchAggregator) { + // Schedule batch for next event loop + short duration + this._pendingBatchAggregator = setTimeout(function () { + // Get teh current batch and clear it, so new requests + // go into the next batch + var batch = _this._pendingBatch; + _this._pendingBatch = null; + _this._pendingBatchAggregator = null; // Get the request as an array of requests + + var request = batch.map(function (inflight) { + return inflight.request; + }); + + _this.emit("debug", { + action: "requestBatch", + request: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["deepCopy"])(request), + provider: _this + }); + + return Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_1__["fetchJson"])(_this.connection, JSON.stringify(request)).then(function (result) { + _this.emit("debug", { + action: "response", + request: request, + response: result, + provider: _this + }); // For each result, feed it to the correct Promise, depending + // on whether it was a success or error + + + batch.forEach(function (inflightRequest, index) { + var payload = result[index]; + + if (payload.error) { + var error = new Error(payload.error.message); + error.code = payload.error.code; + error.data = payload.error.data; + inflightRequest.reject(error); + } else { + inflightRequest.resolve(payload.result); + } + }); + }, function (error) { + _this.emit("debug", { + action: "response", + error: error, + request: request, + provider: _this + }); + + batch.forEach(function (inflightRequest) { + inflightRequest.reject(error); + }); + }); + }, 10); + } + + return promise; + } + }]); + + return JsonRpcBatchProvider; +}(_json_rpc_provider__WEBPACK_IMPORTED_MODULE_2__["JsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js": +/*!****************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js ***! + \****************************************************************************/ +/*! exports provided: JsonRpcSigner, JsonRpcProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonRpcSigner", function() { return JsonRpcSigner; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonRpcProvider", function() { return JsonRpcProvider; }); +/* harmony import */ var _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/abstract-signer */ "./node_modules/@ethersproject/abstract-signer/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/hash */ "./node_modules/@ethersproject/hash/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/web */ "./node_modules/@ethersproject/web/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _base_provider__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./base-provider */ "./node_modules/@ethersproject/providers/lib.esm/base-provider.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"](_version__WEBPACK_IMPORTED_MODULE_9__["version"]); + +var errorGas = ["call", "estimateGas"]; + +function checkError(method, error, params) { + // Undo the "convenience" some nodes are attempting to prevent backwards + // incompatibility; maybe for v6 consider forwarding reverts as errors + if (method === "call" && error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.SERVER_ERROR) { + var e = error.error; + + if (e && e.message.match("reverted") && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isHexString"])(e.data)) { + return e.data; + } + + logger.throwError("missing revert data in call exception", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.CALL_EXCEPTION, { + error: error, + data: "0x" + }); + } + + var message = error.message; + + if (error.code === _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.SERVER_ERROR && error.error && typeof error.error.message === "string") { + message = error.error.message; + } else if (typeof error.body === "string") { + message = error.body; + } else if (typeof error.responseText === "string") { + message = error.responseText; + } + + message = (message || "").toLowerCase(); + var transaction = params.transaction || params.signedTransaction; // "insufficient funds for gas * price + value + cost(data)" + + if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.INSUFFICIENT_FUNDS, { + error: error, + method: method, + transaction: transaction + }); + } // "nonce too low" + + + if (message.match(/nonce too low/)) { + logger.throwError("nonce has already been used", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.NONCE_EXPIRED, { + error: error, + method: method, + transaction: transaction + }); + } // "replacement transaction underpriced" + + + if (message.match(/replacement transaction underpriced/)) { + logger.throwError("replacement fee too low", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.REPLACEMENT_UNDERPRICED, { + error: error, + method: method, + transaction: transaction + }); + } // "replacement transaction underpriced" + + + if (message.match(/only replay-protected/)) { + logger.throwError("legacy pre-eip-155 transactions not supported", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + error: error, + method: method, + transaction: transaction + }); + } + + if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted/)) { + logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNPREDICTABLE_GAS_LIMIT, { + error: error, + method: method, + transaction: transaction + }); + } + + throw error; +} + +function timer(timeout) { + return new Promise(function (resolve) { + setTimeout(resolve, timeout); + }); +} + +function getResult(payload) { + if (payload.error) { + // @TODO: not any + var error = new Error(payload.error.message); + error.code = payload.error.code; + error.data = payload.error.data; + throw error; + } + + return payload.result; +} + +function getLowerCase(value) { + if (value) { + return value.toLowerCase(); + } + + return value; +} + +var _constructorGuard = {}; +var JsonRpcSigner = /*#__PURE__*/function (_Signer) { + _inherits(JsonRpcSigner, _Signer); + + var _super = _createSuper(JsonRpcSigner); + + function JsonRpcSigner(constructorGuard, provider, addressOrIndex) { + var _this; + + _classCallCheck(this, JsonRpcSigner); + + logger.checkNew(this instanceof JsonRpcSigner ? this.constructor : void 0, JsonRpcSigner); + _this = _super.call(this); + + if (constructorGuard !== _constructorGuard) { + throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(_assertThisInitialized(_this), "provider", provider); + + if (addressOrIndex == null) { + addressOrIndex = 0; + } + + if (typeof addressOrIndex === "string") { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(_assertThisInitialized(_this), "_address", _this.provider.formatter.address(addressOrIndex)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(_assertThisInitialized(_this), "_index", null); + } else if (typeof addressOrIndex === "number") { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(_assertThisInitialized(_this), "_index", addressOrIndex); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(_assertThisInitialized(_this), "_address", null); + } else { + logger.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex); + } + + return _this; + } + + _createClass(JsonRpcSigner, [{ + key: "connect", + value: function connect(provider) { + return logger.throwError("cannot alter JSON-RPC Signer connection", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "connect" + }); + } + }, { + key: "connectUnchecked", + value: function connectUnchecked() { + return new UncheckedJsonRpcSigner(_constructorGuard, this.provider, this._address || this._index); + } + }, { + key: "getAddress", + value: function getAddress() { + var _this2 = this; + + if (this._address) { + return Promise.resolve(this._address); + } + + return this.provider.send("eth_accounts", []).then(function (accounts) { + if (accounts.length <= _this2._index) { + logger.throwError("unknown account #" + _this2._index, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "getAddress" + }); + } + + return _this2.provider.formatter.address(accounts[_this2._index]); + }); + } + }, { + key: "sendUncheckedTransaction", + value: function sendUncheckedTransaction(transaction) { + var _this3 = this; + + transaction = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(transaction); + var fromAddress = this.getAddress().then(function (address) { + if (address) { + address = address.toLowerCase(); + } + + return address; + }); // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + + if (transaction.gasLimit == null) { + var estimate = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(transaction); + estimate.from = fromAddress; + transaction.gasLimit = this.provider.estimateGas(estimate); + } + + if (transaction.to != null) { + transaction.to = Promise.resolve(transaction.to).then(function (to) { + return __awaiter(_this3, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var address; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!(to == null)) { + _context.next = 2; + break; + } + + return _context.abrupt("return", null); + + case 2: + _context.next = 4; + return this.provider.resolveName(to); + + case 4: + address = _context.sent; + + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + + return _context.abrupt("return", address); + + case 7: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + }); + } + + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["resolveProperties"])({ + tx: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["resolveProperties"])(transaction), + sender: fromAddress + }).then(function (_ref) { + var tx = _ref.tx, + sender = _ref.sender; + + if (tx.from != null) { + if (tx.from.toLowerCase() !== sender) { + logger.throwArgumentError("from address mismatch", "transaction", transaction); + } + } else { + tx.from = sender; + } + + var hexTx = _this3.provider.constructor.hexlifyTransaction(tx, { + from: true + }); + + return _this3.provider.send("eth_sendTransaction", [hexTx]).then(function (hash) { + return hash; + }, function (error) { + return checkError("sendTransaction", error, hexTx); + }); + }); + } + }, { + key: "signTransaction", + value: function signTransaction(transaction) { + return logger.throwError("signing transactions is unsupported", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "signTransaction" + }); + } + }, { + key: "sendTransaction", + value: function sendTransaction(transaction) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + var _this4 = this; + + var blockNumber, hash; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval); + + case 2: + blockNumber = _context3.sent; + _context3.next = 5; + return this.sendUncheckedTransaction(transaction); + + case 5: + hash = _context3.sent; + _context3.prev = 6; + _context3.next = 9; + return Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_7__["poll"])(function () { + return __awaiter(_this4, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + var tx; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this.provider.getTransaction(hash); + + case 2: + tx = _context2.sent; + + if (!(tx === null)) { + _context2.next = 5; + break; + } + + return _context2.abrupt("return", undefined); + + case 5: + return _context2.abrupt("return", this.provider._wrapTransaction(tx, hash, blockNumber)); + + case 6: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + }, { + oncePoll: this.provider + }); + + case 9: + return _context3.abrupt("return", _context3.sent); + + case 12: + _context3.prev = 12; + _context3.t0 = _context3["catch"](6); + _context3.t0.transactionHash = hash; + throw _context3.t0; + + case 16: + case "end": + return _context3.stop(); + } + } + }, _callee3, this, [[6, 12]]); + })); + } + }, { + key: "signMessage", + value: function signMessage(message) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + var data, address; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + data = typeof message === "string" ? Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_5__["toUtf8Bytes"])(message) : message; + _context4.next = 3; + return this.getAddress(); + + case 3: + address = _context4.sent; + _context4.next = 6; + return this.provider.send("personal_sign", [Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(data), address.toLowerCase()]); + + case 6: + return _context4.abrupt("return", _context4.sent); + + case 7: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + } + }, { + key: "_legacySignMessage", + value: function _legacySignMessage(message) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee5() { + var data, address; + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + data = typeof message === "string" ? Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_5__["toUtf8Bytes"])(message) : message; + _context5.next = 3; + return this.getAddress(); + + case 3: + address = _context5.sent; + _context5.next = 6; + return this.provider.send("eth_sign", [address.toLowerCase(), Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(data)]); + + case 6: + return _context5.abrupt("return", _context5.sent); + + case 7: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + } + }, { + key: "_signTypedData", + value: function _signTypedData(domain, types, value) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { + var _this5 = this; + + var populated, address; + return regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + _context6.next = 2; + return _ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__["_TypedDataEncoder"].resolveNames(domain, types, value, function (name) { + return _this5.provider.resolveName(name); + }); + + case 2: + populated = _context6.sent; + _context6.next = 5; + return this.getAddress(); + + case 5: + address = _context6.sent; + _context6.next = 8; + return this.provider.send("eth_signTypedData_v4", [address.toLowerCase(), JSON.stringify(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_3__["_TypedDataEncoder"].getPayload(populated.domain, types, populated.value))]); + + case 8: + return _context6.abrupt("return", _context6.sent); + + case 9: + case "end": + return _context6.stop(); + } + } + }, _callee6, this); + })); + } + }, { + key: "unlock", + value: function unlock(password) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { + var provider, address; + return regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + provider = this.provider; + _context7.next = 3; + return this.getAddress(); + + case 3: + address = _context7.sent; + return _context7.abrupt("return", provider.send("personal_unlockAccount", [address.toLowerCase(), password, null])); + + case 5: + case "end": + return _context7.stop(); + } + } + }, _callee7, this); + })); + } + }]); + + return JsonRpcSigner; +}(_ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_0__["Signer"]); + +var UncheckedJsonRpcSigner = /*#__PURE__*/function (_JsonRpcSigner) { + _inherits(UncheckedJsonRpcSigner, _JsonRpcSigner); + + var _super2 = _createSuper(UncheckedJsonRpcSigner); + + function UncheckedJsonRpcSigner() { + _classCallCheck(this, UncheckedJsonRpcSigner); + + return _super2.apply(this, arguments); + } + + _createClass(UncheckedJsonRpcSigner, [{ + key: "sendTransaction", + value: function sendTransaction(transaction) { + var _this6 = this; + + return this.sendUncheckedTransaction(transaction).then(function (hash) { + return { + hash: hash, + nonce: null, + gasLimit: null, + gasPrice: null, + data: null, + value: null, + chainId: null, + confirmations: 0, + from: null, + wait: function wait(confirmations) { + return _this6.provider.waitForTransaction(hash, confirmations); + } + }; + }); + } + }]); + + return UncheckedJsonRpcSigner; +}(JsonRpcSigner); + +var allowedTransactionKeys = { + chainId: true, + data: true, + gasLimit: true, + gasPrice: true, + nonce: true, + to: true, + value: true, + type: true, + accessList: true, + maxFeePerGas: true, + maxPriorityFeePerGas: true +}; +var JsonRpcProvider = /*#__PURE__*/function (_BaseProvider) { + _inherits(JsonRpcProvider, _BaseProvider); + + var _super3 = _createSuper(JsonRpcProvider); + + function JsonRpcProvider(url, network) { + var _this7; + + _classCallCheck(this, JsonRpcProvider); + + logger.checkNew(this instanceof JsonRpcProvider ? this.constructor : void 0, JsonRpcProvider); + var networkOrReady = network; // The network is unknown, query the JSON-RPC for it + + if (networkOrReady == null) { + networkOrReady = new Promise(function (resolve, reject) { + setTimeout(function () { + _this7.detectNetwork().then(function (network) { + resolve(network); + }, function (error) { + reject(error); + }); + }, 0); + }); + } + + _this7 = _super3.call(this, networkOrReady); // Default URL + + if (!url) { + url = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["getStatic"])(_this7.constructor, "defaultUrl")(); + } + + if (typeof url === "string") { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(_assertThisInitialized(_this7), "connection", Object.freeze({ + url: url + })); + } else { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["defineReadOnly"])(_assertThisInitialized(_this7), "connection", Object.freeze(Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(url))); + } + + _this7._nextId = 42; + return _this7; + } + + _createClass(JsonRpcProvider, [{ + key: "_cache", + get: function get() { + if (this._eventLoopCache == null) { + this._eventLoopCache = {}; + } + + return this._eventLoopCache; + } + }, { + key: "detectNetwork", + value: function detectNetwork() { + var _this8 = this; + + if (!this._cache["detectNetwork"]) { + this._cache["detectNetwork"] = this._uncachedDetectNetwork(); // Clear this cache at the beginning of the next event loop + + setTimeout(function () { + _this8._cache["detectNetwork"] = null; + }, 0); + } + + return this._cache["detectNetwork"]; + } + }, { + key: "_uncachedDetectNetwork", + value: function _uncachedDetectNetwork() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee8() { + var chainId, getNetwork; + return regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + _context8.next = 2; + return timer(0); + + case 2: + chainId = null; + _context8.prev = 3; + _context8.next = 6; + return this.send("eth_chainId", []); + + case 6: + chainId = _context8.sent; + _context8.next = 19; + break; + + case 9: + _context8.prev = 9; + _context8.t0 = _context8["catch"](3); + _context8.prev = 11; + _context8.next = 14; + return this.send("net_version", []); + + case 14: + chainId = _context8.sent; + _context8.next = 19; + break; + + case 17: + _context8.prev = 17; + _context8.t1 = _context8["catch"](11); + + case 19: + if (!(chainId != null)) { + _context8.next = 28; + break; + } + + getNetwork = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["getStatic"])(this.constructor, "getNetwork"); + _context8.prev = 21; + return _context8.abrupt("return", getNetwork(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(chainId).toNumber())); + + case 25: + _context8.prev = 25; + _context8.t2 = _context8["catch"](21); + return _context8.abrupt("return", logger.throwError("could not detect network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.NETWORK_ERROR, { + chainId: chainId, + event: "invalidNetwork", + serverError: _context8.t2 + })); + + case 28: + return _context8.abrupt("return", logger.throwError("could not detect network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.NETWORK_ERROR, { + event: "noNetwork" + })); + + case 29: + case "end": + return _context8.stop(); + } + } + }, _callee8, this, [[3, 9], [11, 17], [21, 25]]); + })); + } + }, { + key: "getSigner", + value: function getSigner(addressOrIndex) { + return new JsonRpcSigner(_constructorGuard, this, addressOrIndex); + } + }, { + key: "getUncheckedSigner", + value: function getUncheckedSigner(addressOrIndex) { + return this.getSigner(addressOrIndex).connectUnchecked(); + } + }, { + key: "listAccounts", + value: function listAccounts() { + var _this9 = this; + + return this.send("eth_accounts", []).then(function (accounts) { + return accounts.map(function (a) { + return _this9.formatter.address(a); + }); + }); + } + }, { + key: "send", + value: function send(method, params) { + var _this10 = this; + + var request = { + method: method, + params: params, + id: this._nextId++, + jsonrpc: "2.0" + }; + this.emit("debug", { + action: "request", + request: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["deepCopy"])(request), + provider: this + }); // We can expand this in the future to any call, but for now these + // are the biggest wins and do not require any serializing parameters. + + var cache = ["eth_chainId", "eth_blockNumber"].indexOf(method) >= 0; + + if (cache && this._cache[method]) { + return this._cache[method]; + } + + var result = Object(_ethersproject_web__WEBPACK_IMPORTED_MODULE_7__["fetchJson"])(this.connection, JSON.stringify(request), getResult).then(function (result) { + _this10.emit("debug", { + action: "response", + request: request, + response: result, + provider: _this10 + }); + + return result; + }, function (error) { + _this10.emit("debug", { + action: "response", + error: error, + request: request, + provider: _this10 + }); + + throw error; + }); // Cache the fetch, but clear it on the next event loop + + if (cache) { + this._cache[method] = result; + setTimeout(function () { + _this10._cache[method] = null; + }, 0); + } + + return result; + } + }, { + key: "prepareRequest", + value: function prepareRequest(method, params) { + switch (method) { + case "getBlockNumber": + return ["eth_blockNumber", []]; + + case "getGasPrice": + return ["eth_gasPrice", []]; + + case "getBalance": + return ["eth_getBalance", [getLowerCase(params.address), params.blockTag]]; + + case "getTransactionCount": + return ["eth_getTransactionCount", [getLowerCase(params.address), params.blockTag]]; + + case "getCode": + return ["eth_getCode", [getLowerCase(params.address), params.blockTag]]; + + case "getStorageAt": + return ["eth_getStorageAt", [getLowerCase(params.address), params.position, params.blockTag]]; + + case "sendTransaction": + return ["eth_sendRawTransaction", [params.signedTransaction]]; + + case "getBlock": + if (params.blockTag) { + return ["eth_getBlockByNumber", [params.blockTag, !!params.includeTransactions]]; + } else if (params.blockHash) { + return ["eth_getBlockByHash", [params.blockHash, !!params.includeTransactions]]; + } + + return null; + + case "getTransaction": + return ["eth_getTransactionByHash", [params.transactionHash]]; + + case "getTransactionReceipt": + return ["eth_getTransactionReceipt", [params.transactionHash]]; + + case "call": + { + var hexlifyTransaction = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["getStatic"])(this.constructor, "hexlifyTransaction"); + return ["eth_call", [hexlifyTransaction(params.transaction, { + from: true + }), params.blockTag]]; + } + + case "estimateGas": + { + var _hexlifyTransaction = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["getStatic"])(this.constructor, "hexlifyTransaction"); + + return ["eth_estimateGas", [_hexlifyTransaction(params.transaction, { + from: true + })]]; + } + + case "getLogs": + if (params.filter && params.filter.address != null) { + params.filter.address = getLowerCase(params.filter.address); + } + + return ["eth_getLogs", [params.filter]]; + + default: + break; + } + + return null; + } + }, { + key: "perform", + value: function perform(method, params) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee9() { + var tx, feeData, args; + return regeneratorRuntime.wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + if (!(method === "call" || method === "estimateGas")) { + _context9.next = 8; + break; + } + + tx = params.transaction; + + if (!(tx && tx.type != null && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(tx.type).isZero())) { + _context9.next = 8; + break; + } + + if (!(tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null)) { + _context9.next = 8; + break; + } + + _context9.next = 6; + return this.getFeeData(); + + case 6: + feeData = _context9.sent; + + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + // Network doesn't know about EIP-1559 (and hence type) + params = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(params); + params.transaction = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(tx); + delete params.transaction.type; + } + + case 8: + args = this.prepareRequest(method, params); + + if (args == null) { + logger.throwError(method + " not implemented", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.NOT_IMPLEMENTED, { + operation: method + }); + } + + _context9.prev = 10; + _context9.next = 13; + return this.send(args[0], args[1]); + + case 13: + return _context9.abrupt("return", _context9.sent); + + case 16: + _context9.prev = 16; + _context9.t0 = _context9["catch"](10); + return _context9.abrupt("return", checkError(method, _context9.t0, params)); + + case 19: + case "end": + return _context9.stop(); + } + } + }, _callee9, this, [[10, 16]]); + })); + } + }, { + key: "_startEvent", + value: function _startEvent(event) { + if (event.tag === "pending") { + this._startPending(); + } + + _get(_getPrototypeOf(JsonRpcProvider.prototype), "_startEvent", this).call(this, event); + } + }, { + key: "_startPending", + value: function _startPending() { + if (this._pendingFilter != null) { + return; + } + + var self = this; + var pendingFilter = this.send("eth_newPendingTransactionFilter", []); + this._pendingFilter = pendingFilter; + pendingFilter.then(function (filterId) { + function poll() { + self.send("eth_getFilterChanges", [filterId]).then(function (hashes) { + if (self._pendingFilter != pendingFilter) { + return null; + } + + var seq = Promise.resolve(); + hashes.forEach(function (hash) { + // @TODO: This should be garbage collected at some point... How? When? + self._emitted["t:" + hash.toLowerCase()] = "pending"; + seq = seq.then(function () { + return self.getTransaction(hash).then(function (tx) { + self.emit("pending", tx); + return null; + }); + }); + }); + return seq.then(function () { + return timer(1000); + }); + }).then(function () { + if (self._pendingFilter != pendingFilter) { + self.send("eth_uninstallFilter", [filterId]); + return; + } + + setTimeout(function () { + poll(); + }, 0); + return null; + })["catch"](function (error) {}); + } + + poll(); + return filterId; + })["catch"](function (error) {}); + } + }, { + key: "_stopEvent", + value: function _stopEvent(event) { + if (event.tag === "pending" && this.listenerCount("pending") === 0) { + this._pendingFilter = null; + } + + _get(_getPrototypeOf(JsonRpcProvider.prototype), "_stopEvent", this).call(this, event); + } // Convert an ethers.js transaction into a JSON-RPC transaction + // - gasLimit => gas + // - All values hexlified + // - All numeric values zero-striped + // - All addresses are lowercased + // NOTE: This allows a TransactionRequest, but all values should be resolved + // before this is called + // @TODO: This will likely be removed in future versions and prepareRequest + // will be the preferred method for this. + + }], [{ + key: "defaultUrl", + value: function defaultUrl() { + return "http:/\/localhost:8545"; + } + }, { + key: "hexlifyTransaction", + value: function hexlifyTransaction(transaction, allowExtra) { + // Check only allowed properties are given + var allowed = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["shallowCopy"])(allowedTransactionKeys); + + if (allowExtra) { + for (var key in allowExtra) { + if (allowExtra[key]) { + allowed[key] = true; + } + } + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_4__["checkProperties"])(transaction, allowed); + var result = {}; // Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros. + + ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) { + if (transaction[key] == null) { + return; + } + + var value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexValue"])(transaction[key]); + + if (key === "gasLimit") { + key = "gas"; + } + + result[key] = value; + }); + ["from", "to", "data"].forEach(function (key) { + if (transaction[key] == null) { + return; + } + + result[key] = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(transaction[key]); + }); + + if (transaction.accessList) { + result["accessList"] = Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_6__["accessListify"])(transaction.accessList); + } + + return result; + } + }]); + + return JsonRpcProvider; +}(_base_provider__WEBPACK_IMPORTED_MODULE_10__["BaseProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/nodesmith-provider.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/nodesmith-provider.js ***! + \*****************************************************************************/ +/*! exports provided: NodesmithProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NodesmithProvider", function() { return NodesmithProvider; }); +/* harmony import */ var _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url-json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* istanbul ignore file */ + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); // Special API key provided by Nodesmith for ethers.js + +var defaultApiKey = "ETHERS_JS_SHARED"; +var NodesmithProvider = /*#__PURE__*/function (_UrlJsonRpcProvider) { + _inherits(NodesmithProvider, _UrlJsonRpcProvider); + + var _super = _createSuper(NodesmithProvider); + + function NodesmithProvider() { + _classCallCheck(this, NodesmithProvider); + + return _super.apply(this, arguments); + } + + _createClass(NodesmithProvider, null, [{ + key: "getApiKey", + value: function getApiKey(apiKey) { + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + + return apiKey || defaultApiKey; + } + }, { + key: "getUrl", + value: function getUrl(network, apiKey) { + logger.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform."); + var host = null; + + switch (network.name) { + case "homestead": + host = "https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc"; + break; + + case "ropsten": + host = "https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc"; + break; + + case "rinkeby": + host = "https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc"; + break; + + case "goerli": + host = "https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc"; + break; + + case "kovan": + host = "https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc"; + break; + + default: + logger.throwArgumentError("unsupported network", "network", arguments[0]); + } + + return host + "?apiKey=" + apiKey; + } + }]); + + return NodesmithProvider; +}(_url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_0__["UrlJsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/pocket-provider.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/pocket-provider.js ***! + \**************************************************************************/ +/*! exports provided: PocketProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PocketProvider", function() { return PocketProvider; }); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./url-json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); + // These are load-balancer-based application IDs + +var defaultApplicationIds = { + homestead: "6004bcd10040261633ade990", + ropsten: "6004bd4d0040261633ade991", + rinkeby: "6004bda20040261633ade994", + goerli: "6004bd860040261633ade992" +}; +var PocketProvider = /*#__PURE__*/function (_UrlJsonRpcProvider) { + _inherits(PocketProvider, _UrlJsonRpcProvider); + + var _super = _createSuper(PocketProvider); + + function PocketProvider(network, apiKey) { + _classCallCheck(this, PocketProvider); + + // We need a bit of creativity in the constructor because + // Pocket uses different default API keys based on the network + if (apiKey == null) { + var n = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["getStatic"])(this instanceof PocketProvider ? this.constructor : void 0, "getNetwork")(network); + + if (n) { + var applicationId = defaultApplicationIds[n.name]; + + if (applicationId) { + apiKey = { + applicationId: applicationId, + loadBalancer: true + }; + } + } // If there was any issue above, we don't know this network + + + if (apiKey == null) { + logger.throwError("unsupported network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + } + + return _super.call(this, network, apiKey); + } + + _createClass(PocketProvider, [{ + key: "isCommunityResource", + value: function isCommunityResource() { + return this.applicationId === defaultApplicationIds[this.network.name]; + } + }], [{ + key: "getApiKey", + value: function getApiKey(apiKey) { + // Most API Providers allow null to get the default configuration, but + // Pocket requires the network to decide the default provider, so we + // rely on hijacking the constructor to add a sensible default for us + if (apiKey == null) { + logger.throwArgumentError("PocketProvider.getApiKey does not support null apiKey", "apiKey", apiKey); + } + + var apiKeyObj = { + applicationId: null, + loadBalancer: false, + applicationSecretKey: null + }; // Parse applicationId and applicationSecretKey + + if (typeof apiKey === "string") { + apiKeyObj.applicationId = apiKey; + } else if (apiKey.applicationSecretKey != null) { + logger.assertArgument(typeof apiKey.applicationId === "string", "applicationSecretKey requires an applicationId", "applicationId", apiKey.applicationId); + logger.assertArgument(typeof apiKey.applicationSecretKey === "string", "invalid applicationSecretKey", "applicationSecretKey", "[REDACTED]"); + apiKeyObj.applicationId = apiKey.applicationId; + apiKeyObj.applicationSecretKey = apiKey.applicationSecretKey; + apiKeyObj.loadBalancer = !!apiKey.loadBalancer; + } else if (apiKey.applicationId) { + logger.assertArgument(typeof apiKey.applicationId === "string", "apiKey.applicationId must be a string", "apiKey.applicationId", apiKey.applicationId); + apiKeyObj.applicationId = apiKey.applicationId; + apiKeyObj.loadBalancer = !!apiKey.loadBalancer; + } else { + logger.throwArgumentError("unsupported PocketProvider apiKey", "apiKey", apiKey); + } + + return apiKeyObj; + } + }, { + key: "getUrl", + value: function getUrl(network, apiKey) { + var host = null; + + switch (network ? network.name : "unknown") { + case "homestead": + host = "eth-mainnet.gateway.pokt.network"; + break; + + case "ropsten": + host = "eth-ropsten.gateway.pokt.network"; + break; + + case "rinkeby": + host = "eth-rinkeby.gateway.pokt.network"; + break; + + case "goerli": + host = "eth-goerli.gateway.pokt.network"; + break; + + default: + logger.throwError("unsupported network", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + + var url = null; + + if (apiKey.loadBalancer) { + url = "https://".concat(host, "/v1/lb/").concat(apiKey.applicationId); + } else { + url = "https://".concat(host, "/v1/").concat(apiKey.applicationId); + } + + var connection = { + url: url + }; // Initialize empty headers + + connection.headers = {}; // Apply application secret key + + if (apiKey.applicationSecretKey != null) { + connection.user = ""; + connection.password = apiKey.applicationSecretKey; + } + + return connection; + } + }]); + + return PocketProvider; +}(_url_json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__["UrlJsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js": +/*!********************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/url-json-rpc-provider.js ***! + \********************************************************************************/ +/*! exports provided: StaticJsonRpcProvider, UrlJsonRpcProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticJsonRpcProvider", function() { return StaticJsonRpcProvider; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlJsonRpcProvider", function() { return UrlJsonRpcProvider; }); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); + // A StaticJsonRpcProvider is useful when you *know* for certain that +// the backend will never change, as it never calls eth_chainId to +// verify its backend. However, if the backend does change, the effects +// are undefined and may include: +// - inconsistent results +// - locking up the UI +// - block skew warnings +// - wrong results +// If the network is not explicit (i.e. auto-detection is expected), the +// node MUST be running and available to respond to requests BEFORE this +// is instantiated. + +var StaticJsonRpcProvider = /*#__PURE__*/function (_JsonRpcProvider) { + _inherits(StaticJsonRpcProvider, _JsonRpcProvider); + + var _super2 = _createSuper(StaticJsonRpcProvider); + + function StaticJsonRpcProvider() { + _classCallCheck(this, StaticJsonRpcProvider); + + return _super2.apply(this, arguments); + } + + _createClass(StaticJsonRpcProvider, [{ + key: "detectNetwork", + value: function detectNetwork() { + var _this = this; + + var _super = Object.create(null, { + detectNetwork: { + get: function get() { + return _get(_getPrototypeOf(StaticJsonRpcProvider.prototype), "detectNetwork", _this); + } + } + }); + + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var network; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + network = this.network; + + if (!(network == null)) { + _context.next = 7; + break; + } + + _context.next = 4; + return _super.detectNetwork.call(this); + + case 4: + network = _context.sent; + + if (!network) { + logger.throwError("no network detected", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNKNOWN_ERROR, {}); + } // If still not set, set it + + + if (this._network == null) { + // A static network does not support "any" + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(this, "_network", network); + this.emit("network", network, null); + } + + case 7: + return _context.abrupt("return", network); + + case 8: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + } + }]); + + return StaticJsonRpcProvider; +}(_json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__["JsonRpcProvider"]); +var UrlJsonRpcProvider = /*#__PURE__*/function (_StaticJsonRpcProvide) { + _inherits(UrlJsonRpcProvider, _StaticJsonRpcProvide); + + var _super3 = _createSuper(UrlJsonRpcProvider); + + function UrlJsonRpcProvider(network, apiKey) { + var _this2; + + _classCallCheck(this, UrlJsonRpcProvider); + + logger.checkAbstract(this instanceof UrlJsonRpcProvider ? this.constructor : void 0, UrlJsonRpcProvider); // Normalize the Network and API Key + + network = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["getStatic"])(this instanceof UrlJsonRpcProvider ? this.constructor : void 0, "getNetwork")(network); + apiKey = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["getStatic"])(this instanceof UrlJsonRpcProvider ? this.constructor : void 0, "getApiKey")(apiKey); + var connection = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["getStatic"])(this instanceof UrlJsonRpcProvider ? this.constructor : void 0, "getUrl")(network, apiKey); + _this2 = _super3.call(this, connection, network); + + if (typeof apiKey === "string") { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this2), "apiKey", apiKey); + } else if (apiKey != null) { + Object.keys(apiKey).forEach(function (key) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this2), key, apiKey[key]); + }); + } + + return _this2; + } + + _createClass(UrlJsonRpcProvider, [{ + key: "_startPending", + value: function _startPending() { + logger.warn("WARNING: API provider does not support pending filters"); + } + }, { + key: "isCommunityResource", + value: function isCommunityResource() { + return false; + } + }, { + key: "getSigner", + value: function getSigner(address) { + return logger.throwError("API provider does not support signing", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "getSigner" + }); + } + }, { + key: "listAccounts", + value: function listAccounts() { + return Promise.resolve([]); + } // Return a defaultApiKey if null, otherwise validate the API key + + }], [{ + key: "getApiKey", + value: function getApiKey(apiKey) { + return apiKey; + } // Returns the url or connection for the given network and API key. The + // API key will have been sanitized by the getApiKey first, so any validation + // or transformations can be done there. + + }, { + key: "getUrl", + value: function getUrl(network, apiKey) { + return logger.throwError("not implemented; sub-classes must override getUrl", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.NOT_IMPLEMENTED, { + operation: "getUrl" + }); + } + }]); + + return UrlJsonRpcProvider; +}(StaticJsonRpcProvider); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/web3-provider.js": +/*!************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/web3-provider.js ***! + \************************************************************************/ +/*! exports provided: Web3Provider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Web3Provider", function() { return Web3Provider; }); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); +/* harmony import */ var _json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); + +var _nextId = 1; + +function buildWeb3LegacyFetcher(provider, sendFunc) { + var fetcher = "Web3LegacyFetcher"; + return function (method, params) { + var _this = this; + + var request = { + method: method, + params: params, + id: _nextId++, + jsonrpc: "2.0" + }; + return new Promise(function (resolve, reject) { + _this.emit("debug", { + action: "request", + fetcher: fetcher, + request: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["deepCopy"])(request), + provider: _this + }); + + sendFunc(request, function (error, response) { + if (error) { + _this.emit("debug", { + action: "response", + fetcher: fetcher, + error: error, + request: request, + provider: _this + }); + + return reject(error); + } + + _this.emit("debug", { + action: "response", + fetcher: fetcher, + request: request, + response: response, + provider: _this + }); + + if (response.error) { + var _error = new Error(response.error.message); + + _error.code = response.error.code; + _error.data = response.error.data; + return reject(_error); + } + + resolve(response.result); + }); + }); + }; +} + +function buildEip1193Fetcher(provider) { + return function (method, params) { + var _this2 = this; + + if (params == null) { + params = []; + } + + var request = { + method: method, + params: params + }; + this.emit("debug", { + action: "request", + fetcher: "Eip1193Fetcher", + request: Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["deepCopy"])(request), + provider: this + }); + return provider.request(request).then(function (response) { + _this2.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request: request, + response: response, + provider: _this2 + }); + + return response; + }, function (error) { + _this2.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request: request, + error: error, + provider: _this2 + }); + + throw error; + }); + }; +} + +var Web3Provider = /*#__PURE__*/function (_JsonRpcProvider) { + _inherits(Web3Provider, _JsonRpcProvider); + + var _super = _createSuper(Web3Provider); + + function Web3Provider(provider, network) { + var _this3; + + _classCallCheck(this, Web3Provider); + + logger.checkNew(this instanceof Web3Provider ? this.constructor : void 0, Web3Provider); + + if (provider == null) { + logger.throwArgumentError("missing provider", "provider", provider); + } + + var path = null; + var jsonRpcFetchFunc = null; + var subprovider = null; + + if (typeof provider === "function") { + path = "unknown:"; + jsonRpcFetchFunc = provider; + } else { + path = provider.host || provider.path || ""; + + if (!path && provider.isMetaMask) { + path = "metamask"; + } + + subprovider = provider; + + if (provider.request) { + if (path === "") { + path = "eip-1193:"; + } + + jsonRpcFetchFunc = buildEip1193Fetcher(provider); + } else if (provider.sendAsync) { + jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.sendAsync.bind(provider)); + } else if (provider.send) { + jsonRpcFetchFunc = buildWeb3LegacyFetcher(provider, provider.send.bind(provider)); + } else { + logger.throwArgumentError("unsupported provider", "provider", provider); + } + + if (!path) { + path = "unknown:"; + } + } + + _this3 = _super.call(this, path, network); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this3), "jsonRpcFetchFunc", jsonRpcFetchFunc); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_0__["defineReadOnly"])(_assertThisInitialized(_this3), "provider", subprovider); + return _this3; + } + + _createClass(Web3Provider, [{ + key: "send", + value: function send(method, params) { + return this.jsonRpcFetchFunc(method, params); + } + }]); + + return Web3Provider; +}(_json_rpc_provider__WEBPACK_IMPORTED_MODULE_3__["JsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/websocket-provider.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/websocket-provider.js ***! + \*****************************************************************************/ +/*! exports provided: WebSocketProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebSocketProvider", function() { return WebSocketProvider; }); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _json_rpc_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./json-rpc-provider */ "./node_modules/@ethersproject/providers/lib.esm/json-rpc-provider.js"); +/* harmony import */ var _ws__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ws */ "./node_modules/@ethersproject/providers/lib.esm/ws.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"](_version__WEBPACK_IMPORTED_MODULE_5__["version"]); +/** + * Notes: + * + * This provider differs a bit from the polling providers. One main + * difference is how it handles consistency. The polling providers + * will stall responses to ensure a consistent state, while this + * WebSocket provider assumes the connected backend will manage this. + * + * For example, if a polling provider emits an event which indicates + * the event occurred in blockhash XXX, a call to fetch that block by + * its hash XXX, if not present will retry until it is present. This + * can occur when querying a pool of nodes that are mildly out of sync + * with each other. + */ + +var NextId = 1; // For more info about the Real-time Event API see: +// https://geth.ethereum.org/docs/rpc/pubsub + +var WebSocketProvider = /*#__PURE__*/function (_JsonRpcProvider) { + _inherits(WebSocketProvider, _JsonRpcProvider); + + var _super = _createSuper(WebSocketProvider); + + function WebSocketProvider(url, network) { + var _thisSuper, _this; + + _classCallCheck(this, WebSocketProvider); + + // This will be added in the future; please open an issue to expedite + if (network === "any") { + logger.throwError("WebSocketProvider does not support 'any' network yet", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "network:any" + }); + } + + _this = _super.call(this, url, network); + _this._pollingInterval = -1; + _this._wsReady = false; + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(_assertThisInitialized(_this), "_websocket", new _ws__WEBPACK_IMPORTED_MODULE_3__["WebSocket"](_this.connection.url)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(_assertThisInitialized(_this), "_requests", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(_assertThisInitialized(_this), "_subs", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(_assertThisInitialized(_this), "_subIds", {}); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(_assertThisInitialized(_this), "_detectNetwork", _get((_thisSuper = _assertThisInitialized(_this), _getPrototypeOf(WebSocketProvider.prototype)), "detectNetwork", _thisSuper).call(_thisSuper)); // Stall sending requests until the socket is open... + + _this._websocket.onopen = function () { + _this._wsReady = true; + Object.keys(_this._requests).forEach(function (id) { + _this._websocket.send(_this._requests[id].payload); + }); + }; + + _this._websocket.onmessage = function (messageEvent) { + var data = messageEvent.data; + var result = JSON.parse(data); + + if (result.id != null) { + var id = String(result.id); + var request = _this._requests[id]; + delete _this._requests[id]; + + if (result.result !== undefined) { + request.callback(null, result.result); + + _this.emit("debug", { + action: "response", + request: JSON.parse(request.payload), + response: result.result, + provider: _assertThisInitialized(_this) + }); + } else { + var error = null; + + if (result.error) { + error = new Error(result.error.message || "unknown error"); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(error, "code", result.error.code || null); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(error, "response", data); + } else { + error = new Error("unknown error"); + } + + request.callback(error, undefined); + + _this.emit("debug", { + action: "response", + error: error, + request: JSON.parse(request.payload), + provider: _assertThisInitialized(_this) + }); + } + } else if (result.method === "eth_subscription") { + // Subscription... + var sub = _this._subs[result.params.subscription]; + + if (sub) { + //this.emit.apply(this, ); + sub.processFunc(result.params.result); + } + } else { + console.warn("this should not happen"); + } + }; // This Provider does not actually poll, but we want to trigger + // poll events for things that depend on them (like stalling for + // block and transaction lookups) + + + var fauxPoll = setInterval(function () { + _this.emit("poll"); + }, 1000); + + if (fauxPoll.unref) { + fauxPoll.unref(); + } + + return _this; + } + + _createClass(WebSocketProvider, [{ + key: "detectNetwork", + value: function detectNetwork() { + return this._detectNetwork; + } + }, { + key: "pollingInterval", + get: function get() { + return 0; + }, + set: function set(value) { + logger.throwError("cannot set polling interval on WebSocketProvider", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "setPollingInterval" + }); + } + }, { + key: "resetEventsBlock", + value: function resetEventsBlock(blockNumber) { + logger.throwError("cannot reset events block on WebSocketProvider", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "resetEventBlock" + }); + } + }, { + key: "poll", + value: function poll() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + return _context.abrupt("return", null); + + case 1: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + } + }, { + key: "polling", + set: function set(value) { + if (!value) { + return; + } + + logger.throwError("cannot set polling on WebSocketProvider", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "setPolling" + }); + } + }, { + key: "send", + value: function send(method, params) { + var _this2 = this; + + var rid = NextId++; + return new Promise(function (resolve, reject) { + function callback(error, result) { + if (error) { + return reject(error); + } + + return resolve(result); + } + + var payload = JSON.stringify({ + method: method, + params: params, + id: rid, + jsonrpc: "2.0" + }); + + _this2.emit("debug", { + action: "request", + request: JSON.parse(payload), + provider: _this2 + }); + + _this2._requests[String(rid)] = { + callback: callback, + payload: payload + }; + + if (_this2._wsReady) { + _this2._websocket.send(payload); + } + }); + } + }, { + key: "_subscribe", + value: function _subscribe(tag, param, processFunc) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + var _this3 = this; + + var subIdPromise, subId; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + subIdPromise = this._subIds[tag]; + + if (subIdPromise == null) { + subIdPromise = Promise.all(param).then(function (param) { + return _this3.send("eth_subscribe", param); + }); + this._subIds[tag] = subIdPromise; + } + + _context2.next = 4; + return subIdPromise; + + case 4: + subId = _context2.sent; + this._subs[subId] = { + tag: tag, + processFunc: processFunc + }; + + case 6: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + } + }, { + key: "_startEvent", + value: function _startEvent(event) { + var _this4 = this; + + switch (event.type) { + case "block": + this._subscribe("block", ["newHeads"], function (result) { + var blockNumber = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(result.number).toNumber(); + _this4._emitted.block = blockNumber; + + _this4.emit("block", blockNumber); + }); + + break; + + case "pending": + this._subscribe("pending", ["newPendingTransactions"], function (result) { + _this4.emit("pending", result); + }); + + break; + + case "filter": + this._subscribe(event.tag, ["logs", this._getFilter(event.filter)], function (result) { + if (result.removed == null) { + result.removed = false; + } + + _this4.emit(event.filter, _this4.formatter.filterLog(result)); + }); + + break; + + case "tx": + { + var emitReceipt = function emitReceipt(event) { + var hash = event.hash; + + _this4.getTransactionReceipt(hash).then(function (receipt) { + if (!receipt) { + return; + } + + _this4.emit(hash, receipt); + }); + }; // In case it is already mined + + + emitReceipt(event); // To keep things simple, we start up a single newHeads subscription + // to keep an eye out for transactions we are watching for. + // Starting a subscription for an event (i.e. "tx") that is already + // running is (basically) a nop. + + this._subscribe("tx", ["newHeads"], function (result) { + _this4._events.filter(function (e) { + return e.type === "tx"; + }).forEach(emitReceipt); + }); + + break; + } + // Nothing is needed + + case "debug": + case "poll": + case "willPoll": + case "didPoll": + case "error": + break; + + default: + console.log("unhandled:", event); + break; + } + } + }, { + key: "_stopEvent", + value: function _stopEvent(event) { + var _this5 = this; + + var tag = event.tag; + + if (event.type === "tx") { + // There are remaining transaction event listeners + if (this._events.filter(function (e) { + return e.type === "tx"; + }).length) { + return; + } + + tag = "tx"; + } else if (this.listenerCount(event.event)) { + // There are remaining event listeners + return; + } + + var subId = this._subIds[tag]; + + if (!subId) { + return; + } + + delete this._subIds[tag]; + subId.then(function (subId) { + if (!_this5._subs[subId]) { + return; + } + + delete _this5._subs[subId]; + + _this5.send("eth_unsubscribe", [subId]); + }); + } + }, { + key: "destroy", + value: function destroy() { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + var _this6 = this; + + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (!(this._websocket.readyState === _ws__WEBPACK_IMPORTED_MODULE_3__["WebSocket"].CONNECTING)) { + _context3.next = 3; + break; + } + + _context3.next = 3; + return new Promise(function (resolve) { + _this6._websocket.onopen = function () { + resolve(true); + }; + + _this6._websocket.onerror = function () { + resolve(false); + }; + }); + + case 3: + // Hangup + // See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes + this._websocket.close(1000); + + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + } + }], [{ + key: "defaultUrl", + value: function defaultUrl() { + return "ws:/\/localhost:8546"; + } + }]); + + return WebSocketProvider; +}(_json_rpc_provider__WEBPACK_IMPORTED_MODULE_2__["JsonRpcProvider"]); + +/***/ }), + +/***/ "./node_modules/@ethersproject/providers/lib.esm/ws.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/providers/lib.esm/ws.js ***! + \*************************************************************/ +/*! exports provided: WebSocket */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebSocket", function() { return WS; }); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/providers/lib.esm/_version.js"); + + + + +var WS = null; + +try { + WS = WebSocket; + + if (WS == null) { + throw new Error("inject please"); + } +} catch (error) { + var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"](_version__WEBPACK_IMPORTED_MODULE_1__["version"]); + + WS = function WS() { + logger.throwError("WebSockets not supported in this environment", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_0__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "new WebSocket()" + }); + }; +} //export default WS; +//module.exports = WS; + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/random/lib.esm/_version.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/random/lib.esm/_version.js ***! + \****************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "random/5.5.1"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/random/lib.esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/random/lib.esm/index.js ***! + \*************************************************************/ +/*! exports provided: randomBytes, shuffled */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./random */ "./node_modules/@ethersproject/random/lib.esm/random.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "randomBytes", function() { return _random__WEBPACK_IMPORTED_MODULE_0__["randomBytes"]; }); + +/* harmony import */ var _shuffle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shuffle */ "./node_modules/@ethersproject/random/lib.esm/shuffle.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shuffled", function() { return _shuffle__WEBPACK_IMPORTED_MODULE_1__["shuffled"]; }); + + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/random/lib.esm/random.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/random/lib.esm/random.js ***! + \**************************************************************/ +/*! exports provided: randomBytes */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "randomBytes", function() { return randomBytes; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/random/lib.esm/_version.js"); + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); // Debugging line for testing browser lib in node +//const window = { crypto: { getRandomValues: () => { } } }; +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis + +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + + if (typeof window !== 'undefined') { + return window; + } + + if (typeof global !== 'undefined') { + return global; + } + + throw new Error('unable to locate global object'); +} + +; +var anyGlobal = getGlobal(); +var crypto = anyGlobal.crypto || anyGlobal.msCrypto; + +if (!crypto || !crypto.getRandomValues) { + logger.warn("WARNING: Missing strong random number source"); + crypto = { + getRandomValues: function getRandomValues(buffer) { + return logger.throwError("no secure random source avaialble", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "crypto.getRandomValues" + }); + } + }; +} + +function randomBytes(length) { + if (length <= 0 || length > 1024 || length % 1 || length != length) { + logger.throwArgumentError("invalid length", "length", length); + } + + var result = new Uint8Array(length); + crypto.getRandomValues(result); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(result); +} +; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/@ethersproject/random/lib.esm/shuffle.js": +/*!***************************************************************!*\ + !*** ./node_modules/@ethersproject/random/lib.esm/shuffle.js ***! + \***************************************************************/ +/*! exports provided: shuffled */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shuffled", function() { return shuffled; }); + + +function shuffled(array) { + array = array.slice(); + + for (var i = array.length - 1; i > 0; i--) { + var j = Math.floor(Math.random() * (i + 1)); + var tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } + + return array; +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/rlp/lib.esm/_version.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/rlp/lib.esm/_version.js ***! + \*************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "rlp/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/rlp/lib.esm/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@ethersproject/rlp/lib.esm/index.js ***! + \**********************************************************/ +/*! exports provided: encode, decode */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encode", function() { return encode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decode", function() { return decode; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/rlp/lib.esm/_version.js"); + //See: https://github.com/ethereum/wiki/wiki/RLP + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); + +function arrayifyInteger(value) { + var result = []; + + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + + return result; +} + +function unarrayifyInteger(data, offset, length) { + var result = 0; + + for (var i = 0; i < length; i++) { + result = result * 256 + data[offset + i]; + } + + return result; +} + +function _encode(object) { + if (Array.isArray(object)) { + var payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + + var _length = arrayifyInteger(payload.length); + + _length.unshift(0xf7 + _length.length); + + return _length.concat(payload); + } + + if (!Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["isBytesLike"])(object)) { + logger.throwArgumentError("RLP object must be BytesLike", "object", object); + } + + var data = Array.prototype.slice.call(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(object)); + + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + + var length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); +} + +function encode(object) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(_encode(object)); +} + +function _decodeChildren(data, offset, childOffset, length) { + var result = []; + + while (childOffset < offset + 1 + length) { + var decoded = _decode(data, childOffset); + + result.push(decoded.result); + childOffset += decoded.consumed; + + if (childOffset > offset + 1 + length) { + logger.throwError("child data too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } + } + + return { + consumed: 1 + length, + result: result + }; +} // returns { consumed: number, result: Object } + + +function _decode(data, offset) { + if (data.length === 0) { + logger.throwError("data too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } // Array with extra length prefix + + + if (data[offset] >= 0xf8) { + var lengthLength = data[offset] - 0xf7; + + if (offset + 1 + lengthLength > data.length) { + logger.throwError("data short segment too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } + + var length = unarrayifyInteger(data, offset + 1, lengthLength); + + if (offset + 1 + lengthLength + length > data.length) { + logger.throwError("data long segment too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } + + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } else if (data[offset] >= 0xc0) { + var _length2 = data[offset] - 0xc0; + + if (offset + 1 + _length2 > data.length) { + logger.throwError("data array too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } + + return _decodeChildren(data, offset, offset + 1, _length2); + } else if (data[offset] >= 0xb8) { + var _lengthLength = data[offset] - 0xb7; + + if (offset + 1 + _lengthLength > data.length) { + logger.throwError("data array too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } + + var _length3 = unarrayifyInteger(data, offset + 1, _lengthLength); + + if (offset + 1 + _lengthLength + _length3 > data.length) { + logger.throwError("data array too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } + + var result = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(data.slice(offset + 1 + _lengthLength, offset + 1 + _lengthLength + _length3)); + return { + consumed: 1 + _lengthLength + _length3, + result: result + }; + } else if (data[offset] >= 0x80) { + var _length4 = data[offset] - 0x80; + + if (offset + 1 + _length4 > data.length) { + logger.throwError("data too short", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"].errors.BUFFER_OVERRUN, {}); + } + + var _result = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(data.slice(offset + 1, offset + 1 + _length4)); + + return { + consumed: 1 + _length4, + result: _result + }; + } + + return { + consumed: 1, + result: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["hexlify"])(data[offset]) + }; +} + +function decode(data) { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(data); + + var decoded = _decode(bytes, 0); + + if (decoded.consumed !== bytes.length) { + logger.throwArgumentError("invalid rlp data", "data", data); + } + + return decoded.result; +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/sha2/lib.esm/_version.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/sha2/lib.esm/_version.js ***! + \**************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "sha2/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/sha2/lib.esm/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/@ethersproject/sha2/lib.esm/index.js ***! + \***********************************************************/ +/*! exports provided: computeHmac, ripemd160, sha256, sha512, SupportedAlgorithm */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/sha2.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "computeHmac", function() { return _sha2__WEBPACK_IMPORTED_MODULE_0__["computeHmac"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ripemd160", function() { return _sha2__WEBPACK_IMPORTED_MODULE_0__["ripemd160"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sha256", function() { return _sha2__WEBPACK_IMPORTED_MODULE_0__["sha256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sha512", function() { return _sha2__WEBPACK_IMPORTED_MODULE_0__["sha512"]; }); + +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./node_modules/@ethersproject/sha2/lib.esm/types.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SupportedAlgorithm", function() { return _types__WEBPACK_IMPORTED_MODULE_1__["SupportedAlgorithm"]; }); + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/sha2/lib.esm/sha2.js": +/*!**********************************************************!*\ + !*** ./node_modules/@ethersproject/sha2/lib.esm/sha2.js ***! + \**********************************************************/ +/*! exports provided: ripemd160, sha256, sha512, computeHmac */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ripemd160", function() { return ripemd160; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sha256", function() { return sha256; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sha512", function() { return sha512; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeHmac", function() { return computeHmac; }); +/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! hash.js */ "./node_modules/hash.js/lib/hash.js"); +/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(hash_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "./node_modules/@ethersproject/sha2/lib.esm/types.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/sha2/lib.esm/_version.js"); + + + //const _ripemd160 = _hash.ripemd160; + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"](_version__WEBPACK_IMPORTED_MODULE_4__["version"]); +function ripemd160(data) { + return "0x" + hash_js__WEBPACK_IMPORTED_MODULE_0___default.a.ripemd160().update(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(data)).digest("hex"); +} +function sha256(data) { + return "0x" + hash_js__WEBPACK_IMPORTED_MODULE_0___default.a.sha256().update(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(data)).digest("hex"); +} +function sha512(data) { + return "0x" + hash_js__WEBPACK_IMPORTED_MODULE_0___default.a.sha512().update(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(data)).digest("hex"); +} +function computeHmac(algorithm, key, data) { + if (!_types__WEBPACK_IMPORTED_MODULE_2__["SupportedAlgorithm"][algorithm]) { + logger.throwError("unsupported algorithm " + algorithm, _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "hmac", + algorithm: algorithm + }); + } + + return "0x" + hash_js__WEBPACK_IMPORTED_MODULE_0___default.a.hmac(hash_js__WEBPACK_IMPORTED_MODULE_0___default.a[algorithm], Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(key)).update(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(data)).digest("hex"); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/sha2/lib.esm/types.js": +/*!***********************************************************!*\ + !*** ./node_modules/@ethersproject/sha2/lib.esm/types.js ***! + \***********************************************************/ +/*! exports provided: SupportedAlgorithm */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SupportedAlgorithm", function() { return SupportedAlgorithm; }); +var SupportedAlgorithm; + +(function (SupportedAlgorithm) { + SupportedAlgorithm["sha256"] = "sha256"; + SupportedAlgorithm["sha512"] = "sha512"; +})(SupportedAlgorithm || (SupportedAlgorithm = {})); + +; + +/***/ }), + +/***/ "./node_modules/@ethersproject/signing-key/lib.esm/_version.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@ethersproject/signing-key/lib.esm/_version.js ***! + \*********************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "signing-key/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js ***! + \*********************************************************************/ +/*! exports provided: EC */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EC", function() { return EC$1; }); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ "./node_modules/bn.js/lib/bn.js"); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! hash.js */ "./node_modules/hash.js/lib/hash.js"); +/* harmony import */ var hash_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(hash_js__WEBPACK_IMPORTED_MODULE_1__); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + + + +var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; + +function getDefaultExportFromCjs(x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +function createCommonjsModule(fn, basedir, module) { + return module = { + path: basedir, + exports: {}, + require: function require(path, base) { + return commonjsRequire(path, base === undefined || base === null ? module.path : base); + } + }, fn(module, module.exports), module.exports; +} + +function getDefaultExportFromNamespaceIfPresent(n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') ? n['default'] : n; +} + +function getDefaultExportFromNamespaceIfNotNamed(n) { + return n && Object.prototype.hasOwnProperty.call(n, 'default') && Object.keys(n).length === 1 ? n['default'] : n; +} + +function getAugmentedNamespace(n) { + if (n.__esModule) return n; + var a = Object.defineProperty({}, '__esModule', { + value: true + }); + Object.keys(n).forEach(function (k) { + var d = Object.getOwnPropertyDescriptor(n, k); + Object.defineProperty(a, k, d.get ? d : { + enumerable: true, + get: function get() { + return n[k]; + } + }); + }); + return a; +} + +function commonjsRequire() { + throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); +} + +var minimalisticAssert = assert; + +function assert(val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); +} + +assert.equal = function assertEqual(l, r, msg) { + if (l != r) throw new Error(msg || 'Assertion failed: ' + l + ' != ' + r); +}; + +var utils_1 = createCommonjsModule(function (module, exports) { + 'use strict'; + + var utils = exports; + + function toArray(msg, enc) { + if (Array.isArray(msg)) return msg.slice(); + if (!msg) return []; + var res = []; + + if (typeof msg !== 'string') { + for (var i = 0; i < msg.length; i++) { + res[i] = msg[i] | 0; + } + + return res; + } + + if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) msg = '0' + msg; + + for (var i = 0; i < msg.length; i += 2) { + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) res.push(hi, lo);else res.push(lo); + } + } + + return res; + } + + utils.toArray = toArray; + + function zero2(word) { + if (word.length === 1) return '0' + word;else return word; + } + + utils.zero2 = zero2; + + function toHex(msg) { + var res = ''; + + for (var i = 0; i < msg.length; i++) { + res += zero2(msg[i].toString(16)); + } + + return res; + } + + utils.toHex = toHex; + + utils.encode = function encode(arr, enc) { + if (enc === 'hex') return toHex(arr);else return arr; + }; +}); +var utils_1$1 = createCommonjsModule(function (module, exports) { + 'use strict'; + + var utils = exports; + utils.assert = minimalisticAssert; + utils.toArray = utils_1.toArray; + utils.zero2 = utils_1.zero2; + utils.toHex = utils_1.toHex; + utils.encode = utils_1.encode; // Represent num in a w-NAF form + + function getNAF(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + naf.fill(0); + var ws = 1 << w + 1; + var k = num.clone(); + + for (var i = 0; i < naf.length; i++) { + var z; + var mod = k.andln(ws - 1); + + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) z = (ws >> 1) - mod;else z = mod; + k.isubn(z); + } else { + z = 0; + } + + naf[i] = z; + k.iushrn(1); + } + + return naf; + } + + utils.getNAF = getNAF; // Represent k1, k2 in a Joint Sparse Form + + function getJSF(k1, k2) { + var jsf = [[], []]; + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + // First phase + var m14 = k1.andln(3) + d1 & 3; + var m24 = k2.andln(3) + d2 & 3; + if (m14 === 3) m14 = -1; + if (m24 === 3) m24 = -1; + var u1; + + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = k1.andln(7) + d1 & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) u1 = -m14;else u1 = m14; + } + + jsf[0].push(u1); + var u2; + + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = k2.andln(7) + d2 & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) u2 = -m24;else u2 = m24; + } + + jsf[1].push(u2); // Second phase + + if (2 * d1 === u1 + 1) d1 = 1 - d1; + if (2 * d2 === u2 + 1) d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; + } + + utils.getJSF = getJSF; + + function cachedProperty(obj, name, computer) { + var key = '_' + name; + + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : this[key] = computer.call(this); + }; + } + + utils.cachedProperty = cachedProperty; + + function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : bytes; + } + + utils.parseBytes = parseBytes; + + function intFromLE(bytes) { + return new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(bytes, 'hex', 'le'); + } + + utils.intFromLE = intFromLE; +}); +'use strict'; + +var getNAF = utils_1$1.getNAF; +var getJSF = utils_1$1.getJSF; +var assert$1 = utils_1$1.assert; + +function BaseCurve(type, conf) { + this.type = type; + this.p = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(conf.p, 16); // Use Montgomery, when there is no fast reduction for the prime + + this.red = conf.prime ? bn_js__WEBPACK_IMPORTED_MODULE_0___default.a.red(conf.prime) : bn_js__WEBPACK_IMPORTED_MODULE_0___default.a.mont(this.p); // Useful for many curves + + this.zero = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(0).toRed(this.red); + this.one = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(1).toRed(this.red); + this.two = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(2).toRed(this.red); // Curve configuration, optional + + this.n = conf.n && new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); // Temporary arrays + + this._wnafT1 = new Array(4); + this._wnafT2 = new Array(4); + this._wnafT3 = new Array(4); + this._wnafT4 = new Array(4); + this._bitLength = this.n ? this.n.bitLength() : 0; // Generalized Greg Maxwell's trick + + var adjustCount = this.n && this.p.div(this.n); + + if (!adjustCount || adjustCount.cmpn(100) > 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} + +var base = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + assert$1(p.precomputed); + + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1, this._bitLength); + var I = (1 << doubles.step + 1) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; // Translate into more windowed form + + var repr = []; + var j; + var nafW; + + for (j = 0; j < naf.length; j += doubles.step) { + nafW = 0; + + for (var l = j + doubles.step - 1; l >= j; l--) { + nafW = (nafW << 1) + naf[l]; + } + + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + + for (var i = I; i > 0; i--) { + for (j = 0; j < repr.length; j++) { + nafW = repr[j]; + if (nafW === i) b = b.mixedAdd(doubles.points[j]);else if (nafW === -i) b = b.mixedAdd(doubles.points[j].neg()); + } + + a = a.add(b); + } + + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; // Precompute window + + var nafPoints = p._getNAFPoints(w); + + w = nafPoints.wnd; + var wnd = nafPoints.points; // Get NAF form + + var naf = getNAF(k, w, this._bitLength); // Add `this`*(N+1) for every w-NAF index + + var acc = this.jpoint(null, null, null); + + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var l = 0; i >= 0 && naf[i] === 0; i--) { + l++; + } + + if (i >= 0) l++; + acc = acc.dblp(l); + if (i < 0) break; + var z = naf[i]; + assert$1(z !== 0); + + if (p.type === 'affine') { + // J +- P + if (z > 0) acc = acc.mixedAdd(wnd[z - 1 >> 1]);else acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()); + } else { + // J +- J + if (z > 0) acc = acc.add(wnd[z - 1 >> 1]);else acc = acc.add(wnd[-z - 1 >> 1].neg()); + } + } + + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len, jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; // Fill all arrays + + var max = 0; + var i; + var j; + var p; + + for (i = 0; i < len; i++) { + p = points[i]; + + var nafPoints = p._getNAFPoints(defW); + + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } // Comb small window NAFs + + + for (i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); + naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [points[a], + /* 1 */ + null, + /* 3 */ + null, + /* 5 */ + points[b] + /* 7 */ + ]; // Try to avoid Projective points, if possible + + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [-3, + /* -1 -1 */ + -1, + /* -1 0 */ + -5, + /* -1 1 */ + -7, + /* 0 -1 */ + 0, + /* 0 0 */ + 7, + /* 0 1 */ + 5, + /* 1 -1 */ + 1, + /* 1 0 */ + 3 + /* 1 1 */ + ]; + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + + for (j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + + for (i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + + for (j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) zero = false; + } + + if (!zero) break; + k++; + i--; + } + + if (i >= 0) k++; + acc = acc.dblp(k); + if (i < 0) break; + + for (j = 0; j < len; j++) { + var z = tmp[j]; + p; + if (z === 0) continue;else if (z > 0) p = wnd[j][z - 1 >> 1];else if (z < 0) p = wnd[j][-z - 1 >> 1].neg(); + if (p.type === 'affine') acc = acc.mixedAdd(p);else acc = acc.add(p); + } + } // Zeroify references + + + for (i = 0; i < len; i++) { + wnd[i] = null; + } + + if (jacobianResult) return acc;else return acc.toP(); +}; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} + +BaseCurve.BasePoint = BasePoint; + +BasePoint.prototype.eq = function + /*other*/ +eq() { + throw new Error('Not implemented'); +}; + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + bytes = utils_1$1.toArray(bytes, enc); + var len = this.p.byteLength(); // uncompressed, hybrid-odd, hybrid-even + + if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && bytes.length - 1 === 2 * len) { + if (bytes[0] === 0x06) assert$1(bytes[bytes.length - 1] % 2 === 0);else if (bytes[0] === 0x07) assert$1(bytes[bytes.length - 1] % 2 === 1); + var res = this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len)); + return res; + } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); + } + + throw new Error('Unknown point format'); +}; + +BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); +}; + +BasePoint.prototype._encode = function _encode(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray('be', len); + if (compact) return [this.getY().isEven() ? 0x02 : 0x03].concat(x); + return [0x04].concat(x, this.getY().toArray('be', len)); +}; + +BasePoint.prototype.encode = function encode(enc, compact) { + return utils_1$1.encode(this._encode(compact), enc); +}; + +BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) return this; + var precomputed = { + doubles: null, + naf: null, + beta: null + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + return this; +}; + +BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) return false; + var doubles = this.precomputed.doubles; + if (!doubles) return false; + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles; + var doubles = [this]; + var acc = this; + + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) { + acc = acc.dbl(); + } + + doubles.push(acc); + } + + return { + step: step, + points: doubles + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) return this.precomputed.naf; + var res = [this]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + + for (var i = 1; i < max; i++) { + res[i] = res[i - 1].add(dbl); + } + + return { + wnd: wnd, + points: res + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + + for (var i = 0; i < k; i++) { + r = r.dbl(); + } + + return r; +}; + +var inherits_browser = createCommonjsModule(function (module) { + if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + } + }; + } else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + + var TempCtor = function TempCtor() {}; + + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } +}); +'use strict'; + +var assert$2 = utils_1$1.assert; + +function ShortCurve(conf) { + base.call(this, 'short', conf); + this.a = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(conf.a, 16).toRed(this.red); + this.b = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; // If the curve is endomorphic, precalculate beta and lambda + + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} + +inherits_browser(ShortCurve, base); +var short_1 = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) return; // Compute beta and lambda, that lambda * P = (beta * Px; Py) + + var beta; + var lambda; + + if (conf.beta) { + beta = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); // Choose the smallest beta + + + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + + if (conf.lambda) { + lambda = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert$2(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } // Get basis vectors, used for balanced length-two representation + + + var basis; + + if (conf.basis) { + basis = conf.basis.map(function (vec) { + return { + a: new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(vec.a, 16), + b: new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(vec.b, 16) + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : bn_js__WEBPACK_IMPORTED_MODULE_0___default.a.mont(num); + var tinv = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + var s = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(3).toRed(red).redNeg().redSqrt().redMul(tinv); + var l1 = ntinv.redAdd(s).fromRed(); + var l2 = ntinv.redSub(s).fromRed(); + return [l1, l2]; +}; + +ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + + var u = lambda; + var v = this.n.clone(); + var x1 = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(1); + var y1 = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(0); + var x2 = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(0); + var y2 = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(1); // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + + var a0; + var b0; // First vector + + var a1; + var b1; // Second vector + + var a2; + var b2; + var prevR; + var i = 0; + var r; + var x; + + while (u.cmpn(0) !== 0) { + var q = v.div(u); + r = v.sub(q.mul(u)); + x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + + prevR = r; + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + + a2 = r.neg(); + b2 = x; + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } // Normalize signs + + + if (a1.negative) { + a1 = a1.neg(); + b1 = b1.neg(); + } + + if (a2.negative) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [{ + a: a1, + b: b1 + }, { + a: a2, + b: b2 + }]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); // Calculate answer + + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { + k1: k1, + k2: k2 + }; +}; + +ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(x, 16); + if (!x.red) x = x.toRed(this.red); + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) throw new Error('invalid point'); // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) y = y.redNeg(); + return this.point(x, y); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) return true; + var x = point.x; + var y = point.y; + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, jacobianResult) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + + var p = points[i]; + + var beta = p._getBeta(); + + if (split.k1.negative) { + split.k1.ineg(); + p = p.neg(true); + } + + if (split.k2.negative) { + split.k2.ineg(); + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); // Clean-up references to points and coefficients + + + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + + return res; +}; + +function Point(curve, x, y, isRed) { + base.BasePoint.call(this, curve, 'affine'); + + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(x, 16); + this.y = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(y, 16); // Force redgomery representation when loading from JSON + + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + + if (!this.x.red) this.x = this.x.toRed(this.curve.red); + if (!this.y.red) this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} + +inherits_browser(Point, base.BasePoint); + +ShortCurve.prototype.point = function point(x, y, isRed) { + return new Point(this, x, y, isRed); +}; + +ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); +}; + +Point.prototype._getBeta = function _getBeta() { + if (!this.curve.endo) return; + var pre = this.precomputed; + if (pre && pre.beta) return pre.beta; + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + + if (pre) { + var curve = this.curve; + + var endoMul = function endoMul(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + }; + + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul) + } + }; + } + + return beta; +}; + +Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) return [this.x, this.y]; + return [this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1) + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1) + } + }]; +}; + +Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === 'string') obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) return res; + + function obj2point(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [res].concat(pre.doubles.points.map(obj2point)) + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [res].concat(pre.naf.points.map(obj2point)) + } + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) return p; // P + O = P + + if (p.inf) return this; // P + P = 2P + + if (this.eq(p)) return this.dbl(); // P + (-P) = O + + if (this.neg().eq(p)) return this.curve.point(null, null); // P + Q = O + + if (this.x.cmp(p.x) === 0) return this.curve.point(null, null); + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) return this; // 2P = O + + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) return this.curve.point(null, null); + var a = this.curve.a; + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(k, 16); + if (this.isInfinity()) return this;else if (this._hasDoubles(k)) return this.curve._fixedNafMul(this, k);else if (this.curve.endo) return this.curve._endoWnafMulAdd([this], [k]);else return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [this, p2]; + var coeffs = [k1, k2]; + if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs);else return this.curve._wnafMulAdd(1, points, coeffs, 2); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { + var points = [this, p2]; + var coeffs = [k1, k2]; + if (this.curve.endo) return this.curve._endoWnafMulAdd(points, coeffs, true);else return this.curve._wnafMulAdd(1, points, coeffs, 2, true); +}; + +Point.prototype.eq = function eq(p) { + return this === p || this.inf === p.inf && (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); +}; + +Point.prototype.neg = function neg(_precompute) { + if (this.inf) return this; + var res = this.curve.point(this.x, this.y.redNeg()); + + if (_precompute && this.precomputed) { + var pre = this.precomputed; + + var negate = function negate(p) { + return p.neg(); + }; + + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate) + } + }; + } + + return res; +}; + +Point.prototype.toJ = function toJ() { + if (this.inf) return this.curve.jpoint(null, null, null); + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; +}; + +function JPoint(curve, x, y, z) { + base.BasePoint.call(this, curve, 'jacobian'); + + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(0); + } else { + this.x = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(x, 16); + this.y = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(y, 16); + this.z = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(z, 16); + } + + if (!this.x.red) this.x = this.x.toRed(this.curve.red); + if (!this.y.red) this.y = this.y.toRed(this.curve.red); + if (!this.z.red) this.z = this.z.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; +} + +inherits_browser(JPoint, base.BasePoint); + +ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); +}; + +JPoint.prototype.toP = function toP() { + if (this.isInfinity()) return this.curve.point(null, null); + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + return this.curve.point(ax, ay); +}; + +JPoint.prototype.neg = function neg() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; + +JPoint.prototype.add = function add(p) { + // O + P = P + if (this.isInfinity()) return p; // P + O = P + + if (p.isInfinity()) return this; // 12M + 4S + 7A + + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + var h = u1.redSub(u2); + var r = s1.redSub(s2); + + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) return p.toJ(); // P + O = P + + if (p.isInfinity()) return this; // 8M + 3S + 7A + + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + var h = u1.redSub(u2); + var r = s1.redSub(s2); + + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) return this.curve.jpoint(null, null, null);else return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) return this; + if (this.isInfinity()) return this; + if (!pow) return this.dbl(); + var i; + + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + + for (i = 0; i < pow; i++) { + r = r.dbl(); + } + + return r; + } // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + + + var a = this.curve.a; + var tinv = this.curve.tinv; + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); // Reuse results + + var jyd = jy.redAdd(jy); + + for (i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) jz4 = jz4.redMul(jyd4); + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) return this; + if (this.curve.zeroA) return this._zeroDbl();else if (this.curve.threeA) return this._threeDbl();else return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + var nx; + var ny; + var nz; // Z = 1 + + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 14A + // XX = X1^2 + var xx = this.x.redSqr(); // YY = Y1^2 + + var yy = this.y.redSqr(); // YYYY = YY^2 + + var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY) + + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); // M = 3 * XX + a; a = 0 + + var m = xx.redAdd(xx).redIAdd(xx); // T = M ^ 2 - 2*S + + var t = m.redSqr().redISub(s).redISub(s); // 8 * YYYY + + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); // X3 = T + + nx = t; // Y3 = M * (S - T) - 8 * YYYY + + ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2*Y1 + + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-dbl-2009-l + // 2M + 5S + 13A + // A = X1^2 + var a = this.x.redSqr(); // B = Y1^2 + + var b = this.y.redSqr(); // C = B^2 + + var c = b.redSqr(); // D = 2 * ((X1 + B)^2 - A - C) + + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); // E = 3 * A + + var e = a.redAdd(a).redIAdd(a); // F = E^2 + + var f = e.redSqr(); // 8 * C + + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); // X3 = F - 2 * D + + nx = f.redISub(d).redISub(d); // Y3 = E * (D - X3) - 8 * C + + ny = e.redMul(d.redISub(nx)).redISub(c8); // Z3 = 2 * Y1 * Z1 + + nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + var nx; + var ny; + var nz; // Z = 1 + + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 15A + // XX = X1^2 + var xx = this.x.redSqr(); // YY = Y1^2 + + var yy = this.y.redSqr(); // YYYY = YY^2 + + var yyyy = yy.redSqr(); // S = 2 * ((X1 + YY)^2 - XX - YYYY) + + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); // M = 3 * XX + a + + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); // T = M^2 - 2 * S + + var t = m.redSqr().redISub(s).redISub(s); // X3 = T + + nx = t; // Y3 = M * (S - T) - 8 * YYYY + + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); // Z3 = 2 * Y1 + + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + // delta = Z1^2 + var delta = this.z.redSqr(); // gamma = Y1^2 + + var gamma = this.y.redSqr(); // beta = X1 * gamma + + var beta = this.x.redMul(gamma); // alpha = 3 * (X1 - delta) * (X1 + delta) + + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); // X3 = alpha^2 - 8 * beta + + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); // Z3 = (Y1 + Z1)^2 - gamma - delta + + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; // 4M + 6S + 10A + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) return this.dbl().add(this); // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + // XX = X1^2 + + var xx = this.x.redSqr(); // YY = Y1^2 + + var yy = this.y.redSqr(); // ZZ = Z1^2 + + var zz = this.z.redSqr(); // YYYY = YY^2 + + var yyyy = yy.redSqr(); // M = 3 * XX + a * ZZ2; a = 0 + + var m = xx.redAdd(xx).redIAdd(xx); // MM = M^2 + + var mm = m.redSqr(); // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); // EE = E^2 + + var ee = e.redSqr(); // T = 16*YYYY + + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); // U = (M + E)^2 - MM - EE - T + + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); // X3 = 4 * (X1 * EE - 4 * YY * U) + + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); // Z3 = (Z1 + E)^2 - ZZ - EE + + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(k, kbase); + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') return this.eq(p.toJ()); + if (this === p) return true; // x1 * z2^2 == x2 * z1^2 + + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) return false; // y1 * z2^3 == y2 * z1^3 + + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.eqXToP = function eqXToP(x) { + var zs = this.z.redSqr(); + var rx = x.toRed(this.curve.red).redMul(zs); + if (this.x.cmp(rx) === 0) return true; + var xc = x.clone(); + var t = this.curve.redN.redMul(zs); + + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) return false; + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) return true; + } +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +var curve_1 = createCommonjsModule(function (module, exports) { + 'use strict'; + + var curve = exports; + curve.base = base; + curve["short"] = short_1; + curve.mont = + /*RicMoo:ethers:require(./mont)*/ + null; + curve.edwards = + /*RicMoo:ethers:require(./edwards)*/ + null; +}); +var curves_1 = createCommonjsModule(function (module, exports) { + 'use strict'; + + var curves = exports; + var assert = utils_1$1.assert; + + function PresetCurve(options) { + if (options.type === 'short') this.curve = new curve_1["short"](options);else if (options.type === 'edwards') this.curve = new curve_1.edwards(options);else this.curve = new curve_1.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); + } + + curves.PresetCurve = PresetCurve; + + function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function get() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve + }); + return curve; + } + }); + } + + defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha256, + gRed: false, + g: ['188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'] + }); + defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha256, + gRed: false, + g: ['b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'] + }); + defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha256, + gRed: false, + g: ['6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'] + }); + defineCurve('p384', { + type: 'short', + prime: null, + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 ffffffff', + a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'fffffffe ffffffff 00000000 00000000 fffffffc', + b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', + n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha384, + gRed: false, + g: ['aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + '5502f25d bf55296c 3a545e38 72760ab7', '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'] + }); + defineCurve('p521', { + type: 'short', + prime: null, + p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff', + a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff ffffffff ffffffff fffffffc', + b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', + n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha512, + gRed: false, + g: ['000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + '3fad0761 353c7086 a272c240 88be9476 9fd16650'] + }); + defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '1', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha256, + gRed: false, + g: ['9'] + }); + defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha256, + gRed: false, + g: ['216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658'] + }); + var pre; + + try { + pre = + /*RicMoo:ethers:require(./precomputed/secp256k1)*/ + null.crash(); + } catch (e) { + pre = undefined; + } + + defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.sha256, + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [{ + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3' + }, { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15' + }], + gRed: false, + g: ['79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', pre] + }); +}); +'use strict'; + +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + this._reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + var entropy = utils_1.toArray(options.entropy, options.entropyEnc || 'hex'); + var nonce = utils_1.toArray(options.nonce, options.nonceEnc || 'hex'); + var pers = utils_1.toArray(options.pers, options.persEnc || 'hex'); + minimalisticAssert(entropy.length >= this.minEntropy / 8, 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._init(entropy, nonce, pers); +} + +var hmacDrbg = HmacDRBG; + +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + + this._reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +HmacDRBG.prototype._hmac = function hmac() { + return new hash_js__WEBPACK_IMPORTED_MODULE_1___default.a.hmac(this.hash, this.K); +}; + +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac().update(this.V).update([0x00]); + + if (seed) kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) return; + this.K = this._hmac().update(this.V).update([0x01]).update(seed).digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils_1.toArray(entropy, entropyEnc); + add = utils_1.toArray(add, addEnc); + minimalisticAssert(entropy.length >= this.minEntropy / 8, 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._update(entropy.concat(add || [])); + + this._reseed = 1; +}; + +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this._reseed > this.reseedInterval) throw new Error('Reseed is required'); // Optional encoding + + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } // Optional additional data + + + if (add) { + add = utils_1.toArray(add, addEnc || 'hex'); + + this._update(add); + } + + var temp = []; + + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + + this._update(add); + + this._reseed++; + return utils_1.encode(res, enc); +}; + +'use strict'; + +var assert$3 = utils_1$1.assert; + +function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; // KeyPair(ec, { priv: ..., pub: ... }) + + if (options.priv) this._importPrivate(options.priv, options.privEnc); + if (options.pub) this._importPublic(options.pub, options.pubEnc); +} + +var key = KeyPair; + +KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) return pub; + return new KeyPair(ec, { + pub: pub, + pubEnc: enc + }); +}; + +KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) return priv; + return new KeyPair(ec, { + priv: priv, + privEnc: enc + }); +}; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + if (pub.isInfinity()) return { + result: false, + reason: 'Invalid public key' + }; + if (!pub.validate()) return { + result: false, + reason: 'Public key is not a point' + }; + if (!pub.mul(this.ec.curve.n).isInfinity()) return { + result: false, + reason: 'Public key * N != O' + }; + return { + result: true, + reason: null + }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!this.pub) this.pub = this.ec.g.mul(this.priv); + if (!enc) return this.pub; + return this.pub.encode(enc, compact); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') return this.priv.toString(16, 2);else return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { + this.priv = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(key, enc || 16); // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + + this.priv = this.priv.umod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + // Montgomery points only have an `x` coordinate. + // Weierstrass/Edwards points on the other hand have both `x` and + // `y` coordinates. + if (this.ec.curve.type === 'mont') { + assert$3(key.x, 'Need x coordinate'); + } else if (this.ec.curve.type === 'short' || this.ec.curve.type === 'edwards') { + assert$3(key.x && key.y, 'Need both x and y coordinate'); + } + + this.pub = this.ec.curve.point(key.x, key.y); + return; + } + + this.pub = this.ec.curve.decodePoint(key, enc); +}; // ECDH + + +KeyPair.prototype.derive = function derive(pub) { + if (!pub.validate()) { + assert$3(pub.validate(), 'public point not validated'); + } + + return pub.mul(this.priv).getX(); +}; // ECDSA + + +KeyPair.prototype.sign = function sign(msg, enc, options) { + return this.ec.sign(msg, this, enc, options); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; + +'use strict'; + +var assert$4 = utils_1$1.assert; + +function Signature(options, enc) { + if (options instanceof Signature) return options; + if (this._importDER(options, enc)) return; + assert$4(options.r && options.s, 'Signature without r or s'); + this.r = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(options.r, 16); + this.s = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(options.s, 16); + if (options.recoveryParam === undefined) this.recoveryParam = null;else this.recoveryParam = options.recoveryParam; +} + +var signature = Signature; + +function Position() { + this.place = 0; +} + +function getLength(buf, p) { + var initial = buf[p.place++]; + + if (!(initial & 0x80)) { + return initial; + } + + var octetLen = initial & 0xf; // Indefinite length or overflow + + if (octetLen === 0 || octetLen > 4) { + return false; + } + + var val = 0; + + for (var i = 0, off = p.place; i < octetLen; i++, off++) { + val <<= 8; + val |= buf[off]; + val >>>= 0; + } // Leading zeroes + + + if (val <= 0x7f) { + return false; + } + + p.place = off; + return val; +} + +function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + + while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { + i++; + } + + if (i === 0) { + return buf; + } + + return buf.slice(i); +} + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils_1$1.toArray(data, enc); + var p = new Position(); + + if (data[p.place++] !== 0x30) { + return false; + } + + var len = getLength(data, p); + + if (len === false) { + return false; + } + + if (len + p.place !== data.length) { + return false; + } + + if (data[p.place++] !== 0x02) { + return false; + } + + var rlen = getLength(data, p); + + if (rlen === false) { + return false; + } + + var r = data.slice(p.place, rlen + p.place); + p.place += rlen; + + if (data[p.place++] !== 0x02) { + return false; + } + + var slen = getLength(data, p); + + if (slen === false) { + return false; + } + + if (data.length !== slen + p.place) { + return false; + } + + var s = data.slice(p.place, slen + p.place); + + if (r[0] === 0) { + if (r[1] & 0x80) { + r = r.slice(1); + } else { + // Leading zeroes + return false; + } + } + + if (s[0] === 0) { + if (s[1] & 0x80) { + s = s.slice(1); + } else { + // Leading zeroes + return false; + } + } + + this.r = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(r); + this.s = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(s); + this.recoveryParam = null; + return true; +}; + +function constructLength(arr, len) { + if (len < 0x80) { + arr.push(len); + return; + } + + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 0x80); + + while (--octets) { + arr.push(len >>> (octets << 3) & 0xff); + } + + arr.push(len); +} + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); // Pad values + + if (r[0] & 0x80) r = [0].concat(r); // Pad values + + if (s[0] & 0x80) s = [0].concat(s); + r = rmPadding(r); + s = rmPadding(s); + + while (!s[0] && !(s[1] & 0x80)) { + s = s.slice(1); + } + + var arr = [0x02]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(0x02); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [0x30]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils_1$1.encode(res, enc); +}; + +'use strict'; + +var rand = +/*RicMoo:ethers:require(brorand)*/ +function rand() { + throw new Error('unsupported'); +}; + +var assert$5 = utils_1$1.assert; + +function EC(options) { + if (!(this instanceof EC)) return new EC(options); // Shortcut `elliptic.ec(curve-name)` + + if (typeof options === 'string') { + assert$5(Object.prototype.hasOwnProperty.call(curves_1, options), 'Unknown curve ' + options); + options = curves_1[options]; + } // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + + + if (options instanceof curves_1.PresetCurve) options = { + curve: options + }; + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.ushrn(1); + this.g = this.curve.g; // Point on curve + + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); // Hash for function for DRBG + + this.hash = options.hash || options.curve.hash; +} + +var ec = EC; + +EC.prototype.keyPair = function keyPair(options) { + return new key(this, options); +}; + +EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return key.fromPrivate(this, priv, enc); +}; + +EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return key.fromPublic(this, pub, enc); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) options = {}; // Instantiate Hmac_DRBG + + var drbg = new hmacDrbg({ + hash: this.hash, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + entropy: options.entropy || rand(this.hash.hmacStrength), + entropyEnc: options.entropy && options.entropyEnc || 'utf8', + nonce: this.n.toArray() + }); + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(2)); + + for (;;) { + var priv = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) continue; + priv.iaddn(1); + return this.keyFromPrivate(priv); + } +}; + +EC.prototype._truncateToN = function _truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) msg = msg.ushrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) return msg.sub(this.n);else return msg; +}; + +EC.prototype.sign = function sign(msg, key, enc, options) { + if (_typeof(enc) === 'object') { + options = enc; + enc = null; + } + + if (!options) options = {}; + key = this.keyFromPrivate(key, enc); + msg = this._truncateToN(new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(msg, 16)); // Zero-extend key to provide enough entropy + + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray('be', bytes); // Zero-extend nonce to have the same byte size as N + + var nonce = msg.toArray('be', bytes); // Instantiate Hmac_DRBG + + var drbg = new hmacDrbg({ + hash: this.hash, + entropy: bkey, + nonce: nonce, + pers: options.pers, + persEnc: options.persEnc || 'utf8' + }); // Number of bytes to generate + + var ns1 = this.n.sub(new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(1)); + + for (var iter = 0;; iter++) { + var k = options.k ? options.k(iter) : new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) continue; + var kp = this.g.mul(k); + if (kp.isInfinity()) continue; + var kpX = kp.getX(); + var r = kpX.umod(this.n); + if (r.cmpn(0) === 0) continue; + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); + s = s.umod(this.n); + if (s.cmpn(0) === 0) continue; + var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | (kpX.cmp(r) !== 0 ? 2 : 0); // Use complement of `s`, if it is > `n / 2` + + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + + return new signature({ + r: r, + s: s, + recoveryParam: recoveryParam + }); + } +}; + +EC.prototype.verify = function verify(msg, signature$1, key, enc) { + msg = this._truncateToN(new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(msg, 16)); + key = this.keyFromPublic(key, enc); + signature$1 = new signature(signature$1, 'hex'); // Perform primitive values validation + + var r = signature$1.r; + var s = signature$1.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) return false; // Validate signature + + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r).umod(this.n); + var p; + + if (!this.curve._maxwellTrick) { + p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) return false; + return p.getX().umod(this.n).cmp(r) === 0; + } // NOTE: Greg Maxwell's trick, inspired by: + // https://git.io/vad3K + + + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) return false; // Compare `p.x` of Jacobian point with `r`, + // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the + // inverse of `p.z^2` + + return p.eqXToP(r); +}; + +EC.prototype.recoverPubKey = function (msg, signature$1, j, enc) { + assert$5((3 & j) === j, 'The recovery param is more than two bits'); + signature$1 = new signature(signature$1, enc); + var n = this.n; + var e = new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(msg); + var r = signature$1.r; + var s = signature$1.s; // A set LSB signifies that the y-coordinate is odd + + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) throw new Error('Unable to find sencond key candinate'); // 1.1. Let x = r + jn. + + if (isSecondKey) r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);else r = this.curve.pointFromX(r, isYOdd); + var rInv = signature$1.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); // 1.6.1 Compute Q = r^-1 (sR - eG) + // Q = r^-1 (sR + -eG) + + return this.g.mulAdd(s1, r, s2); +}; + +EC.prototype.getKeyRecoveryParam = function (e, signature$1, Q, enc) { + signature$1 = new signature(signature$1, enc); + if (signature$1.recoveryParam !== null) return signature$1.recoveryParam; + + for (var i = 0; i < 4; i++) { + var Qprime; + + try { + Qprime = this.recoverPubKey(e, signature$1, i); + } catch (e) { + continue; + } + + if (Qprime.eq(Q)) return i; + } + + throw new Error('Unable to find valid recovery factor'); +}; + +var elliptic_1 = createCommonjsModule(function (module, exports) { + 'use strict'; + + var elliptic = exports; + elliptic.version = + /*RicMoo:ethers*/ + { + version: "6.5.4" + }.version; + elliptic.utils = utils_1$1; + + elliptic.rand = + /*RicMoo:ethers:require(brorand)*/ + function () { + throw new Error('unsupported'); + }; + + elliptic.curve = curve_1; + elliptic.curves = curves_1; // Protocols + + elliptic.ec = ec; + elliptic.eddsa = + /*RicMoo:ethers:require(./elliptic/eddsa)*/ + null; +}); +var EC$1 = elliptic_1.ec; + +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/@ethersproject/signing-key/lib.esm/index.js": +/*!******************************************************************!*\ + !*** ./node_modules/@ethersproject/signing-key/lib.esm/index.js ***! + \******************************************************************/ +/*! exports provided: SigningKey, recoverPublicKey, computePublicKey */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SigningKey", function() { return SigningKey; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recoverPublicKey", function() { return recoverPublicKey; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computePublicKey", function() { return computePublicKey; }); +/* harmony import */ var _elliptic__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./elliptic */ "./node_modules/@ethersproject/signing-key/lib.esm/elliptic.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/signing-key/lib.esm/_version.js"); + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_3__["Logger"](_version__WEBPACK_IMPORTED_MODULE_4__["version"]); +var _curve = null; + +function getCurve() { + if (!_curve) { + _curve = new _elliptic__WEBPACK_IMPORTED_MODULE_0__["EC"]("secp256k1"); + } + + return _curve; +} + +var SigningKey = /*#__PURE__*/function () { + function SigningKey(privateKey) { + _classCallCheck(this, SigningKey); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "curve", "secp256k1"); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "privateKey", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(privateKey)); + var keyPair = getCurve().keyFromPrivate(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(this.privateKey)); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["defineReadOnly"])(this, "_isSigningKey", true); + } + + _createClass(SigningKey, [{ + key: "_addPoint", + value: function _addPoint(other) { + var p0 = getCurve().keyFromPublic(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(this.publicKey)); + var p1 = getCurve().keyFromPublic(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(other)); + return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex"); + } + }, { + key: "signDigest", + value: function signDigest(digest) { + var keyPair = getCurve().keyFromPrivate(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(this.privateKey)); + var digestBytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(digest); + + if (digestBytes.length !== 32) { + logger.throwArgumentError("bad digest length", "digest", digest); + } + + var signature = keyPair.sign(digestBytes, { + canonical: true + }); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["splitSignature"])({ + recoveryParam: signature.recoveryParam, + r: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexZeroPad"])("0x" + signature.r.toString(16), 32), + s: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexZeroPad"])("0x" + signature.s.toString(16), 32) + }); + } + }, { + key: "computeSharedSecret", + value: function computeSharedSecret(otherKey) { + var keyPair = getCurve().keyFromPrivate(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(this.privateKey)); + var otherKeyPair = getCurve().keyFromPublic(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(computePublicKey(otherKey))); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexZeroPad"])("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32); + } + }], [{ + key: "isSigningKey", + value: function isSigningKey(value) { + return !!(value && value._isSigningKey); + } + }]); + + return SigningKey; +}(); +function recoverPublicKey(digest, signature) { + var sig = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["splitSignature"])(signature); + var rs = { + r: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(sig.r), + s: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(sig.s) + }; + return "0x" + getCurve().recoverPubKey(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(digest), rs, sig.recoveryParam).encode("hex", false); +} +function computePublicKey(key, compressed) { + var bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(key); + + if (bytes.length === 32) { + var signingKey = new SigningKey(bytes); + + if (compressed) { + return "0x" + getCurve().keyFromPrivate(bytes).getPublic(true, "hex"); + } + + return signingKey.publicKey; + } else if (bytes.length === 33) { + if (compressed) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(bytes); + } + + return "0x" + getCurve().keyFromPublic(bytes).getPublic(false, "hex"); + } else if (bytes.length === 65) { + if (!compressed) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(bytes); + } + + return "0x" + getCurve().keyFromPublic(bytes).getPublic(true, "hex"); + } + + return logger.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/solidity/lib.esm/_version.js": +/*!******************************************************************!*\ + !*** ./node_modules/@ethersproject/solidity/lib.esm/_version.js ***! + \******************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "solidity/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/solidity/lib.esm/index.js": +/*!***************************************************************!*\ + !*** ./node_modules/@ethersproject/solidity/lib.esm/index.js ***! + \***************************************************************/ +/*! exports provided: pack, keccak256, sha256 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pack", function() { return pack; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keccak256", function() { return keccak256; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sha256", function() { return sha256; }); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/solidity/lib.esm/_version.js"); + + + + + + + +var regexBytes = new RegExp("^bytes([0-9]+)$"); +var regexNumber = new RegExp("^(u?int)([0-9]*)$"); +var regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); +var Zeros = "0000000000000000000000000000000000000000000000000000000000000000"; + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_5__["Logger"](_version__WEBPACK_IMPORTED_MODULE_6__["version"]); + +function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["zeroPad"])(value, 32); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(value); + + case "string": + return Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_4__["toUtf8Bytes"])(value); + + case "bytes": + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(value); + + case "bool": + value = value ? "0x01" : "0x00"; + + if (isArray) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["zeroPad"])(value, 32); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(value); + } + + var match = type.match(regexNumber); + + if (match) { + //let signed = (match[1] === "int") + var size = parseInt(match[2] || "256"); + + if (match[2] && String(size) !== match[2] || size % 8 !== 0 || size === 0 || size > 256) { + logger.throwArgumentError("invalid number type", "type", type); + } + + if (isArray) { + size = 256; + } + + value = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["BigNumber"].from(value).toTwos(size); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["zeroPad"])(value, size / 8); + } + + match = type.match(regexBytes); + + if (match) { + var _size = parseInt(match[1]); + + if (String(_size) !== match[1] || _size === 0 || _size > 32) { + logger.throwArgumentError("invalid bytes type", "type", type); + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(value).byteLength !== _size) { + logger.throwArgumentError("invalid value for ".concat(type), "value", value); + } + + if (isArray) { + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])((value + Zeros).substring(0, 66)); + } + + return value; + } + + match = type.match(regexArray); + + if (match && Array.isArray(value)) { + var baseType = match[1]; + var count = parseInt(match[2] || String(value.length)); + + if (count != value.length) { + logger.throwArgumentError("invalid array length for ".concat(type), "value", value); + } + + var result = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["concat"])(result); + } + + return logger.throwArgumentError("invalid type", "type", type); +} // @TODO: Array Enum + + +function pack(types, values) { + if (types.length != values.length) { + logger.throwArgumentError("wrong number of values; expected ${ types.length }", "values", values); + } + + var tight = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["concat"])(tight)); +} +function keccak256(types, values) { + return Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_2__["keccak256"])(pack(types, values)); +} +function sha256(types, values) { + return Object(_ethersproject_sha2__WEBPACK_IMPORTED_MODULE_3__["sha256"])(pack(types, values)); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/strings/lib.esm/_version.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@ethersproject/strings/lib.esm/_version.js ***! + \*****************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "strings/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/strings/lib.esm/bytes32.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/strings/lib.esm/bytes32.js ***! + \****************************************************************/ +/*! exports provided: formatBytes32String, parseBytes32String */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatBytes32String", function() { return formatBytes32String; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseBytes32String", function() { return parseBytes32String; }); +/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _utf8__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utf8 */ "./node_modules/@ethersproject/strings/lib.esm/utf8.js"); + + + + + +function formatBytes32String(text) { + // Get the bytes + var bytes = Object(_utf8__WEBPACK_IMPORTED_MODULE_2__["toUtf8Bytes"])(text); // Check we have room for null-termination + + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } // Zero-pad (implicitly null-terminates) + + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["concat"])([bytes, _ethersproject_constants__WEBPACK_IMPORTED_MODULE_0__["HashZero"]]).slice(0, 32)); +} +function parseBytes32String(bytes) { + var data = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["arrayify"])(bytes); // Must be 32 bytes with a null-termination + + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } // Find the null termination + + + var length = 31; + + while (data[length - 1] === 0) { + length--; + } // Determine the string value + + + return Object(_utf8__WEBPACK_IMPORTED_MODULE_2__["toUtf8String"])(data.slice(0, length)); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/strings/lib.esm/idna.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/strings/lib.esm/idna.js ***! + \*************************************************************/ +/*! exports provided: _nameprepTableA1, _nameprepTableB2, _nameprepTableC, nameprep */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nameprepTableA1", function() { return _nameprepTableA1; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nameprepTableB2", function() { return _nameprepTableB2; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_nameprepTableC", function() { return _nameprepTableC; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "nameprep", function() { return nameprep; }); +/* harmony import */ var _utf8__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utf8 */ "./node_modules/@ethersproject/strings/lib.esm/utf8.js"); + + + + +function bytes2(data) { + if (data.length % 4 !== 0) { + throw new Error("bad data"); + } + + var result = []; + + for (var i = 0; i < data.length; i += 4) { + result.push(parseInt(data.substring(i, i + 4), 16)); + } + + return result; +} + +function createTable(data, func) { + if (!func) { + func = function func(value) { + return [parseInt(value, 16)]; + }; + } + + var lo = 0; + var result = {}; + data.split(",").forEach(function (pair) { + var comps = pair.split(":"); + lo += parseInt(comps[0], 16); + result[lo] = func(comps[1]); + }); + return result; +} + +function createRangeTable(data) { + var hi = 0; + return data.split(",").map(function (v) { + var comps = v.split("-"); + + if (comps.length === 1) { + comps[1] = "0"; + } else if (comps[1] === "") { + comps[1] = "1"; + } + + var lo = hi + parseInt(comps[0], 16); + hi = parseInt(comps[1], 16); + return { + l: lo, + h: hi + }; + }); +} + +function matchMap(value, ranges) { + var lo = 0; + + for (var i = 0; i < ranges.length; i++) { + var range = ranges[i]; + lo += range.l; + + if (value >= lo && value <= lo + range.h && (value - lo) % (range.d || 1) === 0) { + if (range.e && range.e.indexOf(value - lo) !== -1) { + continue; + } + + return range; + } + } + + return null; +} + +var Table_A_1_ranges = createRangeTable("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"); // @TODO: Make this relative... + +var Table_B_1_flags = "ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(function (v) { + return parseInt(v, 16); +}); +var Table_B_2_ranges = [{ + h: 25, + s: 32, + l: 65 +}, { + h: 30, + s: 32, + e: [23], + l: 127 +}, { + h: 54, + s: 1, + e: [48], + l: 64, + d: 2 +}, { + h: 14, + s: 1, + l: 57, + d: 2 +}, { + h: 44, + s: 1, + l: 17, + d: 2 +}, { + h: 10, + s: 1, + e: [2, 6, 8], + l: 61, + d: 2 +}, { + h: 16, + s: 1, + l: 68, + d: 2 +}, { + h: 84, + s: 1, + e: [18, 24, 66], + l: 19, + d: 2 +}, { + h: 26, + s: 32, + e: [17], + l: 435 +}, { + h: 22, + s: 1, + l: 71, + d: 2 +}, { + h: 15, + s: 80, + l: 40 +}, { + h: 31, + s: 32, + l: 16 +}, { + h: 32, + s: 1, + l: 80, + d: 2 +}, { + h: 52, + s: 1, + l: 42, + d: 2 +}, { + h: 12, + s: 1, + l: 55, + d: 2 +}, { + h: 40, + s: 1, + e: [38], + l: 15, + d: 2 +}, { + h: 14, + s: 1, + l: 48, + d: 2 +}, { + h: 37, + s: 48, + l: 49 +}, { + h: 148, + s: 1, + l: 6351, + d: 2 +}, { + h: 88, + s: 1, + l: 160, + d: 2 +}, { + h: 15, + s: 16, + l: 704 +}, { + h: 25, + s: 26, + l: 854 +}, { + h: 25, + s: 32, + l: 55915 +}, { + h: 37, + s: 40, + l: 1247 +}, { + h: 25, + s: -119711, + l: 53248 +}, { + h: 25, + s: -119763, + l: 52 +}, { + h: 25, + s: -119815, + l: 52 +}, { + h: 25, + s: -119867, + e: [1, 4, 5, 7, 8, 11, 12, 17], + l: 52 +}, { + h: 25, + s: -119919, + l: 52 +}, { + h: 24, + s: -119971, + e: [2, 7, 8, 17], + l: 52 +}, { + h: 24, + s: -120023, + e: [2, 7, 13, 15, 16, 17], + l: 52 +}, { + h: 25, + s: -120075, + l: 52 +}, { + h: 25, + s: -120127, + l: 52 +}, { + h: 25, + s: -120179, + l: 52 +}, { + h: 25, + s: -120231, + l: 52 +}, { + h: 25, + s: -120283, + l: 52 +}, { + h: 25, + s: -120335, + l: 52 +}, { + h: 24, + s: -119543, + e: [17], + l: 56 +}, { + h: 24, + s: -119601, + e: [17], + l: 58 +}, { + h: 24, + s: -119659, + e: [17], + l: 58 +}, { + h: 24, + s: -119717, + e: [17], + l: 58 +}, { + h: 24, + s: -119775, + e: [17], + l: 58 +}]; +var Table_B_2_lut_abs = createTable("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"); +var Table_B_2_lut_rel = createTable("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"); +var Table_B_2_complex = createTable("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D", bytes2); +var Table_C_ranges = createRangeTable("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001"); + +function flatten(values) { + return values.reduce(function (accum, value) { + value.forEach(function (value) { + accum.push(value); + }); + return accum; + }, []); +} + +function _nameprepTableA1(codepoint) { + return !!matchMap(codepoint, Table_A_1_ranges); +} +function _nameprepTableB2(codepoint) { + var range = matchMap(codepoint, Table_B_2_ranges); + + if (range) { + return [codepoint + range.s]; + } + + var codes = Table_B_2_lut_abs[codepoint]; + + if (codes) { + return codes; + } + + var shift = Table_B_2_lut_rel[codepoint]; + + if (shift) { + return [codepoint + shift[0]]; + } + + var complex = Table_B_2_complex[codepoint]; + + if (complex) { + return complex; + } + + return null; +} +function _nameprepTableC(codepoint) { + return !!matchMap(codepoint, Table_C_ranges); +} +function nameprep(value) { + // This allows platforms with incomplete normalize to bypass + // it for very basic names which the built-in toLowerCase + // will certainly handle correctly + if (value.match(/^[a-z0-9-]*$/i) && value.length <= 59) { + return value.toLowerCase(); + } // Get the code points (keeping the current normalization) + + + var codes = Object(_utf8__WEBPACK_IMPORTED_MODULE_0__["toUtf8CodePoints"])(value); + codes = flatten(codes.map(function (code) { + // Substitute Table B.1 (Maps to Nothing) + if (Table_B_1_flags.indexOf(code) >= 0) { + return []; + } + + if (code >= 0xfe00 && code <= 0xfe0f) { + return []; + } // Substitute Table B.2 (Case Folding) + + + var codesTableB2 = _nameprepTableB2(code); + + if (codesTableB2) { + return codesTableB2; + } // No Substitution + + + return [code]; + })); // Normalize using form KC + + codes = Object(_utf8__WEBPACK_IMPORTED_MODULE_0__["toUtf8CodePoints"])(Object(_utf8__WEBPACK_IMPORTED_MODULE_0__["_toUtf8String"])(codes), _utf8__WEBPACK_IMPORTED_MODULE_0__["UnicodeNormalizationForm"].NFKC); // Prohibit Tables C.1.2, C.2.2, C.3, C.4, C.5, C.6, C.7, C.8, C.9 + + codes.forEach(function (code) { + if (_nameprepTableC(code)) { + throw new Error("STRINGPREP_CONTAINS_PROHIBITED"); + } + }); // Prohibit Unassigned Code Points (Table A.1) + + codes.forEach(function (code) { + if (_nameprepTableA1(code)) { + throw new Error("STRINGPREP_CONTAINS_UNASSIGNED"); + } + }); // IDNA extras + + var name = Object(_utf8__WEBPACK_IMPORTED_MODULE_0__["_toUtf8String"])(codes); // IDNA: 4.2.3.1 + + + if (name.substring(0, 1) === "-" || name.substring(2, 4) === "--" || name.substring(name.length - 1) === "-") { + throw new Error("invalid hyphen"); + } // IDNA: 4.2.4 + + + if (name.length > 63) { + throw new Error("too long"); + } + + return name; +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/strings/lib.esm/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@ethersproject/strings/lib.esm/index.js ***! + \**************************************************************/ +/*! exports provided: _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, Utf8ErrorReason, UnicodeNormalizationForm, formatBytes32String, parseBytes32String, nameprep */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _bytes32__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./bytes32 */ "./node_modules/@ethersproject/strings/lib.esm/bytes32.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatBytes32String", function() { return _bytes32__WEBPACK_IMPORTED_MODULE_0__["formatBytes32String"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseBytes32String", function() { return _bytes32__WEBPACK_IMPORTED_MODULE_0__["parseBytes32String"]; }); + +/* harmony import */ var _idna__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./idna */ "./node_modules/@ethersproject/strings/lib.esm/idna.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "nameprep", function() { return _idna__WEBPACK_IMPORTED_MODULE_1__["nameprep"]; }); + +/* harmony import */ var _utf8__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utf8 */ "./node_modules/@ethersproject/strings/lib.esm/utf8.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_toEscapedUtf8String", function() { return _utf8__WEBPACK_IMPORTED_MODULE_2__["_toEscapedUtf8String"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toUtf8Bytes", function() { return _utf8__WEBPACK_IMPORTED_MODULE_2__["toUtf8Bytes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toUtf8CodePoints", function() { return _utf8__WEBPACK_IMPORTED_MODULE_2__["toUtf8CodePoints"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toUtf8String", function() { return _utf8__WEBPACK_IMPORTED_MODULE_2__["toUtf8String"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Utf8ErrorFuncs", function() { return _utf8__WEBPACK_IMPORTED_MODULE_2__["Utf8ErrorFuncs"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Utf8ErrorReason", function() { return _utf8__WEBPACK_IMPORTED_MODULE_2__["Utf8ErrorReason"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnicodeNormalizationForm", function() { return _utf8__WEBPACK_IMPORTED_MODULE_2__["UnicodeNormalizationForm"]; }); + + + + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/strings/lib.esm/utf8.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/strings/lib.esm/utf8.js ***! + \*************************************************************/ +/*! exports provided: UnicodeNormalizationForm, Utf8ErrorReason, Utf8ErrorFuncs, toUtf8Bytes, _toEscapedUtf8String, _toUtf8String, toUtf8String, toUtf8CodePoints */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnicodeNormalizationForm", function() { return UnicodeNormalizationForm; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Utf8ErrorReason", function() { return Utf8ErrorReason; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Utf8ErrorFuncs", function() { return Utf8ErrorFuncs; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUtf8Bytes", function() { return toUtf8Bytes; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_toEscapedUtf8String", function() { return _toEscapedUtf8String; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_toUtf8String", function() { return _toUtf8String; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUtf8String", function() { return toUtf8String; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toUtf8CodePoints", function() { return toUtf8CodePoints; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/strings/lib.esm/_version.js"); + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); /////////////////////////////// + +var UnicodeNormalizationForm; + +(function (UnicodeNormalizationForm) { + UnicodeNormalizationForm["current"] = ""; + UnicodeNormalizationForm["NFC"] = "NFC"; + UnicodeNormalizationForm["NFD"] = "NFD"; + UnicodeNormalizationForm["NFKC"] = "NFKC"; + UnicodeNormalizationForm["NFKD"] = "NFKD"; +})(UnicodeNormalizationForm || (UnicodeNormalizationForm = {})); + +; +var Utf8ErrorReason; + +(function (Utf8ErrorReason) { + // A continuation byte was present where there was nothing to continue + // - offset = the index the codepoint began in + Utf8ErrorReason["UNEXPECTED_CONTINUE"] = "unexpected continuation byte"; // An invalid (non-continuation) byte to start a UTF-8 codepoint was found + // - offset = the index the codepoint began in + + Utf8ErrorReason["BAD_PREFIX"] = "bad codepoint prefix"; // The string is too short to process the expected codepoint + // - offset = the index the codepoint began in + + Utf8ErrorReason["OVERRUN"] = "string overrun"; // A missing continuation byte was expected but not found + // - offset = the index the continuation byte was expected at + + Utf8ErrorReason["MISSING_CONTINUE"] = "missing continuation byte"; // The computed code point is outside the range for UTF-8 + // - offset = start of this codepoint + // - badCodepoint = the computed codepoint; outside the UTF-8 range + + Utf8ErrorReason["OUT_OF_RANGE"] = "out of UTF-8 range"; // UTF-8 strings may not contain UTF-16 surrogate pairs + // - offset = start of this codepoint + // - badCodepoint = the computed codepoint; inside the UTF-16 surrogate range + + Utf8ErrorReason["UTF16_SURROGATE"] = "UTF-16 surrogate"; // The string is an overlong representation + // - offset = start of this codepoint + // - badCodepoint = the computed codepoint; already bounds checked + + Utf8ErrorReason["OVERLONG"] = "overlong representation"; +})(Utf8ErrorReason || (Utf8ErrorReason = {})); + +; + +function errorFunc(reason, offset, bytes, output, badCodepoint) { + return logger.throwArgumentError("invalid codepoint at offset ".concat(offset, "; ").concat(reason), "bytes", bytes); +} + +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) { + var i = 0; + + for (var o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + + i++; + } + + return i; + } // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + + + if (reason === Utf8ErrorReason.OVERRUN) { + return bytes.length - offset - 1; + } // Nothing to skip + + + return 0; +} + +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === Utf8ErrorReason.OVERLONG) { + output.push(badCodepoint); + return 0; + } // Put the replacement character into the output + + + output.push(0xfffd); // Otherwise, process as if ignoring errors + + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} // Common error handing strategies + + +var Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); // http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 + +function getUtf8CodePoints(bytes, onError) { + if (onError == null) { + onError = Utf8ErrorFuncs.error; + } + + bytes = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(bytes); + var result = []; + var i = 0; // Invalid bytes are ignored + + while (i < bytes.length) { + var c = bytes[i++]; // 0xxx xxxx + + if (c >> 7 === 0) { + result.push(c); + continue; + } // Multibyte; how many bytes left for this character? + + + var extraLength = null; + var overlongMask = null; // 110x xxxx 10xx xxxx + + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; // 1110 xxxx 10xx xxxx 10xx xxxx + } else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } else { + if ((c & 0xc0) === 0x80) { + i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result); + } else { + i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result); + } + + continue; + } // Do we have enough bytes in our data? + + + if (i - 1 + extraLength >= bytes.length) { + i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result); + continue; + } // Remove the length prefix from the char + + + var res = c & (1 << 8 - extraLength - 1) - 1; + + for (var j = 0; j < extraLength; j++) { + var nextChar = bytes[i]; // Invalid continuation byte + + if ((nextChar & 0xc0) != 0x80) { + i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result); + res = null; + break; + } + + ; + res = res << 6 | nextChar & 0x3f; + i++; + } // See above loop for invalid continuation byte + + + if (res === null) { + continue; + } // Maximum code point + + + if (res > 0x10ffff) { + i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res); + continue; + } // Reserved for UTF-16 surrogate halves + + + if (res >= 0xd800 && res <= 0xdfff) { + i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res); + continue; + } // Check for overlong sequences (more bytes than needed) + + + if (res <= overlongMask) { + i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res); + continue; + } + + result.push(res); + } + + return result; +} // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array + + +function toUtf8Bytes(str) { + var form = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : UnicodeNormalizationForm.current; + + if (form != UnicodeNormalizationForm.current) { + logger.checkNormalize(); + str = str.normalize(form); + } + + var result = []; + + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + + if (c < 0x80) { + result.push(c); + } else if (c < 0x800) { + result.push(c >> 6 | 0xc0); + result.push(c & 0x3f | 0x80); + } else if ((c & 0xfc00) == 0xd800) { + i++; + var c2 = str.charCodeAt(i); + + if (i >= str.length || (c2 & 0xfc00) !== 0xdc00) { + throw new Error("invalid utf-8 string"); + } // Surrogate Pair + + + var pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push(pair >> 18 | 0xf0); + result.push(pair >> 12 & 0x3f | 0x80); + result.push(pair >> 6 & 0x3f | 0x80); + result.push(pair & 0x3f | 0x80); + } else { + result.push(c >> 12 | 0xe0); + result.push(c >> 6 & 0x3f | 0x80); + result.push(c & 0x3f | 0x80); + } + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(result); +} +; + +function escapeChar(value) { + var hex = "0000" + value.toString(16); + return "\\u" + hex.substring(hex.length - 4); +} + +function _toEscapedUtf8String(bytes, onError) { + return '"' + getUtf8CodePoints(bytes, onError).map(function (codePoint) { + if (codePoint < 256) { + switch (codePoint) { + case 8: + return "\\b"; + + case 9: + return "\\t"; + + case 10: + return "\\n"; + + case 13: + return "\\r"; + + case 34: + return "\\\""; + + case 92: + return "\\\\"; + } + + if (codePoint >= 32 && codePoint < 127) { + return String.fromCharCode(codePoint); + } + } + + if (codePoint <= 0xffff) { + return escapeChar(codePoint); + } + + codePoint -= 0x10000; + return escapeChar((codePoint >> 10 & 0x3ff) + 0xd800) + escapeChar((codePoint & 0x3ff) + 0xdc00); + }).join("") + '"'; +} +function _toUtf8String(codePoints) { + return codePoints.map(function (codePoint) { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + + codePoint -= 0x10000; + return String.fromCharCode((codePoint >> 10 & 0x3ff) + 0xd800, (codePoint & 0x3ff) + 0xdc00); + }).join(""); +} +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +function toUtf8CodePoints(str) { + var form = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : UnicodeNormalizationForm.current; + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/transactions/lib.esm/_version.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@ethersproject/transactions/lib.esm/_version.js ***! + \**********************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "transactions/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/transactions/lib.esm/index.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/transactions/lib.esm/index.js ***! + \*******************************************************************/ +/*! exports provided: TransactionTypes, computeAddress, recoverAddress, accessListify, serialize, parse */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransactionTypes", function() { return TransactionTypes; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "computeAddress", function() { return computeAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "recoverAddress", function() { return recoverAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "accessListify", function() { return accessListify; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "serialize", function() { return serialize; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parse", function() { return parse; }); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/rlp */ "./node_modules/@ethersproject/rlp/lib.esm/index.js"); +/* harmony import */ var _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/signing-key */ "./node_modules/@ethersproject/signing-key/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/transactions/lib.esm/_version.js"); + + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"](_version__WEBPACK_IMPORTED_MODULE_9__["version"]); +var TransactionTypes; + +(function (TransactionTypes) { + TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy"; + TransactionTypes[TransactionTypes["eip2930"] = 1] = "eip2930"; + TransactionTypes[TransactionTypes["eip1559"] = 2] = "eip1559"; +})(TransactionTypes || (TransactionTypes = {})); + +; /////////////////////////////// + +function handleAddress(value) { + if (value === "0x") { + return null; + } + + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(value); +} + +function handleNumber(value) { + if (value === "0x") { + return _ethersproject_constants__WEBPACK_IMPORTED_MODULE_3__["Zero"]; + } + + return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value); +} // Legacy Transaction Fields + + +var transactionFields = [{ + name: "nonce", + maxLength: 32, + numeric: true +}, { + name: "gasPrice", + maxLength: 32, + numeric: true +}, { + name: "gasLimit", + maxLength: 32, + numeric: true +}, { + name: "to", + length: 20 +}, { + name: "value", + maxLength: 32, + numeric: true +}, { + name: "data" +}]; +var allowedTransactionKeys = { + chainId: true, + data: true, + gasLimit: true, + gasPrice: true, + nonce: true, + to: true, + type: true, + value: true +}; +function computeAddress(key) { + var publicKey = Object(_ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_7__["computePublicKey"])(key); + return Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexDataSlice"])(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexDataSlice"])(publicKey, 1)), 12)); +} +function recoverAddress(digest, signature) { + return computeAddress(Object(_ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_7__["recoverPublicKey"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(digest), signature)); +} + +function formatNumber(value, name) { + var result = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(value).toHexString()); + + if (result.length > 32) { + logger.throwArgumentError("invalid length for " + name, "transaction:" + name, value); + } + + return result; +} + +function accessSetify(addr, storageKeys) { + return { + address: Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(addr), + storageKeys: (storageKeys || []).map(function (storageKey, index) { + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexDataLength"])(storageKey) !== 32) { + logger.throwArgumentError("invalid access list storageKey", "accessList[".concat(addr, ":").concat(index, "]"), storageKey); + } + + return storageKey.toLowerCase(); + }) + }; +} + +function accessListify(value) { + if (Array.isArray(value)) { + return value.map(function (set, index) { + if (Array.isArray(set)) { + if (set.length > 2) { + logger.throwArgumentError("access list expected to be [ address, storageKeys[] ]", "value[".concat(index, "]"), set); + } + + return accessSetify(set[0], set[1]); + } + + return accessSetify(set.address, set.storageKeys); + }); + } + + var result = Object.keys(value).map(function (addr) { + var storageKeys = value[addr].reduce(function (accum, storageKey) { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort(function (a, b) { + return a.address.localeCompare(b.address); + }); + return result; +} + +function formatAccessList(value) { + return accessListify(value).map(function (set) { + return [set.address, set.storageKeys]; + }); +} + +function _serializeEip1559(transaction, signature) { + // If there is an explicit gasPrice, make sure it matches the + // EIP-1559 fees; otherwise they may not understand what they + // think they are setting in terms of fee. + if (transaction.gasPrice != null) { + var gasPrice = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(transaction.gasPrice); + var maxFeePerGas = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(transaction.maxFeePerGas || 0); + + if (!gasPrice.eq(maxFeePerGas)) { + logger.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + gasPrice: gasPrice, + maxFeePerGas: maxFeePerGas + }); + } + } + + var fields = [formatNumber(transaction.chainId || 0, "chainId"), formatNumber(transaction.nonce || 0, "nonce"), formatNumber(transaction.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), formatNumber(transaction.maxFeePerGas || 0, "maxFeePerGas"), formatNumber(transaction.gasLimit || 0, "gasLimit"), transaction.to != null ? Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(transaction.to) : "0x", formatNumber(transaction.value || 0, "value"), transaction.data || "0x", formatAccessList(transaction.accessList || [])]; + + if (signature) { + var sig = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["splitSignature"])(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(sig.r)); + fields.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(sig.s)); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexConcat"])(["0x02", _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["encode"](fields)]); +} + +function _serializeEip2930(transaction, signature) { + var fields = [formatNumber(transaction.chainId || 0, "chainId"), formatNumber(transaction.nonce || 0, "nonce"), formatNumber(transaction.gasPrice || 0, "gasPrice"), formatNumber(transaction.gasLimit || 0, "gasLimit"), transaction.to != null ? Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(transaction.to) : "0x", formatNumber(transaction.value || 0, "value"), transaction.data || "0x", formatAccessList(transaction.accessList || [])]; + + if (signature) { + var sig = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["splitSignature"])(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(sig.r)); + fields.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(sig.s)); + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexConcat"])(["0x01", _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["encode"](fields)]); +} // Legacy Transactions and EIP-155 + + +function _serialize(transaction, signature) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_5__["checkProperties"])(transaction, allowedTransactionKeys); + var raw = []; + transactionFields.forEach(function (fieldInfo) { + var value = transaction[fieldInfo.name] || []; + var options = {}; + + if (fieldInfo.numeric) { + options.hexPad = "left"; + } + + value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(value, options)); // Fixed-width field + + if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } // Variable-width (with a maximum) + + + if (fieldInfo.maxLength) { + value = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(value); + + if (value.length > fieldInfo.maxLength) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + } + + raw.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(value)); + }); + var chainId = 0; + + if (transaction.chainId != null) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = transaction.chainId; + + if (typeof chainId !== "number") { + logger.throwArgumentError("invalid transaction.chainId", "transaction", transaction); + } + } else if (signature && !Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["isBytesLike"])(signature) && signature.v > 28) { + // No chainId provided, but the signature is signing with EIP-155; derive chainId + chainId = Math.floor((signature.v - 35) / 2); + } // We have an EIP-155 transaction (chainId was specified and non-zero) + + + if (chainId !== 0) { + raw.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(chainId)); // @TODO: hexValue? + + raw.push("0x"); + raw.push("0x"); + } // Requesting an unsigned transaction + + + if (!signature) { + return _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["encode"](raw); + } // The splitSignature will ensure the transaction has a recoveryParam in the + // case that the signTransaction function only adds a v. + + + var sig = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["splitSignature"])(signature); // We pushed a chainId and null r, s on for hashing only; remove those + + var v = 27 + sig.recoveryParam; + + if (chainId !== 0) { + raw.pop(); + raw.pop(); + raw.pop(); + v += chainId * 2 + 8; // If an EIP-155 v (directly or indirectly; maybe _vs) was provided, check it! + + if (sig.v > 28 && sig.v !== v) { + logger.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature); + } + } else if (sig.v !== v) { + logger.throwArgumentError("transaction.chainId/signature.v mismatch", "signature", signature); + } + + raw.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(v)); + raw.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(sig.r))); + raw.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["stripZeros"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(sig.s))); + return _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["encode"](raw); +} + +function serialize(transaction, signature) { + // Legacy and EIP-155 Transactions + if (transaction.type == null || transaction.type === 0) { + if (transaction.accessList != null) { + logger.throwArgumentError("untyped transactions do not support accessList; include type: 1", "transaction", transaction); + } + + return _serialize(transaction, signature); + } // Typed Transactions (EIP-2718) + + + switch (transaction.type) { + case 1: + return _serializeEip2930(transaction, signature); + + case 2: + return _serializeEip1559(transaction, signature); + + default: + break; + } + + return logger.throwError("unsupported transaction type: ".concat(transaction.type), _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "serializeTransaction", + transactionType: transaction.type + }); +} + +function _parseEipSignature(tx, fields, serialize) { + try { + var recid = handleNumber(fields[0]).toNumber(); + + if (recid !== 0 && recid !== 1) { + throw new Error("bad recid"); + } + + tx.v = recid; + } catch (error) { + logger.throwArgumentError("invalid v for transaction type: 1", "v", fields[0]); + } + + tx.r = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(fields[1], 32); + tx.s = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(fields[2], 32); + + try { + var digest = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(serialize(tx)); + tx.from = recoverAddress(digest, { + r: tx.r, + s: tx.s, + recoveryParam: tx.v + }); + } catch (error) { + console.log(error); + } +} + +function _parseEip1559(payload) { + var transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["decode"](payload.slice(1)); + + if (transaction.length !== 9 && transaction.length !== 12) { + logger.throwArgumentError("invalid component count for transaction type: 2", "payload", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(payload)); + } + + var maxPriorityFeePerGas = handleNumber(transaction[2]); + var maxFeePerGas = handleNumber(transaction[3]); + var tx = { + type: 2, + chainId: handleNumber(transaction[0]).toNumber(), + nonce: handleNumber(transaction[1]).toNumber(), + maxPriorityFeePerGas: maxPriorityFeePerGas, + maxFeePerGas: maxFeePerGas, + gasPrice: null, + gasLimit: handleNumber(transaction[4]), + to: handleAddress(transaction[5]), + value: handleNumber(transaction[6]), + data: transaction[7], + accessList: accessListify(transaction[8]) + }; // Unsigned EIP-1559 Transaction + + if (transaction.length === 9) { + return tx; + } + + tx.hash = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(payload); + + _parseEipSignature(tx, transaction.slice(9), _serializeEip1559); + + return tx; +} + +function _parseEip2930(payload) { + var transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["decode"](payload.slice(1)); + + if (transaction.length !== 8 && transaction.length !== 11) { + logger.throwArgumentError("invalid component count for transaction type: 1", "payload", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(payload)); + } + + var tx = { + type: 1, + chainId: handleNumber(transaction[0]).toNumber(), + nonce: handleNumber(transaction[1]).toNumber(), + gasPrice: handleNumber(transaction[2]), + gasLimit: handleNumber(transaction[3]), + to: handleAddress(transaction[4]), + value: handleNumber(transaction[5]), + data: transaction[6], + accessList: accessListify(transaction[7]) + }; // Unsigned EIP-2930 Transaction + + if (transaction.length === 8) { + return tx; + } + + tx.hash = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(payload); + + _parseEipSignature(tx, transaction.slice(8), _serializeEip2930); + + return tx; +} // Legacy Transactions and EIP-155 + + +function _parse(rawTransaction) { + var transaction = _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["decode"](rawTransaction); + + if (transaction.length !== 9 && transaction.length !== 6) { + logger.throwArgumentError("invalid raw transaction", "rawTransaction", rawTransaction); + } + + var tx = { + nonce: handleNumber(transaction[0]).toNumber(), + gasPrice: handleNumber(transaction[1]), + gasLimit: handleNumber(transaction[2]), + to: handleAddress(transaction[3]), + value: handleNumber(transaction[4]), + data: transaction[5], + chainId: 0 + }; // Legacy unsigned transaction + + if (transaction.length === 6) { + return tx; + } + + try { + tx.v = _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(transaction[6]).toNumber(); + } catch (error) { + console.log(error); + return tx; + } + + tx.r = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(transaction[7], 32); + tx.s = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexZeroPad"])(transaction[8], 32); + + if (_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(tx.r).isZero() && _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"].from(tx.s).isZero()) { + // EIP-155 unsigned transaction + tx.chainId = tx.v; + tx.v = 0; + } else { + // Signed Transaction + tx.chainId = Math.floor((tx.v - 35) / 2); + + if (tx.chainId < 0) { + tx.chainId = 0; + } + + var recoveryParam = tx.v - 27; + var raw = transaction.slice(0, 6); + + if (tx.chainId !== 0) { + raw.push(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(tx.chainId)); + raw.push("0x"); + raw.push("0x"); + recoveryParam -= tx.chainId * 2 + 8; + } + + var digest = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(_ethersproject_rlp__WEBPACK_IMPORTED_MODULE_6__["encode"](raw)); + + try { + tx.from = recoverAddress(digest, { + r: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(tx.r), + s: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["hexlify"])(tx.s), + recoveryParam: recoveryParam + }); + } catch (error) { + console.log(error); + } + + tx.hash = Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_4__["keccak256"])(rawTransaction); + } + + tx.type = null; + return tx; +} + +function parse(rawTransaction) { + var payload = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_2__["arrayify"])(rawTransaction); // Legacy and EIP-155 Transactions + + if (payload[0] > 0x7f) { + return _parse(payload); + } // Typed Transaction (EIP-2718) + + + switch (payload[0]) { + case 1: + return _parseEip2930(payload); + + case 2: + return _parseEip1559(payload); + + default: + break; + } + + return logger.throwError("unsupported transaction type: ".concat(payload[0]), _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "parseTransaction", + transactionType: payload[0] + }); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/units/lib.esm/_version.js": +/*!***************************************************************!*\ + !*** ./node_modules/@ethersproject/units/lib.esm/_version.js ***! + \***************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "units/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/units/lib.esm/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@ethersproject/units/lib.esm/index.js ***! + \************************************************************/ +/*! exports provided: commify, formatUnits, parseUnits, formatEther, parseEther */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "commify", function() { return commify; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatUnits", function() { return formatUnits; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseUnits", function() { return parseUnits; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatEther", function() { return formatEther; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseEther", function() { return parseEther; }); +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/units/lib.esm/_version.js"); + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_1__["Logger"](_version__WEBPACK_IMPORTED_MODULE_2__["version"]); +var names = ["wei", "kwei", "mwei", "gwei", "szabo", "finney", "ether"]; // Some environments have issues with RegEx that contain back-tracking, so we cannot +// use them. + +function commify(value) { + var comps = String(value).split("."); + + if (comps.length > 2 || !comps[0].match(/^-?[0-9]*$/) || comps[1] && !comps[1].match(/^[0-9]*$/) || value === "." || value === "-.") { + logger.throwArgumentError("invalid value", "value", value); + } // Make sure we have at least one whole digit (0 if none) + + + var whole = comps[0]; + var negative = ""; + + if (whole.substring(0, 1) === "-") { + negative = "-"; + whole = whole.substring(1); + } // Make sure we have at least 1 whole digit with no leading zeros + + + while (whole.substring(0, 1) === "0") { + whole = whole.substring(1); + } + + if (whole === "") { + whole = "0"; + } + + var suffix = ""; + + if (comps.length === 2) { + suffix = "." + (comps[1] || "0"); + } + + while (suffix.length > 2 && suffix[suffix.length - 1] === "0") { + suffix = suffix.substring(0, suffix.length - 1); + } + + var formatted = []; + + while (whole.length) { + if (whole.length <= 3) { + formatted.unshift(whole); + break; + } else { + var index = whole.length - 3; + formatted.unshift(whole.substring(index)); + whole = whole.substring(0, index); + } + } + + return negative + formatted.join(",") + suffix; +} +function formatUnits(value, unitName) { + if (typeof unitName === "string") { + var index = names.indexOf(unitName); + + if (index !== -1) { + unitName = 3 * index; + } + } + + return Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["formatFixed"])(value, unitName != null ? unitName : 18); +} +function parseUnits(value, unitName) { + if (typeof value !== "string") { + logger.throwArgumentError("value must be a string", "value", value); + } + + if (typeof unitName === "string") { + var index = names.indexOf(unitName); + + if (index !== -1) { + unitName = 3 * index; + } + } + + return Object(_ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_0__["parseFixed"])(value, unitName != null ? unitName : 18); +} +function formatEther(wei) { + return formatUnits(wei, 18); +} +function parseEther(ether) { + return parseUnits(ether, 18); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/wallet/lib.esm/_version.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/wallet/lib.esm/_version.js ***! + \****************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "wallet/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/wallet/lib.esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/wallet/lib.esm/index.js ***! + \*************************************************************/ +/*! exports provided: Wallet, verifyMessage, verifyTypedData */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Wallet", function() { return Wallet; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "verifyMessage", function() { return verifyMessage; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "verifyTypedData", function() { return verifyTypedData; }); +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony import */ var _ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/abstract-provider */ "./node_modules/@ethersproject/abstract-provider/lib.esm/index.js"); +/* harmony import */ var _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/abstract-signer */ "./node_modules/@ethersproject/abstract-signer/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/hash */ "./node_modules/@ethersproject/hash/lib.esm/index.js"); +/* harmony import */ var _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/hdnode */ "./node_modules/@ethersproject/hdnode/lib.esm/index.js"); +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/random */ "./node_modules/@ethersproject/random/lib.esm/index.js"); +/* harmony import */ var _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/signing-key */ "./node_modules/@ethersproject/signing-key/lib.esm/index.js"); +/* harmony import */ var _ethersproject_json_wallets__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/json-wallets */ "./node_modules/@ethersproject/json-wallets/lib.esm/index.js"); +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/wallet/lib.esm/_version.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + + + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"](_version__WEBPACK_IMPORTED_MODULE_13__["version"]); + +function isAccount(value) { + return value != null && Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["isHexString"])(value.privateKey, 32) && value.address != null; +} + +function hasMnemonic(value) { + var mnemonic = value.mnemonic; + return mnemonic && mnemonic.phrase; +} + +var Wallet = /*#__PURE__*/function (_Signer) { + _inherits(Wallet, _Signer); + + var _super = _createSuper(Wallet); + + function Wallet(privateKey, provider) { + var _this; + + _classCallCheck(this, Wallet); + + logger.checkNew(this instanceof Wallet ? this.constructor : void 0, Wallet); + _this = _super.call(this); + + if (isAccount(privateKey)) { + var signingKey = new _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_9__["SigningKey"](privateKey.privateKey); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "_signingKey", function () { + return signingKey; + }); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "address", Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__["computeAddress"])(_this.publicKey)); + + if (_this.address !== Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(privateKey.address)) { + logger.throwArgumentError("privateKey/address mismatch", "privateKey", "[REDACTED]"); + } + + if (hasMnemonic(privateKey)) { + var srcMnemonic = privateKey.mnemonic; + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "_mnemonic", function () { + return { + phrase: srcMnemonic.phrase, + path: srcMnemonic.path || _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_5__["defaultPath"], + locale: srcMnemonic.locale || "en" + }; + }); + var mnemonic = _this.mnemonic; + var node = _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_5__["HDNode"].fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path); + + if (Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__["computeAddress"])(node.privateKey) !== _this.address) { + logger.throwArgumentError("mnemonic/address mismatch", "privateKey", "[REDACTED]"); + } + } else { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "_mnemonic", function () { + return null; + }); + } + } else { + if (_ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_9__["SigningKey"].isSigningKey(privateKey)) { + /* istanbul ignore if */ + if (privateKey.curve !== "secp256k1") { + logger.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]"); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "_signingKey", function () { + return privateKey; + }); + } else { + // A lot of common tools do not prefix private keys with a 0x (see: #1166) + if (typeof privateKey === "string") { + if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { + privateKey = "0x" + privateKey; + } + } + + var _signingKey = new _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_9__["SigningKey"](privateKey); + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "_signingKey", function () { + return _signingKey; + }); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "_mnemonic", function () { + return null; + }); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "address", Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__["computeAddress"])(_this.publicKey)); + } + /* istanbul ignore if */ + + + if (provider && !_ethersproject_abstract_provider__WEBPACK_IMPORTED_MODULE_1__["Provider"].isProvider(provider)) { + logger.throwArgumentError("invalid provider", "provider", provider); + } + + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["defineReadOnly"])(_assertThisInitialized(_this), "provider", provider || null); + return _this; + } + + _createClass(Wallet, [{ + key: "mnemonic", + get: function get() { + return this._mnemonic(); + } + }, { + key: "privateKey", + get: function get() { + return this._signingKey().privateKey; + } + }, { + key: "publicKey", + get: function get() { + return this._signingKey().publicKey; + } + }, { + key: "getAddress", + value: function getAddress() { + return Promise.resolve(this.address); + } + }, { + key: "connect", + value: function connect(provider) { + return new Wallet(this, provider); + } + }, { + key: "signTransaction", + value: function signTransaction(transaction) { + var _this2 = this; + + return Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_7__["resolveProperties"])(transaction).then(function (tx) { + if (tx.from != null) { + if (Object(_ethersproject_address__WEBPACK_IMPORTED_MODULE_0__["getAddress"])(tx.from) !== _this2.address) { + logger.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from); + } + + delete tx.from; + } + + var signature = _this2._signingKey().signDigest(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_6__["keccak256"])(Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__["serialize"])(tx))); + + return Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__["serialize"])(tx, signature); + }); + } + }, { + key: "signMessage", + value: function signMessage(message) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + return _context.abrupt("return", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["joinSignature"])(this._signingKey().signDigest(Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_4__["hashMessage"])(message)))); + + case 1: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + } + }, { + key: "_signTypedData", + value: function _signTypedData(domain, types, value) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + var _this3 = this; + + var populated; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return _ethersproject_hash__WEBPACK_IMPORTED_MODULE_4__["_TypedDataEncoder"].resolveNames(domain, types, value, function (name) { + if (_this3.provider == null) { + logger.throwError("cannot resolve ENS names without a provider", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_12__["Logger"].errors.UNSUPPORTED_OPERATION, { + operation: "resolveName", + value: name + }); + } + + return _this3.provider.resolveName(name); + }); + + case 2: + populated = _context2.sent; + return _context2.abrupt("return", Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["joinSignature"])(this._signingKey().signDigest(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_4__["_TypedDataEncoder"].hash(populated.domain, types, populated.value)))); + + case 4: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + } + }, { + key: "encrypt", + value: function encrypt(password, options, progressCallback) { + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + + if (progressCallback && typeof progressCallback !== "function") { + throw new Error("invalid callback"); + } + + if (!options) { + options = {}; + } + + return Object(_ethersproject_json_wallets__WEBPACK_IMPORTED_MODULE_10__["encryptKeystore"])(this, password, options, progressCallback); + } + /** + * Static methods to create Wallet instances. + */ + + }], [{ + key: "createRandom", + value: function createRandom(options) { + var entropy = Object(_ethersproject_random__WEBPACK_IMPORTED_MODULE_8__["randomBytes"])(16); + + if (!options) { + options = {}; + } + + if (options.extraEntropy) { + entropy = Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["arrayify"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["hexDataSlice"])(Object(_ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_6__["keccak256"])(Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_3__["concat"])([entropy, options.extraEntropy])), 0, 16)); + } + + var mnemonic = Object(_ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_5__["entropyToMnemonic"])(entropy, options.locale); + return Wallet.fromMnemonic(mnemonic, options.path, options.locale); + } + }, { + key: "fromEncryptedJson", + value: function fromEncryptedJson(json, password, progressCallback) { + return Object(_ethersproject_json_wallets__WEBPACK_IMPORTED_MODULE_10__["decryptJsonWallet"])(json, password, progressCallback).then(function (account) { + return new Wallet(account); + }); + } + }, { + key: "fromEncryptedJsonSync", + value: function fromEncryptedJsonSync(json, password) { + return new Wallet(Object(_ethersproject_json_wallets__WEBPACK_IMPORTED_MODULE_10__["decryptJsonWalletSync"])(json, password)); + } + }, { + key: "fromMnemonic", + value: function fromMnemonic(mnemonic, path, wordlist) { + if (!path) { + path = _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_5__["defaultPath"]; + } + + return new Wallet(_ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_5__["HDNode"].fromMnemonic(mnemonic, null, wordlist).derivePath(path)); + } + }]); + + return Wallet; +}(_ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__["Signer"]); +function verifyMessage(message, signature) { + return Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__["recoverAddress"])(Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_4__["hashMessage"])(message), signature); +} +function verifyTypedData(domain, types, value, signature) { + return Object(_ethersproject_transactions__WEBPACK_IMPORTED_MODULE_11__["recoverAddress"])(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_4__["_TypedDataEncoder"].hash(domain, types, value), signature); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/web/lib.esm/_version.js": +/*!*************************************************************!*\ + !*** ./node_modules/@ethersproject/web/lib.esm/_version.js ***! + \*************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "web/5.5.1"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/web/lib.esm/geturl.js": +/*!***********************************************************!*\ + !*** ./node_modules/@ethersproject/web/lib.esm/geturl.js ***! + \***********************************************************/ +/*! exports provided: getUrl */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUrl", function() { return getUrl; }); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); + + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + +function getUrl(href, options) { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var request, response, body, headers; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (options == null) { + options = {}; + } + + request = { + method: options.method || "GET", + headers: options.headers || {}, + body: options.body || undefined + }; + + if (options.skipFetchSetup !== true) { + request.mode = "cors"; // no-cors, cors, *same-origin + + request.cache = "no-cache"; // *default, no-cache, reload, force-cache, only-if-cached + + request.credentials = "same-origin"; // include, *same-origin, omit + + request.redirect = "follow"; // manual, *follow, error + + request.referrer = "client"; // no-referrer, *client + } + + ; + _context.next = 6; + return fetch(href, request); + + case 6: + response = _context.sent; + _context.next = 9; + return response.arrayBuffer(); + + case 9: + body = _context.sent; + headers = {}; + + if (response.headers.forEach) { + response.headers.forEach(function (value, key) { + headers[key.toLowerCase()] = value; + }); + } else { + response.headers.keys().forEach(function (key) { + headers[key.toLowerCase()] = response.headers.get(key); + }); + } + + return _context.abrupt("return", { + headers: headers, + statusCode: response.status, + statusMessage: response.statusText, + body: Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_0__["arrayify"])(new Uint8Array(body)) + }); + + case 13: + case "end": + return _context.stop(); + } + } + }, _callee); + })); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/web/lib.esm/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@ethersproject/web/lib.esm/index.js ***! + \**********************************************************/ +/*! exports provided: _fetchData, fetchJson, poll */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_fetchData", function() { return _fetchData; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fetchJson", function() { return fetchJson; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "poll", function() { return poll; }); +/* harmony import */ var _ethersproject_base64__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/base64 */ "./node_modules/@ethersproject/base64/lib.esm/index.js"); +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/web/lib.esm/_version.js"); +/* harmony import */ var _geturl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./geturl */ "./node_modules/@ethersproject/web/lib.esm/geturl.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) { + function adopt(value) { + return value instanceof P ? value : new P(function (resolve) { + resolve(value); + }); + } + + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + } + + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e) { + reject(e); + } + } + + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; + + + + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"](_version__WEBPACK_IMPORTED_MODULE_5__["version"]); + + +function staller(duration) { + return new Promise(function (resolve) { + setTimeout(resolve, duration); + }); +} + +function bodyify(value, type) { + if (value == null) { + return null; + } + + if (typeof value === "string") { + return value; + } + + if (Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["isBytesLike"])(value)) { + if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) { + try { + return Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["toUtf8String"])(value); + } catch (error) {} + + ; + } + + return Object(_ethersproject_bytes__WEBPACK_IMPORTED_MODULE_1__["hexlify"])(value); + } + + return value; +} // This API is still a work in progress; the future changes will likely be: +// - ConnectionInfo => FetchDataRequest +// - FetchDataRequest.body? = string | Uint8Array | { contentType: string, data: string | Uint8Array } +// - If string => text/plain, Uint8Array => application/octet-stream (if content-type unspecified) +// - FetchDataRequest.processFunc = (body: Uint8Array, response: FetchDataResponse) => T +// For this reason, it should be considered internal until the API is finalized + + +function _fetchData(connection, body, processFunc) { + // How many times to retry in the event of a throttle + var attemptLimit = _typeof(connection) === "object" && connection.throttleLimit != null ? connection.throttleLimit : 12; + logger.assertArgument(attemptLimit > 0 && attemptLimit % 1 === 0, "invalid connection throttle limit", "connection.throttleLimit", attemptLimit); + var throttleCallback = _typeof(connection) === "object" ? connection.throttleCallback : null; + var throttleSlotInterval = _typeof(connection) === "object" && typeof connection.throttleSlotInterval === "number" ? connection.throttleSlotInterval : 100; + logger.assertArgument(throttleSlotInterval > 0 && throttleSlotInterval % 1 === 0, "invalid connection throttle slot interval", "connection.throttleSlotInterval", throttleSlotInterval); + var headers = {}; + var url = null; // @TODO: Allow ConnectionInfo to override some of these values + + var options = { + method: "GET" + }; + var allow304 = false; + var timeout = 2 * 60 * 1000; + + if (typeof connection === "string") { + url = connection; + } else if (_typeof(connection) === "object") { + if (connection == null || connection.url == null) { + logger.throwArgumentError("missing URL", "connection.url", connection); + } + + url = connection.url; + + if (typeof connection.timeout === "number" && connection.timeout > 0) { + timeout = connection.timeout; + } + + if (connection.headers) { + for (var key in connection.headers) { + headers[key.toLowerCase()] = { + key: key, + value: String(connection.headers[key]) + }; + + if (["if-none-match", "if-modified-since"].indexOf(key.toLowerCase()) >= 0) { + allow304 = true; + } + } + } + + options.allowGzip = !!connection.allowGzip; + + if (connection.user != null && connection.password != null) { + if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) { + logger.throwError("basic authentication requires a secure https url", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.INVALID_ARGUMENT, { + argument: "url", + url: url, + user: connection.user, + password: "[REDACTED]" + }); + } + + var authorization = connection.user + ":" + connection.password; + headers["authorization"] = { + key: "Authorization", + value: "Basic " + Object(_ethersproject_base64__WEBPACK_IMPORTED_MODULE_0__["encode"])(Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["toUtf8Bytes"])(authorization)) + }; + } + } + + var reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i"); + var dataMatch = url ? url.match(reData) : null; + + if (dataMatch) { + try { + var response = { + statusCode: 200, + statusMessage: "OK", + headers: { + "content-type": dataMatch[1] + }, + body: Object(_ethersproject_base64__WEBPACK_IMPORTED_MODULE_0__["decode"])(dataMatch[2]) + }; + var result = response.body; + + if (processFunc) { + result = processFunc(response.body, response); + } + + return Promise.resolve(result); + } catch (error) { + logger.throwError("processing response error", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.SERVER_ERROR, { + body: bodyify(dataMatch[1], dataMatch[2]), + error: error, + requestBody: null, + requestMethod: "GET", + url: url + }); + } + } + + if (body) { + options.method = "POST"; + options.body = body; + + if (headers["content-type"] == null) { + headers["content-type"] = { + key: "Content-Type", + value: "application/octet-stream" + }; + } + + if (headers["content-length"] == null) { + headers["content-length"] = { + key: "Content-Length", + value: String(body.length) + }; + } + } + + var flatHeaders = {}; + Object.keys(headers).forEach(function (key) { + var header = headers[key]; + flatHeaders[header.key] = header.value; + }); + options.headers = flatHeaders; + + var runningTimeout = function () { + var timer = null; + var promise = new Promise(function (resolve, reject) { + if (timeout) { + timer = setTimeout(function () { + if (timer == null) { + return; + } + + timer = null; + reject(logger.makeError("timeout", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.TIMEOUT, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + timeout: timeout, + url: url + })); + }, timeout); + } + }); + + var cancel = function cancel() { + if (timer == null) { + return; + } + + clearTimeout(timer); + timer = null; + }; + + return { + promise: promise, + cancel: cancel + }; + }(); + + var runningFetch = function () { + return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var attempt, _response, location, tryAgain, stall, retryAfter, _body, _result, _tryAgain, _timeout; + + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + attempt = 0; + + case 1: + if (!(attempt < attemptLimit)) { + _context.next = 65; + break; + } + + _response = null; + _context.prev = 3; + _context.next = 6; + return Object(_geturl__WEBPACK_IMPORTED_MODULE_6__["getUrl"])(url, options); + + case 6: + _response = _context.sent; + + if (!(attempt < attemptLimit)) { + _context.next = 28; + break; + } + + if (!(_response.statusCode === 301 || _response.statusCode === 302)) { + _context.next = 15; + break; + } + + // Redirection; for now we only support absolute locataions + location = _response.headers.location || ""; + + if (!(options.method === "GET" && location.match(/^https:/))) { + _context.next = 13; + break; + } + + url = _response.headers.location; + return _context.abrupt("continue", 62); + + case 13: + _context.next = 28; + break; + + case 15: + if (!(_response.statusCode === 429)) { + _context.next = 28; + break; + } + + // Exponential back-off throttling + tryAgain = true; + + if (!throttleCallback) { + _context.next = 21; + break; + } + + _context.next = 20; + return throttleCallback(attempt, url); + + case 20: + tryAgain = _context.sent; + + case 21: + if (!tryAgain) { + _context.next = 28; + break; + } + + stall = 0; + retryAfter = _response.headers["retry-after"]; + + if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1000; + } else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } //console.log("Stalling 429"); + + + _context.next = 27; + return staller(stall); + + case 27: + return _context.abrupt("continue", 62); + + case 28: + _context.next = 34; + break; + + case 30: + _context.prev = 30; + _context.t0 = _context["catch"](3); + _response = _context.t0.response; + + if (_response == null) { + runningTimeout.cancel(); + logger.throwError("missing response", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + serverError: _context.t0, + url: url + }); + } + + case 34: + _body = _response.body; + + if (allow304 && _response.statusCode === 304) { + _body = null; + } else if (_response.statusCode < 200 || _response.statusCode >= 300) { + runningTimeout.cancel(); + logger.throwError("bad response", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.SERVER_ERROR, { + status: _response.statusCode, + headers: _response.headers, + body: bodyify(_body, _response.headers ? _response.headers["content-type"] : null), + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url: url + }); + } + + if (!processFunc) { + _context.next = 60; + break; + } + + _context.prev = 37; + _context.next = 40; + return processFunc(_body, _response); + + case 40: + _result = _context.sent; + runningTimeout.cancel(); + return _context.abrupt("return", _result); + + case 45: + _context.prev = 45; + _context.t1 = _context["catch"](37); + + if (!(_context.t1.throttleRetry && attempt < attemptLimit)) { + _context.next = 58; + break; + } + + _tryAgain = true; + + if (!throttleCallback) { + _context.next = 53; + break; + } + + _context.next = 52; + return throttleCallback(attempt, url); + + case 52: + _tryAgain = _context.sent; + + case 53: + if (!_tryAgain) { + _context.next = 58; + break; + } + + _timeout = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); //console.log("Stalling callback"); + + _context.next = 57; + return staller(_timeout); + + case 57: + return _context.abrupt("continue", 62); + + case 58: + runningTimeout.cancel(); + logger.throwError("processing response error", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.SERVER_ERROR, { + body: bodyify(_body, _response.headers ? _response.headers["content-type"] : null), + error: _context.t1, + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url: url + }); + + case 60: + runningTimeout.cancel(); // If we had a processFunc, it either returned a T or threw above. + // The "body" is now a Uint8Array. + + return _context.abrupt("return", _body); + + case 62: + attempt++; + _context.next = 1; + break; + + case 65: + return _context.abrupt("return", logger.throwError("failed response", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url: url + })); + + case 66: + case "end": + return _context.stop(); + } + } + }, _callee, null, [[3, 30], [37, 45]]); + })); + }(); + + return Promise.race([runningTimeout.promise, runningFetch]); +} +function fetchJson(connection, json, processFunc) { + var processJsonFunc = function processJsonFunc(value, response) { + var result = null; + + if (value != null) { + try { + result = JSON.parse(Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["toUtf8String"])(value)); + } catch (error) { + logger.throwError("invalid JSON", _ethersproject_logger__WEBPACK_IMPORTED_MODULE_4__["Logger"].errors.SERVER_ERROR, { + body: value, + error: error + }); + } + } + + if (processFunc) { + result = processFunc(result, response); + } + + return result; + }; // If we have json to send, we must + // - add content-type of application/json (unless already overridden) + // - convert the json to bytes + + + var body = null; + + if (json != null) { + body = Object(_ethersproject_strings__WEBPACK_IMPORTED_MODULE_3__["toUtf8Bytes"])(json); // Create a connection with the content-type set for JSON + + var updated = typeof connection === "string" ? { + url: connection + } : Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["shallowCopy"])(connection); + + if (updated.headers) { + var hasContentType = Object.keys(updated.headers).filter(function (k) { + return k.toLowerCase() === "content-type"; + }).length !== 0; + + if (!hasContentType) { + updated.headers = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["shallowCopy"])(updated.headers); + updated.headers["content-type"] = "application/json"; + } + } else { + updated.headers = { + "content-type": "application/json" + }; + } + + connection = updated; + } + + return _fetchData(connection, body, processJsonFunc); +} +function poll(func, options) { + if (!options) { + options = {}; + } + + options = Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_2__["shallowCopy"])(options); + + if (options.floor == null) { + options.floor = 0; + } + + if (options.ceiling == null) { + options.ceiling = 10000; + } + + if (options.interval == null) { + options.interval = 250; + } + + return new Promise(function (resolve, reject) { + var timer = null; + var done = false; // Returns true if cancel was successful. Unsuccessful cancel means we're already done. + + var cancel = function cancel() { + if (done) { + return false; + } + + done = true; + + if (timer) { + clearTimeout(timer); + } + + return true; + }; + + if (options.timeout) { + timer = setTimeout(function () { + if (cancel()) { + reject(new Error("timeout")); + } + }, options.timeout); + } + + var retryLimit = options.retryLimit; + var attempt = 0; + + function check() { + return func().then(function (result) { + // If we have a result, or are allowed null then we're done + if (result !== undefined) { + if (cancel()) { + resolve(result); + } + } else if (options.oncePoll) { + options.oncePoll.once("poll", check); + } else if (options.onceBlock) { + options.onceBlock.once("block", check); // Otherwise, exponential back-off (up to 10s) our next request + } else if (!done) { + attempt++; + + if (attempt > retryLimit) { + if (cancel()) { + reject(new Error("retry limit reached")); + } + + return; + } + + var timeout = options.interval * parseInt(String(Math.random() * Math.pow(2, attempt))); + + if (timeout < options.floor) { + timeout = options.floor; + } + + if (timeout > options.ceiling) { + timeout = options.ceiling; + } + + setTimeout(check, timeout); + } + + return null; + }, function (error) { + if (cancel()) { + reject(error); + } + }); + } + + check(); + }); +} + +/***/ }), + +/***/ "./node_modules/@ethersproject/wordlists/lib.esm/_version.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/wordlists/lib.esm/_version.js ***! + \*******************************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "wordlists/5.5.0"; + +/***/ }), + +/***/ "./node_modules/@ethersproject/wordlists/lib.esm/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@ethersproject/wordlists/lib.esm/index.js ***! + \****************************************************************/ +/*! exports provided: logger, Wordlist, wordlists */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _wordlist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wordlist */ "./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "logger", function() { return _wordlist__WEBPACK_IMPORTED_MODULE_0__["logger"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Wordlist", function() { return _wordlist__WEBPACK_IMPORTED_MODULE_0__["Wordlist"]; }); + +/* harmony import */ var _wordlists__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wordlists */ "./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "wordlists", function() { return _wordlists__WEBPACK_IMPORTED_MODULE_1__["wordlists"]; }); + + // Wordlists +// See: https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md + + + + + +/***/ }), + +/***/ "./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js": +/*!******************************************************************!*\ + !*** ./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js ***! + \******************************************************************/ +/*! exports provided: langEn */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "langEn", function() { return langEn; }); +/* harmony import */ var _wordlist__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wordlist */ "./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js"); + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + +var words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; +var wordlist = null; + +function loadWords(lang) { + if (wordlist != null) { + return; + } + + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); // Verify the computed list matches the official list + + /* istanbul ignore if */ + + if (_wordlist__WEBPACK_IMPORTED_MODULE_0__["Wordlist"].check(lang) !== "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } +} + +var LangEn = /*#__PURE__*/function (_Wordlist) { + _inherits(LangEn, _Wordlist); + + var _super = _createSuper(LangEn); + + function LangEn() { + _classCallCheck(this, LangEn); + + return _super.call(this, "en"); + } + + _createClass(LangEn, [{ + key: "getWord", + value: function getWord(index) { + loadWords(this); + return wordlist[index]; + } + }, { + key: "getWordIndex", + value: function getWordIndex(word) { + loadWords(this); + return wordlist.indexOf(word); + } + }]); + + return LangEn; +}(_wordlist__WEBPACK_IMPORTED_MODULE_0__["Wordlist"]); + +var langEn = new LangEn(); +_wordlist__WEBPACK_IMPORTED_MODULE_0__["Wordlist"].register(langEn); + + +/***/ }), + +/***/ "./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@ethersproject/wordlists/lib.esm/wordlist.js ***! + \*******************************************************************/ +/*! exports provided: logger, Wordlist */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logger", function() { return logger; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Wordlist", function() { return Wordlist; }); +/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/hash */ "./node_modules/@ethersproject/hash/lib.esm/index.js"); +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_version */ "./node_modules/@ethersproject/wordlists/lib.esm/_version.js"); + // This gets overridden by rollup + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +var exportWordlist = false; + + + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_2__["Logger"](_version__WEBPACK_IMPORTED_MODULE_3__["version"]); +var Wordlist = /*#__PURE__*/function () { + function Wordlist(locale) { + _classCallCheck(this, Wordlist); + + logger.checkAbstract(this instanceof Wordlist ? this.constructor : void 0, Wordlist); + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(this, "locale", locale); + } // Subclasses may override this + + + _createClass(Wordlist, [{ + key: "split", + value: function split(mnemonic) { + return mnemonic.toLowerCase().split(/ +/g); + } // Subclasses may override this + + }, { + key: "join", + value: function join(words) { + return words.join(" "); + } + }], [{ + key: "check", + value: function check(wordlist) { + var words = []; + + for (var i = 0; i < 2048; i++) { + var word = wordlist.getWord(i); + /* istanbul ignore if */ + + if (i !== wordlist.getWordIndex(word)) { + return "0x"; + } + + words.push(word); + } + + return Object(_ethersproject_hash__WEBPACK_IMPORTED_MODULE_0__["id"])(words.join("\n") + "\n"); + } + }, { + key: "register", + value: function register(lang, name) { + if (!name) { + name = lang.locale; + } + /* istanbul ignore if */ + + + if (exportWordlist) { + try { + var anyGlobal = window; + + if (anyGlobal._ethers && anyGlobal._ethers.wordlists) { + if (!anyGlobal._ethers.wordlists[name]) { + Object(_ethersproject_properties__WEBPACK_IMPORTED_MODULE_1__["defineReadOnly"])(anyGlobal._ethers.wordlists, name, lang); + } + } + } catch (error) {} + } + } + }]); + + return Wordlist; +}(); + +/***/ }), + +/***/ "./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js": +/*!********************************************************************!*\ + !*** ./node_modules/@ethersproject/wordlists/lib.esm/wordlists.js ***! + \********************************************************************/ +/*! exports provided: wordlists */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wordlists", function() { return wordlists; }); +/* harmony import */ var _lang_en__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lang-en */ "./node_modules/@ethersproject/wordlists/lib.esm/lang-en.js"); + + + +var wordlists = { + en: _lang_en__WEBPACK_IMPORTED_MODULE_0__["langEn"] +}; + +/***/ }), + +/***/ "./node_modules/@walletconnect/browser-utils/dist/esm/browser.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@walletconnect/browser-utils/dist/esm/browser.js ***! + \***********************************************************************/ +/*! exports provided: detectEnv, detectOS, isAndroid, isIOS, isMobile, isNode, isBrowser, getFromWindow, getFromWindowOrThrow, getDocumentOrThrow, getDocument, getNavigatorOrThrow, getNavigator, getLocationOrThrow, getLocation, getCryptoOrThrow, getCrypto, getLocalStorageOrThrow, getLocalStorage, getClientMeta */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectEnv", function() { return detectEnv; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectOS", function() { return detectOS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isAndroid", function() { return isAndroid; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIOS", function() { return isIOS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return isMobile; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNode", function() { return isNode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBrowser", function() { return isBrowser; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFromWindow", function() { return getFromWindow; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getFromWindowOrThrow", function() { return getFromWindowOrThrow; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDocumentOrThrow", function() { return getDocumentOrThrow; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDocument", function() { return getDocument; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNavigatorOrThrow", function() { return getNavigatorOrThrow; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNavigator", function() { return getNavigator; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocationOrThrow", function() { return getLocationOrThrow; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocation", function() { return getLocation; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCryptoOrThrow", function() { return getCryptoOrThrow; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCrypto", function() { return getCrypto; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocalStorageOrThrow", function() { return getLocalStorageOrThrow; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocalStorage", function() { return getLocalStorage; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getClientMeta", function() { return getClientMeta; }); +/* harmony import */ var _walletconnect_window_metadata__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/window-metadata */ "./node_modules/@walletconnect/window-metadata/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_window_metadata__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_window_metadata__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/window-getters */ "./node_modules/@walletconnect/window-getters/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var detect_browser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! detect-browser */ "./node_modules/detect-browser/es/index.js"); + + + +function detectEnv(userAgent) { + return Object(detect_browser__WEBPACK_IMPORTED_MODULE_2__["detect"])(userAgent); +} +function detectOS() { + var env = detectEnv(); + return env && env.os ? env.os : undefined; +} +function isAndroid() { + var os = detectOS(); + return os ? os.toLowerCase().includes("android") : false; +} +function isIOS() { + var os = detectOS(); + return os ? os.toLowerCase().includes("ios") || os.toLowerCase().includes("mac") && navigator.maxTouchPoints > 1 : false; +} +function isMobile() { + var os = detectOS(); + return os ? isAndroid() || isIOS() : false; +} +function isNode() { + var env = detectEnv(); + var result = env && env.name ? env.name.toLowerCase() === "node" : false; + return result; +} +function isBrowser() { + var result = !isNode() && !!getNavigator(); + return result; +} +var getFromWindow = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getFromWindow"]; +var getFromWindowOrThrow = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getFromWindowOrThrow"]; +var getDocumentOrThrow = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getDocumentOrThrow"]; +var getDocument = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getDocument"]; +var getNavigatorOrThrow = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getNavigatorOrThrow"]; +var getNavigator = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getNavigator"]; +var getLocationOrThrow = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getLocationOrThrow"]; +var getLocation = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getLocation"]; +var getCryptoOrThrow = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getCryptoOrThrow"]; +var getCrypto = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getCrypto"]; +var getLocalStorageOrThrow = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getLocalStorageOrThrow"]; +var getLocalStorage = _walletconnect_window_getters__WEBPACK_IMPORTED_MODULE_1__["getLocalStorage"]; +function getClientMeta() { + return _walletconnect_window_metadata__WEBPACK_IMPORTED_MODULE_0__["getWindowMetadata"](); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/browser-utils/dist/esm/index.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/browser-utils/dist/esm/index.js ***! + \*********************************************************************/ +/*! exports provided: detectEnv, detectOS, isAndroid, isIOS, isMobile, isNode, isBrowser, getFromWindow, getFromWindowOrThrow, getDocumentOrThrow, getDocument, getNavigatorOrThrow, getNavigator, getLocationOrThrow, getLocation, getCryptoOrThrow, getCrypto, getLocalStorageOrThrow, getLocalStorage, getClientMeta, safeJsonParse, safeJsonStringify, setLocal, getLocal, removeLocal, mobileLinkChoiceKey, formatIOSMobile, saveMobileLinkInfo, getMobileRegistryEntry, getMobileLinkRegistry, getWalletRegistryUrl, getDappRegistryUrl, getAppLogoUrl, formatMobileRegistryEntry, formatMobileRegistry */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./browser */ "./node_modules/@walletconnect/browser-utils/dist/esm/browser.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "detectEnv", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["detectEnv"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "detectOS", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["detectOS"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isAndroid", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["isAndroid"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isIOS", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["isIOS"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["isMobile"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNode", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["isNode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBrowser", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["isBrowser"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getFromWindow", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getFromWindow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getFromWindowOrThrow", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getFromWindowOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDocumentOrThrow", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getDocumentOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDocument", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getDocument"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getNavigatorOrThrow", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getNavigatorOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getNavigator", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getNavigator"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocationOrThrow", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getLocationOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocation", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getLocation"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getCryptoOrThrow", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getCryptoOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getCrypto", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getCrypto"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocalStorageOrThrow", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getLocalStorageOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocalStorage", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getLocalStorage"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getClientMeta", function() { return _browser__WEBPACK_IMPORTED_MODULE_0__["getClientMeta"]; }); + +/* harmony import */ var _json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./json */ "./node_modules/@walletconnect/browser-utils/dist/esm/json.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "safeJsonParse", function() { return _json__WEBPACK_IMPORTED_MODULE_1__["safeJsonParse"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "safeJsonStringify", function() { return _json__WEBPACK_IMPORTED_MODULE_1__["safeJsonStringify"]; }); + +/* harmony import */ var _local__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./local */ "./node_modules/@walletconnect/browser-utils/dist/esm/local.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setLocal", function() { return _local__WEBPACK_IMPORTED_MODULE_2__["setLocal"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocal", function() { return _local__WEBPACK_IMPORTED_MODULE_2__["getLocal"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeLocal", function() { return _local__WEBPACK_IMPORTED_MODULE_2__["removeLocal"]; }); + +/* harmony import */ var _mobile__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mobile */ "./node_modules/@walletconnect/browser-utils/dist/esm/mobile.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mobileLinkChoiceKey", function() { return _mobile__WEBPACK_IMPORTED_MODULE_3__["mobileLinkChoiceKey"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatIOSMobile", function() { return _mobile__WEBPACK_IMPORTED_MODULE_3__["formatIOSMobile"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "saveMobileLinkInfo", function() { return _mobile__WEBPACK_IMPORTED_MODULE_3__["saveMobileLinkInfo"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMobileRegistryEntry", function() { return _mobile__WEBPACK_IMPORTED_MODULE_3__["getMobileRegistryEntry"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMobileLinkRegistry", function() { return _mobile__WEBPACK_IMPORTED_MODULE_3__["getMobileLinkRegistry"]; }); + +/* harmony import */ var _registry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./registry */ "./node_modules/@walletconnect/browser-utils/dist/esm/registry.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWalletRegistryUrl", function() { return _registry__WEBPACK_IMPORTED_MODULE_4__["getWalletRegistryUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDappRegistryUrl", function() { return _registry__WEBPACK_IMPORTED_MODULE_4__["getDappRegistryUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getAppLogoUrl", function() { return _registry__WEBPACK_IMPORTED_MODULE_4__["getAppLogoUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatMobileRegistryEntry", function() { return _registry__WEBPACK_IMPORTED_MODULE_4__["formatMobileRegistryEntry"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatMobileRegistry", function() { return _registry__WEBPACK_IMPORTED_MODULE_4__["formatMobileRegistry"]; }); + + + + + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/browser-utils/dist/esm/json.js": +/*!********************************************************************!*\ + !*** ./node_modules/@walletconnect/browser-utils/dist/esm/json.js ***! + \********************************************************************/ +/*! exports provided: safeJsonParse, safeJsonStringify */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeJsonParse", function() { return safeJsonParse; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeJsonStringify", function() { return safeJsonStringify; }); +/* harmony import */ var _walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/safe-json */ "./node_modules/@walletconnect/safe-json/dist/esm/index.js"); + +var safeJsonParse = _walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_0__["safeJsonParse"]; +var safeJsonStringify = _walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_0__["safeJsonStringify"]; + +/***/ }), + +/***/ "./node_modules/@walletconnect/browser-utils/dist/esm/local.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/browser-utils/dist/esm/local.js ***! + \*********************************************************************/ +/*! exports provided: setLocal, getLocal, removeLocal */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setLocal", function() { return setLocal; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocal", function() { return getLocal; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeLocal", function() { return removeLocal; }); +/* harmony import */ var _json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./json */ "./node_modules/@walletconnect/browser-utils/dist/esm/json.js"); +/* harmony import */ var _browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./browser */ "./node_modules/@walletconnect/browser-utils/dist/esm/browser.js"); + + +function setLocal(key, data) { + var raw = Object(_json__WEBPACK_IMPORTED_MODULE_0__["safeJsonStringify"])(data); + var local = Object(_browser__WEBPACK_IMPORTED_MODULE_1__["getLocalStorage"])(); + + if (local) { + local.setItem(key, raw); + } +} +function getLocal(key) { + var data = null; + var raw = null; + var local = Object(_browser__WEBPACK_IMPORTED_MODULE_1__["getLocalStorage"])(); + + if (local) { + raw = local.getItem(key); + } + + data = raw ? Object(_json__WEBPACK_IMPORTED_MODULE_0__["safeJsonParse"])(raw) : raw; + return data; +} +function removeLocal(key) { + var local = Object(_browser__WEBPACK_IMPORTED_MODULE_1__["getLocalStorage"])(); + + if (local) { + local.removeItem(key); + } +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/browser-utils/dist/esm/mobile.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@walletconnect/browser-utils/dist/esm/mobile.js ***! + \**********************************************************************/ +/*! exports provided: mobileLinkChoiceKey, formatIOSMobile, saveMobileLinkInfo, getMobileRegistryEntry, getMobileLinkRegistry */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mobileLinkChoiceKey", function() { return mobileLinkChoiceKey; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatIOSMobile", function() { return formatIOSMobile; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "saveMobileLinkInfo", function() { return saveMobileLinkInfo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMobileRegistryEntry", function() { return getMobileRegistryEntry; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMobileLinkRegistry", function() { return getMobileLinkRegistry; }); +/* harmony import */ var _local__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./local */ "./node_modules/@walletconnect/browser-utils/dist/esm/local.js"); + +var mobileLinkChoiceKey = "WALLETCONNECT_DEEPLINK_CHOICE"; +function formatIOSMobile(uri, entry) { + var encodedUri = encodeURIComponent(uri); + return entry.universalLink ? "".concat(entry.universalLink, "/wc?uri=").concat(encodedUri) : entry.deepLink ? "".concat(entry.deepLink).concat(entry.deepLink.endsWith(":") ? "//" : "/", "wc?uri=").concat(encodedUri) : ""; +} +function saveMobileLinkInfo(data) { + var focusUri = data.href.split("?")[0]; + Object(_local__WEBPACK_IMPORTED_MODULE_0__["setLocal"])(mobileLinkChoiceKey, Object.assign(Object.assign({}, data), { + href: focusUri + })); +} +function getMobileRegistryEntry(registry, name) { + return registry.filter(function (entry) { + return entry.name.toLowerCase().includes(name.toLowerCase()); + })[0]; +} +function getMobileLinkRegistry(registry, whitelist) { + var links = registry; + + if (whitelist) { + links = whitelist.map(function (name) { + return getMobileRegistryEntry(registry, name); + }).filter(Boolean); + } + + return links; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/browser-utils/dist/esm/registry.js": +/*!************************************************************************!*\ + !*** ./node_modules/@walletconnect/browser-utils/dist/esm/registry.js ***! + \************************************************************************/ +/*! exports provided: getWalletRegistryUrl, getDappRegistryUrl, getAppLogoUrl, formatMobileRegistryEntry, formatMobileRegistry */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getWalletRegistryUrl", function() { return getWalletRegistryUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDappRegistryUrl", function() { return getDappRegistryUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAppLogoUrl", function() { return getAppLogoUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatMobileRegistryEntry", function() { return formatMobileRegistryEntry; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatMobileRegistry", function() { return formatMobileRegistry; }); +var API_URL = "https://registry.walletconnect.org"; +function getWalletRegistryUrl() { + return API_URL + "/data/wallets.json"; +} +function getDappRegistryUrl() { + return API_URL + "/data/dapps.json"; +} +function getAppLogoUrl(id) { + return API_URL + "/logo/sm/" + id + ".jpeg"; +} +function formatMobileRegistryEntry(entry) { + var platform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "mobile"; + return { + name: entry.name || "", + shortName: entry.metadata.shortName || "", + color: entry.metadata.colors.primary || "", + logo: entry.id ? getAppLogoUrl(entry.id) : "", + universalLink: entry[platform].universal || "", + deepLink: entry[platform]["native"] || "" + }; +} +function formatMobileRegistry(registry) { + var platform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "mobile"; + return Object.values(registry).filter(function (entry) { + return !!entry[platform].universal || !!entry[platform]["native"]; + }).map(function (entry) { + return formatMobileRegistryEntry(entry, platform); + }); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/client/dist/esm/index.js": +/*!**************************************************************!*\ + !*** ./node_modules/@walletconnect/client/dist/esm/index.js ***! + \**************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/core */ "./node_modules/@walletconnect/core/dist/esm/index.js"); +/* harmony import */ var _walletconnect_iso_crypto__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/iso-crypto */ "./node_modules/@walletconnect/iso-crypto/dist/esm/index.js"); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + +var WalletConnect = /*#__PURE__*/function (_Connector) { + _inherits(WalletConnect, _Connector); + + var _super = _createSuper(WalletConnect); + + function WalletConnect(connectorOpts, pushServerOpts) { + _classCallCheck(this, WalletConnect); + + return _super.call(this, { + cryptoLib: _walletconnect_iso_crypto__WEBPACK_IMPORTED_MODULE_1__, + connectorOpts: connectorOpts, + pushServerOpts: pushServerOpts + }); + } + + return _createClass(WalletConnect); +}(_walletconnect_core__WEBPACK_IMPORTED_MODULE_0__["default"]); + +/* harmony default export */ __webpack_exports__["default"] = (WalletConnect); + +/***/ }), + +/***/ "./node_modules/@walletconnect/core/dist/esm/errors.js": +/*!*************************************************************!*\ + !*** ./node_modules/@walletconnect/core/dist/esm/errors.js ***! + \*************************************************************/ +/*! exports provided: ERROR_SESSION_CONNECTED, ERROR_SESSION_DISCONNECTED, ERROR_SESSION_REJECTED, ERROR_MISSING_JSON_RPC, ERROR_MISSING_RESULT, ERROR_MISSING_ERROR, ERROR_MISSING_METHOD, ERROR_MISSING_ID, ERROR_MISSING_REQUIRED, ERROR_INVALID_RESPONSE, ERROR_INVALID_URI, ERROR_QRCODE_MODAL_NOT_PROVIDED, ERROR_QRCODE_MODAL_USER_CLOSED */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_SESSION_CONNECTED", function() { return ERROR_SESSION_CONNECTED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_SESSION_DISCONNECTED", function() { return ERROR_SESSION_DISCONNECTED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_SESSION_REJECTED", function() { return ERROR_SESSION_REJECTED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_MISSING_JSON_RPC", function() { return ERROR_MISSING_JSON_RPC; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_MISSING_RESULT", function() { return ERROR_MISSING_RESULT; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_MISSING_ERROR", function() { return ERROR_MISSING_ERROR; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_MISSING_METHOD", function() { return ERROR_MISSING_METHOD; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_MISSING_ID", function() { return ERROR_MISSING_ID; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_MISSING_REQUIRED", function() { return ERROR_MISSING_REQUIRED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_INVALID_RESPONSE", function() { return ERROR_INVALID_RESPONSE; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_INVALID_URI", function() { return ERROR_INVALID_URI; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_QRCODE_MODAL_NOT_PROVIDED", function() { return ERROR_QRCODE_MODAL_NOT_PROVIDED; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_QRCODE_MODAL_USER_CLOSED", function() { return ERROR_QRCODE_MODAL_USER_CLOSED; }); +var ERROR_SESSION_CONNECTED = "Session currently connected"; +var ERROR_SESSION_DISCONNECTED = "Session currently disconnected"; +var ERROR_SESSION_REJECTED = "Session Rejected"; +var ERROR_MISSING_JSON_RPC = "Missing JSON RPC response"; +var ERROR_MISSING_RESULT = "JSON-RPC success response must include \"result\" field"; +var ERROR_MISSING_ERROR = "JSON-RPC error response must include \"error\" field"; +var ERROR_MISSING_METHOD = "JSON RPC request must have valid \"method\" value"; +var ERROR_MISSING_ID = "JSON RPC request must have valid \"id\" value"; +var ERROR_MISSING_REQUIRED = "Missing one of the required parameters: bridge / uri / session"; +var ERROR_INVALID_RESPONSE = "JSON RPC response format is invalid"; +var ERROR_INVALID_URI = "URI format is invalid"; +var ERROR_QRCODE_MODAL_NOT_PROVIDED = "QRCode Modal not provided"; +var ERROR_QRCODE_MODAL_USER_CLOSED = "User close QRCode Modal"; + +/***/ }), + +/***/ "./node_modules/@walletconnect/core/dist/esm/events.js": +/*!*************************************************************!*\ + !*** ./node_modules/@walletconnect/core/dist/esm/events.js ***! + \*************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/utils */ "./node_modules/@walletconnect/utils/dist/esm/index.js"); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + +var EventManager = /*#__PURE__*/function () { + function EventManager() { + _classCallCheck(this, EventManager); + + this._eventEmitters = []; + } + + _createClass(EventManager, [{ + key: "subscribe", + value: function subscribe(eventEmitter) { + this._eventEmitters.push(eventEmitter); + } + }, { + key: "unsubscribe", + value: function unsubscribe(event) { + this._eventEmitters = this._eventEmitters.filter(function (x) { + return x.event !== event; + }); + } + }, { + key: "trigger", + value: function trigger(payload) { + var eventEmitters = []; + var event; + + if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcRequest"])(payload)) { + event = payload.method; + } else if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcResponseSuccess"])(payload) || Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcResponseError"])(payload)) { + event = "response:".concat(payload.id); + } else if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isInternalEvent"])(payload)) { + event = payload.event; + } else { + event = ""; + } + + if (event) { + eventEmitters = this._eventEmitters.filter(function (eventEmitter) { + return eventEmitter.event === event; + }); + } + + if ((!eventEmitters || !eventEmitters.length) && !Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isReservedEvent"])(event) && !Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isInternalEvent"])(event)) { + eventEmitters = this._eventEmitters.filter(function (eventEmitter) { + return eventEmitter.event === "call_request"; + }); + } + + eventEmitters.forEach(function (eventEmitter) { + if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcResponseError"])(payload)) { + var error = new Error(payload.error.message); + eventEmitter.callback(error, null); + } else { + eventEmitter.callback(null, payload); + } + }); + } + }]); + + return EventManager; +}(); + +/* harmony default export */ __webpack_exports__["default"] = (EventManager); + +/***/ }), + +/***/ "./node_modules/@walletconnect/core/dist/esm/index.js": +/*!************************************************************!*\ + !*** ./node_modules/@walletconnect/core/dist/esm/index.js ***! + \************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/utils */ "./node_modules/@walletconnect/utils/dist/esm/index.js"); +/* harmony import */ var _walletconnect_socket_transport__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/socket-transport */ "./node_modules/@walletconnect/socket-transport/dist/esm/index.js"); +/* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors */ "./node_modules/@walletconnect/core/dist/esm/errors.js"); +/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./events */ "./node_modules/@walletconnect/core/dist/esm/events.js"); +/* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./storage */ "./node_modules/@walletconnect/core/dist/esm/storage.js"); +/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./url */ "./node_modules/@walletconnect/core/dist/esm/url.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + + + + +var Connector = /*#__PURE__*/function () { + function Connector(opts) { + _classCallCheck(this, Connector); + + this.protocol = "wc"; + this.version = 1; + this._bridge = ""; + this._key = null; + this._clientId = ""; + this._clientMeta = null; + this._peerId = ""; + this._peerMeta = null; + this._handshakeId = 0; + this._handshakeTopic = ""; + this._connected = false; + this._accounts = []; + this._chainId = 0; + this._networkId = 0; + this._rpcUrl = ""; + this._eventManager = new _events__WEBPACK_IMPORTED_MODULE_3__["default"](); + this._clientMeta = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["getClientMeta"])() || opts.connectorOpts.clientMeta || null; + this._cryptoLib = opts.cryptoLib; + this._sessionStorage = opts.sessionStorage || new _storage__WEBPACK_IMPORTED_MODULE_4__["default"](opts.connectorOpts.storageId); + this._qrcodeModal = opts.connectorOpts.qrcodeModal; + this._qrcodeModalOptions = opts.connectorOpts.qrcodeModalOptions; + this._signingMethods = [].concat(_toConsumableArray(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["signingMethods"]), _toConsumableArray(opts.connectorOpts.signingMethods || [])); + + if (!opts.connectorOpts.bridge && !opts.connectorOpts.uri && !opts.connectorOpts.session) { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_MISSING_REQUIRED"]); + } + + if (opts.connectorOpts.bridge) { + this.bridge = Object(_url__WEBPACK_IMPORTED_MODULE_5__["getBridgeUrl"])(opts.connectorOpts.bridge); + } + + if (opts.connectorOpts.uri) { + this.uri = opts.connectorOpts.uri; + } + + var session = opts.connectorOpts.session || this._getStorageSession(); + + if (session) { + this.session = session; + } + + if (this.handshakeId) { + this._subscribeToSessionResponse(this.handshakeId, "Session request rejected"); + } + + this._transport = opts.transport || new _walletconnect_socket_transport__WEBPACK_IMPORTED_MODULE_1__["default"]({ + protocol: this.protocol, + version: this.version, + url: this.bridge, + subscriptions: [this.clientId] + }); + + this._subscribeToInternalEvents(); + + this._initTransport(); + + if (opts.connectorOpts.uri) { + this._subscribeToSessionRequest(); + } + + if (opts.pushServerOpts) { + this._registerPushServer(opts.pushServerOpts); + } + } + + _createClass(Connector, [{ + key: "bridge", + get: function get() { + return this._bridge; + }, + set: function set(value) { + if (!value) { + return; + } + + this._bridge = value; + } + }, { + key: "key", + get: function get() { + if (this._key) { + var key = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["convertArrayBufferToHex"])(this._key, true); + return key; + } + + return ""; + }, + set: function set(value) { + if (!value) { + return; + } + + var key = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["convertHexToArrayBuffer"])(value); + this._key = key; + } + }, { + key: "clientId", + get: function get() { + var clientId = this._clientId; + + if (!clientId) { + clientId = this._clientId = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["uuid"])(); + } + + return this._clientId; + }, + set: function set(value) { + if (!value) { + return; + } + + this._clientId = value; + } + }, { + key: "peerId", + get: function get() { + return this._peerId; + }, + set: function set(value) { + if (!value) { + return; + } + + this._peerId = value; + } + }, { + key: "clientMeta", + get: function get() { + var clientMeta = this._clientMeta; + + if (!clientMeta) { + clientMeta = this._clientMeta = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["getClientMeta"])(); + } + + return clientMeta; + }, + set: function set(value) {} + }, { + key: "peerMeta", + get: function get() { + var peerMeta = this._peerMeta; + return peerMeta; + }, + set: function set(value) { + this._peerMeta = value; + } + }, { + key: "handshakeTopic", + get: function get() { + return this._handshakeTopic; + }, + set: function set(value) { + if (!value) { + return; + } + + this._handshakeTopic = value; + } + }, { + key: "handshakeId", + get: function get() { + return this._handshakeId; + }, + set: function set(value) { + if (!value) { + return; + } + + this._handshakeId = value; + } + }, { + key: "uri", + get: function get() { + var _uri = this._formatUri(); + + return _uri; + }, + set: function set(value) { + if (!value) { + return; + } + + var _this$_parseUri = this._parseUri(value), + handshakeTopic = _this$_parseUri.handshakeTopic, + bridge = _this$_parseUri.bridge, + key = _this$_parseUri.key; + + this.handshakeTopic = handshakeTopic; + this.bridge = bridge; + this.key = key; + } + }, { + key: "chainId", + get: function get() { + var chainId = this._chainId; + return chainId; + }, + set: function set(value) { + this._chainId = value; + } + }, { + key: "networkId", + get: function get() { + var networkId = this._networkId; + return networkId; + }, + set: function set(value) { + this._networkId = value; + } + }, { + key: "accounts", + get: function get() { + var accounts = this._accounts; + return accounts; + }, + set: function set(value) { + this._accounts = value; + } + }, { + key: "rpcUrl", + get: function get() { + var rpcUrl = this._rpcUrl; + return rpcUrl; + }, + set: function set(value) { + this._rpcUrl = value; + } + }, { + key: "connected", + get: function get() { + return this._connected; + }, + set: function set(value) {} + }, { + key: "pending", + get: function get() { + return !!this._handshakeTopic; + }, + set: function set(value) {} + }, { + key: "session", + get: function get() { + return { + connected: this.connected, + accounts: this.accounts, + chainId: this.chainId, + bridge: this.bridge, + key: this.key, + clientId: this.clientId, + clientMeta: this.clientMeta, + peerId: this.peerId, + peerMeta: this.peerMeta, + handshakeId: this.handshakeId, + handshakeTopic: this.handshakeTopic + }; + }, + set: function set(value) { + if (!value) { + return; + } + + this._connected = value.connected; + this.accounts = value.accounts; + this.chainId = value.chainId; + this.bridge = value.bridge; + this.key = value.key; + this.clientId = value.clientId; + this.clientMeta = value.clientMeta; + this.peerId = value.peerId; + this.peerMeta = value.peerMeta; + this.handshakeId = value.handshakeId; + this.handshakeTopic = value.handshakeTopic; + } + }, { + key: "on", + value: function on(event, callback) { + var eventEmitter = { + event: event, + callback: callback + }; + + this._eventManager.subscribe(eventEmitter); + } + }, { + key: "off", + value: function off(event) { + this._eventManager.unsubscribe(event); + } + }, { + key: "createInstantRequest", + value: function () { + var _createInstantRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(instantRequest) { + var _this = this; + + var request, endInstantRequest, result; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return this._generateKey(); + + case 2: + this._key = _context.sent; + request = this._formatRequest({ + method: "wc_instantRequest", + params: [{ + peerId: this.clientId, + peerMeta: this.clientMeta, + request: this._formatRequest(instantRequest) + }] + }); + this.handshakeId = request.id; + this.handshakeTopic = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["uuid"])(); + + this._eventManager.trigger({ + event: "display_uri", + params: [this.uri] + }); + + this.on("modal_closed", function () { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_QRCODE_MODAL_USER_CLOSED"]); + }); + + endInstantRequest = function endInstantRequest() { + _this.killSession(); + }; + + _context.prev = 9; + _context.next = 12; + return this._sendCallRequest(request); + + case 12: + result = _context.sent; + + if (result) { + endInstantRequest(); + } + + return _context.abrupt("return", result); + + case 17: + _context.prev = 17; + _context.t0 = _context["catch"](9); + endInstantRequest(); + throw _context.t0; + + case 21: + case "end": + return _context.stop(); + } + } + }, _callee, this, [[9, 17]]); + })); + + function createInstantRequest(_x) { + return _createInstantRequest.apply(this, arguments); + } + + return createInstantRequest; + }() + }, { + key: "connect", + value: function () { + var _connect = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(opts) { + var _this2 = this; + + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (this._qrcodeModal) { + _context3.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_QRCODE_MODAL_NOT_PROVIDED"]); + + case 2: + if (!this.connected) { + _context3.next = 4; + break; + } + + return _context3.abrupt("return", { + chainId: this.chainId, + accounts: this.accounts + }); + + case 4: + _context3.next = 6; + return this.createSession(opts); + + case 6: + return _context3.abrupt("return", new Promise( /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(resolve, reject) { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _this2.on("modal_closed", function () { + return reject(new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_QRCODE_MODAL_USER_CLOSED"])); + }); + + _this2.on("connect", function (error, payload) { + if (error) { + return reject(error); + } + + resolve(payload.params[0]); + }); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + + return function (_x3, _x4) { + return _ref.apply(this, arguments); + }; + }())); + + case 7: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function connect(_x2) { + return _connect.apply(this, arguments); + } + + return connect; + }() + }, { + key: "createSession", + value: function () { + var _createSession = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(opts) { + var request; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + if (!this._connected) { + _context4.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_CONNECTED"]); + + case 2: + if (!this.pending) { + _context4.next = 4; + break; + } + + return _context4.abrupt("return"); + + case 4: + _context4.next = 6; + return this._generateKey(); + + case 6: + this._key = _context4.sent; + request = this._formatRequest({ + method: "wc_sessionRequest", + params: [{ + peerId: this.clientId, + peerMeta: this.clientMeta, + chainId: opts && opts.chainId ? opts.chainId : null + }] + }); + this.handshakeId = request.id; + this.handshakeTopic = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["uuid"])(); + + this._sendSessionRequest(request, "Session update rejected", { + topic: this.handshakeTopic + }); + + this._eventManager.trigger({ + event: "display_uri", + params: [this.uri] + }); + + case 12: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function createSession(_x5) { + return _createSession.apply(this, arguments); + } + + return createSession; + }() + }, { + key: "approveSession", + value: function approveSession(sessionStatus) { + if (this._connected) { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_CONNECTED"]); + } + + this.chainId = sessionStatus.chainId; + this.accounts = sessionStatus.accounts; + this.networkId = sessionStatus.networkId || 0; + this.rpcUrl = sessionStatus.rpcUrl || ""; + var sessionParams = { + approved: true, + chainId: this.chainId, + networkId: this.networkId, + accounts: this.accounts, + rpcUrl: this.rpcUrl, + peerId: this.clientId, + peerMeta: this.clientMeta + }; + var response = { + id: this.handshakeId, + jsonrpc: "2.0", + result: sessionParams + }; + + this._sendResponse(response); + + this._connected = true; + + this._setStorageSession(); + + this._eventManager.trigger({ + event: "connect", + params: [{ + peerId: this.peerId, + peerMeta: this.peerMeta, + chainId: this.chainId, + accounts: this.accounts + }] + }); + } + }, { + key: "rejectSession", + value: function rejectSession(sessionError) { + if (this._connected) { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_CONNECTED"]); + } + + var message = sessionError && sessionError.message ? sessionError.message : _errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_REJECTED"]; + + var response = this._formatResponse({ + id: this.handshakeId, + error: { + message: message + } + }); + + this._sendResponse(response); + + this._connected = false; + + this._eventManager.trigger({ + event: "disconnect", + params: [{ + message: message + }] + }); + + this._removeStorageSession(); + } + }, { + key: "updateSession", + value: function updateSession(sessionStatus) { + if (!this._connected) { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_DISCONNECTED"]); + } + + this.chainId = sessionStatus.chainId; + this.accounts = sessionStatus.accounts; + this.networkId = sessionStatus.networkId || 0; + this.rpcUrl = sessionStatus.rpcUrl || ""; + var sessionParams = { + approved: true, + chainId: this.chainId, + networkId: this.networkId, + accounts: this.accounts, + rpcUrl: this.rpcUrl + }; + + var request = this._formatRequest({ + method: "wc_sessionUpdate", + params: [sessionParams] + }); + + this._sendSessionRequest(request, "Session update rejected"); + + this._eventManager.trigger({ + event: "session_update", + params: [{ + chainId: this.chainId, + accounts: this.accounts + }] + }); + + this._manageStorageSession(); + } + }, { + key: "killSession", + value: function () { + var _killSession = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(sessionError) { + var message, sessionParams, request; + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + message = sessionError ? sessionError.message : "Session Disconnected"; + sessionParams = { + approved: false, + chainId: null, + networkId: null, + accounts: null + }; + request = this._formatRequest({ + method: "wc_sessionUpdate", + params: [sessionParams] + }); + _context5.next = 5; + return this._sendRequest(request); + + case 5: + this._handleSessionDisconnect(message); + + case 6: + case "end": + return _context5.stop(); + } + } + }, _callee5, this); + })); + + function killSession(_x6) { + return _killSession.apply(this, arguments); + } + + return killSession; + }() + }, { + key: "sendTransaction", + value: function () { + var _sendTransaction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(tx) { + var parsedTx, request, result; + return regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + if (this._connected) { + _context6.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_DISCONNECTED"]); + + case 2: + parsedTx = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["parseTransactionData"])(tx); + request = this._formatRequest({ + method: "eth_sendTransaction", + params: [parsedTx] + }); + _context6.next = 6; + return this._sendCallRequest(request); + + case 6: + result = _context6.sent; + return _context6.abrupt("return", result); + + case 8: + case "end": + return _context6.stop(); + } + } + }, _callee6, this); + })); + + function sendTransaction(_x7) { + return _sendTransaction.apply(this, arguments); + } + + return sendTransaction; + }() + }, { + key: "signTransaction", + value: function () { + var _signTransaction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(tx) { + var parsedTx, request, result; + return regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + if (this._connected) { + _context7.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_DISCONNECTED"]); + + case 2: + parsedTx = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["parseTransactionData"])(tx); + request = this._formatRequest({ + method: "eth_signTransaction", + params: [parsedTx] + }); + _context7.next = 6; + return this._sendCallRequest(request); + + case 6: + result = _context7.sent; + return _context7.abrupt("return", result); + + case 8: + case "end": + return _context7.stop(); + } + } + }, _callee7, this); + })); + + function signTransaction(_x8) { + return _signTransaction.apply(this, arguments); + } + + return signTransaction; + }() + }, { + key: "signMessage", + value: function () { + var _signMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(params) { + var request, result; + return regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + if (this._connected) { + _context8.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_DISCONNECTED"]); + + case 2: + request = this._formatRequest({ + method: "eth_sign", + params: params + }); + _context8.next = 5; + return this._sendCallRequest(request); + + case 5: + result = _context8.sent; + return _context8.abrupt("return", result); + + case 7: + case "end": + return _context8.stop(); + } + } + }, _callee8, this); + })); + + function signMessage(_x9) { + return _signMessage.apply(this, arguments); + } + + return signMessage; + }() + }, { + key: "signPersonalMessage", + value: function () { + var _signPersonalMessage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(params) { + var request, result; + return regeneratorRuntime.wrap(function _callee9$(_context9) { + while (1) { + switch (_context9.prev = _context9.next) { + case 0: + if (this._connected) { + _context9.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_DISCONNECTED"]); + + case 2: + params = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["parsePersonalSign"])(params); + request = this._formatRequest({ + method: "personal_sign", + params: params + }); + _context9.next = 6; + return this._sendCallRequest(request); + + case 6: + result = _context9.sent; + return _context9.abrupt("return", result); + + case 8: + case "end": + return _context9.stop(); + } + } + }, _callee9, this); + })); + + function signPersonalMessage(_x10) { + return _signPersonalMessage.apply(this, arguments); + } + + return signPersonalMessage; + }() + }, { + key: "signTypedData", + value: function () { + var _signTypedData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(params) { + var request, result; + return regeneratorRuntime.wrap(function _callee10$(_context10) { + while (1) { + switch (_context10.prev = _context10.next) { + case 0: + if (this._connected) { + _context10.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_DISCONNECTED"]); + + case 2: + request = this._formatRequest({ + method: "eth_signTypedData", + params: params + }); + _context10.next = 5; + return this._sendCallRequest(request); + + case 5: + result = _context10.sent; + return _context10.abrupt("return", result); + + case 7: + case "end": + return _context10.stop(); + } + } + }, _callee10, this); + })); + + function signTypedData(_x11) { + return _signTypedData.apply(this, arguments); + } + + return signTypedData; + }() + }, { + key: "updateChain", + value: function () { + var _updateChain = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(chainParams) { + var request, result; + return regeneratorRuntime.wrap(function _callee11$(_context11) { + while (1) { + switch (_context11.prev = _context11.next) { + case 0: + if (this._connected) { + _context11.next = 2; + break; + } + + throw new Error("Session currently disconnected"); + + case 2: + request = this._formatRequest({ + method: "wallet_updateChain", + params: [chainParams] + }); + _context11.next = 5; + return this._sendCallRequest(request); + + case 5: + result = _context11.sent; + return _context11.abrupt("return", result); + + case 7: + case "end": + return _context11.stop(); + } + } + }, _callee11, this); + })); + + function updateChain(_x12) { + return _updateChain.apply(this, arguments); + } + + return updateChain; + }() + }, { + key: "unsafeSend", + value: function unsafeSend(request, options) { + var _this3 = this; + + this._sendRequest(request, options); + + this._eventManager.trigger({ + event: "call_request_sent", + params: [{ + request: request, + options: options + }] + }); + + return new Promise(function (resolve, reject) { + _this3._subscribeToResponse(request.id, function (error, payload) { + if (error) { + reject(error); + return; + } + + if (!payload) { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_MISSING_JSON_RPC"]); + } + + resolve(payload); + }); + }); + } + }, { + key: "sendCustomRequest", + value: function () { + var _sendCustomRequest = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(request, options) { + var formattedRequest, result; + return regeneratorRuntime.wrap(function _callee12$(_context12) { + while (1) { + switch (_context12.prev = _context12.next) { + case 0: + if (this._connected) { + _context12.next = 2; + break; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_SESSION_DISCONNECTED"]); + + case 2: + _context12.t0 = request.method; + _context12.next = _context12.t0 === "eth_accounts" ? 5 : _context12.t0 === "eth_chainId" ? 6 : _context12.t0 === "eth_sendTransaction" ? 7 : _context12.t0 === "eth_signTransaction" ? 7 : _context12.t0 === "personal_sign" ? 9 : 11; + break; + + case 5: + return _context12.abrupt("return", this.accounts); + + case 6: + return _context12.abrupt("return", Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["convertNumberToHex"])(this.chainId)); + + case 7: + if (request.params) { + request.params[0] = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["parseTransactionData"])(request.params[0]); + } + + return _context12.abrupt("break", 12); + + case 9: + if (request.params) { + request.params = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["parsePersonalSign"])(request.params); + } + + return _context12.abrupt("break", 12); + + case 11: + return _context12.abrupt("break", 12); + + case 12: + formattedRequest = this._formatRequest(request); + _context12.next = 15; + return this._sendCallRequest(formattedRequest, options); + + case 15: + result = _context12.sent; + return _context12.abrupt("return", result); + + case 17: + case "end": + return _context12.stop(); + } + } + }, _callee12, this); + })); + + function sendCustomRequest(_x13, _x14) { + return _sendCustomRequest.apply(this, arguments); + } + + return sendCustomRequest; + }() + }, { + key: "approveRequest", + value: function approveRequest(response) { + if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcResponseSuccess"])(response)) { + var formattedResponse = this._formatResponse(response); + + this._sendResponse(formattedResponse); + } else { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_MISSING_RESULT"]); + } + } + }, { + key: "rejectRequest", + value: function rejectRequest(response) { + if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcResponseError"])(response)) { + var formattedResponse = this._formatResponse(response); + + this._sendResponse(formattedResponse); + } else { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_MISSING_ERROR"]); + } + } + }, { + key: "transportClose", + value: function transportClose() { + this._transport.close(); + } + }, { + key: "_sendRequest", + value: function () { + var _sendRequest2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(request, options) { + var callRequest, encryptionPayload, topic, payload, silent; + return regeneratorRuntime.wrap(function _callee13$(_context13) { + while (1) { + switch (_context13.prev = _context13.next) { + case 0: + callRequest = this._formatRequest(request); + _context13.next = 3; + return this._encrypt(callRequest); + + case 3: + encryptionPayload = _context13.sent; + topic = typeof (options === null || options === void 0 ? void 0 : options.topic) !== "undefined" ? options.topic : this.peerId; + payload = JSON.stringify(encryptionPayload); + silent = typeof (options === null || options === void 0 ? void 0 : options.forcePushNotification) !== "undefined" ? !options.forcePushNotification : Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isSilentPayload"])(callRequest); + + this._transport.send(payload, topic, silent); + + case 8: + case "end": + return _context13.stop(); + } + } + }, _callee13, this); + })); + + function _sendRequest(_x15, _x16) { + return _sendRequest2.apply(this, arguments); + } + + return _sendRequest; + }() + }, { + key: "_sendResponse", + value: function () { + var _sendResponse2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(response) { + var encryptionPayload, topic, payload, silent; + return regeneratorRuntime.wrap(function _callee14$(_context14) { + while (1) { + switch (_context14.prev = _context14.next) { + case 0: + _context14.next = 2; + return this._encrypt(response); + + case 2: + encryptionPayload = _context14.sent; + topic = this.peerId; + payload = JSON.stringify(encryptionPayload); + silent = true; + + this._transport.send(payload, topic, silent); + + case 7: + case "end": + return _context14.stop(); + } + } + }, _callee14, this); + })); + + function _sendResponse(_x17) { + return _sendResponse2.apply(this, arguments); + } + + return _sendResponse; + }() + }, { + key: "_sendSessionRequest", + value: function () { + var _sendSessionRequest2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(request, errorMsg, options) { + return regeneratorRuntime.wrap(function _callee15$(_context15) { + while (1) { + switch (_context15.prev = _context15.next) { + case 0: + this._sendRequest(request, options); + + this._subscribeToSessionResponse(request.id, errorMsg); + + case 2: + case "end": + return _context15.stop(); + } + } + }, _callee15, this); + })); + + function _sendSessionRequest(_x18, _x19, _x20) { + return _sendSessionRequest2.apply(this, arguments); + } + + return _sendSessionRequest; + }() + }, { + key: "_sendCallRequest", + value: function _sendCallRequest(request, options) { + this._sendRequest(request, options); + + this._eventManager.trigger({ + event: "call_request_sent", + params: [{ + request: request, + options: options + }] + }); + + return this._subscribeToCallResponse(request.id); + } + }, { + key: "_formatRequest", + value: function _formatRequest(request) { + if (typeof request.method === "undefined") { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_MISSING_METHOD"]); + } + + var formattedRequest = { + id: typeof request.id === "undefined" ? Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["payloadId"])() : request.id, + jsonrpc: "2.0", + method: request.method, + params: typeof request.params === "undefined" ? [] : request.params + }; + return formattedRequest; + } + }, { + key: "_formatResponse", + value: function _formatResponse(response) { + if (typeof response.id === "undefined") { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_MISSING_ID"]); + } + + var baseResponse = { + id: response.id, + jsonrpc: "2.0" + }; + + if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcResponseError"])(response)) { + var error = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["formatRpcError"])(response.error); + var errorResponse = Object.assign(Object.assign(Object.assign({}, baseResponse), response), { + error: error + }); + return errorResponse; + } else if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isJsonRpcResponseSuccess"])(response)) { + var successResponse = Object.assign(Object.assign({}, baseResponse), response); + return successResponse; + } + + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_INVALID_RESPONSE"]); + } + }, { + key: "_handleSessionDisconnect", + value: function _handleSessionDisconnect(errorMsg) { + var message = errorMsg || "Session Disconnected"; + + if (!this._connected) { + if (this._qrcodeModal) { + this._qrcodeModal.close(); + } + + Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["removeLocal"])(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["mobileLinkChoiceKey"]); + } + + if (this._connected) { + this._connected = false; + } + + if (this._handshakeId) { + this._handshakeId = 0; + } + + if (this._handshakeTopic) { + this._handshakeTopic = ""; + } + + if (this._peerId) { + this._peerId = ""; + } + + this._eventManager.trigger({ + event: "disconnect", + params: [{ + message: message + }] + }); + + this._removeStorageSession(); + + this.transportClose(); + } + }, { + key: "_handleSessionResponse", + value: function _handleSessionResponse(errorMsg, sessionParams) { + if (sessionParams) { + if (sessionParams.approved) { + if (!this._connected) { + this._connected = true; + + if (sessionParams.chainId) { + this.chainId = sessionParams.chainId; + } + + if (sessionParams.accounts) { + this.accounts = sessionParams.accounts; + } + + if (sessionParams.peerId && !this.peerId) { + this.peerId = sessionParams.peerId; + } + + if (sessionParams.peerMeta && !this.peerMeta) { + this.peerMeta = sessionParams.peerMeta; + } + + this._eventManager.trigger({ + event: "connect", + params: [{ + peerId: this.peerId, + peerMeta: this.peerMeta, + chainId: this.chainId, + accounts: this.accounts + }] + }); + } else { + if (sessionParams.chainId) { + this.chainId = sessionParams.chainId; + } + + if (sessionParams.accounts) { + this.accounts = sessionParams.accounts; + } + + this._eventManager.trigger({ + event: "session_update", + params: [{ + chainId: this.chainId, + accounts: this.accounts + }] + }); + } + + this._manageStorageSession(); + } else { + this._handleSessionDisconnect(errorMsg); + } + } else { + this._handleSessionDisconnect(errorMsg); + } + } + }, { + key: "_handleIncomingMessages", + value: function () { + var _handleIncomingMessages2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16(socketMessage) { + var activeTopics, encryptionPayload, payload; + return regeneratorRuntime.wrap(function _callee16$(_context16) { + while (1) { + switch (_context16.prev = _context16.next) { + case 0: + activeTopics = [this.clientId, this.handshakeTopic]; + + if (activeTopics.includes(socketMessage.topic)) { + _context16.next = 3; + break; + } + + return _context16.abrupt("return"); + + case 3: + _context16.prev = 3; + encryptionPayload = JSON.parse(socketMessage.payload); + _context16.next = 10; + break; + + case 7: + _context16.prev = 7; + _context16.t0 = _context16["catch"](3); + return _context16.abrupt("return"); + + case 10: + _context16.next = 12; + return this._decrypt(encryptionPayload); + + case 12: + payload = _context16.sent; + + if (payload) { + this._eventManager.trigger(payload); + } + + case 14: + case "end": + return _context16.stop(); + } + } + }, _callee16, this, [[3, 7]]); + })); + + function _handleIncomingMessages(_x21) { + return _handleIncomingMessages2.apply(this, arguments); + } + + return _handleIncomingMessages; + }() + }, { + key: "_subscribeToSessionRequest", + value: function _subscribeToSessionRequest() { + this._transport.subscribe(this.handshakeTopic); + } + }, { + key: "_subscribeToResponse", + value: function _subscribeToResponse(id, callback) { + this.on("response:".concat(id), callback); + } + }, { + key: "_subscribeToSessionResponse", + value: function _subscribeToSessionResponse(id, errorMsg) { + var _this4 = this; + + this._subscribeToResponse(id, function (error, payload) { + if (error) { + _this4._handleSessionResponse(error.message); + + return; + } + + if (payload.result) { + _this4._handleSessionResponse(errorMsg, payload.result); + } else if (payload.error && payload.error.message) { + _this4._handleSessionResponse(payload.error.message); + } else { + _this4._handleSessionResponse(errorMsg); + } + }); + } + }, { + key: "_subscribeToCallResponse", + value: function _subscribeToCallResponse(id) { + var _this5 = this; + + return new Promise(function (resolve, reject) { + _this5._subscribeToResponse(id, function (error, payload) { + if (error) { + reject(error); + return; + } + + if (payload.result) { + resolve(payload.result); + } else if (payload.error && payload.error.message) { + reject(new Error(payload.error.message)); + } else { + reject(new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_INVALID_RESPONSE"])); + } + }); + }); + } + }, { + key: "_subscribeToInternalEvents", + value: function _subscribeToInternalEvents() { + var _this6 = this; + + this.on("display_uri", function () { + if (_this6._qrcodeModal) { + _this6._qrcodeModal.open(_this6.uri, function () { + _this6._eventManager.trigger({ + event: "modal_closed", + params: [] + }); + }, _this6._qrcodeModalOptions); + } + }); + this.on("connect", function () { + if (_this6._qrcodeModal) { + _this6._qrcodeModal.close(); + } + }); + this.on("call_request_sent", function (error, payload) { + var request = payload.params[0].request; + + if (Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isMobile"])() && _this6._signingMethods.includes(request.method)) { + var mobileLinkUrl = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["getLocal"])(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["mobileLinkChoiceKey"]); + + if (mobileLinkUrl) { + window.location.href = mobileLinkUrl.href; + } + } + }); + this.on("wc_sessionRequest", function (error, payload) { + if (error) { + _this6._eventManager.trigger({ + event: "error", + params: [{ + code: "SESSION_REQUEST_ERROR", + message: error.toString() + }] + }); + } + + _this6.handshakeId = payload.id; + _this6.peerId = payload.params[0].peerId; + _this6.peerMeta = payload.params[0].peerMeta; + var internalPayload = Object.assign(Object.assign({}, payload), { + method: "session_request" + }); + + _this6._eventManager.trigger(internalPayload); + }); + this.on("wc_sessionUpdate", function (error, payload) { + if (error) { + _this6._handleSessionResponse(error.message); + } + + _this6._handleSessionResponse("Session disconnected", payload.params[0]); + }); + } + }, { + key: "_initTransport", + value: function _initTransport() { + var _this7 = this; + + this._transport.on("message", function (socketMessage) { + return _this7._handleIncomingMessages(socketMessage); + }); + + this._transport.on("open", function () { + return _this7._eventManager.trigger({ + event: "transport_open", + params: [] + }); + }); + + this._transport.on("close", function () { + return _this7._eventManager.trigger({ + event: "transport_close", + params: [] + }); + }); + + this._transport.on("error", function () { + return _this7._eventManager.trigger({ + event: "transport_error", + params: ["Websocket connection failed"] + }); + }); + + this._transport.open(); + } + }, { + key: "_formatUri", + value: function _formatUri() { + var protocol = this.protocol; + var handshakeTopic = this.handshakeTopic; + var version = this.version; + var bridge = encodeURIComponent(this.bridge); + var key = this.key; + var uri = "".concat(protocol, ":").concat(handshakeTopic, "@").concat(version, "?bridge=").concat(bridge, "&key=").concat(key); + return uri; + } + }, { + key: "_parseUri", + value: function _parseUri(uri) { + var result = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["parseWalletConnectUri"])(uri); + + if (result.protocol === this.protocol) { + if (!result.handshakeTopic) { + throw Error("Invalid or missing handshakeTopic parameter value"); + } + + var handshakeTopic = result.handshakeTopic; + + if (!result.bridge) { + throw Error("Invalid or missing bridge url parameter value"); + } + + var bridge = decodeURIComponent(result.bridge); + + if (!result.key) { + throw Error("Invalid or missing key parameter value"); + } + + var key = result.key; + return { + handshakeTopic: handshakeTopic, + bridge: bridge, + key: key + }; + } else { + throw new Error(_errors__WEBPACK_IMPORTED_MODULE_2__["ERROR_INVALID_URI"]); + } + } + }, { + key: "_generateKey", + value: function () { + var _generateKey2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17() { + var result; + return regeneratorRuntime.wrap(function _callee17$(_context17) { + while (1) { + switch (_context17.prev = _context17.next) { + case 0: + if (!this._cryptoLib) { + _context17.next = 5; + break; + } + + _context17.next = 3; + return this._cryptoLib.generateKey(); + + case 3: + result = _context17.sent; + return _context17.abrupt("return", result); + + case 5: + return _context17.abrupt("return", null); + + case 6: + case "end": + return _context17.stop(); + } + } + }, _callee17, this); + })); + + function _generateKey() { + return _generateKey2.apply(this, arguments); + } + + return _generateKey; + }() + }, { + key: "_encrypt", + value: function () { + var _encrypt2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(data) { + var key, result; + return regeneratorRuntime.wrap(function _callee18$(_context18) { + while (1) { + switch (_context18.prev = _context18.next) { + case 0: + key = this._key; + + if (!(this._cryptoLib && key)) { + _context18.next = 6; + break; + } + + _context18.next = 4; + return this._cryptoLib.encrypt(data, key); + + case 4: + result = _context18.sent; + return _context18.abrupt("return", result); + + case 6: + return _context18.abrupt("return", null); + + case 7: + case "end": + return _context18.stop(); + } + } + }, _callee18, this); + })); + + function _encrypt(_x22) { + return _encrypt2.apply(this, arguments); + } + + return _encrypt; + }() + }, { + key: "_decrypt", + value: function () { + var _decrypt2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(payload) { + var key, result; + return regeneratorRuntime.wrap(function _callee19$(_context19) { + while (1) { + switch (_context19.prev = _context19.next) { + case 0: + key = this._key; + + if (!(this._cryptoLib && key)) { + _context19.next = 6; + break; + } + + _context19.next = 4; + return this._cryptoLib.decrypt(payload, key); + + case 4: + result = _context19.sent; + return _context19.abrupt("return", result); + + case 6: + return _context19.abrupt("return", null); + + case 7: + case "end": + return _context19.stop(); + } + } + }, _callee19, this); + })); + + function _decrypt(_x23) { + return _decrypt2.apply(this, arguments); + } + + return _decrypt; + }() + }, { + key: "_getStorageSession", + value: function _getStorageSession() { + var result = null; + + if (this._sessionStorage) { + result = this._sessionStorage.getSession(); + } + + return result; + } + }, { + key: "_setStorageSession", + value: function _setStorageSession() { + if (this._sessionStorage) { + this._sessionStorage.setSession(this.session); + } + } + }, { + key: "_removeStorageSession", + value: function _removeStorageSession() { + if (this._sessionStorage) { + this._sessionStorage.removeSession(); + } + } + }, { + key: "_manageStorageSession", + value: function _manageStorageSession() { + if (this._connected) { + this._setStorageSession(); + } else { + this._removeStorageSession(); + } + } + }, { + key: "_registerPushServer", + value: function _registerPushServer(pushServerOpts) { + if (!pushServerOpts.url || typeof pushServerOpts.url !== "string") { + throw Error("Invalid or missing pushServerOpts.url parameter value"); + } + + if (!pushServerOpts.type || typeof pushServerOpts.type !== "string") { + throw Error("Invalid or missing pushServerOpts.type parameter value"); + } + + if (!pushServerOpts.token || typeof pushServerOpts.token !== "string") { + throw Error("Invalid or missing pushServerOpts.token parameter value"); + } + + var pushSubscription = { + bridge: this.bridge, + topic: this.clientId, + type: pushServerOpts.type, + token: pushServerOpts.token, + peerName: "", + language: pushServerOpts.language || "" + }; + this.on("connect", /*#__PURE__*/function () { + var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(error, payload) { + var peerName, response, json; + return regeneratorRuntime.wrap(function _callee20$(_context20) { + while (1) { + switch (_context20.prev = _context20.next) { + case 0: + if (!error) { + _context20.next = 2; + break; + } + + throw error; + + case 2: + if (pushServerOpts.peerMeta) { + peerName = payload.params[0].peerMeta.name; + pushSubscription.peerName = peerName; + } + + _context20.prev = 3; + _context20.next = 6; + return fetch("".concat(pushServerOpts.url, "/new"), { + method: "POST", + headers: { + Accept: "application/json", + "Content-Type": "application/json" + }, + body: JSON.stringify(pushSubscription) + }); + + case 6: + response = _context20.sent; + _context20.next = 9; + return response.json(); + + case 9: + json = _context20.sent; + + if (json.success) { + _context20.next = 12; + break; + } + + throw Error("Failed to register in Push Server"); + + case 12: + _context20.next = 17; + break; + + case 14: + _context20.prev = 14; + _context20.t0 = _context20["catch"](3); + throw Error("Failed to register in Push Server"); + + case 17: + case "end": + return _context20.stop(); + } + } + }, _callee20, null, [[3, 14]]); + })); + + return function (_x24, _x25) { + return _ref2.apply(this, arguments); + }; + }()); + } + }]); + + return Connector; +}(); + +/* harmony default export */ __webpack_exports__["default"] = (Connector); + +/***/ }), + +/***/ "./node_modules/@walletconnect/core/dist/esm/storage.js": +/*!**************************************************************!*\ + !*** ./node_modules/@walletconnect/core/dist/esm/storage.js ***! + \**************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/utils */ "./node_modules/@walletconnect/utils/dist/esm/index.js"); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + +var SessionStorage = /*#__PURE__*/function () { + function SessionStorage() { + var storageId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "walletconnect"; + + _classCallCheck(this, SessionStorage); + + this.storageId = storageId; + } + + _createClass(SessionStorage, [{ + key: "getSession", + value: function getSession() { + var session = null; + var json = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["getLocal"])(this.storageId); + + if (json && Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isWalletConnectSession"])(json)) { + session = json; + } + + return session; + } + }, { + key: "setSession", + value: function setSession(session) { + Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["setLocal"])(this.storageId, session); + return session; + } + }, { + key: "removeSession", + value: function removeSession() { + Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["removeLocal"])(this.storageId); + } + }]); + + return SessionStorage; +}(); + +/* harmony default export */ __webpack_exports__["default"] = (SessionStorage); + +/***/ }), + +/***/ "./node_modules/@walletconnect/core/dist/esm/url.js": +/*!**********************************************************!*\ + !*** ./node_modules/@walletconnect/core/dist/esm/url.js ***! + \**********************************************************/ +/*! exports provided: extractHostname, extractRootDomain, randomBridgeIndex, selectRandomBridgeUrl, shouldSelectRandomly, getBridgeUrl */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractHostname", function() { return extractHostname; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractRootDomain", function() { return extractRootDomain; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "randomBridgeIndex", function() { return randomBridgeIndex; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "selectRandomBridgeUrl", function() { return selectRandomBridgeUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shouldSelectRandomly", function() { return shouldSelectRandomly; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getBridgeUrl", function() { return getBridgeUrl; }); +var domain = "walletconnect.org"; +var alphanumerical = "abcdefghijklmnopqrstuvwxyz0123456789"; +var bridges = alphanumerical.split("").map(function (_char) { + return "https://".concat(_char, ".bridge.walletconnect.org"); +}); +function extractHostname(url) { + var hostname = url.indexOf("//") > -1 ? url.split("/")[2] : url.split("/")[0]; + hostname = hostname.split(":")[0]; + hostname = hostname.split("?")[0]; + return hostname; +} +function extractRootDomain(url) { + return extractHostname(url).split(".").slice(-2).join("."); +} +function randomBridgeIndex() { + return Math.floor(Math.random() * bridges.length); +} +function selectRandomBridgeUrl() { + return bridges[randomBridgeIndex()]; +} +function shouldSelectRandomly(url) { + return extractRootDomain(url) === domain; +} +function getBridgeUrl(url) { + if (shouldSelectRandomly(url)) { + return selectRandomBridgeUrl(); + } + + return url; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/browser/aes.js": +/*!********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/browser/aes.js ***! + \********************************************************************/ +/*! exports provided: aesCbcEncrypt, aesCbcDecrypt */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "aesCbcEncrypt", function() { return aesCbcEncrypt; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "aesCbcDecrypt", function() { return aesCbcDecrypt; }); +/* harmony import */ var _lib_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/browser */ "./node_modules/@walletconnect/crypto/dist/esm/lib/browser.js"); + +function aesCbcEncrypt(iv, key, data) { + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserAesEncrypt"])(iv, key, data); +} +function aesCbcDecrypt(iv, key, data) { + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserAesDecrypt"])(iv, key, data); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/browser/hmac.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/browser/hmac.js ***! + \*********************************************************************/ +/*! exports provided: hmacSha256Sign, hmacSha256Verify, hmacSha512Sign, hmacSha512Verify */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hmacSha256Sign", function() { return hmacSha256Sign; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hmacSha256Verify", function() { return hmacSha256Verify; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hmacSha512Sign", function() { return hmacSha512Sign; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hmacSha512Verify", function() { return hmacSha512Verify; }); +/* harmony import */ var _lib_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/browser */ "./node_modules/@walletconnect/crypto/dist/esm/lib/browser.js"); +/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../helpers */ "./node_modules/@walletconnect/crypto/dist/esm/helpers/index.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + + + +function hmacSha256Sign(_x, _x2) { + return _hmacSha256Sign.apply(this, arguments); +} + +function _hmacSha256Sign() { + _hmacSha256Sign = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(key, msg) { + var result; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserHmacSha256Sign"])(key, msg); + + case 2: + result = _context.sent; + return _context.abrupt("return", result); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _hmacSha256Sign.apply(this, arguments); +} + +function hmacSha256Verify(_x3, _x4, _x5) { + return _hmacSha256Verify.apply(this, arguments); +} + +function _hmacSha256Verify() { + _hmacSha256Verify = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(key, msg, sig) { + var expectedSig, result; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserHmacSha256Sign"])(key, msg); + + case 2: + expectedSig = _context2.sent; + result = Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["isConstantTime"])(expectedSig, sig); + return _context2.abrupt("return", result); + + case 5: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + return _hmacSha256Verify.apply(this, arguments); +} + +function hmacSha512Sign(_x6, _x7) { + return _hmacSha512Sign.apply(this, arguments); +} + +function _hmacSha512Sign() { + _hmacSha512Sign = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(key, msg) { + var result; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _context3.next = 2; + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserHmacSha512Sign"])(key, msg); + + case 2: + result = _context3.sent; + return _context3.abrupt("return", result); + + case 4: + case "end": + return _context3.stop(); + } + } + }, _callee3); + })); + return _hmacSha512Sign.apply(this, arguments); +} + +function hmacSha512Verify(_x8, _x9, _x10) { + return _hmacSha512Verify.apply(this, arguments); +} + +function _hmacSha512Verify() { + _hmacSha512Verify = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(key, msg, sig) { + var expectedSig, result; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _context4.next = 2; + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserHmacSha512Sign"])(key, msg); + + case 2: + expectedSig = _context4.sent; + result = Object(_helpers__WEBPACK_IMPORTED_MODULE_1__["isConstantTime"])(expectedSig, sig); + return _context4.abrupt("return", result); + + case 5: + case "end": + return _context4.stop(); + } + } + }, _callee4); + })); + return _hmacSha512Verify.apply(this, arguments); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/browser/index.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/browser/index.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_randombytes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/randombytes */ "./node_modules/@walletconnect/randombytes/dist/esm/browser/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "randomBytes", function() { return _walletconnect_randombytes__WEBPACK_IMPORTED_MODULE_0__["randomBytes"]; }); + +/* harmony import */ var _aes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./aes */ "./node_modules/@walletconnect/crypto/dist/esm/browser/aes.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "aesCbcEncrypt", function() { return _aes__WEBPACK_IMPORTED_MODULE_1__["aesCbcEncrypt"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "aesCbcDecrypt", function() { return _aes__WEBPACK_IMPORTED_MODULE_1__["aesCbcDecrypt"]; }); + +/* harmony import */ var _hmac__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hmac */ "./node_modules/@walletconnect/crypto/dist/esm/browser/hmac.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hmacSha256Sign", function() { return _hmac__WEBPACK_IMPORTED_MODULE_2__["hmacSha256Sign"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hmacSha256Verify", function() { return _hmac__WEBPACK_IMPORTED_MODULE_2__["hmacSha256Verify"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hmacSha512Sign", function() { return _hmac__WEBPACK_IMPORTED_MODULE_2__["hmacSha512Sign"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hmacSha512Verify", function() { return _hmac__WEBPACK_IMPORTED_MODULE_2__["hmacSha512Verify"]; }); + +/* harmony import */ var _sha2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sha2 */ "./node_modules/@walletconnect/crypto/dist/esm/browser/sha2.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sha256", function() { return _sha2__WEBPACK_IMPORTED_MODULE_3__["sha256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sha512", function() { return _sha2__WEBPACK_IMPORTED_MODULE_3__["sha512"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ripemd160", function() { return _sha2__WEBPACK_IMPORTED_MODULE_3__["ripemd160"]; }); + +/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../helpers */ "./node_modules/@walletconnect/crypto/dist/esm/helpers/index.js"); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _helpers__WEBPACK_IMPORTED_MODULE_4__) if(["default","randomBytes","aesCbcEncrypt","aesCbcDecrypt","hmacSha256Sign","hmacSha256Verify","hmacSha512Sign","hmacSha512Verify","sha256","sha512","ripemd160"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _helpers__WEBPACK_IMPORTED_MODULE_4__[key]; }) }(__WEBPACK_IMPORT_KEY__)); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../constants */ "./node_modules/@walletconnect/crypto/dist/esm/constants/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AES_LENGTH", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["AES_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_LENGTH", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["HMAC_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AES_BROWSER_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["AES_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_BROWSER_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["HMAC_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_BROWSER", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["HMAC_BROWSER"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA256_BROWSER_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["SHA256_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA512_BROWSER_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["SHA512_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AES_NODE_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["AES_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_NODE_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["HMAC_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA256_NODE_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["SHA256_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA512_NODE_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["SHA512_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RIPEMD160_NODE_ALGO", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["RIPEMD160_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PREFIX_LENGTH", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["PREFIX_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KEY_LENGTH", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["KEY_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IV_LENGTH", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["IV_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAC_LENGTH", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["MAC_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HEX_ENC", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["HEX_ENC"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UTF8_ENC", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["UTF8_ENC"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_BAD_MAC", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["ERROR_BAD_MAC"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_0", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_0"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_1", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_1"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_16", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_16"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_32", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_32"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_64", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_64"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_128", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_128"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_256", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_512", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_512"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_1024", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["LENGTH_1024"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ENCRYPT_OP", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["ENCRYPT_OP"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DECRYPT_OP", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["DECRYPT_OP"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SIGN_OP", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["SIGN_OP"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VERIFY_OP", function() { return _constants__WEBPACK_IMPORTED_MODULE_5__["VERIFY_OP"]; }); + + + + + + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/browser/sha2.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/browser/sha2.js ***! + \*********************************************************************/ +/*! exports provided: sha256, sha512, ripemd160 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sha256", function() { return sha256; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sha512", function() { return sha512; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ripemd160", function() { return ripemd160; }); +/* harmony import */ var _lib_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/browser */ "./node_modules/@walletconnect/crypto/dist/esm/lib/browser.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + + +function sha256(_x) { + return _sha.apply(this, arguments); +} + +function _sha() { + _sha = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(msg) { + var result; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.next = 2; + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserSha256"])(msg); + + case 2: + result = _context.sent; + return _context.abrupt("return", result); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _sha.apply(this, arguments); +} + +function sha512(_x2) { + return _sha2.apply(this, arguments); +} + +function _sha2() { + _sha2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(msg) { + var result; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return Object(_lib_browser__WEBPACK_IMPORTED_MODULE_0__["browserSha512"])(msg); + + case 2: + result = _context2.sent; + return _context2.abrupt("return", result); + + case 4: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + return _sha2.apply(this, arguments); +} + +function ripemd160(_x3) { + return _ripemd.apply(this, arguments); +} + +function _ripemd() { + _ripemd = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(msg) { + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + throw new Error("Not supported for Browser async methods, use sync instead!"); + + case 1: + case "end": + return _context3.stop(); + } + } + }, _callee3); + })); + return _ripemd.apply(this, arguments); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/constants/default.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/constants/default.js ***! + \**************************************************************************/ +/*! exports provided: AES_LENGTH, HMAC_LENGTH, AES_BROWSER_ALGO, HMAC_BROWSER_ALGO, HMAC_BROWSER, SHA256_BROWSER_ALGO, SHA512_BROWSER_ALGO, AES_NODE_ALGO, HMAC_NODE_ALGO, SHA256_NODE_ALGO, SHA512_NODE_ALGO, RIPEMD160_NODE_ALGO, PREFIX_LENGTH, KEY_LENGTH, IV_LENGTH, MAC_LENGTH */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AES_LENGTH", function() { return AES_LENGTH; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HMAC_LENGTH", function() { return HMAC_LENGTH; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AES_BROWSER_ALGO", function() { return AES_BROWSER_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HMAC_BROWSER_ALGO", function() { return HMAC_BROWSER_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HMAC_BROWSER", function() { return HMAC_BROWSER; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SHA256_BROWSER_ALGO", function() { return SHA256_BROWSER_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SHA512_BROWSER_ALGO", function() { return SHA512_BROWSER_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AES_NODE_ALGO", function() { return AES_NODE_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HMAC_NODE_ALGO", function() { return HMAC_NODE_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SHA256_NODE_ALGO", function() { return SHA256_NODE_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SHA512_NODE_ALGO", function() { return SHA512_NODE_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RIPEMD160_NODE_ALGO", function() { return RIPEMD160_NODE_ALGO; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PREFIX_LENGTH", function() { return PREFIX_LENGTH; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KEY_LENGTH", function() { return KEY_LENGTH; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IV_LENGTH", function() { return IV_LENGTH; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MAC_LENGTH", function() { return MAC_LENGTH; }); +/* harmony import */ var _length__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./length */ "./node_modules/@walletconnect/crypto/dist/esm/constants/length.js"); + +var AES_LENGTH = _length__WEBPACK_IMPORTED_MODULE_0__["LENGTH_256"]; +var HMAC_LENGTH = _length__WEBPACK_IMPORTED_MODULE_0__["LENGTH_256"]; +var AES_BROWSER_ALGO = "AES-CBC"; +var HMAC_BROWSER_ALGO = "SHA-".concat(AES_LENGTH); +var HMAC_BROWSER = "HMAC"; +var SHA256_BROWSER_ALGO = "SHA-256"; +var SHA512_BROWSER_ALGO = "SHA-512"; +var AES_NODE_ALGO = "aes-".concat(AES_LENGTH, "-cbc"); +var HMAC_NODE_ALGO = "sha".concat(HMAC_LENGTH); +var SHA256_NODE_ALGO = "sha256"; +var SHA512_NODE_ALGO = "sha512"; +var RIPEMD160_NODE_ALGO = "ripemd160"; +var PREFIX_LENGTH = _length__WEBPACK_IMPORTED_MODULE_0__["LENGTH_1"]; +var KEY_LENGTH = _length__WEBPACK_IMPORTED_MODULE_0__["LENGTH_32"]; +var IV_LENGTH = _length__WEBPACK_IMPORTED_MODULE_0__["LENGTH_16"]; +var MAC_LENGTH = _length__WEBPACK_IMPORTED_MODULE_0__["LENGTH_32"]; + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/constants/encoding.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/constants/encoding.js ***! + \***************************************************************************/ +/*! exports provided: HEX_ENC, UTF8_ENC */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HEX_ENC", function() { return HEX_ENC; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UTF8_ENC", function() { return UTF8_ENC; }); +var HEX_ENC = "hex"; +var UTF8_ENC = "utf8"; + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/constants/error.js": +/*!************************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/constants/error.js ***! + \************************************************************************/ +/*! exports provided: ERROR_BAD_MAC */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_BAD_MAC", function() { return ERROR_BAD_MAC; }); +var ERROR_BAD_MAC = "Bad MAC"; + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/constants/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/constants/index.js ***! + \************************************************************************/ +/*! exports provided: AES_LENGTH, HMAC_LENGTH, AES_BROWSER_ALGO, HMAC_BROWSER_ALGO, HMAC_BROWSER, SHA256_BROWSER_ALGO, SHA512_BROWSER_ALGO, AES_NODE_ALGO, HMAC_NODE_ALGO, SHA256_NODE_ALGO, SHA512_NODE_ALGO, RIPEMD160_NODE_ALGO, PREFIX_LENGTH, KEY_LENGTH, IV_LENGTH, MAC_LENGTH, HEX_ENC, UTF8_ENC, ERROR_BAD_MAC, LENGTH_0, LENGTH_1, LENGTH_16, LENGTH_32, LENGTH_64, LENGTH_128, LENGTH_256, LENGTH_512, LENGTH_1024, ENCRYPT_OP, DECRYPT_OP, SIGN_OP, VERIFY_OP */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _default__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./default */ "./node_modules/@walletconnect/crypto/dist/esm/constants/default.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AES_LENGTH", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["AES_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_LENGTH", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["HMAC_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AES_BROWSER_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["AES_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_BROWSER_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["HMAC_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_BROWSER", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["HMAC_BROWSER"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA256_BROWSER_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["SHA256_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA512_BROWSER_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["SHA512_BROWSER_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AES_NODE_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["AES_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HMAC_NODE_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["HMAC_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA256_NODE_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["SHA256_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SHA512_NODE_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["SHA512_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RIPEMD160_NODE_ALGO", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["RIPEMD160_NODE_ALGO"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PREFIX_LENGTH", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["PREFIX_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "KEY_LENGTH", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["KEY_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IV_LENGTH", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["IV_LENGTH"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MAC_LENGTH", function() { return _default__WEBPACK_IMPORTED_MODULE_0__["MAC_LENGTH"]; }); + +/* harmony import */ var _encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encoding */ "./node_modules/@walletconnect/crypto/dist/esm/constants/encoding.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HEX_ENC", function() { return _encoding__WEBPACK_IMPORTED_MODULE_1__["HEX_ENC"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UTF8_ENC", function() { return _encoding__WEBPACK_IMPORTED_MODULE_1__["UTF8_ENC"]; }); + +/* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./error */ "./node_modules/@walletconnect/crypto/dist/esm/constants/error.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ERROR_BAD_MAC", function() { return _error__WEBPACK_IMPORTED_MODULE_2__["ERROR_BAD_MAC"]; }); + +/* harmony import */ var _length__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./length */ "./node_modules/@walletconnect/crypto/dist/esm/constants/length.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_0", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_0"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_1", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_1"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_16", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_16"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_32", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_32"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_64", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_64"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_128", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_128"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_256", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_512", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_512"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LENGTH_1024", function() { return _length__WEBPACK_IMPORTED_MODULE_3__["LENGTH_1024"]; }); + +/* harmony import */ var _operations__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./operations */ "./node_modules/@walletconnect/crypto/dist/esm/constants/operations.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ENCRYPT_OP", function() { return _operations__WEBPACK_IMPORTED_MODULE_4__["ENCRYPT_OP"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DECRYPT_OP", function() { return _operations__WEBPACK_IMPORTED_MODULE_4__["DECRYPT_OP"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SIGN_OP", function() { return _operations__WEBPACK_IMPORTED_MODULE_4__["SIGN_OP"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VERIFY_OP", function() { return _operations__WEBPACK_IMPORTED_MODULE_4__["VERIFY_OP"]; }); + + + + + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/constants/length.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/constants/length.js ***! + \*************************************************************************/ +/*! exports provided: LENGTH_0, LENGTH_1, LENGTH_16, LENGTH_32, LENGTH_64, LENGTH_128, LENGTH_256, LENGTH_512, LENGTH_1024 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_0", function() { return LENGTH_0; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_1", function() { return LENGTH_1; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_16", function() { return LENGTH_16; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_32", function() { return LENGTH_32; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_64", function() { return LENGTH_64; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_128", function() { return LENGTH_128; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_256", function() { return LENGTH_256; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_512", function() { return LENGTH_512; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LENGTH_1024", function() { return LENGTH_1024; }); +var LENGTH_0 = 0; +var LENGTH_1 = 1; +var LENGTH_16 = 16; +var LENGTH_32 = 32; +var LENGTH_64 = 64; +var LENGTH_128 = 128; +var LENGTH_256 = 256; +var LENGTH_512 = 512; +var LENGTH_1024 = 1024; + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/constants/operations.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/constants/operations.js ***! + \*****************************************************************************/ +/*! exports provided: ENCRYPT_OP, DECRYPT_OP, SIGN_OP, VERIFY_OP */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ENCRYPT_OP", function() { return ENCRYPT_OP; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DECRYPT_OP", function() { return DECRYPT_OP; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SIGN_OP", function() { return SIGN_OP; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERIFY_OP", function() { return VERIFY_OP; }); +var ENCRYPT_OP = "encrypt"; +var DECRYPT_OP = "decrypt"; +var SIGN_OP = "sign"; +var VERIFY_OP = "verify"; + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/helpers/env.js": +/*!********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/helpers/env.js ***! + \********************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/environment */ "./node_modules/@walletconnect/environment/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); + + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/helpers/index.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/helpers/index.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./env */ "./node_modules/@walletconnect/crypto/dist/esm/helpers/env.js"); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _env__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _env__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); +/* harmony import */ var _pkcs7__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pkcs7 */ "./node_modules/@walletconnect/crypto/dist/esm/helpers/pkcs7.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pkcs7", function() { return _pkcs7__WEBPACK_IMPORTED_MODULE_1__["pkcs7"]; }); + +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types */ "./node_modules/@walletconnect/crypto/dist/esm/helpers/types.js"); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_types__WEBPACK_IMPORTED_MODULE_2__); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_2__) if(["default","pkcs7"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _types__WEBPACK_IMPORTED_MODULE_2__[key]; }) }(__WEBPACK_IMPORT_KEY__)); +/* harmony import */ var _validators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validators */ "./node_modules/@walletconnect/crypto/dist/esm/helpers/validators.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "assert", function() { return _validators__WEBPACK_IMPORTED_MODULE_3__["assert"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isConstantTime", function() { return _validators__WEBPACK_IMPORTED_MODULE_3__["isConstantTime"]; }); + + + + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/helpers/pkcs7.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/helpers/pkcs7.js ***! + \**********************************************************************/ +/*! exports provided: pkcs7 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pkcs7", function() { return pkcs7; }); +var PADDING = [[16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16], [15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15], [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14], [13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13], [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11], [10, 10, 10, 10, 10, 10, 10, 10, 10, 10], [9, 9, 9, 9, 9, 9, 9, 9, 9], [8, 8, 8, 8, 8, 8, 8, 8], [7, 7, 7, 7, 7, 7, 7], [6, 6, 6, 6, 6, 6], [5, 5, 5, 5, 5], [4, 4, 4, 4], [3, 3, 3], [2, 2], [1]]; +var pkcs7 = { + pad: function pad(plaintext) { + var padding = PADDING[plaintext.byteLength % 16 || 0]; + var result = new Uint8Array(plaintext.byteLength + padding.length); + result.set(plaintext); + result.set(padding, plaintext.byteLength); + return result; + }, + unpad: function unpad(padded) { + return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]); + } +}; + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/helpers/types.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/helpers/types.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/helpers/validators.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/helpers/validators.js ***! + \***************************************************************************/ +/*! exports provided: assert, isConstantTime */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assert", function() { return assert; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isConstantTime", function() { return isConstantTime; }); +function assert(condition, message) { + if (!condition) { + throw new Error(message || "Assertion failed"); + } +} +function isConstantTime(arr1, arr2) { + if (arr1.length !== arr2.length) { + return false; + } + + var res = 0; + + for (var i = 0; i < arr1.length; i++) { + res |= arr1[i] ^ arr2[i]; + } + + return res === 0; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/crypto/dist/esm/lib/browser.js": +/*!********************************************************************!*\ + !*** ./node_modules/@walletconnect/crypto/dist/esm/lib/browser.js ***! + \********************************************************************/ +/*! exports provided: getAlgo, getOps, browserExportKey, browserImportKey, browserAesEncrypt, browserAesDecrypt, browserHmacSha256Sign, browserHmacSha512Sign, browserSha256, browserSha512 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAlgo", function() { return getAlgo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getOps", function() { return getOps; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserExportKey", function() { return browserExportKey; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserImportKey", function() { return browserImportKey; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserAesEncrypt", function() { return browserAesEncrypt; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserAesDecrypt", function() { return browserAesDecrypt; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserHmacSha256Sign", function() { return browserHmacSha256Sign; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserHmacSha512Sign", function() { return browserHmacSha512Sign; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserSha256", function() { return browserSha256; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserSha512", function() { return browserSha512; }); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/environment */ "./node_modules/@walletconnect/environment/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants */ "./node_modules/@walletconnect/crypto/dist/esm/constants/index.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + + + +function getAlgo(type) { + return type === _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"] ? { + length: _constants__WEBPACK_IMPORTED_MODULE_1__["AES_LENGTH"], + name: _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"] + } : { + hash: { + name: _constants__WEBPACK_IMPORTED_MODULE_1__["HMAC_BROWSER_ALGO"] + }, + name: _constants__WEBPACK_IMPORTED_MODULE_1__["HMAC_BROWSER"] + }; +} +function getOps(type) { + return type === _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"] ? [_constants__WEBPACK_IMPORTED_MODULE_1__["ENCRYPT_OP"], _constants__WEBPACK_IMPORTED_MODULE_1__["DECRYPT_OP"]] : [_constants__WEBPACK_IMPORTED_MODULE_1__["SIGN_OP"], _constants__WEBPACK_IMPORTED_MODULE_1__["VERIFY_OP"]]; +} +function browserExportKey(_x) { + return _browserExportKey.apply(this, arguments); +} + +function _browserExportKey() { + _browserExportKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(cryptoKey) { + var type, + subtle, + _args = arguments; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + type = _args.length > 1 && _args[1] !== undefined ? _args[1] : _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"]; + subtle = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"](); + _context.t0 = Uint8Array; + _context.next = 5; + return subtle.exportKey("raw", cryptoKey); + + case 5: + _context.t1 = _context.sent; + return _context.abrupt("return", new _context.t0(_context.t1)); + + case 7: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _browserExportKey.apply(this, arguments); +} + +function browserImportKey(_x2) { + return _browserImportKey.apply(this, arguments); +} + +function _browserImportKey() { + _browserImportKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(buffer) { + var type, + _args2 = arguments; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + type = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"]; + return _context2.abrupt("return", _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"]().importKey("raw", buffer, getAlgo(type), true, getOps(type))); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + return _browserImportKey.apply(this, arguments); +} + +function browserAesEncrypt(_x3, _x4, _x5) { + return _browserAesEncrypt.apply(this, arguments); +} + +function _browserAesEncrypt() { + _browserAesEncrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(iv, key, data) { + var subtle, cryptoKey, result; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + subtle = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"](); + _context3.next = 3; + return browserImportKey(key, _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"]); + + case 3: + cryptoKey = _context3.sent; + _context3.next = 6; + return subtle.encrypt({ + iv: iv, + name: _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"] + }, cryptoKey, data); + + case 6: + result = _context3.sent; + return _context3.abrupt("return", new Uint8Array(result)); + + case 8: + case "end": + return _context3.stop(); + } + } + }, _callee3); + })); + return _browserAesEncrypt.apply(this, arguments); +} + +function browserAesDecrypt(_x6, _x7, _x8) { + return _browserAesDecrypt.apply(this, arguments); +} + +function _browserAesDecrypt() { + _browserAesDecrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(iv, key, data) { + var subtle, cryptoKey, result; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + subtle = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"](); + _context4.next = 3; + return browserImportKey(key, _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"]); + + case 3: + cryptoKey = _context4.sent; + _context4.next = 6; + return subtle.decrypt({ + iv: iv, + name: _constants__WEBPACK_IMPORTED_MODULE_1__["AES_BROWSER_ALGO"] + }, cryptoKey, data); + + case 6: + result = _context4.sent; + return _context4.abrupt("return", new Uint8Array(result)); + + case 8: + case "end": + return _context4.stop(); + } + } + }, _callee4); + })); + return _browserAesDecrypt.apply(this, arguments); +} + +function browserHmacSha256Sign(_x9, _x10) { + return _browserHmacSha256Sign.apply(this, arguments); +} + +function _browserHmacSha256Sign() { + _browserHmacSha256Sign = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(key, data) { + var subtle, cryptoKey, signature; + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + subtle = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"](); + _context5.next = 3; + return browserImportKey(key, _constants__WEBPACK_IMPORTED_MODULE_1__["HMAC_BROWSER"]); + + case 3: + cryptoKey = _context5.sent; + _context5.next = 6; + return subtle.sign({ + length: _constants__WEBPACK_IMPORTED_MODULE_1__["HMAC_LENGTH"], + name: _constants__WEBPACK_IMPORTED_MODULE_1__["HMAC_BROWSER"] + }, cryptoKey, data); + + case 6: + signature = _context5.sent; + return _context5.abrupt("return", new Uint8Array(signature)); + + case 8: + case "end": + return _context5.stop(); + } + } + }, _callee5); + })); + return _browserHmacSha256Sign.apply(this, arguments); +} + +function browserHmacSha512Sign(_x11, _x12) { + return _browserHmacSha512Sign.apply(this, arguments); +} + +function _browserHmacSha512Sign() { + _browserHmacSha512Sign = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(key, data) { + var subtle, cryptoKey, signature; + return regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + subtle = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"](); + _context6.next = 3; + return browserImportKey(key, _constants__WEBPACK_IMPORTED_MODULE_1__["HMAC_BROWSER"]); + + case 3: + cryptoKey = _context6.sent; + _context6.next = 6; + return subtle.sign({ + length: _constants__WEBPACK_IMPORTED_MODULE_1__["LENGTH_512"], + name: _constants__WEBPACK_IMPORTED_MODULE_1__["HMAC_BROWSER"] + }, cryptoKey, data); + + case 6: + signature = _context6.sent; + return _context6.abrupt("return", new Uint8Array(signature)); + + case 8: + case "end": + return _context6.stop(); + } + } + }, _callee6); + })); + return _browserHmacSha512Sign.apply(this, arguments); +} + +function browserSha256(_x13) { + return _browserSha.apply(this, arguments); +} + +function _browserSha() { + _browserSha = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(data) { + var subtle, result; + return regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + subtle = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"](); + _context7.next = 3; + return subtle.digest({ + name: _constants__WEBPACK_IMPORTED_MODULE_1__["SHA256_BROWSER_ALGO"] + }, data); + + case 3: + result = _context7.sent; + return _context7.abrupt("return", new Uint8Array(result)); + + case 5: + case "end": + return _context7.stop(); + } + } + }, _callee7); + })); + return _browserSha.apply(this, arguments); +} + +function browserSha512(_x14) { + return _browserSha2.apply(this, arguments); +} + +function _browserSha2() { + _browserSha2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(data) { + var subtle, result; + return regeneratorRuntime.wrap(function _callee8$(_context8) { + while (1) { + switch (_context8.prev = _context8.next) { + case 0: + subtle = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getSubtleCrypto"](); + _context8.next = 3; + return subtle.digest({ + name: _constants__WEBPACK_IMPORTED_MODULE_1__["SHA512_BROWSER_ALGO"] + }, data); + + case 3: + result = _context8.sent; + return _context8.abrupt("return", new Uint8Array(result)); + + case 5: + case "end": + return _context8.stop(); + } + } + }, _callee8); + })); + return _browserSha2.apply(this, arguments); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/encoding/dist/cjs/index.js": +/*!****************************************************************!*\ + !*** ./node_modules/@walletconnect/encoding/dist/cjs/index.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer) { + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var __importDefault = this && this.__importDefault || function (mod) { + return mod && mod.__esModule ? mod : { + "default": mod + }; +}; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.removeHexLeadingZeros = exports.sanitizeHex = exports.addHexPrefix = exports.removeHexPrefix = exports.padRight = exports.padLeft = exports.sanitizeBytes = exports.swapHex = exports.swapBytes = exports.splitBytes = exports.calcByteLength = exports.trimRight = exports.trimLeft = exports.concatArrays = exports.concatBuffers = exports.getEncoding = exports.getType = exports.isArrayBuffer = exports.isTypedArray = exports.isBuffer = exports.isHexString = exports.isBinaryString = exports.binaryToNumber = exports.binaryToUtf8 = exports.binaryToHex = exports.binaryToArray = exports.binaryToBuffer = exports.numberToBinary = exports.numberToUtf8 = exports.numberToHex = exports.numberToArray = exports.numberToBuffer = exports.utf8ToBinary = exports.utf8ToNumber = exports.utf8ToHex = exports.utf8ToArray = exports.utf8ToBuffer = exports.hexToBinary = exports.hexToNumber = exports.hexToUtf8 = exports.hexToArray = exports.hexToBuffer = exports.arrayToBinary = exports.arrayToNumber = exports.arrayToUtf8 = exports.arrayToHex = exports.arrayToBuffer = exports.bufferToBinary = exports.bufferToNumber = exports.bufferToUtf8 = exports.bufferToHex = exports.bufferToArray = void 0; + +var is_typedarray_1 = __importDefault(__webpack_require__(/*! is-typedarray */ "./node_modules/is-typedarray/index.js")); + +var typedarray_to_buffer_1 = __importDefault(__webpack_require__(/*! typedarray-to-buffer */ "./node_modules/typedarray-to-buffer/index.js")); + +var ENC_HEX = "hex"; +var ENC_UTF8 = "utf8"; +var ENC_BIN = "binary"; +var TYPE_BUFFER = "buffer"; +var TYPE_ARRAY = "array"; +var TYPE_TYPED_ARRAY = "typed-array"; +var TYPE_ARRAY_BUFFER = "array-buffer"; +var STRING_ZERO = "0"; + +function bufferToArray(buf) { + return new Uint8Array(buf); +} + +exports.bufferToArray = bufferToArray; + +function bufferToHex(buf) { + var prefixed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + var hex = buf.toString(ENC_HEX); + return prefixed ? addHexPrefix(hex) : hex; +} + +exports.bufferToHex = bufferToHex; + +function bufferToUtf8(buf) { + return buf.toString(ENC_UTF8); +} + +exports.bufferToUtf8 = bufferToUtf8; + +function bufferToNumber(buf) { + return buf.readUIntBE(0, buf.length); +} + +exports.bufferToNumber = bufferToNumber; + +function bufferToBinary(buf) { + return arrayToBinary(bufferToArray(buf)); +} + +exports.bufferToBinary = bufferToBinary; + +function arrayToBuffer(arr) { + return typedarray_to_buffer_1["default"](arr); +} + +exports.arrayToBuffer = arrayToBuffer; + +function arrayToHex(arr) { + var prefixed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + return bufferToHex(arrayToBuffer(arr), prefixed); +} + +exports.arrayToHex = arrayToHex; + +function arrayToUtf8(arr) { + return bufferToUtf8(arrayToBuffer(arr)); +} + +exports.arrayToUtf8 = arrayToUtf8; + +function arrayToNumber(arr) { + return bufferToNumber(arrayToBuffer(arr)); +} + +exports.arrayToNumber = arrayToNumber; + +function arrayToBinary(arr) { + return Array.from(arr).map(numberToBinary).join(""); +} + +exports.arrayToBinary = arrayToBinary; + +function hexToBuffer(hex) { + return Buffer.from(removeHexPrefix(hex), ENC_HEX); +} + +exports.hexToBuffer = hexToBuffer; + +function hexToArray(hex) { + return bufferToArray(hexToBuffer(hex)); +} + +exports.hexToArray = hexToArray; + +function hexToUtf8(hex) { + return bufferToUtf8(hexToBuffer(hex)); +} + +exports.hexToUtf8 = hexToUtf8; + +function hexToNumber(hex) { + return arrayToNumber(hexToArray(hex)); +} + +exports.hexToNumber = hexToNumber; + +function hexToBinary(hex) { + return arrayToBinary(hexToArray(hex)); +} + +exports.hexToBinary = hexToBinary; + +function utf8ToBuffer(utf8) { + return Buffer.from(utf8, ENC_UTF8); +} + +exports.utf8ToBuffer = utf8ToBuffer; + +function utf8ToArray(utf8) { + return bufferToArray(utf8ToBuffer(utf8)); +} + +exports.utf8ToArray = utf8ToArray; + +function utf8ToHex(utf8) { + var prefixed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + return bufferToHex(utf8ToBuffer(utf8), prefixed); +} + +exports.utf8ToHex = utf8ToHex; + +function utf8ToNumber(utf8) { + var num = parseInt(utf8, 10); + assert(isDefined(num), "Number can only safely store up to 53 bits"); + return num; +} + +exports.utf8ToNumber = utf8ToNumber; + +function utf8ToBinary(utf8) { + return arrayToBinary(utf8ToArray(utf8)); +} + +exports.utf8ToBinary = utf8ToBinary; + +function numberToBuffer(num) { + return binaryToBuffer(numberToBinary(num)); +} + +exports.numberToBuffer = numberToBuffer; + +function numberToArray(num) { + return binaryToArray(numberToBinary(num)); +} + +exports.numberToArray = numberToArray; + +function numberToHex(num, prefixed) { + return binaryToHex(numberToBinary(num), prefixed); +} + +exports.numberToHex = numberToHex; + +function numberToUtf8(num) { + return "".concat(num); +} + +exports.numberToUtf8 = numberToUtf8; + +function numberToBinary(num) { + var bin = (num >>> 0).toString(2); + return sanitizeBytes(bin); +} + +exports.numberToBinary = numberToBinary; + +function binaryToBuffer(bin) { + return arrayToBuffer(binaryToArray(bin)); +} + +exports.binaryToBuffer = binaryToBuffer; + +function binaryToArray(bin) { + return new Uint8Array(splitBytes(bin).map(function (x) { + return parseInt(x, 2); + })); +} + +exports.binaryToArray = binaryToArray; + +function binaryToHex(bin, prefixed) { + return arrayToHex(binaryToArray(bin), prefixed); +} + +exports.binaryToHex = binaryToHex; + +function binaryToUtf8(bin) { + return arrayToUtf8(binaryToArray(bin)); +} + +exports.binaryToUtf8 = binaryToUtf8; + +function binaryToNumber(bin) { + return arrayToNumber(binaryToArray(bin)); +} + +exports.binaryToNumber = binaryToNumber; + +function isBinaryString(str) { + if (typeof str !== "string" || !new RegExp(/^[01]+$/).test(str)) { + return false; + } + + if (str.length % 8 !== 0) { + return false; + } + + return true; +} + +exports.isBinaryString = isBinaryString; + +function isHexString(str, length) { + if (typeof str !== "string" || !str.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + + if (length && str.length !== 2 + 2 * length) { + return false; + } + + return true; +} + +exports.isHexString = isHexString; + +function isBuffer(val) { + return Buffer.isBuffer(val); +} + +exports.isBuffer = isBuffer; + +function isTypedArray(val) { + return is_typedarray_1["default"].strict(val) && !isBuffer(val); +} + +exports.isTypedArray = isTypedArray; + +function isArrayBuffer(val) { + return !isTypedArray(val) && !isBuffer(val) && typeof val.byteLength !== "undefined"; +} + +exports.isArrayBuffer = isArrayBuffer; + +function getType(val) { + if (isBuffer(val)) { + return TYPE_BUFFER; + } else if (isTypedArray(val)) { + return TYPE_TYPED_ARRAY; + } else if (isArrayBuffer(val)) { + return TYPE_ARRAY_BUFFER; + } else if (Array.isArray(val)) { + return TYPE_ARRAY; + } else { + return _typeof(val); + } +} + +exports.getType = getType; + +function getEncoding(str) { + if (isBinaryString(str)) { + return ENC_BIN; + } + + if (isHexString(str)) { + return ENC_HEX; + } + + return ENC_UTF8; +} + +exports.getEncoding = getEncoding; + +function concatBuffers() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var result = Buffer.concat(args); + return result; +} + +exports.concatBuffers = concatBuffers; + +function concatArrays() { + var result = []; + + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + + args.forEach(function (arg) { + return result = result.concat(Array.from(arg)); + }); + return new Uint8Array(_toConsumableArray(result)); +} + +exports.concatArrays = concatArrays; + +function trimLeft(data, length) { + var diff = data.length - length; + + if (diff > 0) { + data = data.slice(diff); + } + + return data; +} + +exports.trimLeft = trimLeft; + +function trimRight(data, length) { + return data.slice(0, length); +} + +exports.trimRight = trimRight; + +function calcByteLength(length) { + var byteSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8; + var remainder = length % byteSize; + return remainder ? (length - remainder) / byteSize * byteSize + byteSize : length; +} + +exports.calcByteLength = calcByteLength; + +function splitBytes(str) { + var byteSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8; + var bytes = sanitizeBytes(str).match(new RegExp(".{".concat(byteSize, "}"), "gi")); + return Array.from(bytes || []); +} + +exports.splitBytes = splitBytes; + +function swapBytes(str) { + return splitBytes(str).map(reverseString).join(""); +} + +exports.swapBytes = swapBytes; + +function swapHex(str) { + return binaryToHex(swapBytes(hexToBinary(str))); +} + +exports.swapHex = swapHex; + +function sanitizeBytes(str) { + var byteSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8; + var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : STRING_ZERO; + return padLeft(str, calcByteLength(str.length, byteSize), padding); +} + +exports.sanitizeBytes = sanitizeBytes; + +function padLeft(str, length) { + var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : STRING_ZERO; + return padString(str, length, true, padding); +} + +exports.padLeft = padLeft; + +function padRight(str, length) { + var padding = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : STRING_ZERO; + return padString(str, length, false, padding); +} + +exports.padRight = padRight; + +function removeHexPrefix(hex) { + return hex.replace(/^0x/, ""); +} + +exports.removeHexPrefix = removeHexPrefix; + +function addHexPrefix(hex) { + return hex.startsWith("0x") ? hex : "0x".concat(hex); +} + +exports.addHexPrefix = addHexPrefix; + +function sanitizeHex(hex) { + hex = removeHexPrefix(hex); + hex = sanitizeBytes(hex, 2); + + if (hex) { + hex = addHexPrefix(hex); + } + + return hex; +} + +exports.sanitizeHex = sanitizeHex; + +function removeHexLeadingZeros(hex) { + var prefixed = hex.startsWith("0x"); + hex = removeHexPrefix(hex); + hex = hex.startsWith(STRING_ZERO) ? hex.substring(1) : hex; + return prefixed ? addHexPrefix(hex) : hex; +} + +exports.removeHexLeadingZeros = removeHexLeadingZeros; + +function isUndefined(value) { + return typeof value === "undefined"; +} + +function isDefined(value) { + return !isUndefined(value); +} + +function assert(assertion, errorMessage) { + if (!assertion) { + throw new Error(errorMessage); + } +} + +function reverseString(str) { + return str.split("").reverse().join(""); +} + +function padString(str, length, left) { + var padding = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : STRING_ZERO; + var diff = length - str.length; + var result = str; + + if (diff > 0) { + var pad = padding.repeat(diff); + result = left ? pad + str : str + pad; + } + + return result; +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../buffer/index.js */ "./node_modules/buffer/index.js").Buffer)) + +/***/ }), + +/***/ "./node_modules/@walletconnect/environment/dist/cjs/crypto.js": +/*!********************************************************************!*\ + !*** ./node_modules/@walletconnect/environment/dist/cjs/crypto.js ***! + \********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isBrowserCryptoAvailable = exports.getSubtleCrypto = exports.getBrowerCrypto = void 0; + +function getBrowerCrypto() { + return (global === null || global === void 0 ? void 0 : global.crypto) || (global === null || global === void 0 ? void 0 : global.msCrypto) || {}; +} + +exports.getBrowerCrypto = getBrowerCrypto; + +function getSubtleCrypto() { + var browserCrypto = getBrowerCrypto(); + return browserCrypto.subtle || browserCrypto.webkitSubtle; +} + +exports.getSubtleCrypto = getSubtleCrypto; + +function isBrowserCryptoAvailable() { + return !!getBrowerCrypto() && !!getSubtleCrypto(); +} + +exports.isBrowserCryptoAvailable = isBrowserCryptoAvailable; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/@walletconnect/environment/dist/cjs/env.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@walletconnect/environment/dist/cjs/env.js ***! + \*****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) { + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isBrowser = exports.isNode = exports.isReactNative = void 0; + +function isReactNative() { + return typeof document === "undefined" && typeof navigator !== "undefined" && navigator.product === "ReactNative"; +} + +exports.isReactNative = isReactNative; + +function isNode() { + return typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined"; +} + +exports.isNode = isNode; + +function isBrowser() { + return !isReactNative() && !isNode(); +} + +exports.isBrowser = isBrowser; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/@walletconnect/environment/dist/cjs/index.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@walletconnect/environment/dist/cjs/index.js ***! + \*******************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { + enumerable: true, + get: function get() { + return m[k]; + } + }); +} : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +var __exportStar = this && this.__exportStar || function (m, exports) { + for (var p in m) { + if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); + } +}; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +__exportStar(__webpack_require__(/*! ./crypto */ "./node_modules/@walletconnect/environment/dist/cjs/crypto.js"), exports); + +__exportStar(__webpack_require__(/*! ./env */ "./node_modules/@walletconnect/environment/dist/cjs/env.js"), exports); + +/***/ }), + +/***/ "./node_modules/@walletconnect/ethereum-provider/dist/esm/index.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@walletconnect/ethereum-provider/dist/esm/index.js ***! + \*************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! eventemitter3 */ "./node_modules/eventemitter3/index.js"); +/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(eventemitter3__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _walletconnect_jsonrpc_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/jsonrpc-provider */ "./node_modules/@walletconnect/jsonrpc-provider/dist/esm/index.js"); +/* harmony import */ var _walletconnect_jsonrpc_http_connection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/jsonrpc-http-connection */ "./node_modules/@walletconnect/jsonrpc-http-connection/dist/esm/index.js"); +/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/utils */ "./node_modules/@walletconnect/utils/dist/esm/index.js"); +/* harmony import */ var _walletconnect_signer_connection__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @walletconnect/signer-connection */ "./node_modules/@walletconnect/signer-connection/dist/esm/index.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + + + +var WalletConnectProvider = /*#__PURE__*/function () { + function WalletConnectProvider(opts) { + _classCallCheck(this, WalletConnectProvider); + + this.events = new eventemitter3__WEBPACK_IMPORTED_MODULE_0___default.a(); + this.rpc = { + infuraId: opts === null || opts === void 0 ? void 0 : opts.infuraId, + custom: opts === null || opts === void 0 ? void 0 : opts.rpc + }; + this.signer = new _walletconnect_jsonrpc_provider__WEBPACK_IMPORTED_MODULE_1__["JsonRpcProvider"](new _walletconnect_signer_connection__WEBPACK_IMPORTED_MODULE_4__["SignerConnection"](opts)); + var chainId = this.signer.connection.chainId || (opts === null || opts === void 0 ? void 0 : opts.chainId) || 1; + this.http = this.setHttpProvider(chainId); + this.registerEventListeners(); + } + + _createClass(WalletConnectProvider, [{ + key: "connected", + get: function get() { + return this.signer.connection.connected; + } + }, { + key: "connector", + get: function get() { + return this.signer.connection.connector; + } + }, { + key: "accounts", + get: function get() { + return this.signer.connection.accounts; + } + }, { + key: "chainId", + get: function get() { + return this.signer.connection.chainId; + } + }, { + key: "rpcUrl", + get: function get() { + var _a; + + return ((_a = this.http) === null || _a === void 0 ? void 0 : _a.connection).url || ""; + } + }, { + key: "request", + value: function () { + var _request = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args) { + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.t0 = args.method; + _context.next = _context.t0 === "eth_requestAccounts" ? 3 : _context.t0 === "eth_accounts" ? 6 : _context.t0 === "eth_chainId" ? 7 : 8; + break; + + case 3: + _context.next = 5; + return this.connect(); + + case 5: + return _context.abrupt("return", this.signer.connection.accounts); + + case 6: + return _context.abrupt("return", this.signer.connection.accounts); + + case 7: + return _context.abrupt("return", this.signer.connection.chainId); + + case 8: + return _context.abrupt("break", 9); + + case 9: + if (!_walletconnect_utils__WEBPACK_IMPORTED_MODULE_3__["signingMethods"].includes(args.method)) { + _context.next = 11; + break; + } + + return _context.abrupt("return", this.signer.request(args)); + + case 11: + if (!(typeof this.http === "undefined")) { + _context.next = 13; + break; + } + + throw new Error("Cannot request JSON-RPC method (".concat(args.method, ") without provided rpc url")); + + case 13: + return _context.abrupt("return", this.http.request(args)); + + case 14: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function request(_x) { + return _request.apply(this, arguments); + } + + return request; + }() + }, { + key: "enable", + value: function () { + var _enable = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + var accounts; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this.request({ + method: "eth_requestAccounts" + }); + + case 2: + accounts = _context2.sent; + return _context2.abrupt("return", accounts); + + case 4: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function enable() { + return _enable.apply(this, arguments); + } + + return enable; + }() + }, { + key: "connect", + value: function () { + var _connect = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() { + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (this.signer.connection.connected) { + _context3.next = 3; + break; + } + + _context3.next = 3; + return this.signer.connect(); + + case 3: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function connect() { + return _connect.apply(this, arguments); + } + + return connect; + }() + }, { + key: "disconnect", + value: function () { + var _disconnect = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + if (!this.signer.connection.connected) { + _context4.next = 3; + break; + } + + _context4.next = 3; + return this.signer.disconnect(); + + case 3: + case "end": + return _context4.stop(); + } + } + }, _callee4, this); + })); + + function disconnect() { + return _disconnect.apply(this, arguments); + } + + return disconnect; + }() + }, { + key: "on", + value: function on(event, listener) { + this.events.on(event, listener); + } + }, { + key: "once", + value: function once(event, listener) { + this.events.once(event, listener); + } + }, { + key: "removeListener", + value: function removeListener(event, listener) { + this.events.removeListener(event, listener); + } + }, { + key: "off", + value: function off(event, listener) { + this.events.off(event, listener); + } + }, { + key: "isWalletConnect", + get: function get() { + return true; + } + }, { + key: "registerEventListeners", + value: function registerEventListeners() { + var _this = this; + + this.signer.connection.on("accountsChanged", function (accounts) { + _this.events.emit("accountsChanged", accounts); + }); + this.signer.connection.on("chainChanged", function (chainId) { + _this.http = _this.setHttpProvider(chainId); + + _this.events.emit("chainChanged", chainId); + }); + this.signer.on("disconnect", function () { + _this.events.emit("disconnect"); + }); + } + }, { + key: "setHttpProvider", + value: function setHttpProvider(chainId) { + var rpcUrl = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_3__["getRpcUrl"])(chainId, this.rpc); + if (typeof rpcUrl === "undefined") return undefined; + var http = new _walletconnect_jsonrpc_provider__WEBPACK_IMPORTED_MODULE_1__["JsonRpcProvider"](new _walletconnect_jsonrpc_http_connection__WEBPACK_IMPORTED_MODULE_2__["HttpConnection"](rpcUrl)); + return http; + } + }]); + + return WalletConnectProvider; +}(); + +/* harmony default export */ __webpack_exports__["default"] = (WalletConnectProvider); + +/***/ }), + +/***/ "./node_modules/@walletconnect/iso-crypto/dist/esm/index.js": +/*!******************************************************************!*\ + !*** ./node_modules/@walletconnect/iso-crypto/dist/esm/index.js ***! + \******************************************************************/ +/*! exports provided: generateKey, verifyHmac, encrypt, decrypt */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generateKey", function() { return generateKey; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "verifyHmac", function() { return verifyHmac; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "encrypt", function() { return encrypt; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "decrypt", function() { return decrypt; }); +/* harmony import */ var _walletconnect_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/crypto */ "./node_modules/@walletconnect/crypto/dist/esm/browser/index.js"); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/encoding */ "./node_modules/@walletconnect/encoding/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/utils */ "./node_modules/@walletconnect/utils/dist/esm/index.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + + + + +function generateKey(_x) { + return _generateKey.apply(this, arguments); +} + +function _generateKey() { + _generateKey = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(length) { + var _length, bytes, result; + + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _length = (length || 256) / 8; + bytes = _walletconnect_crypto__WEBPACK_IMPORTED_MODULE_0__["randomBytes"](_length); + result = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_2__["convertBufferToArrayBuffer"])(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToBuffer"](bytes)); + return _context.abrupt("return", result); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + return _generateKey.apply(this, arguments); +} + +function verifyHmac(_x2, _x3) { + return _verifyHmac.apply(this, arguments); +} + +function _verifyHmac() { + _verifyHmac = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(payload, key) { + var cipherText, iv, hmac, hmacHex, unsigned, chmac, chmacHex; + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + cipherText = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToArray"](payload.data); + iv = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToArray"](payload.iv); + hmac = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToArray"](payload.hmac); + hmacHex = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToHex"](hmac, false); + unsigned = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["concatArrays"](cipherText, iv); + _context2.next = 7; + return _walletconnect_crypto__WEBPACK_IMPORTED_MODULE_0__["hmacSha256Sign"](key, unsigned); + + case 7: + chmac = _context2.sent; + chmacHex = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToHex"](chmac, false); + + if (!(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["removeHexPrefix"](hmacHex) === _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["removeHexPrefix"](chmacHex))) { + _context2.next = 11; + break; + } + + return _context2.abrupt("return", true); + + case 11: + return _context2.abrupt("return", false); + + case 12: + case "end": + return _context2.stop(); + } + } + }, _callee2); + })); + return _verifyHmac.apply(this, arguments); +} + +function encrypt(_x4, _x5, _x6) { + return _encrypt.apply(this, arguments); +} + +function _encrypt() { + _encrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(data, key, providedIv) { + var _key, ivArrayBuffer, iv, ivHex, contentString, content, cipherText, cipherTextHex, unsigned, hmac, hmacHex; + + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + _key = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["bufferToArray"](Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_2__["convertArrayBufferToBuffer"])(key)); + _context3.t0 = providedIv; + + if (_context3.t0) { + _context3.next = 6; + break; + } + + _context3.next = 5; + return generateKey(128); + + case 5: + _context3.t0 = _context3.sent; + + case 6: + ivArrayBuffer = _context3.t0; + iv = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["bufferToArray"](Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_2__["convertArrayBufferToBuffer"])(ivArrayBuffer)); + ivHex = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToHex"](iv, false); + contentString = JSON.stringify(data); + content = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["utf8ToArray"](contentString); + _context3.next = 13; + return _walletconnect_crypto__WEBPACK_IMPORTED_MODULE_0__["aesCbcEncrypt"](iv, _key, content); + + case 13: + cipherText = _context3.sent; + cipherTextHex = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToHex"](cipherText, false); + unsigned = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["concatArrays"](cipherText, iv); + _context3.next = 18; + return _walletconnect_crypto__WEBPACK_IMPORTED_MODULE_0__["hmacSha256Sign"](_key, unsigned); + + case 18: + hmac = _context3.sent; + hmacHex = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToHex"](hmac, false); + return _context3.abrupt("return", { + data: cipherTextHex, + hmac: hmacHex, + iv: ivHex + }); + + case 21: + case "end": + return _context3.stop(); + } + } + }, _callee3); + })); + return _encrypt.apply(this, arguments); +} + +function decrypt(_x7, _x8) { + return _decrypt.apply(this, arguments); +} + +function _decrypt() { + _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(payload, key) { + var _key, verified, cipherText, iv, buffer, utf8, data; + + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + _key = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["bufferToArray"](Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_2__["convertArrayBufferToBuffer"])(key)); + + if (_key) { + _context4.next = 3; + break; + } + + throw new Error("Missing key: required for decryption"); + + case 3: + _context4.next = 5; + return verifyHmac(payload, _key); + + case 5: + verified = _context4.sent; + + if (verified) { + _context4.next = 8; + break; + } + + return _context4.abrupt("return", null); + + case 8: + cipherText = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToArray"](payload.data); + iv = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToArray"](payload.iv); + _context4.next = 12; + return _walletconnect_crypto__WEBPACK_IMPORTED_MODULE_0__["aesCbcDecrypt"](iv, _key, cipherText); + + case 12: + buffer = _context4.sent; + utf8 = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToUtf8"](buffer); + _context4.prev = 14; + data = JSON.parse(utf8); + _context4.next = 21; + break; + + case 18: + _context4.prev = 18; + _context4.t0 = _context4["catch"](14); + return _context4.abrupt("return", null); + + case 21: + return _context4.abrupt("return", data); + + case 22: + case "end": + return _context4.stop(); + } + } + }, _callee4, null, [[14, 18]]); + })); + return _decrypt.apply(this, arguments); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-http-connection/dist/esm/http.js": +/*!******************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-http-connection/dist/esm/http.js ***! + \******************************************************************************/ +/*! exports provided: HttpConnection, default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpConnection", function() { return HttpConnection; }); +/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ "./node_modules/events/events.js"); +/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var cross_fetch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! cross-fetch */ "./node_modules/cross-fetch/dist/browser-ponyfill.js"); +/* harmony import */ var cross_fetch__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(cross_fetch__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/safe-json */ "./node_modules/@walletconnect/safe-json/dist/esm/index.js"); +/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + + + +var DEFAULT_HTTP_HEADERS = { + Accept: "application/json", + "Content-Type": "application/json" +}; +var DEFAULT_HTTP_METHOD = "POST"; +var DEFAULT_FETCH_OPTS = { + headers: DEFAULT_HTTP_HEADERS, + method: DEFAULT_HTTP_METHOD +}; +var HttpConnection = /*#__PURE__*/function () { + function HttpConnection(url) { + _classCallCheck(this, HttpConnection); + + this.url = url; + this.events = new events__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + this.isAvailable = false; + this.registering = false; + + if (!Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__["isHttpUrl"])(url)) { + throw new Error("Provided URL is not compatible with HTTP connection: ".concat(url)); + } + + this.url = url; + } + + _createClass(HttpConnection, [{ + key: "connected", + get: function get() { + return this.isAvailable; + } + }, { + key: "connecting", + get: function get() { + return this.registering; + } + }, { + key: "on", + value: function on(event, listener) { + this.events.on(event, listener); + } + }, { + key: "once", + value: function once(event, listener) { + this.events.once(event, listener); + } + }, { + key: "off", + value: function off(event, listener) { + this.events.off(event, listener); + } + }, { + key: "removeListener", + value: function removeListener(event, listener) { + this.events.removeListener(event, listener); + } + }, { + key: "open", + value: function () { + var _open = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var url, + _args = arguments; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + url = _args.length > 0 && _args[0] !== undefined ? _args[0] : this.url; + _context.next = 3; + return this.register(url); + + case 3: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function open() { + return _open.apply(this, arguments); + } + + return open; + }() + }, { + key: "close", + value: function () { + var _close = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (this.isAvailable) { + _context2.next = 2; + break; + } + + throw new Error("Connection already closed"); + + case 2: + this.onClose(); + + case 3: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function close() { + return _close.apply(this, arguments); + } + + return close; + }() + }, { + key: "send", + value: function () { + var _send = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(payload, context) { + var body, res, data; + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + if (this.isAvailable) { + _context3.next = 3; + break; + } + + _context3.next = 3; + return this.register(); + + case 3: + _context3.prev = 3; + body = Object(_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_2__["safeJsonStringify"])(payload); + _context3.next = 7; + return cross_fetch__WEBPACK_IMPORTED_MODULE_1___default()(this.url, Object.assign(Object.assign({}, DEFAULT_FETCH_OPTS), { + body: body + })); + + case 7: + res = _context3.sent; + _context3.next = 10; + return res.json(); + + case 10: + data = _context3.sent; + this.onPayload({ + data: data + }); + _context3.next = 17; + break; + + case 14: + _context3.prev = 14; + _context3.t0 = _context3["catch"](3); + this.onError(payload.id, _context3.t0); + + case 17: + case "end": + return _context3.stop(); + } + } + }, _callee3, this, [[3, 14]]); + })); + + function send(_x, _x2) { + return _send.apply(this, arguments); + } + + return send; + }() + }, { + key: "register", + value: function () { + var _register = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() { + var _this = this; + + var url, + body, + error, + _args4 = arguments; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + url = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : this.url; + + if (Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__["isHttpUrl"])(url)) { + _context4.next = 3; + break; + } + + throw new Error("Provided URL is not compatible with HTTP connection: ".concat(url)); + + case 3: + if (!this.registering) { + _context4.next = 5; + break; + } + + return _context4.abrupt("return", new Promise(function (resolve, reject) { + _this.events.once("register_error", function (error) { + reject(error); + }); + + _this.events.once("open", function () { + if (typeof _this.isAvailable === "undefined") { + return reject(new Error("HTTP connection is missing or invalid")); + } + + resolve(); + }); + })); + + case 5: + this.url = url; + this.registering = true; + _context4.prev = 7; + body = Object(_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_2__["safeJsonStringify"])({ + id: 1, + jsonrpc: "2.0", + method: "test", + params: [] + }); + _context4.next = 11; + return cross_fetch__WEBPACK_IMPORTED_MODULE_1___default()(url, Object.assign(Object.assign({}, DEFAULT_FETCH_OPTS), { + body: body + })); + + case 11: + this.onOpen(); + _context4.next = 20; + break; + + case 14: + _context4.prev = 14; + _context4.t0 = _context4["catch"](7); + error = this.parseError(_context4.t0); + this.events.emit("register_error", error); + this.onClose(); + throw error; + + case 20: + case "end": + return _context4.stop(); + } + } + }, _callee4, this, [[7, 14]]); + })); + + function register() { + return _register.apply(this, arguments); + } + + return register; + }() + }, { + key: "onOpen", + value: function onOpen() { + this.isAvailable = true; + this.registering = false; + this.events.emit("open"); + } + }, { + key: "onClose", + value: function onClose() { + this.isAvailable = false; + this.registering = false; + this.events.emit("close"); + } + }, { + key: "onPayload", + value: function onPayload(e) { + if (typeof e.data === "undefined") return; + var payload = typeof e.data === "string" ? Object(_walletconnect_safe_json__WEBPACK_IMPORTED_MODULE_2__["safeJsonParse"])(e.data) : e.data; + this.events.emit("payload", payload); + } + }, { + key: "onError", + value: function onError(id, e) { + var error = this.parseError(e); + var message = error.message || error.toString(); + var payload = Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__["formatJsonRpcError"])(id, message); + this.events.emit("payload", payload); + } + }, { + key: "parseError", + value: function parseError(e) { + var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.url; + return Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_3__["parseConnectionError"])(e, url, "HTTP"); + } + }]); + + return HttpConnection; +}(); +/* harmony default export */ __webpack_exports__["default"] = (HttpConnection); + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-http-connection/dist/esm/index.js": +/*!*******************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-http-connection/dist/esm/index.js ***! + \*******************************************************************************/ +/*! exports provided: HttpConnection, default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./http */ "./node_modules/@walletconnect/jsonrpc-http-connection/dist/esm/http.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HttpConnection", function() { return _http__WEBPACK_IMPORTED_MODULE_0__["HttpConnection"]; }); + + + +/* harmony default export */ __webpack_exports__["default"] = (_http__WEBPACK_IMPORTED_MODULE_0__["default"]); + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-provider/dist/esm/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-provider/dist/esm/index.js ***! + \************************************************************************/ +/*! exports provided: JsonRpcProvider, default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./provider */ "./node_modules/@walletconnect/jsonrpc-provider/dist/esm/provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "JsonRpcProvider", function() { return _provider__WEBPACK_IMPORTED_MODULE_0__["JsonRpcProvider"]; }); + + + +/* harmony default export */ __webpack_exports__["default"] = (_provider__WEBPACK_IMPORTED_MODULE_0__["default"]); + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-provider/dist/esm/provider.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-provider/dist/esm/provider.js ***! + \***************************************************************************/ +/*! exports provided: JsonRpcProvider, default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonRpcProvider", function() { return JsonRpcProvider; }); +/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! events */ "./node_modules/events/events.js"); +/* harmony import */ var events__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(events__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js"); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + +var JsonRpcProvider = /*#__PURE__*/function (_IJsonRpcProvider) { + _inherits(JsonRpcProvider, _IJsonRpcProvider); + + var _super = _createSuper(JsonRpcProvider); + + function JsonRpcProvider(connection) { + var _this; + + _classCallCheck(this, JsonRpcProvider); + + _this = _super.call(this, connection); + _this.events = new events__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); + _this.connection = _this.setConnection(connection); + return _this; + } + + _createClass(JsonRpcProvider, [{ + key: "connect", + value: function () { + var _connect = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var connection, + _args = arguments; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + connection = _args.length > 0 && _args[0] !== undefined ? _args[0] : this.connection; + _context.next = 3; + return this.open(connection); + + case 3: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function connect() { + return _connect.apply(this, arguments); + } + + return connect; + }() + }, { + key: "disconnect", + value: function () { + var _disconnect = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + _context2.next = 2; + return this.close(); + + case 2: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function disconnect() { + return _disconnect.apply(this, arguments); + } + + return disconnect; + }() + }, { + key: "on", + value: function on(event, listener) { + this.events.on(event, listener); + } + }, { + key: "once", + value: function once(event, listener) { + this.events.once(event, listener); + } + }, { + key: "off", + value: function off(event, listener) { + this.events.off(event, listener); + } + }, { + key: "removeListener", + value: function removeListener(event, listener) { + this.events.removeListener(event, listener); + } + }, { + key: "request", + value: function () { + var _request2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_request, context) { + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + return _context3.abrupt("return", this.requestStrict(Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__["formatJsonRpcRequest"])(_request.method, _request.params || []), context)); + + case 1: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function request(_x, _x2) { + return _request2.apply(this, arguments); + } + + return request; + }() + }, { + key: "requestStrict", + value: function () { + var _requestStrict = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(request, context) { + var _this2 = this; + + return regeneratorRuntime.wrap(function _callee5$(_context5) { + while (1) { + switch (_context5.prev = _context5.next) { + case 0: + return _context5.abrupt("return", new Promise( /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(resolve, reject) { + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + if (_this2.connection.connected) { + _context4.next = 9; + break; + } + + _context4.prev = 1; + _context4.next = 4; + return _this2.open(); + + case 4: + _context4.next = 9; + break; + + case 6: + _context4.prev = 6; + _context4.t0 = _context4["catch"](1); + reject(_context4.t0); + + case 9: + _this2.events.on("".concat(request.id), function (response) { + if (Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__["isJsonRpcError"])(response)) { + reject(response.error.message); + } else { + resolve(response.result); + } + }); + + _context4.prev = 10; + _context4.next = 13; + return _this2.connection.send(request, context); + + case 13: + _context4.next = 18; + break; + + case 15: + _context4.prev = 15; + _context4.t1 = _context4["catch"](10); + reject(_context4.t1); + + case 18: + case "end": + return _context4.stop(); + } + } + }, _callee4, null, [[1, 6], [10, 15]]); + })); + + return function (_x5, _x6) { + return _ref.apply(this, arguments); + }; + }())); + + case 1: + case "end": + return _context5.stop(); + } + } + }, _callee5); + })); + + function requestStrict(_x3, _x4) { + return _requestStrict.apply(this, arguments); + } + + return requestStrict; + }() + }, { + key: "setConnection", + value: function setConnection() { + var connection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.connection; + return connection; + } + }, { + key: "onPayload", + value: function onPayload(payload) { + this.events.emit("payload", payload); + + if (Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__["isJsonRpcResponse"])(payload)) { + this.events.emit("".concat(payload.id), payload); + } else { + this.events.emit("message", { + type: payload.method, + data: payload.params + }); + } + } + }, { + key: "open", + value: function () { + var _open = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() { + var _this3 = this; + + var connection, + _args6 = arguments; + return regeneratorRuntime.wrap(function _callee6$(_context6) { + while (1) { + switch (_context6.prev = _context6.next) { + case 0: + connection = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : this.connection; + + if (!(this.connection === connection && this.connection.connected)) { + _context6.next = 3; + break; + } + + return _context6.abrupt("return"); + + case 3: + if (this.connection.connected) this.close(); + + if (!(typeof connection === "string")) { + _context6.next = 8; + break; + } + + _context6.next = 7; + return this.connection.open(connection); + + case 7: + connection = this.connection; + + case 8: + this.connection = this.setConnection(connection); + _context6.next = 11; + return this.connection.open(); + + case 11: + this.connection.on("payload", function (payload) { + return _this3.onPayload(payload); + }); + this.connection.on("close", function () { + return _this3.events.emit("disconnect"); + }); + this.connection.on("error", function (error) { + return _this3.events.emit("error", error); + }); + this.events.emit("connect"); + + case 15: + case "end": + return _context6.stop(); + } + } + }, _callee6, this); + })); + + function open() { + return _open.apply(this, arguments); + } + + return open; + }() + }, { + key: "close", + value: function () { + var _close = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() { + return regeneratorRuntime.wrap(function _callee7$(_context7) { + while (1) { + switch (_context7.prev = _context7.next) { + case 0: + _context7.next = 2; + return this.connection.close(); + + case 2: + this.events.emit("disconnect"); + + case 3: + case "end": + return _context7.stop(); + } + } + }, _callee7, this); + })); + + function close() { + return _close.apply(this, arguments); + } + + return close; + }() + }]); + + return JsonRpcProvider; +}(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__["IJsonRpcProvider"]); +/* harmony default export */ __webpack_exports__["default"] = (JsonRpcProvider); + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _jsonrpc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./jsonrpc */ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/jsonrpc.js"); +/* harmony import */ var _jsonrpc__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_jsonrpc__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _jsonrpc__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _jsonrpc__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); +/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./misc */ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IEvents", function() { return _misc__WEBPACK_IMPORTED_MODULE_1__["IEvents"]; }); + +/* harmony import */ var _provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./provider */ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/provider.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IJsonRpcConnection", function() { return _provider__WEBPACK_IMPORTED_MODULE_2__["IJsonRpcConnection"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IBaseJsonRpcProvider", function() { return _provider__WEBPACK_IMPORTED_MODULE_2__["IBaseJsonRpcProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IJsonRpcProvider", function() { return _provider__WEBPACK_IMPORTED_MODULE_2__["IJsonRpcProvider"]; }); + +/* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validator */ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/validator.js"); +/* harmony import */ var _validator__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_validator__WEBPACK_IMPORTED_MODULE_3__); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _validator__WEBPACK_IMPORTED_MODULE_3__) if(["default","IEvents","IJsonRpcConnection","IBaseJsonRpcProvider","IJsonRpcProvider"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _validator__WEBPACK_IMPORTED_MODULE_3__[key]; }) }(__WEBPACK_IMPORT_KEY__)); + + + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/jsonrpc.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/jsonrpc.js ***! + \***********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js": +/*!********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js ***! + \********************************************************************/ +/*! exports provided: IEvents */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IEvents", function() { return IEvents; }); +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var IEvents = /*#__PURE__*/_createClass(function IEvents() { + _classCallCheck(this, IEvents); +}); + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/provider.js": +/*!************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/provider.js ***! + \************************************************************************/ +/*! exports provided: IJsonRpcConnection, IBaseJsonRpcProvider, IJsonRpcProvider */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IJsonRpcConnection", function() { return IJsonRpcConnection; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IBaseJsonRpcProvider", function() { return IBaseJsonRpcProvider; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IJsonRpcProvider", function() { return IJsonRpcProvider; }); +/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./misc */ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/misc.js"); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + +var IJsonRpcConnection = /*#__PURE__*/function (_IEvents) { + _inherits(IJsonRpcConnection, _IEvents); + + var _super = _createSuper(IJsonRpcConnection); + + function IJsonRpcConnection(opts) { + _classCallCheck(this, IJsonRpcConnection); + + return _super.call(this); + } + + return _createClass(IJsonRpcConnection); +}(_misc__WEBPACK_IMPORTED_MODULE_0__["IEvents"]); +var IBaseJsonRpcProvider = /*#__PURE__*/function (_IEvents2) { + _inherits(IBaseJsonRpcProvider, _IEvents2); + + var _super2 = _createSuper(IBaseJsonRpcProvider); + + function IBaseJsonRpcProvider() { + _classCallCheck(this, IBaseJsonRpcProvider); + + return _super2.call(this); + } + + return _createClass(IBaseJsonRpcProvider); +}(_misc__WEBPACK_IMPORTED_MODULE_0__["IEvents"]); +var IJsonRpcProvider = /*#__PURE__*/function (_IBaseJsonRpcProvider) { + _inherits(IJsonRpcProvider, _IBaseJsonRpcProvider); + + var _super3 = _createSuper(IJsonRpcProvider); + + function IJsonRpcProvider(connection) { + _classCallCheck(this, IJsonRpcProvider); + + return _super3.call(this); + } + + return _createClass(IJsonRpcProvider); +}(IBaseJsonRpcProvider); + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/validator.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-types/dist/esm/validator.js ***! + \*************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js ***! + \*************************************************************************/ +/*! exports provided: PARSE_ERROR, INVALID_REQUEST, METHOD_NOT_FOUND, INVALID_PARAMS, INTERNAL_ERROR, SERVER_ERROR, RESERVED_ERROR_CODES, SERVER_ERROR_CODE_RANGE, STANDARD_ERROR_MAP */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PARSE_ERROR", function() { return PARSE_ERROR; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "INVALID_REQUEST", function() { return INVALID_REQUEST; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "METHOD_NOT_FOUND", function() { return METHOD_NOT_FOUND; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "INVALID_PARAMS", function() { return INVALID_PARAMS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "INTERNAL_ERROR", function() { return INTERNAL_ERROR; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SERVER_ERROR", function() { return SERVER_ERROR; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RESERVED_ERROR_CODES", function() { return RESERVED_ERROR_CODES; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SERVER_ERROR_CODE_RANGE", function() { return SERVER_ERROR_CODE_RANGE; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STANDARD_ERROR_MAP", function() { return STANDARD_ERROR_MAP; }); +var _STANDARD_ERROR_MAP; + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var PARSE_ERROR = "PARSE_ERROR"; +var INVALID_REQUEST = "INVALID_REQUEST"; +var METHOD_NOT_FOUND = "METHOD_NOT_FOUND"; +var INVALID_PARAMS = "INVALID_PARAMS"; +var INTERNAL_ERROR = "INTERNAL_ERROR"; +var SERVER_ERROR = "SERVER_ERROR"; +var RESERVED_ERROR_CODES = [-32700, -32600, -32601, -32602, -32603]; +var SERVER_ERROR_CODE_RANGE = [-32000, -32099]; +var STANDARD_ERROR_MAP = (_STANDARD_ERROR_MAP = {}, _defineProperty(_STANDARD_ERROR_MAP, PARSE_ERROR, { + code: -32700, + message: "Parse error" +}), _defineProperty(_STANDARD_ERROR_MAP, INVALID_REQUEST, { + code: -32600, + message: "Invalid Request" +}), _defineProperty(_STANDARD_ERROR_MAP, METHOD_NOT_FOUND, { + code: -32601, + message: "Method not found" +}), _defineProperty(_STANDARD_ERROR_MAP, INVALID_PARAMS, { + code: -32602, + message: "Invalid params" +}), _defineProperty(_STANDARD_ERROR_MAP, INTERNAL_ERROR, { + code: -32603, + message: "Internal error" +}), _defineProperty(_STANDARD_ERROR_MAP, SERVER_ERROR, { + code: -32000, + message: "Server error" +}), _STANDARD_ERROR_MAP); + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js ***! + \*******************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNodeJs", function() { return isNodeJs; }); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/environment */ "./node_modules/@walletconnect/environment/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__) if(["default","isNodeJs"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); + +var isNodeJs = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["isNode"]; + + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js ***! + \*********************************************************************/ +/*! exports provided: isServerErrorCode, isReservedErrorCode, isValidErrorCode, getError, getErrorByCode, validateJsonRpcError, parseConnectionError */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isServerErrorCode", function() { return isServerErrorCode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReservedErrorCode", function() { return isReservedErrorCode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidErrorCode", function() { return isValidErrorCode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getError", function() { return getError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getErrorByCode", function() { return getErrorByCode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "validateJsonRpcError", function() { return validateJsonRpcError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseConnectionError", function() { return parseConnectionError; }); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js"); + +function isServerErrorCode(code) { + return code <= _constants__WEBPACK_IMPORTED_MODULE_0__["SERVER_ERROR_CODE_RANGE"][0] && code >= _constants__WEBPACK_IMPORTED_MODULE_0__["SERVER_ERROR_CODE_RANGE"][1]; +} +function isReservedErrorCode(code) { + return _constants__WEBPACK_IMPORTED_MODULE_0__["RESERVED_ERROR_CODES"].includes(code); +} +function isValidErrorCode(code) { + return typeof code === "number"; +} +function getError(type) { + if (!Object.keys(_constants__WEBPACK_IMPORTED_MODULE_0__["STANDARD_ERROR_MAP"]).includes(type)) { + return _constants__WEBPACK_IMPORTED_MODULE_0__["STANDARD_ERROR_MAP"][_constants__WEBPACK_IMPORTED_MODULE_0__["INTERNAL_ERROR"]]; + } + + return _constants__WEBPACK_IMPORTED_MODULE_0__["STANDARD_ERROR_MAP"][type]; +} +function getErrorByCode(code) { + var match = Object.values(_constants__WEBPACK_IMPORTED_MODULE_0__["STANDARD_ERROR_MAP"]).find(function (e) { + return e.code === code; + }); + + if (!match) { + return _constants__WEBPACK_IMPORTED_MODULE_0__["STANDARD_ERROR_MAP"][_constants__WEBPACK_IMPORTED_MODULE_0__["INTERNAL_ERROR"]]; + } + + return match; +} +function validateJsonRpcError(response) { + if (typeof response.error.code === "undefined") { + return { + valid: false, + error: "Missing code for JSON-RPC error" + }; + } + + if (typeof response.error.message === "undefined") { + return { + valid: false, + error: "Missing message for JSON-RPC error" + }; + } + + if (!isValidErrorCode(response.error.code)) { + return { + valid: false, + error: "Invalid error code type for JSON-RPC: ".concat(response.error.code) + }; + } + + if (isReservedErrorCode(response.error.code)) { + var error = getErrorByCode(response.error.code); + + if (error.message !== _constants__WEBPACK_IMPORTED_MODULE_0__["STANDARD_ERROR_MAP"][_constants__WEBPACK_IMPORTED_MODULE_0__["INTERNAL_ERROR"]].message && response.error.message === error.message) { + return { + valid: false, + error: "Invalid error code message for JSON-RPC: ".concat(response.error.code) + }; + } + } + + return { + valid: true + }; +} +function parseConnectionError(e, url, type) { + return e.message.includes("getaddrinfo ENOTFOUND") || e.message.includes("connect ECONNREFUSED") ? new Error("Unavailable ".concat(type, " RPC url at ").concat(url)) : e; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/format.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/format.js ***! + \**********************************************************************/ +/*! exports provided: payloadId, formatJsonRpcRequest, formatJsonRpcResult, formatJsonRpcError, formatErrorMessage */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "payloadId", function() { return payloadId; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatJsonRpcRequest", function() { return formatJsonRpcRequest; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatJsonRpcResult", function() { return formatJsonRpcResult; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatJsonRpcError", function() { return formatJsonRpcError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatErrorMessage", function() { return formatErrorMessage; }); +/* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js"); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js"); + + +function payloadId() { + var date = Date.now() * Math.pow(10, 3); + var extra = Math.floor(Math.random() * Math.pow(10, 3)); + return date + extra; +} +function formatJsonRpcRequest(method, params, id) { + return { + id: id || payloadId(), + jsonrpc: "2.0", + method: method, + params: params + }; +} +function formatJsonRpcResult(id, result) { + return { + id: id, + jsonrpc: "2.0", + result: result + }; +} +function formatJsonRpcError(id, error) { + return { + id: id, + jsonrpc: "2.0", + error: formatErrorMessage(error) + }; +} +function formatErrorMessage(error) { + if (typeof error === "undefined") { + return Object(_error__WEBPACK_IMPORTED_MODULE_0__["getError"])(_constants__WEBPACK_IMPORTED_MODULE_1__["INTERNAL_ERROR"]); + } + + if (typeof error === "string") { + error = Object.assign(Object.assign({}, Object(_error__WEBPACK_IMPORTED_MODULE_0__["getError"])(_constants__WEBPACK_IMPORTED_MODULE_1__["SERVER_ERROR"])), { + message: error + }); + } + + if (Object(_error__WEBPACK_IMPORTED_MODULE_0__["isReservedErrorCode"])(error.code)) { + error = Object(_error__WEBPACK_IMPORTED_MODULE_0__["getErrorByCode"])(error.code); + } + + return error; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/constants.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "PARSE_ERROR", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["PARSE_ERROR"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "INVALID_REQUEST", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["INVALID_REQUEST"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "METHOD_NOT_FOUND", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["METHOD_NOT_FOUND"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "INVALID_PARAMS", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["INVALID_PARAMS"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "INTERNAL_ERROR", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["INTERNAL_ERROR"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SERVER_ERROR", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["SERVER_ERROR"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RESERVED_ERROR_CODES", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["RESERVED_ERROR_CODES"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SERVER_ERROR_CODE_RANGE", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["SERVER_ERROR_CODE_RANGE"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "STANDARD_ERROR_MAP", function() { return _constants__WEBPACK_IMPORTED_MODULE_0__["STANDARD_ERROR_MAP"]; }); + +/* harmony import */ var _error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./error */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/error.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isServerErrorCode", function() { return _error__WEBPACK_IMPORTED_MODULE_1__["isServerErrorCode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isReservedErrorCode", function() { return _error__WEBPACK_IMPORTED_MODULE_1__["isReservedErrorCode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidErrorCode", function() { return _error__WEBPACK_IMPORTED_MODULE_1__["isValidErrorCode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getError", function() { return _error__WEBPACK_IMPORTED_MODULE_1__["getError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getErrorByCode", function() { return _error__WEBPACK_IMPORTED_MODULE_1__["getErrorByCode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "validateJsonRpcError", function() { return _error__WEBPACK_IMPORTED_MODULE_1__["validateJsonRpcError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseConnectionError", function() { return _error__WEBPACK_IMPORTED_MODULE_1__["parseConnectionError"]; }); + +/* harmony import */ var _env__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./env */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/env.js"); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _env__WEBPACK_IMPORTED_MODULE_2__) if(["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _env__WEBPACK_IMPORTED_MODULE_2__[key]; }) }(__WEBPACK_IMPORT_KEY__)); +/* harmony import */ var _format__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./format */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/format.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "payloadId", function() { return _format__WEBPACK_IMPORTED_MODULE_3__["payloadId"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatJsonRpcRequest", function() { return _format__WEBPACK_IMPORTED_MODULE_3__["formatJsonRpcRequest"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatJsonRpcResult", function() { return _format__WEBPACK_IMPORTED_MODULE_3__["formatJsonRpcResult"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatJsonRpcError", function() { return _format__WEBPACK_IMPORTED_MODULE_3__["formatJsonRpcError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatErrorMessage", function() { return _format__WEBPACK_IMPORTED_MODULE_3__["formatErrorMessage"]; }); + +/* harmony import */ var _routing__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./routing */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/routing.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidRoute", function() { return _routing__WEBPACK_IMPORTED_MODULE_4__["isValidRoute"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidDefaultRoute", function() { return _routing__WEBPACK_IMPORTED_MODULE_4__["isValidDefaultRoute"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidWildcardRoute", function() { return _routing__WEBPACK_IMPORTED_MODULE_4__["isValidWildcardRoute"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidLeadingWildcardRoute", function() { return _routing__WEBPACK_IMPORTED_MODULE_4__["isValidLeadingWildcardRoute"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidTrailingWildcardRoute", function() { return _routing__WEBPACK_IMPORTED_MODULE_4__["isValidTrailingWildcardRoute"]; }); + +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./types */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/types.js"); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _types__WEBPACK_IMPORTED_MODULE_5__) if(["default","PARSE_ERROR","INVALID_REQUEST","METHOD_NOT_FOUND","INVALID_PARAMS","INTERNAL_ERROR","SERVER_ERROR","RESERVED_ERROR_CODES","SERVER_ERROR_CODE_RANGE","STANDARD_ERROR_MAP","isServerErrorCode","isReservedErrorCode","isValidErrorCode","getError","getErrorByCode","validateJsonRpcError","parseConnectionError","payloadId","formatJsonRpcRequest","formatJsonRpcResult","formatJsonRpcError","formatErrorMessage","isValidRoute","isValidDefaultRoute","isValidWildcardRoute","isValidLeadingWildcardRoute","isValidTrailingWildcardRoute"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _types__WEBPACK_IMPORTED_MODULE_5__[key]; }) }(__WEBPACK_IMPORT_KEY__)); +/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./url */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/url.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isHttpUrl", function() { return _url__WEBPACK_IMPORTED_MODULE_6__["isHttpUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isWsUrl", function() { return _url__WEBPACK_IMPORTED_MODULE_6__["isWsUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isLocalhostUrl", function() { return _url__WEBPACK_IMPORTED_MODULE_6__["isLocalhostUrl"]; }); + +/* harmony import */ var _validators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./validators */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/validators.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcPayload", function() { return _validators__WEBPACK_IMPORTED_MODULE_7__["isJsonRpcPayload"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcRequest", function() { return _validators__WEBPACK_IMPORTED_MODULE_7__["isJsonRpcRequest"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResponse", function() { return _validators__WEBPACK_IMPORTED_MODULE_7__["isJsonRpcResponse"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResult", function() { return _validators__WEBPACK_IMPORTED_MODULE_7__["isJsonRpcResult"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcError", function() { return _validators__WEBPACK_IMPORTED_MODULE_7__["isJsonRpcError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcValidationInvalid", function() { return _validators__WEBPACK_IMPORTED_MODULE_7__["isJsonRpcValidationInvalid"]; }); + + + + + + + + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/routing.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/routing.js ***! + \***********************************************************************/ +/*! exports provided: isValidRoute, isValidDefaultRoute, isValidWildcardRoute, isValidLeadingWildcardRoute, isValidTrailingWildcardRoute */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidRoute", function() { return isValidRoute; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidDefaultRoute", function() { return isValidDefaultRoute; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidWildcardRoute", function() { return isValidWildcardRoute; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidLeadingWildcardRoute", function() { return isValidLeadingWildcardRoute; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidTrailingWildcardRoute", function() { return isValidTrailingWildcardRoute; }); +function isValidRoute(route) { + if (route.includes("*")) { + return isValidWildcardRoute(route); + } + + if (/\W/g.test(route)) { + return false; + } + + return true; +} +function isValidDefaultRoute(route) { + return route === "*"; +} +function isValidWildcardRoute(route) { + if (isValidDefaultRoute(route)) { + return true; + } + + if (!route.includes("*")) { + return false; + } + + if (route.split("*").length !== 2) { + return false; + } + + if (route.split("*").filter(function (x) { + return x.trim() === ""; + }).length !== 1) { + return false; + } + + return true; +} +function isValidLeadingWildcardRoute(route) { + return !isValidDefaultRoute(route) && isValidWildcardRoute(route) && !route.split("*")[0].trim(); +} +function isValidTrailingWildcardRoute(route) { + return !isValidDefaultRoute(route) && isValidWildcardRoute(route) && !route.split("*")[1].trim(); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/types.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/types.js ***! + \*********************************************************************/ +/*! no static exports found */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/jsonrpc-types */ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js"); +/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__)); + + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/url.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/url.js ***! + \*******************************************************************/ +/*! exports provided: isHttpUrl, isWsUrl, isLocalhostUrl */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isHttpUrl", function() { return isHttpUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWsUrl", function() { return isWsUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLocalhostUrl", function() { return isLocalhostUrl; }); +var HTTP_REGEX = "^https?:"; +var WS_REGEX = "^wss?:"; + +function getUrlProtocol(url) { + var matches = url.match(new RegExp(/^\w+:/, "gi")); + if (!matches || !matches.length) return; + return matches[0]; +} + +function matchRegexProtocol(url, regex) { + var protocol = getUrlProtocol(url); + if (typeof protocol === "undefined") return false; + return new RegExp(regex).test(protocol); +} + +function isHttpUrl(url) { + return matchRegexProtocol(url, HTTP_REGEX); +} +function isWsUrl(url) { + return matchRegexProtocol(url, WS_REGEX); +} +function isLocalhostUrl(url) { + return new RegExp("wss?://localhost(:d{2,5})?").test(url); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/validators.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@walletconnect/jsonrpc-utils/dist/esm/validators.js ***! + \**************************************************************************/ +/*! exports provided: isJsonRpcPayload, isJsonRpcRequest, isJsonRpcResponse, isJsonRpcResult, isJsonRpcError, isJsonRpcValidationInvalid */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcPayload", function() { return isJsonRpcPayload; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcRequest", function() { return isJsonRpcRequest; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResponse", function() { return isJsonRpcResponse; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResult", function() { return isJsonRpcResult; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcError", function() { return isJsonRpcError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcValidationInvalid", function() { return isJsonRpcValidationInvalid; }); +function isJsonRpcPayload(payload) { + return "id" in payload && "jsonrpc" in payload && payload.jsonrpc === "2.0"; +} +function isJsonRpcRequest(payload) { + return isJsonRpcPayload(payload) && "method" in payload; +} +function isJsonRpcResponse(payload) { + return isJsonRpcPayload(payload) && (isJsonRpcResult(payload) || isJsonRpcError(payload)); +} +function isJsonRpcResult(payload) { + return "result" in payload; +} +function isJsonRpcError(payload) { + return "error" in payload; +} +function isJsonRpcValidationInvalid(validation) { + return "error" in validation && validation.valid === false; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/qrcode-modal/dist/cjs/index.js": +/*!********************************************************************!*\ + !*** ./node_modules/@walletconnect/qrcode-modal/dist/cjs/index.js ***! + \********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _interopDefault(ex) { + return ex && _typeof(ex) === 'object' && 'default' in ex ? ex['default'] : ex; +} + +var browserUtils = __webpack_require__(/*! @walletconnect/browser-utils */ "./node_modules/@walletconnect/browser-utils/dist/esm/index.js"); + +var QRCode = _interopDefault(__webpack_require__(/*! qrcode */ "./node_modules/qrcode/lib/browser.js")); + +var copy = _interopDefault(__webpack_require__(/*! copy-to-clipboard */ "./node_modules/copy-to-clipboard/index.js")); + +var React = __webpack_require__(/*! preact/compat */ "./node_modules/@walletconnect/qrcode-modal/node_modules/preact/compat/dist/compat.module.js"); + +function open(uri) { + QRCode.toString(uri, { + type: "terminal" + }).then(console.log); +} + +var WALLETCONNECT_STYLE_SHEET = ":root {\n --animation-duration: 300ms;\n}\n\n@keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes fadeOut {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n}\n\n.animated {\n animation-duration: var(--animation-duration);\n animation-fill-mode: both;\n}\n\n.fadeIn {\n animation-name: fadeIn;\n}\n\n.fadeOut {\n animation-name: fadeOut;\n}\n\n#walletconnect-wrapper {\n -webkit-user-select: none;\n align-items: center;\n display: flex;\n height: 100%;\n justify-content: center;\n left: 0;\n pointer-events: none;\n position: fixed;\n top: 0;\n user-select: none;\n width: 100%;\n z-index: 99999999999999;\n}\n\n.walletconnect-modal__headerLogo {\n height: 21px;\n}\n\n.walletconnect-modal__header p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n align-items: flex-start;\n display: flex;\n flex: 1;\n margin-left: 5px;\n}\n\n.walletconnect-modal__close__wrapper {\n position: absolute;\n top: 0px;\n right: 0px;\n z-index: 10000;\n background: white;\n border-radius: 26px;\n padding: 6px;\n box-sizing: border-box;\n width: 26px;\n height: 26px;\n cursor: pointer;\n}\n\n.walletconnect-modal__close__icon {\n position: relative;\n top: 7px;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n transform: rotate(45deg);\n}\n\n.walletconnect-modal__close__line1 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n}\n\n.walletconnect-modal__close__line2 {\n position: absolute;\n width: 100%;\n border: 1px solid rgb(48, 52, 59);\n transform: rotate(90deg);\n}\n\n.walletconnect-qrcode__base {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n background: rgba(37, 41, 46, 0.95);\n height: 100%;\n left: 0;\n pointer-events: auto;\n position: fixed;\n top: 0;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n width: 100%;\n will-change: opacity;\n padding: 40px;\n box-sizing: border-box;\n}\n\n.walletconnect-qrcode__text {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 10px 0 20px 0;\n text-align: center;\n width: 100%;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-qrcode__text {\n font-size: 4vw;\n }\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-qrcode__text {\n font-size: 14px;\n }\n}\n\n.walletconnect-qrcode__image {\n width: calc(100% - 30px);\n box-sizing: border-box;\n cursor: none;\n margin: 0 auto;\n}\n\n.walletconnect-qrcode__notification {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n font-size: 16px;\n padding: 16px 20px;\n border-radius: 16px;\n text-align: center;\n transition: all 0.1s ease-in-out;\n background: white;\n color: black;\n margin-bottom: -60px;\n opacity: 0;\n}\n\n.walletconnect-qrcode__notification.notification__show {\n opacity: 1;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__header {\n height: 130px;\n }\n .walletconnect-modal__base {\n overflow: auto;\n }\n}\n\n@media only screen and (min-device-width: 415px) and (max-width: 768px) {\n #content {\n max-width: 768px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 375px) and (max-width: 415px) {\n #content {\n max-width: 414px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (min-width: 320px) and (max-width: 375px) {\n #content {\n max-width: 375px;\n box-sizing: border-box;\n }\n}\n\n@media only screen and (max-width: 320px) {\n #content {\n max-width: 320px;\n box-sizing: border-box;\n }\n}\n\n.walletconnect-modal__base {\n -webkit-font-smoothing: antialiased;\n background: #ffffff;\n border-radius: 24px;\n box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);\n font-family: ui-rounded, \"SF Pro Rounded\", \"SF Pro Text\", medium-content-sans-serif-font,\n -apple-system, BlinkMacSystemFont, ui-sans-serif, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell,\n \"Open Sans\", \"Helvetica Neue\", sans-serif;\n margin-top: 41px;\n padding: 24px 24px 22px;\n pointer-events: auto;\n position: relative;\n text-align: center;\n transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);\n will-change: transform;\n overflow: visible;\n transform: translateY(-50%);\n top: 50%;\n max-width: 500px;\n margin: auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__base {\n padding: 24px 12px;\n }\n}\n\n.walletconnect-modal__base .hidden {\n transform: translateY(150%);\n transition: 0.125s cubic-bezier(0.4, 0, 1, 1);\n}\n\n.walletconnect-modal__header {\n align-items: center;\n display: flex;\n height: 26px;\n left: 0;\n justify-content: space-between;\n position: absolute;\n top: -42px;\n width: 100%;\n}\n\n.walletconnect-modal__base .wc-logo {\n align-items: center;\n display: flex;\n height: 26px;\n margin-top: 15px;\n padding-bottom: 15px;\n pointer-events: auto;\n}\n\n.walletconnect-modal__base .wc-logo div {\n background-color: #3399ff;\n height: 21px;\n margin-right: 5px;\n mask-image: url(\"images/wc-logo.svg\") center no-repeat;\n width: 32px;\n}\n\n.walletconnect-modal__base .wc-logo p {\n color: #ffffff;\n font-size: 20px;\n font-weight: 600;\n margin: 0;\n}\n\n.walletconnect-modal__base h2 {\n color: rgba(60, 66, 82, 0.6);\n font-size: 16px;\n font-weight: 600;\n letter-spacing: 0;\n line-height: 1.1875em;\n margin: 0 0 19px 0;\n text-align: center;\n width: 100%;\n}\n\n.walletconnect-modal__base__row {\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n align-items: center;\n border-radius: 20px;\n cursor: pointer;\n display: flex;\n height: 56px;\n justify-content: space-between;\n padding: 0 15px;\n position: relative;\n margin: 0px 0px 8px;\n text-align: left;\n transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n will-change: transform;\n text-decoration: none;\n}\n\n.walletconnect-modal__base__row:hover {\n background: rgba(60, 66, 82, 0.06);\n}\n\n.walletconnect-modal__base__row:active {\n background: rgba(60, 66, 82, 0.06);\n transform: scale(0.975);\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n}\n\n.walletconnect-modal__base__row__h3 {\n color: #25292e;\n font-size: 20px;\n font-weight: 700;\n margin: 0;\n padding-bottom: 3px;\n}\n\n.walletconnect-modal__base__row__right {\n align-items: center;\n display: flex;\n justify-content: center;\n}\n\n.walletconnect-modal__base__row__right__app-icon {\n border-radius: 8px;\n height: 34px;\n margin: 0 11px 2px 0;\n width: 34px;\n background-size: 100%;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-modal__base__row__right__caret {\n height: 18px;\n opacity: 0.3;\n transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);\n width: 8px;\n will-change: opacity;\n}\n\n.walletconnect-modal__base__row:hover .caret,\n.walletconnect-modal__base__row:active .caret {\n opacity: 0.6;\n}\n\n.walletconnect-modal__mobile__toggle {\n width: 80%;\n display: flex;\n margin: 0 auto;\n position: relative;\n overflow: hidden;\n border-radius: 8px;\n margin-bottom: 18px;\n background: #d4d5d9;\n}\n\n.walletconnect-modal__single_wallet {\n display: flex;\n justify-content: center;\n margin-top: 7px;\n margin-bottom: 18px;\n}\n\n.walletconnect-modal__single_wallet a {\n cursor: pointer;\n color: rgb(64, 153, 255);\n font-size: 21px;\n font-weight: 800;\n text-decoration: none !important;\n margin: 0 auto;\n}\n\n.walletconnect-modal__mobile__toggle_selector {\n width: calc(50% - 8px);\n background: white;\n position: absolute;\n border-radius: 5px;\n height: calc(100% - 8px);\n top: 4px;\n transition: all 0.2s ease-in-out;\n transform: translate3d(4px, 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {\n transform: translate3d(calc(100% + 12px), 0, 0);\n}\n\n.walletconnect-modal__mobile__toggle a {\n font-size: 12px;\n width: 50%;\n text-align: center;\n padding: 8px;\n margin: 0;\n font-weight: 600;\n z-index: 1;\n}\n\n.walletconnect-modal__footer {\n display: flex;\n justify-content: center;\n margin-top: 20px;\n}\n\n@media only screen and (max-width: 768px) {\n .walletconnect-modal__footer {\n margin-top: 5vw;\n }\n}\n\n.walletconnect-modal__footer a {\n cursor: pointer;\n color: #898d97;\n font-size: 15px;\n margin: 0 auto;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-modal__footer a {\n font-size: 14px;\n }\n}\n\n.walletconnect-connect__buttons__wrapper {\n max-height: 44vh;\n}\n\n.walletconnect-connect__buttons__wrapper__android {\n margin: 50% 0;\n}\n\n.walletconnect-connect__buttons__wrapper__wrap {\n display: grid;\n grid-template-columns: repeat(4, 1fr);\n margin: 10px 0;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__buttons__wrapper__wrap {\n margin-top: 40px;\n }\n}\n\n.walletconnect-connect__button {\n background-color: rgb(64, 153, 255);\n padding: 12px;\n border-radius: 8px;\n text-decoration: none;\n color: rgb(255, 255, 255);\n font-weight: 500;\n}\n\n.walletconnect-connect__button__icon_anchor {\n cursor: pointer;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n margin: 8px;\n width: 42px;\n justify-self: center;\n flex-direction: column;\n text-decoration: none !important;\n}\n\n@media only screen and (max-width: 320px) {\n .walletconnect-connect__button__icon_anchor {\n margin: 4px;\n }\n}\n\n.walletconnect-connect__button__icon {\n border-radius: 10px;\n height: 42px;\n margin: 0;\n width: 42px;\n background-size: cover !important;\n box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);\n}\n\n.walletconnect-connect__button__text {\n color: #424952;\n font-size: 2.7vw;\n text-decoration: none !important;\n padding: 0;\n margin-top: 1.8vw;\n font-weight: 600;\n}\n\n@media only screen and (min-width: 768px) {\n .walletconnect-connect__button__text {\n font-size: 16px;\n margin-top: 12px;\n }\n}\n\n.walletconnect-search__input {\n border: none;\n background: #d4d5d9;\n border-style: none;\n padding: 8px 16px;\n outline: none;\n font-style: normal;\n font-stretch: normal;\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: normal;\n text-align: left;\n border-radius: 8px;\n width: calc(100% - 16px);\n margin: 0;\n margin-bottom: 8px;\n}\n"; // A type of promise-like that resolves synchronously and supports only one observer + +var _iteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator")) : "@@iterator"; // Asynchronously iterate through an object's values + + +var _asyncIteratorSymbol = /*#__PURE__*/typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator")) : "@@asyncIterator"; // Asynchronously iterate on a value using it's async iterator if present, or its synchronous iterator if missing + + +function _catch(body, recover) { + try { + var result = body(); + } catch (e) { + return recover(e); + } + + if (result && result.then) { + return result.then(void 0, recover); + } + + return result; +} // Asynchronously await a promise and pass the result to a finally continuation + + +var WALLETCONNECT_LOGO_SVG_URL = "data:image/svg+xml,%3C?xml version='1.0' encoding='UTF-8'?%3E %3Csvg width='300px' height='185px' viewBox='0 0 300 185' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E %3C!-- Generator: Sketch 49.3 (51167) - http://www.bohemiancoding.com/sketch --%3E %3Ctitle%3EWalletConnect%3C/title%3E %3Cdesc%3ECreated with Sketch.%3C/desc%3E %3Cdefs%3E%3C/defs%3E %3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E %3Cg id='walletconnect-logo-alt' fill='%233B99FC' fill-rule='nonzero'%3E %3Cpath d='M61.4385429,36.2562612 C110.349767,-11.6319051 189.65053,-11.6319051 238.561752,36.2562612 L244.448297,42.0196786 C246.893858,44.4140867 246.893858,48.2961898 244.448297,50.690599 L224.311602,70.406102 C223.088821,71.6033071 221.106302,71.6033071 219.883521,70.406102 L211.782937,62.4749541 C177.661245,29.0669724 122.339051,29.0669724 88.2173582,62.4749541 L79.542302,70.9685592 C78.3195204,72.1657633 76.337001,72.1657633 75.1142214,70.9685592 L54.9775265,51.2530561 C52.5319653,48.8586469 52.5319653,44.9765439 54.9775265,42.5821357 L61.4385429,36.2562612 Z M280.206339,77.0300061 L298.128036,94.5769031 C300.573585,96.9713 300.573599,100.85338 298.128067,103.247793 L217.317896,182.368927 C214.872352,184.763353 210.907314,184.76338 208.461736,182.368989 C208.461726,182.368979 208.461714,182.368967 208.461704,182.368957 L151.107561,126.214385 C150.496171,125.615783 149.504911,125.615783 148.893521,126.214385 C148.893517,126.214389 148.893514,126.214393 148.89351,126.214396 L91.5405888,182.368927 C89.095052,184.763359 85.1300133,184.763399 82.6844276,182.369014 C82.6844133,182.369 82.684398,182.368986 82.6843827,182.36897 L1.87196327,103.246785 C-0.573596939,100.852377 -0.573596939,96.9702735 1.87196327,94.5758653 L19.7936929,77.028998 C22.2392531,74.6345898 26.2042918,74.6345898 28.6498531,77.028998 L86.0048306,133.184355 C86.6162214,133.782957 87.6074796,133.782957 88.2188704,133.184355 C88.2188796,133.184346 88.2188878,133.184338 88.2188969,133.184331 L145.571,77.028998 C148.016505,74.6345347 151.981544,74.6344449 154.427161,77.028798 C154.427195,77.0288316 154.427229,77.0288653 154.427262,77.028899 L211.782164,133.184331 C212.393554,133.782932 213.384814,133.782932 213.996204,133.184331 L271.350179,77.0300061 C273.79574,74.6355969 277.760778,74.6355969 280.206339,77.0300061 Z' id='WalletConnect'%3E%3C/path%3E %3C/g%3E %3C/g%3E %3C/svg%3E"; +var WALLETCONNECT_HEADER_TEXT = "WalletConnect"; +var ANIMATION_DURATION = 300; +var DEFAULT_BUTTON_COLOR = "rgb(64, 153, 255)"; +var WALLETCONNECT_WRAPPER_ID = "walletconnect-wrapper"; +var WALLETCONNECT_STYLE_ID = "walletconnect-style-sheet"; +var WALLETCONNECT_MODAL_ID = "walletconnect-qrcode-modal"; +var WALLETCONNECT_CLOSE_BUTTON_ID = "walletconnect-qrcode-close"; +var WALLETCONNECT_CTA_TEXT_ID = "walletconnect-qrcode-text"; +var WALLETCONNECT_CONNECT_BUTTON_ID = "walletconnect-connect-button"; + +function Header(props) { + return React.createElement("div", { + className: "walletconnect-modal__header" + }, React.createElement("img", { + src: WALLETCONNECT_LOGO_SVG_URL, + className: "walletconnect-modal__headerLogo" + }), React.createElement("p", null, WALLETCONNECT_HEADER_TEXT), React.createElement("div", { + className: "walletconnect-modal__close__wrapper", + onClick: props.onClose + }, React.createElement("div", { + id: WALLETCONNECT_CLOSE_BUTTON_ID, + className: "walletconnect-modal__close__icon" + }, React.createElement("div", { + className: "walletconnect-modal__close__line1" + }), React.createElement("div", { + className: "walletconnect-modal__close__line2" + })))); +} + +function ConnectButton(props) { + return React.createElement("a", { + className: "walletconnect-connect__button", + href: props.href, + id: WALLETCONNECT_CONNECT_BUTTON_ID + "-" + props.name, + onClick: props.onClick, + rel: "noopener noreferrer", + style: { + backgroundColor: props.color + }, + target: "_blank" + }, props.name); +} + +var CARET_SVG_URL = "data:image/svg+xml,%3Csvg width='8' height='18' viewBox='0 0 8 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M0.586301 0.213898C0.150354 0.552968 0.0718197 1.18124 0.41089 1.61719L5.2892 7.88931C5.57007 8.25042 5.57007 8.75608 5.2892 9.11719L0.410889 15.3893C0.071819 15.8253 0.150353 16.4535 0.586301 16.7926C1.02225 17.1317 1.65052 17.0531 1.98959 16.6172L6.86791 10.3451C7.7105 9.26174 7.7105 7.74476 6.86791 6.66143L1.98959 0.38931C1.65052 -0.0466374 1.02225 -0.125172 0.586301 0.213898Z' fill='%233C4252'/%3E %3C/svg%3E"; + +function WalletButton(props) { + var color = props.color; + var href = props.href; + var name = props.name; + var logo = props.logo; + var onClick = props.onClick; + return React.createElement("a", { + className: "walletconnect-modal__base__row", + href: href, + onClick: onClick, + rel: "noopener noreferrer", + target: "_blank" + }, React.createElement("h3", { + className: "walletconnect-modal__base__row__h3" + }, name), React.createElement("div", { + className: "walletconnect-modal__base__row__right" + }, React.createElement("div", { + className: "walletconnect-modal__base__row__right__app-icon", + style: { + background: "url('" + logo + "') " + color, + backgroundSize: "100%" + } + }), React.createElement("img", { + src: CARET_SVG_URL, + className: "walletconnect-modal__base__row__right__caret" + }))); +} + +function WalletIcon(props) { + var color = props.color; + var href = props.href; + var name = props.name; + var logo = props.logo; + var onClick = props.onClick; + var fontSize = window.innerWidth < 768 ? (name.length > 8 ? 2.5 : 2.7) + "vw" : "inherit"; + return React.createElement("a", { + className: "walletconnect-connect__button__icon_anchor", + href: href, + onClick: onClick, + rel: "noopener noreferrer", + target: "_blank" + }, React.createElement("div", { + className: "walletconnect-connect__button__icon", + style: { + background: "url('" + logo + "') " + color, + backgroundSize: "100%" + } + }), React.createElement("div", { + style: { + fontSize: fontSize + }, + className: "walletconnect-connect__button__text" + }, name)); +} + +var GRID_MIN_COUNT = 5; +var LINKS_PER_PAGE = 12; + +function LinkDisplay(props) { + var android = browserUtils.isAndroid(); + var ref = React.useState(""); + var input = ref[0]; + var setInput = ref[1]; + var ref$1 = React.useState(""); + var filter = ref$1[0]; + var setFilter = ref$1[1]; + var ref$2 = React.useState(1); + var page = ref$2[0]; + var setPage = ref$2[1]; + var links = filter ? props.links.filter(function (link) { + return link.name.toLowerCase().includes(filter.toLowerCase()); + }) : props.links; + var errorMessage = props.errorMessage; + var grid = filter || links.length > GRID_MIN_COUNT; + var pages = Math.ceil(links.length / LINKS_PER_PAGE); + var range = [(page - 1) * LINKS_PER_PAGE + 1, page * LINKS_PER_PAGE]; + var pageLinks = links.length ? links.filter(function (_, index) { + return index + 1 >= range[0] && index + 1 <= range[1]; + }) : []; + var hasPaging = !!(!android && pages > 1); + var filterTimeout = undefined; + + function handleInput(e) { + setInput(e.target.value); + clearTimeout(filterTimeout); + + if (e.target.value) { + filterTimeout = setTimeout(function () { + setFilter(e.target.value); + setPage(1); + }, 1000); + } else { + setInput(""); + setFilter(""); + setPage(1); + } + } + + return React.createElement("div", null, React.createElement("p", { + id: WALLETCONNECT_CTA_TEXT_ID, + className: "walletconnect-qrcode__text" + }, android ? props.text.connect_mobile_wallet : props.text.choose_preferred_wallet), !android && React.createElement("input", { + className: "walletconnect-search__input", + placeholder: "Search", + value: input, + onChange: handleInput + }), React.createElement("div", { + className: "walletconnect-connect__buttons__wrapper" + (android ? "__android" : grid && links.length ? "__wrap" : "") + }, !android ? pageLinks.length ? pageLinks.map(function (entry) { + var color = entry.color; + var name = entry.name; + var shortName = entry.shortName; + var logo = entry.logo; + var href = browserUtils.formatIOSMobile(props.uri, entry); + var handleClickIOS = React.useCallback(function () { + browserUtils.saveMobileLinkInfo({ + name: name, + href: href + }); + }, [pageLinks]); + return !grid ? React.createElement(WalletButton, { + color: color, + href: href, + name: name, + logo: logo, + onClick: handleClickIOS + }) : React.createElement(WalletIcon, { + color: color, + href: href, + name: shortName, + logo: logo, + onClick: handleClickIOS + }); + }) : React.createElement(React.Fragment, null, React.createElement("p", null, errorMessage.length ? props.errorMessage : !!props.links.length && !links.length ? props.text.no_wallets_found : props.text.loading)) : React.createElement(ConnectButton, { + name: props.text.connect, + color: DEFAULT_BUTTON_COLOR, + href: props.uri, + onClick: React.useCallback(function () { + browserUtils.saveMobileLinkInfo({ + name: "Unknown", + href: props.uri + }); + }, []) + })), hasPaging && React.createElement("div", { + className: "walletconnect-modal__footer" + }, Array(pages).fill(0).map(function (_, index) { + var pageNumber = index + 1; + var selected = page === pageNumber; + return React.createElement("a", { + style: { + margin: "auto 10px", + fontWeight: selected ? "bold" : "normal" + }, + onClick: function onClick() { + return setPage(pageNumber); + } + }, pageNumber); + }))); +} + +function Notification(props) { + var show = !!props.message.trim(); + return React.createElement("div", { + className: "walletconnect-qrcode__notification" + (show ? " notification__show" : "") + }, props.message); +} + +var formatQRCodeImage = function formatQRCodeImage(data) { + try { + var result = ""; + return Promise.resolve(QRCode.toString(data, { + margin: 0, + type: "svg" + })).then(function (dataString) { + if (typeof dataString === "string") { + result = dataString.replace(" 0) { + return; + } + + React.useEffect(function () { + var initLinks = function initLinks() { + try { + if (android) { + return Promise.resolve(); + } + + setLoading(true); + + var _temp = _catch(function () { + var url = props.qrcodeModalOptions && props.qrcodeModalOptions.registryUrl ? props.qrcodeModalOptions.registryUrl : browserUtils.getWalletRegistryUrl(); + return Promise.resolve(fetch(url).then(function (x) { + return x.json(); + })).then(function (registry) { + var platform = mobile ? "mobile" : "desktop"; + + var _links = browserUtils.getMobileLinkRegistry(browserUtils.formatMobileRegistry(registry, platform), whitelist); + + setLoading(false); + setFetched(true); + setErrorMessage(!_links.length ? props.text.no_supported_wallets : ""); + setLinks(_links); + var hasSingleLink = _links.length === 1; + + if (hasSingleLink) { + setSingleLinkHref(browserUtils.formatIOSMobile(props.uri, _links[0])); + setDisplayQRCode(true); + } + + setHasSingleLink(hasSingleLink); + }); + }, function (e) { + setLoading(false); + setFetched(true); + setErrorMessage(props.text.something_went_wrong); + console.error(e); + }); + + return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0); + } catch (e) { + return Promise.reject(e); + } + }; + + initLinks(); + }); + }; + + getLinksIfNeeded(); + var rightSelected = mobile ? displayQRCode : !displayQRCode; + return React.createElement("div", { + id: WALLETCONNECT_MODAL_ID, + className: "walletconnect-qrcode__base animated fadeIn" + }, React.createElement("div", { + className: "walletconnect-modal__base" + }, React.createElement(Header, { + onClose: props.onClose + }), hasSingleLink && displayQRCode ? React.createElement("div", { + className: "walletconnect-modal__single_wallet" + }, React.createElement("a", { + onClick: function onClick() { + return browserUtils.saveMobileLinkInfo({ + name: links[0].name, + href: singleLinkHref + }); + }, + href: singleLinkHref, + rel: "noopener noreferrer", + target: "_blank" + }, props.text.connect_with + " " + (hasSingleLink ? links[0].name : "") + " ›")) : android || loading || !loading && links.length ? React.createElement("div", { + className: "walletconnect-modal__mobile__toggle" + (rightSelected ? " right__selected" : "") + }, React.createElement("div", { + className: "walletconnect-modal__mobile__toggle_selector" + }), mobile ? React.createElement(React.Fragment, null, React.createElement("a", { + onClick: function onClick() { + return setDisplayQRCode(false), getLinksIfNeeded(); + } + }, props.text.mobile), React.createElement("a", { + onClick: function onClick() { + return setDisplayQRCode(true); + } + }, props.text.qrcode)) : React.createElement(React.Fragment, null, React.createElement("a", { + onClick: function onClick() { + return setDisplayQRCode(true); + } + }, props.text.qrcode), React.createElement("a", { + onClick: function onClick() { + return setDisplayQRCode(false), getLinksIfNeeded(); + } + }, props.text.desktop))) : null, React.createElement("div", null, displayQRCode || !android && !loading && !links.length ? React.createElement(QRCodeDisplay, Object.assign({}, displayProps)) : React.createElement(LinkDisplay, Object.assign({}, displayProps, { + links: links, + errorMessage: errorMessage + }))))); +} + +var de = { + choose_preferred_wallet: "Wähle bevorzugte Wallet", + connect_mobile_wallet: "Verbinde mit Mobile Wallet", + scan_qrcode_with_wallet: "Scanne den QR-code mit einer WalletConnect kompatiblen Wallet", + connect: "Verbinden", + qrcode: "QR-Code", + mobile: "Mobile", + desktop: "Desktop", + copy_to_clipboard: "In die Zwischenablage kopieren", + copied_to_clipboard: "In die Zwischenablage kopiert!", + connect_with: "Verbinden mit Hilfe von", + loading: "Laden...", + something_went_wrong: "Etwas ist schief gelaufen", + no_supported_wallets: "Es gibt noch keine unterstützten Wallet", + no_wallets_found: "keine Wallet gefunden" +}; +var en = { + choose_preferred_wallet: "Choose your preferred wallet", + connect_mobile_wallet: "Connect to Mobile Wallet", + scan_qrcode_with_wallet: "Scan QR code with a WalletConnect-compatible wallet", + connect: "Connect", + qrcode: "QR Code", + mobile: "Mobile", + desktop: "Desktop", + copy_to_clipboard: "Copy to clipboard", + copied_to_clipboard: "Copied to clipboard!", + connect_with: "Connect with", + loading: "Loading...", + something_went_wrong: "Something went wrong", + no_supported_wallets: "There are no supported wallets yet", + no_wallets_found: "No wallets found" +}; +var es = { + choose_preferred_wallet: "Elige tu billetera preferida", + connect_mobile_wallet: "Conectar a billetera móvil", + scan_qrcode_with_wallet: "Escanea el código QR con una billetera compatible con WalletConnect", + connect: "Conectar", + qrcode: "Código QR", + mobile: "Móvil", + desktop: "Desktop", + copy_to_clipboard: "Copiar", + copied_to_clipboard: "Copiado!", + connect_with: "Conectar mediante", + loading: "Cargando...", + something_went_wrong: "Algo salió mal", + no_supported_wallets: "Todavía no hay billeteras compatibles", + no_wallets_found: "No se encontraron billeteras" +}; +var fr = { + choose_preferred_wallet: "Choisissez votre portefeuille préféré", + connect_mobile_wallet: "Se connecter au portefeuille mobile", + scan_qrcode_with_wallet: "Scannez le QR code avec un portefeuille compatible WalletConnect", + connect: "Se connecter", + qrcode: "QR Code", + mobile: "Mobile", + desktop: "Desktop", + copy_to_clipboard: "Copier", + copied_to_clipboard: "Copié!", + connect_with: "Connectez-vous à l'aide de", + loading: "Chargement...", + something_went_wrong: "Quelque chose a mal tourné", + no_supported_wallets: "Il n'y a pas encore de portefeuilles pris en charge", + no_wallets_found: "Aucun portefeuille trouvé" +}; +var ko = { + choose_preferred_wallet: "원하는 지갑을 선택하세요", + connect_mobile_wallet: "모바일 지갑과 연결", + scan_qrcode_with_wallet: "WalletConnect 지원 지갑에서 QR코드를 스캔하세요", + connect: "연결", + qrcode: "QR 코드", + mobile: "모바일", + desktop: "데스크탑", + copy_to_clipboard: "클립보드에 복사", + copied_to_clipboard: "클립보드에 복사되었습니다!", + connect_with: "와 연결하다", + loading: "로드 중...", + something_went_wrong: "문제가 발생했습니다.", + no_supported_wallets: "아직 지원되는 지갑이 없습니다", + no_wallets_found: "지갑을 찾을 수 없습니다" +}; +var pt = { + choose_preferred_wallet: "Escolha sua carteira preferida", + connect_mobile_wallet: "Conectar-se à carteira móvel", + scan_qrcode_with_wallet: "Ler o código QR com uma carteira compatível com WalletConnect", + connect: "Conectar", + qrcode: "Código QR", + mobile: "Móvel", + desktop: "Desktop", + copy_to_clipboard: "Copiar", + copied_to_clipboard: "Copiado!", + connect_with: "Ligar por meio de", + loading: "Carregamento...", + something_went_wrong: "Algo correu mal", + no_supported_wallets: "Ainda não há carteiras suportadas", + no_wallets_found: "Nenhuma carteira encontrada" +}; +var zh = { + choose_preferred_wallet: "选择你的钱包", + connect_mobile_wallet: "连接至移动端钱包", + scan_qrcode_with_wallet: "使用兼容 WalletConnect 的钱包扫描二维码", + connect: "连接", + qrcode: "二维码", + mobile: "移动", + desktop: "桌面", + copy_to_clipboard: "复制到剪贴板", + copied_to_clipboard: "复制到剪贴板成功!", + connect_with: "通过以下方式连接", + loading: "正在加载...", + something_went_wrong: "出了问题", + no_supported_wallets: "目前还没有支持的钱包", + no_wallets_found: "没有找到钱包" +}; +var fa = { + choose_preferred_wallet: "کیف پول مورد نظر خود را انتخاب کنید", + connect_mobile_wallet: "به کیف پول موبایل وصل شوید", + scan_qrcode_with_wallet: "کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید", + connect: "اتصال", + qrcode: "کد QR", + mobile: "سیار", + desktop: "دسکتاپ", + copy_to_clipboard: "کپی به کلیپ بورد", + copied_to_clipboard: "در کلیپ بورد کپی شد!", + connect_with: "ارتباط با", + loading: "...بارگذاری", + something_went_wrong: "مشکلی پیش آمد", + no_supported_wallets: "هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد", + no_wallets_found: "هیچ کیف پولی پیدا نشد" +}; +var languages = { + de: de, + en: en, + es: es, + fr: fr, + ko: ko, + pt: pt, + zh: zh, + fa: fa +}; + +function injectStyleSheet() { + var doc = browserUtils.getDocumentOrThrow(); + var prev = doc.getElementById(WALLETCONNECT_STYLE_ID); + + if (prev) { + doc.head.removeChild(prev); + } + + var style = doc.createElement("style"); + style.setAttribute("id", WALLETCONNECT_STYLE_ID); + style.innerText = WALLETCONNECT_STYLE_SHEET; + doc.head.appendChild(style); +} + +function renderWrapper() { + var doc = browserUtils.getDocumentOrThrow(); + var wrapper = doc.createElement("div"); + wrapper.setAttribute("id", WALLETCONNECT_WRAPPER_ID); + doc.body.appendChild(wrapper); + return wrapper; +} + +function triggerCloseAnimation() { + var doc = browserUtils.getDocumentOrThrow(); + var modal = doc.getElementById(WALLETCONNECT_MODAL_ID); + + if (modal) { + modal.className = modal.className.replace("fadeIn", "fadeOut"); + setTimeout(function () { + var wrapper = doc.getElementById(WALLETCONNECT_WRAPPER_ID); + + if (wrapper) { + doc.body.removeChild(wrapper); + } + }, ANIMATION_DURATION); + } +} + +function getWrappedCallback(cb) { + return function () { + triggerCloseAnimation(); + + if (cb) { + cb(); + } + }; +} + +function getText() { + var lang = browserUtils.getNavigatorOrThrow().language.split("-")[0] || "en"; + return languages[lang] || languages["en"]; +} + +function open$1(uri, cb, qrcodeModalOptions) { + injectStyleSheet(); + var wrapper = renderWrapper(); + React.render(React.createElement(Modal, { + text: getText(), + uri: uri, + onClose: getWrappedCallback(cb), + qrcodeModalOptions: qrcodeModalOptions + }), wrapper); +} + +function close$1() { + triggerCloseAnimation(); +} + +var isNode = function isNode() { + return typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined"; +}; + +function open$2(uri, cb, qrcodeModalOptions) { + console.log(uri); + + if (isNode()) { + open(uri); + } else { + open$1(uri, cb, qrcodeModalOptions); + } +} + +function close$2() { + if (isNode()) ;else { + close$1(); + } +} + +var index = { + open: open$2, + close: close$2 +}; +module.exports = index; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/@walletconnect/qrcode-modal/node_modules/preact/compat/dist/compat.module.js": +/*!***************************************************************************************************!*\ + !*** ./node_modules/@walletconnect/qrcode-modal/node_modules/preact/compat/dist/compat.module.js ***! + \***************************************************************************************************/ +/*! exports provided: useState, useReducer, useEffect, useLayoutEffect, useRef, useImperativeHandle, useMemo, useCallback, useContext, useDebugValue, useErrorBoundary, createElement, createContext, createRef, Fragment, Component, default, version, Children, render, hydrate, unmountComponentAtNode, createPortal, createFactory, cloneElement, isValidElement, findDOMNode, PureComponent, memo, forwardRef, unstable_batchedUpdates, Suspense, SuspenseList, lazy */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return B; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Children", function() { return R; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return T; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hydrate", function() { return V; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unmountComponentAtNode", function() { return Q; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPortal", function() { return z; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFactory", function() { return G; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneElement", function() { return K; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidElement", function() { return J; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findDOMNode", function() { return X; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PureComponent", function() { return C; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "memo", function() { return _; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forwardRef", function() { return S; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unstable_batchedUpdates", function() { return Y; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Suspense", function() { return U; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SuspenseList", function() { return O; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lazy", function() { return L; }); +/* harmony import */ var preact_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! preact/hooks */ "./node_modules/@walletconnect/qrcode-modal/node_modules/preact/hooks/dist/hooks.module.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useState", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useState"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useReducer", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useReducer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useEffect", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useEffect"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useRef", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useRef"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useImperativeHandle"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useMemo", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useMemo"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useCallback", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useCallback"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useContext", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useDebugValue"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "useErrorBoundary", function() { return preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useErrorBoundary"]; }); + +/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! preact */ "./node_modules/@walletconnect/qrcode-modal/node_modules/preact/dist/preact.module.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createElement", function() { return preact__WEBPACK_IMPORTED_MODULE_1__["createElement"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createContext", function() { return preact__WEBPACK_IMPORTED_MODULE_1__["createContext"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createRef", function() { return preact__WEBPACK_IMPORTED_MODULE_1__["createRef"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return preact__WEBPACK_IMPORTED_MODULE_1__["Fragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return preact__WEBPACK_IMPORTED_MODULE_1__["Component"]; }); + + + + + + +function E(n, t) { + for (var e in t) { + n[e] = t[e]; + } + + return n; +} + +function w(n, t) { + for (var e in n) { + if ("__source" !== e && !(e in t)) return !0; + } + + for (var r in t) { + if ("__source" !== r && n[r] !== t[r]) return !0; + } + + return !1; +} + +var C = function (n) { + var t, e; + + function r(t) { + var e; + return (e = n.call(this, t) || this).isPureReactComponent = !0, e; + } + + return e = n, (t = r).prototype = Object.create(e.prototype), t.prototype.constructor = t, t.__proto__ = e, r.prototype.shouldComponentUpdate = function (n, t) { + return w(this.props, n) || w(this.state, t); + }, r; +}(preact__WEBPACK_IMPORTED_MODULE_1__["Component"]); + +function _(n, t) { + function e(n) { + var e = this.props.ref, + r = e == n.ref; + return !r && e && (e.call ? e(null) : e.current = null), t ? !t(this.props, n) || !r : w(this.props, n); + } + + function r(t) { + return this.shouldComponentUpdate = e, Object(preact__WEBPACK_IMPORTED_MODULE_1__["createElement"])(n, E({}, t)); + } + + return r.prototype.isReactComponent = !0, r.displayName = "Memo(" + (n.displayName || n.name) + ")", r.t = !0, r; +} + +var A = preact__WEBPACK_IMPORTED_MODULE_1__["options"].__b; + +function S(n) { + function t(t) { + var e = E({}, t); + return delete e.ref, n(e, t.ref); + } + + return t.prototype.isReactComponent = t.t = !0, t.displayName = "ForwardRef(" + (n.displayName || n.name) + ")", t; +} + +preact__WEBPACK_IMPORTED_MODULE_1__["options"].__b = function (n) { + n.type && n.type.t && n.ref && (n.props.ref = n.ref, n.ref = null), A && A(n); +}; + +var k = function k(n, t) { + return n ? Object(preact__WEBPACK_IMPORTED_MODULE_1__["toChildArray"])(n).reduce(function (n, e, r) { + return n.concat(t(e, r)); + }, []) : null; +}, + R = { + map: k, + forEach: k, + count: function count(n) { + return n ? Object(preact__WEBPACK_IMPORTED_MODULE_1__["toChildArray"])(n).length : 0; + }, + only: function only(n) { + if (1 !== (n = Object(preact__WEBPACK_IMPORTED_MODULE_1__["toChildArray"])(n)).length) throw new Error("Children.only() expects only one child."); + return n[0]; + }, + toArray: preact__WEBPACK_IMPORTED_MODULE_1__["toChildArray"] +}, + F = preact__WEBPACK_IMPORTED_MODULE_1__["options"].__e; + +function N(n) { + return n && ((n = E({}, n)).__c = null, n.__k = n.__k && n.__k.map(N)), n; +} + +function U() { + this.__u = 0, this.o = null, this.__b = null; +} + +function M(n) { + var t = n.__.__c; + return t && t.u && t.u(n); +} + +function L(n) { + var t, e, r; + + function o(o) { + if (t || (t = n()).then(function (n) { + e = n["default"] || n; + }, function (n) { + r = n; + }), r) throw r; + if (!e) throw t; + return Object(preact__WEBPACK_IMPORTED_MODULE_1__["createElement"])(e, o); + } + + return o.displayName = "Lazy", o.t = !0, o; +} + +function O() { + this.i = null, this.l = null; +} + +preact__WEBPACK_IMPORTED_MODULE_1__["options"].__e = function (n, t, e) { + if (n.then) for (var r, o = t; o = o.__;) { + if ((r = o.__c) && r.__c) return r.__c(n, t.__c); + } + F(n, t, e); +}, (U.prototype = new preact__WEBPACK_IMPORTED_MODULE_1__["Component"]()).__c = function (n, t) { + var e = this; + null == e.o && (e.o = []), e.o.push(t); + + var r = M(e.__v), + o = !1, + u = function u() { + o || (o = !0, r ? r(i) : i()); + }; + + t.__c = t.componentWillUnmount, t.componentWillUnmount = function () { + u(), t.__c && t.__c(); + }; + + var i = function i() { + var n; + if (! --e.__u) for (e.__v.__k[0] = e.state.u, e.setState({ + u: e.__b = null + }); n = e.o.pop();) { + n.forceUpdate(); + } + }; + + e.__u++ || e.setState({ + u: e.__b = e.__v.__k[0] + }), n.then(u, u); +}, U.prototype.render = function (n, t) { + return this.__b && (this.__v.__k[0] = N(this.__b), this.__b = null), [Object(preact__WEBPACK_IMPORTED_MODULE_1__["createElement"])(preact__WEBPACK_IMPORTED_MODULE_1__["Component"], null, t.u ? null : n.children), t.u && n.fallback]; +}; + +var P = function P(n, t, e) { + if (++e[1] === e[0] && n.l["delete"](t), n.props.revealOrder && ("t" !== n.props.revealOrder[0] || !n.l.size)) for (e = n.i; e;) { + for (; e.length > 3;) { + e.pop()(); + } + + if (e[1] < e[0]) break; + n.i = e = e[2]; + } +}; + +(O.prototype = new preact__WEBPACK_IMPORTED_MODULE_1__["Component"]()).u = function (n) { + var t = this, + e = M(t.__v), + r = t.l.get(n); + return r[0]++, function (o) { + var u = function u() { + t.props.revealOrder ? (r.push(o), P(t, n, r)) : o(); + }; + + e ? e(u) : u(); + }; +}, O.prototype.render = function (n) { + this.i = null, this.l = new Map(); + var t = Object(preact__WEBPACK_IMPORTED_MODULE_1__["toChildArray"])(n.children); + n.revealOrder && "b" === n.revealOrder[0] && t.reverse(); + + for (var e = t.length; e--;) { + this.l.set(t[e], this.i = [1, 0, this.i]); + } + + return n.children; +}, O.prototype.componentDidUpdate = O.prototype.componentDidMount = function () { + var n = this; + n.l.forEach(function (t, e) { + P(n, e, t); + }); +}; + +var W = function () { + function n() {} + + var t = n.prototype; + return t.getChildContext = function () { + return this.props.context; + }, t.render = function (n) { + return n.children; + }, n; +}(); + +function j(n) { + var t = this, + e = n.container, + r = Object(preact__WEBPACK_IMPORTED_MODULE_1__["createElement"])(W, { + context: t.context + }, n.vnode); + return t.s && t.s !== e && (t.v.parentNode && t.s.removeChild(t.v), Object(preact__WEBPACK_IMPORTED_MODULE_1__["_unmount"])(t.h), t.p = !1), n.vnode ? t.p ? (e.__k = t.__k, Object(preact__WEBPACK_IMPORTED_MODULE_1__["render"])(r, e), t.__k = e.__k) : (t.v = document.createTextNode(""), Object(preact__WEBPACK_IMPORTED_MODULE_1__["hydrate"])("", e), e.appendChild(t.v), t.p = !0, t.s = e, Object(preact__WEBPACK_IMPORTED_MODULE_1__["render"])(r, e, t.v), t.__k = t.v.__k) : t.p && (t.v.parentNode && t.s.removeChild(t.v), Object(preact__WEBPACK_IMPORTED_MODULE_1__["_unmount"])(t.h)), t.h = r, t.componentWillUnmount = function () { + t.v.parentNode && t.s.removeChild(t.v), Object(preact__WEBPACK_IMPORTED_MODULE_1__["_unmount"])(t.h); + }, null; +} + +function z(n, t) { + return Object(preact__WEBPACK_IMPORTED_MODULE_1__["createElement"])(j, { + vnode: n, + container: t + }); +} + +var D = /^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/; +preact__WEBPACK_IMPORTED_MODULE_1__["Component"].prototype.isReactComponent = {}; +var H = "undefined" != typeof Symbol && Symbol["for"] && Symbol["for"]("react.element") || 60103; + +function T(n, t, e) { + if (null == t.__k) for (; t.firstChild;) { + t.removeChild(t.firstChild); + } + return Object(preact__WEBPACK_IMPORTED_MODULE_1__["render"])(n, t), "function" == typeof e && e(), n ? n.__c : null; +} + +function V(n, t, e) { + return Object(preact__WEBPACK_IMPORTED_MODULE_1__["hydrate"])(n, t), "function" == typeof e && e(), n ? n.__c : null; +} + +var Z = preact__WEBPACK_IMPORTED_MODULE_1__["options"].event; + +function I(n, t) { + n["UNSAFE_" + t] && !n[t] && Object.defineProperty(n, t, { + configurable: !1, + get: function get() { + return this["UNSAFE_" + t]; + }, + set: function set(n) { + this["UNSAFE_" + t] = n; + } + }); +} + +preact__WEBPACK_IMPORTED_MODULE_1__["options"].event = function (n) { + Z && (n = Z(n)), n.persist = function () {}; + var t = !1, + e = !1, + r = n.stopPropagation; + + n.stopPropagation = function () { + r.call(n), t = !0; + }; + + var o = n.preventDefault; + return n.preventDefault = function () { + o.call(n), e = !0; + }, n.isPropagationStopped = function () { + return t; + }, n.isDefaultPrevented = function () { + return e; + }, n.nativeEvent = n; +}; + +var $ = { + configurable: !0, + get: function get() { + return this["class"]; + } +}, + q = preact__WEBPACK_IMPORTED_MODULE_1__["options"].vnode; + +preact__WEBPACK_IMPORTED_MODULE_1__["options"].vnode = function (n) { + n.$$typeof = H; + var t = n.type, + e = n.props; + + if (t) { + if (e["class"] != e.className && ($.enumerable = "className" in e, null != e.className && (e["class"] = e.className), Object.defineProperty(e, "className", $)), "function" != typeof t) { + var r, o, u; + + for (u in e.defaultValue && void 0 !== e.value && (e.value || 0 === e.value || (e.value = e.defaultValue), delete e.defaultValue), Array.isArray(e.value) && e.multiple && "select" === t && (Object(preact__WEBPACK_IMPORTED_MODULE_1__["toChildArray"])(e.children).forEach(function (n) { + -1 != e.value.indexOf(n.props.value) && (n.props.selected = !0); + }), delete e.value), e) { + if (r = D.test(u)) break; + } + + if (r) for (u in o = n.props = {}, e) { + o[D.test(u) ? u.replace(/[A-Z0-9]/, "-$&").toLowerCase() : u] = e[u]; + } + } + + !function (t) { + var e = n.type, + r = n.props; + + if (r && "string" == typeof e) { + var o = {}; + + for (var u in r) { + /^on(Ani|Tra|Tou)/.test(u) && (r[u.toLowerCase()] = r[u], delete r[u]), o[u.toLowerCase()] = u; + } + + if (o.ondoubleclick && (r.ondblclick = r[o.ondoubleclick], delete r[o.ondoubleclick]), o.onbeforeinput && (r.onbeforeinput = r[o.onbeforeinput], delete r[o.onbeforeinput]), o.onchange && ("textarea" === e || "input" === e.toLowerCase() && !/^fil|che|ra/i.test(r.type))) { + var i = o.oninput || "oninput"; + r[i] || (r[i] = r[o.onchange], delete r[o.onchange]); + } + } + }(), "function" == typeof t && !t.m && t.prototype && (I(t.prototype, "componentWillMount"), I(t.prototype, "componentWillReceiveProps"), I(t.prototype, "componentWillUpdate"), t.m = !0); + } + + q && q(n); +}; + +var B = "16.8.0"; + +function G(n) { + return preact__WEBPACK_IMPORTED_MODULE_1__["createElement"].bind(null, n); +} + +function J(n) { + return !!n && n.$$typeof === H; +} + +function K(n) { + return J(n) ? preact__WEBPACK_IMPORTED_MODULE_1__["cloneElement"].apply(null, arguments) : n; +} + +function Q(n) { + return !!n.__k && (Object(preact__WEBPACK_IMPORTED_MODULE_1__["render"])(null, n), !0); +} + +function X(n) { + return n && (n.base || 1 === n.nodeType && n) || null; +} + +var Y = function Y(n, t) { + return n(t); +}; + +/* harmony default export */ __webpack_exports__["default"] = ({ + useState: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useState"], + useReducer: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useReducer"], + useEffect: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useEffect"], + useLayoutEffect: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"], + useRef: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useRef"], + useImperativeHandle: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useImperativeHandle"], + useMemo: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useMemo"], + useCallback: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useCallback"], + useContext: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useContext"], + useDebugValue: preact_hooks__WEBPACK_IMPORTED_MODULE_0__["useDebugValue"], + version: "16.8.0", + Children: R, + render: T, + hydrate: T, + unmountComponentAtNode: Q, + createPortal: z, + createElement: preact__WEBPACK_IMPORTED_MODULE_1__["createElement"], + createContext: preact__WEBPACK_IMPORTED_MODULE_1__["createContext"], + createFactory: G, + cloneElement: K, + createRef: preact__WEBPACK_IMPORTED_MODULE_1__["createRef"], + Fragment: preact__WEBPACK_IMPORTED_MODULE_1__["Fragment"], + isValidElement: J, + findDOMNode: X, + Component: preact__WEBPACK_IMPORTED_MODULE_1__["Component"], + PureComponent: C, + memo: _, + forwardRef: S, + unstable_batchedUpdates: Y, + Suspense: U, + SuspenseList: O, + lazy: L +}); + + +/***/ }), + +/***/ "./node_modules/@walletconnect/qrcode-modal/node_modules/preact/dist/preact.module.js": +/*!********************************************************************************************!*\ + !*** ./node_modules/@walletconnect/qrcode-modal/node_modules/preact/dist/preact.module.js ***! + \********************************************************************************************/ +/*! exports provided: render, hydrate, createElement, h, Fragment, createRef, isValidElement, Component, cloneElement, createContext, toChildArray, _unmount, options */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "render", function() { return H; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hydrate", function() { return I; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createElement", function() { return h; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return h; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return d; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createRef", function() { return y; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidElement", function() { return l; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return m; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cloneElement", function() { return L; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createContext", function() { return M; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toChildArray", function() { return x; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_unmount", function() { return D; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "options", function() { return n; }); +var n, + l, + u, + i, + t, + r, + o, + f, + e = {}, + c = [], + s = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i; + +function a(n, l) { + for (var u in l) { + n[u] = l[u]; + } + + return n; +} + +function v(n) { + var l = n.parentNode; + l && l.removeChild(n); +} + +function h(n, l, u) { + var i, + t = arguments, + r = {}; + + for (i in l) { + "key" !== i && "ref" !== i && (r[i] = l[i]); + } + + if (arguments.length > 3) for (u = [u], i = 3; i < arguments.length; i++) { + u.push(t[i]); + } + if (null != u && (r.children = u), "function" == typeof n && null != n.defaultProps) for (i in n.defaultProps) { + void 0 === r[i] && (r[i] = n.defaultProps[i]); + } + return p(n, r, l && l.key, l && l.ref, null); +} + +function p(l, u, i, t, r) { + var o = { + type: l, + props: u, + key: i, + ref: t, + __k: null, + __: null, + __b: 0, + __e: null, + __d: void 0, + __c: null, + constructor: void 0, + __v: r + }; + return null == r && (o.__v = o), n.vnode && n.vnode(o), o; +} + +function y() { + return {}; +} + +function d(n) { + return n.children; +} + +function m(n, l) { + this.props = n, this.context = l; +} + +function w(n, l) { + if (null == l) return n.__ ? w(n.__, n.__.__k.indexOf(n) + 1) : null; + + for (var u; l < n.__k.length; l++) { + if (null != (u = n.__k[l]) && null != u.__e) return u.__e; + } + + return "function" == typeof n.type ? w(n) : null; +} + +function k(n) { + var l, u; + + if (null != (n = n.__) && null != n.__c) { + for (n.__e = n.__c.base = null, l = 0; l < n.__k.length; l++) { + if (null != (u = n.__k[l]) && null != u.__e) { + n.__e = n.__c.base = u.__e; + break; + } + } + + return k(n); + } +} + +function g(l) { + (!l.__d && (l.__d = !0) && u.push(l) && !i++ || r !== n.debounceRendering) && ((r = n.debounceRendering) || t)(_); +} + +function _() { + for (var n; i = u.length;) { + n = u.sort(function (n, l) { + return n.__v.__b - l.__v.__b; + }), u = [], n.some(function (n) { + var l, u, i, t, r, o, f; + n.__d && (o = (r = (l = n).__v).__e, (f = l.__P) && (u = [], (i = a({}, r)).__v = i, t = A(f, r, i, l.__n, void 0 !== f.ownerSVGElement, null, u, null == o ? w(r) : o), T(u, r), t != o && k(r))); + }); + } +} + +function b(n, l, u, i, t, r, o, f, s) { + var a, + h, + p, + y, + d, + m, + k, + g = u && u.__k || c, + _ = g.length; + if (f == e && (f = null != r ? r[0] : _ ? w(u, 0) : null), a = 0, l.__k = x(l.__k, function (u) { + if (null != u) { + if (u.__ = l, u.__b = l.__b + 1, null === (p = g[a]) || p && u.key == p.key && u.type === p.type) g[a] = void 0;else for (h = 0; h < _; h++) { + if ((p = g[h]) && u.key == p.key && u.type === p.type) { + g[h] = void 0; + break; + } + + p = null; + } + + if (y = A(n, u, p = p || e, i, t, r, o, f, s), (h = u.ref) && p.ref != h && (k || (k = []), p.ref && k.push(p.ref, null, u), k.push(h, u.__c || y, u)), null != y) { + var c; + if (null == m && (m = y), void 0 !== u.__d) c = u.__d, u.__d = void 0;else if (r == p || y != f || null == y.parentNode) { + n: if (null == f || f.parentNode !== n) n.appendChild(y), c = null;else { + for (d = f, h = 0; (d = d.nextSibling) && h < _; h += 2) { + if (d == y) break n; + } + + n.insertBefore(y, f), c = f; + } + + "option" == l.type && (n.value = ""); + } + f = void 0 !== c ? c : y.nextSibling, "function" == typeof l.type && (l.__d = f); + } else f && p.__e == f && f.parentNode != n && (f = w(p)); + } + + return a++, u; + }), l.__e = m, null != r && "function" != typeof l.type) for (a = r.length; a--;) { + null != r[a] && v(r[a]); + } + + for (a = _; a--;) { + null != g[a] && D(g[a], g[a]); + } + + if (k) for (a = 0; a < k.length; a++) { + j(k[a], k[++a], k[++a]); + } +} + +function x(n, l, u) { + if (null == u && (u = []), null == n || "boolean" == typeof n) l && u.push(l(null));else if (Array.isArray(n)) for (var i = 0; i < n.length; i++) { + x(n[i], l, u); + } else u.push(l ? l("string" == typeof n || "number" == typeof n ? p(null, n, null, null, n) : null != n.__e || null != n.__c ? p(n.type, n.props, n.key, null, n.__v) : n) : n); + return u; +} + +function P(n, l, u, i, t) { + var r; + + for (r in u) { + "children" === r || "key" === r || r in l || N(n, r, null, u[r], i); + } + + for (r in l) { + t && "function" != typeof l[r] || "children" === r || "key" === r || "value" === r || "checked" === r || u[r] === l[r] || N(n, r, l[r], u[r], i); + } +} + +function C(n, l, u) { + "-" === l[0] ? n.setProperty(l, u) : n[l] = "number" == typeof u && !1 === s.test(l) ? u + "px" : null == u ? "" : u; +} + +function N(n, l, u, i, t) { + var r, o, f, e, c; + if (t ? "className" === l && (l = "class") : "class" === l && (l = "className"), "style" === l) { + if (r = n.style, "string" == typeof u) r.cssText = u;else { + if ("string" == typeof i && (r.cssText = "", i = null), i) for (e in i) { + u && e in u || C(r, e, ""); + } + if (u) for (c in u) { + i && u[c] === i[c] || C(r, c, u[c]); + } + } + } else "o" === l[0] && "n" === l[1] ? (o = l !== (l = l.replace(/Capture$/, "")), f = l.toLowerCase(), l = (f in n ? f : l).slice(2), u ? (i || n.addEventListener(l, z, o), (n.l || (n.l = {}))[l] = u) : n.removeEventListener(l, z, o)) : "list" !== l && "tagName" !== l && "form" !== l && "type" !== l && "size" !== l && !t && l in n ? n[l] = null == u ? "" : u : "function" != typeof u && "dangerouslySetInnerHTML" !== l && (l !== (l = l.replace(/^xlink:?/, "")) ? null == u || !1 === u ? n.removeAttributeNS("http://www.w3.org/1999/xlink", l.toLowerCase()) : n.setAttributeNS("http://www.w3.org/1999/xlink", l.toLowerCase(), u) : null == u || !1 === u && !/^ar/.test(l) ? n.removeAttribute(l) : n.setAttribute(l, u)); +} + +function z(l) { + this.l[l.type](n.event ? n.event(l) : l); +} + +function A(l, u, i, t, r, o, f, e, c) { + var s, + v, + h, + p, + y, + w, + k, + g, + _, + x, + P = u.type; + + if (void 0 !== u.constructor) return null; + (s = n.__b) && s(u); + + try { + n: if ("function" == typeof P) { + if (g = u.props, _ = (s = P.contextType) && t[s.__c], x = s ? _ ? _.props.value : s.__ : t, i.__c ? k = (v = u.__c = i.__c).__ = v.__E : ("prototype" in P && P.prototype.render ? u.__c = v = new P(g, x) : (u.__c = v = new m(g, x), v.constructor = P, v.render = E), _ && _.sub(v), v.props = g, v.state || (v.state = {}), v.context = x, v.__n = t, h = v.__d = !0, v.__h = []), null == v.__s && (v.__s = v.state), null != P.getDerivedStateFromProps && (v.__s == v.state && (v.__s = a({}, v.__s)), a(v.__s, P.getDerivedStateFromProps(g, v.__s))), p = v.props, y = v.state, h) null == P.getDerivedStateFromProps && null != v.componentWillMount && v.componentWillMount(), null != v.componentDidMount && v.__h.push(v.componentDidMount);else { + if (null == P.getDerivedStateFromProps && g !== p && null != v.componentWillReceiveProps && v.componentWillReceiveProps(g, x), !v.__e && null != v.shouldComponentUpdate && !1 === v.shouldComponentUpdate(g, v.__s, x) || u.__v === i.__v && !v.__) { + for (v.props = g, v.state = v.__s, u.__v !== i.__v && (v.__d = !1), v.__v = u, u.__e = i.__e, u.__k = i.__k, v.__h.length && f.push(v), s = 0; s < u.__k.length; s++) { + u.__k[s] && (u.__k[s].__ = u); + } + + break n; + } + + null != v.componentWillUpdate && v.componentWillUpdate(g, v.__s, x), null != v.componentDidUpdate && v.__h.push(function () { + v.componentDidUpdate(p, y, w); + }); + } + v.context = x, v.props = g, v.state = v.__s, (s = n.__r) && s(u), v.__d = !1, v.__v = u, v.__P = l, s = v.render(v.props, v.state, v.context), u.__k = null != s && s.type == d && null == s.key ? s.props.children : Array.isArray(s) ? s : [s], null != v.getChildContext && (t = a(a({}, t), v.getChildContext())), h || null == v.getSnapshotBeforeUpdate || (w = v.getSnapshotBeforeUpdate(p, y)), b(l, u, i, t, r, o, f, e, c), v.base = u.__e, v.__h.length && f.push(v), k && (v.__E = v.__ = null), v.__e = !1; + } else null == o && u.__v === i.__v ? (u.__k = i.__k, u.__e = i.__e) : u.__e = $(i.__e, u, i, t, r, o, f, c); + + (s = n.diffed) && s(u); + } catch (l) { + u.__v = null, n.__e(l, u, i); + } + + return u.__e; +} + +function T(l, u) { + n.__c && n.__c(u, l), l.some(function (u) { + try { + l = u.__h, u.__h = [], l.some(function (n) { + n.call(u); + }); + } catch (l) { + n.__e(l, u.__v); + } + }); +} + +function $(n, l, u, i, t, r, o, f) { + var s, + a, + v, + h, + p, + y = u.props, + d = l.props; + if (t = "svg" === l.type || t, null != r) for (s = 0; s < r.length; s++) { + if (null != (a = r[s]) && ((null === l.type ? 3 === a.nodeType : a.localName === l.type) || n == a)) { + n = a, r[s] = null; + break; + } + } + + if (null == n) { + if (null === l.type) return document.createTextNode(d); + n = t ? document.createElementNS("http://www.w3.org/2000/svg", l.type) : document.createElement(l.type, d.is && { + is: d.is + }), r = null, f = !1; + } + + if (null === l.type) y !== d && n.data != d && (n.data = d);else { + if (null != r && (r = c.slice.call(n.childNodes)), v = (y = u.props || e).dangerouslySetInnerHTML, h = d.dangerouslySetInnerHTML, !f) { + if (y === e) for (y = {}, p = 0; p < n.attributes.length; p++) { + y[n.attributes[p].name] = n.attributes[p].value; + } + (h || v) && (h && v && h.__html == v.__html || (n.innerHTML = h && h.__html || "")); + } + + P(n, d, y, t, f), h ? l.__k = [] : (l.__k = l.props.children, b(n, l, u, i, "foreignObject" !== l.type && t, r, o, e, f)), f || ("value" in d && void 0 !== (s = d.value) && s !== n.value && N(n, "value", s, y.value, !1), "checked" in d && void 0 !== (s = d.checked) && s !== n.checked && N(n, "checked", s, y.checked, !1)); + } + return n; +} + +function j(l, u, i) { + try { + "function" == typeof l ? l(u) : l.current = u; + } catch (l) { + n.__e(l, i); + } +} + +function D(l, u, i) { + var t, r, o; + + if (n.unmount && n.unmount(l), (t = l.ref) && (t.current && t.current !== l.__e || j(t, null, u)), i || "function" == typeof l.type || (i = null != (r = l.__e)), l.__e = l.__d = void 0, null != (t = l.__c)) { + if (t.componentWillUnmount) try { + t.componentWillUnmount(); + } catch (l) { + n.__e(l, u); + } + t.base = t.__P = null; + } + + if (t = l.__k) for (o = 0; o < t.length; o++) { + t[o] && D(t[o], u, i); + } + null != r && v(r); +} + +function E(n, l, u) { + return this.constructor(n, u); +} + +function H(l, u, i) { + var t, r, f; + n.__ && n.__(l, u), r = (t = i === o) ? null : i && i.__k || u.__k, l = h(d, null, [l]), f = [], A(u, (t ? u : i || u).__k = l, r || e, e, void 0 !== u.ownerSVGElement, i && !t ? [i] : r ? null : c.slice.call(u.childNodes), f, i || e, t), T(f, l); +} + +function I(n, l) { + H(n, l, o); +} + +function L(n, l) { + var u, i; + + for (i in l = a(a({}, n.props), l), arguments.length > 2 && (l.children = c.slice.call(arguments, 2)), u = {}, l) { + "key" !== i && "ref" !== i && (u[i] = l[i]); + } + + return p(n.type, u, l.key || n.key, l.ref || n.ref, null); +} + +function M(n) { + var l = {}, + u = { + __c: "__cC" + f++, + __: n, + Consumer: function Consumer(n, l) { + return n.children(l); + }, + Provider: function Provider(n) { + var i, + t = this; + return this.getChildContext || (i = [], this.getChildContext = function () { + return l[u.__c] = t, l; + }, this.shouldComponentUpdate = function (n) { + t.props.value !== n.value && i.some(function (l) { + l.context = n.value, g(l); + }); + }, this.sub = function (n) { + i.push(n); + var l = n.componentWillUnmount; + + n.componentWillUnmount = function () { + i.splice(i.indexOf(n), 1), l && l.call(n); + }; + }), n.children; + } + }; + return u.Consumer.contextType = u, u.Provider.__ = u, u; +} + +n = { + __e: function __e(n, l) { + for (var u, i; l = l.__;) { + if ((u = l.__c) && !u.__) try { + if (u.constructor && null != u.constructor.getDerivedStateFromError && (i = !0, u.setState(u.constructor.getDerivedStateFromError(n))), null != u.componentDidCatch && (i = !0, u.componentDidCatch(n)), i) return g(u.__E = u); + } catch (l) { + n = l; + } + } + + throw n; + } +}, l = function l(n) { + return null != n && void 0 === n.constructor; +}, m.prototype.setState = function (n, l) { + var u; + u = this.__s !== this.state ? this.__s : this.__s = a({}, this.state), "function" == typeof n && (n = n(u, this.props)), n && a(u, n), null != n && this.__v && (l && this.__h.push(l), g(this)); +}, m.prototype.forceUpdate = function (n) { + this.__v && (this.__e = !0, n && this.__h.push(n), g(this)); +}, m.prototype.render = d, u = [], i = 0, t = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, o = e, f = 0; + + +/***/ }), + +/***/ "./node_modules/@walletconnect/qrcode-modal/node_modules/preact/hooks/dist/hooks.module.js": +/*!*************************************************************************************************!*\ + !*** ./node_modules/@walletconnect/qrcode-modal/node_modules/preact/hooks/dist/hooks.module.js ***! + \*************************************************************************************************/ +/*! exports provided: useState, useReducer, useEffect, useLayoutEffect, useRef, useImperativeHandle, useMemo, useCallback, useContext, useDebugValue, useErrorBoundary */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useState", function() { return m; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useReducer", function() { return p; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useEffect", function() { return l; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useLayoutEffect", function() { return y; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useRef", function() { return d; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useImperativeHandle", function() { return s; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useMemo", function() { return h; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useCallback", function() { return T; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useContext", function() { return w; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useDebugValue", function() { return A; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "useErrorBoundary", function() { return F; }); +/* harmony import */ var preact__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! preact */ "./node_modules/@walletconnect/qrcode-modal/node_modules/preact/dist/preact.module.js"); + +var t, + u, + r, + i = 0, + o = [], + c = preact__WEBPACK_IMPORTED_MODULE_0__["options"].__r, + f = preact__WEBPACK_IMPORTED_MODULE_0__["options"].diffed, + e = preact__WEBPACK_IMPORTED_MODULE_0__["options"].__c, + a = preact__WEBPACK_IMPORTED_MODULE_0__["options"].unmount; + +function v(t, r) { + preact__WEBPACK_IMPORTED_MODULE_0__["options"].__h && preact__WEBPACK_IMPORTED_MODULE_0__["options"].__h(u, t, i || r), i = 0; + var o = u.__H || (u.__H = { + __: [], + __h: [] + }); + return t >= o.__.length && o.__.push({}), o.__[t]; +} + +function m(n) { + return i = 1, p(E, n); +} + +function p(n, r, i) { + var o = v(t++, 2); + return o.__c || (o.__c = u, o.__ = [i ? i(r) : E(void 0, r), function (t) { + var u = n(o.__[0], t); + o.__[0] !== u && (o.__[0] = u, o.__c.setState({})); + }]), o.__; +} + +function l(r, i) { + var o = v(t++, 3); + !preact__WEBPACK_IMPORTED_MODULE_0__["options"].__s && x(o.__H, i) && (o.__ = r, o.__H = i, u.__H.__h.push(o)); +} + +function y(r, i) { + var o = v(t++, 4); + !preact__WEBPACK_IMPORTED_MODULE_0__["options"].__s && x(o.__H, i) && (o.__ = r, o.__H = i, u.__h.push(o)); +} + +function d(n) { + return i = 5, h(function () { + return { + current: n + }; + }, []); +} + +function s(n, t, u) { + i = 6, y(function () { + "function" == typeof n ? n(t()) : n && (n.current = t()); + }, null == u ? u : u.concat(n)); +} + +function h(n, u) { + var r = v(t++, 7); + return x(r.__H, u) ? (r.__H = u, r.__h = n, r.__ = n()) : r.__; +} + +function T(n, t) { + return i = 8, h(function () { + return n; + }, t); +} + +function w(n) { + var r = u.context[n.__c], + i = v(t++, 9); + return i.__c = n, r ? (null == i.__ && (i.__ = !0, r.sub(u)), r.props.value) : n.__; +} + +function A(t, u) { + preact__WEBPACK_IMPORTED_MODULE_0__["options"].useDebugValue && preact__WEBPACK_IMPORTED_MODULE_0__["options"].useDebugValue(u ? u(t) : t); +} + +function F(n) { + var r = v(t++, 10), + i = m(); + return r.__ = n, u.componentDidCatch || (u.componentDidCatch = function (n) { + r.__ && r.__(n), i[1](n); + }), [i[0], function () { + i[1](void 0); + }]; +} + +function _() { + o.some(function (t) { + if (t.__P) try { + t.__H.__h.forEach(g), t.__H.__h.forEach(q), t.__H.__h = []; + } catch (u) { + return t.__H.__h = [], preact__WEBPACK_IMPORTED_MODULE_0__["options"].__e(u, t.__v), !0; + } + }), o = []; +} + +function g(n) { + n.t && n.t(); +} + +function q(n) { + var t = n.__(); + + "function" == typeof t && (n.t = t); +} + +function x(n, t) { + return !n || t.some(function (t, u) { + return t !== n[u]; + }); +} + +function E(n, t) { + return "function" == typeof t ? t(n) : t; +} + +preact__WEBPACK_IMPORTED_MODULE_0__["options"].__r = function (n) { + c && c(n), t = 0, (u = n.__c).__H && (u.__H.__h.forEach(g), u.__H.__h.forEach(q), u.__H.__h = []); +}, preact__WEBPACK_IMPORTED_MODULE_0__["options"].diffed = function (t) { + f && f(t); + var u = t.__c; + + if (u) { + var i = u.__H; + i && i.__h.length && (1 !== o.push(u) && r === preact__WEBPACK_IMPORTED_MODULE_0__["options"].requestAnimationFrame || ((r = preact__WEBPACK_IMPORTED_MODULE_0__["options"].requestAnimationFrame) || function (n) { + var t, + u = function u() { + clearTimeout(r), cancelAnimationFrame(t), setTimeout(n); + }, + r = setTimeout(u, 100); + + "undefined" != typeof window && (t = requestAnimationFrame(u)); + })(_)); + } +}, preact__WEBPACK_IMPORTED_MODULE_0__["options"].__c = function (t, u) { + u.some(function (t) { + try { + t.__h.forEach(g), t.__h = t.__h.filter(function (n) { + return !n.__ || q(n); + }); + } catch (r) { + u.some(function (n) { + n.__h && (n.__h = []); + }), u = [], preact__WEBPACK_IMPORTED_MODULE_0__["options"].__e(r, t.__v); + } + }), e && e(t, u); +}, preact__WEBPACK_IMPORTED_MODULE_0__["options"].unmount = function (t) { + a && a(t); + var u = t.__c; + + if (u) { + var r = u.__H; + if (r) try { + r.__.forEach(function (n) { + return n.t && n.t(); + }); + } catch (t) { + preact__WEBPACK_IMPORTED_MODULE_0__["options"].__e(t, u.__v); + } + } +}; + + +/***/ }), + +/***/ "./node_modules/@walletconnect/randombytes/dist/esm/browser/index.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@walletconnect/randombytes/dist/esm/browser/index.js ***! + \***************************************************************************/ +/*! exports provided: randomBytes */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "randomBytes", function() { return randomBytes; }); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/environment */ "./node_modules/@walletconnect/environment/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__); + +function randomBytes(length) { + var browserCrypto = _walletconnect_environment__WEBPACK_IMPORTED_MODULE_0__["getBrowerCrypto"](); + return browserCrypto.getRandomValues(new Uint8Array(length)); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/safe-json/dist/esm/index.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@walletconnect/safe-json/dist/esm/index.js ***! + \*****************************************************************/ +/*! exports provided: safeJsonParse, safeJsonStringify */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeJsonParse", function() { return safeJsonParse; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "safeJsonStringify", function() { return safeJsonStringify; }); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function safeJsonParse(value) { + if (typeof value !== "string") { + throw new Error("Cannot safe json parse value of type ".concat(_typeof(value))); + } + + try { + return JSON.parse(value); + } catch (_a) { + return value; + } +} +function safeJsonStringify(value) { + return typeof value === "string" ? value : JSON.stringify(value); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/signer-connection/dist/esm/index.js": +/*!*************************************************************************!*\ + !*** ./node_modules/@walletconnect/signer-connection/dist/esm/index.js ***! + \*************************************************************************/ +/*! exports provided: SignerConnection, default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SignerConnection", function() { return SignerConnection; }); +/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! eventemitter3 */ "./node_modules/eventemitter3/index.js"); +/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(eventemitter3__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _walletconnect_client__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/client */ "./node_modules/@walletconnect/client/dist/esm/index.js"); +/* harmony import */ var _walletconnect_qrcode_modal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @walletconnect/qrcode-modal */ "./node_modules/@walletconnect/qrcode-modal/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_qrcode_modal__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_qrcode_modal__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var _walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @walletconnect/jsonrpc-types */ "./node_modules/@walletconnect/jsonrpc-types/dist/esm/index.js"); +/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js"); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + + + + + + +var SignerConnection = /*#__PURE__*/function (_IJsonRpcConnection) { + _inherits(SignerConnection, _IJsonRpcConnection); + + var _super = _createSuper(SignerConnection); + + function SignerConnection(opts) { + var _this; + + _classCallCheck(this, SignerConnection); + + _this = _super.call(this); + _this.events = new eventemitter3__WEBPACK_IMPORTED_MODULE_0___default.a(); + _this.accounts = []; + _this.chainId = 1; + _this.pending = false; + _this.bridge = "https://bridge.walletconnect.org"; + _this.qrcode = true; + _this.qrcodeModalOptions = undefined; + _this.opts = opts; + _this.chainId = (opts === null || opts === void 0 ? void 0 : opts.chainId) || _this.chainId; + _this.wc = _this.register(opts); + return _this; + } + + _createClass(SignerConnection, [{ + key: "connected", + get: function get() { + return typeof this.wc !== "undefined" && this.wc.connected; + } + }, { + key: "connecting", + get: function get() { + return this.pending; + } + }, { + key: "connector", + get: function get() { + this.wc = this.register(this.opts); + return this.wc; + } + }, { + key: "on", + value: function on(event, listener) { + this.events.on(event, listener); + } + }, { + key: "once", + value: function once(event, listener) { + this.events.once(event, listener); + } + }, { + key: "off", + value: function off(event, listener) { + this.events.off(event, listener); + } + }, { + key: "removeListener", + value: function removeListener(event, listener) { + this.events.removeListener(event, listener); + } + }, { + key: "open", + value: function () { + var _open = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(chainId) { + var _this2 = this; + + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + if (!this.connected) { + _context.next = 3; + break; + } + + this.onOpen(); + return _context.abrupt("return"); + + case 3: + return _context.abrupt("return", new Promise(function (resolve, reject) { + _this2.on("error", function (err) { + reject(err); + }); + + _this2.on("open", function () { + resolve(); + }); + + _this2.create(chainId); + })); + + case 4: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + + function open(_x) { + return _open.apply(this, arguments); + } + + return open; + }() + }, { + key: "close", + value: function () { + var _close = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() { + return regeneratorRuntime.wrap(function _callee2$(_context2) { + while (1) { + switch (_context2.prev = _context2.next) { + case 0: + if (!(typeof this.wc === "undefined")) { + _context2.next = 2; + break; + } + + return _context2.abrupt("return"); + + case 2: + if (this.wc.connected) { + this.wc.killSession(); + } + + this.onClose(); + + case 4: + case "end": + return _context2.stop(); + } + } + }, _callee2, this); + })); + + function close() { + return _close.apply(this, arguments); + } + + return close; + }() + }, { + key: "send", + value: function () { + var _send = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(payload) { + var _this3 = this; + + return regeneratorRuntime.wrap(function _callee3$(_context3) { + while (1) { + switch (_context3.prev = _context3.next) { + case 0: + this.wc = this.register(this.opts); + + if (this.connected) { + _context3.next = 4; + break; + } + + _context3.next = 4; + return this.open(); + + case 4: + this.sendPayload(payload).then(function (res) { + return _this3.events.emit("payload", res); + })["catch"](function (e) { + return _this3.events.emit("payload", Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_4__["formatJsonRpcError"])(payload.id, e.message)); + }); + + case 5: + case "end": + return _context3.stop(); + } + } + }, _callee3, this); + })); + + function send(_x2) { + return _send.apply(this, arguments); + } + + return send; + }() + }, { + key: "register", + value: function register(opts) { + if (this.wc) return this.wc; + this.opts = opts || this.opts; + this.bridge = (opts === null || opts === void 0 ? void 0 : opts.connector) ? opts.connector.bridge : (opts === null || opts === void 0 ? void 0 : opts.bridge) || "https://bridge.walletconnect.org"; + this.qrcode = typeof (opts === null || opts === void 0 ? void 0 : opts.qrcode) === "undefined" || opts.qrcode !== false; + this.chainId = typeof (opts === null || opts === void 0 ? void 0 : opts.chainId) !== "undefined" ? opts.chainId : this.chainId; + this.qrcodeModalOptions = opts === null || opts === void 0 ? void 0 : opts.qrcodeModalOptions; + var connectorOpts = { + bridge: this.bridge, + qrcodeModal: this.qrcode ? _walletconnect_qrcode_modal__WEBPACK_IMPORTED_MODULE_2___default.a : undefined, + qrcodeModalOptions: this.qrcodeModalOptions, + storageId: opts === null || opts === void 0 ? void 0 : opts.storageId, + signingMethods: opts === null || opts === void 0 ? void 0 : opts.signingMethods, + clientMeta: opts === null || opts === void 0 ? void 0 : opts.clientMeta + }; + this.wc = typeof (opts === null || opts === void 0 ? void 0 : opts.connector) !== "undefined" ? opts.connector : new _walletconnect_client__WEBPACK_IMPORTED_MODULE_1__["default"](connectorOpts); + + if (typeof this.wc === "undefined") { + throw new Error("Failed to register WalletConnect connector"); + } + + if (this.wc.accounts.length) { + this.accounts = this.wc.accounts; + } + + if (this.wc.chainId) { + this.chainId = this.wc.chainId; + } + + this.registerConnectorEvents(); + return this.wc; + } + }, { + key: "onOpen", + value: function onOpen(wc) { + this.pending = false; + + if (wc) { + this.wc = wc; + } + + this.events.emit("open"); + } + }, { + key: "onClose", + value: function onClose() { + this.pending = false; + + if (this.wc) { + this.wc = undefined; + } + + this.events.emit("close"); + } + }, { + key: "onError", + value: function onError(payload) { + var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Failed or Rejected Request"; + var code = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -32000; + var errorPayload = { + id: payload.id, + jsonrpc: payload.jsonrpc, + error: { + code: code, + message: message + } + }; + this.events.emit("payload", errorPayload); + return errorPayload; + } + }, { + key: "create", + value: function create(chainId) { + var _this4 = this; + + this.wc = this.register(this.opts); + this.chainId = chainId || this.chainId; + if (this.connected || this.pending) return; + this.pending = true; + this.registerConnectorEvents(); + this.wc.createSession({ + chainId: this.chainId + }).then(function () { + return _this4.events.emit("created"); + })["catch"](function (e) { + return _this4.events.emit("error", e); + }); + } + }, { + key: "registerConnectorEvents", + value: function registerConnectorEvents() { + var _this5 = this; + + this.wc = this.register(this.opts); + this.wc.on("connect", function (err) { + var _a, _b; + + if (err) { + _this5.events.emit("error", err); + + return; + } + + _this5.accounts = ((_a = _this5.wc) === null || _a === void 0 ? void 0 : _a.accounts) || []; + _this5.chainId = ((_b = _this5.wc) === null || _b === void 0 ? void 0 : _b.chainId) || _this5.chainId; + + _this5.onOpen(); + }); + this.wc.on("disconnect", function (err) { + if (err) { + _this5.events.emit("error", err); + + return; + } + + _this5.onClose(); + }); + this.wc.on("modal_closed", function () { + _this5.events.emit("error", new Error("User closed modal")); + }); + this.wc.on("session_update", function (error, payload) { + var _payload$params$ = payload.params[0], + accounts = _payload$params$.accounts, + chainId = _payload$params$.chainId; + + if (!_this5.accounts || accounts && _this5.accounts !== accounts) { + _this5.accounts = accounts; + + _this5.events.emit("accountsChanged", accounts); + } + + if (!_this5.chainId || chainId && _this5.chainId !== chainId) { + _this5.chainId = chainId; + + _this5.events.emit("chainChanged", chainId); + } + }); + } + }, { + key: "sendPayload", + value: function () { + var _sendPayload = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(payload) { + var response; + return regeneratorRuntime.wrap(function _callee4$(_context4) { + while (1) { + switch (_context4.prev = _context4.next) { + case 0: + this.wc = this.register(this.opts); + _context4.prev = 1; + _context4.next = 4; + return this.wc.unsafeSend(payload); + + case 4: + response = _context4.sent; + return _context4.abrupt("return", this.sanitizeResponse(response)); + + case 8: + _context4.prev = 8; + _context4.t0 = _context4["catch"](1); + return _context4.abrupt("return", this.onError(payload, _context4.t0.message)); + + case 11: + case "end": + return _context4.stop(); + } + } + }, _callee4, this, [[1, 8]]); + })); + + function sendPayload(_x3) { + return _sendPayload.apply(this, arguments); + } + + return sendPayload; + }() + }, { + key: "sanitizeResponse", + value: function sanitizeResponse(response) { + return typeof response.error !== "undefined" && typeof response.error.code === "undefined" ? Object(_walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_4__["formatJsonRpcError"])(response.id, response.error.message) : response; + } + }]); + + return SignerConnection; +}(_walletconnect_jsonrpc_types__WEBPACK_IMPORTED_MODULE_3__["IJsonRpcConnection"]); +/* harmony default export */ __webpack_exports__["default"] = (SignerConnection); + +/***/ }), + +/***/ "./node_modules/@walletconnect/socket-transport/dist/esm/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/@walletconnect/socket-transport/dist/esm/index.js ***! + \************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/utils */ "./node_modules/@walletconnect/utils/dist/esm/index.js"); +/* harmony import */ var _network__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./network */ "./node_modules/@walletconnect/socket-transport/dist/esm/network.js"); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + + + +var WS = typeof global.WebSocket !== "undefined" ? global.WebSocket : __webpack_require__(/*! ws */ "./node_modules/@walletconnect/socket-transport/node_modules/ws/browser.js"); + +var SocketTransport = /*#__PURE__*/function () { + function SocketTransport(opts) { + var _this = this; + + _classCallCheck(this, SocketTransport); + + this.opts = opts; + this._queue = []; + this._events = []; + this._subscriptions = []; + this._protocol = opts.protocol; + this._version = opts.version; + this._url = ""; + this._netMonitor = null; + this._socket = null; + this._nextSocket = null; + this._subscriptions = opts.subscriptions || []; + this._netMonitor = opts.netMonitor || new _network__WEBPACK_IMPORTED_MODULE_1__["default"](); + + if (!opts.url || typeof opts.url !== "string") { + throw new Error("Missing or invalid WebSocket url"); + } + + this._url = opts.url; + + this._netMonitor.on("online", function () { + return _this._socketCreate(); + }); + } + + _createClass(SocketTransport, [{ + key: "readyState", + get: function get() { + return this._socket ? this._socket.readyState : -1; + }, + set: function set(value) {} + }, { + key: "connecting", + get: function get() { + return this.readyState === 0; + }, + set: function set(value) {} + }, { + key: "connected", + get: function get() { + return this.readyState === 1; + }, + set: function set(value) {} + }, { + key: "closing", + get: function get() { + return this.readyState === 2; + }, + set: function set(value) {} + }, { + key: "closed", + get: function get() { + return this.readyState === 3; + }, + set: function set(value) {} + }, { + key: "open", + value: function open() { + this._socketCreate(); + } + }, { + key: "close", + value: function close() { + this._socketClose(); + } + }, { + key: "send", + value: function send(message, topic, silent) { + if (!topic || typeof topic !== "string") { + throw new Error("Missing or invalid topic field"); + } + + this._socketSend({ + topic: topic, + type: "pub", + payload: message, + silent: !!silent + }); + } + }, { + key: "subscribe", + value: function subscribe(topic) { + this._socketSend({ + topic: topic, + type: "sub", + payload: "", + silent: true + }); + } + }, { + key: "on", + value: function on(event, callback) { + this._events.push({ + event: event, + callback: callback + }); + } + }, { + key: "_socketCreate", + value: function _socketCreate() { + var _this2 = this; + + if (this._nextSocket) { + return; + } + + var url = getWebSocketUrl(this._url, this._protocol, this._version); + this._nextSocket = new WS(url); + + if (!this._nextSocket) { + throw new Error("Failed to create socket"); + } + + this._nextSocket.onmessage = function (event) { + return _this2._socketReceive(event); + }; + + this._nextSocket.onopen = function () { + return _this2._socketOpen(); + }; + + this._nextSocket.onerror = function (event) { + return _this2._socketError(event); + }; + + this._nextSocket.onclose = function () { + setTimeout(function () { + _this2._nextSocket = null; + + _this2._socketCreate(); + }, 1000); + }; + } + }, { + key: "_socketOpen", + value: function _socketOpen() { + this._socketClose(); + + this._socket = this._nextSocket; + this._nextSocket = null; + + this._queueSubscriptions(); + + this._pushQueue(); + } + }, { + key: "_socketClose", + value: function _socketClose() { + if (this._socket) { + this._socket.onclose = function () {}; + + this._socket.close(); + } + } + }, { + key: "_socketSend", + value: function _socketSend(socketMessage) { + var message = JSON.stringify(socketMessage); + + if (this._socket && this._socket.readyState === 1) { + this._socket.send(message); + } else { + this._setToQueue(socketMessage); + + this._socketCreate(); + } + } + }, { + key: "_socketReceive", + value: function () { + var _socketReceive2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(event) { + var socketMessage, events; + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + _context.prev = 0; + socketMessage = JSON.parse(event.data); + _context.next = 7; + break; + + case 4: + _context.prev = 4; + _context.t0 = _context["catch"](0); + return _context.abrupt("return"); + + case 7: + this._socketSend({ + topic: socketMessage.topic, + type: "ack", + payload: "", + silent: true + }); + + if (this._socket && this._socket.readyState === 1) { + events = this._events.filter(function (event) { + return event.event === "message"; + }); + + if (events && events.length) { + events.forEach(function (event) { + return event.callback(socketMessage); + }); + } + } + + case 9: + case "end": + return _context.stop(); + } + } + }, _callee, this, [[0, 4]]); + })); + + function _socketReceive(_x) { + return _socketReceive2.apply(this, arguments); + } + + return _socketReceive; + }() + }, { + key: "_socketError", + value: function _socketError(e) { + var events = this._events.filter(function (event) { + return event.event === "error"; + }); + + if (events && events.length) { + events.forEach(function (event) { + return event.callback(e); + }); + } + } + }, { + key: "_queueSubscriptions", + value: function _queueSubscriptions() { + var _this3 = this; + + var subscriptions = this._subscriptions; + subscriptions.forEach(function (topic) { + return _this3._queue.push({ + topic: topic, + type: "sub", + payload: "", + silent: true + }); + }); + this._subscriptions = this.opts.subscriptions || []; + } + }, { + key: "_setToQueue", + value: function _setToQueue(socketMessage) { + this._queue.push(socketMessage); + } + }, { + key: "_pushQueue", + value: function _pushQueue() { + var _this4 = this; + + var queue = this._queue; + queue.forEach(function (socketMessage) { + return _this4._socketSend(socketMessage); + }); + this._queue = []; + } + }]); + + return SocketTransport; +}(); + +function getWebSocketUrl(_url, protocol, version) { + var _a, _b; + + var url = _url.startsWith("https") ? _url.replace("https", "wss") : _url.startsWith("http") ? _url.replace("http", "ws") : _url; + var splitUrl = url.split("?"); + var params = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["isBrowser"])() ? { + protocol: protocol, + version: version, + env: "browser", + host: ((_a = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["getLocation"])()) === null || _a === void 0 ? void 0 : _a.host) || "" + } : { + protocol: protocol, + version: version, + env: ((_b = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["detectEnv"])()) === null || _b === void 0 ? void 0 : _b.name) || "" + }; + var queryString = Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["appendToQueryString"])(Object(_walletconnect_utils__WEBPACK_IMPORTED_MODULE_0__["getQueryString"])(splitUrl[1] || ""), params); + return splitUrl[0] + "?" + queryString; +} + +/* harmony default export */ __webpack_exports__["default"] = (SocketTransport); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/@walletconnect/socket-transport/dist/esm/network.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@walletconnect/socket-transport/dist/esm/network.js ***! + \**************************************************************************/ +/*! exports provided: default */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } + +var NetworkMonitor = /*#__PURE__*/function () { + function NetworkMonitor() { + var _this = this; + + _classCallCheck(this, NetworkMonitor); + + this._eventEmitters = []; + + if (typeof window !== "undefined" && typeof window.addEventListener !== "undefined") { + window.addEventListener("online", function () { + return _this.trigger("online"); + }); + window.addEventListener("offline", function () { + return _this.trigger("offline"); + }); + } + } + + _createClass(NetworkMonitor, [{ + key: "on", + value: function on(event, callback) { + this._eventEmitters.push({ + event: event, + callback: callback + }); + } + }, { + key: "trigger", + value: function trigger(event) { + var eventEmitters = []; + + if (event) { + eventEmitters = this._eventEmitters.filter(function (eventEmitter) { + return eventEmitter.event === event; + }); + } + + eventEmitters.forEach(function (eventEmitter) { + eventEmitter.callback(); + }); + } + }]); + + return NetworkMonitor; +}(); + +/* harmony default export */ __webpack_exports__["default"] = (NetworkMonitor); + +/***/ }), + +/***/ "./node_modules/@walletconnect/socket-transport/node_modules/ws/browser.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@walletconnect/socket-transport/node_modules/ws/browser.js ***! + \*********************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +module.exports = function () { + throw new Error('ws does not work in the browser. Browser clients must use the native ' + 'WebSocket object'); +}; + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/constants.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/constants.js ***! + \*****************************************************************/ +/*! exports provided: reservedEvents, signingMethods, stateMethods, infuraNetworks */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reservedEvents", function() { return reservedEvents; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "signingMethods", function() { return signingMethods; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stateMethods", function() { return stateMethods; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "infuraNetworks", function() { return infuraNetworks; }); +var reservedEvents = ["session_request", "session_update", "exchange_key", "connect", "disconnect", "display_uri", "modal_closed", "transport_open", "transport_close", "transport_error"]; +var signingMethods = ["eth_sendTransaction", "eth_signTransaction", "eth_sign", "eth_signTypedData", "eth_signTypedData_v1", "eth_signTypedData_v2", "eth_signTypedData_v3", "eth_signTypedData_v4", "personal_sign", "wallet_addEthereumChain", "wallet_switchEthereumChain", "wallet_getPermissions", "wallet_requestPermissions", "wallet_registerOnboarding", "wallet_watchAsset", "wallet_scanQRCode"]; +var stateMethods = ["eth_accounts", "eth_chainId", "net_version"]; +var infuraNetworks = { + 1: "mainnet", + 3: "ropsten", + 4: "rinkeby", + 5: "goerli", + 42: "kovan" +}; + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/encoding.js": +/*!****************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/encoding.js ***! + \****************************************************************/ +/*! exports provided: convertArrayBufferToBuffer, convertArrayBufferToUtf8, convertArrayBufferToHex, convertArrayBufferToNumber, concatArrayBuffers, convertBufferToArrayBuffer, convertBufferToUtf8, convertBufferToHex, convertBufferToNumber, concatBuffers, convertUtf8ToArrayBuffer, convertUtf8ToBuffer, convertUtf8ToHex, convertUtf8ToNumber, convertHexToBuffer, convertHexToArrayBuffer, convertHexToUtf8, convertHexToNumber, convertNumberToBuffer, convertNumberToArrayBuffer, convertNumberToUtf8, convertNumberToHex */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToBuffer", function() { return convertArrayBufferToBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToUtf8", function() { return convertArrayBufferToUtf8; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToHex", function() { return convertArrayBufferToHex; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToNumber", function() { return convertArrayBufferToNumber; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatArrayBuffers", function() { return concatArrayBuffers; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBufferToArrayBuffer", function() { return convertBufferToArrayBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBufferToUtf8", function() { return convertBufferToUtf8; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBufferToHex", function() { return convertBufferToHex; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBufferToNumber", function() { return convertBufferToNumber; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatBuffers", function() { return concatBuffers; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToArrayBuffer", function() { return convertUtf8ToArrayBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToBuffer", function() { return convertUtf8ToBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToHex", function() { return convertUtf8ToHex; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToNumber", function() { return convertUtf8ToNumber; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertHexToBuffer", function() { return convertHexToBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertHexToArrayBuffer", function() { return convertHexToArrayBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertHexToUtf8", function() { return convertHexToUtf8; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertHexToNumber", function() { return convertHexToNumber; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertNumberToBuffer", function() { return convertNumberToBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertNumberToArrayBuffer", function() { return convertNumberToArrayBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertNumberToUtf8", function() { return convertNumberToUtf8; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertNumberToHex", function() { return convertNumberToHex; }); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bn.js */ "./node_modules/@walletconnect/utils/node_modules/bn.js/lib/bn.js"); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/encoding */ "./node_modules/@walletconnect/encoding/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__); + + +function convertArrayBufferToBuffer(arrBuf) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToBuffer"](new Uint8Array(arrBuf)); +} +function convertArrayBufferToUtf8(arrBuf) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToUtf8"](new Uint8Array(arrBuf)); +} +function convertArrayBufferToHex(arrBuf, noPrefix) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToHex"](new Uint8Array(arrBuf), !noPrefix); +} +function convertArrayBufferToNumber(arrBuf) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToNumber"](new Uint8Array(arrBuf)); +} +function concatArrayBuffers() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToArray"](args.map(function (b) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["arrayToHex"](new Uint8Array(b)); + }).join("")).buffer; +} +function convertBufferToArrayBuffer(buf) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["bufferToArray"](buf).buffer; +} +function convertBufferToUtf8(buf) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["bufferToUtf8"](buf); +} +function convertBufferToHex(buf, noPrefix) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["bufferToHex"](buf, !noPrefix); +} +function convertBufferToNumber(buf) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["bufferToNumber"](buf); +} +function concatBuffers() { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["concatBuffers"].apply(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__, arguments); +} +function convertUtf8ToArrayBuffer(utf8) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["utf8ToArray"](utf8).buffer; +} +function convertUtf8ToBuffer(utf8) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["utf8ToBuffer"](utf8); +} +function convertUtf8ToHex(utf8, noPrefix) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["utf8ToHex"](utf8, !noPrefix); +} +function convertUtf8ToNumber(utf8) { + return new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(utf8, 10).toNumber(); +} +function convertHexToBuffer(hex) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToBuffer"](hex); +} +function convertHexToArrayBuffer(hex) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToArray"](hex).buffer; +} +function convertHexToUtf8(hex) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["hexToUtf8"](hex); +} +function convertHexToNumber(hex) { + return new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["removeHexPrefix"](hex), "hex").toNumber(); +} +function convertNumberToBuffer(num) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["numberToBuffer"](num); +} +function convertNumberToArrayBuffer(num) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["numberToArray"](num).buffer; +} +function convertNumberToUtf8(num) { + return new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(num).toString(); +} +function convertNumberToHex(num, noPrefix) { + var hex = _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["removeHexPrefix"](_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["sanitizeHex"](new bn_js__WEBPACK_IMPORTED_MODULE_0___default.a(num).toString(16))); + return noPrefix ? hex : _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["addHexPrefix"](hex); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/ethereum.js": +/*!****************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/ethereum.js ***! + \****************************************************************/ +/*! exports provided: toChecksumAddress, isValidAddress, parsePersonalSign, parseTransactionData */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toChecksumAddress", function() { return toChecksumAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isValidAddress", function() { return isValidAddress; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parsePersonalSign", function() { return parsePersonalSign; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseTransactionData", function() { return parseTransactionData; }); +/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! js-sha3 */ "./node_modules/js-sha3/src/sha3.js"); +/* harmony import */ var js_sha3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(js_sha3__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/encoding */ "./node_modules/@walletconnect/encoding/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _encoding__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encoding */ "./node_modules/@walletconnect/utils/dist/esm/encoding.js"); +/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./misc */ "./node_modules/@walletconnect/utils/dist/esm/misc.js"); +/* harmony import */ var _validators__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validators */ "./node_modules/@walletconnect/utils/dist/esm/validators.js"); + + + + + +function toChecksumAddress(address) { + address = Object(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["removeHexPrefix"])(address.toLowerCase()); + var hash = Object(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["removeHexPrefix"])(Object(js_sha3__WEBPACK_IMPORTED_MODULE_0__["keccak_256"])(Object(_encoding__WEBPACK_IMPORTED_MODULE_2__["convertUtf8ToBuffer"])(address))); + var checksum = ""; + + for (var i = 0; i < address.length; i++) { + if (parseInt(hash[i], 16) > 7) { + checksum += address[i].toUpperCase(); + } else { + checksum += address[i]; + } + } + + return Object(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_1__["addHexPrefix"])(checksum); +} +var isValidAddress = function isValidAddress(address) { + if (!address) { + return false; + } else if (address.toLowerCase().substring(0, 2) !== "0x") { + return false; + } else if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { + return false; + } else if (/^(0x)?[0-9a-f]{40}$/.test(address) || /^(0x)?[0-9A-F]{40}$/.test(address)) { + return true; + } else { + return address === toChecksumAddress(address); + } +}; +function parsePersonalSign(params) { + if (!Object(_validators__WEBPACK_IMPORTED_MODULE_4__["isEmptyArray"])(params) && !Object(_validators__WEBPACK_IMPORTED_MODULE_4__["isHexString"])(params[0])) { + params[0] = Object(_encoding__WEBPACK_IMPORTED_MODULE_2__["convertUtf8ToHex"])(params[0]); + } + + return params; +} +function parseTransactionData(txData) { + if (typeof txData.type !== "undefined" && txData.type !== "0") return txData; + + if (typeof txData.from === "undefined" || !isValidAddress(txData.from)) { + throw new Error("Transaction object must include a valid 'from' value."); + } + + function parseHexValues(value) { + var result = value; + + if (typeof value === "number" || typeof value === "string" && !Object(_validators__WEBPACK_IMPORTED_MODULE_4__["isEmptyString"])(value)) { + if (!Object(_validators__WEBPACK_IMPORTED_MODULE_4__["isHexString"])(value)) { + result = Object(_encoding__WEBPACK_IMPORTED_MODULE_2__["convertNumberToHex"])(value); + } else if (typeof value === "string") { + result = Object(_misc__WEBPACK_IMPORTED_MODULE_3__["sanitizeHex"])(value); + } + } + + if (typeof result === "string") { + result = Object(_misc__WEBPACK_IMPORTED_MODULE_3__["removeHexLeadingZeros"])(result); + } + + return result; + } + + var txDataRPC = { + from: Object(_misc__WEBPACK_IMPORTED_MODULE_3__["sanitizeHex"])(txData.from), + to: typeof txData.to === "undefined" ? "" : Object(_misc__WEBPACK_IMPORTED_MODULE_3__["sanitizeHex"])(txData.to), + gasPrice: typeof txData.gasPrice === "undefined" ? "" : parseHexValues(txData.gasPrice), + gas: typeof txData.gas === "undefined" ? typeof txData.gasLimit === "undefined" ? "" : parseHexValues(txData.gasLimit) : parseHexValues(txData.gas), + value: typeof txData.value === "undefined" ? "" : parseHexValues(txData.value), + nonce: typeof txData.nonce === "undefined" ? "" : parseHexValues(txData.nonce), + data: typeof txData.data === "undefined" ? "" : Object(_misc__WEBPACK_IMPORTED_MODULE_3__["sanitizeHex"])(txData.data) || "0x" + }; + var prunable = ["gasPrice", "gas", "value", "nonce"]; + Object.keys(txDataRPC).forEach(function (key) { + if (!txDataRPC[key].trim().length && prunable.includes(key)) { + delete txDataRPC[key]; + } + }); + return txDataRPC; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/index.js": +/*!*************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/index.js ***! + \*************************************************************/ +/*! exports provided: detectEnv, detectOS, isAndroid, isIOS, isMobile, isNode, isBrowser, getFromWindow, getFromWindowOrThrow, getDocumentOrThrow, getDocument, getNavigatorOrThrow, getNavigator, getLocationOrThrow, getLocation, getCryptoOrThrow, getCrypto, getLocalStorageOrThrow, getLocalStorage, getClientMeta, safeJsonParse, safeJsonStringify, setLocal, getLocal, removeLocal, mobileLinkChoiceKey, formatIOSMobile, saveMobileLinkInfo, getMobileRegistryEntry, getMobileLinkRegistry, getWalletRegistryUrl, getDappRegistryUrl, getAppLogoUrl, formatMobileRegistryEntry, formatMobileRegistry, reservedEvents, signingMethods, stateMethods, infuraNetworks, convertArrayBufferToBuffer, convertArrayBufferToUtf8, convertArrayBufferToHex, convertArrayBufferToNumber, concatArrayBuffers, convertBufferToArrayBuffer, convertBufferToUtf8, convertBufferToHex, convertBufferToNumber, concatBuffers, convertUtf8ToArrayBuffer, convertUtf8ToBuffer, convertUtf8ToHex, convertUtf8ToNumber, convertHexToBuffer, convertHexToArrayBuffer, convertHexToUtf8, convertHexToNumber, convertNumberToBuffer, convertNumberToArrayBuffer, convertNumberToUtf8, convertNumberToHex, toChecksumAddress, isValidAddress, parsePersonalSign, parseTransactionData, sanitizeHex, addHexPrefix, removeHexPrefix, removeHexLeadingZeros, payloadId, uuid, logDeprecationWarning, getInfuraRpcUrl, getRpcUrl, promisify, formatRpcError, isWalletConnectSession, parseWalletConnectUri, getQueryString, appendToQueryString, parseQueryString, formatQueryString, isEmptyString, isEmptyArray, isBuffer, isTypedArray, isArrayBuffer, getType, getEncoding, isHexString, isJsonRpcSubscription, isJsonRpcRequest, isJsonRpcResponseSuccess, isJsonRpcResponseError, isInternalEvent, isReservedEvent, isSilentPayload */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/browser-utils */ "./node_modules/@walletconnect/browser-utils/dist/esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "detectEnv", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["detectEnv"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "detectOS", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["detectOS"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isAndroid", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["isAndroid"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isIOS", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["isIOS"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["isMobile"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isNode", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["isNode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBrowser", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["isBrowser"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getFromWindow", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getFromWindow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getFromWindowOrThrow", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getFromWindowOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDocumentOrThrow", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getDocumentOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDocument", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getDocument"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getNavigatorOrThrow", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getNavigatorOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getNavigator", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getNavigator"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocationOrThrow", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getLocationOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocation", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getLocation"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getCryptoOrThrow", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getCryptoOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getCrypto", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getCrypto"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocalStorageOrThrow", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getLocalStorageOrThrow"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocalStorage", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getLocalStorage"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getClientMeta", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getClientMeta"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "safeJsonParse", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["safeJsonParse"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "safeJsonStringify", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["safeJsonStringify"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setLocal", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["setLocal"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getLocal", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getLocal"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeLocal", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["removeLocal"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mobileLinkChoiceKey", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["mobileLinkChoiceKey"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatIOSMobile", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["formatIOSMobile"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "saveMobileLinkInfo", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["saveMobileLinkInfo"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMobileRegistryEntry", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getMobileRegistryEntry"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getMobileLinkRegistry", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getMobileLinkRegistry"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWalletRegistryUrl", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getWalletRegistryUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDappRegistryUrl", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getDappRegistryUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getAppLogoUrl", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["getAppLogoUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatMobileRegistryEntry", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["formatMobileRegistryEntry"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatMobileRegistry", function() { return _walletconnect_browser_utils__WEBPACK_IMPORTED_MODULE_0__["formatMobileRegistry"]; }); + +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ "./node_modules/@walletconnect/utils/dist/esm/constants.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reservedEvents", function() { return _constants__WEBPACK_IMPORTED_MODULE_1__["reservedEvents"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "signingMethods", function() { return _constants__WEBPACK_IMPORTED_MODULE_1__["signingMethods"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "stateMethods", function() { return _constants__WEBPACK_IMPORTED_MODULE_1__["stateMethods"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "infuraNetworks", function() { return _constants__WEBPACK_IMPORTED_MODULE_1__["infuraNetworks"]; }); + +/* harmony import */ var _encoding__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encoding */ "./node_modules/@walletconnect/utils/dist/esm/encoding.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertArrayBufferToBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToUtf8", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertArrayBufferToUtf8"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToHex", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertArrayBufferToHex"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertArrayBufferToNumber", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertArrayBufferToNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatArrayBuffers", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["concatArrayBuffers"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertBufferToArrayBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertBufferToArrayBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertBufferToUtf8", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertBufferToUtf8"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertBufferToHex", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertBufferToHex"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertBufferToNumber", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertBufferToNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatBuffers", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["concatBuffers"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToArrayBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertUtf8ToArrayBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertUtf8ToBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToHex", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertUtf8ToHex"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertUtf8ToNumber", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertUtf8ToNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertHexToBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertHexToBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertHexToArrayBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertHexToArrayBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertHexToUtf8", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertHexToUtf8"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertHexToNumber", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertHexToNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertNumberToBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertNumberToBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertNumberToArrayBuffer", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertNumberToArrayBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertNumberToUtf8", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertNumberToUtf8"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "convertNumberToHex", function() { return _encoding__WEBPACK_IMPORTED_MODULE_2__["convertNumberToHex"]; }); + +/* harmony import */ var _ethereum__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ethereum */ "./node_modules/@walletconnect/utils/dist/esm/ethereum.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toChecksumAddress", function() { return _ethereum__WEBPACK_IMPORTED_MODULE_3__["toChecksumAddress"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidAddress", function() { return _ethereum__WEBPACK_IMPORTED_MODULE_3__["isValidAddress"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parsePersonalSign", function() { return _ethereum__WEBPACK_IMPORTED_MODULE_3__["parsePersonalSign"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseTransactionData", function() { return _ethereum__WEBPACK_IMPORTED_MODULE_3__["parseTransactionData"]; }); + +/* harmony import */ var _misc__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./misc */ "./node_modules/@walletconnect/utils/dist/esm/misc.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sanitizeHex", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["sanitizeHex"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addHexPrefix", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["addHexPrefix"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeHexPrefix", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["removeHexPrefix"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeHexLeadingZeros", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["removeHexLeadingZeros"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "payloadId", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["payloadId"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "uuid", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["uuid"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "logDeprecationWarning", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["logDeprecationWarning"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getInfuraRpcUrl", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["getInfuraRpcUrl"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getRpcUrl", function() { return _misc__WEBPACK_IMPORTED_MODULE_4__["getRpcUrl"]; }); + +/* harmony import */ var _payload__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./payload */ "./node_modules/@walletconnect/utils/dist/esm/payload.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "promisify", function() { return _payload__WEBPACK_IMPORTED_MODULE_5__["promisify"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatRpcError", function() { return _payload__WEBPACK_IMPORTED_MODULE_5__["formatRpcError"]; }); + +/* harmony import */ var _session__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./session */ "./node_modules/@walletconnect/utils/dist/esm/session.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isWalletConnectSession", function() { return _session__WEBPACK_IMPORTED_MODULE_6__["isWalletConnectSession"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseWalletConnectUri", function() { return _session__WEBPACK_IMPORTED_MODULE_6__["parseWalletConnectUri"]; }); + +/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./url */ "./node_modules/@walletconnect/utils/dist/esm/url.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getQueryString", function() { return _url__WEBPACK_IMPORTED_MODULE_7__["getQueryString"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "appendToQueryString", function() { return _url__WEBPACK_IMPORTED_MODULE_7__["appendToQueryString"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseQueryString", function() { return _url__WEBPACK_IMPORTED_MODULE_7__["parseQueryString"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatQueryString", function() { return _url__WEBPACK_IMPORTED_MODULE_7__["formatQueryString"]; }); + +/* harmony import */ var _validators__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./validators */ "./node_modules/@walletconnect/utils/dist/esm/validators.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmptyString", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isEmptyString"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmptyArray", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isEmptyArray"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBuffer", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isTypedArray"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isArrayBuffer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getType", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["getType"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getEncoding", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["getEncoding"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isHexString", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isHexString"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcSubscription", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isJsonRpcSubscription"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcRequest", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isJsonRpcRequest"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResponseSuccess", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isJsonRpcResponseSuccess"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResponseError", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isJsonRpcResponseError"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isInternalEvent", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isInternalEvent"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isReservedEvent", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isReservedEvent"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isSilentPayload", function() { return _validators__WEBPACK_IMPORTED_MODULE_8__["isSilentPayload"]; }); + + + + + + + + + + + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/misc.js": +/*!************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/misc.js ***! + \************************************************************/ +/*! exports provided: sanitizeHex, addHexPrefix, removeHexPrefix, removeHexLeadingZeros, payloadId, uuid, logDeprecationWarning, getInfuraRpcUrl, getRpcUrl */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitizeHex", function() { return sanitizeHex; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addHexPrefix", function() { return addHexPrefix; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeHexPrefix", function() { return removeHexPrefix; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeHexLeadingZeros", function() { return removeHexLeadingZeros; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "payloadId", function() { return payloadId; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "uuid", function() { return uuid; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logDeprecationWarning", function() { return logDeprecationWarning; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInfuraRpcUrl", function() { return getInfuraRpcUrl; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRpcUrl", function() { return getRpcUrl; }); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/encoding */ "./node_modules/@walletconnect/encoding/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @walletconnect/jsonrpc-utils */ "./node_modules/@walletconnect/jsonrpc-utils/dist/esm/index.js"); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@walletconnect/utils/dist/esm/constants.js"); + + + +function sanitizeHex(hex) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["sanitizeHex"](hex); +} +function addHexPrefix(hex) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["addHexPrefix"](hex); +} +function removeHexPrefix(hex) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["removeHexPrefix"](hex); +} +function removeHexLeadingZeros(hex) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["removeHexLeadingZeros"](_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["addHexPrefix"](hex)); +} +var payloadId = _walletconnect_jsonrpc_utils__WEBPACK_IMPORTED_MODULE_1__["payloadId"]; +function uuid() { + var result = function (a, b) { + for (b = a = ""; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : "-") {} + + return b; + }(); + + return result; +} +function logDeprecationWarning() { + console.warn("DEPRECATION WARNING: This WalletConnect client library will be deprecated in favor of @walletconnect/client. Please check docs.walletconnect.org to learn more about this migration!"); +} +function getInfuraRpcUrl(chainId, infuraId) { + var rpcUrl; + var network = _constants__WEBPACK_IMPORTED_MODULE_2__["infuraNetworks"][chainId]; + + if (network) { + rpcUrl = "https://".concat(network, ".infura.io/v3/").concat(infuraId); + } + + return rpcUrl; +} +function getRpcUrl(chainId, rpc) { + var rpcUrl; + var infuraUrl = getInfuraRpcUrl(chainId, rpc.infuraId); + + if (rpc.custom && rpc.custom[chainId]) { + rpcUrl = rpc.custom[chainId]; + } else if (infuraUrl) { + rpcUrl = infuraUrl; + } + + return rpcUrl; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/payload.js": +/*!***************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/payload.js ***! + \***************************************************************/ +/*! exports provided: promisify, formatRpcError */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "promisify", function() { return promisify; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatRpcError", function() { return formatRpcError; }); +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } + +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } + +function promisify(originalFn, thisArg) { + var promisifiedFunction = /*#__PURE__*/function () { + var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() { + var _len, + callArgs, + _key, + _args = arguments; + + return regeneratorRuntime.wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + for (_len = _args.length, callArgs = new Array(_len), _key = 0; _key < _len; _key++) { + callArgs[_key] = _args[_key]; + } + + return _context.abrupt("return", new Promise(function (resolve, reject) { + var callback = function callback(err, data) { + if (err === null || typeof err === "undefined") { + reject(err); + } + + resolve(data); + }; + + originalFn.apply(thisArg, [].concat(callArgs, [callback])); + })); + + case 2: + case "end": + return _context.stop(); + } + } + }, _callee); + })); + + return function promisifiedFunction() { + return _ref.apply(this, arguments); + }; + }(); + + return promisifiedFunction; +} +function formatRpcError(error) { + var message = error.message || "Failed or Rejected Request"; + var code = -32000; + + if (error && !error.code) { + switch (message) { + case "Parse error": + code = -32700; + break; + + case "Invalid request": + code = -32600; + break; + + case "Method not found": + code = -32601; + break; + + case "Invalid params": + code = -32602; + break; + + case "Internal error": + code = -32603; + break; + + default: + code = -32000; + break; + } + } + + var result = { + code: code, + message: message + }; + return result; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/session.js": +/*!***************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/session.js ***! + \***************************************************************/ +/*! exports provided: isWalletConnectSession, parseWalletConnectUri */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWalletConnectSession", function() { return isWalletConnectSession; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseWalletConnectUri", function() { return parseWalletConnectUri; }); +/* harmony import */ var _url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./url */ "./node_modules/@walletconnect/utils/dist/esm/url.js"); + +function isWalletConnectSession(object) { + return typeof object.bridge !== "undefined"; +} +function parseWalletConnectUri(str) { + var pathStart = str.indexOf(":"); + var pathEnd = str.indexOf("?") !== -1 ? str.indexOf("?") : undefined; + var protocol = str.substring(0, pathStart); + var path = str.substring(pathStart + 1, pathEnd); + + function parseRequiredParams(path) { + var separator = "@"; + var values = path.split(separator); + var requiredParams = { + handshakeTopic: values[0], + version: parseInt(values[1], 10) + }; + return requiredParams; + } + + var requiredParams = parseRequiredParams(path); + var queryString = typeof pathEnd !== "undefined" ? str.substr(pathEnd) : ""; + + function parseQueryParams(queryString) { + var result = Object(_url__WEBPACK_IMPORTED_MODULE_0__["parseQueryString"])(queryString); + var parameters = { + key: result.key || "", + bridge: result.bridge || "" + }; + return parameters; + } + + var queryParams = parseQueryParams(queryString); + var result = Object.assign(Object.assign({ + protocol: protocol + }, requiredParams), queryParams); + return result; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/url.js": +/*!***********************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/url.js ***! + \***********************************************************/ +/*! exports provided: getQueryString, appendToQueryString, parseQueryString, formatQueryString */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getQueryString", function() { return getQueryString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "appendToQueryString", function() { return appendToQueryString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseQueryString", function() { return parseQueryString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatQueryString", function() { return formatQueryString; }); +/* harmony import */ var query_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! query-string */ "./node_modules/query-string/index.js"); +/* harmony import */ var query_string__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(query_string__WEBPACK_IMPORTED_MODULE_0__); + +function getQueryString(url) { + var pathEnd = url.indexOf("?") !== -1 ? url.indexOf("?") : undefined; + var queryString = typeof pathEnd !== "undefined" ? url.substr(pathEnd) : ""; + return queryString; +} +function appendToQueryString(queryString, newQueryParams) { + var queryParams = parseQueryString(queryString); + queryParams = Object.assign(Object.assign({}, queryParams), newQueryParams); + queryString = formatQueryString(queryParams); + return queryString; +} +function parseQueryString(queryString) { + return query_string__WEBPACK_IMPORTED_MODULE_0__["parse"](queryString); +} +function formatQueryString(queryParams) { + return query_string__WEBPACK_IMPORTED_MODULE_0__["stringify"](queryParams); +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/dist/esm/validators.js": +/*!******************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/dist/esm/validators.js ***! + \******************************************************************/ +/*! exports provided: isEmptyString, isEmptyArray, isBuffer, isTypedArray, isArrayBuffer, getType, getEncoding, isHexString, isJsonRpcSubscription, isJsonRpcRequest, isJsonRpcResponseSuccess, isJsonRpcResponseError, isInternalEvent, isReservedEvent, isSilentPayload */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmptyString", function() { return isEmptyString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmptyArray", function() { return isEmptyArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBuffer", function() { return isBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isTypedArray", function() { return isTypedArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayBuffer", function() { return isArrayBuffer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getType", function() { return getType; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getEncoding", function() { return getEncoding; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isHexString", function() { return isHexString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcSubscription", function() { return isJsonRpcSubscription; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcRequest", function() { return isJsonRpcRequest; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResponseSuccess", function() { return isJsonRpcResponseSuccess; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isJsonRpcResponseError", function() { return isJsonRpcResponseError; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isInternalEvent", function() { return isInternalEvent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isReservedEvent", function() { return isReservedEvent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSilentPayload", function() { return isSilentPayload; }); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @walletconnect/encoding */ "./node_modules/@walletconnect/encoding/dist/cjs/index.js"); +/* harmony import */ var _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants */ "./node_modules/@walletconnect/utils/dist/esm/constants.js"); +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + + + +function isEmptyString(value) { + return value === "" || typeof value === "string" && value.trim() === ""; +} +function isEmptyArray(array) { + return !(array && array.length); +} +function isBuffer(val) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["isBuffer"](val); +} +function isTypedArray(val) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["isTypedArray"](val); +} +function isArrayBuffer(val) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["isArrayBuffer"](val); +} +function getType(val) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["getType"](val); +} +function getEncoding(val) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["getEncoding"](val); +} +function isHexString(value, length) { + return _walletconnect_encoding__WEBPACK_IMPORTED_MODULE_0__["isHexString"](value, length); +} +function isJsonRpcSubscription(object) { + return _typeof(object.params) === "object"; +} +function isJsonRpcRequest(object) { + return typeof object.method !== "undefined"; +} +function isJsonRpcResponseSuccess(object) { + return typeof object.result !== "undefined"; +} +function isJsonRpcResponseError(object) { + return typeof object.error !== "undefined"; +} +function isInternalEvent(object) { + return typeof object.event !== "undefined"; +} +function isReservedEvent(event) { + return _constants__WEBPACK_IMPORTED_MODULE_1__["reservedEvents"].includes(event) || event.startsWith("wc_"); +} +function isSilentPayload(request) { + if (request.method.startsWith("wc_")) { + return true; + } + + if (_constants__WEBPACK_IMPORTED_MODULE_1__["signingMethods"].includes(request.method)) { + return false; + } + + return true; +} + +/***/ }), + +/***/ "./node_modules/@walletconnect/utils/node_modules/bn.js/lib/bn.js": +/*!************************************************************************!*\ + !*** ./node_modules/@walletconnect/utils/node_modules/bn.js/lib/bn.js ***! + \************************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module) {function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +(function (module, exports) { + 'use strict'; // Utils + + function assert(val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } // Could use `inherits` module, but don't want to move from single file + // architecture yet. + + + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + + var TempCtor = function TempCtor() {}; + + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } // BN + + + function BN(number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; // Reduction context + + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + + if (_typeof(module) === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + var Buffer; + + try { + Buffer = __webpack_require__(/*! buffer */ 1).Buffer; + } catch (e) {} + + BN.isBN = function isBN(num) { + if (num instanceof BN) { + return true; + } + + return num !== null && _typeof(num) === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max(left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min(left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (_typeof(number) === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + + assert(base === (base | 0) && base >= 2 && base <= 36); + number = number.toString().replace(/\s+/g, ''); + var start = 0; + + if (number[0] === '-') { + start++; + } + + if (base === 16) { + this._parseHex(number, start); + } else { + this._parseBase(number, base, start); + } + + if (number[0] === '-') { + this.negative = 1; + } + + this.strip(); + if (endian !== 'le') return; + + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initNumber = function _initNumber(number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + + this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1]; + this.length = 3; + } + + if (endian !== 'le') return; // Reverse the bytes + + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | number[i - 1] << 8 | number[i - 2] << 16; + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] = w >>> 26 - off & 0x3ffffff; + off += 24; + + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | number[i + 1] << 8 | number[i + 2] << 16; + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] = w >>> 26 - off & 0x3ffffff; + off += 24; + + if (off >= 26) { + off -= 26; + j++; + } + } + } + + return this.strip(); + }; + + function parseHex(str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + r <<= 4; // 'a' - 'f' + + if (c >= 49 && c <= 54) { + r |= c - 49 + 0xa; // 'A' - 'F' + } else if (c >= 17 && c <= 22) { + r |= c - 17 + 0xa; // '0' - '9' + } else { + r |= c & 0xf; + } + } + + return r; + } + + BN.prototype._parseHex = function _parseHex(number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; // Scan 24-bit chunks and add them to the number + + var off = 0; + + for (i = number.length - 6, j = 0; i >= start; i -= 6) { + w = parseHex(number, i, i + 6); + this.words[j] |= w << off & 0x3ffffff; // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb + + this.words[j + 1] |= w >>> 26 - off & 0x3fffff; + off += 24; + + if (off >= 26) { + off -= 26; + j++; + } + } + + if (i + 6 !== start) { + w = parseHex(number, start, i + 6); + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] |= w >>> 26 - off & 0x3fffff; + } + + this.strip(); + }; + + function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + r *= mul; // 'a' + + if (c >= 49) { + r += c - 49 + 0xa; // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; // '0' - '9' + } else { + r += c; + } + } + + return r; + } + + BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; // Find length of limb in base + + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + + limbLen--; + limbPow = limbPow / base | 0; + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + var word = 0; + + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + this.imuln(limbPow); + + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + }; + + BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand(size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + + return this; + }; // Remove leading `0` from `this` + + + BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + + return this; + }; + + BN.prototype.inspect = function inspect() { + return (this.red ? ''; + }; + /* + var zeros = []; + var groupSizes = []; + var groupBases = []; + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + */ + + + var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000']; + var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]; + var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176]; + + BN.prototype.toString = function toString(base, padding) { + base = base || 10; + padding = padding | 0 || 1; + var out; + + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = ((w << off | carry) & 0xffffff).toString(16); + carry = w >>> 24 - off & 0xffffff; + + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + + off += 2; + + if (off >= 26) { + off -= 26; + i--; + } + } + + if (carry !== 0) { + out = carry.toString(16) + out; + } + + while (out.length % padding !== 0) { + out = '0' + out; + } + + if (this.negative !== 0) { + out = '-' + out; + } + + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize); + + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + + if (this.isZero()) { + out = '0' + out; + } + + while (out.length % padding !== 0) { + out = '0' + out; + } + + if (this.negative !== 0) { + out = '-' + out; + } + + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber() { + var ret = this.words[0]; + + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + this.words[1] * 0x4000000; + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + + return this.negative !== 0 ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON() { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer(endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray(endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + var b, i; + var q = this.clone(); + + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits(w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits(w) { + var t = w; + var r = 0; + + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits(w) { + // Short-cut + if (w === 0) return 26; + var t = w; + var r = 0; + + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + + if ((t & 0x1) === 0) { + r++; + } + + return r; + }; // Return number of used bits in a BN + + + BN.prototype.bitLength = function bitLength() { + var w = this.words[this.length - 1]; + + var hi = this._countBits(w); + + return (this.length - 1) * 26 + hi; + }; + + function toBitArray(num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = bit / 26 | 0; + var wbit = bit % 26; + w[bit] = (num.words[off] & 1 << wbit) >>> wbit; + } + + return w; + } // Number of trailing zero bits + + + BN.prototype.zeroBits = function zeroBits() { + if (this.isZero()) return 0; + var r = 0; + + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + + r += b; + if (b !== 26) break; + } + + return r; + }; + + BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos(width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos(width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg() { + return this.negative !== 0; + }; // Return negative clone of `this` + + + BN.prototype.neg = function neg() { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; // Or `num` with `this` in-place + + + BN.prototype.iuor = function iuor(num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior(num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; // Or `num` with `this` + + + BN.prototype.or = function or(num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor(num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; // And `num` with `this` in-place + + + BN.prototype.iuand = function iuand(num) { + // b = min-length(num, this) + var b; + + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + return this.strip(); + }; + + BN.prototype.iand = function iand(num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; // And `num` with `this` + + + BN.prototype.and = function and(num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand(num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; // Xor `num` with `this` in-place + + + BN.prototype.iuxor = function iuxor(num) { + // a.length > b.length + var a; + var b; + + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + return this.strip(); + }; + + BN.prototype.ixor = function ixor(num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; // Xor `num` with `this` + + + BN.prototype.xor = function xor(num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor(num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; // Not ``this`` with ``width`` bitwidth + + + BN.prototype.inotn = function inotn(width) { + assert(typeof width === 'number' && width >= 0); + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; // Extend the buffer with leading zeroes + + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } // Handle complete words + + + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } // Handle the residue + + + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft; + } // And remove leading zeroes + + + return this.strip(); + }; + + BN.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; // Set `bit` of `this` + + + BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + var off = bit / 26 | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | 1 << wbit; + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; // Add `num` to `this` in-place + + + BN.prototype.iadd = function iadd(num) { + var r; // negative + positive + + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } // a.length > b.length + + + var a, b; + + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; // Add `num` to `this` + + + BN.prototype.add = function add(num) { + var res; + + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + return num.clone().iadd(this); + }; // Subtract `num` from `this` in-place + + + BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } // At this point both numbers are positive + + + var cmp = this.cmp(num); // Optimization - zeroify + + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } // a > b + + + var a, b; + + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } // Copy rest of the words + + + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; // Subtract `num` from `this` + + + BN.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + + function smallMulTo(self, num, out) { + out.negative = num.negative ^ self.negative; + var len = self.length + num.length | 0; + out.length = len; + len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity) + + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + var lo = r & 0x3ffffff; + var carry = r / 0x4000000 | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += r / 0x4000000 | 0; + rword = r & 0x3ffffff; + } + + out.words[k] = rword | 0; + carry = ncarry | 0; + } + + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + + + var comb10MulTo = function comb10MulTo(self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = mid + Math.imul(ah0, bl0) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = mid + Math.imul(ah1, bl0) | 0; + hi = Math.imul(ah1, bh0); + lo = lo + Math.imul(al0, bl1) | 0; + mid = mid + Math.imul(al0, bh1) | 0; + mid = mid + Math.imul(ah0, bl1) | 0; + hi = hi + Math.imul(ah0, bh1) | 0; + var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = mid + Math.imul(ah2, bl0) | 0; + hi = Math.imul(ah2, bh0); + lo = lo + Math.imul(al1, bl1) | 0; + mid = mid + Math.imul(al1, bh1) | 0; + mid = mid + Math.imul(ah1, bl1) | 0; + hi = hi + Math.imul(ah1, bh1) | 0; + lo = lo + Math.imul(al0, bl2) | 0; + mid = mid + Math.imul(al0, bh2) | 0; + mid = mid + Math.imul(ah0, bl2) | 0; + hi = hi + Math.imul(ah0, bh2) | 0; + var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = mid + Math.imul(ah3, bl0) | 0; + hi = Math.imul(ah3, bh0); + lo = lo + Math.imul(al2, bl1) | 0; + mid = mid + Math.imul(al2, bh1) | 0; + mid = mid + Math.imul(ah2, bl1) | 0; + hi = hi + Math.imul(ah2, bh1) | 0; + lo = lo + Math.imul(al1, bl2) | 0; + mid = mid + Math.imul(al1, bh2) | 0; + mid = mid + Math.imul(ah1, bl2) | 0; + hi = hi + Math.imul(ah1, bh2) | 0; + lo = lo + Math.imul(al0, bl3) | 0; + mid = mid + Math.imul(al0, bh3) | 0; + mid = mid + Math.imul(ah0, bl3) | 0; + hi = hi + Math.imul(ah0, bh3) | 0; + var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = mid + Math.imul(ah4, bl0) | 0; + hi = Math.imul(ah4, bh0); + lo = lo + Math.imul(al3, bl1) | 0; + mid = mid + Math.imul(al3, bh1) | 0; + mid = mid + Math.imul(ah3, bl1) | 0; + hi = hi + Math.imul(ah3, bh1) | 0; + lo = lo + Math.imul(al2, bl2) | 0; + mid = mid + Math.imul(al2, bh2) | 0; + mid = mid + Math.imul(ah2, bl2) | 0; + hi = hi + Math.imul(ah2, bh2) | 0; + lo = lo + Math.imul(al1, bl3) | 0; + mid = mid + Math.imul(al1, bh3) | 0; + mid = mid + Math.imul(ah1, bl3) | 0; + hi = hi + Math.imul(ah1, bh3) | 0; + lo = lo + Math.imul(al0, bl4) | 0; + mid = mid + Math.imul(al0, bh4) | 0; + mid = mid + Math.imul(ah0, bl4) | 0; + hi = hi + Math.imul(ah0, bh4) | 0; + var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = mid + Math.imul(ah5, bl0) | 0; + hi = Math.imul(ah5, bh0); + lo = lo + Math.imul(al4, bl1) | 0; + mid = mid + Math.imul(al4, bh1) | 0; + mid = mid + Math.imul(ah4, bl1) | 0; + hi = hi + Math.imul(ah4, bh1) | 0; + lo = lo + Math.imul(al3, bl2) | 0; + mid = mid + Math.imul(al3, bh2) | 0; + mid = mid + Math.imul(ah3, bl2) | 0; + hi = hi + Math.imul(ah3, bh2) | 0; + lo = lo + Math.imul(al2, bl3) | 0; + mid = mid + Math.imul(al2, bh3) | 0; + mid = mid + Math.imul(ah2, bl3) | 0; + hi = hi + Math.imul(ah2, bh3) | 0; + lo = lo + Math.imul(al1, bl4) | 0; + mid = mid + Math.imul(al1, bh4) | 0; + mid = mid + Math.imul(ah1, bl4) | 0; + hi = hi + Math.imul(ah1, bh4) | 0; + lo = lo + Math.imul(al0, bl5) | 0; + mid = mid + Math.imul(al0, bh5) | 0; + mid = mid + Math.imul(ah0, bl5) | 0; + hi = hi + Math.imul(ah0, bh5) | 0; + var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = mid + Math.imul(ah6, bl0) | 0; + hi = Math.imul(ah6, bh0); + lo = lo + Math.imul(al5, bl1) | 0; + mid = mid + Math.imul(al5, bh1) | 0; + mid = mid + Math.imul(ah5, bl1) | 0; + hi = hi + Math.imul(ah5, bh1) | 0; + lo = lo + Math.imul(al4, bl2) | 0; + mid = mid + Math.imul(al4, bh2) | 0; + mid = mid + Math.imul(ah4, bl2) | 0; + hi = hi + Math.imul(ah4, bh2) | 0; + lo = lo + Math.imul(al3, bl3) | 0; + mid = mid + Math.imul(al3, bh3) | 0; + mid = mid + Math.imul(ah3, bl3) | 0; + hi = hi + Math.imul(ah3, bh3) | 0; + lo = lo + Math.imul(al2, bl4) | 0; + mid = mid + Math.imul(al2, bh4) | 0; + mid = mid + Math.imul(ah2, bl4) | 0; + hi = hi + Math.imul(ah2, bh4) | 0; + lo = lo + Math.imul(al1, bl5) | 0; + mid = mid + Math.imul(al1, bh5) | 0; + mid = mid + Math.imul(ah1, bl5) | 0; + hi = hi + Math.imul(ah1, bh5) | 0; + lo = lo + Math.imul(al0, bl6) | 0; + mid = mid + Math.imul(al0, bh6) | 0; + mid = mid + Math.imul(ah0, bl6) | 0; + hi = hi + Math.imul(ah0, bh6) | 0; + var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = mid + Math.imul(ah7, bl0) | 0; + hi = Math.imul(ah7, bh0); + lo = lo + Math.imul(al6, bl1) | 0; + mid = mid + Math.imul(al6, bh1) | 0; + mid = mid + Math.imul(ah6, bl1) | 0; + hi = hi + Math.imul(ah6, bh1) | 0; + lo = lo + Math.imul(al5, bl2) | 0; + mid = mid + Math.imul(al5, bh2) | 0; + mid = mid + Math.imul(ah5, bl2) | 0; + hi = hi + Math.imul(ah5, bh2) | 0; + lo = lo + Math.imul(al4, bl3) | 0; + mid = mid + Math.imul(al4, bh3) | 0; + mid = mid + Math.imul(ah4, bl3) | 0; + hi = hi + Math.imul(ah4, bh3) | 0; + lo = lo + Math.imul(al3, bl4) | 0; + mid = mid + Math.imul(al3, bh4) | 0; + mid = mid + Math.imul(ah3, bl4) | 0; + hi = hi + Math.imul(ah3, bh4) | 0; + lo = lo + Math.imul(al2, bl5) | 0; + mid = mid + Math.imul(al2, bh5) | 0; + mid = mid + Math.imul(ah2, bl5) | 0; + hi = hi + Math.imul(ah2, bh5) | 0; + lo = lo + Math.imul(al1, bl6) | 0; + mid = mid + Math.imul(al1, bh6) | 0; + mid = mid + Math.imul(ah1, bl6) | 0; + hi = hi + Math.imul(ah1, bh6) | 0; + lo = lo + Math.imul(al0, bl7) | 0; + mid = mid + Math.imul(al0, bh7) | 0; + mid = mid + Math.imul(ah0, bl7) | 0; + hi = hi + Math.imul(ah0, bh7) | 0; + var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = mid + Math.imul(ah8, bl0) | 0; + hi = Math.imul(ah8, bh0); + lo = lo + Math.imul(al7, bl1) | 0; + mid = mid + Math.imul(al7, bh1) | 0; + mid = mid + Math.imul(ah7, bl1) | 0; + hi = hi + Math.imul(ah7, bh1) | 0; + lo = lo + Math.imul(al6, bl2) | 0; + mid = mid + Math.imul(al6, bh2) | 0; + mid = mid + Math.imul(ah6, bl2) | 0; + hi = hi + Math.imul(ah6, bh2) | 0; + lo = lo + Math.imul(al5, bl3) | 0; + mid = mid + Math.imul(al5, bh3) | 0; + mid = mid + Math.imul(ah5, bl3) | 0; + hi = hi + Math.imul(ah5, bh3) | 0; + lo = lo + Math.imul(al4, bl4) | 0; + mid = mid + Math.imul(al4, bh4) | 0; + mid = mid + Math.imul(ah4, bl4) | 0; + hi = hi + Math.imul(ah4, bh4) | 0; + lo = lo + Math.imul(al3, bl5) | 0; + mid = mid + Math.imul(al3, bh5) | 0; + mid = mid + Math.imul(ah3, bl5) | 0; + hi = hi + Math.imul(ah3, bh5) | 0; + lo = lo + Math.imul(al2, bl6) | 0; + mid = mid + Math.imul(al2, bh6) | 0; + mid = mid + Math.imul(ah2, bl6) | 0; + hi = hi + Math.imul(ah2, bh6) | 0; + lo = lo + Math.imul(al1, bl7) | 0; + mid = mid + Math.imul(al1, bh7) | 0; + mid = mid + Math.imul(ah1, bl7) | 0; + hi = hi + Math.imul(ah1, bh7) | 0; + lo = lo + Math.imul(al0, bl8) | 0; + mid = mid + Math.imul(al0, bh8) | 0; + mid = mid + Math.imul(ah0, bl8) | 0; + hi = hi + Math.imul(ah0, bh8) | 0; + var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = mid + Math.imul(ah9, bl0) | 0; + hi = Math.imul(ah9, bh0); + lo = lo + Math.imul(al8, bl1) | 0; + mid = mid + Math.imul(al8, bh1) | 0; + mid = mid + Math.imul(ah8, bl1) | 0; + hi = hi + Math.imul(ah8, bh1) | 0; + lo = lo + Math.imul(al7, bl2) | 0; + mid = mid + Math.imul(al7, bh2) | 0; + mid = mid + Math.imul(ah7, bl2) | 0; + hi = hi + Math.imul(ah7, bh2) | 0; + lo = lo + Math.imul(al6, bl3) | 0; + mid = mid + Math.imul(al6, bh3) | 0; + mid = mid + Math.imul(ah6, bl3) | 0; + hi = hi + Math.imul(ah6, bh3) | 0; + lo = lo + Math.imul(al5, bl4) | 0; + mid = mid + Math.imul(al5, bh4) | 0; + mid = mid + Math.imul(ah5, bl4) | 0; + hi = hi + Math.imul(ah5, bh4) | 0; + lo = lo + Math.imul(al4, bl5) | 0; + mid = mid + Math.imul(al4, bh5) | 0; + mid = mid + Math.imul(ah4, bl5) | 0; + hi = hi + Math.imul(ah4, bh5) | 0; + lo = lo + Math.imul(al3, bl6) | 0; + mid = mid + Math.imul(al3, bh6) | 0; + mid = mid + Math.imul(ah3, bl6) | 0; + hi = hi + Math.imul(ah3, bh6) | 0; + lo = lo + Math.imul(al2, bl7) | 0; + mid = mid + Math.imul(al2, bh7) | 0; + mid = mid + Math.imul(ah2, bl7) | 0; + hi = hi + Math.imul(ah2, bh7) | 0; + lo = lo + Math.imul(al1, bl8) | 0; + mid = mid + Math.imul(al1, bh8) | 0; + mid = mid + Math.imul(ah1, bl8) | 0; + hi = hi + Math.imul(ah1, bh8) | 0; + lo = lo + Math.imul(al0, bl9) | 0; + mid = mid + Math.imul(al0, bh9) | 0; + mid = mid + Math.imul(ah0, bl9) | 0; + hi = hi + Math.imul(ah0, bh9) | 0; + var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = mid + Math.imul(ah9, bl1) | 0; + hi = Math.imul(ah9, bh1); + lo = lo + Math.imul(al8, bl2) | 0; + mid = mid + Math.imul(al8, bh2) | 0; + mid = mid + Math.imul(ah8, bl2) | 0; + hi = hi + Math.imul(ah8, bh2) | 0; + lo = lo + Math.imul(al7, bl3) | 0; + mid = mid + Math.imul(al7, bh3) | 0; + mid = mid + Math.imul(ah7, bl3) | 0; + hi = hi + Math.imul(ah7, bh3) | 0; + lo = lo + Math.imul(al6, bl4) | 0; + mid = mid + Math.imul(al6, bh4) | 0; + mid = mid + Math.imul(ah6, bl4) | 0; + hi = hi + Math.imul(ah6, bh4) | 0; + lo = lo + Math.imul(al5, bl5) | 0; + mid = mid + Math.imul(al5, bh5) | 0; + mid = mid + Math.imul(ah5, bl5) | 0; + hi = hi + Math.imul(ah5, bh5) | 0; + lo = lo + Math.imul(al4, bl6) | 0; + mid = mid + Math.imul(al4, bh6) | 0; + mid = mid + Math.imul(ah4, bl6) | 0; + hi = hi + Math.imul(ah4, bh6) | 0; + lo = lo + Math.imul(al3, bl7) | 0; + mid = mid + Math.imul(al3, bh7) | 0; + mid = mid + Math.imul(ah3, bl7) | 0; + hi = hi + Math.imul(ah3, bh7) | 0; + lo = lo + Math.imul(al2, bl8) | 0; + mid = mid + Math.imul(al2, bh8) | 0; + mid = mid + Math.imul(ah2, bl8) | 0; + hi = hi + Math.imul(ah2, bh8) | 0; + lo = lo + Math.imul(al1, bl9) | 0; + mid = mid + Math.imul(al1, bh9) | 0; + mid = mid + Math.imul(ah1, bl9) | 0; + hi = hi + Math.imul(ah1, bh9) | 0; + var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = mid + Math.imul(ah9, bl2) | 0; + hi = Math.imul(ah9, bh2); + lo = lo + Math.imul(al8, bl3) | 0; + mid = mid + Math.imul(al8, bh3) | 0; + mid = mid + Math.imul(ah8, bl3) | 0; + hi = hi + Math.imul(ah8, bh3) | 0; + lo = lo + Math.imul(al7, bl4) | 0; + mid = mid + Math.imul(al7, bh4) | 0; + mid = mid + Math.imul(ah7, bl4) | 0; + hi = hi + Math.imul(ah7, bh4) | 0; + lo = lo + Math.imul(al6, bl5) | 0; + mid = mid + Math.imul(al6, bh5) | 0; + mid = mid + Math.imul(ah6, bl5) | 0; + hi = hi + Math.imul(ah6, bh5) | 0; + lo = lo + Math.imul(al5, bl6) | 0; + mid = mid + Math.imul(al5, bh6) | 0; + mid = mid + Math.imul(ah5, bl6) | 0; + hi = hi + Math.imul(ah5, bh6) | 0; + lo = lo + Math.imul(al4, bl7) | 0; + mid = mid + Math.imul(al4, bh7) | 0; + mid = mid + Math.imul(ah4, bl7) | 0; + hi = hi + Math.imul(ah4, bh7) | 0; + lo = lo + Math.imul(al3, bl8) | 0; + mid = mid + Math.imul(al3, bh8) | 0; + mid = mid + Math.imul(ah3, bl8) | 0; + hi = hi + Math.imul(ah3, bh8) | 0; + lo = lo + Math.imul(al2, bl9) | 0; + mid = mid + Math.imul(al2, bh9) | 0; + mid = mid + Math.imul(ah2, bl9) | 0; + hi = hi + Math.imul(ah2, bh9) | 0; + var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = mid + Math.imul(ah9, bl3) | 0; + hi = Math.imul(ah9, bh3); + lo = lo + Math.imul(al8, bl4) | 0; + mid = mid + Math.imul(al8, bh4) | 0; + mid = mid + Math.imul(ah8, bl4) | 0; + hi = hi + Math.imul(ah8, bh4) | 0; + lo = lo + Math.imul(al7, bl5) | 0; + mid = mid + Math.imul(al7, bh5) | 0; + mid = mid + Math.imul(ah7, bl5) | 0; + hi = hi + Math.imul(ah7, bh5) | 0; + lo = lo + Math.imul(al6, bl6) | 0; + mid = mid + Math.imul(al6, bh6) | 0; + mid = mid + Math.imul(ah6, bl6) | 0; + hi = hi + Math.imul(ah6, bh6) | 0; + lo = lo + Math.imul(al5, bl7) | 0; + mid = mid + Math.imul(al5, bh7) | 0; + mid = mid + Math.imul(ah5, bl7) | 0; + hi = hi + Math.imul(ah5, bh7) | 0; + lo = lo + Math.imul(al4, bl8) | 0; + mid = mid + Math.imul(al4, bh8) | 0; + mid = mid + Math.imul(ah4, bl8) | 0; + hi = hi + Math.imul(ah4, bh8) | 0; + lo = lo + Math.imul(al3, bl9) | 0; + mid = mid + Math.imul(al3, bh9) | 0; + mid = mid + Math.imul(ah3, bl9) | 0; + hi = hi + Math.imul(ah3, bh9) | 0; + var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = mid + Math.imul(ah9, bl4) | 0; + hi = Math.imul(ah9, bh4); + lo = lo + Math.imul(al8, bl5) | 0; + mid = mid + Math.imul(al8, bh5) | 0; + mid = mid + Math.imul(ah8, bl5) | 0; + hi = hi + Math.imul(ah8, bh5) | 0; + lo = lo + Math.imul(al7, bl6) | 0; + mid = mid + Math.imul(al7, bh6) | 0; + mid = mid + Math.imul(ah7, bl6) | 0; + hi = hi + Math.imul(ah7, bh6) | 0; + lo = lo + Math.imul(al6, bl7) | 0; + mid = mid + Math.imul(al6, bh7) | 0; + mid = mid + Math.imul(ah6, bl7) | 0; + hi = hi + Math.imul(ah6, bh7) | 0; + lo = lo + Math.imul(al5, bl8) | 0; + mid = mid + Math.imul(al5, bh8) | 0; + mid = mid + Math.imul(ah5, bl8) | 0; + hi = hi + Math.imul(ah5, bh8) | 0; + lo = lo + Math.imul(al4, bl9) | 0; + mid = mid + Math.imul(al4, bh9) | 0; + mid = mid + Math.imul(ah4, bl9) | 0; + hi = hi + Math.imul(ah4, bh9) | 0; + var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = mid + Math.imul(ah9, bl5) | 0; + hi = Math.imul(ah9, bh5); + lo = lo + Math.imul(al8, bl6) | 0; + mid = mid + Math.imul(al8, bh6) | 0; + mid = mid + Math.imul(ah8, bl6) | 0; + hi = hi + Math.imul(ah8, bh6) | 0; + lo = lo + Math.imul(al7, bl7) | 0; + mid = mid + Math.imul(al7, bh7) | 0; + mid = mid + Math.imul(ah7, bl7) | 0; + hi = hi + Math.imul(ah7, bh7) | 0; + lo = lo + Math.imul(al6, bl8) | 0; + mid = mid + Math.imul(al6, bh8) | 0; + mid = mid + Math.imul(ah6, bl8) | 0; + hi = hi + Math.imul(ah6, bh8) | 0; + lo = lo + Math.imul(al5, bl9) | 0; + mid = mid + Math.imul(al5, bh9) | 0; + mid = mid + Math.imul(ah5, bl9) | 0; + hi = hi + Math.imul(ah5, bh9) | 0; + var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = mid + Math.imul(ah9, bl6) | 0; + hi = Math.imul(ah9, bh6); + lo = lo + Math.imul(al8, bl7) | 0; + mid = mid + Math.imul(al8, bh7) | 0; + mid = mid + Math.imul(ah8, bl7) | 0; + hi = hi + Math.imul(ah8, bh7) | 0; + lo = lo + Math.imul(al7, bl8) | 0; + mid = mid + Math.imul(al7, bh8) | 0; + mid = mid + Math.imul(ah7, bl8) | 0; + hi = hi + Math.imul(ah7, bh8) | 0; + lo = lo + Math.imul(al6, bl9) | 0; + mid = mid + Math.imul(al6, bh9) | 0; + mid = mid + Math.imul(ah6, bl9) | 0; + hi = hi + Math.imul(ah6, bh9) | 0; + var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = mid + Math.imul(ah9, bl7) | 0; + hi = Math.imul(ah9, bh7); + lo = lo + Math.imul(al8, bl8) | 0; + mid = mid + Math.imul(al8, bh8) | 0; + mid = mid + Math.imul(ah8, bl8) | 0; + hi = hi + Math.imul(ah8, bh8) | 0; + lo = lo + Math.imul(al7, bl9) | 0; + mid = mid + Math.imul(al7, bh9) | 0; + mid = mid + Math.imul(ah7, bl9) | 0; + hi = hi + Math.imul(ah7, bh9) | 0; + var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = mid + Math.imul(ah9, bl8) | 0; + hi = Math.imul(ah9, bh8); + lo = lo + Math.imul(al8, bl9) | 0; + mid = mid + Math.imul(al8, bh9) | 0; + mid = mid + Math.imul(ah8, bl9) | 0; + hi = hi + Math.imul(ah8, bh9) | 0; + var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = mid + Math.imul(ah9, bl9) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + + if (c !== 0) { + o[19] = c; + out.length++; + } + + return out; + }; // Polyfill comb + + + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo(self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + var carry = 0; + var hncarry = 0; + + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + var lo = r & 0x3ffffff; + ncarry = ncarry + (r / 0x4000000 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 0x3ffffff; + ncarry = ncarry + (lo >>> 26) | 0; + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo(self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo(num, out) { + var res; + var len = this.length + num.length; + + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + + function FFTM(x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT(N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; // Returns binary-reversed representation of `x` + + + FFTM.prototype.revBin = function revBin(x, l, N) { + if (x === 0 || x === N - 1) return x; + var rb = 0; + + for (var i = 0; i < l; i++) { + rb |= (x & 1) << l - i - 1; + x >>= 1; + } + + return rb; + }; // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + + + FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + var rx = rtwdf_ * ro - itwdf_ * io; + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + /* jshint maxdepth : false */ + + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b(n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate(rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + t = iws[i]; + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b(ws, N) { + var carry = 0; + + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry; + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) { + var carry = 0; + + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + rws[2 * i] = carry & 0x1fff; + carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; + carry = carry >>> 13; + } // Pad with zeroes + + + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub(N) { + var ph = new Array(N); + + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp(x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + var rmws = out.words; + rmws.length = N; + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; // Multiply `this` by `num` + + + BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; // Multiply employing FFT + + + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; // In-place Multiplication + + + BN.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); // Carry + + var carry = 0; + + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum + + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; // `this` * `this` + + + BN.prototype.sqr = function sqr() { + return this.mul(this); + }; // `this` * `this` in-place + + + BN.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; // Math.pow(`this`, `num`) + + + BN.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); // Skip leading zeroes + + var res = this; + + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + res = res.mul(q); + } + } + + return res; + }; // Shift-left in-place + + + BN.prototype.iushln = function iushln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = 0x3ffffff >>> 26 - r << 26 - r; + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] | 0) - newCarry << r; + this.words[i] = c | carry; + carry = newCarry >>> 26 - r; + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln(bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + + + BN.prototype.iushrn = function iushrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + + if (hint) { + h = (hint - hint % 26) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; + var maskedWords = extended; + h -= s; + h = Math.max(0, h); // Extended mode, copy masked part + + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + + maskedWords.length = s; + } + + if (s === 0) {// No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = carry << 26 - r | word >>> r; + carry = word & mask; + } // Push carried bits as a mask + + + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn(bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; // Shift-left + + + BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; // Shift-right + + + BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; // Test if n bit is set + + + BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; // Fast case: bit is much higher than all existing words + + if (this.length <= s) return false; // Check bit and return + + var w = this.words[s]; + return !!(w & q); + }; // Return only lowers bits of number (in-place) + + + BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; // Return only lowers bits of number + + + BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; // Add plain number `num` to `this` + + + BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); // Possible sign change + + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } // Add without checks + + + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; // Carry + + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + + this.length = Math.max(this.length, i + 1); + return this; + }; // Subtract plain number `num` from `this` + + + BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs() { + this.negative = 0; + return this; + }; + + BN.prototype.abs = function abs() { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - (right / 0x4000000 | 0); + this.words[i + shift] = w & 0x3ffffff; + } + + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); // Subtraction overflow + + assert(carry === -1); + carry = 0; + + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + + this.negative = 1; + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + var a = this.clone(); + var b = num; // Normalize + + var bhi = b.words[b.length - 1] | 0; + + var bhiBits = this._countBits(bhi); + + shift = 26 - bhiBits; + + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } // Initialize quotient + + + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + + if (diff.negative === 0) { + a = diff; + + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + + qj = Math.min(qj / bhi | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + + while (a.negative !== 0) { + qj--; + a.negative = 0; + + a._ishlnsubmul(b, 1, j); + + if (!a.isZero()) { + a.negative ^= 1; + } + } + + if (q) { + q.words[j] = qj; + } + } + + if (q) { + q.strip(); + } + + a.strip(); // Denormalize + + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + + + BN.prototype.divmod = function divmod(num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } // Both numbers are positive at this point + // Strip both numbers to approximate shift value + + + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } // Very short reduction + + + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; // Find `this` / `num` + + + BN.prototype.div = function div(num) { + return this.divmod(num, 'div', false).div; + }; // Find `this` % `num` + + + BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod(num) { + return this.divmod(num, 'mod', true).mod; + }; // Find Round(`this` / `num`) + + + BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); // Fast case - exact division + + if (dm.mod.isZero()) return dm.div; + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); // Round down + + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up + + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + var acc = 0; + + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; // In-place division by number + + + BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + var carry = 0; + + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = w / num | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd(p) { + assert(p.negative === 0); + assert(!p.isZero()); + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } // A * x + B * y = x + + + var A = new BN(1); + var B = new BN(0); // C * x + D * y = y + + var C = new BN(0); + var D = new BN(1); + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) { + ; + } + + if (i > 0) { + x.iushrn(i); + + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) { + ; + } + + if (j > 0) { + y.iushrn(j); + + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + + + BN.prototype._invmp = function _invmp(p) { + assert(p.negative === 0); + assert(!p.isZero()); + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) { + ; + } + + if (i > 0) { + a.iushrn(i); + + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) { + ; + } + + if (j > 0) { + b.iushrn(j); + + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd(num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; // Remove common factor of two + + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; // Invert number in the field F(num) + + + BN.prototype.invm = function invm(num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; + }; // And first word and num + + + BN.prototype.andln = function andln(num) { + return this.words[0] & num; + }; // Increment at the bit position in-line + + + BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; // Fast case: bit is much higher than all existing words + + if (this.length <= s) { + this._expand(s + 1); + + this.words[s] |= q; + return this; + } // Add bit and propagate, if needed + + + var carry = q; + + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.isZero = function isZero() { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn(num) { + var negative = num < 0; + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + this.strip(); + var res; + + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + + if (this.negative !== 0) return -res | 0; + return res; + }; // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + + + BN.prototype.cmp = function cmp(num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; // Unsigned comparison + + + BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + var res = 0; + + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + if (a === b) continue; + + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + + break; + } + + return res; + }; + + BN.prototype.gtn = function gtn(num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt(num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten(num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte(num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn(num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt(num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten(num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte(num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn(num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq(num) { + return this.cmp(num) === 0; + }; // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + + + BN.red = function red(num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + + this.red._verify2(this, num); + + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + + this.red._verify2(this, num); + + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + + this.red._verify1(this); + + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + + this.red._verify1(this); + + return this.red.isqr(this); + }; // Square root over p + + + BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + + this.red._verify1(this); + + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + + this.red._verify1(this); + + return this.red.invm(this); + }; // Return negative clone of `this` % `red modulo` + + + BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + + this.red._verify1(this); + + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + + this.red._verify1(this); + + return this.red.pow(this, num); + }; // Prime numbers with efficient reduction + + + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; // Pseudo-Mersenne prime + + function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; + }; + + MPrime.prototype.split = function split(input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); + }; + + function K256() { + MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + + inherits(K256, MPrime); + + K256.prototype.split = function split(input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + var outLen = Math.min(input.length, 9); + + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } // Shift by 9 limbs + + + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = (next & mask) << 4 | prev >>> 22; + prev = next; + } + + prev >>>= 22; + input.words[i - 10] = prev; + + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + + var lo = 0; + + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + (lo / 0x4000000 | 0); + } // Fast length reduction + + + if (num.words[num.length - 1] === 0) { + num.length--; + + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + + return num; + }; + + function P224() { + MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + + inherits(P224, MPrime); + + function P192() { + MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + + inherits(P192, MPrime); + + function P25519() { + // 2 ^ 255 - 19 + MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + num.words[i] = lo; + carry = hi; + } + + if (carry !== 0) { + num.words[num.length++] = carry; + } + + return num; + }; // Exported mostly for testing purposes, use plain name instead + + + BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) return primes[name]; + var prime; + + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + + primes[name] = prime; + return prime; + }; // + // Base reduction engine + // + + + function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1(a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2(a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod(a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg(a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add(a, b) { + this._verify2(a, b); + + var res = a.add(b); + + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + + return res; + }; + + Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); + + var res = a.sub(b); + + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + + return res._forceRed(this); + }; + + Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + + return res; + }; + + Red.prototype.shl = function shl(a, num) { + this._verify1(a); + + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr(a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt(a) { + if (a.isZero()) return a.clone(); + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); // Fast case + + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + + + var q = this.m.subn(1); + var s = 0; + + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + + assert(!q.isZero()); + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + + while (t.cmp(one) !== 0) { + var tmp = t; + + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm(a) { + var inv = a._invmp(this.m); + + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow(a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + + for (var j = start - 1; j >= 0; j--) { + var bit = word >> j & 1; + + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo(num) { + var r = num.umod(this.m); + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; + }; // + // Montgomery method engine + // + + + BN.mont = function mont(num) { + return new Mont(num); + }; + + function Mont(m) { + Red.call(this, m); + this.shift = this.m.bitLength(); + + if (this.shift % 26 !== 0) { + this.shift += 26 - this.shift % 26; + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul(a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul(a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) + +/***/ }), + +/***/ "./node_modules/@walletconnect/window-getters/dist/cjs/index.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@walletconnect/window-getters/dist/cjs/index.js ***! + \**********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getLocalStorage = exports.getLocalStorageOrThrow = exports.getCrypto = exports.getCryptoOrThrow = exports.getLocation = exports.getLocationOrThrow = exports.getNavigator = exports.getNavigatorOrThrow = exports.getDocument = exports.getDocumentOrThrow = exports.getFromWindowOrThrow = exports.getFromWindow = void 0; + +function getFromWindow(name) { + var res = undefined; + + if (typeof window !== "undefined" && typeof window[name] !== "undefined") { + res = window[name]; + } + + return res; +} + +exports.getFromWindow = getFromWindow; + +function getFromWindowOrThrow(name) { + var res = getFromWindow(name); + + if (!res) { + throw new Error("".concat(name, " is not defined in Window")); + } + + return res; +} + +exports.getFromWindowOrThrow = getFromWindowOrThrow; + +function getDocumentOrThrow() { + return getFromWindowOrThrow("document"); +} + +exports.getDocumentOrThrow = getDocumentOrThrow; + +function getDocument() { + return getFromWindow("document"); +} + +exports.getDocument = getDocument; + +function getNavigatorOrThrow() { + return getFromWindowOrThrow("navigator"); +} + +exports.getNavigatorOrThrow = getNavigatorOrThrow; + +function getNavigator() { + return getFromWindow("navigator"); +} + +exports.getNavigator = getNavigator; + +function getLocationOrThrow() { + return getFromWindowOrThrow("location"); +} + +exports.getLocationOrThrow = getLocationOrThrow; + +function getLocation() { + return getFromWindow("location"); +} + +exports.getLocation = getLocation; + +function getCryptoOrThrow() { + return getFromWindowOrThrow("crypto"); +} + +exports.getCryptoOrThrow = getCryptoOrThrow; + +function getCrypto() { + return getFromWindow("crypto"); +} + +exports.getCrypto = getCrypto; + +function getLocalStorageOrThrow() { + return getFromWindowOrThrow("localStorage"); +} + +exports.getLocalStorageOrThrow = getLocalStorageOrThrow; + +function getLocalStorage() { + return getFromWindow("localStorage"); +} + +exports.getLocalStorage = getLocalStorage; + +/***/ }), + +/***/ "./node_modules/@walletconnect/window-metadata/dist/cjs/index.js": +/*!***********************************************************************!*\ + !*** ./node_modules/@walletconnect/window-metadata/dist/cjs/index.js ***! + \***********************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getWindowMetadata = void 0; + +var window_getters_1 = __webpack_require__(/*! @walletconnect/window-getters */ "./node_modules/@walletconnect/window-getters/dist/cjs/index.js"); + +function getWindowMetadata() { + var doc; + var loc; + + try { + doc = window_getters_1.getDocumentOrThrow(); + loc = window_getters_1.getLocationOrThrow(); + } catch (e) { + return null; + } + + function getIcons() { + var links = doc.getElementsByTagName("link"); + var icons = []; + + for (var i = 0; i < links.length; i++) { + var link = links[i]; + var rel = link.getAttribute("rel"); + + if (rel) { + if (rel.toLowerCase().indexOf("icon") > -1) { + var href = link.getAttribute("href"); + + if (href) { + if (href.toLowerCase().indexOf("https:") === -1 && href.toLowerCase().indexOf("http:") === -1 && href.indexOf("//") !== 0) { + var absoluteHref = loc.protocol + "//" + loc.host; + + if (href.indexOf("/") === 0) { + absoluteHref += href; + } else { + var path = loc.pathname.split("/"); + path.pop(); + var finalPath = path.join("/"); + absoluteHref += finalPath + "/" + href; + } + + icons.push(absoluteHref); + } else if (href.indexOf("//") === 0) { + var absoluteUrl = loc.protocol + href; + icons.push(absoluteUrl); + } else { + icons.push(href); + } + } + } + } + } + + return icons; + } + + function getWindowMetadataOfAny() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var metaTags = doc.getElementsByTagName("meta"); + + var _loop = function _loop(i) { + var tag = metaTags[i]; + var attributes = ["itemprop", "property", "name"].map(function (target) { + return tag.getAttribute(target); + }).filter(function (attr) { + if (attr) { + return args.includes(attr); + } + + return false; + }); + + if (attributes.length && attributes) { + var content = tag.getAttribute("content"); + + if (content) { + return { + v: content + }; + } + } + }; + + for (var i = 0; i < metaTags.length; i++) { + var _ret = _loop(i); + + if (_typeof(_ret) === "object") return _ret.v; + } + + return ""; + } + + function getName() { + var name = getWindowMetadataOfAny("name", "og:site_name", "og:title", "twitter:title"); + + if (!name) { + name = doc.title; + } + + return name; + } + + function getDescription() { + var description = getWindowMetadataOfAny("description", "og:description", "twitter:description", "keywords"); + return description; + } + + var name = getName(); + var description = getDescription(); + var url = loc.origin; + var icons = getIcons(); + var meta = { + description: description, + url: url, + icons: icons, + name: name + }; + return meta; +} + +exports.getWindowMetadata = getWindowMetadata; + +/***/ }), + +/***/ "./node_modules/aes-js/index.js": +/*!**************************************!*\ + !*** ./node_modules/aes-js/index.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +(function (root) { + function checkInt(value) { + return parseInt(value) === value; + } + + function checkInts(arrayish) { + if (!checkInt(arrayish.length)) { + return false; + } + + for (var i = 0; i < arrayish.length; i++) { + if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) { + return false; + } + } + + return true; + } + + function coerceArray(arg, copy) { + // ArrayBuffer view + if (arg.buffer && ArrayBuffer.isView(arg) && arg.name === 'Uint8Array') { + if (copy) { + if (arg.slice) { + arg = arg.slice(); + } else { + arg = Array.prototype.slice.call(arg); + } + } + + return arg; + } // It's an array; check it is a valid representation of a byte + + + if (Array.isArray(arg)) { + if (!checkInts(arg)) { + throw new Error('Array contains invalid value: ' + arg); + } + + return new Uint8Array(arg); + } // Something else, but behaves like an array (maybe a Buffer? Arguments?) + + + if (checkInt(arg.length) && checkInts(arg)) { + return new Uint8Array(arg); + } + + throw new Error('unsupported array-like object'); + } + + function createArray(length) { + return new Uint8Array(length); + } + + function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) { + if (sourceStart != null || sourceEnd != null) { + if (sourceArray.slice) { + sourceArray = sourceArray.slice(sourceStart, sourceEnd); + } else { + sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd); + } + } + + targetArray.set(sourceArray, targetStart); + } + + var convertUtf8 = function () { + function toBytes(text) { + var result = [], + i = 0; + text = encodeURI(text); + + while (i < text.length) { + var c = text.charCodeAt(i++); // if it is a % sign, encode the following 2 bytes as a hex value + + if (c === 37) { + result.push(parseInt(text.substr(i, 2), 16)); + i += 2; // otherwise, just the actual byte + } else { + result.push(c); + } + } + + return coerceArray(result); + } + + function fromBytes(bytes) { + var result = [], + i = 0; + + while (i < bytes.length) { + var c = bytes[i]; + + if (c < 128) { + result.push(String.fromCharCode(c)); + i++; + } else if (c > 191 && c < 224) { + result.push(String.fromCharCode((c & 0x1f) << 6 | bytes[i + 1] & 0x3f)); + i += 2; + } else { + result.push(String.fromCharCode((c & 0x0f) << 12 | (bytes[i + 1] & 0x3f) << 6 | bytes[i + 2] & 0x3f)); + i += 3; + } + } + + return result.join(''); + } + + return { + toBytes: toBytes, + fromBytes: fromBytes + }; + }(); + + var convertHex = function () { + function toBytes(text) { + var result = []; + + for (var i = 0; i < text.length; i += 2) { + result.push(parseInt(text.substr(i, 2), 16)); + } + + return result; + } // http://ixti.net/development/javascript/2011/11/11/base64-encodedecode-of-utf8-in-browser-with-js.html + + + var Hex = '0123456789abcdef'; + + function fromBytes(bytes) { + var result = []; + + for (var i = 0; i < bytes.length; i++) { + var v = bytes[i]; + result.push(Hex[(v & 0xf0) >> 4] + Hex[v & 0x0f]); + } + + return result.join(''); + } + + return { + toBytes: toBytes, + fromBytes: fromBytes + }; + }(); // Number of rounds by keysize + + + var numberOfRounds = { + 16: 10, + 24: 12, + 32: 14 + }; // Round constant words + + var rcon = [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91]; // S-box and Inverse S-box (S is for Substitution) + + var S = [0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]; + var Si = [0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]; // Transformations for encryption + + var T1 = [0xc66363a5, 0xf87c7c84, 0xee777799, 0xf67b7b8d, 0xfff2f20d, 0xd66b6bbd, 0xde6f6fb1, 0x91c5c554, 0x60303050, 0x02010103, 0xce6767a9, 0x562b2b7d, 0xe7fefe19, 0xb5d7d762, 0x4dababe6, 0xec76769a, 0x8fcaca45, 0x1f82829d, 0x89c9c940, 0xfa7d7d87, 0xeffafa15, 0xb25959eb, 0x8e4747c9, 0xfbf0f00b, 0x41adadec, 0xb3d4d467, 0x5fa2a2fd, 0x45afafea, 0x239c9cbf, 0x53a4a4f7, 0xe4727296, 0x9bc0c05b, 0x75b7b7c2, 0xe1fdfd1c, 0x3d9393ae, 0x4c26266a, 0x6c36365a, 0x7e3f3f41, 0xf5f7f702, 0x83cccc4f, 0x6834345c, 0x51a5a5f4, 0xd1e5e534, 0xf9f1f108, 0xe2717193, 0xabd8d873, 0x62313153, 0x2a15153f, 0x0804040c, 0x95c7c752, 0x46232365, 0x9dc3c35e, 0x30181828, 0x379696a1, 0x0a05050f, 0x2f9a9ab5, 0x0e070709, 0x24121236, 0x1b80809b, 0xdfe2e23d, 0xcdebeb26, 0x4e272769, 0x7fb2b2cd, 0xea75759f, 0x1209091b, 0x1d83839e, 0x582c2c74, 0x341a1a2e, 0x361b1b2d, 0xdc6e6eb2, 0xb45a5aee, 0x5ba0a0fb, 0xa45252f6, 0x763b3b4d, 0xb7d6d661, 0x7db3b3ce, 0x5229297b, 0xdde3e33e, 0x5e2f2f71, 0x13848497, 0xa65353f5, 0xb9d1d168, 0x00000000, 0xc1eded2c, 0x40202060, 0xe3fcfc1f, 0x79b1b1c8, 0xb65b5bed, 0xd46a6abe, 0x8dcbcb46, 0x67bebed9, 0x7239394b, 0x944a4ade, 0x984c4cd4, 0xb05858e8, 0x85cfcf4a, 0xbbd0d06b, 0xc5efef2a, 0x4faaaae5, 0xedfbfb16, 0x864343c5, 0x9a4d4dd7, 0x66333355, 0x11858594, 0x8a4545cf, 0xe9f9f910, 0x04020206, 0xfe7f7f81, 0xa05050f0, 0x783c3c44, 0x259f9fba, 0x4ba8a8e3, 0xa25151f3, 0x5da3a3fe, 0x804040c0, 0x058f8f8a, 0x3f9292ad, 0x219d9dbc, 0x70383848, 0xf1f5f504, 0x63bcbcdf, 0x77b6b6c1, 0xafdada75, 0x42212163, 0x20101030, 0xe5ffff1a, 0xfdf3f30e, 0xbfd2d26d, 0x81cdcd4c, 0x180c0c14, 0x26131335, 0xc3ecec2f, 0xbe5f5fe1, 0x359797a2, 0x884444cc, 0x2e171739, 0x93c4c457, 0x55a7a7f2, 0xfc7e7e82, 0x7a3d3d47, 0xc86464ac, 0xba5d5de7, 0x3219192b, 0xe6737395, 0xc06060a0, 0x19818198, 0x9e4f4fd1, 0xa3dcdc7f, 0x44222266, 0x542a2a7e, 0x3b9090ab, 0x0b888883, 0x8c4646ca, 0xc7eeee29, 0x6bb8b8d3, 0x2814143c, 0xa7dede79, 0xbc5e5ee2, 0x160b0b1d, 0xaddbdb76, 0xdbe0e03b, 0x64323256, 0x743a3a4e, 0x140a0a1e, 0x924949db, 0x0c06060a, 0x4824246c, 0xb85c5ce4, 0x9fc2c25d, 0xbdd3d36e, 0x43acacef, 0xc46262a6, 0x399191a8, 0x319595a4, 0xd3e4e437, 0xf279798b, 0xd5e7e732, 0x8bc8c843, 0x6e373759, 0xda6d6db7, 0x018d8d8c, 0xb1d5d564, 0x9c4e4ed2, 0x49a9a9e0, 0xd86c6cb4, 0xac5656fa, 0xf3f4f407, 0xcfeaea25, 0xca6565af, 0xf47a7a8e, 0x47aeaee9, 0x10080818, 0x6fbabad5, 0xf0787888, 0x4a25256f, 0x5c2e2e72, 0x381c1c24, 0x57a6a6f1, 0x73b4b4c7, 0x97c6c651, 0xcbe8e823, 0xa1dddd7c, 0xe874749c, 0x3e1f1f21, 0x964b4bdd, 0x61bdbddc, 0x0d8b8b86, 0x0f8a8a85, 0xe0707090, 0x7c3e3e42, 0x71b5b5c4, 0xcc6666aa, 0x904848d8, 0x06030305, 0xf7f6f601, 0x1c0e0e12, 0xc26161a3, 0x6a35355f, 0xae5757f9, 0x69b9b9d0, 0x17868691, 0x99c1c158, 0x3a1d1d27, 0x279e9eb9, 0xd9e1e138, 0xebf8f813, 0x2b9898b3, 0x22111133, 0xd26969bb, 0xa9d9d970, 0x078e8e89, 0x339494a7, 0x2d9b9bb6, 0x3c1e1e22, 0x15878792, 0xc9e9e920, 0x87cece49, 0xaa5555ff, 0x50282878, 0xa5dfdf7a, 0x038c8c8f, 0x59a1a1f8, 0x09898980, 0x1a0d0d17, 0x65bfbfda, 0xd7e6e631, 0x844242c6, 0xd06868b8, 0x824141c3, 0x299999b0, 0x5a2d2d77, 0x1e0f0f11, 0x7bb0b0cb, 0xa85454fc, 0x6dbbbbd6, 0x2c16163a]; + var T2 = [0xa5c66363, 0x84f87c7c, 0x99ee7777, 0x8df67b7b, 0x0dfff2f2, 0xbdd66b6b, 0xb1de6f6f, 0x5491c5c5, 0x50603030, 0x03020101, 0xa9ce6767, 0x7d562b2b, 0x19e7fefe, 0x62b5d7d7, 0xe64dabab, 0x9aec7676, 0x458fcaca, 0x9d1f8282, 0x4089c9c9, 0x87fa7d7d, 0x15effafa, 0xebb25959, 0xc98e4747, 0x0bfbf0f0, 0xec41adad, 0x67b3d4d4, 0xfd5fa2a2, 0xea45afaf, 0xbf239c9c, 0xf753a4a4, 0x96e47272, 0x5b9bc0c0, 0xc275b7b7, 0x1ce1fdfd, 0xae3d9393, 0x6a4c2626, 0x5a6c3636, 0x417e3f3f, 0x02f5f7f7, 0x4f83cccc, 0x5c683434, 0xf451a5a5, 0x34d1e5e5, 0x08f9f1f1, 0x93e27171, 0x73abd8d8, 0x53623131, 0x3f2a1515, 0x0c080404, 0x5295c7c7, 0x65462323, 0x5e9dc3c3, 0x28301818, 0xa1379696, 0x0f0a0505, 0xb52f9a9a, 0x090e0707, 0x36241212, 0x9b1b8080, 0x3ddfe2e2, 0x26cdebeb, 0x694e2727, 0xcd7fb2b2, 0x9fea7575, 0x1b120909, 0x9e1d8383, 0x74582c2c, 0x2e341a1a, 0x2d361b1b, 0xb2dc6e6e, 0xeeb45a5a, 0xfb5ba0a0, 0xf6a45252, 0x4d763b3b, 0x61b7d6d6, 0xce7db3b3, 0x7b522929, 0x3edde3e3, 0x715e2f2f, 0x97138484, 0xf5a65353, 0x68b9d1d1, 0x00000000, 0x2cc1eded, 0x60402020, 0x1fe3fcfc, 0xc879b1b1, 0xedb65b5b, 0xbed46a6a, 0x468dcbcb, 0xd967bebe, 0x4b723939, 0xde944a4a, 0xd4984c4c, 0xe8b05858, 0x4a85cfcf, 0x6bbbd0d0, 0x2ac5efef, 0xe54faaaa, 0x16edfbfb, 0xc5864343, 0xd79a4d4d, 0x55663333, 0x94118585, 0xcf8a4545, 0x10e9f9f9, 0x06040202, 0x81fe7f7f, 0xf0a05050, 0x44783c3c, 0xba259f9f, 0xe34ba8a8, 0xf3a25151, 0xfe5da3a3, 0xc0804040, 0x8a058f8f, 0xad3f9292, 0xbc219d9d, 0x48703838, 0x04f1f5f5, 0xdf63bcbc, 0xc177b6b6, 0x75afdada, 0x63422121, 0x30201010, 0x1ae5ffff, 0x0efdf3f3, 0x6dbfd2d2, 0x4c81cdcd, 0x14180c0c, 0x35261313, 0x2fc3ecec, 0xe1be5f5f, 0xa2359797, 0xcc884444, 0x392e1717, 0x5793c4c4, 0xf255a7a7, 0x82fc7e7e, 0x477a3d3d, 0xacc86464, 0xe7ba5d5d, 0x2b321919, 0x95e67373, 0xa0c06060, 0x98198181, 0xd19e4f4f, 0x7fa3dcdc, 0x66442222, 0x7e542a2a, 0xab3b9090, 0x830b8888, 0xca8c4646, 0x29c7eeee, 0xd36bb8b8, 0x3c281414, 0x79a7dede, 0xe2bc5e5e, 0x1d160b0b, 0x76addbdb, 0x3bdbe0e0, 0x56643232, 0x4e743a3a, 0x1e140a0a, 0xdb924949, 0x0a0c0606, 0x6c482424, 0xe4b85c5c, 0x5d9fc2c2, 0x6ebdd3d3, 0xef43acac, 0xa6c46262, 0xa8399191, 0xa4319595, 0x37d3e4e4, 0x8bf27979, 0x32d5e7e7, 0x438bc8c8, 0x596e3737, 0xb7da6d6d, 0x8c018d8d, 0x64b1d5d5, 0xd29c4e4e, 0xe049a9a9, 0xb4d86c6c, 0xfaac5656, 0x07f3f4f4, 0x25cfeaea, 0xafca6565, 0x8ef47a7a, 0xe947aeae, 0x18100808, 0xd56fbaba, 0x88f07878, 0x6f4a2525, 0x725c2e2e, 0x24381c1c, 0xf157a6a6, 0xc773b4b4, 0x5197c6c6, 0x23cbe8e8, 0x7ca1dddd, 0x9ce87474, 0x213e1f1f, 0xdd964b4b, 0xdc61bdbd, 0x860d8b8b, 0x850f8a8a, 0x90e07070, 0x427c3e3e, 0xc471b5b5, 0xaacc6666, 0xd8904848, 0x05060303, 0x01f7f6f6, 0x121c0e0e, 0xa3c26161, 0x5f6a3535, 0xf9ae5757, 0xd069b9b9, 0x91178686, 0x5899c1c1, 0x273a1d1d, 0xb9279e9e, 0x38d9e1e1, 0x13ebf8f8, 0xb32b9898, 0x33221111, 0xbbd26969, 0x70a9d9d9, 0x89078e8e, 0xa7339494, 0xb62d9b9b, 0x223c1e1e, 0x92158787, 0x20c9e9e9, 0x4987cece, 0xffaa5555, 0x78502828, 0x7aa5dfdf, 0x8f038c8c, 0xf859a1a1, 0x80098989, 0x171a0d0d, 0xda65bfbf, 0x31d7e6e6, 0xc6844242, 0xb8d06868, 0xc3824141, 0xb0299999, 0x775a2d2d, 0x111e0f0f, 0xcb7bb0b0, 0xfca85454, 0xd66dbbbb, 0x3a2c1616]; + var T3 = [0x63a5c663, 0x7c84f87c, 0x7799ee77, 0x7b8df67b, 0xf20dfff2, 0x6bbdd66b, 0x6fb1de6f, 0xc55491c5, 0x30506030, 0x01030201, 0x67a9ce67, 0x2b7d562b, 0xfe19e7fe, 0xd762b5d7, 0xabe64dab, 0x769aec76, 0xca458fca, 0x829d1f82, 0xc94089c9, 0x7d87fa7d, 0xfa15effa, 0x59ebb259, 0x47c98e47, 0xf00bfbf0, 0xadec41ad, 0xd467b3d4, 0xa2fd5fa2, 0xafea45af, 0x9cbf239c, 0xa4f753a4, 0x7296e472, 0xc05b9bc0, 0xb7c275b7, 0xfd1ce1fd, 0x93ae3d93, 0x266a4c26, 0x365a6c36, 0x3f417e3f, 0xf702f5f7, 0xcc4f83cc, 0x345c6834, 0xa5f451a5, 0xe534d1e5, 0xf108f9f1, 0x7193e271, 0xd873abd8, 0x31536231, 0x153f2a15, 0x040c0804, 0xc75295c7, 0x23654623, 0xc35e9dc3, 0x18283018, 0x96a13796, 0x050f0a05, 0x9ab52f9a, 0x07090e07, 0x12362412, 0x809b1b80, 0xe23ddfe2, 0xeb26cdeb, 0x27694e27, 0xb2cd7fb2, 0x759fea75, 0x091b1209, 0x839e1d83, 0x2c74582c, 0x1a2e341a, 0x1b2d361b, 0x6eb2dc6e, 0x5aeeb45a, 0xa0fb5ba0, 0x52f6a452, 0x3b4d763b, 0xd661b7d6, 0xb3ce7db3, 0x297b5229, 0xe33edde3, 0x2f715e2f, 0x84971384, 0x53f5a653, 0xd168b9d1, 0x00000000, 0xed2cc1ed, 0x20604020, 0xfc1fe3fc, 0xb1c879b1, 0x5bedb65b, 0x6abed46a, 0xcb468dcb, 0xbed967be, 0x394b7239, 0x4ade944a, 0x4cd4984c, 0x58e8b058, 0xcf4a85cf, 0xd06bbbd0, 0xef2ac5ef, 0xaae54faa, 0xfb16edfb, 0x43c58643, 0x4dd79a4d, 0x33556633, 0x85941185, 0x45cf8a45, 0xf910e9f9, 0x02060402, 0x7f81fe7f, 0x50f0a050, 0x3c44783c, 0x9fba259f, 0xa8e34ba8, 0x51f3a251, 0xa3fe5da3, 0x40c08040, 0x8f8a058f, 0x92ad3f92, 0x9dbc219d, 0x38487038, 0xf504f1f5, 0xbcdf63bc, 0xb6c177b6, 0xda75afda, 0x21634221, 0x10302010, 0xff1ae5ff, 0xf30efdf3, 0xd26dbfd2, 0xcd4c81cd, 0x0c14180c, 0x13352613, 0xec2fc3ec, 0x5fe1be5f, 0x97a23597, 0x44cc8844, 0x17392e17, 0xc45793c4, 0xa7f255a7, 0x7e82fc7e, 0x3d477a3d, 0x64acc864, 0x5de7ba5d, 0x192b3219, 0x7395e673, 0x60a0c060, 0x81981981, 0x4fd19e4f, 0xdc7fa3dc, 0x22664422, 0x2a7e542a, 0x90ab3b90, 0x88830b88, 0x46ca8c46, 0xee29c7ee, 0xb8d36bb8, 0x143c2814, 0xde79a7de, 0x5ee2bc5e, 0x0b1d160b, 0xdb76addb, 0xe03bdbe0, 0x32566432, 0x3a4e743a, 0x0a1e140a, 0x49db9249, 0x060a0c06, 0x246c4824, 0x5ce4b85c, 0xc25d9fc2, 0xd36ebdd3, 0xacef43ac, 0x62a6c462, 0x91a83991, 0x95a43195, 0xe437d3e4, 0x798bf279, 0xe732d5e7, 0xc8438bc8, 0x37596e37, 0x6db7da6d, 0x8d8c018d, 0xd564b1d5, 0x4ed29c4e, 0xa9e049a9, 0x6cb4d86c, 0x56faac56, 0xf407f3f4, 0xea25cfea, 0x65afca65, 0x7a8ef47a, 0xaee947ae, 0x08181008, 0xbad56fba, 0x7888f078, 0x256f4a25, 0x2e725c2e, 0x1c24381c, 0xa6f157a6, 0xb4c773b4, 0xc65197c6, 0xe823cbe8, 0xdd7ca1dd, 0x749ce874, 0x1f213e1f, 0x4bdd964b, 0xbddc61bd, 0x8b860d8b, 0x8a850f8a, 0x7090e070, 0x3e427c3e, 0xb5c471b5, 0x66aacc66, 0x48d89048, 0x03050603, 0xf601f7f6, 0x0e121c0e, 0x61a3c261, 0x355f6a35, 0x57f9ae57, 0xb9d069b9, 0x86911786, 0xc15899c1, 0x1d273a1d, 0x9eb9279e, 0xe138d9e1, 0xf813ebf8, 0x98b32b98, 0x11332211, 0x69bbd269, 0xd970a9d9, 0x8e89078e, 0x94a73394, 0x9bb62d9b, 0x1e223c1e, 0x87921587, 0xe920c9e9, 0xce4987ce, 0x55ffaa55, 0x28785028, 0xdf7aa5df, 0x8c8f038c, 0xa1f859a1, 0x89800989, 0x0d171a0d, 0xbfda65bf, 0xe631d7e6, 0x42c68442, 0x68b8d068, 0x41c38241, 0x99b02999, 0x2d775a2d, 0x0f111e0f, 0xb0cb7bb0, 0x54fca854, 0xbbd66dbb, 0x163a2c16]; + var T4 = [0x6363a5c6, 0x7c7c84f8, 0x777799ee, 0x7b7b8df6, 0xf2f20dff, 0x6b6bbdd6, 0x6f6fb1de, 0xc5c55491, 0x30305060, 0x01010302, 0x6767a9ce, 0x2b2b7d56, 0xfefe19e7, 0xd7d762b5, 0xababe64d, 0x76769aec, 0xcaca458f, 0x82829d1f, 0xc9c94089, 0x7d7d87fa, 0xfafa15ef, 0x5959ebb2, 0x4747c98e, 0xf0f00bfb, 0xadadec41, 0xd4d467b3, 0xa2a2fd5f, 0xafafea45, 0x9c9cbf23, 0xa4a4f753, 0x727296e4, 0xc0c05b9b, 0xb7b7c275, 0xfdfd1ce1, 0x9393ae3d, 0x26266a4c, 0x36365a6c, 0x3f3f417e, 0xf7f702f5, 0xcccc4f83, 0x34345c68, 0xa5a5f451, 0xe5e534d1, 0xf1f108f9, 0x717193e2, 0xd8d873ab, 0x31315362, 0x15153f2a, 0x04040c08, 0xc7c75295, 0x23236546, 0xc3c35e9d, 0x18182830, 0x9696a137, 0x05050f0a, 0x9a9ab52f, 0x0707090e, 0x12123624, 0x80809b1b, 0xe2e23ddf, 0xebeb26cd, 0x2727694e, 0xb2b2cd7f, 0x75759fea, 0x09091b12, 0x83839e1d, 0x2c2c7458, 0x1a1a2e34, 0x1b1b2d36, 0x6e6eb2dc, 0x5a5aeeb4, 0xa0a0fb5b, 0x5252f6a4, 0x3b3b4d76, 0xd6d661b7, 0xb3b3ce7d, 0x29297b52, 0xe3e33edd, 0x2f2f715e, 0x84849713, 0x5353f5a6, 0xd1d168b9, 0x00000000, 0xeded2cc1, 0x20206040, 0xfcfc1fe3, 0xb1b1c879, 0x5b5bedb6, 0x6a6abed4, 0xcbcb468d, 0xbebed967, 0x39394b72, 0x4a4ade94, 0x4c4cd498, 0x5858e8b0, 0xcfcf4a85, 0xd0d06bbb, 0xefef2ac5, 0xaaaae54f, 0xfbfb16ed, 0x4343c586, 0x4d4dd79a, 0x33335566, 0x85859411, 0x4545cf8a, 0xf9f910e9, 0x02020604, 0x7f7f81fe, 0x5050f0a0, 0x3c3c4478, 0x9f9fba25, 0xa8a8e34b, 0x5151f3a2, 0xa3a3fe5d, 0x4040c080, 0x8f8f8a05, 0x9292ad3f, 0x9d9dbc21, 0x38384870, 0xf5f504f1, 0xbcbcdf63, 0xb6b6c177, 0xdada75af, 0x21216342, 0x10103020, 0xffff1ae5, 0xf3f30efd, 0xd2d26dbf, 0xcdcd4c81, 0x0c0c1418, 0x13133526, 0xecec2fc3, 0x5f5fe1be, 0x9797a235, 0x4444cc88, 0x1717392e, 0xc4c45793, 0xa7a7f255, 0x7e7e82fc, 0x3d3d477a, 0x6464acc8, 0x5d5de7ba, 0x19192b32, 0x737395e6, 0x6060a0c0, 0x81819819, 0x4f4fd19e, 0xdcdc7fa3, 0x22226644, 0x2a2a7e54, 0x9090ab3b, 0x8888830b, 0x4646ca8c, 0xeeee29c7, 0xb8b8d36b, 0x14143c28, 0xdede79a7, 0x5e5ee2bc, 0x0b0b1d16, 0xdbdb76ad, 0xe0e03bdb, 0x32325664, 0x3a3a4e74, 0x0a0a1e14, 0x4949db92, 0x06060a0c, 0x24246c48, 0x5c5ce4b8, 0xc2c25d9f, 0xd3d36ebd, 0xacacef43, 0x6262a6c4, 0x9191a839, 0x9595a431, 0xe4e437d3, 0x79798bf2, 0xe7e732d5, 0xc8c8438b, 0x3737596e, 0x6d6db7da, 0x8d8d8c01, 0xd5d564b1, 0x4e4ed29c, 0xa9a9e049, 0x6c6cb4d8, 0x5656faac, 0xf4f407f3, 0xeaea25cf, 0x6565afca, 0x7a7a8ef4, 0xaeaee947, 0x08081810, 0xbabad56f, 0x787888f0, 0x25256f4a, 0x2e2e725c, 0x1c1c2438, 0xa6a6f157, 0xb4b4c773, 0xc6c65197, 0xe8e823cb, 0xdddd7ca1, 0x74749ce8, 0x1f1f213e, 0x4b4bdd96, 0xbdbddc61, 0x8b8b860d, 0x8a8a850f, 0x707090e0, 0x3e3e427c, 0xb5b5c471, 0x6666aacc, 0x4848d890, 0x03030506, 0xf6f601f7, 0x0e0e121c, 0x6161a3c2, 0x35355f6a, 0x5757f9ae, 0xb9b9d069, 0x86869117, 0xc1c15899, 0x1d1d273a, 0x9e9eb927, 0xe1e138d9, 0xf8f813eb, 0x9898b32b, 0x11113322, 0x6969bbd2, 0xd9d970a9, 0x8e8e8907, 0x9494a733, 0x9b9bb62d, 0x1e1e223c, 0x87879215, 0xe9e920c9, 0xcece4987, 0x5555ffaa, 0x28287850, 0xdfdf7aa5, 0x8c8c8f03, 0xa1a1f859, 0x89898009, 0x0d0d171a, 0xbfbfda65, 0xe6e631d7, 0x4242c684, 0x6868b8d0, 0x4141c382, 0x9999b029, 0x2d2d775a, 0x0f0f111e, 0xb0b0cb7b, 0x5454fca8, 0xbbbbd66d, 0x16163a2c]; // Transformations for decryption + + var T5 = [0x51f4a750, 0x7e416553, 0x1a17a4c3, 0x3a275e96, 0x3bab6bcb, 0x1f9d45f1, 0xacfa58ab, 0x4be30393, 0x2030fa55, 0xad766df6, 0x88cc7691, 0xf5024c25, 0x4fe5d7fc, 0xc52acbd7, 0x26354480, 0xb562a38f, 0xdeb15a49, 0x25ba1b67, 0x45ea0e98, 0x5dfec0e1, 0xc32f7502, 0x814cf012, 0x8d4697a3, 0x6bd3f9c6, 0x038f5fe7, 0x15929c95, 0xbf6d7aeb, 0x955259da, 0xd4be832d, 0x587421d3, 0x49e06929, 0x8ec9c844, 0x75c2896a, 0xf48e7978, 0x99583e6b, 0x27b971dd, 0xbee14fb6, 0xf088ad17, 0xc920ac66, 0x7dce3ab4, 0x63df4a18, 0xe51a3182, 0x97513360, 0x62537f45, 0xb16477e0, 0xbb6bae84, 0xfe81a01c, 0xf9082b94, 0x70486858, 0x8f45fd19, 0x94de6c87, 0x527bf8b7, 0xab73d323, 0x724b02e2, 0xe31f8f57, 0x6655ab2a, 0xb2eb2807, 0x2fb5c203, 0x86c57b9a, 0xd33708a5, 0x302887f2, 0x23bfa5b2, 0x02036aba, 0xed16825c, 0x8acf1c2b, 0xa779b492, 0xf307f2f0, 0x4e69e2a1, 0x65daf4cd, 0x0605bed5, 0xd134621f, 0xc4a6fe8a, 0x342e539d, 0xa2f355a0, 0x058ae132, 0xa4f6eb75, 0x0b83ec39, 0x4060efaa, 0x5e719f06, 0xbd6e1051, 0x3e218af9, 0x96dd063d, 0xdd3e05ae, 0x4de6bd46, 0x91548db5, 0x71c45d05, 0x0406d46f, 0x605015ff, 0x1998fb24, 0xd6bde997, 0x894043cc, 0x67d99e77, 0xb0e842bd, 0x07898b88, 0xe7195b38, 0x79c8eedb, 0xa17c0a47, 0x7c420fe9, 0xf8841ec9, 0x00000000, 0x09808683, 0x322bed48, 0x1e1170ac, 0x6c5a724e, 0xfd0efffb, 0x0f853856, 0x3daed51e, 0x362d3927, 0x0a0fd964, 0x685ca621, 0x9b5b54d1, 0x24362e3a, 0x0c0a67b1, 0x9357e70f, 0xb4ee96d2, 0x1b9b919e, 0x80c0c54f, 0x61dc20a2, 0x5a774b69, 0x1c121a16, 0xe293ba0a, 0xc0a02ae5, 0x3c22e043, 0x121b171d, 0x0e090d0b, 0xf28bc7ad, 0x2db6a8b9, 0x141ea9c8, 0x57f11985, 0xaf75074c, 0xee99ddbb, 0xa37f60fd, 0xf701269f, 0x5c72f5bc, 0x44663bc5, 0x5bfb7e34, 0x8b432976, 0xcb23c6dc, 0xb6edfc68, 0xb8e4f163, 0xd731dcca, 0x42638510, 0x13972240, 0x84c61120, 0x854a247d, 0xd2bb3df8, 0xaef93211, 0xc729a16d, 0x1d9e2f4b, 0xdcb230f3, 0x0d8652ec, 0x77c1e3d0, 0x2bb3166c, 0xa970b999, 0x119448fa, 0x47e96422, 0xa8fc8cc4, 0xa0f03f1a, 0x567d2cd8, 0x223390ef, 0x87494ec7, 0xd938d1c1, 0x8ccaa2fe, 0x98d40b36, 0xa6f581cf, 0xa57ade28, 0xdab78e26, 0x3fadbfa4, 0x2c3a9de4, 0x5078920d, 0x6a5fcc9b, 0x547e4662, 0xf68d13c2, 0x90d8b8e8, 0x2e39f75e, 0x82c3aff5, 0x9f5d80be, 0x69d0937c, 0x6fd52da9, 0xcf2512b3, 0xc8ac993b, 0x10187da7, 0xe89c636e, 0xdb3bbb7b, 0xcd267809, 0x6e5918f4, 0xec9ab701, 0x834f9aa8, 0xe6956e65, 0xaaffe67e, 0x21bccf08, 0xef15e8e6, 0xbae79bd9, 0x4a6f36ce, 0xea9f09d4, 0x29b07cd6, 0x31a4b2af, 0x2a3f2331, 0xc6a59430, 0x35a266c0, 0x744ebc37, 0xfc82caa6, 0xe090d0b0, 0x33a7d815, 0xf104984a, 0x41ecdaf7, 0x7fcd500e, 0x1791f62f, 0x764dd68d, 0x43efb04d, 0xccaa4d54, 0xe49604df, 0x9ed1b5e3, 0x4c6a881b, 0xc12c1fb8, 0x4665517f, 0x9d5eea04, 0x018c355d, 0xfa877473, 0xfb0b412e, 0xb3671d5a, 0x92dbd252, 0xe9105633, 0x6dd64713, 0x9ad7618c, 0x37a10c7a, 0x59f8148e, 0xeb133c89, 0xcea927ee, 0xb761c935, 0xe11ce5ed, 0x7a47b13c, 0x9cd2df59, 0x55f2733f, 0x1814ce79, 0x73c737bf, 0x53f7cdea, 0x5ffdaa5b, 0xdf3d6f14, 0x7844db86, 0xcaaff381, 0xb968c43e, 0x3824342c, 0xc2a3405f, 0x161dc372, 0xbce2250c, 0x283c498b, 0xff0d9541, 0x39a80171, 0x080cb3de, 0xd8b4e49c, 0x6456c190, 0x7bcb8461, 0xd532b670, 0x486c5c74, 0xd0b85742]; + var T6 = [0x5051f4a7, 0x537e4165, 0xc31a17a4, 0x963a275e, 0xcb3bab6b, 0xf11f9d45, 0xabacfa58, 0x934be303, 0x552030fa, 0xf6ad766d, 0x9188cc76, 0x25f5024c, 0xfc4fe5d7, 0xd7c52acb, 0x80263544, 0x8fb562a3, 0x49deb15a, 0x6725ba1b, 0x9845ea0e, 0xe15dfec0, 0x02c32f75, 0x12814cf0, 0xa38d4697, 0xc66bd3f9, 0xe7038f5f, 0x9515929c, 0xebbf6d7a, 0xda955259, 0x2dd4be83, 0xd3587421, 0x2949e069, 0x448ec9c8, 0x6a75c289, 0x78f48e79, 0x6b99583e, 0xdd27b971, 0xb6bee14f, 0x17f088ad, 0x66c920ac, 0xb47dce3a, 0x1863df4a, 0x82e51a31, 0x60975133, 0x4562537f, 0xe0b16477, 0x84bb6bae, 0x1cfe81a0, 0x94f9082b, 0x58704868, 0x198f45fd, 0x8794de6c, 0xb7527bf8, 0x23ab73d3, 0xe2724b02, 0x57e31f8f, 0x2a6655ab, 0x07b2eb28, 0x032fb5c2, 0x9a86c57b, 0xa5d33708, 0xf2302887, 0xb223bfa5, 0xba02036a, 0x5ced1682, 0x2b8acf1c, 0x92a779b4, 0xf0f307f2, 0xa14e69e2, 0xcd65daf4, 0xd50605be, 0x1fd13462, 0x8ac4a6fe, 0x9d342e53, 0xa0a2f355, 0x32058ae1, 0x75a4f6eb, 0x390b83ec, 0xaa4060ef, 0x065e719f, 0x51bd6e10, 0xf93e218a, 0x3d96dd06, 0xaedd3e05, 0x464de6bd, 0xb591548d, 0x0571c45d, 0x6f0406d4, 0xff605015, 0x241998fb, 0x97d6bde9, 0xcc894043, 0x7767d99e, 0xbdb0e842, 0x8807898b, 0x38e7195b, 0xdb79c8ee, 0x47a17c0a, 0xe97c420f, 0xc9f8841e, 0x00000000, 0x83098086, 0x48322bed, 0xac1e1170, 0x4e6c5a72, 0xfbfd0eff, 0x560f8538, 0x1e3daed5, 0x27362d39, 0x640a0fd9, 0x21685ca6, 0xd19b5b54, 0x3a24362e, 0xb10c0a67, 0x0f9357e7, 0xd2b4ee96, 0x9e1b9b91, 0x4f80c0c5, 0xa261dc20, 0x695a774b, 0x161c121a, 0x0ae293ba, 0xe5c0a02a, 0x433c22e0, 0x1d121b17, 0x0b0e090d, 0xadf28bc7, 0xb92db6a8, 0xc8141ea9, 0x8557f119, 0x4caf7507, 0xbbee99dd, 0xfda37f60, 0x9ff70126, 0xbc5c72f5, 0xc544663b, 0x345bfb7e, 0x768b4329, 0xdccb23c6, 0x68b6edfc, 0x63b8e4f1, 0xcad731dc, 0x10426385, 0x40139722, 0x2084c611, 0x7d854a24, 0xf8d2bb3d, 0x11aef932, 0x6dc729a1, 0x4b1d9e2f, 0xf3dcb230, 0xec0d8652, 0xd077c1e3, 0x6c2bb316, 0x99a970b9, 0xfa119448, 0x2247e964, 0xc4a8fc8c, 0x1aa0f03f, 0xd8567d2c, 0xef223390, 0xc787494e, 0xc1d938d1, 0xfe8ccaa2, 0x3698d40b, 0xcfa6f581, 0x28a57ade, 0x26dab78e, 0xa43fadbf, 0xe42c3a9d, 0x0d507892, 0x9b6a5fcc, 0x62547e46, 0xc2f68d13, 0xe890d8b8, 0x5e2e39f7, 0xf582c3af, 0xbe9f5d80, 0x7c69d093, 0xa96fd52d, 0xb3cf2512, 0x3bc8ac99, 0xa710187d, 0x6ee89c63, 0x7bdb3bbb, 0x09cd2678, 0xf46e5918, 0x01ec9ab7, 0xa8834f9a, 0x65e6956e, 0x7eaaffe6, 0x0821bccf, 0xe6ef15e8, 0xd9bae79b, 0xce4a6f36, 0xd4ea9f09, 0xd629b07c, 0xaf31a4b2, 0x312a3f23, 0x30c6a594, 0xc035a266, 0x37744ebc, 0xa6fc82ca, 0xb0e090d0, 0x1533a7d8, 0x4af10498, 0xf741ecda, 0x0e7fcd50, 0x2f1791f6, 0x8d764dd6, 0x4d43efb0, 0x54ccaa4d, 0xdfe49604, 0xe39ed1b5, 0x1b4c6a88, 0xb8c12c1f, 0x7f466551, 0x049d5eea, 0x5d018c35, 0x73fa8774, 0x2efb0b41, 0x5ab3671d, 0x5292dbd2, 0x33e91056, 0x136dd647, 0x8c9ad761, 0x7a37a10c, 0x8e59f814, 0x89eb133c, 0xeecea927, 0x35b761c9, 0xede11ce5, 0x3c7a47b1, 0x599cd2df, 0x3f55f273, 0x791814ce, 0xbf73c737, 0xea53f7cd, 0x5b5ffdaa, 0x14df3d6f, 0x867844db, 0x81caaff3, 0x3eb968c4, 0x2c382434, 0x5fc2a340, 0x72161dc3, 0x0cbce225, 0x8b283c49, 0x41ff0d95, 0x7139a801, 0xde080cb3, 0x9cd8b4e4, 0x906456c1, 0x617bcb84, 0x70d532b6, 0x74486c5c, 0x42d0b857]; + var T7 = [0xa75051f4, 0x65537e41, 0xa4c31a17, 0x5e963a27, 0x6bcb3bab, 0x45f11f9d, 0x58abacfa, 0x03934be3, 0xfa552030, 0x6df6ad76, 0x769188cc, 0x4c25f502, 0xd7fc4fe5, 0xcbd7c52a, 0x44802635, 0xa38fb562, 0x5a49deb1, 0x1b6725ba, 0x0e9845ea, 0xc0e15dfe, 0x7502c32f, 0xf012814c, 0x97a38d46, 0xf9c66bd3, 0x5fe7038f, 0x9c951592, 0x7aebbf6d, 0x59da9552, 0x832dd4be, 0x21d35874, 0x692949e0, 0xc8448ec9, 0x896a75c2, 0x7978f48e, 0x3e6b9958, 0x71dd27b9, 0x4fb6bee1, 0xad17f088, 0xac66c920, 0x3ab47dce, 0x4a1863df, 0x3182e51a, 0x33609751, 0x7f456253, 0x77e0b164, 0xae84bb6b, 0xa01cfe81, 0x2b94f908, 0x68587048, 0xfd198f45, 0x6c8794de, 0xf8b7527b, 0xd323ab73, 0x02e2724b, 0x8f57e31f, 0xab2a6655, 0x2807b2eb, 0xc2032fb5, 0x7b9a86c5, 0x08a5d337, 0x87f23028, 0xa5b223bf, 0x6aba0203, 0x825ced16, 0x1c2b8acf, 0xb492a779, 0xf2f0f307, 0xe2a14e69, 0xf4cd65da, 0xbed50605, 0x621fd134, 0xfe8ac4a6, 0x539d342e, 0x55a0a2f3, 0xe132058a, 0xeb75a4f6, 0xec390b83, 0xefaa4060, 0x9f065e71, 0x1051bd6e, 0x8af93e21, 0x063d96dd, 0x05aedd3e, 0xbd464de6, 0x8db59154, 0x5d0571c4, 0xd46f0406, 0x15ff6050, 0xfb241998, 0xe997d6bd, 0x43cc8940, 0x9e7767d9, 0x42bdb0e8, 0x8b880789, 0x5b38e719, 0xeedb79c8, 0x0a47a17c, 0x0fe97c42, 0x1ec9f884, 0x00000000, 0x86830980, 0xed48322b, 0x70ac1e11, 0x724e6c5a, 0xfffbfd0e, 0x38560f85, 0xd51e3dae, 0x3927362d, 0xd9640a0f, 0xa621685c, 0x54d19b5b, 0x2e3a2436, 0x67b10c0a, 0xe70f9357, 0x96d2b4ee, 0x919e1b9b, 0xc54f80c0, 0x20a261dc, 0x4b695a77, 0x1a161c12, 0xba0ae293, 0x2ae5c0a0, 0xe0433c22, 0x171d121b, 0x0d0b0e09, 0xc7adf28b, 0xa8b92db6, 0xa9c8141e, 0x198557f1, 0x074caf75, 0xddbbee99, 0x60fda37f, 0x269ff701, 0xf5bc5c72, 0x3bc54466, 0x7e345bfb, 0x29768b43, 0xc6dccb23, 0xfc68b6ed, 0xf163b8e4, 0xdccad731, 0x85104263, 0x22401397, 0x112084c6, 0x247d854a, 0x3df8d2bb, 0x3211aef9, 0xa16dc729, 0x2f4b1d9e, 0x30f3dcb2, 0x52ec0d86, 0xe3d077c1, 0x166c2bb3, 0xb999a970, 0x48fa1194, 0x642247e9, 0x8cc4a8fc, 0x3f1aa0f0, 0x2cd8567d, 0x90ef2233, 0x4ec78749, 0xd1c1d938, 0xa2fe8cca, 0x0b3698d4, 0x81cfa6f5, 0xde28a57a, 0x8e26dab7, 0xbfa43fad, 0x9de42c3a, 0x920d5078, 0xcc9b6a5f, 0x4662547e, 0x13c2f68d, 0xb8e890d8, 0xf75e2e39, 0xaff582c3, 0x80be9f5d, 0x937c69d0, 0x2da96fd5, 0x12b3cf25, 0x993bc8ac, 0x7da71018, 0x636ee89c, 0xbb7bdb3b, 0x7809cd26, 0x18f46e59, 0xb701ec9a, 0x9aa8834f, 0x6e65e695, 0xe67eaaff, 0xcf0821bc, 0xe8e6ef15, 0x9bd9bae7, 0x36ce4a6f, 0x09d4ea9f, 0x7cd629b0, 0xb2af31a4, 0x23312a3f, 0x9430c6a5, 0x66c035a2, 0xbc37744e, 0xcaa6fc82, 0xd0b0e090, 0xd81533a7, 0x984af104, 0xdaf741ec, 0x500e7fcd, 0xf62f1791, 0xd68d764d, 0xb04d43ef, 0x4d54ccaa, 0x04dfe496, 0xb5e39ed1, 0x881b4c6a, 0x1fb8c12c, 0x517f4665, 0xea049d5e, 0x355d018c, 0x7473fa87, 0x412efb0b, 0x1d5ab367, 0xd25292db, 0x5633e910, 0x47136dd6, 0x618c9ad7, 0x0c7a37a1, 0x148e59f8, 0x3c89eb13, 0x27eecea9, 0xc935b761, 0xe5ede11c, 0xb13c7a47, 0xdf599cd2, 0x733f55f2, 0xce791814, 0x37bf73c7, 0xcdea53f7, 0xaa5b5ffd, 0x6f14df3d, 0xdb867844, 0xf381caaf, 0xc43eb968, 0x342c3824, 0x405fc2a3, 0xc372161d, 0x250cbce2, 0x498b283c, 0x9541ff0d, 0x017139a8, 0xb3de080c, 0xe49cd8b4, 0xc1906456, 0x84617bcb, 0xb670d532, 0x5c74486c, 0x5742d0b8]; + var T8 = [0xf4a75051, 0x4165537e, 0x17a4c31a, 0x275e963a, 0xab6bcb3b, 0x9d45f11f, 0xfa58abac, 0xe303934b, 0x30fa5520, 0x766df6ad, 0xcc769188, 0x024c25f5, 0xe5d7fc4f, 0x2acbd7c5, 0x35448026, 0x62a38fb5, 0xb15a49de, 0xba1b6725, 0xea0e9845, 0xfec0e15d, 0x2f7502c3, 0x4cf01281, 0x4697a38d, 0xd3f9c66b, 0x8f5fe703, 0x929c9515, 0x6d7aebbf, 0x5259da95, 0xbe832dd4, 0x7421d358, 0xe0692949, 0xc9c8448e, 0xc2896a75, 0x8e7978f4, 0x583e6b99, 0xb971dd27, 0xe14fb6be, 0x88ad17f0, 0x20ac66c9, 0xce3ab47d, 0xdf4a1863, 0x1a3182e5, 0x51336097, 0x537f4562, 0x6477e0b1, 0x6bae84bb, 0x81a01cfe, 0x082b94f9, 0x48685870, 0x45fd198f, 0xde6c8794, 0x7bf8b752, 0x73d323ab, 0x4b02e272, 0x1f8f57e3, 0x55ab2a66, 0xeb2807b2, 0xb5c2032f, 0xc57b9a86, 0x3708a5d3, 0x2887f230, 0xbfa5b223, 0x036aba02, 0x16825ced, 0xcf1c2b8a, 0x79b492a7, 0x07f2f0f3, 0x69e2a14e, 0xdaf4cd65, 0x05bed506, 0x34621fd1, 0xa6fe8ac4, 0x2e539d34, 0xf355a0a2, 0x8ae13205, 0xf6eb75a4, 0x83ec390b, 0x60efaa40, 0x719f065e, 0x6e1051bd, 0x218af93e, 0xdd063d96, 0x3e05aedd, 0xe6bd464d, 0x548db591, 0xc45d0571, 0x06d46f04, 0x5015ff60, 0x98fb2419, 0xbde997d6, 0x4043cc89, 0xd99e7767, 0xe842bdb0, 0x898b8807, 0x195b38e7, 0xc8eedb79, 0x7c0a47a1, 0x420fe97c, 0x841ec9f8, 0x00000000, 0x80868309, 0x2bed4832, 0x1170ac1e, 0x5a724e6c, 0x0efffbfd, 0x8538560f, 0xaed51e3d, 0x2d392736, 0x0fd9640a, 0x5ca62168, 0x5b54d19b, 0x362e3a24, 0x0a67b10c, 0x57e70f93, 0xee96d2b4, 0x9b919e1b, 0xc0c54f80, 0xdc20a261, 0x774b695a, 0x121a161c, 0x93ba0ae2, 0xa02ae5c0, 0x22e0433c, 0x1b171d12, 0x090d0b0e, 0x8bc7adf2, 0xb6a8b92d, 0x1ea9c814, 0xf1198557, 0x75074caf, 0x99ddbbee, 0x7f60fda3, 0x01269ff7, 0x72f5bc5c, 0x663bc544, 0xfb7e345b, 0x4329768b, 0x23c6dccb, 0xedfc68b6, 0xe4f163b8, 0x31dccad7, 0x63851042, 0x97224013, 0xc6112084, 0x4a247d85, 0xbb3df8d2, 0xf93211ae, 0x29a16dc7, 0x9e2f4b1d, 0xb230f3dc, 0x8652ec0d, 0xc1e3d077, 0xb3166c2b, 0x70b999a9, 0x9448fa11, 0xe9642247, 0xfc8cc4a8, 0xf03f1aa0, 0x7d2cd856, 0x3390ef22, 0x494ec787, 0x38d1c1d9, 0xcaa2fe8c, 0xd40b3698, 0xf581cfa6, 0x7ade28a5, 0xb78e26da, 0xadbfa43f, 0x3a9de42c, 0x78920d50, 0x5fcc9b6a, 0x7e466254, 0x8d13c2f6, 0xd8b8e890, 0x39f75e2e, 0xc3aff582, 0x5d80be9f, 0xd0937c69, 0xd52da96f, 0x2512b3cf, 0xac993bc8, 0x187da710, 0x9c636ee8, 0x3bbb7bdb, 0x267809cd, 0x5918f46e, 0x9ab701ec, 0x4f9aa883, 0x956e65e6, 0xffe67eaa, 0xbccf0821, 0x15e8e6ef, 0xe79bd9ba, 0x6f36ce4a, 0x9f09d4ea, 0xb07cd629, 0xa4b2af31, 0x3f23312a, 0xa59430c6, 0xa266c035, 0x4ebc3774, 0x82caa6fc, 0x90d0b0e0, 0xa7d81533, 0x04984af1, 0xecdaf741, 0xcd500e7f, 0x91f62f17, 0x4dd68d76, 0xefb04d43, 0xaa4d54cc, 0x9604dfe4, 0xd1b5e39e, 0x6a881b4c, 0x2c1fb8c1, 0x65517f46, 0x5eea049d, 0x8c355d01, 0x877473fa, 0x0b412efb, 0x671d5ab3, 0xdbd25292, 0x105633e9, 0xd647136d, 0xd7618c9a, 0xa10c7a37, 0xf8148e59, 0x133c89eb, 0xa927eece, 0x61c935b7, 0x1ce5ede1, 0x47b13c7a, 0xd2df599c, 0xf2733f55, 0x14ce7918, 0xc737bf73, 0xf7cdea53, 0xfdaa5b5f, 0x3d6f14df, 0x44db8678, 0xaff381ca, 0x68c43eb9, 0x24342c38, 0xa3405fc2, 0x1dc37216, 0xe2250cbc, 0x3c498b28, 0x0d9541ff, 0xa8017139, 0x0cb3de08, 0xb4e49cd8, 0x56c19064, 0xcb84617b, 0x32b670d5, 0x6c5c7448, 0xb85742d0]; // Transformations for decryption key expansion + + var U1 = [0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]; + var U2 = [0x00000000, 0x0b0e090d, 0x161c121a, 0x1d121b17, 0x2c382434, 0x27362d39, 0x3a24362e, 0x312a3f23, 0x58704868, 0x537e4165, 0x4e6c5a72, 0x4562537f, 0x74486c5c, 0x7f466551, 0x62547e46, 0x695a774b, 0xb0e090d0, 0xbbee99dd, 0xa6fc82ca, 0xadf28bc7, 0x9cd8b4e4, 0x97d6bde9, 0x8ac4a6fe, 0x81caaff3, 0xe890d8b8, 0xe39ed1b5, 0xfe8ccaa2, 0xf582c3af, 0xc4a8fc8c, 0xcfa6f581, 0xd2b4ee96, 0xd9bae79b, 0x7bdb3bbb, 0x70d532b6, 0x6dc729a1, 0x66c920ac, 0x57e31f8f, 0x5ced1682, 0x41ff0d95, 0x4af10498, 0x23ab73d3, 0x28a57ade, 0x35b761c9, 0x3eb968c4, 0x0f9357e7, 0x049d5eea, 0x198f45fd, 0x12814cf0, 0xcb3bab6b, 0xc035a266, 0xdd27b971, 0xd629b07c, 0xe7038f5f, 0xec0d8652, 0xf11f9d45, 0xfa119448, 0x934be303, 0x9845ea0e, 0x8557f119, 0x8e59f814, 0xbf73c737, 0xb47dce3a, 0xa96fd52d, 0xa261dc20, 0xf6ad766d, 0xfda37f60, 0xe0b16477, 0xebbf6d7a, 0xda955259, 0xd19b5b54, 0xcc894043, 0xc787494e, 0xaedd3e05, 0xa5d33708, 0xb8c12c1f, 0xb3cf2512, 0x82e51a31, 0x89eb133c, 0x94f9082b, 0x9ff70126, 0x464de6bd, 0x4d43efb0, 0x5051f4a7, 0x5b5ffdaa, 0x6a75c289, 0x617bcb84, 0x7c69d093, 0x7767d99e, 0x1e3daed5, 0x1533a7d8, 0x0821bccf, 0x032fb5c2, 0x32058ae1, 0x390b83ec, 0x241998fb, 0x2f1791f6, 0x8d764dd6, 0x867844db, 0x9b6a5fcc, 0x906456c1, 0xa14e69e2, 0xaa4060ef, 0xb7527bf8, 0xbc5c72f5, 0xd50605be, 0xde080cb3, 0xc31a17a4, 0xc8141ea9, 0xf93e218a, 0xf2302887, 0xef223390, 0xe42c3a9d, 0x3d96dd06, 0x3698d40b, 0x2b8acf1c, 0x2084c611, 0x11aef932, 0x1aa0f03f, 0x07b2eb28, 0x0cbce225, 0x65e6956e, 0x6ee89c63, 0x73fa8774, 0x78f48e79, 0x49deb15a, 0x42d0b857, 0x5fc2a340, 0x54ccaa4d, 0xf741ecda, 0xfc4fe5d7, 0xe15dfec0, 0xea53f7cd, 0xdb79c8ee, 0xd077c1e3, 0xcd65daf4, 0xc66bd3f9, 0xaf31a4b2, 0xa43fadbf, 0xb92db6a8, 0xb223bfa5, 0x83098086, 0x8807898b, 0x9515929c, 0x9e1b9b91, 0x47a17c0a, 0x4caf7507, 0x51bd6e10, 0x5ab3671d, 0x6b99583e, 0x60975133, 0x7d854a24, 0x768b4329, 0x1fd13462, 0x14df3d6f, 0x09cd2678, 0x02c32f75, 0x33e91056, 0x38e7195b, 0x25f5024c, 0x2efb0b41, 0x8c9ad761, 0x8794de6c, 0x9a86c57b, 0x9188cc76, 0xa0a2f355, 0xabacfa58, 0xb6bee14f, 0xbdb0e842, 0xd4ea9f09, 0xdfe49604, 0xc2f68d13, 0xc9f8841e, 0xf8d2bb3d, 0xf3dcb230, 0xeecea927, 0xe5c0a02a, 0x3c7a47b1, 0x37744ebc, 0x2a6655ab, 0x21685ca6, 0x10426385, 0x1b4c6a88, 0x065e719f, 0x0d507892, 0x640a0fd9, 0x6f0406d4, 0x72161dc3, 0x791814ce, 0x48322bed, 0x433c22e0, 0x5e2e39f7, 0x552030fa, 0x01ec9ab7, 0x0ae293ba, 0x17f088ad, 0x1cfe81a0, 0x2dd4be83, 0x26dab78e, 0x3bc8ac99, 0x30c6a594, 0x599cd2df, 0x5292dbd2, 0x4f80c0c5, 0x448ec9c8, 0x75a4f6eb, 0x7eaaffe6, 0x63b8e4f1, 0x68b6edfc, 0xb10c0a67, 0xba02036a, 0xa710187d, 0xac1e1170, 0x9d342e53, 0x963a275e, 0x8b283c49, 0x80263544, 0xe97c420f, 0xe2724b02, 0xff605015, 0xf46e5918, 0xc544663b, 0xce4a6f36, 0xd3587421, 0xd8567d2c, 0x7a37a10c, 0x7139a801, 0x6c2bb316, 0x6725ba1b, 0x560f8538, 0x5d018c35, 0x40139722, 0x4b1d9e2f, 0x2247e964, 0x2949e069, 0x345bfb7e, 0x3f55f273, 0x0e7fcd50, 0x0571c45d, 0x1863df4a, 0x136dd647, 0xcad731dc, 0xc1d938d1, 0xdccb23c6, 0xd7c52acb, 0xe6ef15e8, 0xede11ce5, 0xf0f307f2, 0xfbfd0eff, 0x92a779b4, 0x99a970b9, 0x84bb6bae, 0x8fb562a3, 0xbe9f5d80, 0xb591548d, 0xa8834f9a, 0xa38d4697]; + var U3 = [0x00000000, 0x0d0b0e09, 0x1a161c12, 0x171d121b, 0x342c3824, 0x3927362d, 0x2e3a2436, 0x23312a3f, 0x68587048, 0x65537e41, 0x724e6c5a, 0x7f456253, 0x5c74486c, 0x517f4665, 0x4662547e, 0x4b695a77, 0xd0b0e090, 0xddbbee99, 0xcaa6fc82, 0xc7adf28b, 0xe49cd8b4, 0xe997d6bd, 0xfe8ac4a6, 0xf381caaf, 0xb8e890d8, 0xb5e39ed1, 0xa2fe8cca, 0xaff582c3, 0x8cc4a8fc, 0x81cfa6f5, 0x96d2b4ee, 0x9bd9bae7, 0xbb7bdb3b, 0xb670d532, 0xa16dc729, 0xac66c920, 0x8f57e31f, 0x825ced16, 0x9541ff0d, 0x984af104, 0xd323ab73, 0xde28a57a, 0xc935b761, 0xc43eb968, 0xe70f9357, 0xea049d5e, 0xfd198f45, 0xf012814c, 0x6bcb3bab, 0x66c035a2, 0x71dd27b9, 0x7cd629b0, 0x5fe7038f, 0x52ec0d86, 0x45f11f9d, 0x48fa1194, 0x03934be3, 0x0e9845ea, 0x198557f1, 0x148e59f8, 0x37bf73c7, 0x3ab47dce, 0x2da96fd5, 0x20a261dc, 0x6df6ad76, 0x60fda37f, 0x77e0b164, 0x7aebbf6d, 0x59da9552, 0x54d19b5b, 0x43cc8940, 0x4ec78749, 0x05aedd3e, 0x08a5d337, 0x1fb8c12c, 0x12b3cf25, 0x3182e51a, 0x3c89eb13, 0x2b94f908, 0x269ff701, 0xbd464de6, 0xb04d43ef, 0xa75051f4, 0xaa5b5ffd, 0x896a75c2, 0x84617bcb, 0x937c69d0, 0x9e7767d9, 0xd51e3dae, 0xd81533a7, 0xcf0821bc, 0xc2032fb5, 0xe132058a, 0xec390b83, 0xfb241998, 0xf62f1791, 0xd68d764d, 0xdb867844, 0xcc9b6a5f, 0xc1906456, 0xe2a14e69, 0xefaa4060, 0xf8b7527b, 0xf5bc5c72, 0xbed50605, 0xb3de080c, 0xa4c31a17, 0xa9c8141e, 0x8af93e21, 0x87f23028, 0x90ef2233, 0x9de42c3a, 0x063d96dd, 0x0b3698d4, 0x1c2b8acf, 0x112084c6, 0x3211aef9, 0x3f1aa0f0, 0x2807b2eb, 0x250cbce2, 0x6e65e695, 0x636ee89c, 0x7473fa87, 0x7978f48e, 0x5a49deb1, 0x5742d0b8, 0x405fc2a3, 0x4d54ccaa, 0xdaf741ec, 0xd7fc4fe5, 0xc0e15dfe, 0xcdea53f7, 0xeedb79c8, 0xe3d077c1, 0xf4cd65da, 0xf9c66bd3, 0xb2af31a4, 0xbfa43fad, 0xa8b92db6, 0xa5b223bf, 0x86830980, 0x8b880789, 0x9c951592, 0x919e1b9b, 0x0a47a17c, 0x074caf75, 0x1051bd6e, 0x1d5ab367, 0x3e6b9958, 0x33609751, 0x247d854a, 0x29768b43, 0x621fd134, 0x6f14df3d, 0x7809cd26, 0x7502c32f, 0x5633e910, 0x5b38e719, 0x4c25f502, 0x412efb0b, 0x618c9ad7, 0x6c8794de, 0x7b9a86c5, 0x769188cc, 0x55a0a2f3, 0x58abacfa, 0x4fb6bee1, 0x42bdb0e8, 0x09d4ea9f, 0x04dfe496, 0x13c2f68d, 0x1ec9f884, 0x3df8d2bb, 0x30f3dcb2, 0x27eecea9, 0x2ae5c0a0, 0xb13c7a47, 0xbc37744e, 0xab2a6655, 0xa621685c, 0x85104263, 0x881b4c6a, 0x9f065e71, 0x920d5078, 0xd9640a0f, 0xd46f0406, 0xc372161d, 0xce791814, 0xed48322b, 0xe0433c22, 0xf75e2e39, 0xfa552030, 0xb701ec9a, 0xba0ae293, 0xad17f088, 0xa01cfe81, 0x832dd4be, 0x8e26dab7, 0x993bc8ac, 0x9430c6a5, 0xdf599cd2, 0xd25292db, 0xc54f80c0, 0xc8448ec9, 0xeb75a4f6, 0xe67eaaff, 0xf163b8e4, 0xfc68b6ed, 0x67b10c0a, 0x6aba0203, 0x7da71018, 0x70ac1e11, 0x539d342e, 0x5e963a27, 0x498b283c, 0x44802635, 0x0fe97c42, 0x02e2724b, 0x15ff6050, 0x18f46e59, 0x3bc54466, 0x36ce4a6f, 0x21d35874, 0x2cd8567d, 0x0c7a37a1, 0x017139a8, 0x166c2bb3, 0x1b6725ba, 0x38560f85, 0x355d018c, 0x22401397, 0x2f4b1d9e, 0x642247e9, 0x692949e0, 0x7e345bfb, 0x733f55f2, 0x500e7fcd, 0x5d0571c4, 0x4a1863df, 0x47136dd6, 0xdccad731, 0xd1c1d938, 0xc6dccb23, 0xcbd7c52a, 0xe8e6ef15, 0xe5ede11c, 0xf2f0f307, 0xfffbfd0e, 0xb492a779, 0xb999a970, 0xae84bb6b, 0xa38fb562, 0x80be9f5d, 0x8db59154, 0x9aa8834f, 0x97a38d46]; + var U4 = [0x00000000, 0x090d0b0e, 0x121a161c, 0x1b171d12, 0x24342c38, 0x2d392736, 0x362e3a24, 0x3f23312a, 0x48685870, 0x4165537e, 0x5a724e6c, 0x537f4562, 0x6c5c7448, 0x65517f46, 0x7e466254, 0x774b695a, 0x90d0b0e0, 0x99ddbbee, 0x82caa6fc, 0x8bc7adf2, 0xb4e49cd8, 0xbde997d6, 0xa6fe8ac4, 0xaff381ca, 0xd8b8e890, 0xd1b5e39e, 0xcaa2fe8c, 0xc3aff582, 0xfc8cc4a8, 0xf581cfa6, 0xee96d2b4, 0xe79bd9ba, 0x3bbb7bdb, 0x32b670d5, 0x29a16dc7, 0x20ac66c9, 0x1f8f57e3, 0x16825ced, 0x0d9541ff, 0x04984af1, 0x73d323ab, 0x7ade28a5, 0x61c935b7, 0x68c43eb9, 0x57e70f93, 0x5eea049d, 0x45fd198f, 0x4cf01281, 0xab6bcb3b, 0xa266c035, 0xb971dd27, 0xb07cd629, 0x8f5fe703, 0x8652ec0d, 0x9d45f11f, 0x9448fa11, 0xe303934b, 0xea0e9845, 0xf1198557, 0xf8148e59, 0xc737bf73, 0xce3ab47d, 0xd52da96f, 0xdc20a261, 0x766df6ad, 0x7f60fda3, 0x6477e0b1, 0x6d7aebbf, 0x5259da95, 0x5b54d19b, 0x4043cc89, 0x494ec787, 0x3e05aedd, 0x3708a5d3, 0x2c1fb8c1, 0x2512b3cf, 0x1a3182e5, 0x133c89eb, 0x082b94f9, 0x01269ff7, 0xe6bd464d, 0xefb04d43, 0xf4a75051, 0xfdaa5b5f, 0xc2896a75, 0xcb84617b, 0xd0937c69, 0xd99e7767, 0xaed51e3d, 0xa7d81533, 0xbccf0821, 0xb5c2032f, 0x8ae13205, 0x83ec390b, 0x98fb2419, 0x91f62f17, 0x4dd68d76, 0x44db8678, 0x5fcc9b6a, 0x56c19064, 0x69e2a14e, 0x60efaa40, 0x7bf8b752, 0x72f5bc5c, 0x05bed506, 0x0cb3de08, 0x17a4c31a, 0x1ea9c814, 0x218af93e, 0x2887f230, 0x3390ef22, 0x3a9de42c, 0xdd063d96, 0xd40b3698, 0xcf1c2b8a, 0xc6112084, 0xf93211ae, 0xf03f1aa0, 0xeb2807b2, 0xe2250cbc, 0x956e65e6, 0x9c636ee8, 0x877473fa, 0x8e7978f4, 0xb15a49de, 0xb85742d0, 0xa3405fc2, 0xaa4d54cc, 0xecdaf741, 0xe5d7fc4f, 0xfec0e15d, 0xf7cdea53, 0xc8eedb79, 0xc1e3d077, 0xdaf4cd65, 0xd3f9c66b, 0xa4b2af31, 0xadbfa43f, 0xb6a8b92d, 0xbfa5b223, 0x80868309, 0x898b8807, 0x929c9515, 0x9b919e1b, 0x7c0a47a1, 0x75074caf, 0x6e1051bd, 0x671d5ab3, 0x583e6b99, 0x51336097, 0x4a247d85, 0x4329768b, 0x34621fd1, 0x3d6f14df, 0x267809cd, 0x2f7502c3, 0x105633e9, 0x195b38e7, 0x024c25f5, 0x0b412efb, 0xd7618c9a, 0xde6c8794, 0xc57b9a86, 0xcc769188, 0xf355a0a2, 0xfa58abac, 0xe14fb6be, 0xe842bdb0, 0x9f09d4ea, 0x9604dfe4, 0x8d13c2f6, 0x841ec9f8, 0xbb3df8d2, 0xb230f3dc, 0xa927eece, 0xa02ae5c0, 0x47b13c7a, 0x4ebc3774, 0x55ab2a66, 0x5ca62168, 0x63851042, 0x6a881b4c, 0x719f065e, 0x78920d50, 0x0fd9640a, 0x06d46f04, 0x1dc37216, 0x14ce7918, 0x2bed4832, 0x22e0433c, 0x39f75e2e, 0x30fa5520, 0x9ab701ec, 0x93ba0ae2, 0x88ad17f0, 0x81a01cfe, 0xbe832dd4, 0xb78e26da, 0xac993bc8, 0xa59430c6, 0xd2df599c, 0xdbd25292, 0xc0c54f80, 0xc9c8448e, 0xf6eb75a4, 0xffe67eaa, 0xe4f163b8, 0xedfc68b6, 0x0a67b10c, 0x036aba02, 0x187da710, 0x1170ac1e, 0x2e539d34, 0x275e963a, 0x3c498b28, 0x35448026, 0x420fe97c, 0x4b02e272, 0x5015ff60, 0x5918f46e, 0x663bc544, 0x6f36ce4a, 0x7421d358, 0x7d2cd856, 0xa10c7a37, 0xa8017139, 0xb3166c2b, 0xba1b6725, 0x8538560f, 0x8c355d01, 0x97224013, 0x9e2f4b1d, 0xe9642247, 0xe0692949, 0xfb7e345b, 0xf2733f55, 0xcd500e7f, 0xc45d0571, 0xdf4a1863, 0xd647136d, 0x31dccad7, 0x38d1c1d9, 0x23c6dccb, 0x2acbd7c5, 0x15e8e6ef, 0x1ce5ede1, 0x07f2f0f3, 0x0efffbfd, 0x79b492a7, 0x70b999a9, 0x6bae84bb, 0x62a38fb5, 0x5d80be9f, 0x548db591, 0x4f9aa883, 0x4697a38d]; + + function convertToInt32(bytes) { + var result = []; + + for (var i = 0; i < bytes.length; i += 4) { + result.push(bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]); + } + + return result; + } + + var AES = function AES(key) { + if (!(this instanceof AES)) { + throw Error('AES must be instanitated with `new`'); + } + + Object.defineProperty(this, 'key', { + value: coerceArray(key, true) + }); + + this._prepare(); + }; + + AES.prototype._prepare = function () { + var rounds = numberOfRounds[this.key.length]; + + if (rounds == null) { + throw new Error('invalid key size (must be 16, 24 or 32 bytes)'); + } // encryption round keys + + + this._Ke = []; // decryption round keys + + this._Kd = []; + + for (var i = 0; i <= rounds; i++) { + this._Ke.push([0, 0, 0, 0]); + + this._Kd.push([0, 0, 0, 0]); + } + + var roundKeyCount = (rounds + 1) * 4; + var KC = this.key.length / 4; // convert the key into ints + + var tk = convertToInt32(this.key); // copy values into round key arrays + + var index; + + for (var i = 0; i < KC; i++) { + index = i >> 2; + this._Ke[index][i % 4] = tk[i]; + this._Kd[rounds - index][i % 4] = tk[i]; + } // key expansion (fips-197 section 5.2) + + + var rconpointer = 0; + var t = KC, + tt; + + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= S[tt >> 16 & 0xFF] << 24 ^ S[tt >> 8 & 0xFF] << 16 ^ S[tt & 0xFF] << 8 ^ S[tt >> 24 & 0xFF] ^ rcon[rconpointer] << 24; + rconpointer += 1; // key expansion (for non-256 bit) + + if (KC != 8) { + for (var i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } // key expansion for 256-bit keys is "slightly different" (fips-197) + + } else { + for (var i = 1; i < KC / 2; i++) { + tk[i] ^= tk[i - 1]; + } + + tt = tk[KC / 2 - 1]; + tk[KC / 2] ^= S[tt & 0xFF] ^ S[tt >> 8 & 0xFF] << 8 ^ S[tt >> 16 & 0xFF] << 16 ^ S[tt >> 24 & 0xFF] << 24; + + for (var i = KC / 2 + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } // copy values into round key arrays + + + var i = 0, + r, + c; + + while (i < KC && t < roundKeyCount) { + r = t >> 2; + c = t % 4; + this._Ke[r][c] = tk[i]; + this._Kd[rounds - r][c] = tk[i++]; + t++; + } + } // inverse-cipher-ify the decryption round key (fips-197 section 5.3) + + + for (var r = 1; r < rounds; r++) { + for (var c = 0; c < 4; c++) { + tt = this._Kd[r][c]; + this._Kd[r][c] = U1[tt >> 24 & 0xFF] ^ U2[tt >> 16 & 0xFF] ^ U3[tt >> 8 & 0xFF] ^ U4[tt & 0xFF]; + } + } + }; + + AES.prototype.encrypt = function (plaintext) { + if (plaintext.length != 16) { + throw new Error('invalid plaintext size (must be 16 bytes)'); + } + + var rounds = this._Ke.length - 1; + var a = [0, 0, 0, 0]; // convert plaintext to (ints ^ key) + + var t = convertToInt32(plaintext); + + for (var i = 0; i < 4; i++) { + t[i] ^= this._Ke[0][i]; + } // apply round transforms + + + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T1[t[i] >> 24 & 0xff] ^ T2[t[(i + 1) % 4] >> 16 & 0xff] ^ T3[t[(i + 2) % 4] >> 8 & 0xff] ^ T4[t[(i + 3) % 4] & 0xff] ^ this._Ke[r][i]; + } + + t = a.slice(); + } // the last round is special + + + var result = createArray(16), + tt; + + for (var i = 0; i < 4; i++) { + tt = this._Ke[rounds][i]; + result[4 * i] = (S[t[i] >> 24 & 0xff] ^ tt >> 24) & 0xff; + result[4 * i + 1] = (S[t[(i + 1) % 4] >> 16 & 0xff] ^ tt >> 16) & 0xff; + result[4 * i + 2] = (S[t[(i + 2) % 4] >> 8 & 0xff] ^ tt >> 8) & 0xff; + result[4 * i + 3] = (S[t[(i + 3) % 4] & 0xff] ^ tt) & 0xff; + } + + return result; + }; + + AES.prototype.decrypt = function (ciphertext) { + if (ciphertext.length != 16) { + throw new Error('invalid ciphertext size (must be 16 bytes)'); + } + + var rounds = this._Kd.length - 1; + var a = [0, 0, 0, 0]; // convert plaintext to (ints ^ key) + + var t = convertToInt32(ciphertext); + + for (var i = 0; i < 4; i++) { + t[i] ^= this._Kd[0][i]; + } // apply round transforms + + + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T5[t[i] >> 24 & 0xff] ^ T6[t[(i + 3) % 4] >> 16 & 0xff] ^ T7[t[(i + 2) % 4] >> 8 & 0xff] ^ T8[t[(i + 1) % 4] & 0xff] ^ this._Kd[r][i]; + } + + t = a.slice(); + } // the last round is special + + + var result = createArray(16), + tt; + + for (var i = 0; i < 4; i++) { + tt = this._Kd[rounds][i]; + result[4 * i] = (Si[t[i] >> 24 & 0xff] ^ tt >> 24) & 0xff; + result[4 * i + 1] = (Si[t[(i + 3) % 4] >> 16 & 0xff] ^ tt >> 16) & 0xff; + result[4 * i + 2] = (Si[t[(i + 2) % 4] >> 8 & 0xff] ^ tt >> 8) & 0xff; + result[4 * i + 3] = (Si[t[(i + 1) % 4] & 0xff] ^ tt) & 0xff; + } + + return result; + }; + /** + * Mode Of Operation - Electonic Codebook (ECB) + */ + + + var ModeOfOperationECB = function ModeOfOperationECB(key) { + if (!(this instanceof ModeOfOperationECB)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Electronic Code Block"; + this.name = "ecb"; + this._aes = new AES(key); + }; + + ModeOfOperationECB.prototype.encrypt = function (plaintext) { + plaintext = coerceArray(plaintext); + + if (plaintext.length % 16 !== 0) { + throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); + } + + var ciphertext = createArray(plaintext.length); + var block = createArray(16); + + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); + block = this._aes.encrypt(block); + copyArray(block, ciphertext, i); + } + + return ciphertext; + }; + + ModeOfOperationECB.prototype.decrypt = function (ciphertext) { + ciphertext = coerceArray(ciphertext); + + if (ciphertext.length % 16 !== 0) { + throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); + } + + var plaintext = createArray(ciphertext.length); + var block = createArray(16); + + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); + block = this._aes.decrypt(block); + copyArray(block, plaintext, i); + } + + return plaintext; + }; + /** + * Mode Of Operation - Cipher Block Chaining (CBC) + */ + + + var ModeOfOperationCBC = function ModeOfOperationCBC(key, iv) { + if (!(this instanceof ModeOfOperationCBC)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Cipher Block Chaining"; + this.name = "cbc"; + + if (!iv) { + iv = createArray(16); + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 bytes)'); + } + + this._lastCipherblock = coerceArray(iv, true); + this._aes = new AES(key); + }; + + ModeOfOperationCBC.prototype.encrypt = function (plaintext) { + plaintext = coerceArray(plaintext); + + if (plaintext.length % 16 !== 0) { + throw new Error('invalid plaintext size (must be multiple of 16 bytes)'); + } + + var ciphertext = createArray(plaintext.length); + var block = createArray(16); + + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); + + for (var j = 0; j < 16; j++) { + block[j] ^= this._lastCipherblock[j]; + } + + this._lastCipherblock = this._aes.encrypt(block); + copyArray(this._lastCipherblock, ciphertext, i); + } + + return ciphertext; + }; + + ModeOfOperationCBC.prototype.decrypt = function (ciphertext) { + ciphertext = coerceArray(ciphertext); + + if (ciphertext.length % 16 !== 0) { + throw new Error('invalid ciphertext size (must be multiple of 16 bytes)'); + } + + var plaintext = createArray(ciphertext.length); + var block = createArray(16); + + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); + block = this._aes.decrypt(block); + + for (var j = 0; j < 16; j++) { + plaintext[i + j] = block[j] ^ this._lastCipherblock[j]; + } + + copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16); + } + + return plaintext; + }; + /** + * Mode Of Operation - Cipher Feedback (CFB) + */ + + + var ModeOfOperationCFB = function ModeOfOperationCFB(key, iv, segmentSize) { + if (!(this instanceof ModeOfOperationCFB)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Cipher Feedback"; + this.name = "cfb"; + + if (!iv) { + iv = createArray(16); + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 size)'); + } + + if (!segmentSize) { + segmentSize = 1; + } + + this.segmentSize = segmentSize; + this._shiftRegister = coerceArray(iv, true); + this._aes = new AES(key); + }; + + ModeOfOperationCFB.prototype.encrypt = function (plaintext) { + if (plaintext.length % this.segmentSize != 0) { + throw new Error('invalid plaintext size (must be segmentSize bytes)'); + } + + var encrypted = coerceArray(plaintext, true); + var xorSegment; + + for (var i = 0; i < encrypted.length; i += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); + + for (var j = 0; j < this.segmentSize; j++) { + encrypted[i + j] ^= xorSegment[j]; + } // Shift the register + + + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } + + return encrypted; + }; + + ModeOfOperationCFB.prototype.decrypt = function (ciphertext) { + if (ciphertext.length % this.segmentSize != 0) { + throw new Error('invalid ciphertext size (must be segmentSize bytes)'); + } + + var plaintext = coerceArray(ciphertext, true); + var xorSegment; + + for (var i = 0; i < plaintext.length; i += this.segmentSize) { + xorSegment = this._aes.encrypt(this._shiftRegister); + + for (var j = 0; j < this.segmentSize; j++) { + plaintext[i + j] ^= xorSegment[j]; + } // Shift the register + + + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } + + return plaintext; + }; + /** + * Mode Of Operation - Output Feedback (OFB) + */ + + + var ModeOfOperationOFB = function ModeOfOperationOFB(key, iv) { + if (!(this instanceof ModeOfOperationOFB)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Output Feedback"; + this.name = "ofb"; + + if (!iv) { + iv = createArray(16); + } else if (iv.length != 16) { + throw new Error('invalid initialation vector size (must be 16 bytes)'); + } + + this._lastPrecipher = coerceArray(iv, true); + this._lastPrecipherIndex = 16; + this._aes = new AES(key); + }; + + ModeOfOperationOFB.prototype.encrypt = function (plaintext) { + var encrypted = coerceArray(plaintext, true); + + for (var i = 0; i < encrypted.length; i++) { + if (this._lastPrecipherIndex === 16) { + this._lastPrecipher = this._aes.encrypt(this._lastPrecipher); + this._lastPrecipherIndex = 0; + } + + encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++]; + } + + return encrypted; + }; // Decryption is symetric + + + ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; + /** + * Counter object for CTR common mode of operation + */ + + var Counter = function Counter(initialValue) { + if (!(this instanceof Counter)) { + throw Error('Counter must be instanitated with `new`'); + } // We allow 0, but anything false-ish uses the default 1 + + + if (initialValue !== 0 && !initialValue) { + initialValue = 1; + } + + if (typeof initialValue === 'number') { + this._counter = createArray(16); + this.setValue(initialValue); + } else { + this.setBytes(initialValue); + } + }; + + Counter.prototype.setValue = function (value) { + if (typeof value !== 'number' || parseInt(value) != value) { + throw new Error('invalid counter value (must be an integer)'); + } + + for (var index = 15; index >= 0; --index) { + this._counter[index] = value % 256; + value = value >> 8; + } + }; + + Counter.prototype.setBytes = function (bytes) { + bytes = coerceArray(bytes, true); + + if (bytes.length != 16) { + throw new Error('invalid counter bytes size (must be 16 bytes)'); + } + + this._counter = bytes; + }; + + Counter.prototype.increment = function () { + for (var i = 15; i >= 0; i--) { + if (this._counter[i] === 255) { + this._counter[i] = 0; + } else { + this._counter[i]++; + break; + } + } + }; + /** + * Mode Of Operation - Counter (CTR) + */ + + + var ModeOfOperationCTR = function ModeOfOperationCTR(key, counter) { + if (!(this instanceof ModeOfOperationCTR)) { + throw Error('AES must be instanitated with `new`'); + } + + this.description = "Counter"; + this.name = "ctr"; + + if (!(counter instanceof Counter)) { + counter = new Counter(counter); + } + + this._counter = counter; + this._remainingCounter = null; + this._remainingCounterIndex = 16; + this._aes = new AES(key); + }; + + ModeOfOperationCTR.prototype.encrypt = function (plaintext) { + var encrypted = coerceArray(plaintext, true); + + for (var i = 0; i < encrypted.length; i++) { + if (this._remainingCounterIndex === 16) { + this._remainingCounter = this._aes.encrypt(this._counter._counter); + this._remainingCounterIndex = 0; + + this._counter.increment(); + } + + encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; + } + + return encrypted; + }; // Decryption is symetric + + + ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; /////////////////////// + // Padding + // See:https://tools.ietf.org/html/rfc2315 + + function pkcs7pad(data) { + data = coerceArray(data, true); + var padder = 16 - data.length % 16; + var result = createArray(data.length + padder); + copyArray(data, result); + + for (var i = data.length; i < result.length; i++) { + result[i] = padder; + } + + return result; + } + + function pkcs7strip(data) { + data = coerceArray(data, true); + + if (data.length < 16) { + throw new Error('PKCS#7 invalid length'); + } + + var padder = data[data.length - 1]; + + if (padder > 16) { + throw new Error('PKCS#7 padding byte out of range'); + } + + var length = data.length - padder; + + for (var i = 0; i < padder; i++) { + if (data[length + i] !== padder) { + throw new Error('PKCS#7 invalid padding byte'); + } + } + + var result = createArray(length); + copyArray(data, result, 0, 0, length); + return result; + } /////////////////////// + // Exporting + // The block cipher + + + var aesjs = { + AES: AES, + Counter: Counter, + ModeOfOperation: { + ecb: ModeOfOperationECB, + cbc: ModeOfOperationCBC, + cfb: ModeOfOperationCFB, + ofb: ModeOfOperationOFB, + ctr: ModeOfOperationCTR + }, + utils: { + hex: convertHex, + utf8: convertUtf8 + }, + padding: { + pkcs7: { + pad: pkcs7pad, + strip: pkcs7strip + } + }, + _arrayTest: { + coerceArray: coerceArray, + createArray: createArray, + copyArray: copyArray + } + }; // node.js + + if (true) { + module.exports = aesjs; // RequireJS/AMD + // http://www.requirejs.org/docs/api.html + // https://github.com/amdjs/amdjs-api/wiki/AMD + } else {} +})(this); + +/***/ }), + +/***/ "./node_modules/base64-js/index.js": +/*!*****************************************!*\ + !*** ./node_modules/base64-js/index.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.byteLength = byteLength; +exports.toByteArray = toByteArray; +exports.fromByteArray = fromByteArray; +var lookup = []; +var revLookup = []; +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array; +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i]; + revLookup[code.charCodeAt(i)] = i; +} // Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications + + +revLookup['-'.charCodeAt(0)] = 62; +revLookup['_'.charCodeAt(0)] = 63; + +function getLens(b64) { + var len = b64.length; + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4'); + } // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + + + var validLen = b64.indexOf('='); + if (validLen === -1) validLen = len; + var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4; + return [validLen, placeHoldersLen]; +} // base64 is 4/3 + up to two characters of the original data + + +function byteLength(b64) { + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; + return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; +} + +function _byteLength(b64, validLen, placeHoldersLen) { + return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen; +} + +function toByteArray(b64) { + var tmp; + var lens = getLens(b64); + var validLen = lens[0]; + var placeHoldersLen = lens[1]; + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); + var curByte = 0; // if there are placeholders, only get up to the last complete 4 chars + + var len = placeHoldersLen > 0 ? validLen - 4 : validLen; + var i; + + for (i = 0; i < len; i += 4) { + tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; + arr[curByte++] = tmp >> 16 & 0xFF; + arr[curByte++] = tmp >> 8 & 0xFF; + arr[curByte++] = tmp & 0xFF; + } + + if (placeHoldersLen === 2) { + tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; + arr[curByte++] = tmp & 0xFF; + } + + if (placeHoldersLen === 1) { + tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; + arr[curByte++] = tmp >> 8 & 0xFF; + arr[curByte++] = tmp & 0xFF; + } + + return arr; +} + +function tripletToBase64(num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]; +} + +function encodeChunk(uint8, start, end) { + var tmp; + var output = []; + + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16 & 0xFF0000) + (uint8[i + 1] << 8 & 0xFF00) + (uint8[i + 2] & 0xFF); + output.push(tripletToBase64(tmp)); + } + + return output.join(''); +} + +function fromByteArray(uint8) { + var tmp; + var len = uint8.length; + var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes + + var parts = []; + var maxChunkLength = 16383; // must be multiple of 3 + // go through the array every three bytes, we'll deal with trailing stuff later + + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); + } // pad the end with zeros, but make sure to not forget the extra bytes + + + if (extraBytes === 1) { + tmp = uint8[len - 1]; + parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '=='); + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1]; + parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '='); + } + + return parts.join(''); +} + +/***/ }), + +/***/ "./node_modules/bech32/index.js": +/*!**************************************!*\ + !*** ./node_modules/bech32/index.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'; // pre-compute lookup table + +var ALPHABET_MAP = {}; + +for (var z = 0; z < ALPHABET.length; z++) { + var x = ALPHABET.charAt(z); + if (ALPHABET_MAP[x] !== undefined) throw new TypeError(x + ' is ambiguous'); + ALPHABET_MAP[x] = z; +} + +function polymodStep(pre) { + var 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) { + var chk = 1; + + for (var i = 0; i < prefix.length; ++i) { + var c = prefix.charCodeAt(i); + if (c < 33 || c > 126) return 'Invalid prefix (' + prefix + ')'; + chk = polymodStep(chk) ^ c >> 5; + } + + chk = polymodStep(chk); + + for (i = 0; i < prefix.length; ++i) { + var v = prefix.charCodeAt(i); + chk = polymodStep(chk) ^ v & 0x1f; + } + + return chk; +} + +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 + + var chk = prefixChk(prefix); + if (typeof chk === 'string') throw new Error(chk); + var result = prefix + '1'; + + for (var i = 0; i < words.length; ++i) { + var x = words[i]; + if (x >> 5 !== 0) throw new Error('Non 5-bit word'); + chk = polymodStep(chk) ^ x; + result += ALPHABET.charAt(x); + } + + for (i = 0; i < 6; ++i) { + chk = polymodStep(chk); + } + + chk ^= 1; + + for (i = 0; i < 6; ++i) { + var 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 + + var lowered = str.toLowerCase(); + var uppered = str.toUpperCase(); + if (str !== lowered && str !== uppered) return 'Mixed-case string ' + str; + str = lowered; + var split = str.lastIndexOf('1'); + if (split === -1) return 'No separator character for ' + str; + if (split === 0) return 'Missing prefix for ' + str; + var prefix = str.slice(0, split); + var wordChars = str.slice(split + 1); + if (wordChars.length < 6) return 'Data too short'; + var chk = prefixChk(prefix); + if (typeof chk === 'string') return chk; + var words = []; + + for (var i = 0; i < wordChars.length; ++i) { + var c = wordChars.charAt(i); + var 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 !== 1) return 'Invalid checksum for ' + str; + return { + prefix: prefix, + words: words + }; +} + +function decodeUnsafe() { + var res = __decode.apply(null, arguments); + + if (_typeof(res) === 'object') return res; +} + +function decode(str) { + var res = __decode.apply(null, arguments); + + if (_typeof(res) === 'object') return res; + throw new Error(res); +} + +function convert(data, inBits, outBits, pad) { + var value = 0; + var bits = 0; + var maxV = (1 << outBits) - 1; + var result = []; + + for (var 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 toWordsUnsafe(bytes) { + var res = convert(bytes, 8, 5, true); + if (Array.isArray(res)) return res; +} + +function toWords(bytes) { + var res = convert(bytes, 8, 5, true); + if (Array.isArray(res)) return res; + throw new Error(res); +} + +function fromWordsUnsafe(words) { + var res = convert(words, 5, 8, false); + if (Array.isArray(res)) return res; +} + +function fromWords(words) { + var res = convert(words, 5, 8, false); + if (Array.isArray(res)) return res; + throw new Error(res); +} + +module.exports = { + decodeUnsafe: decodeUnsafe, + decode: decode, + encode: encode, + toWordsUnsafe: toWordsUnsafe, + toWords: toWords, + fromWordsUnsafe: fromWordsUnsafe, + fromWords: fromWords +}; + +/***/ }), + +/***/ "./node_modules/bn.js/lib/bn.js": +/*!**************************************!*\ + !*** ./node_modules/bn.js/lib/bn.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(module) {function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +(function (module, exports) { + 'use strict'; // Utils + + function assert(val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } // Could use `inherits` module, but don't want to move from single file + // architecture yet. + + + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + + var TempCtor = function TempCtor() {}; + + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } // BN + + + function BN(number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; // Reduction context + + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + + if (_typeof(module) === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + var Buffer; + + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = __webpack_require__(/*! buffer */ 0).Buffer; + } + } catch (e) {} + + BN.isBN = function isBN(num) { + if (num instanceof BN) { + return true; + } + + return num !== null && _typeof(num) === 'object' && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max(left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min(left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init(number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (_typeof(number) === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + + assert(base === (base | 0) && base >= 2 && base <= 36); + number = number.toString().replace(/\s+/g, ''); + var start = 0; + + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber(number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + + this.words = [number & 0x3ffffff, number / 0x4000000 & 0x3ffffff, 1]; + this.length = 3; + } + + if (endian !== 'le') return; // Reverse the bytes + + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray(number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | number[i - 1] << 8 | number[i - 2] << 16; + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] = w >>> 26 - off & 0x3ffffff; + off += 24; + + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | number[i + 1] << 8 | number[i + 2] << 16; + this.words[j] |= w << off & 0x3ffffff; + this.words[j + 1] = w >>> 26 - off & 0x3ffffff; + off += 24; + + if (off >= 26) { + off -= 26; + j++; + } + } + } + + return this.strip(); + }; + + function parseHex4Bits(string, index) { + var c = string.charCodeAt(index); // 'A' - 'F' + + if (c >= 65 && c <= 70) { + return c - 55; // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; // '0' - '9' + } else { + return c - 48 & 0xf; + } + } + + function parseHexByte(string, lowerBound, index) { + var r = parseHex4Bits(string, index); + + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + + return r; + } + + BN.prototype._parseHex = function _parseHex(number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } // 24-bits chunks + + + var off = 0; + var j = 0; + var w; + + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase(str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + r *= mul; // 'a' + + if (c >= 49) { + r += c - 49 + 0xa; // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; // '0' - '9' + } else { + r += c; + } + } + + return r; + } + + BN.prototype._parseBase = function _parseBase(number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; // Find length of limb in base + + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + + limbLen--; + limbPow = limbPow / base | 0; + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + var word = 0; + + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + this.imuln(limbPow); + + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy(dest) { + dest.words = new Array(this.length); + + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone() { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand(size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + + return this; + }; // Remove leading `0` from `this` + + + BN.prototype.strip = function strip() { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign() { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + + return this; + }; + + BN.prototype.inspect = function inspect() { + return (this.red ? ''; + }; + /* + var zeros = []; + var groupSizes = []; + var groupBases = []; + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + */ + + + var zeros = ['', '0', '00', '000', '0000', '00000', '000000', '0000000', '00000000', '000000000', '0000000000', '00000000000', '000000000000', '0000000000000', '00000000000000', '000000000000000', '0000000000000000', '00000000000000000', '000000000000000000', '0000000000000000000', '00000000000000000000', '000000000000000000000', '0000000000000000000000', '00000000000000000000000', '000000000000000000000000', '0000000000000000000000000']; + var groupSizes = [0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]; + var groupBases = [0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176]; + + BN.prototype.toString = function toString(base, padding) { + base = base || 10; + padding = padding | 0 || 1; + var out; + + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = ((w << off | carry) & 0xffffff).toString(16); + carry = w >>> 24 - off & 0xffffff; + + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + + off += 2; + + if (off >= 26) { + off -= 26; + i--; + } + } + + if (carry !== 0) { + out = carry.toString(16) + out; + } + + while (out.length % padding !== 0) { + out = '0' + out; + } + + if (this.negative !== 0) { + out = '-' + out; + } + + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; // var groupBase = Math.pow(base, groupSize); + + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + + if (this.isZero()) { + out = '0' + out; + } + + while (out.length % padding !== 0) { + out = '0' + out; + } + + if (this.negative !== 0) { + out = '-' + out; + } + + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber() { + var ret = this.words[0]; + + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + this.words[1] * 0x4000000; + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + + return this.negative !== 0 ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON() { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer(endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray(endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + var b, i; + var q = this.clone(); + + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits(w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits(w) { + var t = w; + var r = 0; + + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits(w) { + // Short-cut + if (w === 0) return 26; + var t = w; + var r = 0; + + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + + if ((t & 0x1) === 0) { + r++; + } + + return r; + }; // Return number of used bits in a BN + + + BN.prototype.bitLength = function bitLength() { + var w = this.words[this.length - 1]; + + var hi = this._countBits(w); + + return (this.length - 1) * 26 + hi; + }; + + function toBitArray(num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = bit / 26 | 0; + var wbit = bit % 26; + w[bit] = (num.words[off] & 1 << wbit) >>> wbit; + } + + return w; + } // Number of trailing zero bits + + + BN.prototype.zeroBits = function zeroBits() { + if (this.isZero()) return 0; + var r = 0; + + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + + r += b; + if (b !== 26) break; + } + + return r; + }; + + BN.prototype.byteLength = function byteLength() { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos(width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos(width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg() { + return this.negative !== 0; + }; // Return negative clone of `this` + + + BN.prototype.neg = function neg() { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; // Or `num` with `this` in-place + + + BN.prototype.iuor = function iuor(num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior(num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; // Or `num` with `this` + + + BN.prototype.or = function or(num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor(num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; // And `num` with `this` in-place + + + BN.prototype.iuand = function iuand(num) { + // b = min-length(num, this) + var b; + + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + return this.strip(); + }; + + BN.prototype.iand = function iand(num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; // And `num` with `this` + + + BN.prototype.and = function and(num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand(num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; // Xor `num` with `this` in-place + + + BN.prototype.iuxor = function iuxor(num) { + // a.length > b.length + var a; + var b; + + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + return this.strip(); + }; + + BN.prototype.ixor = function ixor(num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; // Xor `num` with `this` + + + BN.prototype.xor = function xor(num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor(num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; // Not ``this`` with ``width`` bitwidth + + + BN.prototype.inotn = function inotn(width) { + assert(typeof width === 'number' && width >= 0); + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; // Extend the buffer with leading zeroes + + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } // Handle complete words + + + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } // Handle the residue + + + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & 0x3ffffff >> 26 - bitsLeft; + } // And remove leading zeroes + + + return this.strip(); + }; + + BN.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; // Set `bit` of `this` + + + BN.prototype.setn = function setn(bit, val) { + assert(typeof bit === 'number' && bit >= 0); + var off = bit / 26 | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | 1 << wbit; + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; // Add `num` to `this` in-place + + + BN.prototype.iadd = function iadd(num) { + var r; // negative + positive + + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } // a.length > b.length + + + var a, b; + + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; // Add `num` to `this` + + + BN.prototype.add = function add(num) { + var res; + + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + return num.clone().iadd(this); + }; // Subtract `num` from `this` in-place + + + BN.prototype.isub = function isub(num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } // At this point both numbers are positive + + + var cmp = this.cmp(num); // Optimization - zeroify + + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } // a > b + + + var a, b; + + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } // Copy rest of the words + + + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; // Subtract `num` from `this` + + + BN.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + + function smallMulTo(self, num, out) { + out.negative = num.negative ^ self.negative; + var len = self.length + num.length | 0; + out.length = len; + len = len - 1 | 0; // Peel one iteration (compiler can't do it, because of code complexity) + + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + var lo = r & 0x3ffffff; + var carry = r / 0x4000000 | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += r / 0x4000000 | 0; + rword = r & 0x3ffffff; + } + + out.words[k] = rword | 0; + carry = ncarry | 0; + } + + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + + + var comb10MulTo = function comb10MulTo(self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = mid + Math.imul(ah0, bl0) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = mid + Math.imul(ah1, bl0) | 0; + hi = Math.imul(ah1, bh0); + lo = lo + Math.imul(al0, bl1) | 0; + mid = mid + Math.imul(al0, bh1) | 0; + mid = mid + Math.imul(ah0, bl1) | 0; + hi = hi + Math.imul(ah0, bh1) | 0; + var w1 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = mid + Math.imul(ah2, bl0) | 0; + hi = Math.imul(ah2, bh0); + lo = lo + Math.imul(al1, bl1) | 0; + mid = mid + Math.imul(al1, bh1) | 0; + mid = mid + Math.imul(ah1, bl1) | 0; + hi = hi + Math.imul(ah1, bh1) | 0; + lo = lo + Math.imul(al0, bl2) | 0; + mid = mid + Math.imul(al0, bh2) | 0; + mid = mid + Math.imul(ah0, bl2) | 0; + hi = hi + Math.imul(ah0, bh2) | 0; + var w2 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = mid + Math.imul(ah3, bl0) | 0; + hi = Math.imul(ah3, bh0); + lo = lo + Math.imul(al2, bl1) | 0; + mid = mid + Math.imul(al2, bh1) | 0; + mid = mid + Math.imul(ah2, bl1) | 0; + hi = hi + Math.imul(ah2, bh1) | 0; + lo = lo + Math.imul(al1, bl2) | 0; + mid = mid + Math.imul(al1, bh2) | 0; + mid = mid + Math.imul(ah1, bl2) | 0; + hi = hi + Math.imul(ah1, bh2) | 0; + lo = lo + Math.imul(al0, bl3) | 0; + mid = mid + Math.imul(al0, bh3) | 0; + mid = mid + Math.imul(ah0, bl3) | 0; + hi = hi + Math.imul(ah0, bh3) | 0; + var w3 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = mid + Math.imul(ah4, bl0) | 0; + hi = Math.imul(ah4, bh0); + lo = lo + Math.imul(al3, bl1) | 0; + mid = mid + Math.imul(al3, bh1) | 0; + mid = mid + Math.imul(ah3, bl1) | 0; + hi = hi + Math.imul(ah3, bh1) | 0; + lo = lo + Math.imul(al2, bl2) | 0; + mid = mid + Math.imul(al2, bh2) | 0; + mid = mid + Math.imul(ah2, bl2) | 0; + hi = hi + Math.imul(ah2, bh2) | 0; + lo = lo + Math.imul(al1, bl3) | 0; + mid = mid + Math.imul(al1, bh3) | 0; + mid = mid + Math.imul(ah1, bl3) | 0; + hi = hi + Math.imul(ah1, bh3) | 0; + lo = lo + Math.imul(al0, bl4) | 0; + mid = mid + Math.imul(al0, bh4) | 0; + mid = mid + Math.imul(ah0, bl4) | 0; + hi = hi + Math.imul(ah0, bh4) | 0; + var w4 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = mid + Math.imul(ah5, bl0) | 0; + hi = Math.imul(ah5, bh0); + lo = lo + Math.imul(al4, bl1) | 0; + mid = mid + Math.imul(al4, bh1) | 0; + mid = mid + Math.imul(ah4, bl1) | 0; + hi = hi + Math.imul(ah4, bh1) | 0; + lo = lo + Math.imul(al3, bl2) | 0; + mid = mid + Math.imul(al3, bh2) | 0; + mid = mid + Math.imul(ah3, bl2) | 0; + hi = hi + Math.imul(ah3, bh2) | 0; + lo = lo + Math.imul(al2, bl3) | 0; + mid = mid + Math.imul(al2, bh3) | 0; + mid = mid + Math.imul(ah2, bl3) | 0; + hi = hi + Math.imul(ah2, bh3) | 0; + lo = lo + Math.imul(al1, bl4) | 0; + mid = mid + Math.imul(al1, bh4) | 0; + mid = mid + Math.imul(ah1, bl4) | 0; + hi = hi + Math.imul(ah1, bh4) | 0; + lo = lo + Math.imul(al0, bl5) | 0; + mid = mid + Math.imul(al0, bh5) | 0; + mid = mid + Math.imul(ah0, bl5) | 0; + hi = hi + Math.imul(ah0, bh5) | 0; + var w5 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = mid + Math.imul(ah6, bl0) | 0; + hi = Math.imul(ah6, bh0); + lo = lo + Math.imul(al5, bl1) | 0; + mid = mid + Math.imul(al5, bh1) | 0; + mid = mid + Math.imul(ah5, bl1) | 0; + hi = hi + Math.imul(ah5, bh1) | 0; + lo = lo + Math.imul(al4, bl2) | 0; + mid = mid + Math.imul(al4, bh2) | 0; + mid = mid + Math.imul(ah4, bl2) | 0; + hi = hi + Math.imul(ah4, bh2) | 0; + lo = lo + Math.imul(al3, bl3) | 0; + mid = mid + Math.imul(al3, bh3) | 0; + mid = mid + Math.imul(ah3, bl3) | 0; + hi = hi + Math.imul(ah3, bh3) | 0; + lo = lo + Math.imul(al2, bl4) | 0; + mid = mid + Math.imul(al2, bh4) | 0; + mid = mid + Math.imul(ah2, bl4) | 0; + hi = hi + Math.imul(ah2, bh4) | 0; + lo = lo + Math.imul(al1, bl5) | 0; + mid = mid + Math.imul(al1, bh5) | 0; + mid = mid + Math.imul(ah1, bl5) | 0; + hi = hi + Math.imul(ah1, bh5) | 0; + lo = lo + Math.imul(al0, bl6) | 0; + mid = mid + Math.imul(al0, bh6) | 0; + mid = mid + Math.imul(ah0, bl6) | 0; + hi = hi + Math.imul(ah0, bh6) | 0; + var w6 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = mid + Math.imul(ah7, bl0) | 0; + hi = Math.imul(ah7, bh0); + lo = lo + Math.imul(al6, bl1) | 0; + mid = mid + Math.imul(al6, bh1) | 0; + mid = mid + Math.imul(ah6, bl1) | 0; + hi = hi + Math.imul(ah6, bh1) | 0; + lo = lo + Math.imul(al5, bl2) | 0; + mid = mid + Math.imul(al5, bh2) | 0; + mid = mid + Math.imul(ah5, bl2) | 0; + hi = hi + Math.imul(ah5, bh2) | 0; + lo = lo + Math.imul(al4, bl3) | 0; + mid = mid + Math.imul(al4, bh3) | 0; + mid = mid + Math.imul(ah4, bl3) | 0; + hi = hi + Math.imul(ah4, bh3) | 0; + lo = lo + Math.imul(al3, bl4) | 0; + mid = mid + Math.imul(al3, bh4) | 0; + mid = mid + Math.imul(ah3, bl4) | 0; + hi = hi + Math.imul(ah3, bh4) | 0; + lo = lo + Math.imul(al2, bl5) | 0; + mid = mid + Math.imul(al2, bh5) | 0; + mid = mid + Math.imul(ah2, bl5) | 0; + hi = hi + Math.imul(ah2, bh5) | 0; + lo = lo + Math.imul(al1, bl6) | 0; + mid = mid + Math.imul(al1, bh6) | 0; + mid = mid + Math.imul(ah1, bl6) | 0; + hi = hi + Math.imul(ah1, bh6) | 0; + lo = lo + Math.imul(al0, bl7) | 0; + mid = mid + Math.imul(al0, bh7) | 0; + mid = mid + Math.imul(ah0, bl7) | 0; + hi = hi + Math.imul(ah0, bh7) | 0; + var w7 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = mid + Math.imul(ah8, bl0) | 0; + hi = Math.imul(ah8, bh0); + lo = lo + Math.imul(al7, bl1) | 0; + mid = mid + Math.imul(al7, bh1) | 0; + mid = mid + Math.imul(ah7, bl1) | 0; + hi = hi + Math.imul(ah7, bh1) | 0; + lo = lo + Math.imul(al6, bl2) | 0; + mid = mid + Math.imul(al6, bh2) | 0; + mid = mid + Math.imul(ah6, bl2) | 0; + hi = hi + Math.imul(ah6, bh2) | 0; + lo = lo + Math.imul(al5, bl3) | 0; + mid = mid + Math.imul(al5, bh3) | 0; + mid = mid + Math.imul(ah5, bl3) | 0; + hi = hi + Math.imul(ah5, bh3) | 0; + lo = lo + Math.imul(al4, bl4) | 0; + mid = mid + Math.imul(al4, bh4) | 0; + mid = mid + Math.imul(ah4, bl4) | 0; + hi = hi + Math.imul(ah4, bh4) | 0; + lo = lo + Math.imul(al3, bl5) | 0; + mid = mid + Math.imul(al3, bh5) | 0; + mid = mid + Math.imul(ah3, bl5) | 0; + hi = hi + Math.imul(ah3, bh5) | 0; + lo = lo + Math.imul(al2, bl6) | 0; + mid = mid + Math.imul(al2, bh6) | 0; + mid = mid + Math.imul(ah2, bl6) | 0; + hi = hi + Math.imul(ah2, bh6) | 0; + lo = lo + Math.imul(al1, bl7) | 0; + mid = mid + Math.imul(al1, bh7) | 0; + mid = mid + Math.imul(ah1, bl7) | 0; + hi = hi + Math.imul(ah1, bh7) | 0; + lo = lo + Math.imul(al0, bl8) | 0; + mid = mid + Math.imul(al0, bh8) | 0; + mid = mid + Math.imul(ah0, bl8) | 0; + hi = hi + Math.imul(ah0, bh8) | 0; + var w8 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = mid + Math.imul(ah9, bl0) | 0; + hi = Math.imul(ah9, bh0); + lo = lo + Math.imul(al8, bl1) | 0; + mid = mid + Math.imul(al8, bh1) | 0; + mid = mid + Math.imul(ah8, bl1) | 0; + hi = hi + Math.imul(ah8, bh1) | 0; + lo = lo + Math.imul(al7, bl2) | 0; + mid = mid + Math.imul(al7, bh2) | 0; + mid = mid + Math.imul(ah7, bl2) | 0; + hi = hi + Math.imul(ah7, bh2) | 0; + lo = lo + Math.imul(al6, bl3) | 0; + mid = mid + Math.imul(al6, bh3) | 0; + mid = mid + Math.imul(ah6, bl3) | 0; + hi = hi + Math.imul(ah6, bh3) | 0; + lo = lo + Math.imul(al5, bl4) | 0; + mid = mid + Math.imul(al5, bh4) | 0; + mid = mid + Math.imul(ah5, bl4) | 0; + hi = hi + Math.imul(ah5, bh4) | 0; + lo = lo + Math.imul(al4, bl5) | 0; + mid = mid + Math.imul(al4, bh5) | 0; + mid = mid + Math.imul(ah4, bl5) | 0; + hi = hi + Math.imul(ah4, bh5) | 0; + lo = lo + Math.imul(al3, bl6) | 0; + mid = mid + Math.imul(al3, bh6) | 0; + mid = mid + Math.imul(ah3, bl6) | 0; + hi = hi + Math.imul(ah3, bh6) | 0; + lo = lo + Math.imul(al2, bl7) | 0; + mid = mid + Math.imul(al2, bh7) | 0; + mid = mid + Math.imul(ah2, bl7) | 0; + hi = hi + Math.imul(ah2, bh7) | 0; + lo = lo + Math.imul(al1, bl8) | 0; + mid = mid + Math.imul(al1, bh8) | 0; + mid = mid + Math.imul(ah1, bl8) | 0; + hi = hi + Math.imul(ah1, bh8) | 0; + lo = lo + Math.imul(al0, bl9) | 0; + mid = mid + Math.imul(al0, bh9) | 0; + mid = mid + Math.imul(ah0, bl9) | 0; + hi = hi + Math.imul(ah0, bh9) | 0; + var w9 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = mid + Math.imul(ah9, bl1) | 0; + hi = Math.imul(ah9, bh1); + lo = lo + Math.imul(al8, bl2) | 0; + mid = mid + Math.imul(al8, bh2) | 0; + mid = mid + Math.imul(ah8, bl2) | 0; + hi = hi + Math.imul(ah8, bh2) | 0; + lo = lo + Math.imul(al7, bl3) | 0; + mid = mid + Math.imul(al7, bh3) | 0; + mid = mid + Math.imul(ah7, bl3) | 0; + hi = hi + Math.imul(ah7, bh3) | 0; + lo = lo + Math.imul(al6, bl4) | 0; + mid = mid + Math.imul(al6, bh4) | 0; + mid = mid + Math.imul(ah6, bl4) | 0; + hi = hi + Math.imul(ah6, bh4) | 0; + lo = lo + Math.imul(al5, bl5) | 0; + mid = mid + Math.imul(al5, bh5) | 0; + mid = mid + Math.imul(ah5, bl5) | 0; + hi = hi + Math.imul(ah5, bh5) | 0; + lo = lo + Math.imul(al4, bl6) | 0; + mid = mid + Math.imul(al4, bh6) | 0; + mid = mid + Math.imul(ah4, bl6) | 0; + hi = hi + Math.imul(ah4, bh6) | 0; + lo = lo + Math.imul(al3, bl7) | 0; + mid = mid + Math.imul(al3, bh7) | 0; + mid = mid + Math.imul(ah3, bl7) | 0; + hi = hi + Math.imul(ah3, bh7) | 0; + lo = lo + Math.imul(al2, bl8) | 0; + mid = mid + Math.imul(al2, bh8) | 0; + mid = mid + Math.imul(ah2, bl8) | 0; + hi = hi + Math.imul(ah2, bh8) | 0; + lo = lo + Math.imul(al1, bl9) | 0; + mid = mid + Math.imul(al1, bh9) | 0; + mid = mid + Math.imul(ah1, bl9) | 0; + hi = hi + Math.imul(ah1, bh9) | 0; + var w10 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = mid + Math.imul(ah9, bl2) | 0; + hi = Math.imul(ah9, bh2); + lo = lo + Math.imul(al8, bl3) | 0; + mid = mid + Math.imul(al8, bh3) | 0; + mid = mid + Math.imul(ah8, bl3) | 0; + hi = hi + Math.imul(ah8, bh3) | 0; + lo = lo + Math.imul(al7, bl4) | 0; + mid = mid + Math.imul(al7, bh4) | 0; + mid = mid + Math.imul(ah7, bl4) | 0; + hi = hi + Math.imul(ah7, bh4) | 0; + lo = lo + Math.imul(al6, bl5) | 0; + mid = mid + Math.imul(al6, bh5) | 0; + mid = mid + Math.imul(ah6, bl5) | 0; + hi = hi + Math.imul(ah6, bh5) | 0; + lo = lo + Math.imul(al5, bl6) | 0; + mid = mid + Math.imul(al5, bh6) | 0; + mid = mid + Math.imul(ah5, bl6) | 0; + hi = hi + Math.imul(ah5, bh6) | 0; + lo = lo + Math.imul(al4, bl7) | 0; + mid = mid + Math.imul(al4, bh7) | 0; + mid = mid + Math.imul(ah4, bl7) | 0; + hi = hi + Math.imul(ah4, bh7) | 0; + lo = lo + Math.imul(al3, bl8) | 0; + mid = mid + Math.imul(al3, bh8) | 0; + mid = mid + Math.imul(ah3, bl8) | 0; + hi = hi + Math.imul(ah3, bh8) | 0; + lo = lo + Math.imul(al2, bl9) | 0; + mid = mid + Math.imul(al2, bh9) | 0; + mid = mid + Math.imul(ah2, bl9) | 0; + hi = hi + Math.imul(ah2, bh9) | 0; + var w11 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = mid + Math.imul(ah9, bl3) | 0; + hi = Math.imul(ah9, bh3); + lo = lo + Math.imul(al8, bl4) | 0; + mid = mid + Math.imul(al8, bh4) | 0; + mid = mid + Math.imul(ah8, bl4) | 0; + hi = hi + Math.imul(ah8, bh4) | 0; + lo = lo + Math.imul(al7, bl5) | 0; + mid = mid + Math.imul(al7, bh5) | 0; + mid = mid + Math.imul(ah7, bl5) | 0; + hi = hi + Math.imul(ah7, bh5) | 0; + lo = lo + Math.imul(al6, bl6) | 0; + mid = mid + Math.imul(al6, bh6) | 0; + mid = mid + Math.imul(ah6, bl6) | 0; + hi = hi + Math.imul(ah6, bh6) | 0; + lo = lo + Math.imul(al5, bl7) | 0; + mid = mid + Math.imul(al5, bh7) | 0; + mid = mid + Math.imul(ah5, bl7) | 0; + hi = hi + Math.imul(ah5, bh7) | 0; + lo = lo + Math.imul(al4, bl8) | 0; + mid = mid + Math.imul(al4, bh8) | 0; + mid = mid + Math.imul(ah4, bl8) | 0; + hi = hi + Math.imul(ah4, bh8) | 0; + lo = lo + Math.imul(al3, bl9) | 0; + mid = mid + Math.imul(al3, bh9) | 0; + mid = mid + Math.imul(ah3, bl9) | 0; + hi = hi + Math.imul(ah3, bh9) | 0; + var w12 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = mid + Math.imul(ah9, bl4) | 0; + hi = Math.imul(ah9, bh4); + lo = lo + Math.imul(al8, bl5) | 0; + mid = mid + Math.imul(al8, bh5) | 0; + mid = mid + Math.imul(ah8, bl5) | 0; + hi = hi + Math.imul(ah8, bh5) | 0; + lo = lo + Math.imul(al7, bl6) | 0; + mid = mid + Math.imul(al7, bh6) | 0; + mid = mid + Math.imul(ah7, bl6) | 0; + hi = hi + Math.imul(ah7, bh6) | 0; + lo = lo + Math.imul(al6, bl7) | 0; + mid = mid + Math.imul(al6, bh7) | 0; + mid = mid + Math.imul(ah6, bl7) | 0; + hi = hi + Math.imul(ah6, bh7) | 0; + lo = lo + Math.imul(al5, bl8) | 0; + mid = mid + Math.imul(al5, bh8) | 0; + mid = mid + Math.imul(ah5, bl8) | 0; + hi = hi + Math.imul(ah5, bh8) | 0; + lo = lo + Math.imul(al4, bl9) | 0; + mid = mid + Math.imul(al4, bh9) | 0; + mid = mid + Math.imul(ah4, bl9) | 0; + hi = hi + Math.imul(ah4, bh9) | 0; + var w13 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = mid + Math.imul(ah9, bl5) | 0; + hi = Math.imul(ah9, bh5); + lo = lo + Math.imul(al8, bl6) | 0; + mid = mid + Math.imul(al8, bh6) | 0; + mid = mid + Math.imul(ah8, bl6) | 0; + hi = hi + Math.imul(ah8, bh6) | 0; + lo = lo + Math.imul(al7, bl7) | 0; + mid = mid + Math.imul(al7, bh7) | 0; + mid = mid + Math.imul(ah7, bl7) | 0; + hi = hi + Math.imul(ah7, bh7) | 0; + lo = lo + Math.imul(al6, bl8) | 0; + mid = mid + Math.imul(al6, bh8) | 0; + mid = mid + Math.imul(ah6, bl8) | 0; + hi = hi + Math.imul(ah6, bh8) | 0; + lo = lo + Math.imul(al5, bl9) | 0; + mid = mid + Math.imul(al5, bh9) | 0; + mid = mid + Math.imul(ah5, bl9) | 0; + hi = hi + Math.imul(ah5, bh9) | 0; + var w14 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = mid + Math.imul(ah9, bl6) | 0; + hi = Math.imul(ah9, bh6); + lo = lo + Math.imul(al8, bl7) | 0; + mid = mid + Math.imul(al8, bh7) | 0; + mid = mid + Math.imul(ah8, bl7) | 0; + hi = hi + Math.imul(ah8, bh7) | 0; + lo = lo + Math.imul(al7, bl8) | 0; + mid = mid + Math.imul(al7, bh8) | 0; + mid = mid + Math.imul(ah7, bl8) | 0; + hi = hi + Math.imul(ah7, bh8) | 0; + lo = lo + Math.imul(al6, bl9) | 0; + mid = mid + Math.imul(al6, bh9) | 0; + mid = mid + Math.imul(ah6, bl9) | 0; + hi = hi + Math.imul(ah6, bh9) | 0; + var w15 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = mid + Math.imul(ah9, bl7) | 0; + hi = Math.imul(ah9, bh7); + lo = lo + Math.imul(al8, bl8) | 0; + mid = mid + Math.imul(al8, bh8) | 0; + mid = mid + Math.imul(ah8, bl8) | 0; + hi = hi + Math.imul(ah8, bh8) | 0; + lo = lo + Math.imul(al7, bl9) | 0; + mid = mid + Math.imul(al7, bh9) | 0; + mid = mid + Math.imul(ah7, bl9) | 0; + hi = hi + Math.imul(ah7, bh9) | 0; + var w16 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = mid + Math.imul(ah9, bl8) | 0; + hi = Math.imul(ah9, bh8); + lo = lo + Math.imul(al8, bl9) | 0; + mid = mid + Math.imul(al8, bh9) | 0; + mid = mid + Math.imul(ah8, bl9) | 0; + hi = hi + Math.imul(ah8, bh9) | 0; + var w17 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = mid + Math.imul(ah9, bl9) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (c + lo | 0) + ((mid & 0x1fff) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + + if (c !== 0) { + o[19] = c; + out.length++; + } + + return out; + }; // Polyfill comb + + + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo(self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + var carry = 0; + var hncarry = 0; + + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + var lo = r & 0x3ffffff; + ncarry = ncarry + (r / 0x4000000 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 0x3ffffff; + ncarry = ncarry + (lo >>> 26) | 0; + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo(self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo(num, out) { + var res; + var len = this.length + num.length; + + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + + function FFTM(x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT(N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; // Returns binary-reversed representation of `x` + + + FFTM.prototype.revBin = function revBin(x, l, N) { + if (x === 0 || x === N - 1) return x; + var rb = 0; + + for (var i = 0; i < l; i++) { + rb |= (x & 1) << l - i - 1; + x >>= 1; + } + + return rb; + }; // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + + + FFTM.prototype.permute = function permute(rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform(rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + var rx = rtwdf_ * ro - itwdf_ * io; + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + /* jshint maxdepth : false */ + + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b(n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate(rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + t = iws[i]; + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b(ws, N) { + var carry = 0; + + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + Math.round(ws[2 * i] / N) + carry; + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b(ws, len, rws, N) { + var carry = 0; + + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + rws[2 * i] = carry & 0x1fff; + carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; + carry = carry >>> 13; + } // Pad with zeroes + + + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub(N) { + var ph = new Array(N); + + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp(x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + var rmws = out.words; + rmws.length = N; + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; // Multiply `this` by `num` + + + BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; // Multiply employing FFT + + + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; // In-place Multiplication + + + BN.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); // Carry + + var carry = 0; + + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += w / 0x4000000 | 0; // NOTE: lo is 27bit maximum + + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; // `this` * `this` + + + BN.prototype.sqr = function sqr() { + return this.mul(this); + }; // `this` * `this` in-place + + + BN.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; // Math.pow(`this`, `num`) + + + BN.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); // Skip leading zeroes + + var res = this; + + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + res = res.mul(q); + } + } + + return res; + }; // Shift-left in-place + + + BN.prototype.iushln = function iushln(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = 0x3ffffff >>> 26 - r << 26 - r; + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = (this.words[i] | 0) - newCarry << r; + this.words[i] = c | carry; + carry = newCarry >>> 26 - r; + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln(bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + + + BN.prototype.iushrn = function iushrn(bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + + if (hint) { + h = (hint - hint % 26) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; + var maskedWords = extended; + h -= s; + h = Math.max(0, h); // Extended mode, copy masked part + + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + + maskedWords.length = s; + } + + if (s === 0) {// No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = carry << 26 - r | word >>> r; + carry = word & mask; + } // Push carried bits as a mask + + + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn(bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; // Shift-left + + + BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; // Shift-right + + + BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; // Test if n bit is set + + + BN.prototype.testn = function testn(bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; // Fast case: bit is much higher than all existing words + + if (this.length <= s) return false; // Check bit and return + + var w = this.words[s]; + return !!(w & q); + }; // Return only lowers bits of number (in-place) + + + BN.prototype.imaskn = function imaskn(bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ 0x3ffffff >>> r << r; + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; // Return only lowers bits of number + + + BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; // Add plain number `num` to `this` + + + BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); // Possible sign change + + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } // Add without checks + + + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; // Carry + + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + + this.length = Math.max(this.length, i + 1); + return this; + }; // Subtract plain number `num` from `this` + + + BN.prototype.isubn = function isubn(num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn(num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn(num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs() { + this.negative = 0; + return this; + }; + + BN.prototype.abs = function abs() { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul(num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - (right / 0x4000000 | 0); + this.words[i + shift] = w & 0x3ffffff; + } + + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); // Subtraction overflow + + assert(carry === -1); + carry = 0; + + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + + this.negative = 1; + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv(num, mode) { + var shift = this.length - num.length; + var a = this.clone(); + var b = num; // Normalize + + var bhi = b.words[b.length - 1] | 0; + + var bhiBits = this._countBits(bhi); + + shift = 26 - bhiBits; + + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } // Initialize quotient + + + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + + if (diff.negative === 0) { + a = diff; + + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + (a.words[b.length + j - 1] | 0); // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + + qj = Math.min(qj / bhi | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + + while (a.negative !== 0) { + qj--; + a.negative = 0; + + a._ishlnsubmul(b, 1, j); + + if (!a.isZero()) { + a.negative ^= 1; + } + } + + if (q) { + q.words[j] = qj; + } + } + + if (q) { + q.strip(); + } + + a.strip(); // Denormalize + + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + + + BN.prototype.divmod = function divmod(num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } // Both numbers are positive at this point + // Strip both numbers to approximate shift value + + + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } // Very short reduction + + + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; // Find `this` / `num` + + + BN.prototype.div = function div(num) { + return this.divmod(num, 'div', false).div; + }; // Find `this` % `num` + + + BN.prototype.mod = function mod(num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod(num) { + return this.divmod(num, 'mod', true).mod; + }; // Find Round(`this` / `num`) + + + BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); // Fast case - exact division + + if (dm.mod.isZero()) return dm.div; + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); // Round down + + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; // Round up + + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn(num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + var acc = 0; + + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; // In-place division by number + + + BN.prototype.idivn = function idivn(num) { + assert(num <= 0x3ffffff); + var carry = 0; + + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = w / num | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn(num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd(p) { + assert(p.negative === 0); + assert(!p.isZero()); + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } // A * x + B * y = x + + + var A = new BN(1); + var B = new BN(0); // C * x + D * y = y + + var C = new BN(0); + var D = new BN(1); + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) { + ; + } + + if (i > 0) { + x.iushrn(i); + + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) { + ; + } + + if (j > 0) { + y.iushrn(j); + + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + + + BN.prototype._invmp = function _invmp(p) { + assert(p.negative === 0); + assert(!p.isZero()); + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1) { + ; + } + + if (i > 0) { + a.iushrn(i); + + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1) { + ; + } + + if (j > 0) { + b.iushrn(j); + + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd(num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; // Remove common factor of two + + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; // Invert number in the field F(num) + + + BN.prototype.invm = function invm(num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven() { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd() { + return (this.words[0] & 1) === 1; + }; // And first word and num + + + BN.prototype.andln = function andln(num) { + return this.words[0] & num; + }; // Increment at the bit position in-line + + + BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; // Fast case: bit is much higher than all existing words + + if (this.length <= s) { + this._expand(s + 1); + + this.words[s] |= q; + return this; + } // Add bit and propagate, if needed + + + var carry = q; + + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.isZero = function isZero() { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn(num) { + var negative = num < 0; + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + this.strip(); + var res; + + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + + if (this.negative !== 0) return -res | 0; + return res; + }; // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + + + BN.prototype.cmp = function cmp(num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; // Unsigned comparison + + + BN.prototype.ucmp = function ucmp(num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + var res = 0; + + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + if (a === b) continue; + + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + + break; + } + + return res; + }; + + BN.prototype.gtn = function gtn(num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt(num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten(num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte(num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn(num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt(num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten(num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte(num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn(num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq(num) { + return this.cmp(num) === 0; + }; // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + + + BN.red = function red(num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed() { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed(ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed(ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd(num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd(num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub(num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub(num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl(num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul(num) { + assert(this.red, 'redMul works only with red numbers'); + + this.red._verify2(this, num); + + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul(num) { + assert(this.red, 'redMul works only with red numbers'); + + this.red._verify2(this, num); + + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr() { + assert(this.red, 'redSqr works only with red numbers'); + + this.red._verify1(this); + + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr() { + assert(this.red, 'redISqr works only with red numbers'); + + this.red._verify1(this); + + return this.red.isqr(this); + }; // Square root over p + + + BN.prototype.redSqrt = function redSqrt() { + assert(this.red, 'redSqrt works only with red numbers'); + + this.red._verify1(this); + + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm() { + assert(this.red, 'redInvm works only with red numbers'); + + this.red._verify1(this); + + return this.red.invm(this); + }; // Return negative clone of `this` % `red modulo` + + + BN.prototype.redNeg = function redNeg() { + assert(this.red, 'redNeg works only with red numbers'); + + this.red._verify1(this); + + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow(num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + + this.red._verify1(this); + + return this.red.pow(this, num); + }; // Prime numbers with efficient reduction + + + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; // Pseudo-Mersenne prime + + function MPrime(name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp() { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce(num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split(input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK(num) { + return num.imul(this.k); + }; + + function K256() { + MPrime.call(this, 'k256', 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + + inherits(K256, MPrime); + + K256.prototype.split = function split(input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + var outLen = Math.min(input.length, 9); + + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } // Shift by 9 limbs + + + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = (next & mask) << 4 | prev >>> 22; + prev = next; + } + + prev >>>= 22; + input.words[i - 10] = prev; + + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK(num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + + var lo = 0; + + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + (lo / 0x4000000 | 0); + } // Fast length reduction + + + if (num.words[num.length - 1] === 0) { + num.length--; + + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + + return num; + }; + + function P224() { + MPrime.call(this, 'p224', 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + + inherits(P224, MPrime); + + function P192() { + MPrime.call(this, 'p192', 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + + inherits(P192, MPrime); + + function P25519() { + // 2 ^ 255 - 19 + MPrime.call(this, '25519', '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK(num) { + // K = 0x13 + var carry = 0; + + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + num.words[i] = lo; + carry = hi; + } + + if (carry !== 0) { + num.words[num.length++] = carry; + } + + return num; + }; // Exported mostly for testing purposes, use plain name instead + + + BN._prime = function prime(name) { + // Cached version of prime + if (primes[name]) return primes[name]; + var prime; + + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + + primes[name] = prime; + return prime; + }; // + // Base reduction engine + // + + + function Red(m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1(a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2(a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod(a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg(a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add(a, b) { + this._verify2(a, b); + + var res = a.add(b); + + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd(a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + + return res; + }; + + Red.prototype.sub = function sub(a, b) { + this._verify2(a, b); + + var res = a.sub(b); + + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + + return res._forceRed(this); + }; + + Red.prototype.isub = function isub(a, b) { + this._verify2(a, b); + + var res = a.isub(b); + + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + + return res; + }; + + Red.prototype.shl = function shl(a, num) { + this._verify1(a); + + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul(a, b) { + this._verify2(a, b); + + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul(a, b) { + this._verify2(a, b); + + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr(a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr(a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt(a) { + if (a.isZero()) return a.clone(); + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); // Fast case + + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + + + var q = this.m.subn(1); + var s = 0; + + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + + assert(!q.isZero()); + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + + while (t.cmp(one) !== 0) { + var tmp = t; + + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm(a) { + var inv = a._invmp(this.m); + + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow(a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + + for (var j = start - 1; j >= 0; j--) { + var bit = word >> j & 1; + + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo(num) { + var r = num.umod(this.m); + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom(num) { + var res = num.clone(); + res.red = null; + return res; + }; // + // Montgomery method engine + // + + + BN.mont = function mont(num) { + return new Mont(num); + }; + + function Mont(m) { + Red.call(this, m); + this.shift = this.m.bitLength(); + + if (this.shift % 26 !== 0) { + this.shift += 26 - this.shift % 26; + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo(num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom(num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul(a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul(a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm(a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) + +/***/ }), + +/***/ "./node_modules/buffer/index.js": +/*!**************************************!*\ + !*** ./node_modules/buffer/index.js ***! + \**************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +/* eslint-disable no-proto */ + + +var base64 = __webpack_require__(/*! base64-js */ "./node_modules/base64-js/index.js"); + +var ieee754 = __webpack_require__(/*! ieee754 */ "./node_modules/ieee754/index.js"); + +var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js"); + +exports.Buffer = Buffer; +exports.SlowBuffer = SlowBuffer; +exports.INSPECT_MAX_BYTES = 50; +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ + +Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined ? global.TYPED_ARRAY_SUPPORT : typedArraySupport(); +/* + * Export kMaxLength after typed array support is determined. + */ + +exports.kMaxLength = kMaxLength(); + +function typedArraySupport() { + try { + var arr = new Uint8Array(1); + arr.__proto__ = { + __proto__: Uint8Array.prototype, + foo: function foo() { + return 42; + } + }; + return arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0; // ie10 has broken `subarray` + } catch (e) { + return false; + } +} + +function kMaxLength() { + return Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff; +} + +function createBuffer(that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length'); + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length); + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length); + } + + that.length = length; + } + + return that; +} +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + + +function Buffer(arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length); + } // Common case. + + + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error('If encoding is specified then the first argument must be a string'); + } + + return allocUnsafe(this, arg); + } + + return from(this, arg, encodingOrOffset, length); +} + +Buffer.poolSize = 8192; // not used by this implementation +// TODO: Legacy, not needed anymore. Remove in next major version. + +Buffer._augment = function (arr) { + arr.__proto__ = Buffer.prototype; + return arr; +}; + +function from(that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length); + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset); + } + + return fromObject(that, value); +} +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ + + +Buffer.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length); +}; + +if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype; + Buffer.__proto__ = Uint8Array; + + if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true + }); + } +} + +function assertSize(size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number'); + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative'); + } +} + +function alloc(that, size, fill, encoding) { + assertSize(size); + + if (size <= 0) { + return createBuffer(that, size); + } + + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' ? createBuffer(that, size).fill(fill, encoding) : createBuffer(that, size).fill(fill); + } + + return createBuffer(that, size); +} +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ + + +Buffer.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding); +}; + +function allocUnsafe(that, size) { + assertSize(size); + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0); + + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0; + } + } + + return that; +} +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ + + +Buffer.allocUnsafe = function (size) { + return allocUnsafe(null, size); +}; +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ + + +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size); +}; + +function fromString(that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8'; + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding'); + } + + var length = byteLength(string, encoding) | 0; + that = createBuffer(that, length); + var actual = that.write(string, encoding); + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual); + } + + return that; +} + +function fromArrayLike(that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0; + that = createBuffer(that, length); + + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255; + } + + return that; +} + +function fromArrayBuffer(that, array, byteOffset, length) { + array.byteLength; // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds'); + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds'); + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array); + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset); + } else { + array = new Uint8Array(array, byteOffset, length); + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array; + that.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array); + } + + return that; +} + +function fromObject(that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0; + that = createBuffer(that, len); + + if (that.length === 0) { + return that; + } + + obj.copy(that, 0, 0, len); + return that; + } + + if (obj) { + if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0); + } + + return fromArrayLike(that, obj); + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.'); +} + +function checked(length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + kMaxLength().toString(16) + ' bytes'); + } + + return length | 0; +} + +function SlowBuffer(length) { + if (+length != length) { + // eslint-disable-line eqeqeq + length = 0; + } + + return Buffer.alloc(+length); +} + +Buffer.isBuffer = function isBuffer(b) { + return !!(b != null && b._isBuffer); +}; + +Buffer.compare = function compare(a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers'); + } + + if (a === b) return 0; + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; +}; + +Buffer.isEncoding = function isEncoding(encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true; + + default: + return false; + } +}; + +Buffer.concat = function concat(list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + + if (list.length === 0) { + return Buffer.alloc(0); + } + + var i; + + if (length === undefined) { + length = 0; + + for (i = 0; i < list.length; ++i) { + length += list[i].length; + } + } + + var buffer = Buffer.allocUnsafe(length); + var pos = 0; + + for (i = 0; i < list.length; ++i) { + var buf = list[i]; + + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + + buf.copy(buffer, pos); + pos += buf.length; + } + + return buffer; +}; + +function byteLength(string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length; + } + + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength; + } + + if (typeof string !== 'string') { + string = '' + string; + } + + var len = string.length; + if (len === 0) return 0; // Use a for loop to avoid recursion + + var loweredCase = false; + + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len; + + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length; + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2; + + case 'hex': + return len >>> 1; + + case 'base64': + return base64ToBytes(string).length; + + default: + if (loweredCase) return utf8ToBytes(string).length; // assume utf8 + + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } +} + +Buffer.byteLength = byteLength; + +function slowToString(encoding, start, end) { + var loweredCase = false; // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + + if (start === undefined || start < 0) { + start = 0; + } // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + + + if (start > this.length) { + return ''; + } + + if (end === undefined || end > this.length) { + end = this.length; + } + + if (end <= 0) { + return ''; + } // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + + + end >>>= 0; + start >>>= 0; + + if (end <= start) { + return ''; + } + + if (!encoding) encoding = 'utf8'; + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end); + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end); + + case 'ascii': + return asciiSlice(this, start, end); + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end); + + case 'base64': + return base64Slice(this, start, end); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end); + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); + encoding = (encoding + '').toLowerCase(); + loweredCase = true; + } + } +} // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect +// Buffer instances. + + +Buffer.prototype._isBuffer = true; + +function swap(b, n, m) { + var i = b[n]; + b[n] = b[m]; + b[m] = i; +} + +Buffer.prototype.swap16 = function swap16() { + var len = this.length; + + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits'); + } + + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1); + } + + return this; +}; + +Buffer.prototype.swap32 = function swap32() { + var len = this.length; + + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits'); + } + + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3); + swap(this, i + 1, i + 2); + } + + return this; +}; + +Buffer.prototype.swap64 = function swap64() { + var len = this.length; + + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits'); + } + + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7); + swap(this, i + 1, i + 6); + swap(this, i + 2, i + 5); + swap(this, i + 3, i + 4); + } + + return this; +}; + +Buffer.prototype.toString = function toString() { + var length = this.length | 0; + if (length === 0) return ''; + if (arguments.length === 0) return utf8Slice(this, 0, length); + return slowToString.apply(this, arguments); +}; + +Buffer.prototype.equals = function equals(b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer'); + if (this === b) return true; + return Buffer.compare(this, b) === 0; +}; + +Buffer.prototype.inspect = function inspect() { + var str = ''; + var max = exports.INSPECT_MAX_BYTES; + + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' '); + if (this.length > max) str += ' ... '; + } + + return ''; +}; + +Buffer.prototype.compare = function compare(target, start, end, thisStart, thisEnd) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer'); + } + + if (start === undefined) { + start = 0; + } + + if (end === undefined) { + end = target ? target.length : 0; + } + + if (thisStart === undefined) { + thisStart = 0; + } + + if (thisEnd === undefined) { + thisEnd = this.length; + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index'); + } + + if (thisStart >= thisEnd && start >= end) { + return 0; + } + + if (thisStart >= thisEnd) { + return -1; + } + + if (start >= end) { + return 1; + } + + start >>>= 0; + end >>>= 0; + thisStart >>>= 0; + thisEnd >>>= 0; + if (this === target) return 0; + var x = thisEnd - thisStart; + var y = end - start; + var len = Math.min(x, y); + var thisCopy = this.slice(thisStart, thisEnd); + var targetCopy = target.slice(start, end); + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i]; + y = targetCopy[i]; + break; + } + } + + if (x < y) return -1; + if (y < x) return 1; + return 0; +}; // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf + + +function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1; // Normalize byteOffset + + if (typeof byteOffset === 'string') { + encoding = byteOffset; + byteOffset = 0; + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff; + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000; + } + + byteOffset = +byteOffset; // Coerce to Number. + + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : buffer.length - 1; + } // Normalize byteOffset: negative offsets start from the end of the buffer + + + if (byteOffset < 0) byteOffset = buffer.length + byteOffset; + + if (byteOffset >= buffer.length) { + if (dir) return -1;else byteOffset = buffer.length - 1; + } else if (byteOffset < 0) { + if (dir) byteOffset = 0;else return -1; + } // Normalize val + + + if (typeof val === 'string') { + val = Buffer.from(val, encoding); + } // Finally, search either indexOf (if dir is true) or lastIndexOf + + + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1; + } + + return arrayIndexOf(buffer, val, byteOffset, encoding, dir); + } else if (typeof val === 'number') { + val = val & 0xFF; // Search for a byte value [0-255] + + if (Buffer.TYPED_ARRAY_SUPPORT && typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset); + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset); + } + } + + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir); + } + + throw new TypeError('val must be string, number or Buffer'); +} + +function arrayIndexOf(arr, val, byteOffset, encoding, dir) { + var indexSize = 1; + var arrLength = arr.length; + var valLength = val.length; + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase(); + + if (encoding === 'ucs2' || encoding === 'ucs-2' || encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1; + } + + indexSize = 2; + arrLength /= 2; + valLength /= 2; + byteOffset /= 2; + } + } + + function read(buf, i) { + if (indexSize === 1) { + return buf[i]; + } else { + return buf.readUInt16BE(i * indexSize); + } + } + + var i; + + if (dir) { + var foundIndex = -1; + + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i; + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; + } else { + if (foundIndex !== -1) i -= i - foundIndex; + foundIndex = -1; + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; + + for (i = byteOffset; i >= 0; i--) { + var found = true; + + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false; + break; + } + } + + if (found) return i; + } + } + + return -1; +} + +Buffer.prototype.includes = function includes(val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1; +}; + +Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true); +}; + +Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false); +}; + +function hexWrite(buf, string, offset, length) { + offset = Number(offset) || 0; + var remaining = buf.length - offset; + + if (!length) { + length = remaining; + } else { + length = Number(length); + + if (length > remaining) { + length = remaining; + } + } // must be an even number of digits + + + var strLen = string.length; + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string'); + + if (length > strLen / 2) { + length = strLen / 2; + } + + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16); + if (isNaN(parsed)) return i; + buf[offset + i] = parsed; + } + + return i; +} + +function utf8Write(buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); +} + +function asciiWrite(buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length); +} + +function latin1Write(buf, string, offset, length) { + return asciiWrite(buf, string, offset, length); +} + +function base64Write(buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length); +} + +function ucs2Write(buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length); +} + +Buffer.prototype.write = function write(string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8'; + length = this.length; + offset = 0; // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset; + length = this.length; + offset = 0; // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0; + + if (isFinite(length)) { + length = length | 0; + if (encoding === undefined) encoding = 'utf8'; + } else { + encoding = length; + length = undefined; + } // legacy write(string, encoding, offset, length) - remove in v0.13 + + } else { + throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported'); + } + + var remaining = this.length - offset; + if (length === undefined || length > remaining) length = remaining; + + if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds'); + } + + if (!encoding) encoding = 'utf8'; + var loweredCase = false; + + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length); + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length); + + case 'ascii': + return asciiWrite(this, string, offset, length); + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length); + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length); + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length); + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding); + encoding = ('' + encoding).toLowerCase(); + loweredCase = true; + } + } +}; + +Buffer.prototype.toJSON = function toJSON() { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + }; +}; + +function base64Slice(buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf); + } else { + return base64.fromByteArray(buf.slice(start, end)); + } +} + +function utf8Slice(buf, start, end) { + end = Math.min(buf.length, end); + var res = []; + var i = start; + + while (i < end) { + var firstByte = buf[i]; + var codePoint = null; + var bytesPerSequence = firstByte > 0xEF ? 4 : firstByte > 0xDF ? 3 : firstByte > 0xBF ? 2 : 1; + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint; + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte; + } + + break; + + case 2: + secondByte = buf[i + 1]; + + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | secondByte & 0x3F; + + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint; + } + } + + break; + + case 3: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | thirdByte & 0x3F; + + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint; + } + } + + break; + + case 4: + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + fourthByte = buf[i + 3]; + + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | fourthByte & 0x3F; + + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint; + } + } + + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD; + bytesPerSequence = 1; + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000; + res.push(codePoint >>> 10 & 0x3FF | 0xD800); + codePoint = 0xDC00 | codePoint & 0x3FF; + } + + res.push(codePoint); + i += bytesPerSequence; + } + + return decodeCodePointsArray(res); +} // Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety + + +var MAX_ARGUMENTS_LENGTH = 0x1000; + +function decodeCodePointsArray(codePoints) { + var len = codePoints.length; + + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints); // avoid extra slice() + } // Decode in chunks to avoid "call stack size exceeded". + + + var res = ''; + var i = 0; + + while (i < len) { + res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)); + } + + return res; +} + +function asciiSlice(buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F); + } + + return ret; +} + +function latin1Slice(buf, start, end) { + var ret = ''; + end = Math.min(buf.length, end); + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]); + } + + return ret; +} + +function hexSlice(buf, start, end) { + var len = buf.length; + if (!start || start < 0) start = 0; + if (!end || end < 0 || end > len) end = len; + var out = ''; + + for (var i = start; i < end; ++i) { + out += toHex(buf[i]); + } + + return out; +} + +function utf16leSlice(buf, start, end) { + var bytes = buf.slice(start, end); + var res = ''; + + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256); + } + + return res; +} + +Buffer.prototype.slice = function slice(start, end) { + var len = this.length; + start = ~~start; + end = end === undefined ? len : ~~end; + + if (start < 0) { + start += len; + if (start < 0) start = 0; + } else if (start > len) { + start = len; + } + + if (end < 0) { + end += len; + if (end < 0) end = 0; + } else if (end > len) { + end = len; + } + + if (end < start) end = start; + var newBuf; + + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end); + newBuf.__proto__ = Buffer.prototype; + } else { + var sliceLen = end - start; + newBuf = new Buffer(sliceLen, undefined); + + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start]; + } + } + + return newBuf; +}; +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ + + +function checkOffset(offset, ext, length) { + if (offset % 1 !== 0 || offset < 0) throw new RangeError('offset is not uint'); + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length'); +} + +Buffer.prototype.readUIntLE = function readUIntLE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + var val = this[offset]; + var mul = 1; + var i = 0; + + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + + return val; +}; + +Buffer.prototype.readUIntBE = function readUIntBE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + + if (!noAssert) { + checkOffset(offset, byteLength, this.length); + } + + var val = this[offset + --byteLength]; + var mul = 1; + + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul; + } + + return val; +}; + +Buffer.prototype.readUInt8 = function readUInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + return this[offset]; +}; + +Buffer.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] | this[offset + 1] << 8; +}; + +Buffer.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + return this[offset] << 8 | this[offset + 1]; +}; + +Buffer.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 0x1000000; +}; + +Buffer.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return this[offset] * 0x1000000 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]); +}; + +Buffer.prototype.readIntLE = function readIntLE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + var val = this[offset]; + var mul = 1; + var i = 0; + + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul; + } + + mul *= 0x80; + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + return val; +}; + +Buffer.prototype.readIntBE = function readIntBE(offset, byteLength, noAssert) { + offset = offset | 0; + byteLength = byteLength | 0; + if (!noAssert) checkOffset(offset, byteLength, this.length); + var i = byteLength; + var mul = 1; + var val = this[offset + --i]; + + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul; + } + + mul *= 0x80; + if (val >= mul) val -= Math.pow(2, 8 * byteLength); + return val; +}; + +Buffer.prototype.readInt8 = function readInt8(offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length); + if (!(this[offset] & 0x80)) return this[offset]; + return (0xff - this[offset] + 1) * -1; +}; + +Buffer.prototype.readInt16LE = function readInt16LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset] | this[offset + 1] << 8; + return val & 0x8000 ? val | 0xFFFF0000 : val; +}; + +Buffer.prototype.readInt16BE = function readInt16BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length); + var val = this[offset + 1] | this[offset] << 8; + return val & 0x8000 ? val | 0xFFFF0000 : val; +}; + +Buffer.prototype.readInt32LE = function readInt32LE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24; +}; + +Buffer.prototype.readInt32BE = function readInt32BE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]; +}; + +Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, true, 23, 4); +}; + +Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length); + return ieee754.read(this, offset, false, 23, 4); +}; + +Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, true, 52, 8); +}; + +Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length); + return ieee754.read(this, offset, false, 52, 8); +}; + +function checkInt(buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance'); + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds'); + if (offset + ext > buf.length) throw new RangeError('Index out of range'); +} + +Buffer.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var mul = 1; + var i = 0; + this[offset] = value & 0xFF; + + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = value / mul & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + byteLength = byteLength | 0; + + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1; + checkInt(this, value, offset, byteLength, maxBytes, 0); + } + + var i = byteLength - 1; + var mul = 1; + this[offset + i] = value & 0xFF; + + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = value / mul & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + this[offset] = value & 0xff; + return offset + 1; +}; + +function objectWriteUInt16(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1; + + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & 0xff << 8 * (littleEndian ? i : 1 - i)) >>> (littleEndian ? i : 1 - i) * 8; + } +} + +Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + + return offset + 2; +}; + +Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0); + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + + return offset + 2; +}; + +function objectWriteUInt32(buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1; + + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = value >>> (littleEndian ? i : 3 - i) * 8 & 0xff; + } +} + +Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = value >>> 24; + this[offset + 2] = value >>> 16; + this[offset + 1] = value >>> 8; + this[offset] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, true); + } + + return offset + 4; +}; + +Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0); + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + + return offset + 4; +}; + +Buffer.prototype.writeIntLE = function writeIntLE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = 0; + var mul = 1; + var sub = 0; + this[offset] = value & 0xFF; + + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1; + } + + this[offset + i] = (value / mul >> 0) - sub & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeIntBE = function writeIntBE(value, offset, byteLength, noAssert) { + value = +value; + offset = offset | 0; + + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1); + checkInt(this, value, offset, byteLength, limit - 1, -limit); + } + + var i = byteLength - 1; + var mul = 1; + var sub = 0; + this[offset + i] = value & 0xFF; + + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1; + } + + this[offset + i] = (value / mul >> 0) - sub & 0xFF; + } + + return offset + byteLength; +}; + +Buffer.prototype.writeInt8 = function writeInt8(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80); + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value); + if (value < 0) value = 0xff + value + 1; + this[offset] = value & 0xff; + return offset + 1; +}; + +Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + } else { + objectWriteUInt16(this, value, offset, true); + } + + return offset + 2; +}; + +Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000); + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 8; + this[offset + 1] = value & 0xff; + } else { + objectWriteUInt16(this, value, offset, false); + } + + return offset + 2; +}; + +Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value & 0xff; + this[offset + 1] = value >>> 8; + this[offset + 2] = value >>> 16; + this[offset + 3] = value >>> 24; + } else { + objectWriteUInt32(this, value, offset, true); + } + + return offset + 4; +}; + +Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) { + value = +value; + offset = offset | 0; + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000); + if (value < 0) value = 0xffffffff + value + 1; + + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = value >>> 24; + this[offset + 1] = value >>> 16; + this[offset + 2] = value >>> 8; + this[offset + 3] = value & 0xff; + } else { + objectWriteUInt32(this, value, offset, false); + } + + return offset + 4; +}; + +function checkIEEE754(buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range'); + if (offset < 0) throw new RangeError('Index out of range'); +} + +function writeFloat(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38); + } + + ieee754.write(buf, value, offset, littleEndian, 23, 4); + return offset + 4; +} + +Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert); +}; + +Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert); +}; + +function writeDouble(buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308); + } + + ieee754.write(buf, value, offset, littleEndian, 52, 8); + return offset + 8; +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert); +}; + +Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert); +}; // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) + + +Buffer.prototype.copy = function copy(target, targetStart, start, end) { + if (!start) start = 0; + if (!end && end !== 0) end = this.length; + if (targetStart >= target.length) targetStart = target.length; + if (!targetStart) targetStart = 0; + if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done + + if (end === start) return 0; + if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions + + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds'); + } + + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds'); + if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob? + + if (end > this.length) end = this.length; + + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start; + } + + var len = end - start; + var i; + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start]; + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start]; + } + } else { + Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart); + } + + return len; +}; // Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) + + +Buffer.prototype.fill = function fill(val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start; + start = 0; + end = this.length; + } else if (typeof end === 'string') { + encoding = end; + end = this.length; + } + + if (val.length === 1) { + var code = val.charCodeAt(0); + + if (code < 256) { + val = code; + } + } + + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string'); + } + + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding); + } + } else if (typeof val === 'number') { + val = val & 255; + } // Invalid ranges are not set to a default, so can range check early. + + + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index'); + } + + if (end <= start) { + return this; + } + + start = start >>> 0; + end = end === undefined ? this.length : end >>> 0; + if (!val) val = 0; + var i; + + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val; + } + } else { + var bytes = Buffer.isBuffer(val) ? val : utf8ToBytes(new Buffer(val, encoding).toString()); + var len = bytes.length; + + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len]; + } + } + + return this; +}; // HELPER FUNCTIONS +// ================ + + +var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g; + +function base64clean(str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, ''); // Node converts strings with length < 2 to '' + + if (str.length < 2) return ''; // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + + while (str.length % 4 !== 0) { + str = str + '='; + } + + return str; +} + +function stringtrim(str) { + if (str.trim) return str.trim(); + return str.replace(/^\s+|\s+$/g, ''); +} + +function toHex(n) { + if (n < 16) return '0' + n.toString(16); + return n.toString(16); +} + +function utf8ToBytes(string, units) { + units = units || Infinity; + var codePoint; + var length = string.length; + var leadSurrogate = null; + var bytes = []; + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); // is surrogate component + + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } // valid lead + + + leadSurrogate = codePoint; + continue; + } // 2 leads in a row + + + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + leadSurrogate = codePoint; + continue; + } // valid surrogate pair + + + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + } + + leadSurrogate = null; // encode utf8 + + if (codePoint < 0x80) { + if ((units -= 1) < 0) break; + bytes.push(codePoint); + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break; + bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break; + bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break; + bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else { + throw new Error('Invalid code point'); + } + } + + return bytes; +} + +function asciiToBytes(str) { + var byteArray = []; + + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF); + } + + return byteArray; +} + +function utf16leToBytes(str, units) { + var c, hi, lo; + var byteArray = []; + + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break; + c = str.charCodeAt(i); + hi = c >> 8; + lo = c % 256; + byteArray.push(lo); + byteArray.push(hi); + } + + return byteArray; +} + +function base64ToBytes(str) { + return base64.toByteArray(base64clean(str)); +} + +function blitBuffer(src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if (i + offset >= dst.length || i >= src.length) break; + dst[i + offset] = src[i]; + } + + return i; +} + +function isnan(val) { + return val !== val; // eslint-disable-line no-self-compare +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) + +/***/ }), + +/***/ "./node_modules/copy-to-clipboard/index.js": +/*!*************************************************!*\ + !*** ./node_modules/copy-to-clipboard/index.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var deselectCurrent = __webpack_require__(/*! toggle-selection */ "./node_modules/toggle-selection/index.js"); + +var clipboardToIE11Formatting = { + "text/plain": "Text", + "text/html": "Url", + "default": "Text" +}; +var defaultMessage = "Copy to clipboard: #{key}, Enter"; + +function format(message) { + var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C"; + return message.replace(/#{\s*key\s*}/g, copyKey); +} + +function copy(text, options) { + var debug, + message, + reselectPrevious, + range, + selection, + mark, + success = false; + + if (!options) { + options = {}; + } + + debug = options.debug || false; + + try { + reselectPrevious = deselectCurrent(); + range = document.createRange(); + selection = document.getSelection(); + mark = document.createElement("span"); + mark.textContent = text; // reset user styles for span element + + mark.style.all = "unset"; // prevents scrolling to the end of the page + + mark.style.position = "fixed"; + mark.style.top = 0; + mark.style.clip = "rect(0, 0, 0, 0)"; // used to preserve spaces and line breaks + + mark.style.whiteSpace = "pre"; // do not inherit user-select (it may be `none`) + + mark.style.webkitUserSelect = "text"; + mark.style.MozUserSelect = "text"; + mark.style.msUserSelect = "text"; + mark.style.userSelect = "text"; + mark.addEventListener("copy", function (e) { + e.stopPropagation(); + + if (options.format) { + e.preventDefault(); + + if (typeof e.clipboardData === "undefined") { + // IE 11 + debug && console.warn("unable to use e.clipboardData"); + debug && console.warn("trying IE specific stuff"); + window.clipboardData.clearData(); + var format = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"]; + window.clipboardData.setData(format, text); + } else { + // all other browsers + e.clipboardData.clearData(); + e.clipboardData.setData(options.format, text); + } + } + + if (options.onCopy) { + e.preventDefault(); + options.onCopy(e.clipboardData); + } + }); + document.body.appendChild(mark); + range.selectNodeContents(mark); + selection.addRange(range); + var successful = document.execCommand("copy"); + + if (!successful) { + throw new Error("copy command was unsuccessful"); + } + + success = true; + } catch (err) { + debug && console.error("unable to copy using execCommand: ", err); + debug && console.warn("trying IE specific stuff"); + + try { + window.clipboardData.setData(options.format || "text", text); + options.onCopy && options.onCopy(window.clipboardData); + success = true; + } catch (err) { + debug && console.error("unable to copy using clipboardData: ", err); + debug && console.error("falling back to prompt"); + message = format("message" in options ? options.message : defaultMessage); + window.prompt(message, text); + } + } finally { + if (selection) { + if (typeof selection.removeRange == "function") { + selection.removeRange(range); + } else { + selection.removeAllRanges(); + } + } + + if (mark) { + document.body.removeChild(mark); + } + + reselectPrevious(); + } + + return success; +} + +module.exports = copy; + +/***/ }), + +/***/ "./node_modules/cross-fetch/dist/browser-ponyfill.js": +/*!***********************************************************!*\ + !*** ./node_modules/cross-fetch/dist/browser-ponyfill.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var global = typeof self !== 'undefined' ? self : this; + +var __self__ = function () { + function F() { + this.fetch = false; + this.DOMException = global.DOMException; + } + + F.prototype = global; + return new F(); +}(); + +(function (self) { + var irrelevant = function (exports) { + var support = { + searchParams: 'URLSearchParams' in self, + iterable: 'Symbol' in self && 'iterator' in Symbol, + blob: 'FileReader' in self && 'Blob' in self && function () { + try { + new Blob(); + return true; + } catch (e) { + return false; + } + }(), + formData: 'FormData' in self, + arrayBuffer: 'ArrayBuffer' in self + }; + + function isDataView(obj) { + return obj && DataView.prototype.isPrototypeOf(obj); + } + + if (support.arrayBuffer) { + var viewClasses = ['[object Int8Array]', '[object Uint8Array]', '[object Uint8ClampedArray]', '[object Int16Array]', '[object Uint16Array]', '[object Int32Array]', '[object Uint32Array]', '[object Float32Array]', '[object Float64Array]']; + + var isArrayBufferView = ArrayBuffer.isView || function (obj) { + return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1; + }; + } + + function normalizeName(name) { + if (typeof name !== 'string') { + name = String(name); + } + + if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) { + throw new TypeError('Invalid character in header field name'); + } + + return name.toLowerCase(); + } + + function normalizeValue(value) { + if (typeof value !== 'string') { + value = String(value); + } + + return value; + } // Build a destructive iterator for the value list + + + function iteratorFor(items) { + var iterator = { + next: function next() { + var value = items.shift(); + return { + done: value === undefined, + value: value + }; + } + }; + + if (support.iterable) { + iterator[Symbol.iterator] = function () { + return iterator; + }; + } + + return iterator; + } + + function Headers(headers) { + this.map = {}; + + if (headers instanceof Headers) { + headers.forEach(function (value, name) { + this.append(name, value); + }, this); + } else if (Array.isArray(headers)) { + headers.forEach(function (header) { + this.append(header[0], header[1]); + }, this); + } else if (headers) { + Object.getOwnPropertyNames(headers).forEach(function (name) { + this.append(name, headers[name]); + }, this); + } + } + + Headers.prototype.append = function (name, value) { + name = normalizeName(name); + value = normalizeValue(value); + var oldValue = this.map[name]; + this.map[name] = oldValue ? oldValue + ', ' + value : value; + }; + + Headers.prototype['delete'] = function (name) { + delete this.map[normalizeName(name)]; + }; + + Headers.prototype.get = function (name) { + name = normalizeName(name); + return this.has(name) ? this.map[name] : null; + }; + + Headers.prototype.has = function (name) { + return this.map.hasOwnProperty(normalizeName(name)); + }; + + Headers.prototype.set = function (name, value) { + this.map[normalizeName(name)] = normalizeValue(value); + }; + + Headers.prototype.forEach = function (callback, thisArg) { + for (var name in this.map) { + if (this.map.hasOwnProperty(name)) { + callback.call(thisArg, this.map[name], name, this); + } + } + }; + + Headers.prototype.keys = function () { + var items = []; + this.forEach(function (value, name) { + items.push(name); + }); + return iteratorFor(items); + }; + + Headers.prototype.values = function () { + var items = []; + this.forEach(function (value) { + items.push(value); + }); + return iteratorFor(items); + }; + + Headers.prototype.entries = function () { + var items = []; + this.forEach(function (value, name) { + items.push([name, value]); + }); + return iteratorFor(items); + }; + + if (support.iterable) { + Headers.prototype[Symbol.iterator] = Headers.prototype.entries; + } + + function consumed(body) { + if (body.bodyUsed) { + return Promise.reject(new TypeError('Already read')); + } + + body.bodyUsed = true; + } + + function fileReaderReady(reader) { + return new Promise(function (resolve, reject) { + reader.onload = function () { + resolve(reader.result); + }; + + reader.onerror = function () { + reject(reader.error); + }; + }); + } + + function readBlobAsArrayBuffer(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsArrayBuffer(blob); + return promise; + } + + function readBlobAsText(blob) { + var reader = new FileReader(); + var promise = fileReaderReady(reader); + reader.readAsText(blob); + return promise; + } + + function readArrayBufferAsText(buf) { + var view = new Uint8Array(buf); + var chars = new Array(view.length); + + for (var i = 0; i < view.length; i++) { + chars[i] = String.fromCharCode(view[i]); + } + + return chars.join(''); + } + + function bufferClone(buf) { + if (buf.slice) { + return buf.slice(0); + } else { + var view = new Uint8Array(buf.byteLength); + view.set(new Uint8Array(buf)); + return view.buffer; + } + } + + function Body() { + this.bodyUsed = false; + + this._initBody = function (body) { + this._bodyInit = body; + + if (!body) { + this._bodyText = ''; + } else if (typeof body === 'string') { + this._bodyText = body; + } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { + this._bodyBlob = body; + } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { + this._bodyFormData = body; + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this._bodyText = body.toString(); + } else if (support.arrayBuffer && support.blob && isDataView(body)) { + this._bodyArrayBuffer = bufferClone(body.buffer); // IE 10-11 can't handle a DataView body. + + this._bodyInit = new Blob([this._bodyArrayBuffer]); + } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { + this._bodyArrayBuffer = bufferClone(body); + } else { + this._bodyText = body = Object.prototype.toString.call(body); + } + + if (!this.headers.get('content-type')) { + if (typeof body === 'string') { + this.headers.set('content-type', 'text/plain;charset=UTF-8'); + } else if (this._bodyBlob && this._bodyBlob.type) { + this.headers.set('content-type', this._bodyBlob.type); + } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { + this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); + } + } + }; + + if (support.blob) { + this.blob = function () { + var rejected = consumed(this); + + if (rejected) { + return rejected; + } + + if (this._bodyBlob) { + return Promise.resolve(this._bodyBlob); + } else if (this._bodyArrayBuffer) { + return Promise.resolve(new Blob([this._bodyArrayBuffer])); + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as blob'); + } else { + return Promise.resolve(new Blob([this._bodyText])); + } + }; + + this.arrayBuffer = function () { + if (this._bodyArrayBuffer) { + return consumed(this) || Promise.resolve(this._bodyArrayBuffer); + } else { + return this.blob().then(readBlobAsArrayBuffer); + } + }; + } + + this.text = function () { + var rejected = consumed(this); + + if (rejected) { + return rejected; + } + + if (this._bodyBlob) { + return readBlobAsText(this._bodyBlob); + } else if (this._bodyArrayBuffer) { + return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)); + } else if (this._bodyFormData) { + throw new Error('could not read FormData body as text'); + } else { + return Promise.resolve(this._bodyText); + } + }; + + if (support.formData) { + this.formData = function () { + return this.text().then(decode); + }; + } + + this.json = function () { + return this.text().then(JSON.parse); + }; + + return this; + } // HTTP methods whose capitalization should be normalized + + + var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']; + + function normalizeMethod(method) { + var upcased = method.toUpperCase(); + return methods.indexOf(upcased) > -1 ? upcased : method; + } + + function Request(input, options) { + options = options || {}; + var body = options.body; + + if (input instanceof Request) { + if (input.bodyUsed) { + throw new TypeError('Already read'); + } + + this.url = input.url; + this.credentials = input.credentials; + + if (!options.headers) { + this.headers = new Headers(input.headers); + } + + this.method = input.method; + this.mode = input.mode; + this.signal = input.signal; + + if (!body && input._bodyInit != null) { + body = input._bodyInit; + input.bodyUsed = true; + } + } else { + this.url = String(input); + } + + this.credentials = options.credentials || this.credentials || 'same-origin'; + + if (options.headers || !this.headers) { + this.headers = new Headers(options.headers); + } + + this.method = normalizeMethod(options.method || this.method || 'GET'); + this.mode = options.mode || this.mode || null; + this.signal = options.signal || this.signal; + this.referrer = null; + + if ((this.method === 'GET' || this.method === 'HEAD') && body) { + throw new TypeError('Body not allowed for GET or HEAD requests'); + } + + this._initBody(body); + } + + Request.prototype.clone = function () { + return new Request(this, { + body: this._bodyInit + }); + }; + + function decode(body) { + var form = new FormData(); + body.trim().split('&').forEach(function (bytes) { + if (bytes) { + var split = bytes.split('='); + var name = split.shift().replace(/\+/g, ' '); + var value = split.join('=').replace(/\+/g, ' '); + form.append(decodeURIComponent(name), decodeURIComponent(value)); + } + }); + return form; + } + + function parseHeaders(rawHeaders) { + var headers = new Headers(); // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space + // https://tools.ietf.org/html/rfc7230#section-3.2 + + var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' '); + preProcessedHeaders.split(/\r?\n/).forEach(function (line) { + var parts = line.split(':'); + var key = parts.shift().trim(); + + if (key) { + var value = parts.join(':').trim(); + headers.append(key, value); + } + }); + return headers; + } + + Body.call(Request.prototype); + + function Response(bodyInit, options) { + if (!options) { + options = {}; + } + + this.type = 'default'; + this.status = options.status === undefined ? 200 : options.status; + this.ok = this.status >= 200 && this.status < 300; + this.statusText = 'statusText' in options ? options.statusText : 'OK'; + this.headers = new Headers(options.headers); + this.url = options.url || ''; + + this._initBody(bodyInit); + } + + Body.call(Response.prototype); + + Response.prototype.clone = function () { + return new Response(this._bodyInit, { + status: this.status, + statusText: this.statusText, + headers: new Headers(this.headers), + url: this.url + }); + }; + + Response.error = function () { + var response = new Response(null, { + status: 0, + statusText: '' + }); + response.type = 'error'; + return response; + }; + + var redirectStatuses = [301, 302, 303, 307, 308]; + + Response.redirect = function (url, status) { + if (redirectStatuses.indexOf(status) === -1) { + throw new RangeError('Invalid status code'); + } + + return new Response(null, { + status: status, + headers: { + location: url + } + }); + }; + + exports.DOMException = self.DOMException; + + try { + new exports.DOMException(); + } catch (err) { + exports.DOMException = function (message, name) { + this.message = message; + this.name = name; + var error = Error(message); + this.stack = error.stack; + }; + + exports.DOMException.prototype = Object.create(Error.prototype); + exports.DOMException.prototype.constructor = exports.DOMException; + } + + function fetch(input, init) { + return new Promise(function (resolve, reject) { + var request = new Request(input, init); + + if (request.signal && request.signal.aborted) { + return reject(new exports.DOMException('Aborted', 'AbortError')); + } + + var xhr = new XMLHttpRequest(); + + function abortXhr() { + xhr.abort(); + } + + xhr.onload = function () { + var options = { + status: xhr.status, + statusText: xhr.statusText, + headers: parseHeaders(xhr.getAllResponseHeaders() || '') + }; + options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL'); + var body = 'response' in xhr ? xhr.response : xhr.responseText; + resolve(new Response(body, options)); + }; + + xhr.onerror = function () { + reject(new TypeError('Network request failed')); + }; + + xhr.ontimeout = function () { + reject(new TypeError('Network request failed')); + }; + + xhr.onabort = function () { + reject(new exports.DOMException('Aborted', 'AbortError')); + }; + + xhr.open(request.method, request.url, true); + + if (request.credentials === 'include') { + xhr.withCredentials = true; + } else if (request.credentials === 'omit') { + xhr.withCredentials = false; + } + + if ('responseType' in xhr && support.blob) { + xhr.responseType = 'blob'; + } + + request.headers.forEach(function (value, name) { + xhr.setRequestHeader(name, value); + }); + + if (request.signal) { + request.signal.addEventListener('abort', abortXhr); + + xhr.onreadystatechange = function () { + // DONE (success or failure) + if (xhr.readyState === 4) { + request.signal.removeEventListener('abort', abortXhr); + } + }; + } + + xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit); + }); + } + + fetch.polyfill = true; + + if (!self.fetch) { + self.fetch = fetch; + self.Headers = Headers; + self.Request = Request; + self.Response = Response; + } + + exports.Headers = Headers; + exports.Request = Request; + exports.Response = Response; + exports.fetch = fetch; + Object.defineProperty(exports, '__esModule', { + value: true + }); + return exports; + }({}); +})(__self__); + +__self__.fetch.ponyfill = true; // Remove "polyfill" property added by whatwg-fetch + +delete __self__.fetch.polyfill; // Choose between native implementation (global) or custom implementation (__self__) +// var ctx = global.fetch ? global : __self__; + +var ctx = __self__; // this line disable service worker support temporarily + +exports = ctx.fetch; // To enable: import fetch from 'cross-fetch' + +exports["default"] = ctx.fetch; // For TypeScript consumers without esModuleInterop. + +exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch' + +exports.Headers = ctx.Headers; +exports.Request = ctx.Request; +exports.Response = ctx.Response; +module.exports = exports; + +/***/ }), + +/***/ "./node_modules/decode-uri-component/index.js": +/*!****************************************************!*\ + !*** ./node_modules/decode-uri-component/index.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var token = '%[a-f0-9]{2}'; +var singleMatcher = new RegExp(token, 'gi'); +var multiMatcher = new RegExp('(' + token + ')+', 'gi'); + +function decodeComponents(components, split) { + try { + // Try to decode the entire string first + return decodeURIComponent(components.join('')); + } catch (err) {// Do nothing + } + + if (components.length === 1) { + return components; + } + + split = split || 1; // Split the array in 2 parts + + var left = components.slice(0, split); + var right = components.slice(split); + return Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right)); +} + +function decode(input) { + try { + return decodeURIComponent(input); + } catch (err) { + var tokens = input.match(singleMatcher); + + for (var i = 1; i < tokens.length; i++) { + input = decodeComponents(tokens, i).join(''); + tokens = input.match(singleMatcher); + } + + return input; + } +} + +function customDecodeURIComponent(input) { + // Keep track of all the replacements and prefill the map with the `BOM` + var replaceMap = { + '%FE%FF': "\uFFFD\uFFFD", + '%FF%FE': "\uFFFD\uFFFD" + }; + var match = multiMatcher.exec(input); + + while (match) { + try { + // Decode as big chunks as possible + replaceMap[match[0]] = decodeURIComponent(match[0]); + } catch (err) { + var result = decode(match[0]); + + if (result !== match[0]) { + replaceMap[match[0]] = result; + } + } + + match = multiMatcher.exec(input); + } // Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else + + + replaceMap['%C2'] = "\uFFFD"; + var entries = Object.keys(replaceMap); + + for (var i = 0; i < entries.length; i++) { + // Replace all decoded components + var key = entries[i]; + input = input.replace(new RegExp(key, 'g'), replaceMap[key]); + } + + return input; +} + +module.exports = function (encodedURI) { + if (typeof encodedURI !== 'string') { + throw new TypeError('Expected `encodedURI` to be of type `string`, got `' + _typeof(encodedURI) + '`'); + } + + try { + encodedURI = encodedURI.replace(/\+/g, ' '); // Try the built in decoder first + + return decodeURIComponent(encodedURI); + } catch (err) { + // Fallback to a more advanced decoder + return customDecodeURIComponent(encodedURI); + } +}; + +/***/ }), + +/***/ "./node_modules/detect-browser/es/index.js": +/*!*************************************************!*\ + !*** ./node_modules/detect-browser/es/index.js ***! + \*************************************************/ +/*! exports provided: BrowserInfo, NodeInfo, SearchBotDeviceInfo, BotInfo, ReactNativeInfo, detect, browserName, parseUserAgent, detectOS, getNodeVersion */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserInfo", function() { return BrowserInfo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NodeInfo", function() { return NodeInfo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SearchBotDeviceInfo", function() { return SearchBotDeviceInfo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BotInfo", function() { return BotInfo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReactNativeInfo", function() { return ReactNativeInfo; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detect", function() { return detect; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "browserName", function() { return browserName; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseUserAgent", function() { return parseUserAgent; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "detectOS", function() { return detectOS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNodeVersion", function() { return getNodeVersion; }); +var __spreadArrays = undefined && undefined.__spreadArrays || function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) { + s += arguments[i].length; + } + + for (var r = Array(s), k = 0, i = 0; i < il; i++) { + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) { + r[k] = a[j]; + } + } + + return r; +}; + +var BrowserInfo = +/** @class */ +function () { + function BrowserInfo(name, version, os) { + this.name = name; + this.version = version; + this.os = os; + this.type = 'browser'; + } + + return BrowserInfo; +}(); + + + +var NodeInfo = +/** @class */ +function () { + function NodeInfo(version) { + this.version = version; + this.type = 'node'; + this.name = 'node'; + this.os = process.platform; + } + + return NodeInfo; +}(); + + + +var SearchBotDeviceInfo = +/** @class */ +function () { + function SearchBotDeviceInfo(name, version, os, bot) { + this.name = name; + this.version = version; + this.os = os; + this.bot = bot; + this.type = 'bot-device'; + } + + return SearchBotDeviceInfo; +}(); + + + +var BotInfo = +/** @class */ +function () { + function BotInfo() { + this.type = 'bot'; + this.bot = true; // NOTE: deprecated test name instead + + this.name = 'bot'; + this.version = null; + this.os = null; + } + + return BotInfo; +}(); + + + +var ReactNativeInfo = +/** @class */ +function () { + function ReactNativeInfo() { + this.type = 'react-native'; + this.name = 'react-native'; + this.version = null; + this.os = null; + } + + return ReactNativeInfo; +}(); + + // tslint:disable-next-line:max-line-length + +var SEARCHBOX_UA_REGEX = /alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/; +var SEARCHBOT_OS_REGEX = /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/; +var REQUIRED_VERSION_PARTS = 3; +var userAgentRules = [['aol', /AOLShield\/([0-9\._]+)/], ['edge', /Edge\/([0-9\._]+)/], ['edge-ios', /EdgiOS\/([0-9\._]+)/], ['yandexbrowser', /YaBrowser\/([0-9\._]+)/], ['kakaotalk', /KAKAOTALK\s([0-9\.]+)/], ['samsung', /SamsungBrowser\/([0-9\.]+)/], ['silk', /\bSilk\/([0-9._-]+)\b/], ['miui', /MiuiBrowser\/([0-9\.]+)$/], ['beaker', /BeakerBrowser\/([0-9\.]+)/], ['edge-chromium', /EdgA?\/([0-9\.]+)/], ['chromium-webview', /(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], ['chrome', /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/], ['phantomjs', /PhantomJS\/([0-9\.]+)(:?\s|$)/], ['crios', /CriOS\/([0-9\.]+)(:?\s|$)/], ['firefox', /Firefox\/([0-9\.]+)(?:\s|$)/], ['fxios', /FxiOS\/([0-9\.]+)/], ['opera-mini', /Opera Mini.*Version\/([0-9\.]+)/], ['opera', /Opera\/([0-9\.]+)(?:\s|$)/], ['opera', /OPR\/([0-9\.]+)(:?\s|$)/], ['ie', /Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/], ['ie', /MSIE\s([0-9\.]+);.*Trident\/[4-7].0/], ['ie', /MSIE\s(7\.0)/], ['bb10', /BB10;\sTouch.*Version\/([0-9\.]+)/], ['android', /Android\s([0-9\.]+)/], ['ios', /Version\/([0-9\._]+).*Mobile.*Safari.*/], ['safari', /Version\/([0-9\._]+).*Safari/], ['facebook', /FBAV\/([0-9\.]+)/], ['instagram', /Instagram\s([0-9\.]+)/], ['ios-webview', /AppleWebKit\/([0-9\.]+).*Mobile/], ['ios-webview', /AppleWebKit\/([0-9\.]+).*Gecko\)$/], ['searchbot', SEARCHBOX_UA_REGEX]]; +var operatingSystemRules = [['iOS', /iP(hone|od|ad)/], ['Android OS', /Android/], ['BlackBerry OS', /BlackBerry|BB10/], ['Windows Mobile', /IEMobile/], ['Amazon OS', /Kindle/], ['Windows 3.11', /Win16/], ['Windows 95', /(Windows 95)|(Win95)|(Windows_95)/], ['Windows 98', /(Windows 98)|(Win98)/], ['Windows 2000', /(Windows NT 5.0)|(Windows 2000)/], ['Windows XP', /(Windows NT 5.1)|(Windows XP)/], ['Windows Server 2003', /(Windows NT 5.2)/], ['Windows Vista', /(Windows NT 6.0)/], ['Windows 7', /(Windows NT 6.1)/], ['Windows 8', /(Windows NT 6.2)/], ['Windows 8.1', /(Windows NT 6.3)/], ['Windows 10', /(Windows NT 10.0)/], ['Windows ME', /Windows ME/], ['Open BSD', /OpenBSD/], ['Sun OS', /SunOS/], ['Chrome OS', /CrOS/], ['Linux', /(Linux)|(X11)/], ['Mac OS', /(Mac_PowerPC)|(Macintosh)/], ['QNX', /QNX/], ['BeOS', /BeOS/], ['OS/2', /OS\/2/]]; +function detect(userAgent) { + if (!!userAgent) { + return parseUserAgent(userAgent); + } + + if (typeof document === 'undefined' && typeof navigator !== 'undefined' && navigator.product === 'ReactNative') { + return new ReactNativeInfo(); + } + + if (typeof navigator !== 'undefined') { + return parseUserAgent(navigator.userAgent); + } + + return getNodeVersion(); +} + +function matchUserAgent(ua) { + // opted for using reduce here rather than Array#first with a regex.test call + // this is primarily because using the reduce we only perform the regex + // execution once rather than once for the test and for the exec again below + // probably something that needs to be benchmarked though + return ua !== '' && userAgentRules.reduce(function (matched, _a) { + var browser = _a[0], + regex = _a[1]; + + if (matched) { + return matched; + } + + var uaMatch = regex.exec(ua); + return !!uaMatch && [browser, uaMatch]; + }, false); +} + +function browserName(ua) { + var data = matchUserAgent(ua); + return data ? data[0] : null; +} +function parseUserAgent(ua) { + var matchedRule = matchUserAgent(ua); + + if (!matchedRule) { + return null; + } + + var name = matchedRule[0], + match = matchedRule[1]; + + if (name === 'searchbot') { + return new BotInfo(); + } + + var versionParts = match[1] && match[1].split(/[._]/).slice(0, 3); + + if (versionParts) { + if (versionParts.length < REQUIRED_VERSION_PARTS) { + versionParts = __spreadArrays(versionParts, createVersionParts(REQUIRED_VERSION_PARTS - versionParts.length)); + } + } else { + versionParts = []; + } + + var version = versionParts.join('.'); + var os = detectOS(ua); + var searchBotMatch = SEARCHBOT_OS_REGEX.exec(ua); + + if (searchBotMatch && searchBotMatch[1]) { + return new SearchBotDeviceInfo(name, version, os, searchBotMatch[1]); + } + + return new BrowserInfo(name, version, os); +} +function detectOS(ua) { + for (var ii = 0, count = operatingSystemRules.length; ii < count; ii++) { + var _a = operatingSystemRules[ii], + os = _a[0], + regex = _a[1]; + var match = regex.exec(ua); + + if (match) { + return os; + } + } + + return null; +} +function getNodeVersion() { + var isNode = typeof process !== 'undefined' && process.version; + return isNode ? new NodeInfo(process.version.slice(1)) : null; +} + +function createVersionParts(count) { + var output = []; + + for (var ii = 0; ii < count; ii++) { + output.push('0'); + } + + return output; +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"))) + +/***/ }), + +/***/ "./node_modules/dijkstrajs/dijkstra.js": +/*!*********************************************!*\ + !*** ./node_modules/dijkstrajs/dijkstra.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +/****************************************************************************** + * Created 2008-08-19. + * + * Dijkstra path-finding functions. Adapted from the Dijkstar Python project. + * + * Copyright (C) 2008 + * Wyatt Baldwin + * All rights reserved + * + * Licensed under the MIT license. + * + * http://www.opensource.org/licenses/mit-license.php + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + *****************************************************************************/ + +var dijkstra = { + single_source_shortest_paths: function single_source_shortest_paths(graph, s, d) { + // Predecessor map for each node that has been encountered. + // node ID => predecessor node ID + var predecessors = {}; // Costs of shortest paths from s to all nodes encountered. + // node ID => cost + + var costs = {}; + costs[s] = 0; // Costs of shortest paths from s to all nodes encountered; differs from + // `costs` in that it provides easy access to the node that currently has + // the known shortest path from s. + // XXX: Do we actually need both `costs` and `open`? + + var open = dijkstra.PriorityQueue.make(); + open.push(s, 0); + var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit; + + while (!open.empty()) { + // In the nodes remaining in graph that have a known cost from s, + // find the node, u, that currently has the shortest path from s. + closest = open.pop(); + u = closest.value; + cost_of_s_to_u = closest.cost; // Get nodes adjacent to u... + + adjacent_nodes = graph[u] || {}; // ...and explore the edges that connect u to those nodes, updating + // the cost of the shortest paths to any or all of those nodes as + // necessary. v is the node across the current edge from u. + + for (v in adjacent_nodes) { + if (adjacent_nodes.hasOwnProperty(v)) { + // Get the cost of the edge running from u to v. + cost_of_e = adjacent_nodes[v]; // Cost of s to u plus the cost of u to v across e--this is *a* + // cost from s to v that may or may not be less than the current + // known cost to v. + + cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e; // If we haven't visited v yet OR if the current known cost from s to + // v is greater than the new cost we just found (cost of s to u plus + // cost of u to v across e), update v's cost in the cost list and + // update v's predecessor in the predecessor list (it's now u). + + cost_of_s_to_v = costs[v]; + first_visit = typeof costs[v] === 'undefined'; + + if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) { + costs[v] = cost_of_s_to_u_plus_cost_of_e; + open.push(v, cost_of_s_to_u_plus_cost_of_e); + predecessors[v] = u; + } + } + } + } + + if (typeof d !== 'undefined' && typeof costs[d] === 'undefined') { + var msg = ['Could not find a path from ', s, ' to ', d, '.'].join(''); + throw new Error(msg); + } + + return predecessors; + }, + extract_shortest_path_from_predecessor_list: function extract_shortest_path_from_predecessor_list(predecessors, d) { + var nodes = []; + var u = d; + var predecessor; + + while (u) { + nodes.push(u); + predecessor = predecessors[u]; + u = predecessors[u]; + } + + nodes.reverse(); + return nodes; + }, + find_path: function find_path(graph, s, d) { + var predecessors = dijkstra.single_source_shortest_paths(graph, s, d); + return dijkstra.extract_shortest_path_from_predecessor_list(predecessors, d); + }, + + /** + * A very naive priority queue implementation. + */ + PriorityQueue: { + make: function make(opts) { + var T = dijkstra.PriorityQueue, + t = {}, + key; + opts = opts || {}; + + for (key in T) { + if (T.hasOwnProperty(key)) { + t[key] = T[key]; + } + } + + t.queue = []; + t.sorter = opts.sorter || T.default_sorter; + return t; + }, + default_sorter: function default_sorter(a, b) { + return a.cost - b.cost; + }, + + /** + * Add a new item to the queue and ensure the highest priority element + * is at the front of the queue. + */ + push: function push(value, cost) { + var item = { + value: value, + cost: cost + }; + this.queue.push(item); + this.queue.sort(this.sorter); + }, + + /** + * Return the highest priority element in the queue. + */ + pop: function pop() { + return this.queue.shift(); + }, + empty: function empty() { + return this.queue.length === 0; + } + } +}; // node.js module exports + +if (true) { + module.exports = dijkstra; +} + +/***/ }), + +/***/ "./node_modules/ethers/lib.esm/_version.js": +/*!*************************************************!*\ + !*** ./node_modules/ethers/lib.esm/_version.js ***! + \*************************************************/ +/*! exports provided: version */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "version", function() { return version; }); +var version = "ethers/5.5.4"; + +/***/ }), + +/***/ "./node_modules/ethers/lib.esm/ethers.js": +/*!***********************************************!*\ + !*** ./node_modules/ethers/lib.esm/ethers.js ***! + \***********************************************/ +/*! exports provided: Signer, Wallet, VoidSigner, getDefaultProvider, providers, BaseContract, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, Wordlist */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "logger", function() { return logger; }); +/* harmony import */ var _ethersproject_contracts__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/contracts */ "./node_modules/@ethersproject/contracts/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BaseContract", function() { return _ethersproject_contracts__WEBPACK_IMPORTED_MODULE_0__["BaseContract"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Contract", function() { return _ethersproject_contracts__WEBPACK_IMPORTED_MODULE_0__["Contract"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ContractFactory", function() { return _ethersproject_contracts__WEBPACK_IMPORTED_MODULE_0__["ContractFactory"]; }); + +/* harmony import */ var _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/bignumber */ "./node_modules/@ethersproject/bignumber/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BigNumber", function() { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["BigNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FixedNumber", function() { return _ethersproject_bignumber__WEBPACK_IMPORTED_MODULE_1__["FixedNumber"]; }); + +/* harmony import */ var _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/abstract-signer */ "./node_modules/@ethersproject/abstract-signer/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Signer", function() { return _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__["Signer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VoidSigner", function() { return _ethersproject_abstract_signer__WEBPACK_IMPORTED_MODULE_2__["VoidSigner"]; }); + +/* harmony import */ var _ethersproject_wallet__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/wallet */ "./node_modules/@ethersproject/wallet/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Wallet", function() { return _ethersproject_wallet__WEBPACK_IMPORTED_MODULE_3__["Wallet"]; }); + +/* harmony import */ var _ethersproject_constants__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/constants */ "./node_modules/@ethersproject/constants/lib.esm/index.js"); +/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "constants", function() { return _ethersproject_constants__WEBPACK_IMPORTED_MODULE_4__; }); +/* harmony import */ var _ethersproject_providers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/providers */ "./node_modules/@ethersproject/providers/lib.esm/index.js"); +/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "providers", function() { return _ethersproject_providers__WEBPACK_IMPORTED_MODULE_5__; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDefaultProvider", function() { return _ethersproject_providers__WEBPACK_IMPORTED_MODULE_5__["getDefaultProvider"]; }); + +/* harmony import */ var _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/wordlists */ "./node_modules/@ethersproject/wordlists/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "wordlists", function() { return _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_6__["wordlists"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Wordlist", function() { return _ethersproject_wordlists__WEBPACK_IMPORTED_MODULE_6__["Wordlist"]; }); + +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ "./node_modules/ethers/lib.esm/utils.js"); +/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "utils", function() { return _utils__WEBPACK_IMPORTED_MODULE_7__; }); +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "errors", function() { return _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["ErrorCode"]; }); + +/* harmony import */ var _version__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./_version */ "./node_modules/ethers/lib.esm/_version.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "version", function() { return _version__WEBPACK_IMPORTED_MODULE_9__["version"]; }); + + + + + + + + + + + + + //////////////////////// +// Compile-Time Constants +// This is generated by "npm run dist" + + +var logger = new _ethersproject_logger__WEBPACK_IMPORTED_MODULE_8__["Logger"](_version__WEBPACK_IMPORTED_MODULE_9__["version"]); //////////////////////// +// Exports + + + +/***/ }), + +/***/ "./node_modules/ethers/lib.esm/index.js": +/*!**********************************************!*\ + !*** ./node_modules/ethers/lib.esm/index.js ***! + \**********************************************/ +/*! exports provided: ethers, Signer, Wallet, VoidSigner, getDefaultProvider, providers, BaseContract, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, Wordlist */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _ethers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ethers */ "./node_modules/ethers/lib.esm/ethers.js"); +/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "ethers", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__; }); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Signer", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["Signer"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Wallet", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["Wallet"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VoidSigner", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["VoidSigner"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getDefaultProvider", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["getDefaultProvider"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "providers", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["providers"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BaseContract", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["BaseContract"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Contract", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["Contract"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ContractFactory", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["ContractFactory"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BigNumber", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["BigNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FixedNumber", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["FixedNumber"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "constants", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["constants"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "errors", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["errors"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "logger", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["logger"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "utils", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["utils"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "wordlists", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["wordlists"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "version", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["version"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Wordlist", function() { return _ethers__WEBPACK_IMPORTED_MODULE_0__["Wordlist"]; }); + + // To modify this file, you must update ./misc/admin/lib/cmds/update-exports.js + + + +try { + var anyGlobal = window; + + if (anyGlobal._ethers == null) { + anyGlobal._ethers = _ethers__WEBPACK_IMPORTED_MODULE_0__; + } +} catch (error) {} + + + + +/***/ }), + +/***/ "./node_modules/ethers/lib.esm/utils.js": +/*!**********************************************!*\ + !*** ./node_modules/ethers/lib.esm/utils.js ***! + \**********************************************/ +/*! exports provided: AbiCoder, defaultAbiCoder, Fragment, ConstructorFragment, ErrorFragment, EventFragment, FunctionFragment, ParamType, FormatTypes, checkResultErrors, Logger, RLP, _fetchData, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, isBytes, isBytesLike, defaultPath, HDNode, SigningKey, Interface, LogDescription, TransactionDescription, base58, base64, hexlify, isHexString, hexConcat, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, id, _TypedDataEncoder, getAddress, getIcapAddress, getContractAddress, getCreate2Address, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, computeHmac, keccak256, ripemd160, sha256, sha512, randomBytes, shuffled, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, accessListify, parseTransaction, serializeTransaction, TransactionTypes, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, verifyTypedData, getAccountPath, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithm, UnicodeNormalizationForm, Utf8ErrorReason, Indexed */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony import */ var _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @ethersproject/abi */ "./node_modules/@ethersproject/abi/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AbiCoder", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["AbiCoder"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultAbiCoder", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["defaultAbiCoder"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Fragment", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["Fragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConstructorFragment", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["ConstructorFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ErrorFragment", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["ErrorFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EventFragment", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["EventFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionFragment", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["FunctionFragment"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ParamType", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["ParamType"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormatTypes", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["FormatTypes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "checkResultErrors", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["checkResultErrors"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Interface", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["Interface"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LogDescription", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["LogDescription"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TransactionDescription", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["TransactionDescription"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Indexed", function() { return _ethersproject_abi__WEBPACK_IMPORTED_MODULE_0__["Indexed"]; }); + +/* harmony import */ var _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getAddress", function() { return _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__["getAddress"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getIcapAddress", function() { return _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__["getIcapAddress"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getContractAddress", function() { return _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__["getContractAddress"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getCreate2Address", function() { return _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__["getCreate2Address"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isAddress", function() { return _ethersproject_address__WEBPACK_IMPORTED_MODULE_1__["isAddress"]; }); + +/* harmony import */ var _ethersproject_base64__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @ethersproject/base64 */ "./node_modules/@ethersproject/base64/lib.esm/index.js"); +/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "base64", function() { return _ethersproject_base64__WEBPACK_IMPORTED_MODULE_2__; }); +/* harmony import */ var _ethersproject_basex__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @ethersproject/basex */ "./node_modules/@ethersproject/basex/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "base58", function() { return _ethersproject_basex__WEBPACK_IMPORTED_MODULE_3__["Base58"]; }); + +/* harmony import */ var _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "arrayify", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["arrayify"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["concat"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "stripZeros", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["stripZeros"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zeroPad", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["zeroPad"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBytes", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["isBytes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBytesLike", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["isBytesLike"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexlify", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["hexlify"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isHexString", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["isHexString"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexConcat", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["hexConcat"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexStripZeros", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["hexStripZeros"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexValue", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["hexValue"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexZeroPad", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["hexZeroPad"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexDataLength", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["hexDataLength"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hexDataSlice", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["hexDataSlice"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "splitSignature", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["splitSignature"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "joinSignature", function() { return _ethersproject_bytes__WEBPACK_IMPORTED_MODULE_4__["joinSignature"]; }); + +/* harmony import */ var _ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @ethersproject/hash */ "./node_modules/@ethersproject/hash/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "hashMessage", function() { return _ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["hashMessage"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "namehash", function() { return _ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["namehash"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidName", function() { return _ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["isValidName"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "id", function() { return _ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["id"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_TypedDataEncoder", function() { return _ethersproject_hash__WEBPACK_IMPORTED_MODULE_5__["_TypedDataEncoder"]; }); + +/* harmony import */ var _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @ethersproject/hdnode */ "./node_modules/@ethersproject/hdnode/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultPath", function() { return _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__["defaultPath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "HDNode", function() { return _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__["HDNode"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getAccountPath", function() { return _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__["getAccountPath"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mnemonicToEntropy", function() { return _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__["mnemonicToEntropy"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "entropyToMnemonic", function() { return _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__["entropyToMnemonic"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isValidMnemonic", function() { return _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__["isValidMnemonic"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mnemonicToSeed", function() { return _ethersproject_hdnode__WEBPACK_IMPORTED_MODULE_6__["mnemonicToSeed"]; }); + +/* harmony import */ var _ethersproject_json_wallets__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @ethersproject/json-wallets */ "./node_modules/@ethersproject/json-wallets/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getJsonWalletAddress", function() { return _ethersproject_json_wallets__WEBPACK_IMPORTED_MODULE_7__["getJsonWalletAddress"]; }); + +/* harmony import */ var _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "keccak256", function() { return _ethersproject_keccak256__WEBPACK_IMPORTED_MODULE_8__["keccak256"]; }); + +/* harmony import */ var _ethersproject_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return _ethersproject_logger__WEBPACK_IMPORTED_MODULE_9__["Logger"]; }); + +/* harmony import */ var _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @ethersproject/sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "computeHmac", function() { return _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__["computeHmac"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ripemd160", function() { return _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__["ripemd160"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sha256", function() { return _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__["sha256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sha512", function() { return _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__["sha512"]; }); + +/* harmony import */ var _ethersproject_solidity__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @ethersproject/solidity */ "./node_modules/@ethersproject/solidity/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "solidityPack", function() { return _ethersproject_solidity__WEBPACK_IMPORTED_MODULE_11__["pack"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "solidityKeccak256", function() { return _ethersproject_solidity__WEBPACK_IMPORTED_MODULE_11__["keccak256"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "soliditySha256", function() { return _ethersproject_solidity__WEBPACK_IMPORTED_MODULE_11__["sha256"]; }); + +/* harmony import */ var _ethersproject_random__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @ethersproject/random */ "./node_modules/@ethersproject/random/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "randomBytes", function() { return _ethersproject_random__WEBPACK_IMPORTED_MODULE_12__["randomBytes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shuffled", function() { return _ethersproject_random__WEBPACK_IMPORTED_MODULE_12__["shuffled"]; }); + +/* harmony import */ var _ethersproject_properties__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "checkProperties", function() { return _ethersproject_properties__WEBPACK_IMPORTED_MODULE_13__["checkProperties"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "deepCopy", function() { return _ethersproject_properties__WEBPACK_IMPORTED_MODULE_13__["deepCopy"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defineReadOnly", function() { return _ethersproject_properties__WEBPACK_IMPORTED_MODULE_13__["defineReadOnly"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getStatic", function() { return _ethersproject_properties__WEBPACK_IMPORTED_MODULE_13__["getStatic"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resolveProperties", function() { return _ethersproject_properties__WEBPACK_IMPORTED_MODULE_13__["resolveProperties"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shallowCopy", function() { return _ethersproject_properties__WEBPACK_IMPORTED_MODULE_13__["shallowCopy"]; }); + +/* harmony import */ var _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @ethersproject/rlp */ "./node_modules/@ethersproject/rlp/lib.esm/index.js"); +/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "RLP", function() { return _ethersproject_rlp__WEBPACK_IMPORTED_MODULE_14__; }); +/* harmony import */ var _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @ethersproject/signing-key */ "./node_modules/@ethersproject/signing-key/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SigningKey", function() { return _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_15__["SigningKey"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "computePublicKey", function() { return _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_15__["computePublicKey"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "recoverPublicKey", function() { return _ethersproject_signing_key__WEBPACK_IMPORTED_MODULE_15__["recoverPublicKey"]; }); + +/* harmony import */ var _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "nameprep", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["nameprep"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_toEscapedUtf8String", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["_toEscapedUtf8String"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toUtf8Bytes", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["toUtf8Bytes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toUtf8CodePoints", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["toUtf8CodePoints"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toUtf8String", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["toUtf8String"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Utf8ErrorFuncs", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["Utf8ErrorFuncs"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatBytes32String", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["formatBytes32String"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseBytes32String", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["parseBytes32String"]; }); + +/* harmony import */ var _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "accessListify", function() { return _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_17__["accessListify"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseTransaction", function() { return _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_17__["parse"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "serializeTransaction", function() { return _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_17__["serialize"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TransactionTypes", function() { return _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_17__["TransactionTypes"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "computeAddress", function() { return _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_17__["computeAddress"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "recoverAddress", function() { return _ethersproject_transactions__WEBPACK_IMPORTED_MODULE_17__["recoverAddress"]; }); + +/* harmony import */ var _ethersproject_units__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @ethersproject/units */ "./node_modules/@ethersproject/units/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatEther", function() { return _ethersproject_units__WEBPACK_IMPORTED_MODULE_18__["formatEther"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseEther", function() { return _ethersproject_units__WEBPACK_IMPORTED_MODULE_18__["parseEther"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "formatUnits", function() { return _ethersproject_units__WEBPACK_IMPORTED_MODULE_18__["formatUnits"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "parseUnits", function() { return _ethersproject_units__WEBPACK_IMPORTED_MODULE_18__["parseUnits"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "commify", function() { return _ethersproject_units__WEBPACK_IMPORTED_MODULE_18__["commify"]; }); + +/* harmony import */ var _ethersproject_wallet__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @ethersproject/wallet */ "./node_modules/@ethersproject/wallet/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "verifyMessage", function() { return _ethersproject_wallet__WEBPACK_IMPORTED_MODULE_19__["verifyMessage"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "verifyTypedData", function() { return _ethersproject_wallet__WEBPACK_IMPORTED_MODULE_19__["verifyTypedData"]; }); + +/* harmony import */ var _ethersproject_web__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! @ethersproject/web */ "./node_modules/@ethersproject/web/lib.esm/index.js"); +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "_fetchData", function() { return _ethersproject_web__WEBPACK_IMPORTED_MODULE_20__["_fetchData"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fetchJson", function() { return _ethersproject_web__WEBPACK_IMPORTED_MODULE_20__["fetchJson"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "poll", function() { return _ethersproject_web__WEBPACK_IMPORTED_MODULE_20__["poll"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SupportedAlgorithm", function() { return _ethersproject_sha2__WEBPACK_IMPORTED_MODULE_10__["SupportedAlgorithm"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnicodeNormalizationForm", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["UnicodeNormalizationForm"]; }); + +/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Utf8ErrorReason", function() { return _ethersproject_strings__WEBPACK_IMPORTED_MODULE_16__["Utf8ErrorReason"]; }); + + + + + + + + + + + + + + + + + + + + + + + + //////////////////////// +// Enums + + + //////////////////////// +// Exports + + + +/***/ }), + +/***/ "./node_modules/ethers/lib/utils.js": +/*!******************************************!*\ + !*** ./node_modules/ethers/lib/utils.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { + enumerable: true, + get: function get() { + return m[k]; + } + }); +} : function (o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { + Object.defineProperty(o, "default", { + enumerable: true, + value: v + }); +} : function (o, v) { + o["default"] = v; +}); + +var __importStar = this && this.__importStar || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) { + if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + } + + __setModuleDefault(result, mod); + + return result; +}; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.formatBytes32String = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports._toEscapedUtf8String = exports.nameprep = exports.hexDataSlice = exports.hexDataLength = exports.hexZeroPad = exports.hexValue = exports.hexStripZeros = exports.hexConcat = exports.isHexString = exports.hexlify = exports.base64 = exports.base58 = exports.TransactionDescription = exports.LogDescription = exports.Interface = exports.SigningKey = exports.HDNode = exports.defaultPath = exports.isBytesLike = exports.isBytes = exports.zeroPad = exports.stripZeros = exports.concat = exports.arrayify = exports.shallowCopy = exports.resolveProperties = exports.getStatic = exports.defineReadOnly = exports.deepCopy = exports.checkProperties = exports.poll = exports.fetchJson = exports._fetchData = exports.RLP = exports.Logger = exports.checkResultErrors = exports.FormatTypes = exports.ParamType = exports.FunctionFragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.Fragment = exports.defaultAbiCoder = exports.AbiCoder = void 0; +exports.Indexed = exports.Utf8ErrorReason = exports.UnicodeNormalizationForm = exports.SupportedAlgorithm = exports.mnemonicToSeed = exports.isValidMnemonic = exports.entropyToMnemonic = exports.mnemonicToEntropy = exports.getAccountPath = exports.verifyTypedData = exports.verifyMessage = exports.recoverPublicKey = exports.computePublicKey = exports.recoverAddress = exports.computeAddress = exports.getJsonWalletAddress = exports.TransactionTypes = exports.serializeTransaction = exports.parseTransaction = exports.accessListify = exports.joinSignature = exports.splitSignature = exports.soliditySha256 = exports.solidityKeccak256 = exports.solidityPack = exports.shuffled = exports.randomBytes = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.computeHmac = exports.commify = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.isAddress = exports.getCreate2Address = exports.getContractAddress = exports.getIcapAddress = exports.getAddress = exports._TypedDataEncoder = exports.id = exports.isValidName = exports.namehash = exports.hashMessage = exports.parseBytes32String = void 0; + +var abi_1 = __webpack_require__(/*! @ethersproject/abi */ "./node_modules/@ethersproject/abi/lib.esm/index.js"); + +Object.defineProperty(exports, "AbiCoder", { + enumerable: true, + get: function get() { + return abi_1.AbiCoder; + } +}); +Object.defineProperty(exports, "checkResultErrors", { + enumerable: true, + get: function get() { + return abi_1.checkResultErrors; + } +}); +Object.defineProperty(exports, "ConstructorFragment", { + enumerable: true, + get: function get() { + return abi_1.ConstructorFragment; + } +}); +Object.defineProperty(exports, "defaultAbiCoder", { + enumerable: true, + get: function get() { + return abi_1.defaultAbiCoder; + } +}); +Object.defineProperty(exports, "ErrorFragment", { + enumerable: true, + get: function get() { + return abi_1.ErrorFragment; + } +}); +Object.defineProperty(exports, "EventFragment", { + enumerable: true, + get: function get() { + return abi_1.EventFragment; + } +}); +Object.defineProperty(exports, "FormatTypes", { + enumerable: true, + get: function get() { + return abi_1.FormatTypes; + } +}); +Object.defineProperty(exports, "Fragment", { + enumerable: true, + get: function get() { + return abi_1.Fragment; + } +}); +Object.defineProperty(exports, "FunctionFragment", { + enumerable: true, + get: function get() { + return abi_1.FunctionFragment; + } +}); +Object.defineProperty(exports, "Indexed", { + enumerable: true, + get: function get() { + return abi_1.Indexed; + } +}); +Object.defineProperty(exports, "Interface", { + enumerable: true, + get: function get() { + return abi_1.Interface; + } +}); +Object.defineProperty(exports, "LogDescription", { + enumerable: true, + get: function get() { + return abi_1.LogDescription; + } +}); +Object.defineProperty(exports, "ParamType", { + enumerable: true, + get: function get() { + return abi_1.ParamType; + } +}); +Object.defineProperty(exports, "TransactionDescription", { + enumerable: true, + get: function get() { + return abi_1.TransactionDescription; + } +}); + +var address_1 = __webpack_require__(/*! @ethersproject/address */ "./node_modules/@ethersproject/address/lib.esm/index.js"); + +Object.defineProperty(exports, "getAddress", { + enumerable: true, + get: function get() { + return address_1.getAddress; + } +}); +Object.defineProperty(exports, "getCreate2Address", { + enumerable: true, + get: function get() { + return address_1.getCreate2Address; + } +}); +Object.defineProperty(exports, "getContractAddress", { + enumerable: true, + get: function get() { + return address_1.getContractAddress; + } +}); +Object.defineProperty(exports, "getIcapAddress", { + enumerable: true, + get: function get() { + return address_1.getIcapAddress; + } +}); +Object.defineProperty(exports, "isAddress", { + enumerable: true, + get: function get() { + return address_1.isAddress; + } +}); + +var base64 = __importStar(__webpack_require__(/*! @ethersproject/base64 */ "./node_modules/@ethersproject/base64/lib.esm/index.js")); + +exports.base64 = base64; + +var basex_1 = __webpack_require__(/*! @ethersproject/basex */ "./node_modules/@ethersproject/basex/lib.esm/index.js"); + +Object.defineProperty(exports, "base58", { + enumerable: true, + get: function get() { + return basex_1.Base58; + } +}); + +var bytes_1 = __webpack_require__(/*! @ethersproject/bytes */ "./node_modules/@ethersproject/bytes/lib.esm/index.js"); + +Object.defineProperty(exports, "arrayify", { + enumerable: true, + get: function get() { + return bytes_1.arrayify; + } +}); +Object.defineProperty(exports, "concat", { + enumerable: true, + get: function get() { + return bytes_1.concat; + } +}); +Object.defineProperty(exports, "hexConcat", { + enumerable: true, + get: function get() { + return bytes_1.hexConcat; + } +}); +Object.defineProperty(exports, "hexDataSlice", { + enumerable: true, + get: function get() { + return bytes_1.hexDataSlice; + } +}); +Object.defineProperty(exports, "hexDataLength", { + enumerable: true, + get: function get() { + return bytes_1.hexDataLength; + } +}); +Object.defineProperty(exports, "hexlify", { + enumerable: true, + get: function get() { + return bytes_1.hexlify; + } +}); +Object.defineProperty(exports, "hexStripZeros", { + enumerable: true, + get: function get() { + return bytes_1.hexStripZeros; + } +}); +Object.defineProperty(exports, "hexValue", { + enumerable: true, + get: function get() { + return bytes_1.hexValue; + } +}); +Object.defineProperty(exports, "hexZeroPad", { + enumerable: true, + get: function get() { + return bytes_1.hexZeroPad; + } +}); +Object.defineProperty(exports, "isBytes", { + enumerable: true, + get: function get() { + return bytes_1.isBytes; + } +}); +Object.defineProperty(exports, "isBytesLike", { + enumerable: true, + get: function get() { + return bytes_1.isBytesLike; + } +}); +Object.defineProperty(exports, "isHexString", { + enumerable: true, + get: function get() { + return bytes_1.isHexString; + } +}); +Object.defineProperty(exports, "joinSignature", { + enumerable: true, + get: function get() { + return bytes_1.joinSignature; + } +}); +Object.defineProperty(exports, "zeroPad", { + enumerable: true, + get: function get() { + return bytes_1.zeroPad; + } +}); +Object.defineProperty(exports, "splitSignature", { + enumerable: true, + get: function get() { + return bytes_1.splitSignature; + } +}); +Object.defineProperty(exports, "stripZeros", { + enumerable: true, + get: function get() { + return bytes_1.stripZeros; + } +}); + +var hash_1 = __webpack_require__(/*! @ethersproject/hash */ "./node_modules/@ethersproject/hash/lib.esm/index.js"); + +Object.defineProperty(exports, "_TypedDataEncoder", { + enumerable: true, + get: function get() { + return hash_1._TypedDataEncoder; + } +}); +Object.defineProperty(exports, "hashMessage", { + enumerable: true, + get: function get() { + return hash_1.hashMessage; + } +}); +Object.defineProperty(exports, "id", { + enumerable: true, + get: function get() { + return hash_1.id; + } +}); +Object.defineProperty(exports, "isValidName", { + enumerable: true, + get: function get() { + return hash_1.isValidName; + } +}); +Object.defineProperty(exports, "namehash", { + enumerable: true, + get: function get() { + return hash_1.namehash; + } +}); + +var hdnode_1 = __webpack_require__(/*! @ethersproject/hdnode */ "./node_modules/@ethersproject/hdnode/lib.esm/index.js"); + +Object.defineProperty(exports, "defaultPath", { + enumerable: true, + get: function get() { + return hdnode_1.defaultPath; + } +}); +Object.defineProperty(exports, "entropyToMnemonic", { + enumerable: true, + get: function get() { + return hdnode_1.entropyToMnemonic; + } +}); +Object.defineProperty(exports, "getAccountPath", { + enumerable: true, + get: function get() { + return hdnode_1.getAccountPath; + } +}); +Object.defineProperty(exports, "HDNode", { + enumerable: true, + get: function get() { + return hdnode_1.HDNode; + } +}); +Object.defineProperty(exports, "isValidMnemonic", { + enumerable: true, + get: function get() { + return hdnode_1.isValidMnemonic; + } +}); +Object.defineProperty(exports, "mnemonicToEntropy", { + enumerable: true, + get: function get() { + return hdnode_1.mnemonicToEntropy; + } +}); +Object.defineProperty(exports, "mnemonicToSeed", { + enumerable: true, + get: function get() { + return hdnode_1.mnemonicToSeed; + } +}); + +var json_wallets_1 = __webpack_require__(/*! @ethersproject/json-wallets */ "./node_modules/@ethersproject/json-wallets/lib.esm/index.js"); + +Object.defineProperty(exports, "getJsonWalletAddress", { + enumerable: true, + get: function get() { + return json_wallets_1.getJsonWalletAddress; + } +}); + +var keccak256_1 = __webpack_require__(/*! @ethersproject/keccak256 */ "./node_modules/@ethersproject/keccak256/lib.esm/index.js"); + +Object.defineProperty(exports, "keccak256", { + enumerable: true, + get: function get() { + return keccak256_1.keccak256; + } +}); + +var logger_1 = __webpack_require__(/*! @ethersproject/logger */ "./node_modules/@ethersproject/logger/lib.esm/index.js"); + +Object.defineProperty(exports, "Logger", { + enumerable: true, + get: function get() { + return logger_1.Logger; + } +}); + +var sha2_1 = __webpack_require__(/*! @ethersproject/sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/index.js"); + +Object.defineProperty(exports, "computeHmac", { + enumerable: true, + get: function get() { + return sha2_1.computeHmac; + } +}); +Object.defineProperty(exports, "ripemd160", { + enumerable: true, + get: function get() { + return sha2_1.ripemd160; + } +}); +Object.defineProperty(exports, "sha256", { + enumerable: true, + get: function get() { + return sha2_1.sha256; + } +}); +Object.defineProperty(exports, "sha512", { + enumerable: true, + get: function get() { + return sha2_1.sha512; + } +}); + +var solidity_1 = __webpack_require__(/*! @ethersproject/solidity */ "./node_modules/@ethersproject/solidity/lib.esm/index.js"); + +Object.defineProperty(exports, "solidityKeccak256", { + enumerable: true, + get: function get() { + return solidity_1.keccak256; + } +}); +Object.defineProperty(exports, "solidityPack", { + enumerable: true, + get: function get() { + return solidity_1.pack; + } +}); +Object.defineProperty(exports, "soliditySha256", { + enumerable: true, + get: function get() { + return solidity_1.sha256; + } +}); + +var random_1 = __webpack_require__(/*! @ethersproject/random */ "./node_modules/@ethersproject/random/lib.esm/index.js"); + +Object.defineProperty(exports, "randomBytes", { + enumerable: true, + get: function get() { + return random_1.randomBytes; + } +}); +Object.defineProperty(exports, "shuffled", { + enumerable: true, + get: function get() { + return random_1.shuffled; + } +}); + +var properties_1 = __webpack_require__(/*! @ethersproject/properties */ "./node_modules/@ethersproject/properties/lib.esm/index.js"); + +Object.defineProperty(exports, "checkProperties", { + enumerable: true, + get: function get() { + return properties_1.checkProperties; + } +}); +Object.defineProperty(exports, "deepCopy", { + enumerable: true, + get: function get() { + return properties_1.deepCopy; + } +}); +Object.defineProperty(exports, "defineReadOnly", { + enumerable: true, + get: function get() { + return properties_1.defineReadOnly; + } +}); +Object.defineProperty(exports, "getStatic", { + enumerable: true, + get: function get() { + return properties_1.getStatic; + } +}); +Object.defineProperty(exports, "resolveProperties", { + enumerable: true, + get: function get() { + return properties_1.resolveProperties; + } +}); +Object.defineProperty(exports, "shallowCopy", { + enumerable: true, + get: function get() { + return properties_1.shallowCopy; + } +}); + +var RLP = __importStar(__webpack_require__(/*! @ethersproject/rlp */ "./node_modules/@ethersproject/rlp/lib.esm/index.js")); + +exports.RLP = RLP; + +var signing_key_1 = __webpack_require__(/*! @ethersproject/signing-key */ "./node_modules/@ethersproject/signing-key/lib.esm/index.js"); + +Object.defineProperty(exports, "computePublicKey", { + enumerable: true, + get: function get() { + return signing_key_1.computePublicKey; + } +}); +Object.defineProperty(exports, "recoverPublicKey", { + enumerable: true, + get: function get() { + return signing_key_1.recoverPublicKey; + } +}); +Object.defineProperty(exports, "SigningKey", { + enumerable: true, + get: function get() { + return signing_key_1.SigningKey; + } +}); + +var strings_1 = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); + +Object.defineProperty(exports, "formatBytes32String", { + enumerable: true, + get: function get() { + return strings_1.formatBytes32String; + } +}); +Object.defineProperty(exports, "nameprep", { + enumerable: true, + get: function get() { + return strings_1.nameprep; + } +}); +Object.defineProperty(exports, "parseBytes32String", { + enumerable: true, + get: function get() { + return strings_1.parseBytes32String; + } +}); +Object.defineProperty(exports, "_toEscapedUtf8String", { + enumerable: true, + get: function get() { + return strings_1._toEscapedUtf8String; + } +}); +Object.defineProperty(exports, "toUtf8Bytes", { + enumerable: true, + get: function get() { + return strings_1.toUtf8Bytes; + } +}); +Object.defineProperty(exports, "toUtf8CodePoints", { + enumerable: true, + get: function get() { + return strings_1.toUtf8CodePoints; + } +}); +Object.defineProperty(exports, "toUtf8String", { + enumerable: true, + get: function get() { + return strings_1.toUtf8String; + } +}); +Object.defineProperty(exports, "Utf8ErrorFuncs", { + enumerable: true, + get: function get() { + return strings_1.Utf8ErrorFuncs; + } +}); + +var transactions_1 = __webpack_require__(/*! @ethersproject/transactions */ "./node_modules/@ethersproject/transactions/lib.esm/index.js"); + +Object.defineProperty(exports, "accessListify", { + enumerable: true, + get: function get() { + return transactions_1.accessListify; + } +}); +Object.defineProperty(exports, "computeAddress", { + enumerable: true, + get: function get() { + return transactions_1.computeAddress; + } +}); +Object.defineProperty(exports, "parseTransaction", { + enumerable: true, + get: function get() { + return transactions_1.parse; + } +}); +Object.defineProperty(exports, "recoverAddress", { + enumerable: true, + get: function get() { + return transactions_1.recoverAddress; + } +}); +Object.defineProperty(exports, "serializeTransaction", { + enumerable: true, + get: function get() { + return transactions_1.serialize; + } +}); +Object.defineProperty(exports, "TransactionTypes", { + enumerable: true, + get: function get() { + return transactions_1.TransactionTypes; + } +}); + +var units_1 = __webpack_require__(/*! @ethersproject/units */ "./node_modules/@ethersproject/units/lib.esm/index.js"); + +Object.defineProperty(exports, "commify", { + enumerable: true, + get: function get() { + return units_1.commify; + } +}); +Object.defineProperty(exports, "formatEther", { + enumerable: true, + get: function get() { + return units_1.formatEther; + } +}); +Object.defineProperty(exports, "parseEther", { + enumerable: true, + get: function get() { + return units_1.parseEther; + } +}); +Object.defineProperty(exports, "formatUnits", { + enumerable: true, + get: function get() { + return units_1.formatUnits; + } +}); +Object.defineProperty(exports, "parseUnits", { + enumerable: true, + get: function get() { + return units_1.parseUnits; + } +}); + +var wallet_1 = __webpack_require__(/*! @ethersproject/wallet */ "./node_modules/@ethersproject/wallet/lib.esm/index.js"); + +Object.defineProperty(exports, "verifyMessage", { + enumerable: true, + get: function get() { + return wallet_1.verifyMessage; + } +}); +Object.defineProperty(exports, "verifyTypedData", { + enumerable: true, + get: function get() { + return wallet_1.verifyTypedData; + } +}); + +var web_1 = __webpack_require__(/*! @ethersproject/web */ "./node_modules/@ethersproject/web/lib.esm/index.js"); + +Object.defineProperty(exports, "_fetchData", { + enumerable: true, + get: function get() { + return web_1._fetchData; + } +}); +Object.defineProperty(exports, "fetchJson", { + enumerable: true, + get: function get() { + return web_1.fetchJson; + } +}); +Object.defineProperty(exports, "poll", { + enumerable: true, + get: function get() { + return web_1.poll; + } +}); //////////////////////// +// Enums + +var sha2_2 = __webpack_require__(/*! @ethersproject/sha2 */ "./node_modules/@ethersproject/sha2/lib.esm/index.js"); + +Object.defineProperty(exports, "SupportedAlgorithm", { + enumerable: true, + get: function get() { + return sha2_2.SupportedAlgorithm; + } +}); + +var strings_2 = __webpack_require__(/*! @ethersproject/strings */ "./node_modules/@ethersproject/strings/lib.esm/index.js"); + +Object.defineProperty(exports, "UnicodeNormalizationForm", { + enumerable: true, + get: function get() { + return strings_2.UnicodeNormalizationForm; + } +}); +Object.defineProperty(exports, "Utf8ErrorReason", { + enumerable: true, + get: function get() { + return strings_2.Utf8ErrorReason; + } +}); + +/***/ }), + +/***/ "./node_modules/eventemitter3/index.js": +/*!*********************************************!*\ + !*** ./node_modules/eventemitter3/index.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var has = Object.prototype.hasOwnProperty, + prefix = '~'; +/** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @private + */ + +function Events() {} // +// We try to not inherit from `Object.prototype`. In some engines creating an +// instance in this way is faster than calling `Object.create(null)` directly. +// If `Object.create(null)` is not supported we prefix the event names with a +// character to make sure that the built-in object properties are not +// overridden or used as an attack vector. +// + + +if (Object.create) { + Events.prototype = Object.create(null); // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + + if (!new Events().__proto__) prefix = false; +} +/** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @private + */ + + +function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; +} +/** + * Add a listener for a given event. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} once Specify if the listener is a one-time listener. + * @returns {EventEmitter} + * @private + */ + + +function addListener(emitter, event, fn, context, once) { + if (typeof fn !== 'function') { + throw new TypeError('The listener must be a function'); + } + + var listener = new EE(fn, context || emitter, once), + evt = prefix ? prefix + event : event; + if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);else emitter._events[evt] = [emitter._events[evt], listener]; + return emitter; +} +/** + * Clear event by name. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} evt The Event name. + * @private + */ + + +function clearEvent(emitter, evt) { + if (--emitter._eventsCount === 0) emitter._events = new Events();else delete emitter._events[evt]; +} +/** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @public + */ + + +function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; +} +/** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @public + */ + + +EventEmitter.prototype.eventNames = function eventNames() { + var names = [], + events, + name; + if (this._eventsCount === 0) return names; + + for (name in events = this._events) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; +}; +/** + * Return the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Array} The registered listeners. + * @public + */ + + +EventEmitter.prototype.listeners = function listeners(event) { + var evt = prefix ? prefix + event : event, + handlers = this._events[evt]; + if (!handlers) return []; + if (handlers.fn) return [handlers.fn]; + + for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { + ee[i] = handlers[i].fn; + } + + return ee; +}; +/** + * Return the number of listeners listening to a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Number} The number of listeners. + * @public + */ + + +EventEmitter.prototype.listenerCount = function listenerCount(event) { + var evt = prefix ? prefix + event : event, + listeners = this._events[evt]; + if (!listeners) return 0; + if (listeners.fn) return 1; + return listeners.length; +}; +/** + * Calls each of the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @public + */ + + +EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + if (!this._events[evt]) return false; + var listeners = this._events[evt], + len = arguments.length, + args, + i; + + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: + return listeners.fn.call(listeners.context), true; + + case 2: + return listeners.fn.call(listeners.context, a1), true; + + case 3: + return listeners.fn.call(listeners.context, a1, a2), true; + + case 4: + return listeners.fn.call(listeners.context, a1, a2, a3), true; + + case 5: + return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + + case 6: + return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len - 1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length, + j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: + listeners[i].fn.call(listeners[i].context); + break; + + case 2: + listeners[i].fn.call(listeners[i].context, a1); + break; + + case 3: + listeners[i].fn.call(listeners[i].context, a1, a2); + break; + + case 4: + listeners[i].fn.call(listeners[i].context, a1, a2, a3); + break; + + default: + if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) { + args[j - 1] = arguments[j]; + } + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; +}; +/** + * Add a listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ + + +EventEmitter.prototype.on = function on(event, fn, context) { + return addListener(this, event, fn, context, false); +}; +/** + * Add a one-time listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ + + +EventEmitter.prototype.once = function once(event, fn, context) { + return addListener(this, event, fn, context, true); +}; +/** + * Remove the listeners of a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @public + */ + + +EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + if (!this._events[evt]) return this; + + if (!fn) { + clearEvent(this, evt); + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) { + clearEvent(this, evt); + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) { + events.push(listeners[i]); + } + } // + // Reset the array, or remove it completely if we have no more listeners. + // + + + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;else clearEvent(this, evt); + } + + return this; +}; +/** + * Remove all listeners, or those of the specified event. + * + * @param {(String|Symbol)} [event] The event name. + * @returns {EventEmitter} `this`. + * @public + */ + + +EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) clearEvent(this, evt); + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; +}; // +// Alias methods names because people roll like that. +// + + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; +EventEmitter.prototype.addListener = EventEmitter.prototype.on; // +// Expose the prefix. +// + +EventEmitter.prefixed = prefix; // +// Allow `EventEmitter` to be imported as module namespace. +// + +EventEmitter.EventEmitter = EventEmitter; // +// Expose the module. +// + +if (true) { + module.exports = EventEmitter; +} + +/***/ }), + +/***/ "./node_modules/events/events.js": +/*!***************************************!*\ + !*** ./node_modules/events/events.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +var R = (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === 'object' ? Reflect : null; +var ReflectApply = R && typeof R.apply === 'function' ? R.apply : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); +}; +var ReflectOwnKeys; + +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys; +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +}; + +function EventEmitter() { + EventEmitter.init.call(this); +} + +module.exports = EventEmitter; +module.exports.once = once; // Backwards-compat with node 0.10.x + +EventEmitter.EventEmitter = EventEmitter; +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; // By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. + +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + _typeof(listener)); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function get() { + return defaultMaxListeners; + }, + set: function set(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function () { + if (this._events === undefined || this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; // Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. + + +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + + for (var i = 1; i < arguments.length; i++) { + args.push(arguments[i]); + } + + var doError = type === 'error'; + var events = this._events; + if (events !== undefined) doError = doError && events.error === undefined;else if (!doError) return false; // If there is no 'error' event listener then throw. + + if (doError) { + var er; + if (args.length > 0) er = args[0]; + + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } // At least give some kind of context to the user + + + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + if (handler === undefined) return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + + for (var i = 0; i < len; ++i) { + ReflectApply(listeners[i], this, args); + } + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + checkListener(listener); + events = target._events; + + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, listener.listener ? listener.listener : listener); // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + + events = target._events; + } + + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = prepend ? [listener, existing] : [existing, listener]; // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } // Check for listener leak + + + m = _getMaxListeners(target); + + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + + var w = new Error('Possible EventEmitter memory leak detected. ' + existing.length + ' ' + String(type) + ' listeners ' + 'added. Use emitter.setMaxListeners() to ' + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = function prependListener(type, listener) { + return _addListener(this, type, listener, true); +}; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { + fired: false, + wrapFn: undefined, + target: target, + type: type, + listener: listener + }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; +}; // Emits a 'removeListener' event if and only if the listener was removed. + + +EventEmitter.prototype.removeListener = function removeListener(type, listener) { + var list, events, position, i, originalListener; + checkListener(listener); + events = this._events; + if (events === undefined) return this; + list = events[type]; + if (list === undefined) return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) this._events = Object.create(null);else { + delete events[type]; + if (events.removeListener) this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) return this; + if (position === 0) list.shift();else { + spliceOne(list, position); + } + if (list.length === 1) events[type] = list[0]; + if (events.removeListener !== undefined) this.emit('removeListener', type, originalListener || listener); + } + + return this; +}; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = function removeAllListeners(type) { + var listeners, events, i; + events = this._events; + if (events === undefined) return this; // not listening for removeListener, no need to emit + + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) this._events = Object.create(null);else delete events[type]; + } + + return this; + } // emit removeListener for all listeners on all events + + + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; +}; + +function _listeners(target, type, unwrap) { + var events = target._events; + if (events === undefined) return []; + var evlistener = events[type]; + if (evlistener === undefined) return []; + if (typeof evlistener === 'function') return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function (emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; + +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + + for (var i = 0; i < n; ++i) { + copy[i] = arr[i]; + } + + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) { + list[index] = list[index + 1]; + } + + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + + resolve([].slice.call(arguments)); + } + + ; + eventTargetAgnosticAddListener(emitter, name, resolver, { + once: true + }); + + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { + once: true + }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + _typeof(emitter)); + } +} + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash.js": +/*!******************************************!*\ + !*** ./node_modules/hash.js/lib/hash.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var hash = exports; +hash.utils = __webpack_require__(/*! ./hash/utils */ "./node_modules/hash.js/lib/hash/utils.js"); +hash.common = __webpack_require__(/*! ./hash/common */ "./node_modules/hash.js/lib/hash/common.js"); +hash.sha = __webpack_require__(/*! ./hash/sha */ "./node_modules/hash.js/lib/hash/sha.js"); +hash.ripemd = __webpack_require__(/*! ./hash/ripemd */ "./node_modules/hash.js/lib/hash/ripemd.js"); +hash.hmac = __webpack_require__(/*! ./hash/hmac */ "./node_modules/hash.js/lib/hash/hmac.js"); // Proxy hash functions to the main object + +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/common.js": +/*!*************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/common.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = 'big'; + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; +} + +exports.BlockHash = BlockHash; + +BlockHash.prototype.update = function update(msg, enc) { + // Convert message to array, pad it, and join into 32bit blocks + msg = utils.toArray(msg, enc); + if (!this.pending) this.pending = msg;else this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; // Enough data, try updating + + if (this.pending.length >= this._delta8) { + msg = this.pending; // Process pending data in blocks + + var r = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r, msg.length); + if (this.pending.length === 0) this.pending = null; + msg = utils.join32(msg, 0, msg.length - r, this.endian); + + for (var i = 0; i < msg.length; i += this._delta32) { + this._update(msg, i, i + this._delta32); + } + } + + return this; +}; + +BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert(this.pending === null); + return this._digest(enc); +}; + +BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - (len + this.padLength) % bytes; + var res = new Array(k + this.padLength); + res[0] = 0x80; + + for (var i = 1; i < k; i++) { + res[i] = 0; + } // Append length + + + len <<= 3; + + if (this.endian === 'big') { + for (var t = 8; t < this.padLength; t++) { + res[i++] = 0; + } + + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = len >>> 24 & 0xff; + res[i++] = len >>> 16 & 0xff; + res[i++] = len >>> 8 & 0xff; + res[i++] = len & 0xff; + } else { + res[i++] = len & 0xff; + res[i++] = len >>> 8 & 0xff; + res[i++] = len >>> 16 & 0xff; + res[i++] = len >>> 24 & 0xff; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + + for (t = 8; t < this.padLength; t++) { + res[i++] = 0; + } + } + + return res; +}; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/hmac.js": +/*!***********************************************!*\ + !*** ./node_modules/hash.js/lib/hash/hmac.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +function Hmac(hash, key, enc) { + if (!(this instanceof Hmac)) return new Hmac(hash, key, enc); + this.Hash = hash; + this.blockSize = hash.blockSize / 8; + this.outSize = hash.outSize / 8; + this.inner = null; + this.outer = null; + + this._init(utils.toArray(key, enc)); +} + +module.exports = Hmac; + +Hmac.prototype._init = function init(key) { + // Shorten key, if needed + if (key.length > this.blockSize) key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); // Add padding to key + + for (var i = key.length; i < this.blockSize; i++) { + key.push(0); + } + + for (i = 0; i < key.length; i++) { + key[i] ^= 0x36; + } + + this.inner = new this.Hash().update(key); // 0x36 ^ 0x5c = 0x6a + + for (i = 0; i < key.length; i++) { + key[i] ^= 0x6a; + } + + this.outer = new this.Hash().update(key); +}; + +Hmac.prototype.update = function update(msg, enc) { + this.inner.update(msg, enc); + return this; +}; + +Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); +}; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/ripemd.js": +/*!*************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/ripemd.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var common = __webpack_require__(/*! ./common */ "./node_modules/hash.js/lib/hash/common.js"); + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = common.BlockHash; + +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) return new RIPEMD160(); + BlockHash.call(this); + this.h = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; + this.endian = 'little'; +} + +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; + +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + + for (var j = 0; j < 80; j++) { + var T = sum32(rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32(rotl32(sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') return utils.toHex32(this.h, 'little');else return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) return x ^ y ^ z;else if (j <= 31) return x & y | ~x & z;else if (j <= 47) return (x | ~y) ^ z;else if (j <= 63) return x & z | y & ~z;else return x ^ (y | ~z); +} + +function K(j) { + if (j <= 15) return 0x00000000;else if (j <= 31) return 0x5a827999;else if (j <= 47) return 0x6ed9eba1;else if (j <= 63) return 0x8f1bbcdc;else return 0xa953fd4e; +} + +function Kh(j) { + if (j <= 15) return 0x50a28be6;else if (j <= 31) return 0x5c4dd124;else if (j <= 47) return 0x6d703ef3;else if (j <= 63) return 0x7a6d76e9;else return 0x00000000; +} + +var r = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]; +var rh = [5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]; +var s = [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]; +var sh = [8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha.js": +/*!**********************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.sha1 = __webpack_require__(/*! ./sha/1 */ "./node_modules/hash.js/lib/hash/sha/1.js"); +exports.sha224 = __webpack_require__(/*! ./sha/224 */ "./node_modules/hash.js/lib/hash/sha/224.js"); +exports.sha256 = __webpack_require__(/*! ./sha/256 */ "./node_modules/hash.js/lib/hash/sha/256.js"); +exports.sha384 = __webpack_require__(/*! ./sha/384 */ "./node_modules/hash.js/lib/hash/sha/384.js"); +exports.sha512 = __webpack_require__(/*! ./sha/512 */ "./node_modules/hash.js/lib/hash/sha/512.js"); + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/1.js": +/*!************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/1.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var common = __webpack_require__(/*! ../common */ "./node_modules/hash.js/lib/hash/common.js"); + +var shaCommon = __webpack_require__(/*! ./common */ "./node_modules/hash.js/lib/hash/sha/common.js"); + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_5 = utils.sum32_5; +var ft_1 = shaCommon.ft_1; +var BlockHash = common.BlockHash; +var sha1_K = [0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6]; + +function SHA1() { + if (!(this instanceof SHA1)) return new SHA1(); + BlockHash.call(this); + this.h = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; + this.W = new Array(80); +} + +utils.inherits(SHA1, BlockHash); +module.exports = SHA1; +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; + +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) { + W[i] = msg[start + i]; + } + + for (; i < W.length; i++) { + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + } + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + + for (i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); +}; + +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big'); +}; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/224.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/224.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var SHA256 = __webpack_require__(/*! ./256 */ "./node_modules/hash.js/lib/hash/sha/256.js"); + +function SHA224() { + if (!(this instanceof SHA224)) return new SHA224(); + SHA256.call(this); + this.h = [0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4]; +} + +utils.inherits(SHA224, SHA256); +module.exports = SHA224; +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; + +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') return utils.toHex32(this.h.slice(0, 7), 'big');else return utils.split32(this.h.slice(0, 7), 'big'); +}; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/256.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/256.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var common = __webpack_require__(/*! ../common */ "./node_modules/hash.js/lib/hash/common.js"); + +var shaCommon = __webpack_require__(/*! ./common */ "./node_modules/hash.js/lib/hash/sha/common.js"); + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var ch32 = shaCommon.ch32; +var maj32 = shaCommon.maj32; +var s0_256 = shaCommon.s0_256; +var s1_256 = shaCommon.s1_256; +var g0_256 = shaCommon.g0_256; +var g1_256 = shaCommon.g1_256; +var BlockHash = common.BlockHash; +var sha256_K = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; + +function SHA256() { + if (!(this instanceof SHA256)) return new SHA256(); + BlockHash.call(this); + this.h = [0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]; + this.k = sha256_K; + this.W = new Array(64); +} + +utils.inherits(SHA256, BlockHash); +module.exports = SHA256; +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; + +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) { + W[i] = msg[start + i]; + } + + for (; i < W.length; i++) { + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + } + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + assert(this.k.length === W.length); + + for (i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; + +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big'); +}; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/384.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/384.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var SHA512 = __webpack_require__(/*! ./512 */ "./node_modules/hash.js/lib/hash/sha/512.js"); + +function SHA384() { + if (!(this instanceof SHA384)) return new SHA384(); + SHA512.call(this); + this.h = [0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939, 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4]; +} + +utils.inherits(SHA384, SHA512); +module.exports = SHA384; +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; + +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') return utils.toHex32(this.h.slice(0, 12), 'big');else return utils.split32(this.h.slice(0, 12), 'big'); +}; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/512.js": +/*!**************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/512.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var common = __webpack_require__(/*! ../common */ "./node_modules/hash.js/lib/hash/common.js"); + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; +var BlockHash = common.BlockHash; +var sha512_K = [0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817]; + +function SHA512() { + if (!(this instanceof SHA512)) return new SHA512(); + BlockHash.call(this); + this.h = [0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1, 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179]; + this.k = sha512_K; + this.W = new Array(160); +} + +utils.inherits(SHA512, BlockHash); +module.exports = SHA512; +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; + +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; // 32 x 32bit words + + for (var i = 0; i < 32; i++) { + W[i] = msg[start + i]; + } + + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + + var c3_lo = W[i - 31]; + W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo); + W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo); + } +}; + +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + + var W = this.W; + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + assert(this.k.length === W.length); + + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; + var T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo); + var T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo); + c0_hi = s0_512_hi(ah, al); + c0_lo = s0_512_lo(ah, al); + c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + hh = gh; + hl = gl; + gh = fh; + gl = fl; + fh = eh; + fl = el; + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + dh = ch; + dl = cl; + ch = bh; + cl = bl; + bh = ah; + bl = al; + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; + +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') return utils.toHex32(this.h, 'big');else return utils.split32(this.h, 'big'); +}; + +function ch64_hi(xh, xl, yh, yl, zh) { + var r = xh & yh ^ ~xh & zh; + if (r < 0) r += 0x100000000; + return r; +} + +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ ~xl & zl; + if (r < 0) r += 0x100000000; + return r; +} + +function maj64_hi(xh, xl, yh, yl, zh) { + var r = xh & yh ^ xh & zh ^ yh & zh; + if (r < 0) r += 0x100000000; + return r; +} + +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ xl & zl ^ yl & zl; + if (r < 0) r += 0x100000000; + return r; +} + +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + + var c2_hi = rotr64_hi(xl, xh, 7); // 39 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) r += 0x100000000; + return r; +} + +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + + var c2_lo = rotr64_lo(xl, xh, 7); // 39 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) r += 0x100000000; + return r; +} + +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) r += 0x100000000; + return r; +} + +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) r += 0x100000000; + return r; +} + +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) r += 0x100000000; + return r; +} + +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) r += 0x100000000; + return r; +} + +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + + var c2_hi = shr64_hi(xh, xl, 6); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) r += 0x100000000; + return r; +} + +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + + var c2_lo = shr64_lo(xh, xl, 6); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) r += 0x100000000; + return r; +} + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/sha/common.js": +/*!*****************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/sha/common.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ "./node_modules/hash.js/lib/hash/utils.js"); + +var rotr32 = utils.rotr32; + +function ft_1(s, x, y, z) { + if (s === 0) return ch32(x, y, z); + if (s === 1 || s === 3) return p32(x, y, z); + if (s === 2) return maj32(x, y, z); +} + +exports.ft_1 = ft_1; + +function ch32(x, y, z) { + return x & y ^ ~x & z; +} + +exports.ch32 = ch32; + +function maj32(x, y, z) { + return x & y ^ x & z ^ y & z; +} + +exports.maj32 = maj32; + +function p32(x, y, z) { + return x ^ y ^ z; +} + +exports.p32 = p32; + +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} + +exports.s0_256 = s0_256; + +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} + +exports.s1_256 = s1_256; + +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3; +} + +exports.g0_256 = g0_256; + +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10; +} + +exports.g1_256 = g1_256; + +/***/ }), + +/***/ "./node_modules/hash.js/lib/hash/utils.js": +/*!************************************************!*\ + !*** ./node_modules/hash.js/lib/hash/utils.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ "./node_modules/minimalistic-assert/index.js"); + +var inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js"); + +exports.inherits = inherits; + +function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { + return false; + } + + if (i < 0 || i + 1 >= msg.length) { + return false; + } + + return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; +} + +function toArray(msg, enc) { + if (Array.isArray(msg)) return msg.slice(); + if (!msg) return []; + var res = []; + + if (typeof msg === 'string') { + if (!enc) { + // Inspired by stringToUtf8ByteArray() in closure-library by Google + // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 + // Apache License 2.0 + // https://github.com/google/closure-library/blob/master/LICENSE + var p = 0; + + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + + if (c < 128) { + res[p++] = c; + } else if (c < 2048) { + res[p++] = c >> 6 | 192; + res[p++] = c & 63 | 128; + } else if (isSurrogatePair(msg, i)) { + c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); + res[p++] = c >> 18 | 240; + res[p++] = c >> 12 & 63 | 128; + res[p++] = c >> 6 & 63 | 128; + res[p++] = c & 63 | 128; + } else { + res[p++] = c >> 12 | 224; + res[p++] = c >> 6 & 63 | 128; + res[p++] = c & 63 | 128; + } + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) msg = '0' + msg; + + for (i = 0; i < msg.length; i += 2) { + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } + } else { + for (i = 0; i < msg.length; i++) { + res[i] = msg[i] | 0; + } + } + + return res; +} + +exports.toArray = toArray; + +function toHex(msg) { + var res = ''; + + for (var i = 0; i < msg.length; i++) { + res += zero2(msg[i].toString(16)); + } + + return res; +} + +exports.toHex = toHex; + +function htonl(w) { + var res = w >>> 24 | w >>> 8 & 0xff00 | w << 8 & 0xff0000 | (w & 0xff) << 24; + return res >>> 0; +} + +exports.htonl = htonl; + +function toHex32(msg, endian) { + var res = ''; + + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') w = htonl(w); + res += zero8(w.toString(16)); + } + + return res; +} + +exports.toHex32 = toHex32; + +function zero2(word) { + if (word.length === 1) return '0' + word;else return word; +} + +exports.zero2 = zero2; + +function zero8(word) { + if (word.length === 7) return '0' + word;else if (word.length === 6) return '00' + word;else if (word.length === 5) return '000' + word;else if (word.length === 4) return '0000' + word;else if (word.length === 3) return '00000' + word;else if (word.length === 2) return '000000' + word;else if (word.length === 1) return '0000000' + word;else return word; +} + +exports.zero8 = zero8; + +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') w = msg[k] << 24 | msg[k + 1] << 16 | msg[k + 2] << 8 | msg[k + 3];else w = msg[k + 3] << 24 | msg[k + 2] << 16 | msg[k + 1] << 8 | msg[k]; + res[i] = w >>> 0; + } + + return res; +} + +exports.join32 = join32; + +function split32(msg, endian) { + var res = new Array(msg.length * 4); + + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = m >>> 16 & 0xff; + res[k + 2] = m >>> 8 & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = m >>> 16 & 0xff; + res[k + 1] = m >>> 8 & 0xff; + res[k] = m & 0xff; + } + } + + return res; +} + +exports.split32 = split32; + +function rotr32(w, b) { + return w >>> b | w << 32 - b; +} + +exports.rotr32 = rotr32; + +function rotl32(w, b) { + return w << b | w >>> 32 - b; +} + +exports.rotl32 = rotl32; + +function sum32(a, b) { + return a + b >>> 0; +} + +exports.sum32 = sum32; + +function sum32_3(a, b, c) { + return a + b + c >>> 0; +} + +exports.sum32_3 = sum32_3; + +function sum32_4(a, b, c, d) { + return a + b + c + d >>> 0; +} + +exports.sum32_4 = sum32_4; + +function sum32_5(a, b, c, d, e) { + return a + b + c + d + e >>> 0; +} + +exports.sum32_5 = sum32_5; + +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + var lo = al + bl >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} + +exports.sum64 = sum64; + +function sum64_hi(ah, al, bh, bl) { + var lo = al + bl >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +} + +exports.sum64_hi = sum64_hi; + +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +} + +exports.sum64_lo = sum64_lo; + +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = lo + bl >>> 0; + carry += lo < al ? 1 : 0; + lo = lo + cl >>> 0; + carry += lo < cl ? 1 : 0; + lo = lo + dl >>> 0; + carry += lo < dl ? 1 : 0; + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +} + +exports.sum64_4_hi = sum64_4_hi; + +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +} + +exports.sum64_4_lo = sum64_4_lo; + +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = lo + bl >>> 0; + carry += lo < al ? 1 : 0; + lo = lo + cl >>> 0; + carry += lo < cl ? 1 : 0; + lo = lo + dl >>> 0; + carry += lo < dl ? 1 : 0; + lo = lo + el >>> 0; + carry += lo < el ? 1 : 0; + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; +} + +exports.sum64_5_hi = sum64_5_hi; + +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + return lo >>> 0; +} + +exports.sum64_5_lo = sum64_5_lo; + +function rotr64_hi(ah, al, num) { + var r = al << 32 - num | ah >>> num; + return r >>> 0; +} + +exports.rotr64_hi = rotr64_hi; + +function rotr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; +} + +exports.rotr64_lo = rotr64_lo; + +function shr64_hi(ah, al, num) { + return ah >>> num; +} + +exports.shr64_hi = shr64_hi; + +function shr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; +} + +exports.shr64_lo = shr64_lo; + +/***/ }), + +/***/ "./node_modules/ieee754/index.js": +/*!***************************************!*\ + !*** ./node_modules/ieee754/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var nBits = -7; + var i = isLE ? nBytes - 1 : 0; + var d = isLE ? -1 : 1; + var s = buffer[offset + i]; + i += d; + e = s & (1 << -nBits) - 1; + s >>= -nBits; + nBits += eLen; + + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & (1 << -nBits) - 1; + e >>= -nBits; + nBits += mLen; + + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias; + } else if (e === eMax) { + return m ? NaN : (s ? -1 : 1) * Infinity; + } else { + m = m + Math.pow(2, mLen); + e = e - eBias; + } + + return (s ? -1 : 1) * m * Math.pow(2, e - mLen); +}; + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c; + var eLen = nBytes * 8 - mLen - 1; + var eMax = (1 << eLen) - 1; + var eBias = eMax >> 1; + var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; + var i = isLE ? 0 : nBytes - 1; + var d = isLE ? 1 : -1; + var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; + value = Math.abs(value); + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0; + e = eMax; + } else { + e = Math.floor(Math.log(value) / Math.LN2); + + if (value * (c = Math.pow(2, -e)) < 1) { + e--; + c *= 2; + } + + if (e + eBias >= 1) { + value += rt / c; + } else { + value += rt * Math.pow(2, 1 - eBias); + } + + if (value * c >= 2) { + e++; + c /= 2; + } + + if (e + eBias >= eMax) { + m = 0; + e = eMax; + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen); + e = e + eBias; + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); + e = 0; + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = e << mLen | m; + eLen += mLen; + + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128; +}; + +/***/ }), + +/***/ "./node_modules/inherits/inherits_browser.js": +/*!***************************************************!*\ + !*** ./node_modules/inherits/inherits_browser.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + + var TempCtor = function TempCtor() {}; + + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; +} + +/***/ }), + +/***/ "./node_modules/is-typedarray/index.js": +/*!*********************************************!*\ + !*** ./node_modules/is-typedarray/index.js ***! + \*********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = isTypedArray; +isTypedArray.strict = isStrictTypedArray; +isTypedArray.loose = isLooseTypedArray; +var toString = Object.prototype.toString; +var names = { + '[object Int8Array]': true, + '[object Int16Array]': true, + '[object Int32Array]': true, + '[object Uint8Array]': true, + '[object Uint8ClampedArray]': true, + '[object Uint16Array]': true, + '[object Uint32Array]': true, + '[object Float32Array]': true, + '[object Float64Array]': true +}; + +function isTypedArray(arr) { + return isStrictTypedArray(arr) || isLooseTypedArray(arr); +} + +function isStrictTypedArray(arr) { + return arr instanceof Int8Array || arr instanceof Int16Array || arr instanceof Int32Array || arr instanceof Uint8Array || arr instanceof Uint8ClampedArray || arr instanceof Uint16Array || arr instanceof Uint32Array || arr instanceof Float32Array || arr instanceof Float64Array; +} + +function isLooseTypedArray(arr) { + return names[toString.call(arr)]; +} + +/***/ }), + +/***/ "./node_modules/isarray/index.js": +/*!***************************************!*\ + !*** ./node_modules/isarray/index.js ***! + \***************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + +/***/ }), + +/***/ "./node_modules/js-sha3/src/sha3.js": +/*!******************************************!*\ + !*** ./node_modules/js-sha3/src/sha3.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process, global, module) {var __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */ + +/*jslint bitwise: true */ +(function () { + 'use strict'; + + var INPUT_ERROR = 'input is invalid type'; + var FINALIZE_ERROR = 'finalize already called'; + var WINDOW = (typeof window === "undefined" ? "undefined" : _typeof(window)) === 'object'; + var root = WINDOW ? window : {}; + + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + + var WEB_WORKER = !WINDOW && (typeof self === "undefined" ? "undefined" : _typeof(self)) === 'object'; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && (typeof process === "undefined" ? "undefined" : _typeof(process)) === 'object' && process.versions && process.versions.node; + + if (NODE_JS) { + root = global; + } else if (WEB_WORKER) { + root = self; + } + + var COMMON_JS = !root.JS_SHA3_NO_COMMON_JS && ( false ? undefined : _typeof(module)) === 'object' && module.exports; + var AMD = true && __webpack_require__(/*! !webpack amd options */ "./node_modules/webpack/buildin/amd-options.js"); + var ARRAY_BUFFER = !root.JS_SHA3_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined'; + var HEX_CHARS = '0123456789abcdef'.split(''); + var SHAKE_PADDING = [31, 7936, 2031616, 520093696]; + var CSHAKE_PADDING = [4, 1024, 262144, 67108864]; + var KECCAK_PADDING = [1, 256, 65536, 16777216]; + var PADDING = [6, 1536, 393216, 100663296]; + var SHIFT = [0, 8, 16, 24]; + var RC = [1, 0, 32898, 0, 32906, 2147483648, 2147516416, 2147483648, 32907, 0, 2147483649, 0, 2147516545, 2147483648, 32777, 2147483648, 138, 0, 136, 0, 2147516425, 0, 2147483658, 0, 2147516555, 0, 139, 2147483648, 32905, 2147483648, 32771, 2147483648, 32770, 2147483648, 128, 2147483648, 32778, 0, 2147483658, 2147483648, 2147516545, 2147483648, 32896, 2147483648, 2147483649, 0, 2147516424, 2147483648]; + var BITS = [224, 256, 384, 512]; + var SHAKE_BITS = [128, 256]; + var OUTPUT_TYPES = ['hex', 'buffer', 'arrayBuffer', 'array', 'digest']; + var CSHAKE_BYTEPAD = { + '128': 168, + '256': 136 + }; + + if (root.JS_SHA3_NO_NODE_JS || !Array.isArray) { + Array.isArray = function (obj) { + return Object.prototype.toString.call(obj) === '[object Array]'; + }; + } + + if (ARRAY_BUFFER && (root.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) { + ArrayBuffer.isView = function (obj) { + return _typeof(obj) === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer; + }; + } + + var createOutputMethod = function createOutputMethod(bits, padding, outputType) { + return function (message) { + return new Keccak(bits, padding, bits).update(message)[outputType](); + }; + }; + + var createShakeOutputMethod = function createShakeOutputMethod(bits, padding, outputType) { + return function (message, outputBits) { + return new Keccak(bits, padding, outputBits).update(message)[outputType](); + }; + }; + + var createCshakeOutputMethod = function createCshakeOutputMethod(bits, padding, outputType) { + return function (message, outputBits, n, s) { + return methods['cshake' + bits].update(message, outputBits, n, s)[outputType](); + }; + }; + + var createKmacOutputMethod = function createKmacOutputMethod(bits, padding, outputType) { + return function (key, message, outputBits, s) { + return methods['kmac' + bits].update(key, message, outputBits, s)[outputType](); + }; + }; + + var createOutputMethods = function createOutputMethods(method, createMethod, bits, padding) { + for (var i = 0; i < OUTPUT_TYPES.length; ++i) { + var type = OUTPUT_TYPES[i]; + method[type] = createMethod(bits, padding, type); + } + + return method; + }; + + var createMethod = function createMethod(bits, padding) { + var method = createOutputMethod(bits, padding, 'hex'); + + method.create = function () { + return new Keccak(bits, padding, bits); + }; + + method.update = function (message) { + return method.create().update(message); + }; + + return createOutputMethods(method, createOutputMethod, bits, padding); + }; + + var createShakeMethod = function createShakeMethod(bits, padding) { + var method = createShakeOutputMethod(bits, padding, 'hex'); + + method.create = function (outputBits) { + return new Keccak(bits, padding, outputBits); + }; + + method.update = function (message, outputBits) { + return method.create(outputBits).update(message); + }; + + return createOutputMethods(method, createShakeOutputMethod, bits, padding); + }; + + var createCshakeMethod = function createCshakeMethod(bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createCshakeOutputMethod(bits, padding, 'hex'); + + method.create = function (outputBits, n, s) { + if (!n && !s) { + return methods['shake' + bits].create(outputBits); + } else { + return new Keccak(bits, padding, outputBits).bytepad([n, s], w); + } + }; + + method.update = function (message, outputBits, n, s) { + return method.create(outputBits, n, s).update(message); + }; + + return createOutputMethods(method, createCshakeOutputMethod, bits, padding); + }; + + var createKmacMethod = function createKmacMethod(bits, padding) { + var w = CSHAKE_BYTEPAD[bits]; + var method = createKmacOutputMethod(bits, padding, 'hex'); + + method.create = function (key, outputBits, s) { + return new Kmac(bits, padding, outputBits).bytepad(['KMAC', s], w).bytepad([key], w); + }; + + method.update = function (key, message, outputBits, s) { + return method.create(key, outputBits, s).update(message); + }; + + return createOutputMethods(method, createKmacOutputMethod, bits, padding); + }; + + var algorithms = [{ + name: 'keccak', + padding: KECCAK_PADDING, + bits: BITS, + createMethod: createMethod + }, { + name: 'sha3', + padding: PADDING, + bits: BITS, + createMethod: createMethod + }, { + name: 'shake', + padding: SHAKE_PADDING, + bits: SHAKE_BITS, + createMethod: createShakeMethod + }, { + name: 'cshake', + padding: CSHAKE_PADDING, + bits: SHAKE_BITS, + createMethod: createCshakeMethod + }, { + name: 'kmac', + padding: CSHAKE_PADDING, + bits: SHAKE_BITS, + createMethod: createKmacMethod + }]; + var methods = {}, + methodNames = []; + + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; + var bits = algorithm.bits; + + for (var j = 0; j < bits.length; ++j) { + var methodName = algorithm.name + '_' + bits[j]; + methodNames.push(methodName); + methods[methodName] = algorithm.createMethod(bits[j], algorithm.padding); + + if (algorithm.name !== 'sha3') { + var newMethodName = algorithm.name + bits[j]; + methodNames.push(newMethodName); + methods[newMethodName] = methods[methodName]; + } + } + } + + function Keccak(bits, padding, outputBits) { + this.blocks = []; + this.s = []; + this.padding = padding; + this.outputBits = outputBits; + this.reset = true; + this.finalized = false; + this.block = 0; + this.start = 0; + this.blockCount = 1600 - (bits << 1) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + + for (var i = 0; i < 50; ++i) { + this.s[i] = 0; + } + } + + Keccak.prototype.update = function (message) { + if (this.finalized) { + throw new Error(FINALIZE_ERROR); + } + + var notString, + type = _typeof(message); + + if (type !== 'string') { + if (type === 'object') { + if (message === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) { + message = new Uint8Array(message); + } else if (!Array.isArray(message)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + + notString = true; + } + + var blocks = this.blocks, + byteCount = this.byteCount, + length = message.length, + blockCount = this.blockCount, + index = 0, + s = this.s, + i, + code; + + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + + if (notString) { + for (i = this.start; index < length && i < byteCount; ++index) { + blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; + } + } else { + for (i = this.start; index < length && i < byteCount; ++index) { + code = message.charCodeAt(index); + + if (code < 0x80) { + blocks[i >> 2] |= code << SHIFT[i++ & 3]; + } else if (code < 0x800) { + blocks[i >> 2] |= (0xc0 | code >> 6) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3]; + } else if (code < 0xd800 || code >= 0xe000) { + blocks[i >> 2] |= (0xe0 | code >> 12) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3]; + } else { + code = 0x10000 + ((code & 0x3ff) << 10 | message.charCodeAt(++index) & 0x3ff); + blocks[i >> 2] |= (0xf0 | code >> 18) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code >> 12 & 0x3f) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code >> 6 & 0x3f) << SHIFT[i++ & 3]; + blocks[i >> 2] |= (0x80 | code & 0x3f) << SHIFT[i++ & 3]; + } + } + } + + this.lastByteIndex = i; + + if (i >= byteCount) { + this.start = i - byteCount; + this.block = blocks[blockCount]; + + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + + f(s); + this.reset = true; + } else { + this.start = i; + } + } + + return this; + }; + + Keccak.prototype.encode = function (x, right) { + var o = x & 255, + n = 1; + var bytes = [o]; + x = x >> 8; + o = x & 255; + + while (o > 0) { + bytes.unshift(o); + x = x >> 8; + o = x & 255; + ++n; + } + + if (right) { + bytes.push(n); + } else { + bytes.unshift(n); + } + + this.update(bytes); + return bytes.length; + }; + + Keccak.prototype.encodeString = function (str) { + var notString, + type = _typeof(str); + + if (type !== 'string') { + if (type === 'object') { + if (str === null) { + throw new Error(INPUT_ERROR); + } else if (ARRAY_BUFFER && str.constructor === ArrayBuffer) { + str = new Uint8Array(str); + } else if (!Array.isArray(str)) { + if (!ARRAY_BUFFER || !ArrayBuffer.isView(str)) { + throw new Error(INPUT_ERROR); + } + } + } else { + throw new Error(INPUT_ERROR); + } + + notString = true; + } + + var bytes = 0, + length = str.length; + + if (notString) { + bytes = length; + } else { + for (var i = 0; i < str.length; ++i) { + var code = str.charCodeAt(i); + + if (code < 0x80) { + bytes += 1; + } else if (code < 0x800) { + bytes += 2; + } else if (code < 0xd800 || code >= 0xe000) { + bytes += 3; + } else { + code = 0x10000 + ((code & 0x3ff) << 10 | str.charCodeAt(++i) & 0x3ff); + bytes += 4; + } + } + } + + bytes += this.encode(bytes * 8); + this.update(str); + return bytes; + }; + + Keccak.prototype.bytepad = function (strs, w) { + var bytes = this.encode(w); + + for (var i = 0; i < strs.length; ++i) { + bytes += this.encodeString(strs[i]); + } + + var paddingBytes = w - bytes % w; + var zeros = []; + zeros.length = paddingBytes; + this.update(zeros); + return this; + }; + + Keccak.prototype.finalize = function () { + if (this.finalized) { + return; + } + + this.finalized = true; + var blocks = this.blocks, + i = this.lastByteIndex, + blockCount = this.blockCount, + s = this.s; + blocks[i >> 2] |= this.padding[i & 3]; + + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + + for (i = 1; i < blockCount + 1; ++i) { + blocks[i] = 0; + } + } + + blocks[blockCount - 1] |= 0x80000000; + + for (i = 0; i < blockCount; ++i) { + s[i] ^= blocks[i]; + } + + f(s); + }; + + Keccak.prototype.toString = Keccak.prototype.hex = function () { + this.finalize(); + var blockCount = this.blockCount, + s = this.s, + outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, + i = 0, + j = 0; + var hex = '', + block; + + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + block = s[i]; + hex += HEX_CHARS[block >> 4 & 0x0F] + HEX_CHARS[block & 0x0F] + HEX_CHARS[block >> 12 & 0x0F] + HEX_CHARS[block >> 8 & 0x0F] + HEX_CHARS[block >> 20 & 0x0F] + HEX_CHARS[block >> 16 & 0x0F] + HEX_CHARS[block >> 28 & 0x0F] + HEX_CHARS[block >> 24 & 0x0F]; + } + + if (j % blockCount === 0) { + f(s); + i = 0; + } + } + + if (extraBytes) { + block = s[i]; + hex += HEX_CHARS[block >> 4 & 0x0F] + HEX_CHARS[block & 0x0F]; + + if (extraBytes > 1) { + hex += HEX_CHARS[block >> 12 & 0x0F] + HEX_CHARS[block >> 8 & 0x0F]; + } + + if (extraBytes > 2) { + hex += HEX_CHARS[block >> 20 & 0x0F] + HEX_CHARS[block >> 16 & 0x0F]; + } + } + + return hex; + }; + + Keccak.prototype.arrayBuffer = function () { + this.finalize(); + var blockCount = this.blockCount, + s = this.s, + outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, + i = 0, + j = 0; + var bytes = this.outputBits >> 3; + var buffer; + + if (extraBytes) { + buffer = new ArrayBuffer(outputBlocks + 1 << 2); + } else { + buffer = new ArrayBuffer(bytes); + } + + var array = new Uint32Array(buffer); + + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + array[j] = s[i]; + } + + if (j % blockCount === 0) { + f(s); + } + } + + if (extraBytes) { + array[i] = s[i]; + buffer = buffer.slice(0, bytes); + } + + return buffer; + }; + + Keccak.prototype.buffer = Keccak.prototype.arrayBuffer; + + Keccak.prototype.digest = Keccak.prototype.array = function () { + this.finalize(); + var blockCount = this.blockCount, + s = this.s, + outputBlocks = this.outputBlocks, + extraBytes = this.extraBytes, + i = 0, + j = 0; + var array = [], + offset, + block; + + while (j < outputBlocks) { + for (i = 0; i < blockCount && j < outputBlocks; ++i, ++j) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + array[offset + 1] = block >> 8 & 0xFF; + array[offset + 2] = block >> 16 & 0xFF; + array[offset + 3] = block >> 24 & 0xFF; + } + + if (j % blockCount === 0) { + f(s); + } + } + + if (extraBytes) { + offset = j << 2; + block = s[i]; + array[offset] = block & 0xFF; + + if (extraBytes > 1) { + array[offset + 1] = block >> 8 & 0xFF; + } + + if (extraBytes > 2) { + array[offset + 2] = block >> 16 & 0xFF; + } + } + + return array; + }; + + function Kmac(bits, padding, outputBits) { + Keccak.call(this, bits, padding, outputBits); + } + + Kmac.prototype = new Keccak(); + + Kmac.prototype.finalize = function () { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + + var f = function f(s) { + var h, l, n, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49; + + for (n = 0; n < 48; n += 2) { + c0 = s[0] ^ s[10] ^ s[20] ^ s[30] ^ s[40]; + c1 = s[1] ^ s[11] ^ s[21] ^ s[31] ^ s[41]; + c2 = s[2] ^ s[12] ^ s[22] ^ s[32] ^ s[42]; + c3 = s[3] ^ s[13] ^ s[23] ^ s[33] ^ s[43]; + c4 = s[4] ^ s[14] ^ s[24] ^ s[34] ^ s[44]; + c5 = s[5] ^ s[15] ^ s[25] ^ s[35] ^ s[45]; + c6 = s[6] ^ s[16] ^ s[26] ^ s[36] ^ s[46]; + c7 = s[7] ^ s[17] ^ s[27] ^ s[37] ^ s[47]; + c8 = s[8] ^ s[18] ^ s[28] ^ s[38] ^ s[48]; + c9 = s[9] ^ s[19] ^ s[29] ^ s[39] ^ s[49]; + h = c8 ^ (c2 << 1 | c3 >>> 31); + l = c9 ^ (c3 << 1 | c2 >>> 31); + s[0] ^= h; + s[1] ^= l; + s[10] ^= h; + s[11] ^= l; + s[20] ^= h; + s[21] ^= l; + s[30] ^= h; + s[31] ^= l; + s[40] ^= h; + s[41] ^= l; + h = c0 ^ (c4 << 1 | c5 >>> 31); + l = c1 ^ (c5 << 1 | c4 >>> 31); + s[2] ^= h; + s[3] ^= l; + s[12] ^= h; + s[13] ^= l; + s[22] ^= h; + s[23] ^= l; + s[32] ^= h; + s[33] ^= l; + s[42] ^= h; + s[43] ^= l; + h = c2 ^ (c6 << 1 | c7 >>> 31); + l = c3 ^ (c7 << 1 | c6 >>> 31); + s[4] ^= h; + s[5] ^= l; + s[14] ^= h; + s[15] ^= l; + s[24] ^= h; + s[25] ^= l; + s[34] ^= h; + s[35] ^= l; + s[44] ^= h; + s[45] ^= l; + h = c4 ^ (c8 << 1 | c9 >>> 31); + l = c5 ^ (c9 << 1 | c8 >>> 31); + s[6] ^= h; + s[7] ^= l; + s[16] ^= h; + s[17] ^= l; + s[26] ^= h; + s[27] ^= l; + s[36] ^= h; + s[37] ^= l; + s[46] ^= h; + s[47] ^= l; + h = c6 ^ (c0 << 1 | c1 >>> 31); + l = c7 ^ (c1 << 1 | c0 >>> 31); + s[8] ^= h; + s[9] ^= l; + s[18] ^= h; + s[19] ^= l; + s[28] ^= h; + s[29] ^= l; + s[38] ^= h; + s[39] ^= l; + s[48] ^= h; + s[49] ^= l; + b0 = s[0]; + b1 = s[1]; + b32 = s[11] << 4 | s[10] >>> 28; + b33 = s[10] << 4 | s[11] >>> 28; + b14 = s[20] << 3 | s[21] >>> 29; + b15 = s[21] << 3 | s[20] >>> 29; + b46 = s[31] << 9 | s[30] >>> 23; + b47 = s[30] << 9 | s[31] >>> 23; + b28 = s[40] << 18 | s[41] >>> 14; + b29 = s[41] << 18 | s[40] >>> 14; + b20 = s[2] << 1 | s[3] >>> 31; + b21 = s[3] << 1 | s[2] >>> 31; + b2 = s[13] << 12 | s[12] >>> 20; + b3 = s[12] << 12 | s[13] >>> 20; + b34 = s[22] << 10 | s[23] >>> 22; + b35 = s[23] << 10 | s[22] >>> 22; + b16 = s[33] << 13 | s[32] >>> 19; + b17 = s[32] << 13 | s[33] >>> 19; + b48 = s[42] << 2 | s[43] >>> 30; + b49 = s[43] << 2 | s[42] >>> 30; + b40 = s[5] << 30 | s[4] >>> 2; + b41 = s[4] << 30 | s[5] >>> 2; + b22 = s[14] << 6 | s[15] >>> 26; + b23 = s[15] << 6 | s[14] >>> 26; + b4 = s[25] << 11 | s[24] >>> 21; + b5 = s[24] << 11 | s[25] >>> 21; + b36 = s[34] << 15 | s[35] >>> 17; + b37 = s[35] << 15 | s[34] >>> 17; + b18 = s[45] << 29 | s[44] >>> 3; + b19 = s[44] << 29 | s[45] >>> 3; + b10 = s[6] << 28 | s[7] >>> 4; + b11 = s[7] << 28 | s[6] >>> 4; + b42 = s[17] << 23 | s[16] >>> 9; + b43 = s[16] << 23 | s[17] >>> 9; + b24 = s[26] << 25 | s[27] >>> 7; + b25 = s[27] << 25 | s[26] >>> 7; + b6 = s[36] << 21 | s[37] >>> 11; + b7 = s[37] << 21 | s[36] >>> 11; + b38 = s[47] << 24 | s[46] >>> 8; + b39 = s[46] << 24 | s[47] >>> 8; + b30 = s[8] << 27 | s[9] >>> 5; + b31 = s[9] << 27 | s[8] >>> 5; + b12 = s[18] << 20 | s[19] >>> 12; + b13 = s[19] << 20 | s[18] >>> 12; + b44 = s[29] << 7 | s[28] >>> 25; + b45 = s[28] << 7 | s[29] >>> 25; + b26 = s[38] << 8 | s[39] >>> 24; + b27 = s[39] << 8 | s[38] >>> 24; + b8 = s[48] << 14 | s[49] >>> 18; + b9 = s[49] << 14 | s[48] >>> 18; + s[0] = b0 ^ ~b2 & b4; + s[1] = b1 ^ ~b3 & b5; + s[10] = b10 ^ ~b12 & b14; + s[11] = b11 ^ ~b13 & b15; + s[20] = b20 ^ ~b22 & b24; + s[21] = b21 ^ ~b23 & b25; + s[30] = b30 ^ ~b32 & b34; + s[31] = b31 ^ ~b33 & b35; + s[40] = b40 ^ ~b42 & b44; + s[41] = b41 ^ ~b43 & b45; + s[2] = b2 ^ ~b4 & b6; + s[3] = b3 ^ ~b5 & b7; + s[12] = b12 ^ ~b14 & b16; + s[13] = b13 ^ ~b15 & b17; + s[22] = b22 ^ ~b24 & b26; + s[23] = b23 ^ ~b25 & b27; + s[32] = b32 ^ ~b34 & b36; + s[33] = b33 ^ ~b35 & b37; + s[42] = b42 ^ ~b44 & b46; + s[43] = b43 ^ ~b45 & b47; + s[4] = b4 ^ ~b6 & b8; + s[5] = b5 ^ ~b7 & b9; + s[14] = b14 ^ ~b16 & b18; + s[15] = b15 ^ ~b17 & b19; + s[24] = b24 ^ ~b26 & b28; + s[25] = b25 ^ ~b27 & b29; + s[34] = b34 ^ ~b36 & b38; + s[35] = b35 ^ ~b37 & b39; + s[44] = b44 ^ ~b46 & b48; + s[45] = b45 ^ ~b47 & b49; + s[6] = b6 ^ ~b8 & b0; + s[7] = b7 ^ ~b9 & b1; + s[16] = b16 ^ ~b18 & b10; + s[17] = b17 ^ ~b19 & b11; + s[26] = b26 ^ ~b28 & b20; + s[27] = b27 ^ ~b29 & b21; + s[36] = b36 ^ ~b38 & b30; + s[37] = b37 ^ ~b39 & b31; + s[46] = b46 ^ ~b48 & b40; + s[47] = b47 ^ ~b49 & b41; + s[8] = b8 ^ ~b0 & b2; + s[9] = b9 ^ ~b1 & b3; + s[18] = b18 ^ ~b10 & b12; + s[19] = b19 ^ ~b11 & b13; + s[28] = b28 ^ ~b20 & b22; + s[29] = b29 ^ ~b21 & b23; + s[38] = b38 ^ ~b30 & b32; + s[39] = b39 ^ ~b31 & b33; + s[48] = b48 ^ ~b40 & b42; + s[49] = b49 ^ ~b41 & b43; + s[0] ^= RC[n]; + s[1] ^= RC[n + 1]; + } + }; + + if (COMMON_JS) { + module.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + + if (AMD) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () { + return methods; + }).call(exports, __webpack_require__, exports, module), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } + } +})(); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __webpack_require__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module))) + +/***/ }), + +/***/ "./node_modules/minimalistic-assert/index.js": +/*!***************************************************!*\ + !*** ./node_modules/minimalistic-assert/index.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +module.exports = assert; + +function assert(val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); +} + +assert.equal = function assertEqual(l, r, msg) { + if (l != r) throw new Error(msg || 'Assertion failed: ' + l + ' != ' + r); +}; + +/***/ }), + +/***/ "./node_modules/process/browser.js": +/*!*****************************************!*\ + !*** ./node_modules/process/browser.js ***! + \*****************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} + +function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); +} + +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +})(); + +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } +} + +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } +} + +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + + while (len) { + currentQueue = queue; + queue = []; + + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + + queueIndex = -1; + len = queue.length; + } + + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + + queue.push(new Item(fun, args)); + + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; // v8 likes predictible objects + + +function Item(fun, array) { + this.fun = fun; + this.array = array; +} + +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues + +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { + return []; +}; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { + return '/'; +}; + +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +process.umask = function () { + return 0; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/browser.js": +/*!********************************************!*\ + !*** ./node_modules/qrcode/lib/browser.js ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var canPromise = __webpack_require__(/*! ./can-promise */ "./node_modules/qrcode/lib/can-promise.js"); + +var QRCode = __webpack_require__(/*! ./core/qrcode */ "./node_modules/qrcode/lib/core/qrcode.js"); + +var CanvasRenderer = __webpack_require__(/*! ./renderer/canvas */ "./node_modules/qrcode/lib/renderer/canvas.js"); + +var SvgRenderer = __webpack_require__(/*! ./renderer/svg-tag.js */ "./node_modules/qrcode/lib/renderer/svg-tag.js"); + +function renderCanvas(renderFunc, canvas, text, opts, cb) { + var args = [].slice.call(arguments, 1); + var argsNum = args.length; + var isLastArgCb = typeof args[argsNum - 1] === 'function'; + + if (!isLastArgCb && !canPromise()) { + throw new Error('Callback required as last argument'); + } + + if (isLastArgCb) { + if (argsNum < 2) { + throw new Error('Too few arguments provided'); + } + + if (argsNum === 2) { + cb = text; + text = canvas; + canvas = opts = undefined; + } else if (argsNum === 3) { + if (canvas.getContext && typeof cb === 'undefined') { + cb = opts; + opts = undefined; + } else { + cb = opts; + opts = text; + text = canvas; + canvas = undefined; + } + } + } else { + if (argsNum < 1) { + throw new Error('Too few arguments provided'); + } + + if (argsNum === 1) { + text = canvas; + canvas = opts = undefined; + } else if (argsNum === 2 && !canvas.getContext) { + opts = text; + text = canvas; + canvas = undefined; + } + + return new Promise(function (resolve, reject) { + try { + var data = QRCode.create(text, opts); + resolve(renderFunc(data, canvas, opts)); + } catch (e) { + reject(e); + } + }); + } + + try { + var data = QRCode.create(text, opts); + cb(null, renderFunc(data, canvas, opts)); + } catch (e) { + cb(e); + } +} + +exports.create = QRCode.create; +exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render); +exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL); // only svg for now. + +exports.toString = renderCanvas.bind(null, function (data, _, opts) { + return SvgRenderer.render(data, opts); +}); + +/***/ }), + +/***/ "./node_modules/qrcode/lib/can-promise.js": +/*!************************************************!*\ + !*** ./node_modules/qrcode/lib/can-promise.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +// can-promise has a crash in some versions of react native that dont have +// standard global objects +// https://github.com/soldair/node-qrcode/issues/157 +module.exports = function () { + return typeof Promise === 'function' && Promise.prototype && Promise.prototype.then; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/alignment-pattern.js": +/*!***********************************************************!*\ + !*** ./node_modules/qrcode/lib/core/alignment-pattern.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/** + * Alignment pattern are fixed reference pattern in defined positions + * in a matrix symbology, which enables the decode software to re-synchronise + * the coordinate mapping of the image modules in the event of moderate amounts + * of distortion of the image. + * + * Alignment patterns are present only in QR Code symbols of version 2 or larger + * and their number depends on the symbol version. + */ +var getSymbolSize = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js").getSymbolSize; +/** + * Calculate the row/column coordinates of the center module of each alignment pattern + * for the specified QR Code version. + * + * The alignment patterns are positioned symmetrically on either side of the diagonal + * running from the top left corner of the symbol to the bottom right corner. + * + * Since positions are simmetrical only half of the coordinates are returned. + * Each item of the array will represent in turn the x and y coordinate. + * @see {@link getPositions} + * + * @param {Number} version QR Code version + * @return {Array} Array of coordinate + */ + + +exports.getRowColCoords = function getRowColCoords(version) { + if (version === 1) return []; + var posCount = Math.floor(version / 7) + 2; + var size = getSymbolSize(version); + var intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2; + var positions = [size - 7]; // Last coord is always (size - 7) + + for (var i = 1; i < posCount - 1; i++) { + positions[i] = positions[i - 1] - intervals; + } + + positions.push(6); // First coord is always 6 + + return positions.reverse(); +}; +/** + * Returns an array containing the positions of each alignment pattern. + * Each array's element represent the center point of the pattern as (x, y) coordinates + * + * Coordinates are calculated expanding the row/column coordinates returned by {@link getRowColCoords} + * and filtering out the items that overlaps with finder pattern + * + * @example + * For a Version 7 symbol {@link getRowColCoords} returns values 6, 22 and 38. + * The alignment patterns, therefore, are to be centered on (row, column) + * positions (6,22), (22,6), (22,22), (22,38), (38,22), (38,38). + * Note that the coordinates (6,6), (6,38), (38,6) are occupied by finder patterns + * and are not therefore used for alignment patterns. + * + * var pos = getPositions(7) + * // [[6,22], [22,6], [22,22], [22,38], [38,22], [38,38]] + * + * @param {Number} version QR Code version + * @return {Array} Array of coordinates + */ + + +exports.getPositions = function getPositions(version) { + var coords = []; + var pos = exports.getRowColCoords(version); + var posLength = pos.length; + + for (var i = 0; i < posLength; i++) { + for (var j = 0; j < posLength; j++) { + // Skip if position is occupied by finder patterns + if (i === 0 && j === 0 || // top-left + i === 0 && j === posLength - 1 || // bottom-left + i === posLength - 1 && j === 0) { + // top-right + continue; + } + + coords.push([pos[i], pos[j]]); + } + } + + return coords; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/alphanumeric-data.js": +/*!***********************************************************!*\ + !*** ./node_modules/qrcode/lib/core/alphanumeric-data.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js"); +/** + * Array of characters available in alphanumeric mode + * + * As per QR Code specification, to each character + * is assigned a value from 0 to 44 which in this case coincides + * with the array index + * + * @type {Array} + */ + + +var ALPHA_NUM_CHARS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ' ', '$', '%', '*', '+', '-', '.', '/', ':']; + +function AlphanumericData(data) { + this.mode = Mode.ALPHANUMERIC; + this.data = data; +} + +AlphanumericData.getBitsLength = function getBitsLength(length) { + return 11 * Math.floor(length / 2) + 6 * (length % 2); +}; + +AlphanumericData.prototype.getLength = function getLength() { + return this.data.length; +}; + +AlphanumericData.prototype.getBitsLength = function getBitsLength() { + return AlphanumericData.getBitsLength(this.data.length); +}; + +AlphanumericData.prototype.write = function write(bitBuffer) { + var i; // Input data characters are divided into groups of two characters + // and encoded as 11-bit binary codes. + + for (i = 0; i + 2 <= this.data.length; i += 2) { + // The character value of the first character is multiplied by 45 + var value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45; // The character value of the second digit is added to the product + + value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]); // The sum is then stored as 11-bit binary number + + bitBuffer.put(value, 11); + } // If the number of input data characters is not a multiple of two, + // the character value of the final character is encoded as a 6-bit binary number. + + + if (this.data.length % 2) { + bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6); + } +}; + +module.exports = AlphanumericData; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/bit-buffer.js": +/*!****************************************************!*\ + !*** ./node_modules/qrcode/lib/core/bit-buffer.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +function BitBuffer() { + this.buffer = []; + this.length = 0; +} + +BitBuffer.prototype = { + get: function get(index) { + var bufIndex = Math.floor(index / 8); + return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1; + }, + put: function put(num, length) { + for (var i = 0; i < length; i++) { + this.putBit((num >>> length - i - 1 & 1) === 1); + } + }, + getLengthInBits: function getLengthInBits() { + return this.length; + }, + putBit: function putBit(bit) { + var bufIndex = Math.floor(this.length / 8); + + if (this.buffer.length <= bufIndex) { + this.buffer.push(0); + } + + if (bit) { + this.buffer[bufIndex] |= 0x80 >>> this.length % 8; + } + + this.length++; + } +}; +module.exports = BitBuffer; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/bit-matrix.js": +/*!****************************************************!*\ + !*** ./node_modules/qrcode/lib/core/bit-matrix.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js"); +/** + * Helper class to handle QR Code symbol modules + * + * @param {Number} size Symbol size + */ + + +function BitMatrix(size) { + if (!size || size < 1) { + throw new Error('BitMatrix size must be defined and greater than 0'); + } + + this.size = size; + this.data = BufferUtil.alloc(size * size); + this.reservedBit = BufferUtil.alloc(size * size); +} +/** + * Set bit value at specified location + * If reserved flag is set, this bit will be ignored during masking process + * + * @param {Number} row + * @param {Number} col + * @param {Boolean} value + * @param {Boolean} reserved + */ + + +BitMatrix.prototype.set = function (row, col, value, reserved) { + var index = row * this.size + col; + this.data[index] = value; + if (reserved) this.reservedBit[index] = true; +}; +/** + * Returns bit value at specified location + * + * @param {Number} row + * @param {Number} col + * @return {Boolean} + */ + + +BitMatrix.prototype.get = function (row, col) { + return this.data[row * this.size + col]; +}; +/** + * Applies xor operator at specified location + * (used during masking process) + * + * @param {Number} row + * @param {Number} col + * @param {Boolean} value + */ + + +BitMatrix.prototype.xor = function (row, col, value) { + this.data[row * this.size + col] ^= value; +}; +/** + * Check if bit at specified location is reserved + * + * @param {Number} row + * @param {Number} col + * @return {Boolean} + */ + + +BitMatrix.prototype.isReserved = function (row, col) { + return this.reservedBit[row * this.size + col]; +}; + +module.exports = BitMatrix; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/byte-data.js": +/*!***************************************************!*\ + !*** ./node_modules/qrcode/lib/core/byte-data.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js"); + +var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js"); + +function ByteData(data) { + this.mode = Mode.BYTE; + this.data = BufferUtil.from(data); +} + +ByteData.getBitsLength = function getBitsLength(length) { + return length * 8; +}; + +ByteData.prototype.getLength = function getLength() { + return this.data.length; +}; + +ByteData.prototype.getBitsLength = function getBitsLength() { + return ByteData.getBitsLength(this.data.length); +}; + +ByteData.prototype.write = function (bitBuffer) { + for (var i = 0, l = this.data.length; i < l; i++) { + bitBuffer.put(this.data[i], 8); + } +}; + +module.exports = ByteData; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/error-correction-code.js": +/*!***************************************************************!*\ + !*** ./node_modules/qrcode/lib/core/error-correction-code.js ***! + \***************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js"); + +var EC_BLOCKS_TABLE = [// L M Q H +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 4, 1, 2, 4, 4, 2, 4, 4, 4, 2, 4, 6, 5, 2, 4, 6, 6, 2, 5, 8, 8, 4, 5, 8, 8, 4, 5, 8, 11, 4, 8, 10, 11, 4, 9, 12, 16, 4, 9, 16, 16, 6, 10, 12, 18, 6, 10, 17, 16, 6, 11, 16, 19, 6, 13, 18, 21, 7, 14, 21, 25, 8, 16, 20, 25, 8, 17, 23, 25, 9, 17, 23, 34, 9, 18, 25, 30, 10, 20, 27, 32, 12, 21, 29, 35, 12, 23, 34, 37, 12, 25, 34, 40, 13, 26, 35, 42, 14, 28, 38, 45, 15, 29, 40, 48, 16, 31, 43, 51, 17, 33, 45, 54, 18, 35, 48, 57, 19, 37, 51, 60, 19, 38, 53, 63, 20, 40, 56, 66, 21, 43, 59, 70, 22, 45, 62, 74, 24, 47, 65, 77, 25, 49, 68, 81]; +var EC_CODEWORDS_TABLE = [// L M Q H +7, 10, 13, 17, 10, 16, 22, 28, 15, 26, 36, 44, 20, 36, 52, 64, 26, 48, 72, 88, 36, 64, 96, 112, 40, 72, 108, 130, 48, 88, 132, 156, 60, 110, 160, 192, 72, 130, 192, 224, 80, 150, 224, 264, 96, 176, 260, 308, 104, 198, 288, 352, 120, 216, 320, 384, 132, 240, 360, 432, 144, 280, 408, 480, 168, 308, 448, 532, 180, 338, 504, 588, 196, 364, 546, 650, 224, 416, 600, 700, 224, 442, 644, 750, 252, 476, 690, 816, 270, 504, 750, 900, 300, 560, 810, 960, 312, 588, 870, 1050, 336, 644, 952, 1110, 360, 700, 1020, 1200, 390, 728, 1050, 1260, 420, 784, 1140, 1350, 450, 812, 1200, 1440, 480, 868, 1290, 1530, 510, 924, 1350, 1620, 540, 980, 1440, 1710, 570, 1036, 1530, 1800, 570, 1064, 1590, 1890, 600, 1120, 1680, 1980, 630, 1204, 1770, 2100, 660, 1260, 1860, 2220, 720, 1316, 1950, 2310, 750, 1372, 2040, 2430]; +/** + * Returns the number of error correction block that the QR Code should contain + * for the specified version and error correction level. + * + * @param {Number} version QR Code version + * @param {Number} errorCorrectionLevel Error correction level + * @return {Number} Number of error correction blocks + */ + +exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) { + switch (errorCorrectionLevel) { + case ECLevel.L: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 0]; + + case ECLevel.M: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 1]; + + case ECLevel.Q: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 2]; + + case ECLevel.H: + return EC_BLOCKS_TABLE[(version - 1) * 4 + 3]; + + default: + return undefined; + } +}; +/** + * Returns the number of error correction codewords to use for the specified + * version and error correction level. + * + * @param {Number} version QR Code version + * @param {Number} errorCorrectionLevel Error correction level + * @return {Number} Number of error correction codewords + */ + + +exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) { + switch (errorCorrectionLevel) { + case ECLevel.L: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0]; + + case ECLevel.M: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1]; + + case ECLevel.Q: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2]; + + case ECLevel.H: + return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3]; + + default: + return undefined; + } +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/error-correction-level.js": +/*!****************************************************************!*\ + !*** ./node_modules/qrcode/lib/core/error-correction-level.js ***! + \****************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +exports.L = { + bit: 1 +}; +exports.M = { + bit: 0 +}; +exports.Q = { + bit: 3 +}; +exports.H = { + bit: 2 +}; + +function fromString(string) { + if (typeof string !== 'string') { + throw new Error('Param is not a string'); + } + + var lcStr = string.toLowerCase(); + + switch (lcStr) { + case 'l': + case 'low': + return exports.L; + + case 'm': + case 'medium': + return exports.M; + + case 'q': + case 'quartile': + return exports.Q; + + case 'h': + case 'high': + return exports.H; + + default: + throw new Error('Unknown EC Level: ' + string); + } +} + +exports.isValid = function isValid(level) { + return level && typeof level.bit !== 'undefined' && level.bit >= 0 && level.bit < 4; +}; + +exports.from = function from(value, defaultValue) { + if (exports.isValid(value)) { + return value; + } + + try { + return fromString(value); + } catch (e) { + return defaultValue; + } +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/finder-pattern.js": +/*!********************************************************!*\ + !*** ./node_modules/qrcode/lib/core/finder-pattern.js ***! + \********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var getSymbolSize = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js").getSymbolSize; + +var FINDER_PATTERN_SIZE = 7; +/** + * Returns an array containing the positions of each finder pattern. + * Each array's element represent the top-left point of the pattern as (x, y) coordinates + * + * @param {Number} version QR Code version + * @return {Array} Array of coordinates + */ + +exports.getPositions = function getPositions(version) { + var size = getSymbolSize(version); + return [// top-left + [0, 0], // top-right + [size - FINDER_PATTERN_SIZE, 0], // bottom-left + [0, size - FINDER_PATTERN_SIZE]]; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/format-info.js": +/*!*****************************************************!*\ + !*** ./node_modules/qrcode/lib/core/format-info.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js"); + +var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0; +var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1; +var G15_BCH = Utils.getBCHDigit(G15); +/** + * Returns format information with relative error correction bits + * + * The format information is a 15-bit sequence containing 5 data bits, + * with 10 error correction bits calculated using the (15, 5) BCH code. + * + * @param {Number} errorCorrectionLevel Error correction level + * @param {Number} mask Mask pattern + * @return {Number} Encoded format information bits + */ + +exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) { + var data = errorCorrectionLevel.bit << 3 | mask; + var d = data << 10; + + while (Utils.getBCHDigit(d) - G15_BCH >= 0) { + d ^= G15 << Utils.getBCHDigit(d) - G15_BCH; + } // xor final data with mask pattern in order to ensure that + // no combination of Error Correction Level and data mask pattern + // will result in an all-zero data string + + + return (data << 10 | d) ^ G15_MASK; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/galois-field.js": +/*!******************************************************!*\ + !*** ./node_modules/qrcode/lib/core/galois-field.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js"); + +var EXP_TABLE = BufferUtil.alloc(512); +var LOG_TABLE = BufferUtil.alloc(256) +/** + * Precompute the log and anti-log tables for faster computation later + * + * For each possible value in the galois field 2^8, we will pre-compute + * the logarithm and anti-logarithm (exponential) of this value + * + * ref {@link https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Introduction_to_mathematical_fields} + */ +; + +(function initTables() { + var x = 1; + + for (var i = 0; i < 255; i++) { + EXP_TABLE[i] = x; + LOG_TABLE[x] = i; + x <<= 1; // multiply by 2 + // The QR code specification says to use byte-wise modulo 100011101 arithmetic. + // This means that when a number is 256 or larger, it should be XORed with 0x11D. + + if (x & 0x100) { + // similar to x >= 256, but a lot faster (because 0x100 == 256) + x ^= 0x11D; + } + } // Optimization: double the size of the anti-log table so that we don't need to mod 255 to + // stay inside the bounds (because we will mainly use this table for the multiplication of + // two GF numbers, no more). + // @see {@link mul} + + + for (i = 255; i < 512; i++) { + EXP_TABLE[i] = EXP_TABLE[i - 255]; + } +})(); +/** + * Returns log value of n inside Galois Field + * + * @param {Number} n + * @return {Number} + */ + + +exports.log = function log(n) { + if (n < 1) throw new Error('log(' + n + ')'); + return LOG_TABLE[n]; +}; +/** + * Returns anti-log value of n inside Galois Field + * + * @param {Number} n + * @return {Number} + */ + + +exports.exp = function exp(n) { + return EXP_TABLE[n]; +}; +/** + * Multiplies two number inside Galois Field + * + * @param {Number} x + * @param {Number} y + * @return {Number} + */ + + +exports.mul = function mul(x, y) { + if (x === 0 || y === 0) return 0; // should be EXP_TABLE[(LOG_TABLE[x] + LOG_TABLE[y]) % 255] if EXP_TABLE wasn't oversized + // @see {@link initTables} + + return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]]; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/kanji-data.js": +/*!****************************************************!*\ + !*** ./node_modules/qrcode/lib/core/kanji-data.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js"); + +var Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js"); + +function KanjiData(data) { + this.mode = Mode.KANJI; + this.data = data; +} + +KanjiData.getBitsLength = function getBitsLength(length) { + return length * 13; +}; + +KanjiData.prototype.getLength = function getLength() { + return this.data.length; +}; + +KanjiData.prototype.getBitsLength = function getBitsLength() { + return KanjiData.getBitsLength(this.data.length); +}; + +KanjiData.prototype.write = function (bitBuffer) { + var i; // In the Shift JIS system, Kanji characters are represented by a two byte combination. + // These byte values are shifted from the JIS X 0208 values. + // JIS X 0208 gives details of the shift coded representation. + + for (i = 0; i < this.data.length; i++) { + var value = Utils.toSJIS(this.data[i]); // For characters with Shift JIS values from 0x8140 to 0x9FFC: + + if (value >= 0x8140 && value <= 0x9FFC) { + // Subtract 0x8140 from Shift JIS value + value -= 0x8140; // For characters with Shift JIS values from 0xE040 to 0xEBBF + } else if (value >= 0xE040 && value <= 0xEBBF) { + // Subtract 0xC140 from Shift JIS value + value -= 0xC140; + } else { + throw new Error('Invalid SJIS character: ' + this.data[i] + '\n' + 'Make sure your charset is UTF-8'); + } // Multiply most significant byte of result by 0xC0 + // and add least significant byte to product + + + value = (value >>> 8 & 0xff) * 0xC0 + (value & 0xff); // Convert result to a 13-bit binary string + + bitBuffer.put(value, 13); + } +}; + +module.exports = KanjiData; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/mask-pattern.js": +/*!******************************************************!*\ + !*** ./node_modules/qrcode/lib/core/mask-pattern.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +/** + * Data mask pattern reference + * @type {Object} + */ +exports.Patterns = { + PATTERN000: 0, + PATTERN001: 1, + PATTERN010: 2, + PATTERN011: 3, + PATTERN100: 4, + PATTERN101: 5, + PATTERN110: 6, + PATTERN111: 7 +}; +/** + * Weighted penalty scores for the undesirable features + * @type {Object} + */ + +var PenaltyScores = { + N1: 3, + N2: 3, + N3: 40, + N4: 10 +}; +/** + * Check if mask pattern value is valid + * + * @param {Number} mask Mask pattern + * @return {Boolean} true if valid, false otherwise + */ + +exports.isValid = function isValid(mask) { + return mask != null && mask !== '' && !isNaN(mask) && mask >= 0 && mask <= 7; +}; +/** + * Returns mask pattern from a value. + * If value is not valid, returns undefined + * + * @param {Number|String} value Mask pattern value + * @return {Number} Valid mask pattern or undefined + */ + + +exports.from = function from(value) { + return exports.isValid(value) ? parseInt(value, 10) : undefined; +}; +/** +* Find adjacent modules in row/column with the same color +* and assign a penalty value. +* +* Points: N1 + i +* i is the amount by which the number of adjacent modules of the same color exceeds 5 +*/ + + +exports.getPenaltyN1 = function getPenaltyN1(data) { + var size = data.size; + var points = 0; + var sameCountCol = 0; + var sameCountRow = 0; + var lastCol = null; + var lastRow = null; + + for (var row = 0; row < size; row++) { + sameCountCol = sameCountRow = 0; + lastCol = lastRow = null; + + for (var col = 0; col < size; col++) { + var module = data.get(row, col); + + if (module === lastCol) { + sameCountCol++; + } else { + if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5); + lastCol = module; + sameCountCol = 1; + } + + module = data.get(col, row); + + if (module === lastRow) { + sameCountRow++; + } else { + if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5); + lastRow = module; + sameCountRow = 1; + } + } + + if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5); + if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5); + } + + return points; +}; +/** + * Find 2x2 blocks with the same color and assign a penalty value + * + * Points: N2 * (m - 1) * (n - 1) + */ + + +exports.getPenaltyN2 = function getPenaltyN2(data) { + var size = data.size; + var points = 0; + + for (var row = 0; row < size - 1; row++) { + for (var col = 0; col < size - 1; col++) { + var last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1); + if (last === 4 || last === 0) points++; + } + } + + return points * PenaltyScores.N2; +}; +/** + * Find 1:1:3:1:1 ratio (dark:light:dark:light:dark) pattern in row/column, + * preceded or followed by light area 4 modules wide + * + * Points: N3 * number of pattern found + */ + + +exports.getPenaltyN3 = function getPenaltyN3(data) { + var size = data.size; + var points = 0; + var bitsCol = 0; + var bitsRow = 0; + + for (var row = 0; row < size; row++) { + bitsCol = bitsRow = 0; + + for (var col = 0; col < size; col++) { + bitsCol = bitsCol << 1 & 0x7FF | data.get(row, col); + if (col >= 10 && (bitsCol === 0x5D0 || bitsCol === 0x05D)) points++; + bitsRow = bitsRow << 1 & 0x7FF | data.get(col, row); + if (col >= 10 && (bitsRow === 0x5D0 || bitsRow === 0x05D)) points++; + } + } + + return points * PenaltyScores.N3; +}; +/** + * Calculate proportion of dark modules in entire symbol + * + * Points: N4 * k + * + * k is the rating of the deviation of the proportion of dark modules + * in the symbol from 50% in steps of 5% + */ + + +exports.getPenaltyN4 = function getPenaltyN4(data) { + var darkCount = 0; + var modulesCount = data.data.length; + + for (var i = 0; i < modulesCount; i++) { + darkCount += data.data[i]; + } + + var k = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10); + return k * PenaltyScores.N4; +}; +/** + * Return mask value at given position + * + * @param {Number} maskPattern Pattern reference value + * @param {Number} i Row + * @param {Number} j Column + * @return {Boolean} Mask value + */ + + +function getMaskAt(maskPattern, i, j) { + switch (maskPattern) { + case exports.Patterns.PATTERN000: + return (i + j) % 2 === 0; + + case exports.Patterns.PATTERN001: + return i % 2 === 0; + + case exports.Patterns.PATTERN010: + return j % 3 === 0; + + case exports.Patterns.PATTERN011: + return (i + j) % 3 === 0; + + case exports.Patterns.PATTERN100: + return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0; + + case exports.Patterns.PATTERN101: + return i * j % 2 + i * j % 3 === 0; + + case exports.Patterns.PATTERN110: + return (i * j % 2 + i * j % 3) % 2 === 0; + + case exports.Patterns.PATTERN111: + return (i * j % 3 + (i + j) % 2) % 2 === 0; + + default: + throw new Error('bad maskPattern:' + maskPattern); + } +} +/** + * Apply a mask pattern to a BitMatrix + * + * @param {Number} pattern Pattern reference number + * @param {BitMatrix} data BitMatrix data + */ + + +exports.applyMask = function applyMask(pattern, data) { + var size = data.size; + + for (var col = 0; col < size; col++) { + for (var row = 0; row < size; row++) { + if (data.isReserved(row, col)) continue; + data.xor(row, col, getMaskAt(pattern, row, col)); + } + } +}; +/** + * Returns the best mask pattern for data + * + * @param {BitMatrix} data + * @return {Number} Mask pattern reference number + */ + + +exports.getBestMask = function getBestMask(data, setupFormatFunc) { + var numPatterns = Object.keys(exports.Patterns).length; + var bestPattern = 0; + var lowerPenalty = Infinity; + + for (var p = 0; p < numPatterns; p++) { + setupFormatFunc(p); + exports.applyMask(p, data); // Calculate penalty + + var penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data); // Undo previously applied mask + + exports.applyMask(p, data); + + if (penalty < lowerPenalty) { + lowerPenalty = penalty; + bestPattern = p; + } + } + + return bestPattern; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/mode.js": +/*!**********************************************!*\ + !*** ./node_modules/qrcode/lib/core/mode.js ***! + \**********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js"); + +var Regex = __webpack_require__(/*! ./regex */ "./node_modules/qrcode/lib/core/regex.js"); +/** + * Numeric mode encodes data from the decimal digit set (0 - 9) + * (byte values 30HEX to 39HEX). + * Normally, 3 data characters are represented by 10 bits. + * + * @type {Object} + */ + + +exports.NUMERIC = { + id: 'Numeric', + bit: 1 << 0, + ccBits: [10, 12, 14] +}; +/** + * Alphanumeric mode encodes data from a set of 45 characters, + * i.e. 10 numeric digits (0 - 9), + * 26 alphabetic characters (A - Z), + * and 9 symbols (SP, $, %, *, +, -, ., /, :). + * Normally, two input characters are represented by 11 bits. + * + * @type {Object} + */ + +exports.ALPHANUMERIC = { + id: 'Alphanumeric', + bit: 1 << 1, + ccBits: [9, 11, 13] +}; +/** + * In byte mode, data is encoded at 8 bits per character. + * + * @type {Object} + */ + +exports.BYTE = { + id: 'Byte', + bit: 1 << 2, + ccBits: [8, 16, 16] +}; +/** + * The Kanji mode efficiently encodes Kanji characters in accordance with + * the Shift JIS system based on JIS X 0208. + * The Shift JIS values are shifted from the JIS X 0208 values. + * JIS X 0208 gives details of the shift coded representation. + * Each two-byte character value is compacted to a 13-bit binary codeword. + * + * @type {Object} + */ + +exports.KANJI = { + id: 'Kanji', + bit: 1 << 3, + ccBits: [8, 10, 12] +}; +/** + * Mixed mode will contain a sequences of data in a combination of any of + * the modes described above + * + * @type {Object} + */ + +exports.MIXED = { + bit: -1 +}; +/** + * Returns the number of bits needed to store the data length + * according to QR Code specifications. + * + * @param {Mode} mode Data mode + * @param {Number} version QR Code version + * @return {Number} Number of bits + */ + +exports.getCharCountIndicator = function getCharCountIndicator(mode, version) { + if (!mode.ccBits) throw new Error('Invalid mode: ' + mode); + + if (!VersionCheck.isValid(version)) { + throw new Error('Invalid version: ' + version); + } + + if (version >= 1 && version < 10) return mode.ccBits[0];else if (version < 27) return mode.ccBits[1]; + return mode.ccBits[2]; +}; +/** + * Returns the most efficient mode to store the specified data + * + * @param {String} dataStr Input data string + * @return {Mode} Best mode + */ + + +exports.getBestModeForData = function getBestModeForData(dataStr) { + if (Regex.testNumeric(dataStr)) return exports.NUMERIC;else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;else if (Regex.testKanji(dataStr)) return exports.KANJI;else return exports.BYTE; +}; +/** + * Return mode name as string + * + * @param {Mode} mode Mode object + * @returns {String} Mode name + */ + + +exports.toString = function toString(mode) { + if (mode && mode.id) return mode.id; + throw new Error('Invalid mode'); +}; +/** + * Check if input param is a valid mode object + * + * @param {Mode} mode Mode object + * @returns {Boolean} True if valid mode, false otherwise + */ + + +exports.isValid = function isValid(mode) { + return mode && mode.bit && mode.ccBits; +}; +/** + * Get mode object from its name + * + * @param {String} string Mode name + * @returns {Mode} Mode object + */ + + +function fromString(string) { + if (typeof string !== 'string') { + throw new Error('Param is not a string'); + } + + var lcStr = string.toLowerCase(); + + switch (lcStr) { + case 'numeric': + return exports.NUMERIC; + + case 'alphanumeric': + return exports.ALPHANUMERIC; + + case 'kanji': + return exports.KANJI; + + case 'byte': + return exports.BYTE; + + default: + throw new Error('Unknown mode: ' + string); + } +} +/** + * Returns mode from a value. + * If value is not a valid mode, returns defaultValue + * + * @param {Mode|String} value Encoding mode + * @param {Mode} defaultValue Fallback value + * @return {Mode} Encoding mode + */ + + +exports.from = function from(value, defaultValue) { + if (exports.isValid(value)) { + return value; + } + + try { + return fromString(value); + } catch (e) { + return defaultValue; + } +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/numeric-data.js": +/*!******************************************************!*\ + !*** ./node_modules/qrcode/lib/core/numeric-data.js ***! + \******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js"); + +function NumericData(data) { + this.mode = Mode.NUMERIC; + this.data = data.toString(); +} + +NumericData.getBitsLength = function getBitsLength(length) { + return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0); +}; + +NumericData.prototype.getLength = function getLength() { + return this.data.length; +}; + +NumericData.prototype.getBitsLength = function getBitsLength() { + return NumericData.getBitsLength(this.data.length); +}; + +NumericData.prototype.write = function write(bitBuffer) { + var i, group, value; // The input data string is divided into groups of three digits, + // and each group is converted to its 10-bit binary equivalent. + + for (i = 0; i + 3 <= this.data.length; i += 3) { + group = this.data.substr(i, 3); + value = parseInt(group, 10); + bitBuffer.put(value, 10); + } // If the number of input digits is not an exact multiple of three, + // the final one or two digits are converted to 4 or 7 bits respectively. + + + var remainingNum = this.data.length - i; + + if (remainingNum > 0) { + group = this.data.substr(i); + value = parseInt(group, 10); + bitBuffer.put(value, remainingNum * 3 + 1); + } +}; + +module.exports = NumericData; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/polynomial.js": +/*!****************************************************!*\ + !*** ./node_modules/qrcode/lib/core/polynomial.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js"); + +var GF = __webpack_require__(/*! ./galois-field */ "./node_modules/qrcode/lib/core/galois-field.js"); +/** + * Multiplies two polynomials inside Galois Field + * + * @param {Buffer} p1 Polynomial + * @param {Buffer} p2 Polynomial + * @return {Buffer} Product of p1 and p2 + */ + + +exports.mul = function mul(p1, p2) { + var coeff = BufferUtil.alloc(p1.length + p2.length - 1); + + for (var i = 0; i < p1.length; i++) { + for (var j = 0; j < p2.length; j++) { + coeff[i + j] ^= GF.mul(p1[i], p2[j]); + } + } + + return coeff; +}; +/** + * Calculate the remainder of polynomials division + * + * @param {Buffer} divident Polynomial + * @param {Buffer} divisor Polynomial + * @return {Buffer} Remainder + */ + + +exports.mod = function mod(divident, divisor) { + var result = BufferUtil.from(divident); + + while (result.length - divisor.length >= 0) { + var coeff = result[0]; + + for (var i = 0; i < divisor.length; i++) { + result[i] ^= GF.mul(divisor[i], coeff); + } // remove all zeros from buffer head + + + var offset = 0; + + while (offset < result.length && result[offset] === 0) { + offset++; + } + + result = result.slice(offset); + } + + return result; +}; +/** + * Generate an irreducible generator polynomial of specified degree + * (used by Reed-Solomon encoder) + * + * @param {Number} degree Degree of the generator polynomial + * @return {Buffer} Buffer containing polynomial coefficients + */ + + +exports.generateECPolynomial = function generateECPolynomial(degree) { + var poly = BufferUtil.from([1]); + + for (var i = 0; i < degree; i++) { + poly = exports.mul(poly, [1, GF.exp(i)]); + } + + return poly; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/qrcode.js": +/*!************************************************!*\ + !*** ./node_modules/qrcode/lib/core/qrcode.js ***! + \************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js"); + +var Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js"); + +var ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js"); + +var BitBuffer = __webpack_require__(/*! ./bit-buffer */ "./node_modules/qrcode/lib/core/bit-buffer.js"); + +var BitMatrix = __webpack_require__(/*! ./bit-matrix */ "./node_modules/qrcode/lib/core/bit-matrix.js"); + +var AlignmentPattern = __webpack_require__(/*! ./alignment-pattern */ "./node_modules/qrcode/lib/core/alignment-pattern.js"); + +var FinderPattern = __webpack_require__(/*! ./finder-pattern */ "./node_modules/qrcode/lib/core/finder-pattern.js"); + +var MaskPattern = __webpack_require__(/*! ./mask-pattern */ "./node_modules/qrcode/lib/core/mask-pattern.js"); + +var ECCode = __webpack_require__(/*! ./error-correction-code */ "./node_modules/qrcode/lib/core/error-correction-code.js"); + +var ReedSolomonEncoder = __webpack_require__(/*! ./reed-solomon-encoder */ "./node_modules/qrcode/lib/core/reed-solomon-encoder.js"); + +var Version = __webpack_require__(/*! ./version */ "./node_modules/qrcode/lib/core/version.js"); + +var FormatInfo = __webpack_require__(/*! ./format-info */ "./node_modules/qrcode/lib/core/format-info.js"); + +var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js"); + +var Segments = __webpack_require__(/*! ./segments */ "./node_modules/qrcode/lib/core/segments.js"); + +var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js"); +/** + * QRCode for JavaScript + * + * modified by Ryan Day for nodejs support + * Copyright (c) 2011 Ryan Day + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/mit-license.php + * +//--------------------------------------------------------------------- +// QRCode for JavaScript +// +// Copyright (c) 2009 Kazuhiko Arase +// +// URL: http://www.d-project.com/ +// +// Licensed under the MIT license: +// http://www.opensource.org/licenses/mit-license.php +// +// The word "QR Code" is registered trademark of +// DENSO WAVE INCORPORATED +// http://www.denso-wave.com/qrcode/faqpatent-e.html +// +//--------------------------------------------------------------------- +*/ + +/** + * Add finder patterns bits to matrix + * + * @param {BitMatrix} matrix Modules matrix + * @param {Number} version QR Code version + */ + + +function setupFinderPattern(matrix, version) { + var size = matrix.size; + var pos = FinderPattern.getPositions(version); + + for (var i = 0; i < pos.length; i++) { + var row = pos[i][0]; + var col = pos[i][1]; + + for (var r = -1; r <= 7; r++) { + if (row + r <= -1 || size <= row + r) continue; + + for (var c = -1; c <= 7; c++) { + if (col + c <= -1 || size <= col + c) continue; + + if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) { + matrix.set(row + r, col + c, true, true); + } else { + matrix.set(row + r, col + c, false, true); + } + } + } + } +} +/** + * Add timing pattern bits to matrix + * + * Note: this function must be called before {@link setupAlignmentPattern} + * + * @param {BitMatrix} matrix Modules matrix + */ + + +function setupTimingPattern(matrix) { + var size = matrix.size; + + for (var r = 8; r < size - 8; r++) { + var value = r % 2 === 0; + matrix.set(r, 6, value, true); + matrix.set(6, r, value, true); + } +} +/** + * Add alignment patterns bits to matrix + * + * Note: this function must be called after {@link setupTimingPattern} + * + * @param {BitMatrix} matrix Modules matrix + * @param {Number} version QR Code version + */ + + +function setupAlignmentPattern(matrix, version) { + var pos = AlignmentPattern.getPositions(version); + + for (var i = 0; i < pos.length; i++) { + var row = pos[i][0]; + var col = pos[i][1]; + + for (var r = -2; r <= 2; r++) { + for (var c = -2; c <= 2; c++) { + if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) { + matrix.set(row + r, col + c, true, true); + } else { + matrix.set(row + r, col + c, false, true); + } + } + } + } +} +/** + * Add version info bits to matrix + * + * @param {BitMatrix} matrix Modules matrix + * @param {Number} version QR Code version + */ + + +function setupVersionInfo(matrix, version) { + var size = matrix.size; + var bits = Version.getEncodedBits(version); + var row, col, mod; + + for (var i = 0; i < 18; i++) { + row = Math.floor(i / 3); + col = i % 3 + size - 8 - 3; + mod = (bits >> i & 1) === 1; + matrix.set(row, col, mod, true); + matrix.set(col, row, mod, true); + } +} +/** + * Add format info bits to matrix + * + * @param {BitMatrix} matrix Modules matrix + * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level + * @param {Number} maskPattern Mask pattern reference value + */ + + +function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) { + var size = matrix.size; + var bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern); + var i, mod; + + for (i = 0; i < 15; i++) { + mod = (bits >> i & 1) === 1; // vertical + + if (i < 6) { + matrix.set(i, 8, mod, true); + } else if (i < 8) { + matrix.set(i + 1, 8, mod, true); + } else { + matrix.set(size - 15 + i, 8, mod, true); + } // horizontal + + + if (i < 8) { + matrix.set(8, size - i - 1, mod, true); + } else if (i < 9) { + matrix.set(8, 15 - i - 1 + 1, mod, true); + } else { + matrix.set(8, 15 - i - 1, mod, true); + } + } // fixed module + + + matrix.set(size - 8, 8, 1, true); +} +/** + * Add encoded data bits to matrix + * + * @param {BitMatrix} matrix Modules matrix + * @param {Buffer} data Data codewords + */ + + +function setupData(matrix, data) { + var size = matrix.size; + var inc = -1; + var row = size - 1; + var bitIndex = 7; + var byteIndex = 0; + + for (var col = size - 1; col > 0; col -= 2) { + if (col === 6) col--; + + while (true) { + for (var c = 0; c < 2; c++) { + if (!matrix.isReserved(row, col - c)) { + var dark = false; + + if (byteIndex < data.length) { + dark = (data[byteIndex] >>> bitIndex & 1) === 1; + } + + matrix.set(row, col - c, dark); + bitIndex--; + + if (bitIndex === -1) { + byteIndex++; + bitIndex = 7; + } + } + } + + row += inc; + + if (row < 0 || size <= row) { + row -= inc; + inc = -inc; + break; + } + } + } +} +/** + * Create encoded codewords from data input + * + * @param {Number} version QR Code version + * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level + * @param {ByteData} data Data input + * @return {Buffer} Buffer containing encoded codewords + */ + + +function createData(version, errorCorrectionLevel, segments) { + // Prepare data buffer + var buffer = new BitBuffer(); + segments.forEach(function (data) { + // prefix data with mode indicator (4 bits) + buffer.put(data.mode.bit, 4); // Prefix data with character count indicator. + // The character count indicator is a string of bits that represents the + // number of characters that are being encoded. + // The character count indicator must be placed after the mode indicator + // and must be a certain number of bits long, depending on the QR version + // and data mode + // @see {@link Mode.getCharCountIndicator}. + + buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version)); // add binary data sequence to buffer + + data.write(buffer); + }); // Calculate required number of bits + + var totalCodewords = Utils.getSymbolTotalCodewords(version); + var ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel); + var dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8; // Add a terminator. + // If the bit string is shorter than the total number of required bits, + // a terminator of up to four 0s must be added to the right side of the string. + // If the bit string is more than four bits shorter than the required number of bits, + // add four 0s to the end. + + if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) { + buffer.put(0, 4); + } // If the bit string is fewer than four bits shorter, add only the number of 0s that + // are needed to reach the required number of bits. + // After adding the terminator, if the number of bits in the string is not a multiple of 8, + // pad the string on the right with 0s to make the string's length a multiple of 8. + + + while (buffer.getLengthInBits() % 8 !== 0) { + buffer.putBit(0); + } // Add pad bytes if the string is still shorter than the total number of required bits. + // Extend the buffer to fill the data capacity of the symbol corresponding to + // the Version and Error Correction Level by adding the Pad Codewords 11101100 (0xEC) + // and 00010001 (0x11) alternately. + + + var remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8; + + for (var i = 0; i < remainingByte; i++) { + buffer.put(i % 2 ? 0x11 : 0xEC, 8); + } + + return createCodewords(buffer, version, errorCorrectionLevel); +} +/** + * Encode input data with Reed-Solomon and return codewords with + * relative error correction bits + * + * @param {BitBuffer} bitBuffer Data to encode + * @param {Number} version QR Code version + * @param {ErrorCorrectionLevel} errorCorrectionLevel Error correction level + * @return {Buffer} Buffer containing encoded codewords + */ + + +function createCodewords(bitBuffer, version, errorCorrectionLevel) { + // Total codewords for this QR code version (Data + Error correction) + var totalCodewords = Utils.getSymbolTotalCodewords(version); // Total number of error correction codewords + + var ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel); // Total number of data codewords + + var dataTotalCodewords = totalCodewords - ecTotalCodewords; // Total number of blocks + + var ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel); // Calculate how many blocks each group should contain + + var blocksInGroup2 = totalCodewords % ecTotalBlocks; + var blocksInGroup1 = ecTotalBlocks - blocksInGroup2; + var totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks); + var dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks); + var dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1; // Number of EC codewords is the same for both groups + + var ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1; // Initialize a Reed-Solomon encoder with a generator polynomial of degree ecCount + + var rs = new ReedSolomonEncoder(ecCount); + var offset = 0; + var dcData = new Array(ecTotalBlocks); + var ecData = new Array(ecTotalBlocks); + var maxDataSize = 0; + var buffer = BufferUtil.from(bitBuffer.buffer); // Divide the buffer into the required number of blocks + + for (var b = 0; b < ecTotalBlocks; b++) { + var dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2; // extract a block of data from buffer + + dcData[b] = buffer.slice(offset, offset + dataSize); // Calculate EC codewords for this data block + + ecData[b] = rs.encode(dcData[b]); + offset += dataSize; + maxDataSize = Math.max(maxDataSize, dataSize); + } // Create final data + // Interleave the data and error correction codewords from each block + + + var data = BufferUtil.alloc(totalCodewords); + var index = 0; + var i, r; // Add data codewords + + for (i = 0; i < maxDataSize; i++) { + for (r = 0; r < ecTotalBlocks; r++) { + if (i < dcData[r].length) { + data[index++] = dcData[r][i]; + } + } + } // Apped EC codewords + + + for (i = 0; i < ecCount; i++) { + for (r = 0; r < ecTotalBlocks; r++) { + data[index++] = ecData[r][i]; + } + } + + return data; +} +/** + * Build QR Code symbol + * + * @param {String} data Input string + * @param {Number} version QR Code version + * @param {ErrorCorretionLevel} errorCorrectionLevel Error level + * @param {MaskPattern} maskPattern Mask pattern + * @return {Object} Object containing symbol data + */ + + +function createSymbol(data, version, errorCorrectionLevel, maskPattern) { + var segments; + + if (isArray(data)) { + segments = Segments.fromArray(data); + } else if (typeof data === 'string') { + var estimatedVersion = version; + + if (!estimatedVersion) { + var rawSegments = Segments.rawSplit(data); // Estimate best version that can contain raw splitted segments + + estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel); + } // Build optimized segments + // If estimated version is undefined, try with the highest version + + + segments = Segments.fromString(data, estimatedVersion || 40); + } else { + throw new Error('Invalid data'); + } // Get the min version that can contain data + + + var bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel); // If no version is found, data cannot be stored + + if (!bestVersion) { + throw new Error('The amount of data is too big to be stored in a QR Code'); + } // If not specified, use min version as default + + + if (!version) { + version = bestVersion; // Check if the specified version can contain the data + } else if (version < bestVersion) { + throw new Error('\n' + 'The chosen QR Code version cannot contain this amount of data.\n' + 'Minimum version required to store current data is: ' + bestVersion + '.\n'); + } + + var dataBits = createData(version, errorCorrectionLevel, segments); // Allocate matrix buffer + + var moduleCount = Utils.getSymbolSize(version); + var modules = new BitMatrix(moduleCount); // Add function modules + + setupFinderPattern(modules, version); + setupTimingPattern(modules); + setupAlignmentPattern(modules, version); // Add temporary dummy bits for format info just to set them as reserved. + // This is needed to prevent these bits from being masked by {@link MaskPattern.applyMask} + // since the masking operation must be performed only on the encoding region. + // These blocks will be replaced with correct values later in code. + + setupFormatInfo(modules, errorCorrectionLevel, 0); + + if (version >= 7) { + setupVersionInfo(modules, version); + } // Add data codewords + + + setupData(modules, dataBits); + + if (isNaN(maskPattern)) { + // Find best mask pattern + maskPattern = MaskPattern.getBestMask(modules, setupFormatInfo.bind(null, modules, errorCorrectionLevel)); + } // Apply mask pattern + + + MaskPattern.applyMask(maskPattern, modules); // Replace format info bits with correct values + + setupFormatInfo(modules, errorCorrectionLevel, maskPattern); + return { + modules: modules, + version: version, + errorCorrectionLevel: errorCorrectionLevel, + maskPattern: maskPattern, + segments: segments + }; +} +/** + * QR Code + * + * @param {String | Array} data Input data + * @param {Object} options Optional configurations + * @param {Number} options.version QR Code version + * @param {String} options.errorCorrectionLevel Error correction level + * @param {Function} options.toSJISFunc Helper func to convert utf8 to sjis + */ + + +exports.create = function create(data, options) { + if (typeof data === 'undefined' || data === '') { + throw new Error('No input text'); + } + + var errorCorrectionLevel = ECLevel.M; + var version; + var mask; + + if (typeof options !== 'undefined') { + // Use higher error correction level as default + errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M); + version = Version.from(options.version); + mask = MaskPattern.from(options.maskPattern); + + if (options.toSJISFunc) { + Utils.setToSJISFunction(options.toSJISFunc); + } + } + + return createSymbol(data, version, errorCorrectionLevel, mask); +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/reed-solomon-encoder.js": +/*!**************************************************************!*\ + !*** ./node_modules/qrcode/lib/core/reed-solomon-encoder.js ***! + \**************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var BufferUtil = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js"); + +var Polynomial = __webpack_require__(/*! ./polynomial */ "./node_modules/qrcode/lib/core/polynomial.js"); + +var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer; + +function ReedSolomonEncoder(degree) { + this.genPoly = undefined; + this.degree = degree; + if (this.degree) this.initialize(this.degree); +} +/** + * Initialize the encoder. + * The input param should correspond to the number of error correction codewords. + * + * @param {Number} degree + */ + + +ReedSolomonEncoder.prototype.initialize = function initialize(degree) { + // create an irreducible generator polynomial + this.degree = degree; + this.genPoly = Polynomial.generateECPolynomial(this.degree); +}; +/** + * Encodes a chunk of data + * + * @param {Buffer} data Buffer containing input data + * @return {Buffer} Buffer containing encoded data + */ + + +ReedSolomonEncoder.prototype.encode = function encode(data) { + if (!this.genPoly) { + throw new Error('Encoder not initialized'); + } // Calculate EC for this data block + // extends data size to data+genPoly size + + + var pad = BufferUtil.alloc(this.degree); + var paddedData = Buffer.concat([data, pad], data.length + this.degree); // The error correction codewords are the remainder after dividing the data codewords + // by a generator polynomial + + var remainder = Polynomial.mod(paddedData, this.genPoly); // return EC data blocks (last n byte, where n is the degree of genPoly) + // If coefficients number in remainder are less than genPoly degree, + // pad with 0s to the left to reach the needed number of coefficients + + var start = this.degree - remainder.length; + + if (start > 0) { + var buff = BufferUtil.alloc(this.degree); + remainder.copy(buff, start); + return buff; + } + + return remainder; +}; + +module.exports = ReedSolomonEncoder; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/regex.js": +/*!***********************************************!*\ + !*** ./node_modules/qrcode/lib/core/regex.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var numeric = '[0-9]+'; +var alphanumeric = '[A-Z $%*+\\-./:]+'; +var kanji = '(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|' + '[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|' + '[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|' + '[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+'; +kanji = kanji.replace(/u/g, "\\u"); + +var _byte = '(?:(?![A-Z0-9 $%*+\\-./:]|' + kanji + ')(?:.|[\r\n]))+'; + +exports.KANJI = new RegExp(kanji, 'g'); +exports.BYTE_KANJI = new RegExp('[^A-Z0-9 $%*+\\-./:]+', 'g'); +exports.BYTE = new RegExp(_byte, 'g'); +exports.NUMERIC = new RegExp(numeric, 'g'); +exports.ALPHANUMERIC = new RegExp(alphanumeric, 'g'); +var TEST_KANJI = new RegExp('^' + kanji + '$'); +var TEST_NUMERIC = new RegExp('^' + numeric + '$'); +var TEST_ALPHANUMERIC = new RegExp('^[A-Z0-9 $%*+\\-./:]+$'); + +exports.testKanji = function testKanji(str) { + return TEST_KANJI.test(str); +}; + +exports.testNumeric = function testNumeric(str) { + return TEST_NUMERIC.test(str); +}; + +exports.testAlphanumeric = function testAlphanumeric(str) { + return TEST_ALPHANUMERIC.test(str); +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/segments.js": +/*!**************************************************!*\ + !*** ./node_modules/qrcode/lib/core/segments.js ***! + \**************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js"); + +var NumericData = __webpack_require__(/*! ./numeric-data */ "./node_modules/qrcode/lib/core/numeric-data.js"); + +var AlphanumericData = __webpack_require__(/*! ./alphanumeric-data */ "./node_modules/qrcode/lib/core/alphanumeric-data.js"); + +var ByteData = __webpack_require__(/*! ./byte-data */ "./node_modules/qrcode/lib/core/byte-data.js"); + +var KanjiData = __webpack_require__(/*! ./kanji-data */ "./node_modules/qrcode/lib/core/kanji-data.js"); + +var Regex = __webpack_require__(/*! ./regex */ "./node_modules/qrcode/lib/core/regex.js"); + +var Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js"); + +var dijkstra = __webpack_require__(/*! dijkstrajs */ "./node_modules/dijkstrajs/dijkstra.js"); +/** + * Returns UTF8 byte length + * + * @param {String} str Input string + * @return {Number} Number of byte + */ + + +function getStringByteLength(str) { + return unescape(encodeURIComponent(str)).length; +} +/** + * Get a list of segments of the specified mode + * from a string + * + * @param {Mode} mode Segment mode + * @param {String} str String to process + * @return {Array} Array of object with segments data + */ + + +function getSegments(regex, mode, str) { + var segments = []; + var result; + + while ((result = regex.exec(str)) !== null) { + segments.push({ + data: result[0], + index: result.index, + mode: mode, + length: result[0].length + }); + } + + return segments; +} +/** + * Extracts a series of segments with the appropriate + * modes from a string + * + * @param {String} dataStr Input string + * @return {Array} Array of object with segments data + */ + + +function getSegmentsFromString(dataStr) { + var numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr); + var alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr); + var byteSegs; + var kanjiSegs; + + if (Utils.isKanjiModeEnabled()) { + byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr); + kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr); + } else { + byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr); + kanjiSegs = []; + } + + var segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs); + return segs.sort(function (s1, s2) { + return s1.index - s2.index; + }).map(function (obj) { + return { + data: obj.data, + mode: obj.mode, + length: obj.length + }; + }); +} +/** + * Returns how many bits are needed to encode a string of + * specified length with the specified mode + * + * @param {Number} length String length + * @param {Mode} mode Segment mode + * @return {Number} Bit length + */ + + +function getSegmentBitsLength(length, mode) { + switch (mode) { + case Mode.NUMERIC: + return NumericData.getBitsLength(length); + + case Mode.ALPHANUMERIC: + return AlphanumericData.getBitsLength(length); + + case Mode.KANJI: + return KanjiData.getBitsLength(length); + + case Mode.BYTE: + return ByteData.getBitsLength(length); + } +} +/** + * Merges adjacent segments which have the same mode + * + * @param {Array} segs Array of object with segments data + * @return {Array} Array of object with segments data + */ + + +function mergeSegments(segs) { + return segs.reduce(function (acc, curr) { + var prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null; + + if (prevSeg && prevSeg.mode === curr.mode) { + acc[acc.length - 1].data += curr.data; + return acc; + } + + acc.push(curr); + return acc; + }, []); +} +/** + * Generates a list of all possible nodes combination which + * will be used to build a segments graph. + * + * Nodes are divided by groups. Each group will contain a list of all the modes + * in which is possible to encode the given text. + * + * For example the text '12345' can be encoded as Numeric, Alphanumeric or Byte. + * The group for '12345' will contain then 3 objects, one for each + * possible encoding mode. + * + * Each node represents a possible segment. + * + * @param {Array} segs Array of object with segments data + * @return {Array} Array of object with segments data + */ + + +function buildNodes(segs) { + var nodes = []; + + for (var i = 0; i < segs.length; i++) { + var seg = segs[i]; + + switch (seg.mode) { + case Mode.NUMERIC: + nodes.push([seg, { + data: seg.data, + mode: Mode.ALPHANUMERIC, + length: seg.length + }, { + data: seg.data, + mode: Mode.BYTE, + length: seg.length + }]); + break; + + case Mode.ALPHANUMERIC: + nodes.push([seg, { + data: seg.data, + mode: Mode.BYTE, + length: seg.length + }]); + break; + + case Mode.KANJI: + nodes.push([seg, { + data: seg.data, + mode: Mode.BYTE, + length: getStringByteLength(seg.data) + }]); + break; + + case Mode.BYTE: + nodes.push([{ + data: seg.data, + mode: Mode.BYTE, + length: getStringByteLength(seg.data) + }]); + } + } + + return nodes; +} +/** + * Builds a graph from a list of nodes. + * All segments in each node group will be connected with all the segments of + * the next group and so on. + * + * At each connection will be assigned a weight depending on the + * segment's byte length. + * + * @param {Array} nodes Array of object with segments data + * @param {Number} version QR Code version + * @return {Object} Graph of all possible segments + */ + + +function buildGraph(nodes, version) { + var table = {}; + var graph = { + 'start': {} + }; + var prevNodeIds = ['start']; + + for (var i = 0; i < nodes.length; i++) { + var nodeGroup = nodes[i]; + var currentNodeIds = []; + + for (var j = 0; j < nodeGroup.length; j++) { + var node = nodeGroup[j]; + var key = '' + i + j; + currentNodeIds.push(key); + table[key] = { + node: node, + lastCount: 0 + }; + graph[key] = {}; + + for (var n = 0; n < prevNodeIds.length; n++) { + var prevNodeId = prevNodeIds[n]; + + if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) { + graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode); + table[prevNodeId].lastCount += node.length; + } else { + if (table[prevNodeId]) table[prevNodeId].lastCount = node.length; + graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version); // switch cost + } + } + } + + prevNodeIds = currentNodeIds; + } + + for (n = 0; n < prevNodeIds.length; n++) { + graph[prevNodeIds[n]]['end'] = 0; + } + + return { + map: graph, + table: table + }; +} +/** + * Builds a segment from a specified data and mode. + * If a mode is not specified, the more suitable will be used. + * + * @param {String} data Input data + * @param {Mode | String} modesHint Data mode + * @return {Segment} Segment + */ + + +function buildSingleSegment(data, modesHint) { + var mode; + var bestMode = Mode.getBestModeForData(data); + mode = Mode.from(modesHint, bestMode); // Make sure data can be encoded + + if (mode !== Mode.BYTE && mode.bit < bestMode.bit) { + throw new Error('"' + data + '"' + ' cannot be encoded with mode ' + Mode.toString(mode) + '.\n Suggested mode is: ' + Mode.toString(bestMode)); + } // Use Mode.BYTE if Kanji support is disabled + + + if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) { + mode = Mode.BYTE; + } + + switch (mode) { + case Mode.NUMERIC: + return new NumericData(data); + + case Mode.ALPHANUMERIC: + return new AlphanumericData(data); + + case Mode.KANJI: + return new KanjiData(data); + + case Mode.BYTE: + return new ByteData(data); + } +} +/** + * Builds a list of segments from an array. + * Array can contain Strings or Objects with segment's info. + * + * For each item which is a string, will be generated a segment with the given + * string and the more appropriate encoding mode. + * + * For each item which is an object, will be generated a segment with the given + * data and mode. + * Objects must contain at least the property "data". + * If property "mode" is not present, the more suitable mode will be used. + * + * @param {Array} array Array of objects with segments data + * @return {Array} Array of Segments + */ + + +exports.fromArray = function fromArray(array) { + return array.reduce(function (acc, seg) { + if (typeof seg === 'string') { + acc.push(buildSingleSegment(seg, null)); + } else if (seg.data) { + acc.push(buildSingleSegment(seg.data, seg.mode)); + } + + return acc; + }, []); +}; +/** + * Builds an optimized sequence of segments from a string, + * which will produce the shortest possible bitstream. + * + * @param {String} data Input string + * @param {Number} version QR Code version + * @return {Array} Array of segments + */ + + +exports.fromString = function fromString(data, version) { + var segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled()); + var nodes = buildNodes(segs); + var graph = buildGraph(nodes, version); + var path = dijkstra.find_path(graph.map, 'start', 'end'); + var optimizedSegs = []; + + for (var i = 1; i < path.length - 1; i++) { + optimizedSegs.push(graph.table[path[i]].node); + } + + return exports.fromArray(mergeSegments(optimizedSegs)); +}; +/** + * Splits a string in various segments with the modes which + * best represent their content. + * The produced segments are far from being optimized. + * The output of this function is only used to estimate a QR Code version + * which may contain the data. + * + * @param {string} data Input string + * @return {Array} Array of segments + */ + + +exports.rawSplit = function rawSplit(data) { + return exports.fromArray(getSegmentsFromString(data, Utils.isKanjiModeEnabled())); +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/utils.js": +/*!***********************************************!*\ + !*** ./node_modules/qrcode/lib/core/utils.js ***! + \***********************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var toSJISFunction; +var CODEWORDS_COUNT = [0, // Not used +26, 44, 70, 100, 134, 172, 196, 242, 292, 346, 404, 466, 532, 581, 655, 733, 815, 901, 991, 1085, 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051, 2185, 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532, 3706]; +/** + * Returns the QR Code size for the specified version + * + * @param {Number} version QR Code version + * @return {Number} size of QR code + */ + +exports.getSymbolSize = function getSymbolSize(version) { + if (!version) throw new Error('"version" cannot be null or undefined'); + if (version < 1 || version > 40) throw new Error('"version" should be in range from 1 to 40'); + return version * 4 + 17; +}; +/** + * Returns the total number of codewords used to store data and EC information. + * + * @param {Number} version QR Code version + * @return {Number} Data length in bits + */ + + +exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) { + return CODEWORDS_COUNT[version]; +}; +/** + * Encode data with Bose-Chaudhuri-Hocquenghem + * + * @param {Number} data Value to encode + * @return {Number} Encoded value + */ + + +exports.getBCHDigit = function (data) { + var digit = 0; + + while (data !== 0) { + digit++; + data >>>= 1; + } + + return digit; +}; + +exports.setToSJISFunction = function setToSJISFunction(f) { + if (typeof f !== 'function') { + throw new Error('"toSJISFunc" is not a valid function.'); + } + + toSJISFunction = f; +}; + +exports.isKanjiModeEnabled = function () { + return typeof toSJISFunction !== 'undefined'; +}; + +exports.toSJIS = function toSJIS(kanji) { + return toSJISFunction(kanji); +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/version-check.js": +/*!*******************************************************!*\ + !*** ./node_modules/qrcode/lib/core/version-check.js ***! + \*******************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +/** + * Check if QR Code version is valid + * + * @param {Number} version QR Code version + * @return {Boolean} true if valid version, false otherwise + */ +exports.isValid = function isValid(version) { + return !isNaN(version) && version >= 1 && version <= 40; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/core/version.js": +/*!*************************************************!*\ + !*** ./node_modules/qrcode/lib/core/version.js ***! + \*************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/core/utils.js"); + +var ECCode = __webpack_require__(/*! ./error-correction-code */ "./node_modules/qrcode/lib/core/error-correction-code.js"); + +var ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js"); + +var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js"); + +var VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js"); + +var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js"); // Generator polynomial used to encode version information + + +var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0; +var G18_BCH = Utils.getBCHDigit(G18); + +function getBestVersionForDataLength(mode, length, errorCorrectionLevel) { + for (var currentVersion = 1; currentVersion <= 40; currentVersion++) { + if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) { + return currentVersion; + } + } + + return undefined; +} + +function getReservedBitsCount(mode, version) { + // Character count indicator + mode indicator bits + return Mode.getCharCountIndicator(mode, version) + 4; +} + +function getTotalBitsFromDataArray(segments, version) { + var totalBits = 0; + segments.forEach(function (data) { + var reservedBits = getReservedBitsCount(data.mode, version); + totalBits += reservedBits + data.getBitsLength(); + }); + return totalBits; +} + +function getBestVersionForMixedData(segments, errorCorrectionLevel) { + for (var currentVersion = 1; currentVersion <= 40; currentVersion++) { + var length = getTotalBitsFromDataArray(segments, currentVersion); + + if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) { + return currentVersion; + } + } + + return undefined; +} +/** + * Returns version number from a value. + * If value is not a valid version, returns defaultValue + * + * @param {Number|String} value QR Code version + * @param {Number} defaultValue Fallback value + * @return {Number} QR Code version number + */ + + +exports.from = function from(value, defaultValue) { + if (VersionCheck.isValid(value)) { + return parseInt(value, 10); + } + + return defaultValue; +}; +/** + * Returns how much data can be stored with the specified QR code version + * and error correction level + * + * @param {Number} version QR Code version (1-40) + * @param {Number} errorCorrectionLevel Error correction level + * @param {Mode} mode Data mode + * @return {Number} Quantity of storable data + */ + + +exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) { + if (!VersionCheck.isValid(version)) { + throw new Error('Invalid QR Code version'); + } // Use Byte mode as default + + + if (typeof mode === 'undefined') mode = Mode.BYTE; // Total codewords for this QR code version (Data + Error correction) + + var totalCodewords = Utils.getSymbolTotalCodewords(version); // Total number of error correction codewords + + var ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel); // Total number of data codewords + + var dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8; + if (mode === Mode.MIXED) return dataTotalCodewordsBits; + var usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version); // Return max number of storable codewords + + switch (mode) { + case Mode.NUMERIC: + return Math.floor(usableBits / 10 * 3); + + case Mode.ALPHANUMERIC: + return Math.floor(usableBits / 11 * 2); + + case Mode.KANJI: + return Math.floor(usableBits / 13); + + case Mode.BYTE: + default: + return Math.floor(usableBits / 8); + } +}; +/** + * Returns the minimum version needed to contain the amount of data + * + * @param {Segment} data Segment of data + * @param {Number} [errorCorrectionLevel=H] Error correction level + * @param {Mode} mode Data mode + * @return {Number} QR Code version + */ + + +exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) { + var seg; + var ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M); + + if (isArray(data)) { + if (data.length > 1) { + return getBestVersionForMixedData(data, ecl); + } + + if (data.length === 0) { + return 1; + } + + seg = data[0]; + } else { + seg = data; + } + + return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl); +}; +/** + * Returns version information with relative error correction bits + * + * The version information is included in QR Code symbols of version 7 or larger. + * It consists of an 18-bit sequence containing 6 data bits, + * with 12 error correction bits calculated using the (18, 6) Golay code. + * + * @param {Number} version QR Code version + * @return {Number} Encoded version info bits + */ + + +exports.getEncodedBits = function getEncodedBits(version) { + if (!VersionCheck.isValid(version) || version < 7) { + throw new Error('Invalid QR Code version'); + } + + var d = version << 12; + + while (Utils.getBCHDigit(d) - G18_BCH >= 0) { + d ^= G18 << Utils.getBCHDigit(d) - G18_BCH; + } + + return version << 12 | d; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/renderer/canvas.js": +/*!****************************************************!*\ + !*** ./node_modules/qrcode/lib/renderer/canvas.js ***! + \****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/renderer/utils.js"); + +function clearCanvas(ctx, canvas, size) { + ctx.clearRect(0, 0, canvas.width, canvas.height); + if (!canvas.style) canvas.style = {}; + canvas.height = size; + canvas.width = size; + canvas.style.height = size + 'px'; + canvas.style.width = size + 'px'; +} + +function getCanvasElement() { + try { + return document.createElement('canvas'); + } catch (e) { + throw new Error('You need to specify a canvas element'); + } +} + +exports.render = function render(qrData, canvas, options) { + var opts = options; + var canvasEl = canvas; + + if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) { + opts = canvas; + canvas = undefined; + } + + if (!canvas) { + canvasEl = getCanvasElement(); + } + + opts = Utils.getOptions(opts); + var size = Utils.getImageWidth(qrData.modules.size, opts); + var ctx = canvasEl.getContext('2d'); + var image = ctx.createImageData(size, size); + Utils.qrToImageData(image.data, qrData, opts); + clearCanvas(ctx, canvasEl, size); + ctx.putImageData(image, 0, 0); + return canvasEl; +}; + +exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) { + var opts = options; + + if (typeof opts === 'undefined' && (!canvas || !canvas.getContext)) { + opts = canvas; + canvas = undefined; + } + + if (!opts) opts = {}; + var canvasEl = exports.render(qrData, canvas, opts); + var type = opts.type || 'image/png'; + var rendererOpts = opts.rendererOpts || {}; + return canvasEl.toDataURL(type, rendererOpts.quality); +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/renderer/svg-tag.js": +/*!*****************************************************!*\ + !*** ./node_modules/qrcode/lib/renderer/svg-tag.js ***! + \*****************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +var Utils = __webpack_require__(/*! ./utils */ "./node_modules/qrcode/lib/renderer/utils.js"); + +function getColorAttrib(color, attrib) { + var alpha = color.a / 255; + var str = attrib + '="' + color.hex + '"'; + return alpha < 1 ? str + ' ' + attrib + '-opacity="' + alpha.toFixed(2).slice(1) + '"' : str; +} + +function svgCmd(cmd, x, y) { + var str = cmd + x; + if (typeof y !== 'undefined') str += ' ' + y; + return str; +} + +function qrToPath(data, size, margin) { + var path = ''; + var moveBy = 0; + var newRow = false; + var lineLength = 0; + + for (var i = 0; i < data.length; i++) { + var col = Math.floor(i % size); + var row = Math.floor(i / size); + if (!col && !newRow) newRow = true; + + if (data[i]) { + lineLength++; + + if (!(i > 0 && col > 0 && data[i - 1])) { + path += newRow ? svgCmd('M', col + margin, 0.5 + row + margin) : svgCmd('m', moveBy, 0); + moveBy = 0; + newRow = false; + } + + if (!(col + 1 < size && data[i + 1])) { + path += svgCmd('h', lineLength); + lineLength = 0; + } + } else { + moveBy++; + } + } + + return path; +} + +exports.render = function render(qrData, options, cb) { + var opts = Utils.getOptions(options); + var size = qrData.modules.size; + var data = qrData.modules.data; + var qrcodesize = size + opts.margin * 2; + var bg = !opts.color.light.a ? '' : ''; + var path = ''; + var viewBox = 'viewBox="' + '0 0 ' + qrcodesize + ' ' + qrcodesize + '"'; + var width = !opts.width ? '' : 'width="' + opts.width + '" height="' + opts.width + '" '; + var svgTag = '' + bg + path + '\n'; + + if (typeof cb === 'function') { + cb(null, svgTag); + } + + return svgTag; +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/renderer/utils.js": +/*!***************************************************!*\ + !*** ./node_modules/qrcode/lib/renderer/utils.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +function hex2rgba(hex) { + if (typeof hex === 'number') { + hex = hex.toString(); + } + + if (typeof hex !== 'string') { + throw new Error('Color should be defined as hex string'); + } + + var hexCode = hex.slice().replace('#', '').split(''); + + if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) { + throw new Error('Invalid hex color: ' + hex); + } // Convert from short to long form (fff -> ffffff) + + + if (hexCode.length === 3 || hexCode.length === 4) { + hexCode = Array.prototype.concat.apply([], hexCode.map(function (c) { + return [c, c]; + })); + } // Add default alpha value + + + if (hexCode.length === 6) hexCode.push('F', 'F'); + var hexValue = parseInt(hexCode.join(''), 16); + return { + r: hexValue >> 24 & 255, + g: hexValue >> 16 & 255, + b: hexValue >> 8 & 255, + a: hexValue & 255, + hex: '#' + hexCode.slice(0, 6).join('') + }; +} + +exports.getOptions = function getOptions(options) { + if (!options) options = {}; + if (!options.color) options.color = {}; + var margin = typeof options.margin === 'undefined' || options.margin === null || options.margin < 0 ? 4 : options.margin; + var width = options.width && options.width >= 21 ? options.width : undefined; + var scale = options.scale || 4; + return { + width: width, + scale: width ? 4 : scale, + margin: margin, + color: { + dark: hex2rgba(options.color.dark || '#000000ff'), + light: hex2rgba(options.color.light || '#ffffffff') + }, + type: options.type, + rendererOpts: options.rendererOpts || {} + }; +}; + +exports.getScale = function getScale(qrSize, opts) { + return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale; +}; + +exports.getImageWidth = function getImageWidth(qrSize, opts) { + var scale = exports.getScale(qrSize, opts); + return Math.floor((qrSize + opts.margin * 2) * scale); +}; + +exports.qrToImageData = function qrToImageData(imgData, qr, opts) { + var size = qr.modules.size; + var data = qr.modules.data; + var scale = exports.getScale(size, opts); + var symbolSize = Math.floor((size + opts.margin * 2) * scale); + var scaledMargin = opts.margin * scale; + var palette = [opts.color.light, opts.color.dark]; + + for (var i = 0; i < symbolSize; i++) { + for (var j = 0; j < symbolSize; j++) { + var posDst = (i * symbolSize + j) * 4; + var pxColor = opts.color.light; + + if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) { + var iSrc = Math.floor((i - scaledMargin) / scale); + var jSrc = Math.floor((j - scaledMargin) / scale); + pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0]; + } + + imgData[posDst++] = pxColor.r; + imgData[posDst++] = pxColor.g; + imgData[posDst++] = pxColor.b; + imgData[posDst] = pxColor.a; + } + } +}; + +/***/ }), + +/***/ "./node_modules/qrcode/lib/utils/typedarray-buffer.js": +/*!************************************************************!*\ + !*** ./node_modules/qrcode/lib/utils/typedarray-buffer.js ***! + \************************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/** + * Implementation of a subset of node.js Buffer methods for the browser. + * Based on https://github.com/feross/buffer + */ + +/* eslint-disable no-proto */ + + +var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js"); + +function typedArraySupport() { + // Can typed array instances be augmented? + try { + var arr = new Uint8Array(1); + arr.__proto__ = { + __proto__: Uint8Array.prototype, + foo: function foo() { + return 42; + } + }; + return arr.foo() === 42; + } catch (e) { + return false; + } +} + +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport(); +var K_MAX_LENGTH = Buffer.TYPED_ARRAY_SUPPORT ? 0x7fffffff : 0x3fffffff; + +function Buffer(arg, offset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, offset, length); + } + + if (typeof arg === 'number') { + return allocUnsafe(this, arg); + } + + return from(this, arg, offset, length); +} + +if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype; + Buffer.__proto__ = Uint8Array; // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + + if (typeof Symbol !== 'undefined' && Symbol.species && Buffer[Symbol.species] === Buffer) { + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true, + enumerable: false, + writable: false + }); + } +} + +function checked(length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes'); + } + + return length | 0; +} + +function isnan(val) { + return val !== val; // eslint-disable-line no-self-compare +} + +function createBuffer(that, length) { + var buf; + + if (Buffer.TYPED_ARRAY_SUPPORT) { + buf = new Uint8Array(length); + buf.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + buf = that; + + if (buf === null) { + buf = new Buffer(length); + } + + buf.length = length; + } + + return buf; +} + +function allocUnsafe(that, size) { + var buf = createBuffer(that, size < 0 ? 0 : checked(size) | 0); + + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + buf[i] = 0; + } + } + + return buf; +} + +function fromString(that, string) { + var length = byteLength(string) | 0; + var buf = createBuffer(that, length); + var actual = buf.write(string); + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual); + } + + return buf; +} + +function fromArrayLike(that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0; + var buf = createBuffer(that, length); + + for (var i = 0; i < length; i += 1) { + buf[i] = array[i] & 255; + } + + return buf; +} + +function fromArrayBuffer(that, array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds'); + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds'); + } + + var buf; + + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array); + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset); + } else { + buf = new Uint8Array(array, byteOffset, length); + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + buf.__proto__ = Buffer.prototype; + } else { + // Fallback: Return an object instance of the Buffer class + buf = fromArrayLike(that, buf); + } + + return buf; +} + +function fromObject(that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0; + var buf = createBuffer(that, len); + + if (buf.length === 0) { + return buf; + } + + obj.copy(buf, 0, 0, len); + return buf; + } + + if (obj) { + if (typeof ArrayBuffer !== 'undefined' && obj.buffer instanceof ArrayBuffer || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0); + } + + return fromArrayLike(that, obj); + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(that, obj.data); + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.'); +} + +function utf8ToBytes(string, units) { + units = units || Infinity; + var codePoint; + var length = string.length; + var leadSurrogate = null; + var bytes = []; + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); // is surrogate component + + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + continue; + } // valid lead + + + leadSurrogate = codePoint; + continue; + } // 2 leads in a row + + + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + leadSurrogate = codePoint; + continue; + } // valid surrogate pair + + + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000; + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD); + } + + leadSurrogate = null; // encode utf8 + + if (codePoint < 0x80) { + if ((units -= 1) < 0) break; + bytes.push(codePoint); + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break; + bytes.push(codePoint >> 0x6 | 0xC0, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break; + bytes.push(codePoint >> 0xC | 0xE0, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break; + bytes.push(codePoint >> 0x12 | 0xF0, codePoint >> 0xC & 0x3F | 0x80, codePoint >> 0x6 & 0x3F | 0x80, codePoint & 0x3F | 0x80); + } else { + throw new Error('Invalid code point'); + } + } + + return bytes; +} + +function byteLength(string) { + if (Buffer.isBuffer(string)) { + return string.length; + } + + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength; + } + + if (typeof string !== 'string') { + string = '' + string; + } + + var len = string.length; + if (len === 0) return 0; + return utf8ToBytes(string).length; +} + +function blitBuffer(src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if (i + offset >= dst.length || i >= src.length) break; + dst[i + offset] = src[i]; + } + + return i; +} + +function utf8Write(buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length); +} + +function from(that, value, offset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, offset, length); + } + + if (typeof value === 'string') { + return fromString(that, value, offset); + } + + return fromObject(that, value); +} + +Buffer.prototype.write = function write(string, offset, length) { + // Buffer#write(string) + if (offset === undefined) { + length = this.length; + offset = 0; // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + length = this.length; + offset = 0; // Buffer#write(string, offset[, length]) + } else if (isFinite(offset)) { + offset = offset | 0; + + if (isFinite(length)) { + length = length | 0; + } else { + length = undefined; + } + } + + var remaining = this.length - offset; + if (length === undefined || length > remaining) length = remaining; + + if (string.length > 0 && (length < 0 || offset < 0) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds'); + } + + return utf8Write(this, string, offset, length); +}; + +Buffer.prototype.slice = function slice(start, end) { + var len = this.length; + start = ~~start; + end = end === undefined ? len : ~~end; + + if (start < 0) { + start += len; + if (start < 0) start = 0; + } else if (start > len) { + start = len; + } + + if (end < 0) { + end += len; + if (end < 0) end = 0; + } else if (end > len) { + end = len; + } + + if (end < start) end = start; + var newBuf; + + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end); // Return an augmented `Uint8Array` instance + + newBuf.__proto__ = Buffer.prototype; + } else { + var sliceLen = end - start; + newBuf = new Buffer(sliceLen, undefined); + + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start]; + } + } + + return newBuf; +}; + +Buffer.prototype.copy = function copy(target, targetStart, start, end) { + if (!start) start = 0; + if (!end && end !== 0) end = this.length; + if (targetStart >= target.length) targetStart = target.length; + if (!targetStart) targetStart = 0; + if (end > 0 && end < start) end = start; // Copy 0 bytes; we're done + + if (end === start) return 0; + if (target.length === 0 || this.length === 0) return 0; // Fatal error conditions + + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds'); + } + + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds'); + if (end < 0) throw new RangeError('sourceEnd out of bounds'); // Are we oob? + + if (end > this.length) end = this.length; + + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start; + } + + var len = end - start; + var i; + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start]; + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start]; + } + } else { + Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart); + } + + return len; +}; + +Buffer.prototype.fill = function fill(val, start, end) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + start = 0; + end = this.length; + } else if (typeof end === 'string') { + end = this.length; + } + + if (val.length === 1) { + var code = val.charCodeAt(0); + + if (code < 256) { + val = code; + } + } + } else if (typeof val === 'number') { + val = val & 255; + } // Invalid ranges are not set to a default, so can range check early. + + + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index'); + } + + if (end <= start) { + return this; + } + + start = start >>> 0; + end = end === undefined ? this.length : end >>> 0; + if (!val) val = 0; + var i; + + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val; + } + } else { + var bytes = Buffer.isBuffer(val) ? val : new Buffer(val); + var len = bytes.length; + + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len]; + } + } + + return this; +}; + +Buffer.concat = function concat(list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + + if (list.length === 0) { + return createBuffer(null, 0); + } + + var i; + + if (length === undefined) { + length = 0; + + for (i = 0; i < list.length; ++i) { + length += list[i].length; + } + } + + var buffer = allocUnsafe(null, length); + var pos = 0; + + for (i = 0; i < list.length; ++i) { + var buf = list[i]; + + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers'); + } + + buf.copy(buffer, pos); + pos += buf.length; + } + + return buffer; +}; + +Buffer.byteLength = byteLength; +Buffer.prototype._isBuffer = true; + +Buffer.isBuffer = function isBuffer(b) { + return !!(b != null && b._isBuffer); +}; + +module.exports.alloc = function (size) { + var buffer = new Buffer(size); + buffer.fill(0); + return buffer; +}; + +module.exports.from = function (data) { + return new Buffer(data); +}; + +/***/ }), + +/***/ "./node_modules/qrcode/node_modules/isarray/index.js": +/*!***********************************************************!*\ + !*** ./node_modules/qrcode/node_modules/isarray/index.js ***! + \***********************************************************/ +/*! no static exports found */ +/***/ (function(module, exports) { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + +/***/ }), + +/***/ "./node_modules/query-string/index.js": +/*!********************************************!*\ + !*** ./node_modules/query-string/index.js ***! + \********************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } + +function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +var strictUriEncode = __webpack_require__(/*! strict-uri-encode */ "./node_modules/strict-uri-encode/index.js"); + +var decodeComponent = __webpack_require__(/*! decode-uri-component */ "./node_modules/decode-uri-component/index.js"); + +var splitOnFirst = __webpack_require__(/*! split-on-first */ "./node_modules/split-on-first/index.js"); + +var isNullOrUndefined = function isNullOrUndefined(value) { + return value === null || value === undefined; +}; + +function encoderForArrayFormat(options) { + switch (options.arrayFormat) { + case 'index': + return function (key) { + return function (result, value) { + var index = result.length; + + if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === '') { + return result; + } + + if (value === null) { + return [].concat(_toConsumableArray(result), [[encode(key, options), '[', index, ']'].join('')]); + } + + return [].concat(_toConsumableArray(result), [[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join('')]); + }; + }; + + case 'bracket': + return function (key) { + return function (result, value) { + if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === '') { + return result; + } + + if (value === null) { + return [].concat(_toConsumableArray(result), [[encode(key, options), '[]'].join('')]); + } + + return [].concat(_toConsumableArray(result), [[encode(key, options), '[]=', encode(value, options)].join('')]); + }; + }; + + case 'comma': + case 'separator': + return function (key) { + return function (result, value) { + if (value === null || value === undefined || value.length === 0) { + return result; + } + + if (result.length === 0) { + return [[encode(key, options), '=', encode(value, options)].join('')]; + } + + return [[result, encode(value, options)].join(options.arrayFormatSeparator)]; + }; + }; + + default: + return function (key) { + return function (result, value) { + if (value === undefined || options.skipNull && value === null || options.skipEmptyString && value === '') { + return result; + } + + if (value === null) { + return [].concat(_toConsumableArray(result), [encode(key, options)]); + } + + return [].concat(_toConsumableArray(result), [[encode(key, options), '=', encode(value, options)].join('')]); + }; + }; + } +} + +function parserForArrayFormat(options) { + var result; + + switch (options.arrayFormat) { + case 'index': + return function (key, value, accumulator) { + result = /\[(\d*)\]$/.exec(key); + key = key.replace(/\[\d*\]$/, ''); + + if (!result) { + accumulator[key] = value; + return; + } + + if (accumulator[key] === undefined) { + accumulator[key] = {}; + } + + accumulator[key][result[1]] = value; + }; + + case 'bracket': + return function (key, value, accumulator) { + result = /(\[\])$/.exec(key); + key = key.replace(/\[\]$/, ''); + + if (!result) { + accumulator[key] = value; + return; + } + + if (accumulator[key] === undefined) { + accumulator[key] = [value]; + return; + } + + accumulator[key] = [].concat(accumulator[key], value); + }; + + case 'comma': + case 'separator': + return function (key, value, accumulator) { + var isArray = typeof value === 'string' && value.split('').indexOf(options.arrayFormatSeparator) > -1; + var newValue = isArray ? value.split(options.arrayFormatSeparator).map(function (item) { + return decode(item, options); + }) : value === null ? value : decode(value, options); + accumulator[key] = newValue; + }; + + default: + return function (key, value, accumulator) { + if (accumulator[key] === undefined) { + accumulator[key] = value; + return; + } + + accumulator[key] = [].concat(accumulator[key], value); + }; + } +} + +function validateArrayFormatSeparator(value) { + if (typeof value !== 'string' || value.length !== 1) { + throw new TypeError('arrayFormatSeparator must be single character string'); + } +} + +function encode(value, options) { + if (options.encode) { + return options.strict ? strictUriEncode(value) : encodeURIComponent(value); + } + + return value; +} + +function decode(value, options) { + if (options.decode) { + return decodeComponent(value); + } + + return value; +} + +function keysSorter(input) { + if (Array.isArray(input)) { + return input.sort(); + } + + if (_typeof(input) === 'object') { + return keysSorter(Object.keys(input)).sort(function (a, b) { + return Number(a) - Number(b); + }).map(function (key) { + return input[key]; + }); + } + + return input; +} + +function removeHash(input) { + var hashStart = input.indexOf('#'); + + if (hashStart !== -1) { + input = input.slice(0, hashStart); + } + + return input; +} + +function getHash(url) { + var hash = ''; + var hashStart = url.indexOf('#'); + + if (hashStart !== -1) { + hash = url.slice(hashStart); + } + + return hash; +} + +function extract(input) { + input = removeHash(input); + var queryStart = input.indexOf('?'); + + if (queryStart === -1) { + return ''; + } + + return input.slice(queryStart + 1); +} + +function parseValue(value, options) { + if (options.parseNumbers && !Number.isNaN(Number(value)) && typeof value === 'string' && value.trim() !== '') { + value = Number(value); + } else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) { + value = value.toLowerCase() === 'true'; + } + + return value; +} + +function parse(input, options) { + options = Object.assign({ + decode: true, + sort: true, + arrayFormat: 'none', + arrayFormatSeparator: ',', + parseNumbers: false, + parseBooleans: false + }, options); + validateArrayFormatSeparator(options.arrayFormatSeparator); + var formatter = parserForArrayFormat(options); // Create an object with no prototype + + var ret = Object.create(null); + + if (typeof input !== 'string') { + return ret; + } + + input = input.trim().replace(/^[?#&]/, ''); + + if (!input) { + return ret; + } + + var _iterator = _createForOfIteratorHelper(input.split('&')), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var param = _step.value; + + var _splitOnFirst = splitOnFirst(options.decode ? param.replace(/\+/g, ' ') : param, '='), + _splitOnFirst2 = _slicedToArray(_splitOnFirst, 2), + _key = _splitOnFirst2[0], + _value = _splitOnFirst2[1]; // Missing `=` should be `null`: + // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters + + + _value = _value === undefined ? null : ['comma', 'separator'].includes(options.arrayFormat) ? _value : decode(_value, options); + formatter(decode(_key, options), _value, ret); + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + for (var _i = 0, _Object$keys = Object.keys(ret); _i < _Object$keys.length; _i++) { + var key = _Object$keys[_i]; + var value = ret[key]; + + if (_typeof(value) === 'object' && value !== null) { + for (var _i2 = 0, _Object$keys2 = Object.keys(value); _i2 < _Object$keys2.length; _i2++) { + var k = _Object$keys2[_i2]; + value[k] = parseValue(value[k], options); + } + } else { + ret[key] = parseValue(value, options); + } + } + + if (options.sort === false) { + return ret; + } + + return (options.sort === true ? Object.keys(ret).sort() : Object.keys(ret).sort(options.sort)).reduce(function (result, key) { + var value = ret[key]; + + if (Boolean(value) && _typeof(value) === 'object' && !Array.isArray(value)) { + // Sort object keys, not values + result[key] = keysSorter(value); + } else { + result[key] = value; + } + + return result; + }, Object.create(null)); +} + +exports.extract = extract; +exports.parse = parse; + +exports.stringify = function (object, options) { + if (!object) { + return ''; + } + + options = Object.assign({ + encode: true, + strict: true, + arrayFormat: 'none', + arrayFormatSeparator: ',' + }, options); + validateArrayFormatSeparator(options.arrayFormatSeparator); + + var shouldFilter = function shouldFilter(key) { + return options.skipNull && isNullOrUndefined(object[key]) || options.skipEmptyString && object[key] === ''; + }; + + var formatter = encoderForArrayFormat(options); + var objectCopy = {}; + + for (var _i3 = 0, _Object$keys3 = Object.keys(object); _i3 < _Object$keys3.length; _i3++) { + var key = _Object$keys3[_i3]; + + if (!shouldFilter(key)) { + objectCopy[key] = object[key]; + } + } + + var keys = Object.keys(objectCopy); + + if (options.sort !== false) { + keys.sort(options.sort); + } + + return keys.map(function (key) { + var value = object[key]; + + if (value === undefined) { + return ''; + } + + if (value === null) { + return encode(key, options); + } + + if (Array.isArray(value)) { + return value.reduce(formatter(key), []).join('&'); + } + + return encode(key, options) + '=' + encode(value, options); + }).filter(function (x) { + return x.length > 0; + }).join('&'); +}; + +exports.parseUrl = function (input, options) { + options = Object.assign({ + decode: true + }, options); + + var _splitOnFirst3 = splitOnFirst(input, '#'), + _splitOnFirst4 = _slicedToArray(_splitOnFirst3, 2), + url = _splitOnFirst4[0], + hash = _splitOnFirst4[1]; + + return Object.assign({ + url: url.split('?')[0] || '', + query: parse(extract(input), options) + }, options && options.parseFragmentIdentifier && hash ? { + fragmentIdentifier: decode(hash, options) + } : {}); +}; + +exports.stringifyUrl = function (input, options) { + options = Object.assign({ + encode: true, + strict: true + }, options); + var url = removeHash(input.url).split('?')[0] || ''; + var queryFromUrl = exports.extract(input.url); + var parsedQueryFromUrl = exports.parse(queryFromUrl, { + sort: false + }); + var query = Object.assign(parsedQueryFromUrl, input.query); + var queryString = exports.stringify(query, options); + + if (queryString) { + queryString = "?".concat(queryString); + } + + var hash = getHash(input.url); + + if (input.fragmentIdentifier) { + hash = "#".concat(encode(input.fragmentIdentifier, options)); + } + + return "".concat(url).concat(queryString).concat(hash); +}; + +/***/ }), + +/***/ "./node_modules/scrypt-js/scrypt.js": +/*!******************************************!*\ + !*** ./node_modules/scrypt-js/scrypt.js ***! + \******************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +/* WEBPACK VAR INJECTION */(function(setImmediate) { + +(function (root) { + var MAX_VALUE = 0x7fffffff; // The SHA256 and PBKDF2 implementation are from scrypt-async-js: + // See: https://github.com/dchest/scrypt-async-js + + function SHA256(m) { + var K = new Uint32Array([0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]); + var h0 = 0x6a09e667, + h1 = 0xbb67ae85, + h2 = 0x3c6ef372, + h3 = 0xa54ff53a; + var h4 = 0x510e527f, + h5 = 0x9b05688c, + h6 = 0x1f83d9ab, + h7 = 0x5be0cd19; + var w = new Uint32Array(64); + + function blocks(p) { + var off = 0, + len = p.length; + + while (len >= 64) { + var a = h0, + b = h1, + c = h2, + d = h3, + e = h4, + f = h5, + g = h6, + h = h7, + u = void 0, + _i = void 0, + j = void 0, + t1 = void 0, + t2 = void 0; + + for (_i = 0; _i < 16; _i++) { + j = off + _i * 4; + w[_i] = (p[j] & 0xff) << 24 | (p[j + 1] & 0xff) << 16 | (p[j + 2] & 0xff) << 8 | p[j + 3] & 0xff; + } + + for (_i = 16; _i < 64; _i++) { + u = w[_i - 2]; + t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10; + u = w[_i - 15]; + t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3; + w[_i] = (t1 + w[_i - 7] | 0) + (t2 + w[_i - 16] | 0) | 0; + } + + for (_i = 0; _i < 64; _i++) { + t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[_i] + w[_i] | 0) | 0) | 0; + t2 = ((a >>> 2 | a << 32 - 2) ^ (a >>> 13 | a << 32 - 13) ^ (a >>> 22 | a << 32 - 22)) + (a & b ^ a & c ^ b & c) | 0; + h = g; + g = f; + f = e; + e = d + t1 | 0; + d = c; + c = b; + b = a; + a = t1 + t2 | 0; + } + + h0 = h0 + a | 0; + h1 = h1 + b | 0; + h2 = h2 + c | 0; + h3 = h3 + d | 0; + h4 = h4 + e | 0; + h5 = h5 + f | 0; + h6 = h6 + g | 0; + h7 = h7 + h | 0; + off += 64; + len -= 64; + } + } + + blocks(m); + var i, + bytesLeft = m.length % 64, + bitLenHi = m.length / 0x20000000 | 0, + bitLenLo = m.length << 3, + numZeros = bytesLeft < 56 ? 56 : 120, + p = m.slice(m.length - bytesLeft, m.length); + p.push(0x80); + + for (i = bytesLeft + 1; i < numZeros; i++) { + p.push(0); + } + + p.push(bitLenHi >>> 24 & 0xff); + p.push(bitLenHi >>> 16 & 0xff); + p.push(bitLenHi >>> 8 & 0xff); + p.push(bitLenHi >>> 0 & 0xff); + p.push(bitLenLo >>> 24 & 0xff); + p.push(bitLenLo >>> 16 & 0xff); + p.push(bitLenLo >>> 8 & 0xff); + p.push(bitLenLo >>> 0 & 0xff); + blocks(p); + return [h0 >>> 24 & 0xff, h0 >>> 16 & 0xff, h0 >>> 8 & 0xff, h0 >>> 0 & 0xff, h1 >>> 24 & 0xff, h1 >>> 16 & 0xff, h1 >>> 8 & 0xff, h1 >>> 0 & 0xff, h2 >>> 24 & 0xff, h2 >>> 16 & 0xff, h2 >>> 8 & 0xff, h2 >>> 0 & 0xff, h3 >>> 24 & 0xff, h3 >>> 16 & 0xff, h3 >>> 8 & 0xff, h3 >>> 0 & 0xff, h4 >>> 24 & 0xff, h4 >>> 16 & 0xff, h4 >>> 8 & 0xff, h4 >>> 0 & 0xff, h5 >>> 24 & 0xff, h5 >>> 16 & 0xff, h5 >>> 8 & 0xff, h5 >>> 0 & 0xff, h6 >>> 24 & 0xff, h6 >>> 16 & 0xff, h6 >>> 8 & 0xff, h6 >>> 0 & 0xff, h7 >>> 24 & 0xff, h7 >>> 16 & 0xff, h7 >>> 8 & 0xff, h7 >>> 0 & 0xff]; + } + + function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) { + // compress password if it's longer than hash block length + password = password.length <= 64 ? password : SHA256(password); + var innerLen = 64 + salt.length + 4; + var inner = new Array(innerLen); + var outerKey = new Array(64); + var i; + var dk = []; // inner = (password ^ ipad) || salt || counter + + for (i = 0; i < 64; i++) { + inner[i] = 0x36; + } + + for (i = 0; i < password.length; i++) { + inner[i] ^= password[i]; + } + + for (i = 0; i < salt.length; i++) { + inner[64 + i] = salt[i]; + } + + for (i = innerLen - 4; i < innerLen; i++) { + inner[i] = 0; + } // outerKey = password ^ opad + + + for (i = 0; i < 64; i++) { + outerKey[i] = 0x5c; + } + + for (i = 0; i < password.length; i++) { + outerKey[i] ^= password[i]; + } // increments counter inside inner + + + function incrementCounter() { + for (var _i2 = innerLen - 1; _i2 >= innerLen - 4; _i2--) { + inner[_i2]++; + if (inner[_i2] <= 0xff) return; + inner[_i2] = 0; + } + } // output blocks = SHA256(outerKey || SHA256(inner)) ... + + + while (dkLen >= 32) { + incrementCounter(); + dk = dk.concat(SHA256(outerKey.concat(SHA256(inner)))); + dkLen -= 32; + } + + if (dkLen > 0) { + incrementCounter(); + dk = dk.concat(SHA256(outerKey.concat(SHA256(inner))).slice(0, dkLen)); + } + + return dk; + } // The following is an adaptation of scryptsy + // See: https://www.npmjs.com/package/scryptsy + + + function blockmix_salsa8(BY, Yi, r, x, _X) { + var i; + arraycopy(BY, (2 * r - 1) * 16, _X, 0, 16); + + for (i = 0; i < 2 * r; i++) { + blockxor(BY, i * 16, _X, 16); + salsa20_8(_X, x); + arraycopy(_X, 0, BY, Yi + i * 16, 16); + } + + for (i = 0; i < r; i++) { + arraycopy(BY, Yi + i * 2 * 16, BY, i * 16, 16); + } + + for (i = 0; i < r; i++) { + arraycopy(BY, Yi + (i * 2 + 1) * 16, BY, (i + r) * 16, 16); + } + } + + function R(a, b) { + return a << b | a >>> 32 - b; + } + + function salsa20_8(B, x) { + arraycopy(B, 0, x, 0, 16); + + for (var i = 8; i > 0; i -= 2) { + x[4] ^= R(x[0] + x[12], 7); + x[8] ^= R(x[4] + x[0], 9); + x[12] ^= R(x[8] + x[4], 13); + x[0] ^= R(x[12] + x[8], 18); + x[9] ^= R(x[5] + x[1], 7); + x[13] ^= R(x[9] + x[5], 9); + x[1] ^= R(x[13] + x[9], 13); + x[5] ^= R(x[1] + x[13], 18); + x[14] ^= R(x[10] + x[6], 7); + x[2] ^= R(x[14] + x[10], 9); + x[6] ^= R(x[2] + x[14], 13); + x[10] ^= R(x[6] + x[2], 18); + x[3] ^= R(x[15] + x[11], 7); + x[7] ^= R(x[3] + x[15], 9); + x[11] ^= R(x[7] + x[3], 13); + x[15] ^= R(x[11] + x[7], 18); + x[1] ^= R(x[0] + x[3], 7); + x[2] ^= R(x[1] + x[0], 9); + x[3] ^= R(x[2] + x[1], 13); + x[0] ^= R(x[3] + x[2], 18); + x[6] ^= R(x[5] + x[4], 7); + x[7] ^= R(x[6] + x[5], 9); + x[4] ^= R(x[7] + x[6], 13); + x[5] ^= R(x[4] + x[7], 18); + x[11] ^= R(x[10] + x[9], 7); + x[8] ^= R(x[11] + x[10], 9); + x[9] ^= R(x[8] + x[11], 13); + x[10] ^= R(x[9] + x[8], 18); + x[12] ^= R(x[15] + x[14], 7); + x[13] ^= R(x[12] + x[15], 9); + x[14] ^= R(x[13] + x[12], 13); + x[15] ^= R(x[14] + x[13], 18); + } + + for (var _i3 = 0; _i3 < 16; ++_i3) { + B[_i3] += x[_i3]; + } + } // naive approach... going back to loop unrolling may yield additional performance + + + function blockxor(S, Si, D, len) { + for (var i = 0; i < len; i++) { + D[i] ^= S[Si + i]; + } + } + + function arraycopy(src, srcPos, dest, destPos, length) { + while (length--) { + dest[destPos++] = src[srcPos++]; + } + } + + function checkBufferish(o) { + if (!o || typeof o.length !== 'number') { + return false; + } + + for (var i = 0; i < o.length; i++) { + var v = o[i]; + + if (typeof v !== 'number' || v % 1 || v < 0 || v >= 256) { + return false; + } + } + + return true; + } + + function ensureInteger(value, name) { + if (typeof value !== "number" || value % 1) { + throw new Error('invalid ' + name); + } + + return value; + } // N = Cpu cost, r = Memory cost, p = parallelization cost + // callback(error, progress, key) + + + function _scrypt(password, salt, N, r, p, dkLen, callback) { + N = ensureInteger(N, 'N'); + r = ensureInteger(r, 'r'); + p = ensureInteger(p, 'p'); + dkLen = ensureInteger(dkLen, 'dkLen'); + + if (N === 0 || (N & N - 1) !== 0) { + throw new Error('N must be power of 2'); + } + + if (N > MAX_VALUE / 128 / r) { + throw new Error('N too large'); + } + + if (r > MAX_VALUE / 128 / p) { + throw new Error('r too large'); + } + + if (!checkBufferish(password)) { + throw new Error('password must be an array or buffer'); + } + + password = Array.prototype.slice.call(password); + + if (!checkBufferish(salt)) { + throw new Error('salt must be an array or buffer'); + } + + salt = Array.prototype.slice.call(salt); + var b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r); + var B = new Uint32Array(p * 32 * r); + + for (var i = 0; i < B.length; i++) { + var j = i * 4; + B[i] = (b[j + 3] & 0xff) << 24 | (b[j + 2] & 0xff) << 16 | (b[j + 1] & 0xff) << 8 | (b[j + 0] & 0xff) << 0; + } + + var XY = new Uint32Array(64 * r); + var V = new Uint32Array(32 * r * N); + var Yi = 32 * r; // scratch space + + var x = new Uint32Array(16); // salsa20_8 + + var _X = new Uint32Array(16); // blockmix_salsa8 + + + var totalOps = p * N * 2; + var currentOp = 0; + var lastPercent10 = null; // Set this to true to abandon the scrypt on the next step + + var stop = false; // State information + + var state = 0; + var i0 = 0, + i1; + var Bi; // How many blockmix_salsa8 can we do per step? + + var limit = callback ? parseInt(1000 / r) : 0xffffffff; // Trick from scrypt-async; if there is a setImmediate shim in place, use it + + var nextTick = typeof setImmediate !== 'undefined' ? setImmediate : setTimeout; // This is really all I changed; making scryptsy a state machine so we occasionally + // stop and give other evnts on the evnt loop a chance to run. ~RicMoo + + var incrementalSMix = function incrementalSMix() { + if (stop) { + return callback(new Error('cancelled'), currentOp / totalOps); + } + + var steps; + + switch (state) { + case 0: + // for (var i = 0; i < p; i++)... + Bi = i0 * 32 * r; + arraycopy(B, Bi, XY, 0, Yi); // ROMix - 1 + + state = 1; // Move to ROMix 2 + + i1 = 0; + // Fall through + + case 1: + // Run up to 1000 steps of the first inner smix loop + steps = N - i1; + + if (steps > limit) { + steps = limit; + } + + for (var _i4 = 0; _i4 < steps; _i4++) { + // ROMix - 2 + arraycopy(XY, 0, V, (i1 + _i4) * Yi, Yi); // ROMix - 3 + + blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 4 + } // for (var i = 0; i < N; i++) + + + i1 += steps; + currentOp += steps; + + if (callback) { + // Call the callback with the progress (optionally stopping us) + var percent10 = parseInt(1000 * currentOp / totalOps); + + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + + if (stop) { + break; + } + + lastPercent10 = percent10; + } + } + + if (i1 < N) { + break; + } + + i1 = 0; // Move to ROMix 6 + + state = 2; + // Fall through + + case 2: + // Run up to 1000 steps of the second inner smix loop + steps = N - i1; + + if (steps > limit) { + steps = limit; + } + + for (var _i5 = 0; _i5 < steps; _i5++) { + // ROMix - 6 + var offset = (2 * r - 1) * 16; // ROMix - 7 + + var _j = XY[offset] & N - 1; + + blockxor(V, _j * Yi, XY, Yi); // ROMix - 8 (inner) + + blockmix_salsa8(XY, Yi, r, x, _X); // ROMix - 9 (outer) + } // for (var i = 0; i < N; i++)... + + + i1 += steps; + currentOp += steps; // Call the callback with the progress (optionally stopping us) + + if (callback) { + var _percent = parseInt(1000 * currentOp / totalOps); + + if (_percent !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + + if (stop) { + break; + } + + lastPercent10 = _percent; + } + } + + if (i1 < N) { + break; + } + + arraycopy(XY, 0, B, Bi, Yi); // ROMix - 10 + // for (var i = 0; i < p; i++)... + + i0++; + + if (i0 < p) { + state = 0; + break; + } + + b = []; + + for (var _i6 = 0; _i6 < B.length; _i6++) { + b.push(B[_i6] >> 0 & 0xff); + b.push(B[_i6] >> 8 & 0xff); + b.push(B[_i6] >> 16 & 0xff); + b.push(B[_i6] >> 24 & 0xff); + } + + var derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen); // Send the result to the callback + + if (callback) { + callback(null, 1.0, derivedKey); + } // Done; don't break (which would reschedule) + + + return derivedKey; + } // Schedule the next steps + + + if (callback) { + nextTick(incrementalSMix); + } + }; // Run the smix state machine until completion + + + if (!callback) { + while (true) { + var derivedKey = incrementalSMix(); + + if (derivedKey != undefined) { + return derivedKey; + } + } + } // Bootstrap the async incremental smix + + + incrementalSMix(); + } + + var lib = { + scrypt: function scrypt(password, salt, N, r, p, dkLen, progressCallback) { + return new Promise(function (resolve, reject) { + var lastProgress = 0; + + if (progressCallback) { + progressCallback(0); + } + + _scrypt(password, salt, N, r, p, dkLen, function (error, progress, key) { + if (error) { + reject(error); + } else if (key) { + if (progressCallback && lastProgress !== 1) { + progressCallback(1); + } + + resolve(new Uint8Array(key)); + } else if (progressCallback && progress !== lastProgress) { + lastProgress = progress; + return progressCallback(progress); + } + }); + }); + }, + syncScrypt: function syncScrypt(password, salt, N, r, p, dkLen) { + return new Uint8Array(_scrypt(password, salt, N, r, p, dkLen)); + } + }; // node.js + + if (true) { + module.exports = lib; // RequireJS/AMD + // http://www.requirejs.org/docs/api.html + // https://github.com/amdjs/amdjs-api/wiki/AMD + } else {} +})(this); +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate)) + +/***/ }), + +/***/ "./node_modules/setimmediate/setImmediate.js": +/*!***************************************************!*\ + !*** ./node_modules/setimmediate/setImmediate.js ***! + \***************************************************/ +/*! no static exports found */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) { + "use strict"; + + if (global.setImmediate) { + return; + } + + var nextHandle = 1; // Spec says greater than zero + + var tasksByHandle = {}; + var currentlyRunningATask = false; + var doc = global.document; + var registerImmediate; + + function setImmediate(callback) { + // Callback can either be a function or a string + if (typeof callback !== "function") { + callback = new Function("" + callback); + } // Copy function arguments + + + var args = new Array(arguments.length - 1); + + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i + 1]; + } // Store and register the task + + + var task = { + callback: callback, + args: args + }; + tasksByHandle[nextHandle] = task; + registerImmediate(nextHandle); + return nextHandle++; + } + + function clearImmediate(handle) { + delete tasksByHandle[handle]; + } + + function run(task) { + var callback = task.callback; + var args = task.args; + + switch (args.length) { + case 0: + callback(); + break; + + case 1: + callback(args[0]); + break; + + case 2: + callback(args[0], args[1]); + break; + + case 3: + callback(args[0], args[1], args[2]); + break; + + default: + callback.apply(undefined, args); + break; + } + } + + function runIfPresent(handle) { + // From the spec: "Wait until any invocations of this algorithm started before this one have completed." + // So if we're currently running a task, we'll need to delay this invocation. + if (currentlyRunningATask) { + // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a + // "too much recursion" error. + setTimeout(runIfPresent, 0, handle); + } else { + var task = tasksByHandle[handle]; + + if (task) { + currentlyRunningATask = true; + + try { + run(task); + } finally { + clearImmediate(handle); + currentlyRunningATask = false; + } + } + } + } + + function installNextTickImplementation() { + registerImmediate = function registerImmediate(handle) { + process.nextTick(function () { + runIfPresent(handle); + }); + }; + } + + function canUsePostMessage() { + // The test against `importScripts` prevents this implementation from being installed inside a web worker, + // where `global.postMessage` means something completely different and can't be used for this purpose. + if (global.postMessage && !global.importScripts) { + var postMessageIsAsynchronous = true; + var oldOnMessage = global.onmessage; + + global.onmessage = function () { + postMessageIsAsynchronous = false; + }; + + global.postMessage("", "*"); + global.onmessage = oldOnMessage; + return postMessageIsAsynchronous; + } + } + + function installPostMessageImplementation() { + // Installs an event handler on `global` for the `message` event: see + // * https://developer.mozilla.org/en/DOM/window.postMessage + // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages + var messagePrefix = "setImmediate$" + Math.random() + "$"; + + var onGlobalMessage = function onGlobalMessage(event) { + if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) { + runIfPresent(+event.data.slice(messagePrefix.length)); + } + }; + + if (global.addEventListener) { + global.addEventListener("message", onGlobalMessage, false); + } else { + global.attachEvent("onmessage", onGlobalMessage); + } + + registerImmediate = function registerImmediate(handle) { + global.postMessage(messagePrefix + handle, "*"); + }; + } + + function installMessageChannelImplementation() { + var channel = new MessageChannel(); + + channel.port1.onmessage = function (event) { + var handle = event.data; + runIfPresent(handle); + }; + + registerImmediate = function registerImmediate(handle) { + channel.port2.postMessage(handle); + }; + } + + function installReadyStateChangeImplementation() { + var html = doc.documentElement; + + registerImmediate = function registerImmediate(handle) { + // Create a