diff --git a/.env b/.env index 8ee727902..297a17cdc 100644 --- a/.env +++ b/.env @@ -1,7 +1 @@ -FOUNDRY_FUZZ_SEED=0x4444 - -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - export FOUNDRY_SOLC="./bin/solc-static-linux" -elif [[ "$OSTYPE" == "darwin"* ]]; then - export FOUNDRY_SOLC="./bin/solc-mac" -fi +FOUNDRY_FUZZ_SEED=0x4444 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index bf763d508..7979d0ad0 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -4,31 +4,28 @@ title: "[Bug]: " labels: ["bug"] body: - - type: markdown - attributes: - value: | - Please check that the bug is not already being tracked. - - type: textarea - attributes: - label: Describe the bug - description: Provide a clear and concise description of what the bug is and which contracts it affects. - validations: - required: true - - type: textarea - attributes: - label: Expected Behavior - description: Provide a clear and concise description of the desired fix. - validations: - required: true - - type: textarea - attributes: - label: To Reproduce - description: If you have written tests to showcase the bug, what can we run to reproduce the issue? - placeholder: "git checkout / forge test --isolate --mt " - - type: textarea - attributes: - label: Additional context - description: If there is any additional context needed like a dependency or integrating contract that is affected please describe it below. - - - + - type: markdown + attributes: + value: | + Please check that the bug is not already being tracked. + - type: textarea + attributes: + label: Describe the bug + description: Provide a clear and concise description of what the bug is and which contracts it affects. + validations: + required: true + - type: textarea + attributes: + label: Expected Behavior + description: Provide a clear and concise description of the desired fix. + validations: + required: true + - type: textarea + attributes: + label: To Reproduce + description: If you have written tests to showcase the bug, what can we run to reproduce the issue? + placeholder: "git checkout / forge test --isolate --mt " + - type: textarea + attributes: + label: Additional context + description: If there is any additional context needed like a dependency or integrating contract that is affected please describe it below. diff --git a/.github/ISSUE_TEMPLATE/FEATURE_IMPROVEMENT.yml b/.github/ISSUE_TEMPLATE/FEATURE_IMPROVEMENT.yml index 4622f708b..57e7caf04 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_IMPROVEMENT.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_IMPROVEMENT.yml @@ -3,40 +3,40 @@ description: Suggest an improvement to v4-core. labels: ["triage"] body: - - type: markdown - attributes: - value: | - Please ensure that the feature has not already been requested. - - type: dropdown - attributes: - label: Component - description: Which area of code does your idea improve? - multiple: true - options: - - Hooks - - Singleton - - Lock and Call - - Delta accounting - - 1155 Balances - - Pool Actions (swap, modifyLiquidity, donate, take, settle, mint) - - Gas Optimization - - General design optimization (improving efficiency, cleanliness, or developer experience) - - Documentation - - type: textarea - attributes: - label: Describe the suggested feature and problem it solves. - description: Provide a clear and concise description of what feature you would like to see, and what problems it solves. - validations: - required: true - - type: textarea - attributes: - label: Describe the desired implementation. - description: If possible, provide a suggested architecture change or implementation. - - type: textarea - attributes: - label: Describe alternatives. - description: If possible, describe the alternatives you've considered, or describe the current functionality and how it may be sub-optimal. - - type: textarea - attributes: - label: Additional context. - description: Please list any additional dependencies or integrating contacts that are affected. + - type: markdown + attributes: + value: | + Please ensure that the feature has not already been requested. + - type: dropdown + attributes: + label: Component + description: Which area of code does your idea improve? + multiple: true + options: + - Hooks + - Singleton + - Lock and Call + - Delta accounting + - 1155 Balances + - Pool Actions (swap, modifyLiquidity, donate, take, settle, mint) + - Gas Optimization + - General design optimization (improving efficiency, cleanliness, or developer experience) + - Documentation + - type: textarea + attributes: + label: Describe the suggested feature and problem it solves. + description: Provide a clear and concise description of what feature you would like to see, and what problems it solves. + validations: + required: true + - type: textarea + attributes: + label: Describe the desired implementation. + description: If possible, provide a suggested architecture change or implementation. + - type: textarea + attributes: + label: Describe alternatives. + description: If possible, describe the alternatives you've considered, or describe the current functionality and how it may be sub-optimal. + - type: textarea + attributes: + label: Additional context. + description: Please list any additional dependencies or integrating contacts that are affected. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index d77b54100..72a324885 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,4 +1,5 @@ ## Related Issue + Which issue does this pull request resolve? -## Description of changes \ No newline at end of file +## Description of changes diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index e5b7fb2e7..9dba40709 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,9 +1,9 @@ name: code coverage -on: +on: pull_request: branches: - - main + - main jobs: comment-forge-coverage: @@ -13,77 +13,77 @@ jobs: pull-requests: write steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout code + uses: actions/checkout@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} - - name: Install foundry - uses: foundry-rs/foundry-toolchain@v1 - with: + - name: Install foundry + uses: foundry-rs/foundry-toolchain@v1 + with: version: nightly - - name: Run Forge build - run: | + - name: Run Forge build + run: | forge --version forge build --sizes - id: build - - name: Run forge coverage - id: coverage - run: | - { - echo 'COVERAGE<> "$GITHUB_OUTPUT" - env: - FOUNDRY_RPC_URL: '${{ secrets.RPC_URL }}' - - - name: Check coverage is updated - uses: actions/github-script@v5 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const fs = require('fs'); - const file = "coverage.txt" - if(!fs.existsSync(file)) { - console.log("Nothing to check"); - return - } - const currentCoverage = fs.readFileSync(file, "utf8").trim(); - const newCoverage = (`${{ steps.coverage.outputs.COVERAGE }}`).trim(); - if (newCoverage != currentCoverage) { - core.setFailed(`Code coverage not updated. Run : forge coverage | grep '^|' | grep -v 'test/' > coverage.txt`); - } + id: build + - name: Run forge coverage + id: coverage + run: | + { + echo 'COVERAGE<> "$GITHUB_OUTPUT" + env: + FOUNDRY_RPC_URL: "${{ secrets.RPC_URL }}" - - name: Comment on PR - id: comment - uses: actions/github-script@v5 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const {data: comments} = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - }) + - name: Check coverage is updated + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const file = "coverage.txt" + if(!fs.existsSync(file)) { + console.log("Nothing to check"); + return + } + const currentCoverage = fs.readFileSync(file, "utf8").trim(); + const newCoverage = (`${{ steps.coverage.outputs.COVERAGE }}`).trim(); + if (newCoverage != currentCoverage) { + core.setFailed(`Code coverage not updated. Run : forge coverage | grep '^|' | grep -v 'test/' > coverage.txt`); + } - const botComment = comments.find(comment => comment.user.id === 41898282) + - name: Comment on PR + id: comment + uses: actions/github-script@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const {data: comments} = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + }) - const output = `${{ steps.coverage.outputs.COVERAGE }}`; - const commentBody = `Forge code coverage:\n${output}\n`; + const botComment = comments.find(comment => comment.user.id === 41898282) - if (botComment) { - github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: botComment.id, - body: commentBody - }) - } else { - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: commentBody - }); - } \ No newline at end of file + const output = `${{ steps.coverage.outputs.COVERAGE }}`; + const commentBody = `Forge code coverage:\n${output}\n`; + + if (botComment) { + github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: botComment.id, + body: commentBody + }) + } else { + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: commentBody + }); + } diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3220b0237..049508100 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -22,3 +22,15 @@ jobs: - name: Lint run: forge fmt --check + + - uses: actions/cache@v2 + name: Configure npm caching + with: + path: ~/.npm + key: ${{ runner.os }}-npm-${{ hashFiles('**/workflows/prettier.yml') }} + restore-keys: | + ${{ runner.os }}-npm- + + - name: Check code formatting + run: |- + npx prettier --check . diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index c773069bd..b66798fed 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -7,7 +7,7 @@ on: - main schedule: # random HH:MM to avoid a load spike on GitHub Actions at 00:00 - - cron: '35 11 * * *' + - cron: "35 11 * * *" jobs: semgrep: name: semgrep/ci diff --git a/.github/workflows/tests-merge.yml b/.github/workflows/tests-merge.yml index 7ef603ea8..13da03c2b 100644 --- a/.github/workflows/tests-merge.yml +++ b/.github/workflows/tests-merge.yml @@ -15,15 +15,6 @@ jobs: with: submodules: recursive - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache-dependency-path: './test/js-scripts' - cache: 'yarn' - - - run: yarn - working-directory: ./test/js-scripts - - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: @@ -39,4 +30,3 @@ jobs: env: FOUNDRY_PROFILE: ci FORGE_SNAPSHOT_CHECK: true - diff --git a/.github/workflows/tests-pr.yml b/.github/workflows/tests-pr.yml index 5eb80cec9..9399261d3 100644 --- a/.github/workflows/tests-pr.yml +++ b/.github/workflows/tests-pr.yml @@ -16,15 +16,6 @@ jobs: with: submodules: recursive - - uses: actions/setup-node@v3 - with: - node-version: 16 - cache-dependency-path: './test/js-scripts' - cache: 'yarn' - - - run: yarn - working-directory: ./test/js-scripts - - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: @@ -40,4 +31,3 @@ jobs: env: FOUNDRY_PROFILE: pr FORGE_SNAPSHOT_CHECK: true - diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..ae7db4672 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +.prettierrc +foundry.toml +out +lib/ +cache/ +*.sol +dist/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..3106c9be6 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,27 @@ +{ + "printWidth": 120, + "tabWidth": 2, + "useTabs": false, + "singleQuote": false, + "bracketSpacing": true, + "trailingComma": "all", + "embeddedLanguageFormatting": "off", + "overrides": [ + { + "files": "*.sol", + "options": { + "printWidth": 120, + "tabWidth": 4, + "useTabs": false, + "singleQuote": false, + "bracketSpacing": false + } + }, + { + "files": "*.json", + "options": { + "tabWidth": 2 + } + } + ] +} diff --git a/echidna.config.yml b/echidna.config.yml index 64a761dec..2ad6fe27b 100644 --- a/echidna.config.yml +++ b/echidna.config.yml @@ -1,5 +1,5 @@ #format can be "text" or "json" for different output (human or machine readable) -format: 'text' +format: "text" #checkAsserts checks assertions checkAsserts: true #coverage controls coverage guided testing diff --git a/justfile b/justfile index 8399face8..ef3b95e4d 100644 --- a/justfile +++ b/justfile @@ -5,11 +5,11 @@ prep *args: fix (test-forge args) test-forge *args: build-forge - forge test --isolate --no-match-path 'test/js-scripts/**/*' {{args}} + forge test --isolate {{args}} build-forge *args: install-forge - forge build --skip 'test/js-scripts/**/*' {{args}} + forge build {{args}} install-forge: forge install diff --git a/test/ModifyLiquidity.t.sol b/test/ModifyLiquidity.t.sol index 2b55bf135..5cf4687b5 100644 --- a/test/ModifyLiquidity.t.sol +++ b/test/ModifyLiquidity.t.sol @@ -14,8 +14,14 @@ import {Constants} from "./utils/Constants.sol"; import {Currency} from "src/types/Currency.sol"; import {MockERC20} from "solmate/test/utils/mocks/MockERC20.sol"; import {StateLibrary} from "src/libraries/StateLibrary.sol"; - -contract ModifyLiquidityTest is Test, Deployers, GasSnapshot { +import {JavascriptFfi} from "./utils/JavascriptFfi.sol"; +import {BalanceDelta} from "../src/types/BalanceDelta.sol"; +import {Fuzzers} from "../src/test/Fuzzers.sol"; +import {TickMath} from "src/libraries/TickMath.sol"; +import {toBalanceDelta} from "src/types/BalanceDelta.sol"; +import {Logger} from "./utils/Logger.sol"; + +contract ModifyLiquidityTest is Test, Logger, Deployers, JavascriptFfi, Fuzzers, GasSnapshot { using StateLibrary for IPoolManager; PoolKey simpleKey; // vanilla pool key @@ -23,6 +29,8 @@ contract ModifyLiquidityTest is Test, Deployers, GasSnapshot { bytes32 SALT = hex"CAFF"; + int128 constant ONE_PIP = 1e6; + IPoolManager.ModifyLiquidityParams public LIQ_PARAM_NO_SALT = IPoolManager.ModifyLiquidityParams({tickLower: -120, tickUpper: 120, liquidityDelta: 1e18, salt: 0}); @@ -35,6 +43,126 @@ contract ModifyLiquidityTest is Test, Deployers, GasSnapshot { (simpleKey, simplePoolId) = initPool(currency0, currency1, IHooks(address(0)), 3000, SQRT_PRICE_1_1, ZERO_BYTES); } + /*////////////////////////////////////////////////////////////// + Fuzz Add Liquidity + //////////////////////////////////////////////////////////////*/ + + /// forge-config: default.fuzz.runs = 10 + /// forge-config: pr.fuzz.runs = 10 + /// forge-config: ci.fuzz.runs = 500 + function test_ffi_fuzz_addLiquidity_defaultPool_ReturnsCorrectLiquidityDelta( + IPoolManager.ModifyLiquidityParams memory paramSeed + ) public { + // Sanitize the fuzzed params to get valid tickLower, tickUpper, and liquidityDelta. + // We use SQRT_PRICE_1_1 because the simpleKey pool has initial sqrtPrice of SQRT_PRICE_1_1. + IPoolManager.ModifyLiquidityParams memory params = + createFuzzyLiquidityParams(simpleKey, paramSeed, SQRT_PRICE_1_1); + + logParams(params); + + (BalanceDelta delta) = modifyLiquidityRouter.modifyLiquidity(simpleKey, params, ZERO_BYTES); + + (int128 jsDelta0, int128 jsDelta1) = _modifyLiquidityJS(simplePoolId, params); + + _checkError(delta.amount0(), jsDelta0, "amount0 is off by more than one pip"); + _checkError(delta.amount1(), jsDelta1, "amount1 is off by more than one pip"); + } + + // Static edge case, no fuzz test, to make sure we test max tickspacing. + function test_ffi_addLiqudity_weirdPool_0_returnsCorrectLiquidityDelta() public { + // Use a pool with TickSpacing of MAX_TICK_SPACING + (PoolKey memory wp0, PoolId wpId0) = initPool( + currency0, currency1, IHooks(address(0)), 500, TickMath.MAX_TICK_SPACING, SQRT_PRICE_1_1, ZERO_BYTES + ); + + // Set the params to add random amount of liquidity to random tick boundary. + int24 tickUpper = TickMath.MAX_TICK_SPACING * 4; + int24 tickLower = TickMath.MAX_TICK_SPACING * -9; + IPoolManager.ModifyLiquidityParams memory params = IPoolManager.ModifyLiquidityParams({ + tickLower: tickLower, + tickUpper: tickUpper, + liquidityDelta: 16787899214600939458, + salt: 0 + }); + + (BalanceDelta delta) = modifyLiquidityRouter.modifyLiquidity(wp0, params, ZERO_BYTES); + + (int128 jsDelta0, int128 jsDelta1) = _modifyLiquidityJS(wpId0, params); + + _checkError(delta.amount0(), jsDelta0, "amount0 is off by more than one pip"); + _checkError(delta.amount1(), jsDelta1, "amount1 is off by more than one pip"); + } + + // Static edge case, no fuzz test, to make sure we test min tick spacing. + function test_ffi_addLiqudity_weirdPool_1_returnsCorrectLiquidityDelta() public { + // Use a pool with TickSpacing of MIN_TICK_SPACING + (PoolKey memory wp0, PoolId wpId0) = initPool( + currency0, currency1, IHooks(address(0)), 551, TickMath.MIN_TICK_SPACING, SQRT_PRICE_1_1, ZERO_BYTES + ); + + // Set the params to add random amount of liquidity to random tick boundary. + int24 tickUpper = TickMath.MIN_TICK_SPACING * 17; + int24 tickLower = TickMath.MIN_TICK_SPACING * 9; + IPoolManager.ModifyLiquidityParams memory params = IPoolManager.ModifyLiquidityParams({ + tickLower: tickLower, + tickUpper: tickUpper, + liquidityDelta: 922871614499955267459963, + salt: 0 + }); + + params.tickLower = 10; + + (BalanceDelta delta) = modifyLiquidityRouter.modifyLiquidity(wp0, params, ZERO_BYTES); + + (int128 jsDelta0, int128 jsDelta1) = _modifyLiquidityJS(wpId0, params); + + _checkError(delta.amount0(), jsDelta0, "amount0 is off by more than one pip"); + _checkError(delta.amount1(), jsDelta1, "amount1 is off by more than one pip"); + } + + function _modifyLiquidityJS(PoolId poolId, IPoolManager.ModifyLiquidityParams memory params) + public + returns (int128, int128) + { + (uint256 price, int24 tick,,) = manager.getSlot0(poolId); + + string memory jsParameters = string( + abi.encodePacked( + vm.toString(params.tickLower), + ",", + vm.toString(params.tickUpper), + ",", + vm.toString(params.liquidityDelta), + ",", + vm.toString(tick), + ",", + vm.toString(price) + ) + ); + + string memory scriptName = "forge-test-getModifyLiquidityResult"; + bytes memory jsResult = runScript(scriptName, jsParameters); + + int128[] memory result = abi.decode(jsResult, (int128[])); + int128 jsDelta0 = result[0]; + int128 jsDelta1 = result[1]; + return (jsDelta0, jsDelta1); + } + + // assert solc/js result is at most off by 1/100th of a bip (aka one pip) + function _checkError(int128 solc, int128 js, string memory errMsg) public pure returns (int128) { + if (solc != js) { + // Ensures no div by 0 in the case of one-sided liquidity adds. + (int128 gtResult, int128 ltResult) = js > solc ? (js, solc) : (solc, js); + int128 resultsDiff = gtResult - ltResult; + assertEq(resultsDiff * ONE_PIP / js, 0, errMsg); + } + } + + /*////////////////////////////////////////////////////////////// + Salt + //////////////////////////////////////////////////////////////*/ + function test_modifyLiquidity_samePosition_zeroSalt_isUpdated() public { Position.Info memory position = manager.getPosition( simplePoolId, address(modifyLiquidityRouter), LIQ_PARAM_NO_SALT.tickLower, LIQ_PARAM_NO_SALT.tickUpper, 0 diff --git a/test/js-scripts/.yarnrc b/test/js-scripts/.yarnrc deleted file mode 100644 index 5455c6c5d..000000000 --- a/test/js-scripts/.yarnrc +++ /dev/null @@ -1 +0,0 @@ -ignore-scripts true diff --git a/test/js-scripts/build.js b/test/js-scripts/build.js new file mode 100644 index 000000000..630a1de43 --- /dev/null +++ b/test/js-scripts/build.js @@ -0,0 +1,17 @@ +const { build } = require("esbuild"); + +const entryPoints = ["getModifyLiquidityResult", "getSqrtPriceAtTick", "getTickAtSqrtPrice"]; + +const sharedConfig = { + bundle: true, + minify: false, +}; + +for (const entryPoint of entryPoints) { + build({ + entryPoints: [`src/${entryPoint}.ts`], + ...sharedConfig, + platform: "node", + outfile: `dist/${entryPoint}.js`, + }); +} diff --git a/test/js-scripts/dist/getModifyLiquidityResult.js b/test/js-scripts/dist/getModifyLiquidityResult.js new file mode 100644 index 000000000..05d12ebfe --- /dev/null +++ b/test/js-scripts/dist/getModifyLiquidityResult.js @@ -0,0 +1,45222 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); + +// node_modules/bn.js/lib/bn.js +var require_bn = __commonJS({ + "node_modules/bn.js/lib/bn.js"(exports2, module2) { + (function(module3, exports3) { + "use strict"; + function assert(val, msg) { + if (!val) throw new Error(msg || "Assertion failed"); + } + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + function BN(number, base, endian) { + if (BN.isBN(number)) { + return number; + } + this.negative = 0; + this.words = null; + this.length = 0; + 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 module3 === "object") { + module3.exports = BN; + } else { + exports3.BN = BN; + } + BN.BN = BN; + BN.wordSize = 26; + var Buffer2; + try { + if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") { + Buffer2 = window.Buffer; + } else { + Buffer2 = require("buffer").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 < 67108864) { + this.words = [number & 67108863]; + this.length = 1; + } else if (number < 4503599627370496) { + this.words = [ + number & 67108863, + number / 67108864 & 67108863 + ]; + this.length = 2; + } else { + assert(number < 9007199254740992); + this.words = [ + number & 67108863, + number / 67108864 & 67108863, + 1 + ]; + this.length = 3; + } + if (endian !== "le") return; + this._initArray(this.toArray(), base, endian); + }; + BN.prototype._initArray = function _initArray(number, base, endian) { + 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 & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + 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 & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + function parseHex4Bits(string, index) { + var c = string.charCodeAt(index); + if (c >= 65 && c <= 70) { + return c - 55; + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + return c - 48 & 15; + } + } + 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) { + 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 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 & 67108863; + 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 & 67108863; + 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; + if (c >= 49) { + r += c - 49 + 10; + } else if (c >= 17) { + r += c - 17 + 10; + } else { + r += c; + } + } + return r; + } + BN.prototype._parseBase = function _parseBase(number, base, start) { + this.words = [0]; + this.length = 1; + for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; 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 < 67108864) { + 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 < 67108864) { + 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; + }; + 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() { + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + BN.prototype.inspect = function inspect() { + return (this.red ? ""; + }; + 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, + 1e7, + 19487171, + 35831808, + 62748517, + 7529536, + 11390625, + 16777216, + 24137569, + 34012224, + 47045881, + 64e6, + 4084101, + 5153632, + 6436343, + 7962624, + 9765625, + 11881376, + 14348907, + 17210368, + 20511149, + 243e5, + 28629151, + 33554432, + 39135393, + 45435424, + 52521875, + 60466176 + ]; + 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) & 16777215).toString(16); + carry = w >>> 24 - off & 16777215; + 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 = groupSizes[base]; + 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] * 67108864; + } else if (this.length === 3 && this.words[2] === 1) { + ret += 4503599627370496 + this.words[1] * 67108864; + } 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 Buffer2 !== "undefined"); + return this.toArrayLike(Buffer2, 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) { + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + for (i = 0; !q.isZero(); i++) { + b = q.andln(255); + q.iushrn(8); + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(255); + 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 >= 4096) { + r += 13; + t >>>= 13; + } + if (t >= 64) { + r += 7; + t >>>= 7; + } + if (t >= 8) { + r += 4; + t >>>= 4; + } + if (t >= 2) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + BN.prototype._zeroBits = function _zeroBits(w) { + if (w === 0) return 26; + var t = w; + var r = 0; + if ((t & 8191) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 127) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 15) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 1) === 0) { + r++; + } + return r; + }; + 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; + } + 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; + }; + BN.prototype.neg = function neg() { + return this.clone().ineg(); + }; + BN.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + return this; + }; + 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); + }; + 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); + }; + BN.prototype.iuand = function iuand(num) { + 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); + }; + 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); + }; + BN.prototype.iuxor = function iuxor(num) { + 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); + }; + 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); + }; + BN.prototype.inotn = function inotn(width) { + assert(typeof width === "number" && width >= 0); + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + this._expand(bytesNeeded); + if (bitsLeft > 0) { + bytesNeeded--; + } + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 67108863; + } + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft; + } + return this.strip(); + }; + BN.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; + 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(); + }; + BN.prototype.iadd = function iadd(num) { + var r; + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + 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 & 67108863; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 67108863; + carry = r >>> 26; + } + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + return 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); + }; + BN.prototype.isub = function isub(num) { + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + var cmp = this.cmp(num); + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + 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 & 67108863; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 67108863; + } + 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(); + }; + BN.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + function smallMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + var len = self2.length + num.length | 0; + out.length = len; + len = len - 1 | 0; + var a = self2.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + var lo = r & 67108863; + var carry = r / 67108864 | 0; + out.words[0] = lo; + for (var k = 1; k < len; k++) { + var ncarry = carry >>> 26; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i = k - j | 0; + a = self2.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += r / 67108864 | 0; + rword = r & 67108863; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + return out.strip(); + } + var comb10MulTo = function comb10MulTo2(self2, num, out) { + var a = self2.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 & 8191; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 8191; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 8191; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 8191; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 8191; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 8191; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 8191; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 8191; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 8191; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 8191; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 8191; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 8191; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 8191; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 8191; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 8191; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 8191; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 8191; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 8191; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 8191; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 8191; + var bh9 = b9 >>> 13; + out.negative = self2.negative ^ num.negative; + out.length = 19; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 67108863; + 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; + }; + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + function bigMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + out.length = self2.length + num.length; + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self2.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + var lo = r & 67108863; + ncarry = ncarry + (r / 67108864 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 67108863; + ncarry = ncarry + (lo >>> 26) | 0; + hncarry += ncarry >>> 26; + ncarry &= 67108863; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + return out.strip(); + } + function jumboMulTo(self2, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self2, 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; + }; + 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; + }; + 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; + }; + 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; + 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) * 8192 + Math.round(ws[2 * i] / N) + carry; + ws[i] = w & 67108863; + if (w < 67108864) { + carry = 0; + } else { + carry = w / 67108864 | 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 & 8191; + carry = carry >>> 13; + rws[2 * i + 1] = carry & 8191; + carry = carry >>> 13; + } + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + assert(carry === 0); + assert((carry & ~8191) === 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(); + }; + BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + BN.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + BN.prototype.imuln = function imuln(num) { + assert(typeof num === "number"); + assert(num < 67108864); + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 67108863) + (carry & 67108863); + carry >>= 26; + carry += w / 67108864 | 0; + carry += lo >>> 26; + this.words[i] = lo & 67108863; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + BN.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; + BN.prototype.sqr = function sqr() { + return this.mul(this); + }; + BN.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; + BN.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + 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; + }; + BN.prototype.iushln = function iushln(bits) { + assert(typeof bits === "number" && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = 67108863 >>> 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) { + assert(this.negative === 0); + return this.iushln(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 = 67108863 ^ 67108863 >>> r << r; + var maskedWords = extended; + h -= s; + h = Math.max(0, h); + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + if (s === 0) { + } 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; + } + 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) { + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + BN.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; + BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + BN.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; + 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; + if (this.length <= s) return false; + var w = this.words[s]; + return !!(w & q); + }; + 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 = 67108863 ^ 67108863 >>> r << r; + this.words[this.length - 1] &= mask; + } + return this.strip(); + }; + BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; + BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === "number"); + assert(num < 67108864); + if (num < 0) return this.isubn(-num); + 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; + } + return this._iaddn(num); + }; + BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) { + this.words[i] -= 67108864; + 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; + }; + BN.prototype.isubn = function isubn(num) { + assert(typeof num === "number"); + assert(num < 67108864); + 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 { + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 67108864; + 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 & 67108863; + carry = (w >> 26) - (right / 67108864 | 0); + this.words[i + shift] = w & 67108863; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 67108863; + } + if (carry === 0) return this.strip(); + 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 & 67108863; + } + 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; + 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; + } + 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) * 67108864 + (a.words[b.length + j - 1] | 0); + qj = Math.min(qj / bhi | 0, 67108863); + 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(); + if (mode !== "div" && shift !== 0) { + a.iushrn(shift); + } + return { + div: q || null, + mod: a + }; + }; + 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, + mod + }; + } + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + if (mode !== "mod") { + div = res.div.neg(); + } + return { + 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 + }; + } + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + 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); + }; + BN.prototype.div = function div(num) { + return this.divmod(num, "div", false).div; + }; + 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; + }; + BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + 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); + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + BN.prototype.modn = function modn(num) { + assert(num <= 67108863); + 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; + }; + BN.prototype.idivn = function idivn(num) { + assert(num <= 67108863); + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 67108864; + 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(); + } + var A = new BN(1); + var B = new BN(0); + 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) + }; + }; + 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; + 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) { + 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); + }; + 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; + }; + BN.prototype.andln = function andln(num) { + return this.words[0] & num; + }; + BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === "number"); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + 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 &= 67108863; + 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 <= 67108863, "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; + }; + 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; + }; + BN.prototype.ucmp = function ucmp(num) { + 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; + }; + 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); + }; + 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); + }; + 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); + }; + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + function MPrime(name2, p) { + this.name = name2; + 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) { + 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 !== void 0) { + r.strip(); + } 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) { + var mask = 4194303; + 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; + } + 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) { + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 977; + num.words[i] = lo & 67108863; + lo = w * 64 + (lo / 67108864 | 0); + } + 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() { + MPrime.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + inherits(P25519, MPrime); + P25519.prototype.imulK = function imulK(num) { + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 19 + carry; + var lo = hi & 67108863; + hi >>>= 26; + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + BN._prime = function prime(name2) { + if (primes[name2]) return primes[name2]; + var prime2; + if (name2 === "k256") { + prime2 = new K256(); + } else if (name2 === "p224") { + prime2 = new P224(); + } else if (name2 === "p192") { + prime2 = new P192(); + } else if (name2 === "p25519") { + prime2 = new P25519(); + } else { + throw new Error("Unknown prime " + name2); + } + primes[name2] = prime2; + return prime2; + }; + 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); + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + 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(); + 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; + }; + 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) { + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; + })(typeof module2 === "undefined" || module2, exports2); + } +}); + +// node_modules/@ethersproject/logger/lib/_version.js +var require_version = __commonJS({ + "node_modules/@ethersproject/logger/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "logger/5.5.0"; + } +}); + +// node_modules/@ethersproject/logger/lib/index.js +var require_lib = __commonJS({ + "node_modules/@ethersproject/logger/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Logger = exports2.ErrorCode = exports2.LogLevel = void 0; + 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 _version_1 = require_version(); + var _globalLogger = null; + function _checkNormalize() { + try { + var missing_1 = []; + ["NFD", "NFC", "NFKD", "NFKC"].forEach(function(form) { + try { + if ("test".normalize(form) !== "test") { + throw new Error("bad normalize"); + } + ; + } catch (error) { + missing_1.push(form); + } + }); + if (missing_1.length) { + throw new Error("missing " + missing_1.join(", ")); + } + if (String.fromCharCode(233).normalize("NFD") !== String.fromCharCode(101, 769)) { + throw new Error("broken implementation"); + } + } catch (error) { + return error.message; + } + return null; + } + var _normalizeError = _checkNormalize(); + var LogLevel; + (function(LogLevel2) { + LogLevel2["DEBUG"] = "DEBUG"; + LogLevel2["INFO"] = "INFO"; + LogLevel2["WARNING"] = "WARNING"; + LogLevel2["ERROR"] = "ERROR"; + LogLevel2["OFF"] = "OFF"; + })(LogLevel = exports2.LogLevel || (exports2.LogLevel = {})); + var ErrorCode; + (function(ErrorCode2) { + ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; + ErrorCode2["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; + ErrorCode2["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; + ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR"; + ErrorCode2["SERVER_ERROR"] = "SERVER_ERROR"; + ErrorCode2["TIMEOUT"] = "TIMEOUT"; + ErrorCode2["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; + ErrorCode2["NUMERIC_FAULT"] = "NUMERIC_FAULT"; + ErrorCode2["MISSING_NEW"] = "MISSING_NEW"; + ErrorCode2["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; + ErrorCode2["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; + ErrorCode2["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; + ErrorCode2["CALL_EXCEPTION"] = "CALL_EXCEPTION"; + ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; + ErrorCode2["NONCE_EXPIRED"] = "NONCE_EXPIRED"; + ErrorCode2["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; + ErrorCode2["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; + ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; + })(ErrorCode = exports2.ErrorCode || (exports2.ErrorCode = {})); + var HEX = "0123456789abcdef"; + var Logger = ( + /** @class */ + function() { + function Logger2(version) { + Object.defineProperty(this, "version", { + enumerable: true, + value: version, + writable: false + }); + } + Logger2.prototype._log = function(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); + }; + Logger2.prototype.debug = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.DEBUG, args); + }; + Logger2.prototype.info = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.INFO, args); + }; + Logger2.prototype.warn = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.WARNING, args); + }; + Logger2.prototype.makeError = function(message, code, params2) { + if (_censorErrors) { + return this.makeError("censored error", code, {}); + } + if (!code) { + code = Logger2.errors.UNKNOWN_ERROR; + } + if (!params2) { + params2 = {}; + } + var messageDetails = []; + Object.keys(params2).forEach(function(key) { + var value = params2[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] & 15]; + } + messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); + } else { + messageDetails.push(key + "=" + JSON.stringify(value)); + } + } catch (error2) { + messageDetails.push(key + "=" + JSON.stringify(params2[key].toString())); + } + }); + messageDetails.push("code=" + code); + messageDetails.push("version=" + this.version); + var reason = message; + if (messageDetails.length) { + message += " (" + messageDetails.join(", ") + ")"; + } + var error = new Error(message); + error.reason = reason; + error.code = code; + Object.keys(params2).forEach(function(key) { + error[key] = params2[key]; + }); + return error; + }; + Logger2.prototype.throwError = function(message, code, params2) { + throw this.makeError(message, code, params2); + }; + Logger2.prototype.throwArgumentError = function(message, name2, value) { + return this.throwError(message, Logger2.errors.INVALID_ARGUMENT, { + argument: name2, + value + }); + }; + Logger2.prototype.assert = function(condition, message, code, params2) { + if (!!condition) { + return; + } + this.throwError(message, code, params2); + }; + Logger2.prototype.assertArgument = function(condition, message, name2, value) { + if (!!condition) { + return; + } + this.throwArgumentError(message, name2, value); + }; + Logger2.prototype.checkNormalize = function(message) { + if (message == null) { + message = "platform missing String.prototype.normalize"; + } + if (_normalizeError) { + this.throwError("platform missing String.prototype.normalize", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "String.prototype.normalize", + form: _normalizeError + }); + } + }; + Logger2.prototype.checkSafeUint53 = function(value, message) { + if (typeof value !== "number") { + return; + } + if (message == null) { + message = "value not safe"; + } + if (value < 0 || value >= 9007199254740991) { + this.throwError(message, Logger2.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value + }); + } + if (value % 1) { + this.throwError(message, Logger2.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value + }); + } + }; + Logger2.prototype.checkArgumentCount = function(count, expectedCount, message) { + if (message) { + message = ": " + message; + } else { + message = ""; + } + if (count < expectedCount) { + this.throwError("missing argument" + message, Logger2.errors.MISSING_ARGUMENT, { + count, + expectedCount + }); + } + if (count > expectedCount) { + this.throwError("too many arguments" + message, Logger2.errors.UNEXPECTED_ARGUMENT, { + count, + expectedCount + }); + } + }; + Logger2.prototype.checkNew = function(target, kind) { + if (target === Object || target == null) { + this.throwError("missing new", Logger2.errors.MISSING_NEW, { name: kind.name }); + } + }; + Logger2.prototype.checkAbstract = function(target, kind) { + if (target === kind) { + this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger2.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); + } else if (target === Object || target == null) { + this.throwError("missing new", Logger2.errors.MISSING_NEW, { name: kind.name }); + } + }; + Logger2.globalLogger = function() { + if (!_globalLogger) { + _globalLogger = new Logger2(_version_1.version); + } + return _globalLogger; + }; + Logger2.setCensorship = function(censorship, permanent) { + if (!censorship && permanent) { + this.globalLogger().throwError("cannot permanently disable censorship", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + if (_permanentCensorErrors) { + if (!censorship) { + return; + } + this.globalLogger().throwError("error censorship permanent", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + _censorErrors = !!censorship; + _permanentCensorErrors = !!permanent; + }; + Logger2.setLogLevel = function(logLevel) { + var level = LogLevels[logLevel.toLowerCase()]; + if (level == null) { + Logger2.globalLogger().warn("invalid log level - " + logLevel); + return; + } + _logLevel = level; + }; + Logger2.from = function(version) { + return new Logger2(version); + }; + Logger2.errors = ErrorCode; + Logger2.levels = LogLevel; + return Logger2; + }() + ); + exports2.Logger = Logger; + } +}); + +// node_modules/@ethersproject/bytes/lib/_version.js +var require_version2 = __commonJS({ + "node_modules/@ethersproject/bytes/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "bytes/5.5.0"; + } +}); + +// node_modules/@ethersproject/bytes/lib/index.js +var require_lib2 = __commonJS({ + "node_modules/@ethersproject/bytes/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.joinSignature = exports2.splitSignature = exports2.hexZeroPad = exports2.hexStripZeros = exports2.hexValue = exports2.hexConcat = exports2.hexDataSlice = exports2.hexDataLength = exports2.hexlify = exports2.isHexString = exports2.zeroPad = exports2.stripZeros = exports2.concat = exports2.arrayify = exports2.isBytes = exports2.isBytesLike = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version2(); + var logger = new logger_1.Logger(_version_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); + } + exports2.isBytesLike = isBytesLike; + 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; + } + exports2.isBytes = isBytes; + function arrayify(value, options) { + if (!options) { + options = {}; + } + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid arrayify value"); + var result2 = []; + while (value) { + result2.unshift(value & 255); + value = parseInt(String(value / 256)); + } + if (result2.length === 0) { + result2.push(0); + } + return addSlice(new Uint8Array(result2)); + } + 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 result2 = []; + for (var i = 0; i < hex.length; i += 2) { + result2.push(parseInt(hex.substring(i, i + 2), 16)); + } + return addSlice(new Uint8Array(result2)); + } + if (isBytes(value)) { + return addSlice(new Uint8Array(value)); + } + return logger.throwArgumentError("invalid arrayify value", "value", value); + } + exports2.arrayify = arrayify; + 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 result2 = new Uint8Array(length); + objects.reduce(function(offset, object) { + result2.set(object, offset); + return offset + object.length; + }, 0); + return addSlice(result2); + } + exports2.concat = concat; + function stripZeros(value) { + var result2 = arrayify(value); + if (result2.length === 0) { + return result2; + } + var start = 0; + while (start < result2.length && result2[start] === 0) { + start++; + } + if (start) { + result2 = result2.slice(start); + } + return result2; + } + exports2.stripZeros = stripZeros; + function zeroPad(value, length) { + value = arrayify(value); + if (value.length > length) { + logger.throwArgumentError("value out of range", "value", arguments[0]); + } + var result2 = new Uint8Array(length); + result2.set(value, length - value.length); + return addSlice(result2); + } + exports2.zeroPad = zeroPad; + 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; + } + exports2.isHexString = isHexString; + 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 & 15] + 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 result2 = "0x"; + for (var i = 0; i < value.length; i++) { + var v = value[i]; + result2 += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15]; + } + return result2; + } + return logger.throwArgumentError("invalid hexlify value", "value", value); + } + exports2.hexlify = hexlify; + function hexDataLength(data) { + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + return null; + } + return (data.length - 2) / 2; + } + exports2.hexDataLength = hexDataLength; + 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); + } + exports2.hexDataSlice = hexDataSlice; + function hexConcat(items) { + var result2 = "0x"; + items.forEach(function(item) { + result2 += hexlify(item).substring(2); + }); + return result2; + } + exports2.hexConcat = hexConcat; + function hexValue(value) { + var trimmed = hexStripZeros(hexlify(value, { hexPad: "left" })); + if (trimmed === "0x") { + return "0x0"; + } + return trimmed; + } + exports2.hexValue = hexValue; + 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); + } + exports2.hexStripZeros = hexStripZeros; + 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; + } + exports2.hexZeroPad = hexZeroPad; + function splitSignature(signature) { + var result2 = { + 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); + } + result2.r = hexlify(bytes.slice(0, 32)); + result2.s = hexlify(bytes.slice(32, 64)); + result2.v = bytes[64]; + if (result2.v < 27) { + if (result2.v === 0 || result2.v === 1) { + result2.v += 27; + } else { + logger.throwArgumentError("signature invalid v byte", "signature", signature); + } + } + result2.recoveryParam = 1 - result2.v % 2; + if (result2.recoveryParam) { + bytes[32] |= 128; + } + result2._vs = hexlify(bytes.slice(32, 64)); + } else { + result2.r = signature.r; + result2.s = signature.s; + result2.v = signature.v; + result2.recoveryParam = signature.recoveryParam; + result2._vs = signature._vs; + if (result2._vs != null) { + var vs_1 = zeroPad(arrayify(result2._vs), 32); + result2._vs = hexlify(vs_1); + var recoveryParam = vs_1[0] >= 128 ? 1 : 0; + if (result2.recoveryParam == null) { + result2.recoveryParam = recoveryParam; + } else if (result2.recoveryParam !== recoveryParam) { + logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); + } + vs_1[0] &= 127; + var s = hexlify(vs_1); + if (result2.s == null) { + result2.s = s; + } else if (result2.s !== s) { + logger.throwArgumentError("signature v mismatch _vs", "signature", signature); + } + } + if (result2.recoveryParam == null) { + if (result2.v == null) { + logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature); + } else if (result2.v === 0 || result2.v === 1) { + result2.recoveryParam = result2.v; + } else { + result2.recoveryParam = 1 - result2.v % 2; + } + } else { + if (result2.v == null) { + result2.v = 27 + result2.recoveryParam; + } else { + var recId = result2.v === 0 || result2.v === 1 ? result2.v : 1 - result2.v % 2; + if (result2.recoveryParam !== recId) { + logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature); + } + } + } + if (result2.r == null || !isHexString(result2.r)) { + logger.throwArgumentError("signature missing or invalid r", "signature", signature); + } else { + result2.r = hexZeroPad(result2.r, 32); + } + if (result2.s == null || !isHexString(result2.s)) { + logger.throwArgumentError("signature missing or invalid s", "signature", signature); + } else { + result2.s = hexZeroPad(result2.s, 32); + } + var vs = arrayify(result2.s); + if (vs[0] >= 128) { + logger.throwArgumentError("signature s out of range", "signature", signature); + } + if (result2.recoveryParam) { + vs[0] |= 128; + } + var _vs = hexlify(vs); + if (result2._vs) { + if (!isHexString(result2._vs)) { + logger.throwArgumentError("signature invalid _vs", "signature", signature); + } + result2._vs = hexZeroPad(result2._vs, 32); + } + if (result2._vs == null) { + result2._vs = _vs; + } else if (result2._vs !== _vs) { + logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature); + } + } + return result2; + } + exports2.splitSignature = splitSignature; + function joinSignature(signature) { + signature = splitSignature(signature); + return hexlify(concat([ + signature.r, + signature.s, + signature.recoveryParam ? "0x1c" : "0x1b" + ])); + } + exports2.joinSignature = joinSignature; + } +}); + +// node_modules/@ethersproject/bignumber/lib/_version.js +var require_version3 = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "bignumber/5.5.0"; + } +}); + +// node_modules/@ethersproject/bignumber/lib/bignumber.js +var require_bignumber = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/bignumber.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._base16To36 = exports2._base36To16 = exports2.BigNumber = exports2.isBigNumberish = void 0; + var bn_js_1 = __importDefault(require_bn()); + var BN = bn_js_1.default.BN; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version3(); + var logger = new logger_1.Logger(_version_1.version); + var _constructorGuard = {}; + var MAX_SAFE = 9007199254740991; + function isBigNumberish(value) { + return value != null && (BigNumber2.isBigNumber(value) || typeof value === "number" && value % 1 === 0 || typeof value === "string" && !!value.match(/^-?[0-9]+$/) || (0, bytes_1.isHexString)(value) || typeof value === "bigint" || (0, bytes_1.isBytes)(value)); + } + exports2.isBigNumberish = isBigNumberish; + var _warnedToStringRadix = false; + var BigNumber2 = ( + /** @class */ + function() { + function BigNumber3(constructorGuard, hex) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, BigNumber3); + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot call constructor directly; use BigNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new (BigNumber)" + }); + } + this._hex = hex; + this._isBigNumber = true; + Object.freeze(this); + } + BigNumber3.prototype.fromTwos = function(value) { + return toBigNumber(toBN(this).fromTwos(value)); + }; + BigNumber3.prototype.toTwos = function(value) { + return toBigNumber(toBN(this).toTwos(value)); + }; + BigNumber3.prototype.abs = function() { + if (this._hex[0] === "-") { + return BigNumber3.from(this._hex.substring(1)); + } + return this; + }; + BigNumber3.prototype.add = function(other) { + return toBigNumber(toBN(this).add(toBN(other))); + }; + BigNumber3.prototype.sub = function(other) { + return toBigNumber(toBN(this).sub(toBN(other))); + }; + BigNumber3.prototype.div = function(other) { + var o = BigNumber3.from(other); + if (o.isZero()) { + throwFault("division by zero", "div"); + } + return toBigNumber(toBN(this).div(toBN(other))); + }; + BigNumber3.prototype.mul = function(other) { + return toBigNumber(toBN(this).mul(toBN(other))); + }; + BigNumber3.prototype.mod = function(other) { + var value = toBN(other); + if (value.isNeg()) { + throwFault("cannot modulo negative values", "mod"); + } + return toBigNumber(toBN(this).umod(value)); + }; + BigNumber3.prototype.pow = function(other) { + var value = toBN(other); + if (value.isNeg()) { + throwFault("cannot raise to negative values", "pow"); + } + return toBigNumber(toBN(this).pow(value)); + }; + BigNumber3.prototype.and = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'and' negative values", "and"); + } + return toBigNumber(toBN(this).and(value)); + }; + BigNumber3.prototype.or = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'or' negative values", "or"); + } + return toBigNumber(toBN(this).or(value)); + }; + BigNumber3.prototype.xor = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'xor' negative values", "xor"); + } + return toBigNumber(toBN(this).xor(value)); + }; + BigNumber3.prototype.mask = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot mask negative values", "mask"); + } + return toBigNumber(toBN(this).maskn(value)); + }; + BigNumber3.prototype.shl = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shl"); + } + return toBigNumber(toBN(this).shln(value)); + }; + BigNumber3.prototype.shr = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shr"); + } + return toBigNumber(toBN(this).shrn(value)); + }; + BigNumber3.prototype.eq = function(other) { + return toBN(this).eq(toBN(other)); + }; + BigNumber3.prototype.lt = function(other) { + return toBN(this).lt(toBN(other)); + }; + BigNumber3.prototype.lte = function(other) { + return toBN(this).lte(toBN(other)); + }; + BigNumber3.prototype.gt = function(other) { + return toBN(this).gt(toBN(other)); + }; + BigNumber3.prototype.gte = function(other) { + return toBN(this).gte(toBN(other)); + }; + BigNumber3.prototype.isNegative = function() { + return this._hex[0] === "-"; + }; + BigNumber3.prototype.isZero = function() { + return toBN(this).isZero(); + }; + BigNumber3.prototype.toNumber = function() { + try { + return toBN(this).toNumber(); + } catch (error) { + throwFault("overflow", "toNumber", this.toString()); + } + return null; + }; + BigNumber3.prototype.toBigInt = function() { + try { + return BigInt(this.toString()); + } catch (e) { + } + return logger.throwError("this platform does not support BigInt", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + value: this.toString() + }); + }; + BigNumber3.prototype.toString = function() { + 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()", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); + } else { + logger.throwError("BigNumber.toString does not accept parameters", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); + } + } + return toBN(this).toString(10); + }; + BigNumber3.prototype.toHexString = function() { + return this._hex; + }; + BigNumber3.prototype.toJSON = function(key) { + return { type: "BigNumber", hex: this.toHexString() }; + }; + BigNumber3.from = function(value) { + if (value instanceof BigNumber3) { + return value; + } + if (typeof value === "string") { + if (value.match(/^-?0x[0-9a-f]+$/i)) { + return new BigNumber3(_constructorGuard, toHex(value)); + } + if (value.match(/^-?[0-9]+$/)) { + return new BigNumber3(_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 BigNumber3.from(String(value)); + } + var anyValue = value; + if (typeof anyValue === "bigint") { + return BigNumber3.from(anyValue.toString()); + } + if ((0, bytes_1.isBytes)(anyValue)) { + return BigNumber3.from((0, bytes_1.hexlify)(anyValue)); + } + if (anyValue) { + if (anyValue.toHexString) { + var hex = anyValue.toHexString(); + if (typeof hex === "string") { + return BigNumber3.from(hex); + } + } else { + var hex = anyValue._hex; + if (hex == null && anyValue.type === "BigNumber") { + hex = anyValue.hex; + } + if (typeof hex === "string") { + if ((0, bytes_1.isHexString)(hex) || hex[0] === "-" && (0, bytes_1.isHexString)(hex.substring(1))) { + return BigNumber3.from(hex); + } + } + } + } + return logger.throwArgumentError("invalid BigNumber value", "value", value); + }; + BigNumber3.isBigNumber = function(value) { + return !!(value && value._isBigNumber); + }; + return BigNumber3; + }() + ); + exports2.BigNumber = BigNumber2; + function toHex(value) { + if (typeof value !== "string") { + return toHex(value.toString(16)); + } + if (value[0] === "-") { + value = value.substring(1); + if (value[0] === "-") { + logger.throwArgumentError("invalid hex", "value", value); + } + value = toHex(value); + if (value === "0x00") { + return value; + } + return "-" + value; + } + if (value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (value === "0x") { + return "0x00"; + } + if (value.length % 2) { + value = "0x0" + value.substring(2); + } + while (value.length > 4 && value.substring(0, 4) === "0x00") { + value = "0x" + value.substring(4); + } + return value; + } + function toBigNumber(value) { + return BigNumber2.from(toHex(value)); + } + function toBN(value) { + var hex = BigNumber2.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 params2 = { fault, operation }; + if (value != null) { + params2.value = value; + } + return logger.throwError(fault, logger_1.Logger.errors.NUMERIC_FAULT, params2); + } + function _base36To16(value) { + return new BN(value, 36).toString(16); + } + exports2._base36To16 = _base36To16; + function _base16To36(value) { + return new BN(value, 16).toString(36); + } + exports2._base16To36 = _base16To36; + } +}); + +// node_modules/@ethersproject/bignumber/lib/fixednumber.js +var require_fixednumber = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/fixednumber.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FixedNumber = exports2.FixedFormat = exports2.parseFixed = exports2.formatFixed = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version3(); + var logger = new logger_1.Logger(_version_1.version); + var bignumber_1 = require_bignumber(); + var _constructorGuard = {}; + var Zero = bignumber_1.BigNumber.from(0); + var NegativeOne = bignumber_1.BigNumber.from(-1); + function throwFault(message, fault, operation, value) { + var params2 = { fault, operation }; + if (value !== void 0) { + params2.value = value; + } + return logger.throwError(message, logger_1.Logger.errors.NUMERIC_FAULT, params2); + } + var zeros = "0"; + while (zeros.length < 256) { + zeros += zeros; + } + function getMultiplier(decimals) { + if (typeof decimals !== "number") { + try { + decimals = bignumber_1.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); + value = bignumber_1.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; + } + 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; + } + exports2.formatFixed = formatFixed; + 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); + } + var negative = value.substring(0, 1) === "-"; + if (negative) { + value = value.substring(1); + } + if (value === ".") { + logger.throwArgumentError("missing value", "value", value); + } + 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"; + } + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + if (fraction.length > multiplier.length - 1) { + throwFault("fractional component exceeds decimals", "underflow", "parseFixed"); + } + if (fraction === "") { + fraction = "0"; + } + while (fraction.length < multiplier.length - 1) { + fraction += "0"; + } + var wholeValue = bignumber_1.BigNumber.from(whole); + var fractionValue = bignumber_1.BigNumber.from(fraction); + var wei = wholeValue.mul(multiplier).add(fractionValue); + if (negative) { + wei = wei.mul(NegativeOne); + } + return wei; + } + exports2.parseFixed = parseFixed; + var FixedFormat = ( + /** @class */ + function() { + function FixedFormat2(constructorGuard, signed, width, decimals) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", logger_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); + } + FixedFormat2.from = function(value) { + if (value instanceof FixedFormat2) { + return value; + } + if (typeof value === "number") { + value = "fixed128x" + value; + } + var signed = true; + var width = 128; + var decimals = 18; + if (typeof value === "string") { + if (value === "fixed") { + } 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(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 FixedFormat2(_constructorGuard, signed, width, decimals); + }; + return FixedFormat2; + }() + ); + exports2.FixedFormat = FixedFormat; + var FixedNumber = ( + /** @class */ + function() { + function FixedNumber2(constructorGuard, hex, value, format) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, FixedNumber2); + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new FixedFormat" + }); + } + this.format = format; + this._hex = hex; + this._value = value; + this._isFixedNumber = true; + Object.freeze(this); + } + FixedNumber2.prototype._checkFormat = function(other) { + if (this.format.name !== other.format.name) { + logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); + } + }; + FixedNumber2.prototype.addUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.add(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.subUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.sub(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.mulUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format); + }; + FixedNumber2.prototype.divUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.floor = function() { + var comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + var result2 = FixedNumber2.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + if (this.isNegative() && hasFraction) { + result2 = result2.subUnsafe(ONE.toFormat(result2.format)); + } + return result2; + }; + FixedNumber2.prototype.ceiling = function() { + var comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + var result2 = FixedNumber2.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + if (!this.isNegative() && hasFraction) { + result2 = result2.addUnsafe(ONE.toFormat(result2.format)); + } + return result2; + }; + FixedNumber2.prototype.round = function(decimals) { + if (decimals == null) { + decimals = 0; + } + 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 = FixedNumber2.from("1" + zeros.substring(0, decimals), this.format); + var bump = BUMP.toFormat(this.format); + return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); + }; + FixedNumber2.prototype.isZero = function() { + return this._value === "0.0" || this._value === "0"; + }; + FixedNumber2.prototype.isNegative = function() { + return this._value[0] === "-"; + }; + FixedNumber2.prototype.toString = function() { + return this._value; + }; + FixedNumber2.prototype.toHexString = function(width) { + if (width == null) { + return this._hex; + } + if (width % 8) { + logger.throwArgumentError("invalid byte width", "width", width); + } + var hex = bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + return (0, bytes_1.hexZeroPad)(hex, width / 8); + }; + FixedNumber2.prototype.toUnsafeFloat = function() { + return parseFloat(this.toString()); + }; + FixedNumber2.prototype.toFormat = function(format) { + return FixedNumber2.fromString(this._value, format); + }; + FixedNumber2.fromValue = function(value, decimals, format) { + if (format == null && decimals != null && !(0, bignumber_1.isBigNumberish)(decimals)) { + format = decimals; + decimals = null; + } + if (decimals == null) { + decimals = 0; + } + if (format == null) { + format = "fixed"; + } + return FixedNumber2.fromString(formatFixed(value, decimals), FixedFormat.from(format)); + }; + FixedNumber2.fromString = function(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 = (0, bytes_1.hexZeroPad)(hex, fixedFormat.width / 8); + } + var decimal = formatFixed(numeric, fixedFormat.decimals); + return new FixedNumber2(_constructorGuard, hex, decimal, fixedFormat); + }; + FixedNumber2.fromBytes = function(value, format) { + if (format == null) { + format = "fixed"; + } + var fixedFormat = FixedFormat.from(format); + if ((0, bytes_1.arrayify)(value).length > fixedFormat.width / 8) { + throw new Error("overflow"); + } + var numeric = bignumber_1.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 FixedNumber2(_constructorGuard, hex, decimal, fixedFormat); + }; + FixedNumber2.from = function(value, format) { + if (typeof value === "string") { + return FixedNumber2.fromString(value, format); + } + if ((0, bytes_1.isBytes)(value)) { + return FixedNumber2.fromBytes(value, format); + } + try { + return FixedNumber2.fromValue(value, 0, format); + } catch (error) { + if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT) { + throw error; + } + } + return logger.throwArgumentError("invalid FixedNumber value", "value", value); + }; + FixedNumber2.isFixedNumber = function(value) { + return !!(value && value._isFixedNumber); + }; + return FixedNumber2; + }() + ); + exports2.FixedNumber = FixedNumber; + var ONE = FixedNumber.from(1); + var BUMP = FixedNumber.from("0.5"); + } +}); + +// node_modules/@ethersproject/bignumber/lib/index.js +var require_lib3 = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._base36To16 = exports2._base16To36 = exports2.parseFixed = exports2.FixedNumber = exports2.FixedFormat = exports2.formatFixed = exports2.BigNumber = void 0; + var bignumber_1 = require_bignumber(); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return bignumber_1.BigNumber; + } }); + var fixednumber_1 = require_fixednumber(); + Object.defineProperty(exports2, "formatFixed", { enumerable: true, get: function() { + return fixednumber_1.formatFixed; + } }); + Object.defineProperty(exports2, "FixedFormat", { enumerable: true, get: function() { + return fixednumber_1.FixedFormat; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return fixednumber_1.FixedNumber; + } }); + Object.defineProperty(exports2, "parseFixed", { enumerable: true, get: function() { + return fixednumber_1.parseFixed; + } }); + var bignumber_2 = require_bignumber(); + Object.defineProperty(exports2, "_base16To36", { enumerable: true, get: function() { + return bignumber_2._base16To36; + } }); + Object.defineProperty(exports2, "_base36To16", { enumerable: true, get: function() { + return bignumber_2._base36To16; + } }); + } +}); + +// node_modules/@ethersproject/properties/lib/_version.js +var require_version4 = __commonJS({ + "node_modules/@ethersproject/properties/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "properties/5.5.0"; + } +}); + +// node_modules/@ethersproject/properties/lib/index.js +var require_lib4 = __commonJS({ + "node_modules/@ethersproject/properties/lib/index.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Description = exports2.deepCopy = exports2.shallowCopy = exports2.checkProperties = exports2.resolveProperties = exports2.getStatic = exports2.defineReadOnly = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version4(); + var logger = new logger_1.Logger(_version_1.version); + function defineReadOnly(object, name2, value) { + Object.defineProperty(object, name2, { + enumerable: true, + value, + writable: false + }); + } + exports2.defineReadOnly = defineReadOnly; + 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; + } + exports2.getStatic = getStatic; + function resolveProperties(object) { + return __awaiter(this, void 0, void 0, function() { + var promises, results; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + promises = Object.keys(object).map(function(key) { + var value = object[key]; + return Promise.resolve(value).then(function(v) { + return { key, value: v }; + }); + }); + return [4, Promise.all(promises)]; + case 1: + results = _a.sent(); + return [2, results.reduce(function(accum, result2) { + accum[result2.key] = result2.value; + return accum; + }, {})]; + } + }); + }); + } + exports2.resolveProperties = resolveProperties; + 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); + } + }); + } + exports2.checkProperties = checkProperties; + function shallowCopy(object) { + var result2 = {}; + for (var key in object) { + result2[key] = object[key]; + } + return result2; + } + exports2.shallowCopy = shallowCopy; + var opaque = { bigint: true, boolean: true, "function": true, number: true, string: true }; + function _isFrozen(object) { + if (object === void 0 || 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) { + continue; + } + if (!_isFrozen(value)) { + return false; + } + } + return true; + } + return logger.throwArgumentError("Cannot deepCopy " + typeof object, "object", object); + } + function _deepCopy(object) { + if (_isFrozen(object)) { + return object; + } + if (Array.isArray(object)) { + return Object.freeze(object.map(function(item) { + return deepCopy(item); + })); + } + if (typeof object === "object") { + var result2 = {}; + for (var key in object) { + var value = object[key]; + if (value === void 0) { + continue; + } + defineReadOnly(result2, key, deepCopy(value)); + } + return result2; + } + return logger.throwArgumentError("Cannot deepCopy " + typeof object, "object", object); + } + function deepCopy(object) { + return _deepCopy(object); + } + exports2.deepCopy = deepCopy; + var Description = ( + /** @class */ + /* @__PURE__ */ function() { + function Description2(info) { + for (var key in info) { + this[key] = deepCopy(info[key]); + } + } + return Description2; + }() + ); + exports2.Description = Description; + } +}); + +// node_modules/@ethersproject/abi/lib/_version.js +var require_version5 = __commonJS({ + "node_modules/@ethersproject/abi/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abi/5.5.0"; + } +}); + +// node_modules/@ethersproject/abi/lib/fragments.js +var require_fragments = __commonJS({ + "node_modules/@ethersproject/abi/lib/fragments.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ErrorFragment = exports2.FunctionFragment = exports2.ConstructorFragment = exports2.EventFragment = exports2.Fragment = exports2.ParamType = exports2.FormatTypes = void 0; + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var _constructorGuard = {}; + var ModifiersBytes = { calldata: true, memory: true, storage: true }; + var ModifiersNest = { calldata: true, memory: true }; + function checkModifier(type, name2) { + if (type === "bytes" || type === "string") { + if (ModifiersBytes[name2]) { + return true; + } + } else if (type === "address") { + if (name2 === "payable") { + return true; + } + } else if (type.indexOf("[") >= 0 || type === "tuple") { + if (ModifiersNest[name2]) { + return true; + } + } + if (ModifiersBytes[name2] || name2 === "payable") { + logger.throwArgumentError("invalid modifier", "name", name2); + } + return false; + } + function parseParamType(param, allowIndexed) { + var originalParam = param; + function throwError(i2) { + logger.throwArgumentError("unexpected character at position " + i2, "param", param); + } + param = param.replace(/\s/g, " "); + function newNode(parent2) { + var node2 = { type: "", name: "", parent: parent2, state: { allowType: true } }; + if (allowIndexed) { + node2.indexed = false; + } + return node2; + } + 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); + node.parent.components.push(sibling); + delete node.parent; + node = sibling; + break; + case " ": + 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 (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, params2) { + for (var key in params2) { + (0, properties_1.defineReadOnly)(object, key, params2[key]); + } + } + exports2.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 = ( + /** @class */ + function() { + function ParamType2(constructorGuard, params2) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("use fromString", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new ParamType()" + }); + } + populate(this, params2); + var match = this.type.match(paramTypeArray); + if (match) { + populate(this, { + arrayLength: parseInt(match[2] || "-1"), + arrayChildren: ParamType2.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); + } + ParamType2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + var result_1 = { + type: this.baseType === "tuple" ? "tuple" : this.type, + name: this.name || void 0 + }; + if (typeof this.indexed === "boolean") { + result_1.indexed = this.indexed; + } + if (this.components) { + result_1.components = this.components.map(function(comp) { + return JSON.parse(comp.format(format)); + }); + } + return JSON.stringify(result_1); + } + var result2 = ""; + if (this.baseType === "array") { + result2 += this.arrayChildren.format(format); + result2 += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]"; + } else { + if (this.baseType === "tuple") { + if (format !== exports2.FormatTypes.sighash) { + result2 += this.type; + } + result2 += "(" + this.components.map(function(comp) { + return comp.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ")"; + } else { + result2 += this.type; + } + } + if (format !== exports2.FormatTypes.sighash) { + if (this.indexed === true) { + result2 += " indexed"; + } + if (format === exports2.FormatTypes.full && this.name) { + result2 += " " + this.name; + } + } + return result2; + }; + ParamType2.from = function(value, allowIndexed) { + if (typeof value === "string") { + return ParamType2.fromString(value, allowIndexed); + } + return ParamType2.fromObject(value); + }; + ParamType2.fromObject = function(value) { + if (ParamType2.isParamType(value)) { + return value; + } + return new ParamType2(_constructorGuard, { + name: value.name || null, + type: verifyType(value.type), + indexed: value.indexed == null ? null : !!value.indexed, + components: value.components ? value.components.map(ParamType2.fromObject) : null + }); + }; + ParamType2.fromString = function(value, allowIndexed) { + function ParamTypify(node) { + return ParamType2.fromObject({ + name: node.name, + type: node.type, + indexed: node.indexed, + components: node.components + }); + } + return ParamTypify(parseParamType(value, !!allowIndexed)); + }; + ParamType2.isParamType = function(value) { + return !!(value != null && value._isParamType); + }; + return ParamType2; + }() + ); + exports2.ParamType = ParamType; + function parseParams(value, allowIndex) { + return splitNesting(value).map(function(param) { + return ParamType.fromString(param, allowIndex); + }); + } + var Fragment = ( + /** @class */ + function() { + function Fragment2(constructorGuard, params2) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("use a static from method", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Fragment()" + }); + } + populate(this, params2); + this._isFragment = true; + Object.freeze(this); + } + Fragment2.from = function(value) { + if (Fragment2.isFragment(value)) { + return value; + } + if (typeof value === "string") { + return Fragment2.fromString(value); + } + return Fragment2.fromObject(value); + }; + Fragment2.fromObject = function(value) { + if (Fragment2.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": + return null; + } + return logger.throwArgumentError("invalid fragment object", "value", value); + }; + Fragment2.fromString = function(value) { + 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); + }; + Fragment2.isFragment = function(value) { + return !!(value && value._isFragment); + }; + return Fragment2; + }() + ); + exports2.Fragment = Fragment; + var EventFragment = ( + /** @class */ + function(_super) { + __extends(EventFragment2, _super); + function EventFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + EventFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + var result2 = ""; + if (format !== exports2.FormatTypes.sighash) { + result2 += "event "; + } + result2 += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (format !== exports2.FormatTypes.sighash) { + if (this.anonymous) { + result2 += "anonymous "; + } + } + return result2.trim(); + }; + EventFragment2.from = function(value) { + if (typeof value === "string") { + return EventFragment2.fromString(value); + } + return EventFragment2.fromObject(value); + }; + EventFragment2.fromObject = function(value) { + if (EventFragment2.isEventFragment(value)) { + return value; + } + if (value.type !== "event") { + logger.throwArgumentError("invalid event object", "value", value); + } + var params2 = { + name: verifyIdentifier(value.name), + anonymous: value.anonymous, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + type: "event" + }; + return new EventFragment2(_constructorGuard, params2); + }; + EventFragment2.fromString = function(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 EventFragment2.fromObject({ + name: match[1].trim(), + anonymous, + inputs: parseParams(match[2], true), + type: "event" + }); + }; + EventFragment2.isEventFragment = function(value) { + return value && value._isFragment && value.type === "event"; + }; + return EventFragment2; + }(Fragment) + ); + exports2.EventFragment = EventFragment; + function parseGas(value, params2) { + params2.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); + } + params2.gas = bignumber_1.BigNumber.from(comps[1]); + return comps[0]; + } + return value; + } + function parseModifiers(value, params2) { + params2.constant = false; + params2.payable = false; + params2.stateMutability = "nonpayable"; + value.split(" ").forEach(function(modifier) { + switch (modifier.trim()) { + case "constant": + params2.constant = true; + break; + case "payable": + params2.payable = true; + params2.stateMutability = "payable"; + break; + case "nonpayable": + params2.payable = false; + params2.stateMutability = "nonpayable"; + break; + case "pure": + params2.constant = true; + params2.stateMutability = "pure"; + break; + case "view": + params2.constant = true; + params2.stateMutability = "view"; + break; + case "external": + case "public": + case "": + break; + default: + console.log("unknown modifier: " + modifier); + } + }); + } + function verifyState(value) { + var result2 = { + constant: false, + payable: true, + stateMutability: "payable" + }; + if (value.stateMutability != null) { + result2.stateMutability = value.stateMutability; + result2.constant = result2.stateMutability === "view" || result2.stateMutability === "pure"; + if (value.constant != null) { + if (!!value.constant !== result2.constant) { + logger.throwArgumentError("cannot have constant function with mutability " + result2.stateMutability, "value", value); + } + } + result2.payable = result2.stateMutability === "payable"; + if (value.payable != null) { + if (!!value.payable !== result2.payable) { + logger.throwArgumentError("cannot have payable function with mutability " + result2.stateMutability, "value", value); + } + } + } else if (value.payable != null) { + result2.payable = !!value.payable; + if (value.constant == null && !result2.payable && value.type !== "constructor") { + logger.throwArgumentError("unable to determine stateMutability", "value", value); + } + result2.constant = !!value.constant; + if (result2.constant) { + result2.stateMutability = "view"; + } else { + result2.stateMutability = result2.payable ? "payable" : "nonpayable"; + } + if (result2.payable && result2.constant) { + logger.throwArgumentError("cannot have constant payable function", "value", value); + } + } else if (value.constant != null) { + result2.constant = !!value.constant; + result2.payable = !result2.constant; + result2.stateMutability = result2.constant ? "view" : "payable"; + } else if (value.type !== "constructor") { + logger.throwArgumentError("unable to determine stateMutability", "value", value); + } + return result2; + } + var ConstructorFragment = ( + /** @class */ + function(_super) { + __extends(ConstructorFragment2, _super); + function ConstructorFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ConstructorFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "constructor", + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + if (format === exports2.FormatTypes.sighash) { + logger.throwError("cannot format a constructor for sighash", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "format(sighash)" + }); + } + var result2 = "constructor(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (this.stateMutability && this.stateMutability !== "nonpayable") { + result2 += this.stateMutability + " "; + } + return result2.trim(); + }; + ConstructorFragment2.from = function(value) { + if (typeof value === "string") { + return ConstructorFragment2.fromString(value); + } + return ConstructorFragment2.fromObject(value); + }; + ConstructorFragment2.fromObject = function(value) { + if (ConstructorFragment2.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 params2 = { + name: null, + type: value.type, + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [], + payable: state.payable, + stateMutability: state.stateMutability, + gas: value.gas ? bignumber_1.BigNumber.from(value.gas) : null + }; + return new ConstructorFragment2(_constructorGuard, params2); + }; + ConstructorFragment2.fromString = function(value) { + var params2 = { type: "constructor" }; + value = parseGas(value, params2); + var parens = value.match(regexParen); + if (!parens || parens[1].trim() !== "constructor") { + logger.throwArgumentError("invalid constructor string", "value", value); + } + params2.inputs = parseParams(parens[2].trim(), false); + parseModifiers(parens[3].trim(), params2); + return ConstructorFragment2.fromObject(params2); + }; + ConstructorFragment2.isConstructorFragment = function(value) { + return value && value._isFragment && value.type === "constructor"; + }; + return ConstructorFragment2; + }(Fragment) + ); + exports2.ConstructorFragment = ConstructorFragment; + var FunctionFragment = ( + /** @class */ + function(_super) { + __extends(FunctionFragment2, _super); + function FunctionFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + FunctionFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }), + outputs: this.outputs.map(function(output) { + return JSON.parse(output.format(format)); + }) + }); + } + var result2 = ""; + if (format !== exports2.FormatTypes.sighash) { + result2 += "function "; + } + result2 += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (format !== exports2.FormatTypes.sighash) { + if (this.stateMutability) { + if (this.stateMutability !== "nonpayable") { + result2 += this.stateMutability + " "; + } + } else if (this.constant) { + result2 += "view "; + } + if (this.outputs && this.outputs.length) { + result2 += "returns (" + this.outputs.map(function(output) { + return output.format(format); + }).join(", ") + ") "; + } + if (this.gas != null) { + result2 += "@" + this.gas.toString() + " "; + } + } + return result2.trim(); + }; + FunctionFragment2.from = function(value) { + if (typeof value === "string") { + return FunctionFragment2.fromString(value); + } + return FunctionFragment2.fromObject(value); + }; + FunctionFragment2.fromObject = function(value) { + if (FunctionFragment2.isFunctionFragment(value)) { + return value; + } + if (value.type !== "function") { + logger.throwArgumentError("invalid function object", "value", value); + } + var state = verifyState(value); + var params2 = { + 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 ? bignumber_1.BigNumber.from(value.gas) : null + }; + return new FunctionFragment2(_constructorGuard, params2); + }; + FunctionFragment2.fromString = function(value) { + var params2 = { type: "function" }; + value = parseGas(value, params2); + 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); + } + params2.name = parens[1].trim(); + if (params2.name) { + verifyIdentifier(params2.name); + } + params2.inputs = parseParams(parens[2], false); + parseModifiers(parens[3].trim(), params2); + if (comps.length > 1) { + var returns = comps[1].match(regexParen); + if (returns[1].trim() != "" || returns[3].trim() != "") { + logger.throwArgumentError("unexpected tokens", "value", value); + } + params2.outputs = parseParams(returns[2], false); + } else { + params2.outputs = []; + } + return FunctionFragment2.fromObject(params2); + }; + FunctionFragment2.isFunctionFragment = function(value) { + return value && value._isFragment && value.type === "function"; + }; + return FunctionFragment2; + }(ConstructorFragment) + ); + exports2.FunctionFragment = FunctionFragment; + function checkForbidden(fragment) { + var sig = fragment.format(); + if (sig === "Error(string)" || sig === "Panic(uint256)") { + logger.throwArgumentError("cannot specify user defined " + sig + " error", "fragment", fragment); + } + return fragment; + } + var ErrorFragment = ( + /** @class */ + function(_super) { + __extends(ErrorFragment2, _super); + function ErrorFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ErrorFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + var result2 = ""; + if (format !== exports2.FormatTypes.sighash) { + result2 += "error "; + } + result2 += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + return result2.trim(); + }; + ErrorFragment2.from = function(value) { + if (typeof value === "string") { + return ErrorFragment2.fromString(value); + } + return ErrorFragment2.fromObject(value); + }; + ErrorFragment2.fromObject = function(value) { + if (ErrorFragment2.isErrorFragment(value)) { + return value; + } + if (value.type !== "error") { + logger.throwArgumentError("invalid error object", "value", value); + } + var params2 = { + type: value.type, + name: verifyIdentifier(value.name), + inputs: value.inputs ? value.inputs.map(ParamType.fromObject) : [] + }; + return checkForbidden(new ErrorFragment2(_constructorGuard, params2)); + }; + ErrorFragment2.fromString = function(value) { + var params2 = { type: "error" }; + var parens = value.match(regexParen); + if (!parens) { + logger.throwArgumentError("invalid error signature", "value", value); + } + params2.name = parens[1].trim(); + if (params2.name) { + verifyIdentifier(params2.name); + } + params2.inputs = parseParams(parens[2], false); + return checkForbidden(ErrorFragment2.fromObject(params2)); + }; + ErrorFragment2.isErrorFragment = function(value) { + return value && value._isFragment && value.type === "error"; + }; + return ErrorFragment2; + }(Fragment) + ); + exports2.ErrorFragment = ErrorFragment; + function verifyType(type) { + if (type.match(/^uint($|[^1-9])/)) { + type = "uint256" + type.substring(4); + } else if (type.match(/^int($|[^1-9])/)) { + type = "int256" + type.substring(3); + } + return type; + } + var regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); + function verifyIdentifier(value) { + if (!value || !value.match(regexIdentifier)) { + logger.throwArgumentError('invalid identifier "' + value + '"', "value", value); + } + return value; + } + var regexParen = new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$"); + function splitNesting(value) { + value = value.trim(); + var result2 = []; + var accum = ""; + var depth = 0; + for (var offset = 0; offset < value.length; offset++) { + var c = value[offset]; + if (c === "," && depth === 0) { + result2.push(accum); + accum = ""; + } else { + accum += c; + if (c === "(") { + depth++; + } else if (c === ")") { + depth--; + if (depth === -1) { + logger.throwArgumentError("unbalanced parenthesis", "value", value); + } + } + } + } + if (accum) { + result2.push(accum); + } + return result2; + } + } +}); + +// node_modules/@ethersproject/abi/lib/coders/abstract-coder.js +var require_abstract_coder = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/abstract-coder.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Reader = exports2.Writer = exports2.Coder = exports2.checkResultErrors = void 0; + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + function checkResultErrors(result2) { + var errors = []; + var checkErrors = function(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 }); + } + } + }; + checkErrors([], result2); + return errors; + } + exports2.checkResultErrors = checkResultErrors; + var Coder = ( + /** @class */ + function() { + function Coder2(name2, type, localName, dynamic) { + this.name = name2; + this.type = type; + this.localName = localName; + this.dynamic = dynamic; + } + Coder2.prototype._throwError = function(message, value) { + logger.throwArgumentError(message, this.localName, value); + }; + return Coder2; + }() + ); + exports2.Coder = Coder; + var Writer = ( + /** @class */ + function() { + function Writer2(wordSize) { + (0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32); + this._data = []; + this._dataLength = 0; + this._padding = new Uint8Array(wordSize); + } + Object.defineProperty(Writer2.prototype, "data", { + get: function() { + return (0, bytes_1.hexConcat)(this._data); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Writer2.prototype, "length", { + get: function() { + return this._dataLength; + }, + enumerable: false, + configurable: true + }); + Writer2.prototype._writeData = function(data) { + this._data.push(data); + this._dataLength += data.length; + return data.length; + }; + Writer2.prototype.appendWriter = function(writer) { + return this._writeData((0, bytes_1.concat)(writer._data)); + }; + Writer2.prototype.writeBytes = function(value) { + var bytes = (0, bytes_1.arrayify)(value); + var paddingOffset = bytes.length % this.wordSize; + if (paddingOffset) { + bytes = (0, bytes_1.concat)([bytes, this._padding.slice(paddingOffset)]); + } + return this._writeData(bytes); + }; + Writer2.prototype._getValue = function(value) { + var bytes = (0, bytes_1.arrayify)(bignumber_1.BigNumber.from(value)); + if (bytes.length > this.wordSize) { + logger.throwError("value out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: this.wordSize, + offset: bytes.length + }); + } + if (bytes.length % this.wordSize) { + bytes = (0, bytes_1.concat)([this._padding.slice(bytes.length % this.wordSize), bytes]); + } + return bytes; + }; + Writer2.prototype.writeValue = function(value) { + return this._writeData(this._getValue(value)); + }; + Writer2.prototype.writeUpdatableValue = function() { + 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 Writer2; + }() + ); + exports2.Writer = Writer; + var Reader = ( + /** @class */ + function() { + function Reader2(data, wordSize, coerceFunc, allowLoose) { + (0, properties_1.defineReadOnly)(this, "_data", (0, bytes_1.arrayify)(data)); + (0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32); + (0, properties_1.defineReadOnly)(this, "_coerceFunc", coerceFunc); + (0, properties_1.defineReadOnly)(this, "allowLoose", allowLoose); + this._offset = 0; + } + Object.defineProperty(Reader2.prototype, "data", { + get: function() { + return (0, bytes_1.hexlify)(this._data); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Reader2.prototype, "consumed", { + get: function() { + return this._offset; + }, + enumerable: false, + configurable: true + }); + Reader2.coerce = function(name2, value) { + var match = name2.match("^u?int([0-9]+)$"); + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + return value; + }; + Reader2.prototype.coerce = function(name2, value) { + if (this._coerceFunc) { + return this._coerceFunc(name2, value); + } + return Reader2.coerce(name2, value); + }; + Reader2.prototype._peekBytes = function(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", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + return this._data.slice(this._offset, this._offset + alignedLength); + }; + Reader2.prototype.subReader = function(offset) { + return new Reader2(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + }; + Reader2.prototype.readBytes = function(length, loose) { + var bytes = this._peekBytes(0, length, !!loose); + this._offset += bytes.length; + return bytes.slice(0, length); + }; + Reader2.prototype.readValue = function() { + return bignumber_1.BigNumber.from(this.readBytes(this.wordSize)); + }; + return Reader2; + }() + ); + exports2.Reader = Reader; + } +}); + +// node_modules/js-sha3/src/sha3.js +var require_sha3 = __commonJS({ + "node_modules/js-sha3/src/sha3.js"(exports2, module2) { + (function() { + "use strict"; + var INPUT_ERROR = "input is invalid type"; + var FINALIZE_ERROR = "finalize already called"; + var WINDOW = typeof window === "object"; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === "object"; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && 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 && typeof module2 === "object" && module2.exports; + var AMD = typeof define === "function" && define.amd; + 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(bits2, padding, outputType) { + return function(message) { + return new Keccak(bits2, padding, bits2).update(message)[outputType](); + }; + }; + var createShakeOutputMethod = function(bits2, padding, outputType) { + return function(message, outputBits) { + return new Keccak(bits2, padding, outputBits).update(message)[outputType](); + }; + }; + var createCshakeOutputMethod = function(bits2, padding, outputType) { + return function(message, outputBits, n, s) { + return methods["cshake" + bits2].update(message, outputBits, n, s)[outputType](); + }; + }; + var createKmacOutputMethod = function(bits2, padding, outputType) { + return function(key, message, outputBits, s) { + return methods["kmac" + bits2].update(key, message, outputBits, s)[outputType](); + }; + }; + var createOutputMethods = function(method, createMethod2, bits2, padding) { + for (var i2 = 0; i2 < OUTPUT_TYPES.length; ++i2) { + var type = OUTPUT_TYPES[i2]; + method[type] = createMethod2(bits2, padding, type); + } + return method; + }; + var createMethod = function(bits2, padding) { + var method = createOutputMethod(bits2, padding, "hex"); + method.create = function() { + return new Keccak(bits2, padding, bits2); + }; + method.update = function(message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits2, padding); + }; + var createShakeMethod = function(bits2, padding) { + var method = createShakeOutputMethod(bits2, padding, "hex"); + method.create = function(outputBits) { + return new Keccak(bits2, padding, outputBits); + }; + method.update = function(message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits2, padding); + }; + var createCshakeMethod = function(bits2, padding) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createCshakeOutputMethod(bits2, padding, "hex"); + method.create = function(outputBits, n, s) { + if (!n && !s) { + return methods["shake" + bits2].create(outputBits); + } else { + return new Keccak(bits2, 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, bits2, padding); + }; + var createKmacMethod = function(bits2, padding) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createKmacOutputMethod(bits2, padding, "hex"); + method.create = function(key, outputBits, s) { + return new Kmac(bits2, 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, bits2, padding); + }; + var algorithms = [ + { name: "keccak", padding: KECCAK_PADDING, bits: BITS, createMethod }, + { name: "sha3", padding: PADDING, bits: BITS, 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(bits2, 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 - (bits2 << 1) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + for (var i2 = 0; i2 < 50; ++i2) { + this.s[i2] = 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, i2, code; + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; + } + } + if (notString) { + for (i2 = this.start; index < length && i2 < byteCount; ++index) { + blocks[i2 >> 2] |= message[index] << SHIFT[i2++ & 3]; + } + } else { + for (i2 = this.start; index < length && i2 < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 128) { + blocks[i2 >> 2] |= code << SHIFT[i2++ & 3]; + } else if (code < 2048) { + blocks[i2 >> 2] |= (192 | code >> 6) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } else if (code < 55296 || code >= 57344) { + blocks[i2 >> 2] |= (224 | code >> 12) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } else { + code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023); + blocks[i2 >> 2] |= (240 | code >> 18) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 12 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } + } + } + this.lastByteIndex = i2; + if (i2 >= byteCount) { + this.start = i2 - byteCount; + this.block = blocks[blockCount]; + for (i2 = 0; i2 < blockCount; ++i2) { + s[i2] ^= blocks[i2]; + } + f(s); + this.reset = true; + } else { + this.start = i2; + } + } + 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 i2 = 0; i2 < str.length; ++i2) { + var code = str.charCodeAt(i2); + if (code < 128) { + bytes += 1; + } else if (code < 2048) { + bytes += 2; + } else if (code < 55296 || code >= 57344) { + bytes += 3; + } else { + code = 65536 + ((code & 1023) << 10 | str.charCodeAt(++i2) & 1023); + 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 i2 = 0; i2 < strs.length; ++i2) { + bytes += this.encodeString(strs[i2]); + } + 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, i2 = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i2 >> 2] |= this.padding[i2 & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; + } + } + blocks[blockCount - 1] |= 2147483648; + for (i2 = 0; i2 < blockCount; ++i2) { + s[i2] ^= blocks[i2]; + } + f(s); + }; + Keccak.prototype.toString = Keccak.prototype.hex = function() { + this.finalize(); + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 0; + var hex = "", block; + while (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + block = s[i2]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15] + HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15] + HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15] + HEX_CHARS[block >> 28 & 15] + HEX_CHARS[block >> 24 & 15]; + } + if (j2 % blockCount === 0) { + f(s); + i2 = 0; + } + } + if (extraBytes) { + block = s[i2]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15]; + if (extraBytes > 1) { + hex += HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15]; + } + } + return hex; + }; + Keccak.prototype.arrayBuffer = function() { + this.finalize(); + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 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 (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + array[j2] = s[i2]; + } + if (j2 % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i2] = s[i2]; + 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, i2 = 0, j2 = 0; + var array = [], offset, block; + while (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + offset = j2 << 2; + block = s[i2]; + array[offset] = block & 255; + array[offset + 1] = block >> 8 & 255; + array[offset + 2] = block >> 16 & 255; + array[offset + 3] = block >> 24 & 255; + } + if (j2 % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j2 << 2; + block = s[i2]; + array[offset] = block & 255; + if (extraBytes > 1) { + array[offset + 1] = block >> 8 & 255; + } + if (extraBytes > 2) { + array[offset + 2] = block >> 16 & 255; + } + } + return array; + }; + function Kmac(bits2, padding, outputBits) { + Keccak.call(this, bits2, padding, outputBits); + } + Kmac.prototype = new Keccak(); + Kmac.prototype.finalize = function() { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + var f = function(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) { + module2.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + if (AMD) { + define(function() { + return methods; + }); + } + } + })(); + } +}); + +// node_modules/@ethersproject/keccak256/lib/index.js +var require_lib5 = __commonJS({ + "node_modules/@ethersproject/keccak256/lib/index.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.keccak256 = void 0; + var js_sha3_1 = __importDefault(require_sha3()); + var bytes_1 = require_lib2(); + function keccak256(data) { + return "0x" + js_sha3_1.default.keccak_256((0, bytes_1.arrayify)(data)); + } + exports2.keccak256 = keccak256; + } +}); + +// node_modules/@ethersproject/rlp/lib/_version.js +var require_version6 = __commonJS({ + "node_modules/@ethersproject/rlp/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "rlp/5.5.0"; + } +}); + +// node_modules/@ethersproject/rlp/lib/index.js +var require_lib6 = __commonJS({ + "node_modules/@ethersproject/rlp/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decode = exports2.encode = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version6(); + var logger = new logger_1.Logger(_version_1.version); + function arrayifyInteger(value) { + var result2 = []; + while (value) { + result2.unshift(value & 255); + value >>= 8; + } + return result2; + } + function unarrayifyInteger(data, offset, length) { + var result2 = 0; + for (var i = 0; i < length; i++) { + result2 = result2 * 256 + data[offset + i]; + } + return result2; + } + function _encode(object) { + if (Array.isArray(object)) { + var payload_1 = []; + object.forEach(function(child) { + payload_1 = payload_1.concat(_encode(child)); + }); + if (payload_1.length <= 55) { + payload_1.unshift(192 + payload_1.length); + return payload_1; + } + var length_1 = arrayifyInteger(payload_1.length); + length_1.unshift(247 + length_1.length); + return length_1.concat(payload_1); + } + if (!(0, bytes_1.isBytesLike)(object)) { + logger.throwArgumentError("RLP object must be BytesLike", "object", object); + } + var data = Array.prototype.slice.call((0, bytes_1.arrayify)(object)); + if (data.length === 1 && data[0] <= 127) { + return data; + } else if (data.length <= 55) { + data.unshift(128 + data.length); + return data; + } + var length = arrayifyInteger(data.length); + length.unshift(183 + length.length); + return length.concat(data); + } + function encode(object) { + return (0, bytes_1.hexlify)(_encode(object)); + } + exports2.encode = encode; + function _decodeChildren(data, offset, childOffset, length) { + var result2 = []; + while (childOffset < offset + 1 + length) { + var decoded = _decode(data, childOffset); + result2.push(decoded.result); + childOffset += decoded.consumed; + if (childOffset > offset + 1 + length) { + logger.throwError("child data too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + } + return { consumed: 1 + length, result: result2 }; + } + function _decode(data, offset) { + if (data.length === 0) { + logger.throwError("data too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + if (data[offset] >= 248) { + var lengthLength = data[offset] - 247; + if (offset + 1 + lengthLength > data.length) { + logger.throwError("data short segment too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var length_2 = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length_2 > data.length) { + logger.throwError("data long segment too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length_2); + } else if (data[offset] >= 192) { + var length_3 = data[offset] - 192; + if (offset + 1 + length_3 > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1, length_3); + } else if (data[offset] >= 184) { + var lengthLength = data[offset] - 183; + if (offset + 1 + lengthLength > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var length_4 = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length_4 > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var result2 = (0, bytes_1.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length_4)); + return { consumed: 1 + lengthLength + length_4, result: result2 }; + } else if (data[offset] >= 128) { + var length_5 = data[offset] - 128; + if (offset + 1 + length_5 > data.length) { + logger.throwError("data too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var result2 = (0, bytes_1.hexlify)(data.slice(offset + 1, offset + 1 + length_5)); + return { consumed: 1 + length_5, result: result2 }; + } + return { consumed: 1, result: (0, bytes_1.hexlify)(data[offset]) }; + } + function decode(data) { + var bytes = (0, bytes_1.arrayify)(data); + var decoded = _decode(bytes, 0); + if (decoded.consumed !== bytes.length) { + logger.throwArgumentError("invalid rlp data", "data", data); + } + return decoded.result; + } + exports2.decode = decode; + } +}); + +// node_modules/@ethersproject/address/lib/_version.js +var require_version7 = __commonJS({ + "node_modules/@ethersproject/address/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "address/5.5.0"; + } +}); + +// node_modules/@ethersproject/address/lib/index.js +var require_lib7 = __commonJS({ + "node_modules/@ethersproject/address/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getCreate2Address = exports2.getContractAddress = exports2.getIcapAddress = exports2.isAddress = exports2.getAddress = void 0; + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var keccak256_1 = require_lib5(); + var rlp_1 = require_lib6(); + var logger_1 = require_lib(); + var _version_1 = require_version7(); + var logger = new logger_1.Logger(_version_1.version); + function getChecksumAddress(address) { + if (!(0, bytes_1.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 i2 = 0; i2 < 40; i2++) { + expanded[i2] = chars[i2].charCodeAt(0); + } + var hashed = (0, bytes_1.arrayify)((0, keccak256_1.keccak256)(expanded)); + for (var i2 = 0; i2 < 40; i2 += 2) { + if (hashed[i2 >> 1] >> 4 >= 8) { + chars[i2] = chars[i2].toUpperCase(); + } + if ((hashed[i2 >> 1] & 15) >= 8) { + chars[i2 + 1] = chars[i2 + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); + } + var MAX_SAFE_INTEGER = 9007199254740991; + function log10(x) { + if (Math.log10) { + return Math.log10(x); + } + return Math.log(x) / Math.LN10; + } + var ibanLookup = {}; + for (i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); + } + var i; + for (i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); + } + var i; + 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(""); + 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 result2 = null; + if (typeof address !== "string") { + logger.throwArgumentError("invalid address", "address", address); + } + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + if (address.substring(0, 2) !== "0x") { + address = "0x" + address; + } + result2 = getChecksumAddress(address); + if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result2 !== address) { + logger.throwArgumentError("bad address checksum", "address", address); + } + } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + if (address.substring(2, 4) !== ibanChecksum(address)) { + logger.throwArgumentError("bad icap checksum", "address", address); + } + result2 = (0, bignumber_1._base36To16)(address.substring(4)); + while (result2.length < 40) { + result2 = "0" + result2; + } + result2 = getChecksumAddress("0x" + result2); + } else { + logger.throwArgumentError("invalid address", "address", address); + } + return result2; + } + exports2.getAddress = getAddress; + function isAddress(address) { + try { + getAddress(address); + return true; + } catch (error) { + } + return false; + } + exports2.isAddress = isAddress; + function getIcapAddress(address) { + var base36 = (0, bignumber_1._base16To36)(getAddress(address).substring(2)).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; + } + exports2.getIcapAddress = getIcapAddress; + function getContractAddress(transaction) { + var from = null; + try { + from = getAddress(transaction.from); + } catch (error) { + logger.throwArgumentError("missing from address", "transaction", transaction); + } + var nonce = (0, bytes_1.stripZeros)((0, bytes_1.arrayify)(bignumber_1.BigNumber.from(transaction.nonce).toHexString())); + return getAddress((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, rlp_1.encode)([from, nonce])), 12)); + } + exports2.getContractAddress = getContractAddress; + function getCreate2Address(from, salt, initCodeHash) { + if ((0, bytes_1.hexDataLength)(salt) !== 32) { + logger.throwArgumentError("salt must be 32 bytes", "salt", salt); + } + if ((0, bytes_1.hexDataLength)(initCodeHash) !== 32) { + logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); + } + return getAddress((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.concat)(["0xff", getAddress(from), salt, initCodeHash])), 12)); + } + exports2.getCreate2Address = getCreate2Address; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/address.js +var require_address = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/address.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AddressCoder = void 0; + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var AddressCoder = ( + /** @class */ + function(_super) { + __extends(AddressCoder2, _super); + function AddressCoder2(localName) { + return _super.call(this, "address", "address", localName, false) || this; + } + AddressCoder2.prototype.defaultValue = function() { + return "0x0000000000000000000000000000000000000000"; + }; + AddressCoder2.prototype.encode = function(writer, value) { + try { + value = (0, address_1.getAddress)(value); + } catch (error) { + this._throwError(error.message, value); + } + return writer.writeValue(value); + }; + AddressCoder2.prototype.decode = function(reader) { + return (0, address_1.getAddress)((0, bytes_1.hexZeroPad)(reader.readValue().toHexString(), 20)); + }; + return AddressCoder2; + }(abstract_coder_1.Coder) + ); + exports2.AddressCoder = AddressCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/anonymous.js +var require_anonymous = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/anonymous.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AnonymousCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var AnonymousCoder = ( + /** @class */ + function(_super) { + __extends(AnonymousCoder2, _super); + function AnonymousCoder2(coder) { + var _this = _super.call(this, coder.name, coder.type, void 0, coder.dynamic) || this; + _this.coder = coder; + return _this; + } + AnonymousCoder2.prototype.defaultValue = function() { + return this.coder.defaultValue(); + }; + AnonymousCoder2.prototype.encode = function(writer, value) { + return this.coder.encode(writer, value); + }; + AnonymousCoder2.prototype.decode = function(reader) { + return this.coder.decode(reader); + }; + return AnonymousCoder2; + }(abstract_coder_1.Coder) + ); + exports2.AnonymousCoder = AnonymousCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/array.js +var require_array = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/array.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ArrayCoder = exports2.unpack = exports2.pack = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var abstract_coder_1 = require_abstract_coder(); + var anonymous_1 = require_anonymous(); + function pack(writer, coders, values) { + var arrayValues = null; + if (Array.isArray(values)) { + arrayValues = values; + } else if (values && typeof values === "object") { + var unique_1 = {}; + arrayValues = coders.map(function(coder) { + var name2 = coder.localName; + if (!name2) { + logger.throwError("cannot encode object for signature with missing names", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + if (unique_1[name2]) { + logger.throwError("cannot encode object for signature with duplicate names", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + unique_1[name2] = true; + return values[name2]; + }); + } 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_1.Writer(writer.wordSize); + var dynamicWriter = new abstract_coder_1.Writer(writer.wordSize); + var updateFuncs = []; + coders.forEach(function(coder, index) { + var value = arrayValues[index]; + if (coder.dynamic) { + var dynamicOffset_1 = dynamicWriter.length; + coder.encode(dynamicWriter, value); + var updateFunc_1 = staticWriter.writeUpdatableValue(); + updateFuncs.push(function(baseOffset) { + updateFunc_1(baseOffset + dynamicOffset_1); + }); + } else { + coder.encode(staticWriter, value); + } + }); + updateFuncs.forEach(function(func) { + func(staticWriter.length); + }); + var length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; + } + exports2.pack = pack; + function unpack(reader, coders) { + var values = []; + 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) { + if (error.code === logger_1.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) { + if (error.code === logger_1.Logger.errors.BUFFER_OVERRUN) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value != void 0) { + values.push(value); + } + }); + var uniqueNames = coders.reduce(function(accum, coder) { + var name2 = coder.localName; + if (name2) { + if (!accum[name2]) { + accum[name2] = 0; + } + accum[name2]++; + } + return accum; + }, {}); + coders.forEach(function(coder, index) { + var name2 = coder.localName; + if (!name2 || uniqueNames[name2] !== 1) { + return; + } + if (name2 === "length") { + name2 = "_length"; + } + if (values[name2] != null) { + return; + } + var value = values[index]; + if (value instanceof Error) { + Object.defineProperty(values, name2, { + enumerable: true, + get: function() { + throw value; + } + }); + } else { + values[name2] = value; + } + }); + var _loop_1 = function(i2) { + var value = values[i2]; + if (value instanceof Error) { + Object.defineProperty(values, i2, { + enumerable: true, + get: function() { + throw value; + } + }); + } + }; + for (var i = 0; i < values.length; i++) { + _loop_1(i); + } + return Object.freeze(values); + } + exports2.unpack = unpack; + var ArrayCoder = ( + /** @class */ + function(_super) { + __extends(ArrayCoder2, _super); + function ArrayCoder2(coder, length, localName) { + var _this = this; + var type = coder.type + "[" + (length >= 0 ? length : "") + "]"; + var dynamic = length === -1 || coder.dynamic; + _this = _super.call(this, "array", type, localName, dynamic) || this; + _this.coder = coder; + _this.length = length; + return _this; + } + ArrayCoder2.prototype.defaultValue = function() { + var defaultChild = this.coder.defaultValue(); + var result2 = []; + for (var i = 0; i < this.length; i++) { + result2.push(defaultChild); + } + return result2; + }; + ArrayCoder2.prototype.encode = function(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); + }; + ArrayCoder2.prototype.decode = function(reader) { + var count = this.length; + if (count === -1) { + count = reader.readValue().toNumber(); + if (count * 32 > reader._data.length) { + logger.throwError("insufficient data length", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: reader._data.length, + count + }); + } + } + var coders = []; + for (var i = 0; i < count; i++) { + coders.push(new anonymous_1.AnonymousCoder(this.coder)); + } + return reader.coerce(this.name, unpack(reader, coders)); + }; + return ArrayCoder2; + }(abstract_coder_1.Coder) + ); + exports2.ArrayCoder = ArrayCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/boolean.js +var require_boolean = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/boolean.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BooleanCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var BooleanCoder = ( + /** @class */ + function(_super) { + __extends(BooleanCoder2, _super); + function BooleanCoder2(localName) { + return _super.call(this, "bool", "bool", localName, false) || this; + } + BooleanCoder2.prototype.defaultValue = function() { + return false; + }; + BooleanCoder2.prototype.encode = function(writer, value) { + return writer.writeValue(value ? 1 : 0); + }; + BooleanCoder2.prototype.decode = function(reader) { + return reader.coerce(this.type, !reader.readValue().isZero()); + }; + return BooleanCoder2; + }(abstract_coder_1.Coder) + ); + exports2.BooleanCoder = BooleanCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/bytes.js +var require_bytes = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/bytes.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BytesCoder = exports2.DynamicBytesCoder = void 0; + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var DynamicBytesCoder = ( + /** @class */ + function(_super) { + __extends(DynamicBytesCoder2, _super); + function DynamicBytesCoder2(type, localName) { + return _super.call(this, type, type, localName, true) || this; + } + DynamicBytesCoder2.prototype.defaultValue = function() { + return "0x"; + }; + DynamicBytesCoder2.prototype.encode = function(writer, value) { + value = (0, bytes_1.arrayify)(value); + var length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + }; + DynamicBytesCoder2.prototype.decode = function(reader) { + return reader.readBytes(reader.readValue().toNumber(), true); + }; + return DynamicBytesCoder2; + }(abstract_coder_1.Coder) + ); + exports2.DynamicBytesCoder = DynamicBytesCoder; + var BytesCoder = ( + /** @class */ + function(_super) { + __extends(BytesCoder2, _super); + function BytesCoder2(localName) { + return _super.call(this, "bytes", localName) || this; + } + BytesCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, bytes_1.hexlify)(_super.prototype.decode.call(this, reader))); + }; + return BytesCoder2; + }(DynamicBytesCoder) + ); + exports2.BytesCoder = BytesCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/fixed-bytes.js +var require_fixed_bytes = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/fixed-bytes.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FixedBytesCoder = void 0; + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var FixedBytesCoder = ( + /** @class */ + function(_super) { + __extends(FixedBytesCoder2, _super); + function FixedBytesCoder2(size, localName) { + var _this = this; + var name2 = "bytes" + String(size); + _this = _super.call(this, name2, name2, localName, false) || this; + _this.size = size; + return _this; + } + FixedBytesCoder2.prototype.defaultValue = function() { + return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); + }; + FixedBytesCoder2.prototype.encode = function(writer, value) { + var data = (0, bytes_1.arrayify)(value); + if (data.length !== this.size) { + this._throwError("incorrect data length", value); + } + return writer.writeBytes(data); + }; + FixedBytesCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, bytes_1.hexlify)(reader.readBytes(this.size))); + }; + return FixedBytesCoder2; + }(abstract_coder_1.Coder) + ); + exports2.FixedBytesCoder = FixedBytesCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/null.js +var require_null = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/null.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NullCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var NullCoder = ( + /** @class */ + function(_super) { + __extends(NullCoder2, _super); + function NullCoder2(localName) { + return _super.call(this, "null", "", localName, false) || this; + } + NullCoder2.prototype.defaultValue = function() { + return null; + }; + NullCoder2.prototype.encode = function(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes([]); + }; + NullCoder2.prototype.decode = function(reader) { + reader.readBytes(0); + return reader.coerce(this.name, null); + }; + return NullCoder2; + }(abstract_coder_1.Coder) + ); + exports2.NullCoder = NullCoder; + } +}); + +// node_modules/@ethersproject/constants/lib/addresses.js +var require_addresses = __commonJS({ + "node_modules/@ethersproject/constants/lib/addresses.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AddressZero = void 0; + exports2.AddressZero = "0x0000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib/bignumbers.js +var require_bignumbers = __commonJS({ + "node_modules/@ethersproject/constants/lib/bignumbers.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MaxInt256 = exports2.MinInt256 = exports2.MaxUint256 = exports2.WeiPerEther = exports2.Two = exports2.One = exports2.Zero = exports2.NegativeOne = void 0; + var bignumber_1 = require_lib3(); + var NegativeOne = /* @__PURE__ */ bignumber_1.BigNumber.from(-1); + exports2.NegativeOne = NegativeOne; + var Zero = /* @__PURE__ */ bignumber_1.BigNumber.from(0); + exports2.Zero = Zero; + var One = /* @__PURE__ */ bignumber_1.BigNumber.from(1); + exports2.One = One; + var Two = /* @__PURE__ */ bignumber_1.BigNumber.from(2); + exports2.Two = Two; + var WeiPerEther = /* @__PURE__ */ bignumber_1.BigNumber.from("1000000000000000000"); + exports2.WeiPerEther = WeiPerEther; + var MaxUint256 = /* @__PURE__ */ bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + exports2.MaxUint256 = MaxUint256; + var MinInt256 = /* @__PURE__ */ bignumber_1.BigNumber.from("-0x8000000000000000000000000000000000000000000000000000000000000000"); + exports2.MinInt256 = MinInt256; + var MaxInt256 = /* @__PURE__ */ bignumber_1.BigNumber.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + exports2.MaxInt256 = MaxInt256; + } +}); + +// node_modules/@ethersproject/constants/lib/hashes.js +var require_hashes = __commonJS({ + "node_modules/@ethersproject/constants/lib/hashes.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.HashZero = void 0; + exports2.HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib/strings.js +var require_strings = __commonJS({ + "node_modules/@ethersproject/constants/lib/strings.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherSymbol = void 0; + exports2.EtherSymbol = "\u039E"; + } +}); + +// node_modules/@ethersproject/constants/lib/index.js +var require_lib8 = __commonJS({ + "node_modules/@ethersproject/constants/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherSymbol = exports2.HashZero = exports2.MaxInt256 = exports2.MinInt256 = exports2.MaxUint256 = exports2.WeiPerEther = exports2.Two = exports2.One = exports2.Zero = exports2.NegativeOne = exports2.AddressZero = void 0; + var addresses_1 = require_addresses(); + Object.defineProperty(exports2, "AddressZero", { enumerable: true, get: function() { + return addresses_1.AddressZero; + } }); + var bignumbers_1 = require_bignumbers(); + Object.defineProperty(exports2, "NegativeOne", { enumerable: true, get: function() { + return bignumbers_1.NegativeOne; + } }); + Object.defineProperty(exports2, "Zero", { enumerable: true, get: function() { + return bignumbers_1.Zero; + } }); + Object.defineProperty(exports2, "One", { enumerable: true, get: function() { + return bignumbers_1.One; + } }); + Object.defineProperty(exports2, "Two", { enumerable: true, get: function() { + return bignumbers_1.Two; + } }); + Object.defineProperty(exports2, "WeiPerEther", { enumerable: true, get: function() { + return bignumbers_1.WeiPerEther; + } }); + Object.defineProperty(exports2, "MaxUint256", { enumerable: true, get: function() { + return bignumbers_1.MaxUint256; + } }); + Object.defineProperty(exports2, "MinInt256", { enumerable: true, get: function() { + return bignumbers_1.MinInt256; + } }); + Object.defineProperty(exports2, "MaxInt256", { enumerable: true, get: function() { + return bignumbers_1.MaxInt256; + } }); + var hashes_1 = require_hashes(); + Object.defineProperty(exports2, "HashZero", { enumerable: true, get: function() { + return hashes_1.HashZero; + } }); + var strings_1 = require_strings(); + Object.defineProperty(exports2, "EtherSymbol", { enumerable: true, get: function() { + return strings_1.EtherSymbol; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/coders/number.js +var require_number = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/number.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NumberCoder = void 0; + var bignumber_1 = require_lib3(); + var constants_1 = require_lib8(); + var abstract_coder_1 = require_abstract_coder(); + var NumberCoder = ( + /** @class */ + function(_super) { + __extends(NumberCoder2, _super); + function NumberCoder2(size, signed, localName) { + var _this = this; + var name2 = (signed ? "int" : "uint") + size * 8; + _this = _super.call(this, name2, name2, localName, false) || this; + _this.size = size; + _this.signed = signed; + return _this; + } + NumberCoder2.prototype.defaultValue = function() { + return 0; + }; + NumberCoder2.prototype.encode = function(writer, value) { + var v = bignumber_1.BigNumber.from(value); + var maxUintValue = constants_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(constants_1.One).mul(constants_1.NegativeOne))) { + this._throwError("value out-of-bounds", value); + } + } else if (v.lt(constants_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); + }; + NumberCoder2.prototype.decode = function(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 NumberCoder2; + }(abstract_coder_1.Coder) + ); + exports2.NumberCoder = NumberCoder; + } +}); + +// node_modules/@ethersproject/strings/lib/_version.js +var require_version8 = __commonJS({ + "node_modules/@ethersproject/strings/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "strings/5.5.0"; + } +}); + +// node_modules/@ethersproject/strings/lib/utf8.js +var require_utf8 = __commonJS({ + "node_modules/@ethersproject/strings/lib/utf8.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.toUtf8CodePoints = exports2.toUtf8String = exports2._toUtf8String = exports2._toEscapedUtf8String = exports2.toUtf8Bytes = exports2.Utf8ErrorFuncs = exports2.Utf8ErrorReason = exports2.UnicodeNormalizationForm = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version8(); + var logger = new logger_1.Logger(_version_1.version); + var UnicodeNormalizationForm; + (function(UnicodeNormalizationForm2) { + UnicodeNormalizationForm2["current"] = ""; + UnicodeNormalizationForm2["NFC"] = "NFC"; + UnicodeNormalizationForm2["NFD"] = "NFD"; + UnicodeNormalizationForm2["NFKC"] = "NFKC"; + UnicodeNormalizationForm2["NFKD"] = "NFKD"; + })(UnicodeNormalizationForm = exports2.UnicodeNormalizationForm || (exports2.UnicodeNormalizationForm = {})); + var Utf8ErrorReason; + (function(Utf8ErrorReason2) { + Utf8ErrorReason2["UNEXPECTED_CONTINUE"] = "unexpected continuation byte"; + Utf8ErrorReason2["BAD_PREFIX"] = "bad codepoint prefix"; + Utf8ErrorReason2["OVERRUN"] = "string overrun"; + Utf8ErrorReason2["MISSING_CONTINUE"] = "missing continuation byte"; + Utf8ErrorReason2["OUT_OF_RANGE"] = "out of UTF-8 range"; + Utf8ErrorReason2["UTF16_SURROGATE"] = "UTF-16 surrogate"; + Utf8ErrorReason2["OVERLONG"] = "overlong representation"; + })(Utf8ErrorReason = exports2.Utf8ErrorReason || (exports2.Utf8ErrorReason = {})); + function errorFunc(reason, offset, bytes, output, badCodepoint) { + return logger.throwArgumentError("invalid codepoint at offset " + offset + "; " + reason, "bytes", bytes); + } + function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + 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 !== 2) { + break; + } + i++; + } + return i; + } + if (reason === Utf8ErrorReason.OVERRUN) { + return bytes.length - offset - 1; + } + return 0; + } + function replaceFunc(reason, offset, bytes, output, badCodepoint) { + if (reason === Utf8ErrorReason.OVERLONG) { + output.push(badCodepoint); + return 0; + } + output.push(65533); + return ignoreFunc(reason, offset, bytes, output, badCodepoint); + } + exports2.Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc + }); + function getUtf8CodePoints(bytes, onError) { + if (onError == null) { + onError = exports2.Utf8ErrorFuncs.error; + } + bytes = (0, bytes_1.arrayify)(bytes); + var result2 = []; + var i = 0; + while (i < bytes.length) { + var c = bytes[i++]; + if (c >> 7 === 0) { + result2.push(c); + continue; + } + var extraLength = null; + var overlongMask = null; + if ((c & 224) === 192) { + extraLength = 1; + overlongMask = 127; + } else if ((c & 240) === 224) { + extraLength = 2; + overlongMask = 2047; + } else if ((c & 248) === 240) { + extraLength = 3; + overlongMask = 65535; + } else { + if ((c & 192) === 128) { + i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result2); + } else { + i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result2); + } + continue; + } + if (i - 1 + extraLength >= bytes.length) { + i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result2); + continue; + } + var res = c & (1 << 8 - extraLength - 1) - 1; + for (var j = 0; j < extraLength; j++) { + var nextChar = bytes[i]; + if ((nextChar & 192) != 128) { + i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result2); + res = null; + break; + } + ; + res = res << 6 | nextChar & 63; + i++; + } + if (res === null) { + continue; + } + if (res > 1114111) { + i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result2, res); + continue; + } + if (res >= 55296 && res <= 57343) { + i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result2, res); + continue; + } + if (res <= overlongMask) { + i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result2, res); + continue; + } + result2.push(res); + } + return result2; + } + function toUtf8Bytes(str, form) { + if (form === void 0) { + form = UnicodeNormalizationForm.current; + } + if (form != UnicodeNormalizationForm.current) { + logger.checkNormalize(); + str = str.normalize(form); + } + var result2 = []; + for (var i = 0; i < str.length; i++) { + var c = str.charCodeAt(i); + if (c < 128) { + result2.push(c); + } else if (c < 2048) { + result2.push(c >> 6 | 192); + result2.push(c & 63 | 128); + } else if ((c & 64512) == 55296) { + i++; + var c2 = str.charCodeAt(i); + if (i >= str.length || (c2 & 64512) !== 56320) { + throw new Error("invalid utf-8 string"); + } + var pair = 65536 + ((c & 1023) << 10) + (c2 & 1023); + result2.push(pair >> 18 | 240); + result2.push(pair >> 12 & 63 | 128); + result2.push(pair >> 6 & 63 | 128); + result2.push(pair & 63 | 128); + } else { + result2.push(c >> 12 | 224); + result2.push(c >> 6 & 63 | 128); + result2.push(c & 63 | 128); + } + } + return (0, bytes_1.arrayify)(result2); + } + exports2.toUtf8Bytes = toUtf8Bytes; + 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 <= 65535) { + return escapeChar(codePoint); + } + codePoint -= 65536; + return escapeChar((codePoint >> 10 & 1023) + 55296) + escapeChar((codePoint & 1023) + 56320); + }).join("") + '"'; + } + exports2._toEscapedUtf8String = _toEscapedUtf8String; + function _toUtf8String(codePoints) { + return codePoints.map(function(codePoint) { + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); + } + codePoint -= 65536; + return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320); + }).join(""); + } + exports2._toUtf8String = _toUtf8String; + function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); + } + exports2.toUtf8String = toUtf8String; + function toUtf8CodePoints(str, form) { + if (form === void 0) { + form = UnicodeNormalizationForm.current; + } + return getUtf8CodePoints(toUtf8Bytes(str, form)); + } + exports2.toUtf8CodePoints = toUtf8CodePoints; + } +}); + +// node_modules/@ethersproject/strings/lib/bytes32.js +var require_bytes32 = __commonJS({ + "node_modules/@ethersproject/strings/lib/bytes32.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.parseBytes32String = exports2.formatBytes32String = void 0; + var constants_1 = require_lib8(); + var bytes_1 = require_lib2(); + var utf8_1 = require_utf8(); + function formatBytes32String(text) { + var bytes = (0, utf8_1.toUtf8Bytes)(text); + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([bytes, constants_1.HashZero]).slice(0, 32)); + } + exports2.formatBytes32String = formatBytes32String; + function parseBytes32String(bytes) { + var data = (0, bytes_1.arrayify)(bytes); + 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"); + } + var length = 31; + while (data[length - 1] === 0) { + length--; + } + return (0, utf8_1.toUtf8String)(data.slice(0, length)); + } + exports2.parseBytes32String = parseBytes32String; + } +}); + +// node_modules/@ethersproject/strings/lib/idna.js +var require_idna = __commonJS({ + "node_modules/@ethersproject/strings/lib/idna.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.nameprep = exports2._nameprepTableC = exports2._nameprepTableB2 = exports2._nameprepTableA1 = void 0; + var utf8_1 = require_utf8(); + function bytes2(data) { + if (data.length % 4 !== 0) { + throw new Error("bad data"); + } + var result2 = []; + for (var i = 0; i < data.length; i += 4) { + result2.push(parseInt(data.substring(i, i + 4), 16)); + } + return result2; + } + function createTable(data, func) { + if (!func) { + func = function(value) { + return [parseInt(value, 16)]; + }; + } + var lo = 0; + var result2 = {}; + data.split(",").forEach(function(pair) { + var comps = pair.split(":"); + lo += parseInt(comps[0], 16); + result2[lo] = func(comps[1]); + }); + return result2; + } + 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"); + 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(value2) { + accum.push(value2); + }); + return accum; + }, []); + } + function _nameprepTableA1(codepoint) { + return !!matchMap(codepoint, Table_A_1_ranges); + } + exports2._nameprepTableA1 = _nameprepTableA1; + 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; + } + exports2._nameprepTableB2 = _nameprepTableB2; + function _nameprepTableC(codepoint) { + return !!matchMap(codepoint, Table_C_ranges); + } + exports2._nameprepTableC = _nameprepTableC; + function nameprep(value) { + if (value.match(/^[a-z0-9-]*$/i) && value.length <= 59) { + return value.toLowerCase(); + } + var codes = (0, utf8_1.toUtf8CodePoints)(value); + codes = flatten(codes.map(function(code) { + if (Table_B_1_flags.indexOf(code) >= 0) { + return []; + } + if (code >= 65024 && code <= 65039) { + return []; + } + var codesTableB2 = _nameprepTableB2(code); + if (codesTableB2) { + return codesTableB2; + } + return [code]; + })); + codes = (0, utf8_1.toUtf8CodePoints)((0, utf8_1._toUtf8String)(codes), utf8_1.UnicodeNormalizationForm.NFKC); + codes.forEach(function(code) { + if (_nameprepTableC(code)) { + throw new Error("STRINGPREP_CONTAINS_PROHIBITED"); + } + }); + codes.forEach(function(code) { + if (_nameprepTableA1(code)) { + throw new Error("STRINGPREP_CONTAINS_UNASSIGNED"); + } + }); + var name2 = (0, utf8_1._toUtf8String)(codes); + if (name2.substring(0, 1) === "-" || name2.substring(2, 4) === "--" || name2.substring(name2.length - 1) === "-") { + throw new Error("invalid hyphen"); + } + if (name2.length > 63) { + throw new Error("too long"); + } + return name2; + } + exports2.nameprep = nameprep; + } +}); + +// node_modules/@ethersproject/strings/lib/index.js +var require_lib9 = __commonJS({ + "node_modules/@ethersproject/strings/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.nameprep = exports2.parseBytes32String = exports2.formatBytes32String = exports2.UnicodeNormalizationForm = exports2.Utf8ErrorReason = exports2.Utf8ErrorFuncs = exports2.toUtf8String = exports2.toUtf8CodePoints = exports2.toUtf8Bytes = exports2._toEscapedUtf8String = void 0; + var bytes32_1 = require_bytes32(); + Object.defineProperty(exports2, "formatBytes32String", { enumerable: true, get: function() { + return bytes32_1.formatBytes32String; + } }); + Object.defineProperty(exports2, "parseBytes32String", { enumerable: true, get: function() { + return bytes32_1.parseBytes32String; + } }); + var idna_1 = require_idna(); + Object.defineProperty(exports2, "nameprep", { enumerable: true, get: function() { + return idna_1.nameprep; + } }); + var utf8_1 = require_utf8(); + Object.defineProperty(exports2, "_toEscapedUtf8String", { enumerable: true, get: function() { + return utf8_1._toEscapedUtf8String; + } }); + Object.defineProperty(exports2, "toUtf8Bytes", { enumerable: true, get: function() { + return utf8_1.toUtf8Bytes; + } }); + Object.defineProperty(exports2, "toUtf8CodePoints", { enumerable: true, get: function() { + return utf8_1.toUtf8CodePoints; + } }); + Object.defineProperty(exports2, "toUtf8String", { enumerable: true, get: function() { + return utf8_1.toUtf8String; + } }); + Object.defineProperty(exports2, "UnicodeNormalizationForm", { enumerable: true, get: function() { + return utf8_1.UnicodeNormalizationForm; + } }); + Object.defineProperty(exports2, "Utf8ErrorFuncs", { enumerable: true, get: function() { + return utf8_1.Utf8ErrorFuncs; + } }); + Object.defineProperty(exports2, "Utf8ErrorReason", { enumerable: true, get: function() { + return utf8_1.Utf8ErrorReason; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/coders/string.js +var require_string = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/string.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.StringCoder = void 0; + var strings_1 = require_lib9(); + var bytes_1 = require_bytes(); + var StringCoder = ( + /** @class */ + function(_super) { + __extends(StringCoder2, _super); + function StringCoder2(localName) { + return _super.call(this, "string", localName) || this; + } + StringCoder2.prototype.defaultValue = function() { + return ""; + }; + StringCoder2.prototype.encode = function(writer, value) { + return _super.prototype.encode.call(this, writer, (0, strings_1.toUtf8Bytes)(value)); + }; + StringCoder2.prototype.decode = function(reader) { + return (0, strings_1.toUtf8String)(_super.prototype.decode.call(this, reader)); + }; + return StringCoder2; + }(bytes_1.DynamicBytesCoder) + ); + exports2.StringCoder = StringCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/tuple.js +var require_tuple = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/tuple.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TupleCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var array_1 = require_array(); + var TupleCoder = ( + /** @class */ + function(_super) { + __extends(TupleCoder2, _super); + function TupleCoder2(coders, localName) { + var _this = this; + 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; + _this.coders = coders; + return _this; + } + TupleCoder2.prototype.defaultValue = function() { + var values = []; + this.coders.forEach(function(coder) { + values.push(coder.defaultValue()); + }); + var uniqueNames = this.coders.reduce(function(accum, coder) { + var name2 = coder.localName; + if (name2) { + if (!accum[name2]) { + accum[name2] = 0; + } + accum[name2]++; + } + return accum; + }, {}); + this.coders.forEach(function(coder, index) { + var name2 = coder.localName; + if (!name2 || uniqueNames[name2] !== 1) { + return; + } + if (name2 === "length") { + name2 = "_length"; + } + if (values[name2] != null) { + return; + } + values[name2] = values[index]; + }); + return Object.freeze(values); + }; + TupleCoder2.prototype.encode = function(writer, value) { + return (0, array_1.pack)(writer, this.coders, value); + }; + TupleCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, array_1.unpack)(reader, this.coders)); + }; + return TupleCoder2; + }(abstract_coder_1.Coder) + ); + exports2.TupleCoder = TupleCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/abi-coder.js +var require_abi_coder = __commonJS({ + "node_modules/@ethersproject/abi/lib/abi-coder.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultAbiCoder = exports2.AbiCoder = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var abstract_coder_1 = require_abstract_coder(); + var address_1 = require_address(); + var array_1 = require_array(); + var boolean_1 = require_boolean(); + var bytes_2 = require_bytes(); + var fixed_bytes_1 = require_fixed_bytes(); + var null_1 = require_null(); + var number_1 = require_number(); + var string_1 = require_string(); + var tuple_1 = require_tuple(); + var fragments_1 = require_fragments(); + var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); + var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); + var AbiCoder = ( + /** @class */ + function() { + function AbiCoder2(coerceFunc) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, AbiCoder2); + (0, properties_1.defineReadOnly)(this, "coerceFunc", coerceFunc || null); + } + AbiCoder2.prototype._getCoder = function(param) { + var _this = this; + switch (param.baseType) { + case "address": + return new address_1.AddressCoder(param.name); + case "bool": + return new boolean_1.BooleanCoder(param.name); + case "string": + return new string_1.StringCoder(param.name); + case "bytes": + return new bytes_2.BytesCoder(param.name); + case "array": + return new array_1.ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name); + case "tuple": + return new tuple_1.TupleCoder((param.components || []).map(function(component) { + return _this._getCoder(component); + }), param.name); + case "": + return new null_1.NullCoder(param.name); + } + 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 number_1.NumberCoder(size / 8, match[1] === "int", param.name); + } + 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 fixed_bytes_1.FixedBytesCoder(size, param.name); + } + return logger.throwArgumentError("invalid type", "type", param.type); + }; + AbiCoder2.prototype._getWordSize = function() { + return 32; + }; + AbiCoder2.prototype._getReader = function(data, allowLoose) { + return new abstract_coder_1.Reader(data, this._getWordSize(), this.coerceFunc, allowLoose); + }; + AbiCoder2.prototype._getWriter = function() { + return new abstract_coder_1.Writer(this._getWordSize()); + }; + AbiCoder2.prototype.getDefaultValue = function(types) { + var _this = this; + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + return coder.defaultValue(); + }; + AbiCoder2.prototype.encode = function(types, values) { + var _this = this; + if (types.length !== values.length) { + logger.throwError("types/values length mismatch", logger_1.Logger.errors.INVALID_ARGUMENT, { + count: { types: types.length, values: values.length }, + value: { types, values } + }); + } + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + var writer = this._getWriter(); + coder.encode(writer, values); + return writer.data; + }; + AbiCoder2.prototype.decode = function(types, data, loose) { + var _this = this; + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + return coder.decode(this._getReader((0, bytes_1.arrayify)(data), loose)); + }; + return AbiCoder2; + }() + ); + exports2.AbiCoder = AbiCoder; + exports2.defaultAbiCoder = new AbiCoder(); + } +}); + +// node_modules/@ethersproject/hash/lib/id.js +var require_id = __commonJS({ + "node_modules/@ethersproject/hash/lib/id.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.id = void 0; + var keccak256_1 = require_lib5(); + var strings_1 = require_lib9(); + function id(text) { + return (0, keccak256_1.keccak256)((0, strings_1.toUtf8Bytes)(text)); + } + exports2.id = id; + } +}); + +// node_modules/@ethersproject/hash/lib/_version.js +var require_version9 = __commonJS({ + "node_modules/@ethersproject/hash/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "hash/5.5.0"; + } +}); + +// node_modules/@ethersproject/hash/lib/namehash.js +var require_namehash = __commonJS({ + "node_modules/@ethersproject/hash/lib/namehash.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.namehash = exports2.isValidName = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + var keccak256_1 = require_lib5(); + var logger_1 = require_lib(); + var _version_1 = require_version9(); + var logger = new logger_1.Logger(_version_1.version); + var Zeros = new Uint8Array(32); + Zeros.fill(0); + var Partition = new RegExp("^((.*)\\.)?([^.]+)$"); + function isValidName(name2) { + try { + var comps = name2.split("."); + for (var i = 0; i < comps.length; i++) { + if ((0, strings_1.nameprep)(comps[i]).length === 0) { + throw new Error("empty"); + } + } + return true; + } catch (error) { + } + return false; + } + exports2.isValidName = isValidName; + function namehash(name2) { + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid ENS name; not a string", "name", name2); + } + var current = name2; + var result2 = Zeros; + while (current.length) { + var partition = current.match(Partition); + if (partition == null || partition[2] === "") { + logger.throwArgumentError("invalid ENS address; missing component", "name", name2); + } + var label = (0, strings_1.toUtf8Bytes)((0, strings_1.nameprep)(partition[3])); + result2 = (0, keccak256_1.keccak256)((0, bytes_1.concat)([result2, (0, keccak256_1.keccak256)(label)])); + current = partition[2] || ""; + } + return (0, bytes_1.hexlify)(result2); + } + exports2.namehash = namehash; + } +}); + +// node_modules/@ethersproject/hash/lib/message.js +var require_message = __commonJS({ + "node_modules/@ethersproject/hash/lib/message.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.hashMessage = exports2.messagePrefix = void 0; + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var strings_1 = require_lib9(); + exports2.messagePrefix = "Ethereum Signed Message:\n"; + function hashMessage(message) { + if (typeof message === "string") { + message = (0, strings_1.toUtf8Bytes)(message); + } + return (0, keccak256_1.keccak256)((0, bytes_1.concat)([ + (0, strings_1.toUtf8Bytes)(exports2.messagePrefix), + (0, strings_1.toUtf8Bytes)(String(message.length)), + message + ])); + } + exports2.hashMessage = hashMessage; + } +}); + +// node_modules/@ethersproject/hash/lib/typed-data.js +var require_typed_data = __commonJS({ + "node_modules/@ethersproject/hash/lib/typed-data.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypedDataEncoder = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version9(); + var logger = new logger_1.Logger(_version_1.version); + var id_1 = require_id(); + var padding = new Uint8Array(32); + padding.fill(0); + var NegativeOne = bignumber_1.BigNumber.from(-1); + var Zero = bignumber_1.BigNumber.from(0); + var One = bignumber_1.BigNumber.from(1); + var MaxUint256 = bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + function hexPadRight(value) { + var bytes = (0, bytes_1.arrayify)(value); + var padOffset = bytes.length % 32; + if (padOffset) { + return (0, bytes_1.hexConcat)([bytes, padding.slice(padOffset)]); + } + return (0, bytes_1.hexlify)(bytes); + } + var hexTrue = (0, bytes_1.hexZeroPad)(One.toHexString(), 32); + var hexFalse = (0, bytes_1.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 " + JSON.stringify(key), "domain." + key, value); + } + return value; + }; + } + var domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function(value) { + try { + return bignumber_1.BigNumber.from(value).toString(); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value for "chainId"', "domain.chainId", value); + }, + verifyingContract: function(value) { + try { + return (0, address_1.getAddress)(value).toLowerCase(); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value "verifyingContract"', "domain.verifyingContract", value); + }, + salt: function(value) { + try { + var bytes = (0, bytes_1.arrayify)(value); + if (bytes.length !== 32) { + throw new Error("bad length"); + } + return (0, bytes_1.hexlify)(bytes); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value "salt"', "domain.salt", value); + } + }; + function getBaseEncoder(type) { + { + 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_1 = MaxUint256.mask(signed ? width - 1 : width); + var boundsLower_1 = signed ? boundsUpper_1.add(One).mul(NegativeOne) : Zero; + return function(value) { + var v = bignumber_1.BigNumber.from(value); + if (v.lt(boundsLower_1) || v.gt(boundsUpper_1)) { + logger.throwArgumentError("value out-of-bounds for " + type, "value", value); + } + return (0, bytes_1.hexZeroPad)(v.toTwos(256).toHexString(), 32); + }; + } + } + { + var match = type.match(/^bytes(\d+)$/); + if (match) { + var width_1 = parseInt(match[1]); + if (width_1 === 0 || width_1 > 32 || match[1] !== String(width_1)) { + logger.throwArgumentError("invalid bytes width", "type", type); + } + return function(value) { + var bytes = (0, bytes_1.arrayify)(value); + if (bytes.length !== width_1) { + logger.throwArgumentError("invalid length for " + type, "value", value); + } + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": + return function(value) { + return (0, bytes_1.hexZeroPad)((0, address_1.getAddress)(value), 32); + }; + case "bool": + return function(value) { + return !value ? hexFalse : hexTrue; + }; + case "bytes": + return function(value) { + return (0, keccak256_1.keccak256)(value); + }; + case "string": + return function(value) { + return (0, id_1.id)(value); + }; + } + return null; + } + function encodeType(name2, fields) { + return name2 + "(" + fields.map(function(_a) { + var name3 = _a.name, type = _a.type; + return type + " " + name3; + }).join(",") + ")"; + } + var TypedDataEncoder = ( + /** @class */ + function() { + function TypedDataEncoder2(types) { + (0, properties_1.defineReadOnly)(this, "types", Object.freeze((0, properties_1.deepCopy)(types))); + (0, properties_1.defineReadOnly)(this, "_encoderCache", {}); + (0, properties_1.defineReadOnly)(this, "_types", {}); + var links = {}; + var parents = {}; + var subtypes = {}; + Object.keys(types).forEach(function(type) { + links[type] = {}; + parents[type] = []; + subtypes[type] = {}; + }); + var _loop_1 = function(name_12) { + var uniqueNames = {}; + types[name_12].forEach(function(field) { + if (uniqueNames[field.name]) { + logger.throwArgumentError("duplicate variable name " + JSON.stringify(field.name) + " in " + JSON.stringify(name_12), "types", types); + } + uniqueNames[field.name] = true; + var baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; + if (baseType === name_12) { + logger.throwArgumentError("circular type reference to " + JSON.stringify(baseType), "types", types); + } + var encoder = getBaseEncoder(baseType); + if (encoder) { + return; + } + if (!parents[baseType]) { + logger.throwArgumentError("unknown type " + JSON.stringify(baseType), "types", types); + } + parents[baseType].push(name_12); + links[name_12][baseType] = true; + }); + }; + for (var name_1 in types) { + _loop_1(name_1); + } + 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: " + primaryTypes.map(function(t) { + return JSON.stringify(t); + }).join(", "), "types", types); + } + (0, properties_1.defineReadOnly)(this, "primaryType", primaryTypes[0]); + function checkCircular(type, found) { + if (found[type]) { + logger.throwArgumentError("circular type reference to " + JSON.stringify(type), "types", types); + } + found[type] = true; + Object.keys(links[type]).forEach(function(child) { + if (!parents[child]) { + return; + } + checkCircular(child, found); + Object.keys(found).forEach(function(subtype) { + subtypes[subtype][child] = true; + }); + }); + delete found[type]; + } + checkCircular(this.primaryType, {}); + for (var name_2 in subtypes) { + var st = Object.keys(subtypes[name_2]); + st.sort(); + this._types[name_2] = encodeType(name_2, types[name_2]) + st.map(function(t) { + return encodeType(t, types[t]); + }).join(""); + } + } + TypedDataEncoder2.prototype.getEncoder = function(type) { + var encoder = this._encoderCache[type]; + if (!encoder) { + encoder = this._encoderCache[type] = this._getEncoder(type); + } + return encoder; + }; + TypedDataEncoder2.prototype._getEncoder = function(type) { + var _this = this; + { + var encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + var subtype_1 = match[1]; + var subEncoder_1 = this.getEncoder(subtype_1); + var length_1 = parseInt(match[3]); + return function(value) { + if (length_1 >= 0 && value.length !== length_1) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + var result2 = value.map(subEncoder_1); + if (_this._types[subtype_1]) { + result2 = result2.map(keccak256_1.keccak256); + } + return (0, keccak256_1.keccak256)((0, bytes_1.hexConcat)(result2)); + }; + } + var fields = this.types[type]; + if (fields) { + var encodedType_1 = (0, id_1.id)(this._types[type]); + return function(value) { + var values = fields.map(function(_a) { + var name2 = _a.name, type2 = _a.type; + var result2 = _this.getEncoder(type2)(value[name2]); + if (_this._types[type2]) { + return (0, keccak256_1.keccak256)(result2); + } + return result2; + }); + values.unshift(encodedType_1); + return (0, bytes_1.hexConcat)(values); + }; + } + return logger.throwArgumentError("unknown type: " + type, "type", type); + }; + TypedDataEncoder2.prototype.encodeType = function(name2) { + var result2 = this._types[name2]; + if (!result2) { + logger.throwArgumentError("unknown type: " + JSON.stringify(name2), "name", name2); + } + return result2; + }; + TypedDataEncoder2.prototype.encodeData = function(type, value) { + return this.getEncoder(type)(value); + }; + TypedDataEncoder2.prototype.hashStruct = function(name2, value) { + return (0, keccak256_1.keccak256)(this.encodeData(name2, value)); + }; + TypedDataEncoder2.prototype.encode = function(value) { + return this.encodeData(this.primaryType, value); + }; + TypedDataEncoder2.prototype.hash = function(value) { + return this.hashStruct(this.primaryType, value); + }; + TypedDataEncoder2.prototype._visit = function(type, value, callback) { + var _this = this; + { + var encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + var subtype_2 = match[1]; + var length_2 = parseInt(match[3]); + if (length_2 >= 0 && value.length !== length_2) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + return value.map(function(v) { + return _this._visit(subtype_2, v, callback); + }); + } + var fields = this.types[type]; + if (fields) { + return fields.reduce(function(accum, _a) { + var name2 = _a.name, type2 = _a.type; + accum[name2] = _this._visit(type2, value[name2], callback); + return accum; + }, {}); + } + return logger.throwArgumentError("unknown type: " + type, "type", type); + }; + TypedDataEncoder2.prototype.visit = function(value, callback) { + return this._visit(this.primaryType, value, callback); + }; + TypedDataEncoder2.from = function(types) { + return new TypedDataEncoder2(types); + }; + TypedDataEncoder2.getPrimaryType = function(types) { + return TypedDataEncoder2.from(types).primaryType; + }; + TypedDataEncoder2.hashStruct = function(name2, types, value) { + return TypedDataEncoder2.from(types).hashStruct(name2, value); + }; + TypedDataEncoder2.hashDomain = function(domain) { + var domainFields = []; + for (var name_3 in domain) { + var type = domainFieldTypes[name_3]; + if (!type) { + logger.throwArgumentError("invalid typed-data domain key: " + JSON.stringify(name_3), "domain", domain); + } + domainFields.push({ name: name_3, type }); + } + domainFields.sort(function(a, b) { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder2.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + }; + TypedDataEncoder2.encode = function(domain, types, value) { + return (0, bytes_1.hexConcat)([ + "0x1901", + TypedDataEncoder2.hashDomain(domain), + TypedDataEncoder2.from(types).hash(value) + ]); + }; + TypedDataEncoder2.hash = function(domain, types, value) { + return (0, keccak256_1.keccak256)(TypedDataEncoder2.encode(domain, types, value)); + }; + TypedDataEncoder2.resolveNames = function(domain, types, value, resolveName) { + return __awaiter(this, void 0, void 0, function() { + var ensCache, encoder, _a, _b, _i, name_4, _c, _d; + return __generator(this, function(_e) { + switch (_e.label) { + case 0: + domain = (0, properties_1.shallowCopy)(domain); + ensCache = {}; + if (domain.verifyingContract && !(0, bytes_1.isHexString)(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + encoder = TypedDataEncoder2.from(types); + encoder.visit(value, function(type, value2) { + if (type === "address" && !(0, bytes_1.isHexString)(value2, 20)) { + ensCache[value2] = "0x"; + } + return value2; + }); + _a = []; + for (_b in ensCache) + _a.push(_b); + _i = 0; + _e.label = 1; + case 1: + if (!(_i < _a.length)) return [3, 4]; + name_4 = _a[_i]; + _c = ensCache; + _d = name_4; + return [4, resolveName(name_4)]; + case 2: + _c[_d] = _e.sent(); + _e.label = 3; + case 3: + _i++; + return [3, 1]; + case 4: + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + value = encoder.visit(value, function(type, value2) { + if (type === "address" && ensCache[value2]) { + return ensCache[value2]; + } + return value2; + }); + return [2, { domain, value }]; + } + }); + }); + }; + TypedDataEncoder2.getPayload = function(domain, types, value) { + TypedDataEncoder2.hashDomain(domain); + var domainValues = {}; + var domainTypes = []; + domainFieldNames.forEach(function(name2) { + var value2 = domain[name2]; + if (value2 == null) { + return; + } + domainValues[name2] = domainChecks[name2](value2); + domainTypes.push({ name: name2, type: domainFieldTypes[name2] }); + }); + var encoder = TypedDataEncoder2.from(types); + var typesWithDomain = (0, properties_1.shallowCopy)(types); + if (typesWithDomain.EIP712Domain) { + logger.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + } else { + typesWithDomain.EIP712Domain = domainTypes; + } + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, function(type, value2) { + if (type.match(/^bytes(\d*)/)) { + return (0, bytes_1.hexlify)((0, bytes_1.arrayify)(value2)); + } + if (type.match(/^u?int/)) { + return bignumber_1.BigNumber.from(value2).toString(); + } + switch (type) { + case "address": + return value2.toLowerCase(); + case "bool": + return !!value2; + case "string": + if (typeof value2 !== "string") { + logger.throwArgumentError("invalid string", "value", value2); + } + return value2; + } + return logger.throwArgumentError("unsupported type", "type", type); + }) + }; + }; + return TypedDataEncoder2; + }() + ); + exports2.TypedDataEncoder = TypedDataEncoder; + } +}); + +// node_modules/@ethersproject/hash/lib/index.js +var require_lib10 = __commonJS({ + "node_modules/@ethersproject/hash/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._TypedDataEncoder = exports2.hashMessage = exports2.messagePrefix = exports2.isValidName = exports2.namehash = exports2.id = void 0; + var id_1 = require_id(); + Object.defineProperty(exports2, "id", { enumerable: true, get: function() { + return id_1.id; + } }); + var namehash_1 = require_namehash(); + Object.defineProperty(exports2, "isValidName", { enumerable: true, get: function() { + return namehash_1.isValidName; + } }); + Object.defineProperty(exports2, "namehash", { enumerable: true, get: function() { + return namehash_1.namehash; + } }); + var message_1 = require_message(); + Object.defineProperty(exports2, "hashMessage", { enumerable: true, get: function() { + return message_1.hashMessage; + } }); + Object.defineProperty(exports2, "messagePrefix", { enumerable: true, get: function() { + return message_1.messagePrefix; + } }); + var typed_data_1 = require_typed_data(); + Object.defineProperty(exports2, "_TypedDataEncoder", { enumerable: true, get: function() { + return typed_data_1.TypedDataEncoder; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/interface.js +var require_interface = __commonJS({ + "node_modules/@ethersproject/abi/lib/interface.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Interface = exports2.Indexed = exports2.ErrorDescription = exports2.TransactionDescription = exports2.LogDescription = exports2.checkResultErrors = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var abi_coder_1 = require_abi_coder(); + var abstract_coder_1 = require_abstract_coder(); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return abstract_coder_1.checkResultErrors; + } }); + var fragments_1 = require_fragments(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var LogDescription = ( + /** @class */ + function(_super) { + __extends(LogDescription2, _super); + function LogDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return LogDescription2; + }(properties_1.Description) + ); + exports2.LogDescription = LogDescription; + var TransactionDescription = ( + /** @class */ + function(_super) { + __extends(TransactionDescription2, _super); + function TransactionDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return TransactionDescription2; + }(properties_1.Description) + ); + exports2.TransactionDescription = TransactionDescription; + var ErrorDescription = ( + /** @class */ + function(_super) { + __extends(ErrorDescription2, _super); + function ErrorDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return ErrorDescription2; + }(properties_1.Description) + ); + exports2.ErrorDescription = ErrorDescription; + var Indexed = ( + /** @class */ + function(_super) { + __extends(Indexed2, _super); + function Indexed2() { + return _super !== null && _super.apply(this, arguments) || this; + } + Indexed2.isIndexed = function(value) { + return !!(value && value._isIndexed); + }; + return Indexed2; + }(properties_1.Description) + ); + exports2.Indexed = Indexed; + 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 " + property); + wrap.error = error; + return wrap; + } + var Interface = ( + /** @class */ + function() { + function Interface2(fragments) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Interface2); + var abi = []; + if (typeof fragments === "string") { + abi = JSON.parse(fragments); + } else { + abi = fragments; + } + (0, properties_1.defineReadOnly)(this, "fragments", abi.map(function(fragment) { + return fragments_1.Fragment.from(fragment); + }).filter(function(fragment) { + return fragment != null; + })); + (0, properties_1.defineReadOnly)(this, "_abiCoder", (0, properties_1.getStatic)(_newTarget, "getAbiCoder")()); + (0, properties_1.defineReadOnly)(this, "functions", {}); + (0, properties_1.defineReadOnly)(this, "errors", {}); + (0, properties_1.defineReadOnly)(this, "events", {}); + (0, properties_1.defineReadOnly)(this, "structs", {}); + this.fragments.forEach(function(fragment) { + var bucket = null; + switch (fragment.type) { + case "constructor": + if (_this.deploy) { + logger.warn("duplicate definition - constructor"); + return; + } + (0, properties_1.defineReadOnly)(_this, "deploy", fragment); + return; + case "function": + bucket = _this.functions; + break; + case "event": + 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 (!this.deploy) { + (0, properties_1.defineReadOnly)(this, "deploy", fragments_1.ConstructorFragment.from({ + payable: false, + type: "constructor" + })); + } + (0, properties_1.defineReadOnly)(this, "_isInterface", true); + } + Interface2.prototype.format = function(format) { + if (!format) { + format = fragments_1.FormatTypes.full; + } + if (format === fragments_1.FormatTypes.sighash) { + logger.throwArgumentError("interface does not support formatting sighash", "format", format); + } + var abi = this.fragments.map(function(fragment) { + return fragment.format(format); + }); + if (format === fragments_1.FormatTypes.json) { + return JSON.stringify(abi.map(function(j) { + return JSON.parse(j); + })); + } + return abi; + }; + Interface2.getAbiCoder = function() { + return abi_coder_1.defaultAbiCoder; + }; + Interface2.getAddress = function(address) { + return (0, address_1.getAddress)(address); + }; + Interface2.getSighash = function(fragment) { + return (0, bytes_1.hexDataSlice)((0, hash_1.id)(fragment.format()), 0, 4); + }; + Interface2.getEventTopic = function(eventFragment) { + return (0, hash_1.id)(eventFragment.format()); + }; + Interface2.prototype.getFunction = function(nameOrSignatureOrSighash) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrSighash)) { + for (var name_1 in this.functions) { + if (nameOrSignatureOrSighash === this.getSighash(name_1)) { + return this.functions[name_1]; + } + } + logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var name_2 = nameOrSignatureOrSighash.trim(); + var matching = Object.keys(this.functions).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_2; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching function", "name", name_2); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching functions", "name", name_2); + } + return this.functions[matching[0]]; + } + var result2 = this.functions[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result2) { + logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + } + return result2; + }; + Interface2.prototype.getEvent = function(nameOrSignatureOrTopic) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrTopic)) { + var topichash = nameOrSignatureOrTopic.toLowerCase(); + for (var name_3 in this.events) { + if (topichash === this.getEventTopic(name_3)) { + return this.events[name_3]; + } + } + logger.throwArgumentError("no matching event", "topichash", topichash); + } + if (nameOrSignatureOrTopic.indexOf("(") === -1) { + var name_4 = nameOrSignatureOrTopic.trim(); + var matching = Object.keys(this.events).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_4; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching event", "name", name_4); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching events", "name", name_4); + } + return this.events[matching[0]]; + } + var result2 = this.events[fragments_1.EventFragment.fromString(nameOrSignatureOrTopic).format()]; + if (!result2) { + logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + } + return result2; + }; + Interface2.prototype.getError = function(nameOrSignatureOrSighash) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrSighash)) { + var getSighash = (0, properties_1.getStatic)(this.constructor, "getSighash"); + for (var name_5 in this.errors) { + var error = this.errors[name_5]; + if (nameOrSignatureOrSighash === getSighash(error)) { + return this.errors[name_5]; + } + } + logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var name_6 = nameOrSignatureOrSighash.trim(); + var matching = Object.keys(this.errors).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_6; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching error", "name", name_6); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching errors", "name", name_6); + } + return this.errors[matching[0]]; + } + var result2 = this.errors[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result2) { + logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + } + return result2; + }; + Interface2.prototype.getSighash = function(fragment) { + if (typeof fragment === "string") { + try { + fragment = this.getFunction(fragment); + } catch (error) { + try { + fragment = this.getError(fragment); + } catch (_) { + throw error; + } + } + } + return (0, properties_1.getStatic)(this.constructor, "getSighash")(fragment); + }; + Interface2.prototype.getEventTopic = function(eventFragment) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + return (0, properties_1.getStatic)(this.constructor, "getEventTopic")(eventFragment); + }; + Interface2.prototype._decodeParams = function(params2, data) { + return this._abiCoder.decode(params2, data); + }; + Interface2.prototype._encodeParams = function(params2, values) { + return this._abiCoder.encode(params2, values); + }; + Interface2.prototype.encodeDeploy = function(values) { + return this._encodeParams(this.deploy.inputs, values || []); + }; + Interface2.prototype.decodeErrorResult = function(fragment, data) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + var bytes = (0, bytes_1.arrayify)(data); + if ((0, bytes_1.hexlify)(bytes.slice(0, 4)) !== this.getSighash(fragment)) { + logger.throwArgumentError("data signature does not match error " + fragment.name + ".", "data", (0, bytes_1.hexlify)(bytes)); + } + return this._decodeParams(fragment.inputs, bytes.slice(4)); + }; + Interface2.prototype.encodeErrorResult = function(fragment, values) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.getSighash(fragment), + this._encodeParams(fragment.inputs, values || []) + ])); + }; + Interface2.prototype.decodeFunctionData = function(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + var bytes = (0, bytes_1.arrayify)(data); + if ((0, bytes_1.hexlify)(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { + logger.throwArgumentError("data signature does not match function " + functionFragment.name + ".", "data", (0, bytes_1.hexlify)(bytes)); + } + return this._decodeParams(functionFragment.inputs, bytes.slice(4)); + }; + Interface2.prototype.encodeFunctionData = function(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.getSighash(functionFragment), + this._encodeParams(functionFragment.inputs, values || []) + ])); + }; + Interface2.prototype.decodeFunctionResult = function(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + var bytes = (0, bytes_1.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 (error2) { + } + break; + case 4: { + var selector = (0, bytes_1.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 (error2) { + console.log(error2); + } + } + break; + } + } + return logger.throwError("call revert exception", logger_1.Logger.errors.CALL_EXCEPTION, { + method: functionFragment.format(), + errorArgs, + errorName, + errorSignature, + reason + }); + }; + Interface2.prototype.encodeFunctionResult = function(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return (0, bytes_1.hexlify)(this._abiCoder.encode(functionFragment.outputs, values || [])); + }; + Interface2.prototype.encodeFilterTopics = function(eventFragment, values) { + var _this = this; + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (values.length > eventFragment.inputs.length) { + logger.throwError("too many arguments for " + eventFragment.format(), logger_1.Logger.errors.UNEXPECTED_ARGUMENT, { + argument: "values", + value: values + }); + } + var topics = []; + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + var encodeTopic = function(param, value) { + if (param.type === "string") { + return (0, hash_1.id)(value); + } else if (param.type === "bytes") { + return (0, keccak256_1.keccak256)((0, bytes_1.hexlify)(value)); + } + if (param.type === "address") { + _this._abiCoder.encode(["address"], [value]); + } + return (0, bytes_1.hexZeroPad)((0, bytes_1.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(value2) { + return encodeTopic(param, value2); + })); + } else { + topics.push(encodeTopic(param, value)); + } + }); + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + }; + Interface2.prototype.encodeEventLog = function(eventFragment, values) { + var _this = 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((0, hash_1.id)(value)); + } else if (param.type === "bytes") { + topics.push((0, keccak256_1.keccak256)(value)); + } else if (param.baseType === "tuple" || param.baseType === "array") { + throw new Error("not implemented"); + } else { + topics.push(_this._abiCoder.encode([param.type], [value])); + } + } else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this._abiCoder.encode(dataTypes, dataValues), + topics + }; + }; + Interface2.prototype.decodeEventLog = function(eventFragment, data, topics) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (topics != null && !eventFragment.anonymous) { + var topicHash = this.getEventTopic(eventFragment); + if (!(0, bytes_1.isHexString)(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { + logger.throwError("fragment/topic mismatch", logger_1.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_1.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, (0, bytes_1.concat)(topics)) : null; + var resultNonIndexed = this._abiCoder.decode(nonIndexed, data, true); + var result2 = []; + var nonIndexedIndex = 0, indexedIndex = 0; + eventFragment.inputs.forEach(function(param, index) { + if (param.indexed) { + if (resultIndexed == null) { + result2[index] = new Indexed({ _isIndexed: true, hash: null }); + } else if (dynamic[index]) { + result2[index] = new Indexed({ _isIndexed: true, hash: resultIndexed[indexedIndex++] }); + } else { + try { + result2[index] = resultIndexed[indexedIndex++]; + } catch (error) { + result2[index] = error; + } + } + } else { + try { + result2[index] = resultNonIndexed[nonIndexedIndex++]; + } catch (error) { + result2[index] = error; + } + } + if (param.name && result2[param.name] == null) { + var value_1 = result2[index]; + if (value_1 instanceof Error) { + Object.defineProperty(result2, param.name, { + enumerable: true, + get: function() { + throw wrapAccessError("property " + JSON.stringify(param.name), value_1); + } + }); + } else { + result2[param.name] = value_1; + } + } + }); + var _loop_1 = function(i2) { + var value = result2[i2]; + if (value instanceof Error) { + Object.defineProperty(result2, i2, { + enumerable: true, + get: function() { + throw wrapAccessError("index " + i2, value); + } + }); + } + }; + for (var i = 0; i < result2.length; i++) { + _loop_1(i); + } + return Object.freeze(result2); + }; + Interface2.prototype.parseTransaction = function(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: bignumber_1.BigNumber.from(tx.value || "0") + }); + }; + Interface2.prototype.parseLog = function(log) { + var fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + return new LogDescription({ + eventFragment: fragment, + name: fragment.name, + signature: fragment.format(), + topic: this.getEventTopic(fragment), + args: this.decodeEventLog(fragment, log.data, log.topics) + }); + }; + Interface2.prototype.parseError = function(data) { + var hexData = (0, bytes_1.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) + }); + }; + Interface2.isInterface = function(value) { + return !!(value && value._isInterface); + }; + return Interface2; + }() + ); + exports2.Interface = Interface; + } +}); + +// node_modules/@ethersproject/abi/lib/index.js +var require_lib11 = __commonJS({ + "node_modules/@ethersproject/abi/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TransactionDescription = exports2.LogDescription = exports2.checkResultErrors = exports2.Indexed = exports2.Interface = exports2.defaultAbiCoder = exports2.AbiCoder = exports2.FormatTypes = exports2.ParamType = exports2.FunctionFragment = exports2.Fragment = exports2.EventFragment = exports2.ErrorFragment = exports2.ConstructorFragment = void 0; + var fragments_1 = require_fragments(); + Object.defineProperty(exports2, "ConstructorFragment", { enumerable: true, get: function() { + return fragments_1.ConstructorFragment; + } }); + Object.defineProperty(exports2, "ErrorFragment", { enumerable: true, get: function() { + return fragments_1.ErrorFragment; + } }); + Object.defineProperty(exports2, "EventFragment", { enumerable: true, get: function() { + return fragments_1.EventFragment; + } }); + Object.defineProperty(exports2, "FormatTypes", { enumerable: true, get: function() { + return fragments_1.FormatTypes; + } }); + Object.defineProperty(exports2, "Fragment", { enumerable: true, get: function() { + return fragments_1.Fragment; + } }); + Object.defineProperty(exports2, "FunctionFragment", { enumerable: true, get: function() { + return fragments_1.FunctionFragment; + } }); + Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() { + return fragments_1.ParamType; + } }); + var abi_coder_1 = require_abi_coder(); + Object.defineProperty(exports2, "AbiCoder", { enumerable: true, get: function() { + return abi_coder_1.AbiCoder; + } }); + Object.defineProperty(exports2, "defaultAbiCoder", { enumerable: true, get: function() { + return abi_coder_1.defaultAbiCoder; + } }); + var interface_1 = require_interface(); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return interface_1.checkResultErrors; + } }); + Object.defineProperty(exports2, "Indexed", { enumerable: true, get: function() { + return interface_1.Indexed; + } }); + Object.defineProperty(exports2, "Interface", { enumerable: true, get: function() { + return interface_1.Interface; + } }); + Object.defineProperty(exports2, "LogDescription", { enumerable: true, get: function() { + return interface_1.LogDescription; + } }); + Object.defineProperty(exports2, "TransactionDescription", { enumerable: true, get: function() { + return interface_1.TransactionDescription; + } }); + } +}); + +// node_modules/@ethersproject/abstract-provider/lib/_version.js +var require_version10 = __commonJS({ + "node_modules/@ethersproject/abstract-provider/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abstract-provider/5.5.1"; + } +}); + +// node_modules/@ethersproject/abstract-provider/lib/index.js +var require_lib12 = __commonJS({ + "node_modules/@ethersproject/abstract-provider/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Provider = exports2.TransactionOrderForkEvent = exports2.TransactionForkEvent = exports2.BlockForkEvent = exports2.ForkEvent = void 0; + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version10(); + var logger = new logger_1.Logger(_version_1.version); + var ForkEvent = ( + /** @class */ + function(_super) { + __extends(ForkEvent2, _super); + function ForkEvent2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ForkEvent2.isForkEvent = function(value) { + return !!(value && value._isForkEvent); + }; + return ForkEvent2; + }(properties_1.Description) + ); + exports2.ForkEvent = ForkEvent; + var BlockForkEvent = ( + /** @class */ + function(_super) { + __extends(BlockForkEvent2, _super); + function BlockForkEvent2(blockHash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(blockHash, 32)) { + logger.throwArgumentError("invalid blockHash", "blockHash", blockHash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isBlockForkEvent: true, + expiry: expiry || 0, + blockHash + }) || this; + return _this; + } + return BlockForkEvent2; + }(ForkEvent) + ); + exports2.BlockForkEvent = BlockForkEvent; + var TransactionForkEvent = ( + /** @class */ + function(_super) { + __extends(TransactionForkEvent2, _super); + function TransactionForkEvent2(hash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(hash, 32)) { + logger.throwArgumentError("invalid transaction hash", "hash", hash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isTransactionForkEvent: true, + expiry: expiry || 0, + hash + }) || this; + return _this; + } + return TransactionForkEvent2; + }(ForkEvent) + ); + exports2.TransactionForkEvent = TransactionForkEvent; + var TransactionOrderForkEvent = ( + /** @class */ + function(_super) { + __extends(TransactionOrderForkEvent2, _super); + function TransactionOrderForkEvent2(beforeHash, afterHash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(beforeHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash); + } + if (!(0, bytes_1.isHexString)(afterHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isTransactionOrderForkEvent: true, + expiry: expiry || 0, + beforeHash, + afterHash + }) || this; + return _this; + } + return TransactionOrderForkEvent2; + }(ForkEvent) + ); + exports2.TransactionOrderForkEvent = TransactionOrderForkEvent; + var Provider = ( + /** @class */ + function() { + function Provider2() { + var _newTarget = this.constructor; + logger.checkAbstract(_newTarget, Provider2); + (0, properties_1.defineReadOnly)(this, "_isProvider", true); + } + Provider2.prototype.getFeeData = function() { + return __awaiter(this, void 0, void 0, function() { + var _a, block, gasPrice, maxFeePerGas, maxPriorityFeePerGas; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, (0, properties_1.resolveProperties)({ + block: this.getBlock("latest"), + gasPrice: this.getGasPrice().catch(function(error) { + return null; + }) + })]; + case 1: + _a = _b.sent(), block = _a.block, gasPrice = _a.gasPrice; + maxFeePerGas = null, maxPriorityFeePerGas = null; + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = bignumber_1.BigNumber.from("2500000000"); + maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); + } + return [2, { maxFeePerGas, maxPriorityFeePerGas, gasPrice }]; + } + }); + }); + }; + Provider2.prototype.addListener = function(eventName, listener) { + return this.on(eventName, listener); + }; + Provider2.prototype.removeListener = function(eventName, listener) { + return this.off(eventName, listener); + }; + Provider2.isProvider = function(value) { + return !!(value && value._isProvider); + }; + return Provider2; + }() + ); + exports2.Provider = Provider; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib/_version.js +var require_version11 = __commonJS({ + "node_modules/@ethersproject/abstract-signer/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abstract-signer/5.5.0"; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib/index.js +var require_lib13 = __commonJS({ + "node_modules/@ethersproject/abstract-signer/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.VoidSigner = exports2.Signer = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version11(); + var logger = new logger_1.Logger(_version_1.version); + var allowedTransactionKeys = [ + "accessList", + "chainId", + "customData", + "data", + "from", + "gasLimit", + "gasPrice", + "maxFeePerGas", + "maxPriorityFeePerGas", + "nonce", + "to", + "type", + "value" + ]; + var forwardErrors = [ + logger_1.Logger.errors.INSUFFICIENT_FUNDS, + logger_1.Logger.errors.NONCE_EXPIRED, + logger_1.Logger.errors.REPLACEMENT_UNDERPRICED + ]; + var Signer = ( + /** @class */ + function() { + function Signer2() { + var _newTarget = this.constructor; + logger.checkAbstract(_newTarget, Signer2); + (0, properties_1.defineReadOnly)(this, "_isSigner", true); + } + Signer2.prototype.getBalance = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getBalance"); + return [4, this.provider.getBalance(this.getAddress(), blockTag)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getTransactionCount = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getTransactionCount"); + return [4, this.provider.getTransactionCount(this.getAddress(), blockTag)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.estimateGas = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("estimateGas"); + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + return [4, this.provider.estimateGas(tx)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.call = function(transaction, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("call"); + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + return [4, this.provider.call(tx, blockTag)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.sendTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx, signedTx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("sendTransaction"); + return [4, this.populateTransaction(transaction)]; + case 1: + tx = _a.sent(); + return [4, this.signTransaction(tx)]; + case 2: + signedTx = _a.sent(); + return [4, this.provider.sendTransaction(signedTx)]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getChainId = function() { + return __awaiter(this, void 0, void 0, function() { + var network; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getChainId"); + return [4, this.provider.getNetwork()]; + case 1: + network = _a.sent(); + return [2, network.chainId]; + } + }); + }); + }; + Signer2.prototype.getGasPrice = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getGasPrice"); + return [4, this.provider.getGasPrice()]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getFeeData = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getFeeData"); + return [4, this.provider.getFeeData()]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.resolveName = function(name2) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("resolveName"); + return [4, this.provider.resolveName(name2)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.checkTransaction = function(transaction) { + for (var key in transaction) { + if (allowedTransactionKeys.indexOf(key) === -1) { + logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); + } + } + var tx = (0, properties_1.shallowCopy)(transaction); + if (tx.from == null) { + tx.from = this.getAddress(); + } else { + tx.from = Promise.all([ + Promise.resolve(tx.from), + this.getAddress() + ]).then(function(result2) { + if (result2[0].toLowerCase() !== result2[1].toLowerCase()) { + logger.throwArgumentError("from address mismatch", "transaction", transaction); + } + return result2[0]; + }); + } + return tx; + }; + Signer2.prototype.populateTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx, hasEip1559, feeData, gasPrice; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + if (tx.to != null) { + tx.to = Promise.resolve(tx.to).then(function(to) { + return __awaiter(_this, void 0, void 0, function() { + var address; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + if (to == null) { + return [2, null]; + } + return [4, this.resolveName(to)]; + case 1: + address = _a2.sent(); + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return [2, address]; + } + }); + }); + }); + tx.to.catch(function(error) { + }); + } + 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))) return [3, 2]; + tx.type = 2; + return [3, 5]; + case 2: + if (!(tx.type === 0 || tx.type === 1)) return [3, 3]; + if (tx.gasPrice == null) { + tx.gasPrice = this.getGasPrice(); + } + return [3, 5]; + case 3: + return [4, this.getFeeData()]; + case 4: + feeData = _a.sent(); + if (tx.type == null) { + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + tx.type = 2; + if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + delete tx.gasPrice; + tx.maxFeePerGas = gasPrice; + tx.maxPriorityFeePerGas = gasPrice; + } else { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } else if (feeData.gasPrice != null) { + if (hasEip1559) { + logger.throwError("network does not support EIP-1559", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "populateTransaction" + }); + } + if (tx.gasPrice == null) { + tx.gasPrice = feeData.gasPrice; + } + tx.type = 0; + } else { + logger.throwError("failed to get consistent fee data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signer.getFeeData" + }); + } + } else if (tx.type === 2) { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + _a.label = 5; + case 5: + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + 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]; + }); + } + return [4, (0, properties_1.resolveProperties)(tx)]; + case 6: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype._checkProvider = function(operation) { + if (!this.provider) { + logger.throwError("missing provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: operation || "_checkProvider" + }); + } + }; + Signer2.isSigner = function(value) { + return !!(value && value._isSigner); + }; + return Signer2; + }() + ); + exports2.Signer = Signer; + var VoidSigner = ( + /** @class */ + function(_super) { + __extends(VoidSigner2, _super); + function VoidSigner2(address, provider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, VoidSigner2); + _this = _super.call(this) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "provider", provider || null); + return _this; + } + VoidSigner2.prototype.getAddress = function() { + return Promise.resolve(this.address); + }; + VoidSigner2.prototype._fail = function(message, operation) { + return Promise.resolve().then(function() { + logger.throwError(message, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation }); + }); + }; + VoidSigner2.prototype.signMessage = function(message) { + return this._fail("VoidSigner cannot sign messages", "signMessage"); + }; + VoidSigner2.prototype.signTransaction = function(transaction) { + return this._fail("VoidSigner cannot sign transactions", "signTransaction"); + }; + VoidSigner2.prototype._signTypedData = function(domain, types, value) { + return this._fail("VoidSigner cannot sign typed data", "signTypedData"); + }; + VoidSigner2.prototype.connect = function(provider) { + return new VoidSigner2(this.address, provider); + }; + return VoidSigner2; + }(Signer) + ); + exports2.VoidSigner = VoidSigner; + } +}); + +// node_modules/elliptic/package.json +var require_package = __commonJS({ + "node_modules/elliptic/package.json"(exports2, module2) { + module2.exports = { + name: "elliptic", + version: "6.5.4", + description: "EC cryptography", + main: "lib/elliptic.js", + files: [ + "lib" + ], + scripts: { + lint: "eslint lib test", + "lint:fix": "npm run lint -- --fix", + unit: "istanbul test _mocha --reporter=spec test/index.js", + test: "npm run lint && npm run unit", + version: "grunt dist && git add dist/" + }, + repository: { + type: "git", + url: "git@github.com:indutny/elliptic" + }, + keywords: [ + "EC", + "Elliptic", + "curve", + "Cryptography" + ], + author: "Fedor Indutny ", + license: "MIT", + bugs: { + url: "https://github.com/indutny/elliptic/issues" + }, + homepage: "https://github.com/indutny/elliptic", + devDependencies: { + brfs: "^2.0.2", + coveralls: "^3.1.0", + eslint: "^7.6.0", + grunt: "^1.2.1", + "grunt-browserify": "^5.3.0", + "grunt-cli": "^1.3.2", + "grunt-contrib-connect": "^3.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^5.0.0", + "grunt-mocha-istanbul": "^5.0.2", + "grunt-saucelabs": "^9.0.1", + istanbul: "^0.4.5", + mocha: "^8.0.1" + }, + dependencies: { + "bn.js": "^4.11.9", + brorand: "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + inherits: "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }; + } +}); + +// node_modules/minimalistic-assert/index.js +var require_minimalistic_assert = __commonJS({ + "node_modules/minimalistic-assert/index.js"(exports2, module2) { + module2.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/minimalistic-crypto-utils/lib/utils.js +var require_utils = __commonJS({ + "node_modules/minimalistic-crypto-utils/lib/utils.js"(exports2) { + "use strict"; + var utils = exports2; + 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 & 255; + 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; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/utils.js +var require_utils2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/utils.js"(exports2) { + "use strict"; + var utils = exports2; + var BN = require_bn(); + var minAssert = require_minimalistic_assert(); + var minUtils = require_utils(); + utils.assert = minAssert; + utils.toArray = minUtils.toArray; + utils.zero2 = minUtils.zero2; + utils.toHex = minUtils.toHex; + utils.encode = minUtils.encode; + 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; + 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) { + 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); + 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, name2, computer) { + var key = "_" + name2; + obj.prototype[name2] = function cachedProperty2() { + return this[key] !== void 0 ? 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(bytes, "hex", "le"); + } + utils.intFromLE = intFromLE; + } +}); + +// node_modules/brorand/index.js +var require_brorand = __commonJS({ + "node_modules/brorand/index.js"(exports2, module2) { + var r; + module2.exports = function rand(len) { + if (!r) + r = new Rand(null); + return r.generate(len); + }; + function Rand(rand) { + this.rand = rand; + } + module2.exports.Rand = Rand; + Rand.prototype.generate = function generate(len) { + return this._rand(len); + }; + Rand.prototype._rand = function _rand(n) { + if (this.rand.getBytes) + return this.rand.getBytes(n); + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; + }; + if (typeof self === "object") { + if (self.crypto && self.crypto.getRandomValues) { + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.crypto.getRandomValues(arr); + return arr; + }; + } else if (self.msCrypto && self.msCrypto.getRandomValues) { + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.msCrypto.getRandomValues(arr); + return arr; + }; + } else if (typeof window === "object") { + Rand.prototype._rand = function() { + throw new Error("Not implemented yet"); + }; + } + } else { + try { + crypto2 = require("crypto"); + if (typeof crypto2.randomBytes !== "function") + throw new Error("Not supported"); + Rand.prototype._rand = function _rand(n) { + return crypto2.randomBytes(n); + }; + } catch (e) { + } + } + var crypto2; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/base.js +var require_base = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/base.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var getNAF = utils.getNAF; + var getJSF = utils.getJSF; + var assert = utils.assert; + function BaseCurve(type, conf) { + this.type = type; + this.p = new BN(conf.p, 16); + this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); + this.zero = new BN(0).toRed(this.red); + this.one = new BN(1).toRed(this.red); + this.two = new BN(2).toRed(this.red); + this.n = conf.n && new BN(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + 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; + 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); + } + } + module2.exports = 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(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; + 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; + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + var naf = getNAF(k, w, this._bitLength); + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + 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(z !== 0); + if (p.type === "affine") { + if (z > 0) + acc = acc.mixedAdd(wnd[z - 1 >> 1]); + else + acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()); + } else { + 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; + 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; + } + 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 */ + ]; + 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); + } + } + 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 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.toArray(bytes, enc); + var len = this.p.byteLength(); + if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) { + if (bytes[0] === 6) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 7) + assert(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] === 2 || bytes[0] === 3) && bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3); + } + 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() ? 2 : 3].concat(x); + return [4].concat(x, this.getY().toArray("be", len)); + }; + BasePoint.prototype.encode = function encode(enc, compact) { + return utils.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, + 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, + 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; + }; + } +}); + +// node_modules/inherits/inherits_browser.js +var require_inherits_browser = __commonJS({ + "node_modules/inherits/inherits_browser.js"(exports2, module2) { + if (typeof Object.create === "function") { + module2.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 { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } + } +}); + +// node_modules/inherits/inherits.js +var require_inherits = __commonJS({ + "node_modules/inherits/inherits.js"(exports2, module2) { + try { + util = require("util"); + if (typeof util.inherits !== "function") throw ""; + module2.exports = util.inherits; + } catch (e) { + module2.exports = require_inherits_browser(); + } + var util; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/short.js +var require_short = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/short.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var assert = utils.assert; + function ShortCurve(conf) { + Base.call(this, "short", conf); + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(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; + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); + } + inherits(ShortCurve, Base); + module2.exports = ShortCurve; + ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + var beta; + var lambda; + if (conf.beta) { + beta = new BN(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new BN(conf.lambda, 16); + } else { + 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(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new BN(vec.a, 16), + b: new BN(vec.b, 16) + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + return { + beta, + lambda, + basis + }; + }; + ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + var red = num === this.p ? this.red : BN.mont(num); + var tinv = new BN(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + var s = new BN(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) { + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + var u = lambda; + var v = this.n.clone(); + var x1 = new BN(1); + var y1 = new BN(0); + var x2 = new BN(0); + var y2 = new BN(1); + var a0; + var b0; + var a1; + var b1; + 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; + } + 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); + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1, k2 }; + }; + ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(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"); + 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); + 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(x, 16); + this.y = new BN(y, 16); + 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(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(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(obj2) { + return curve.point(obj2[0], obj2[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) { + if (this.inf) + return p; + if (p.inf) + return this; + if (this.eq(p)) + return this.dbl(); + if (this.neg().eq(p)) + return this.curve.point(null, null); + 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; + 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(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(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(0); + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = new BN(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(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) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + 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) { + if (this.isInfinity()) + return p.toJ(); + if (p.isInfinity()) + return this; + 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; + } + 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(); + 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; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + var m = xx.redAdd(xx).redIAdd(xx); + var t = m.redSqr().redISub(s).redISub(s); + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + nx = t; + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var a = this.x.redSqr(); + var b = this.y.redSqr(); + var c = b.redSqr(); + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + var e = a.redAdd(a).redIAdd(a); + var f = e.redSqr(); + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + nx = f.redISub(d).redISub(d); + ny = e.redMul(d.redISub(nx)).redISub(c8); + 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; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + var t = m.redSqr().redISub(s).redISub(s); + nx = t; + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var delta = this.z.redSqr(); + var gamma = this.y.redSqr(); + var beta = this.x.redMul(gamma); + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + 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; + 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); + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var zz = this.z.redSqr(); + var yyyy = yy.redSqr(); + var m = xx.redAdd(xx).redIAdd(xx); + var mm = m.redSqr(); + 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); + var ee = e.redSqr(); + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + 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); + 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); + 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(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; + 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; + 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() { + return this.z.cmpn(0) === 0; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/mont.js +var require_mont = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/mont.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var utils = require_utils2(); + function MontCurve(conf) { + Base.call(this, "mont", conf); + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.i4 = new BN(4).toRed(this.red).redInvm(); + this.two = new BN(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); + } + inherits(MontCurve, Base); + module2.exports = MontCurve; + MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + return y.redSqr().cmp(rhs) === 0; + }; + function Point(curve, x, z) { + Base.BasePoint.call(this, curve, "projective"); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new BN(x, 16); + this.z = new BN(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } + } + inherits(Point, Base.BasePoint); + MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + return this.point(utils.toArray(bytes, enc), 1); + }; + MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); + }; + MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); + }; + Point.prototype.precompute = function precompute() { + }; + Point.prototype._encode = function _encode() { + return this.getX().toArray("be", this.curve.p.byteLength()); + }; + Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); + }; + Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ""; + return ""; + }; + Point.prototype.isInfinity = function isInfinity() { + return this.z.cmpn(0) === 0; + }; + Point.prototype.dbl = function dbl() { + var a = this.x.redAdd(this.z); + var aa = a.redSqr(); + var b = this.x.redSub(this.z); + var bb = b.redSqr(); + var c = aa.redSub(bb); + var nx = aa.redMul(bb); + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); + }; + Point.prototype.add = function add() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.diffAdd = function diffAdd(p, diff) { + var a = this.x.redAdd(this.z); + var b = this.x.redSub(this.z); + var c = p.x.redAdd(p.z); + var d = p.x.redSub(p.z); + var da = d.redMul(a); + var cb = c.redMul(b); + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); + }; + Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; + var b = this.curve.point(null, null); + var c = this; + for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) + bits.push(t.andln(1)); + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + a = a.diffAdd(b, c); + b = b.dbl(); + } else { + b = a.diffAdd(b, c); + a = a.dbl(); + } + } + return b; + }; + Point.prototype.mulAdd = function mulAdd() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.jumlAdd = function jumlAdd() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.eq = function eq(other) { + return this.getX().cmp(other.getX()) === 0; + }; + Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; + }; + Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/edwards.js +var require_edwards = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/edwards.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var assert = utils.assert; + function EdwardsCurve(conf) { + this.twisted = (conf.a | 0) !== 1; + this.mOneA = this.twisted && (conf.a | 0) === -1; + this.extended = this.mOneA; + Base.call(this, "edwards", conf); + this.a = new BN(conf.a, 16).umod(this.red.m); + this.a = this.a.toRed(this.red); + this.c = new BN(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new BN(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = (conf.c | 0) === 1; + } + inherits(EdwardsCurve, Base); + module2.exports = EdwardsCurve; + EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); + }; + EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); + }; + EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); + }; + EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + var y2 = rhs.redMul(lhs.redInvm()); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error("invalid point"); + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + return this.point(x, y); + }; + EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { + y = new BN(y, 16); + if (!y.red) + y = y.toRed(this.red); + var y2 = y.redSqr(); + var lhs = y2.redSub(this.c2); + var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a); + var x2 = lhs.redMul(rhs.redInvm()); + if (x2.cmp(this.zero) === 0) { + if (odd) + throw new Error("invalid point"); + else + return this.point(this.zero, y); + } + var x = x2.redSqrt(); + if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) + throw new Error("invalid point"); + if (x.fromRed().isOdd() !== odd) + x = x.redNeg(); + return this.point(x, y); + }; + EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + point.normalize(); + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + return lhs.cmp(rhs) === 0; + }; + function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, "projective"); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = z ? new BN(z, 16) : this.curve.one; + this.t = t && new BN(t, 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); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } + } + inherits(Point, Base.BasePoint); + EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); + }; + EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); + }; + Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); + }; + Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ""; + return ""; + }; + Point.prototype.isInfinity = function isInfinity() { + return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0); + }; + Point.prototype._extDbl = function _extDbl() { + var a = this.x.redSqr(); + var b = this.y.redSqr(); + var c = this.z.redSqr(); + c = c.redIAdd(c); + var d = this.curve._mulA(a); + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + var g = d.redAdd(b); + var f = g.redSub(c); + var h = d.redSub(b); + var nx = e.redMul(f); + var ny = g.redMul(h); + var nt = e.redMul(h); + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); + }; + Point.prototype._projDbl = function _projDbl() { + var b = this.x.redAdd(this.y).redSqr(); + var c = this.x.redSqr(); + var d = this.y.redSqr(); + var nx; + var ny; + var nz; + var e; + var h; + var j; + if (this.curve.twisted) { + e = this.curve._mulA(c); + var f = e.redAdd(d); + if (this.zOne) { + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + ny = f.redMul(e.redSub(d)); + nz = f.redSqr().redSub(f).redSub(f); + } else { + h = this.z.redSqr(); + j = f.redSub(h).redISub(h); + nx = b.redSub(c).redISub(d).redMul(j); + ny = f.redMul(e.redSub(d)); + nz = f.redMul(j); + } + } else { + e = c.redAdd(d); + h = this.curve._mulC(this.z).redSqr(); + j = e.redSub(h).redSub(h); + nx = this.curve._mulC(b.redISub(e)).redMul(j); + ny = this.curve._mulC(e).redMul(c.redISub(d)); + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); + }; + Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); + }; + Point.prototype._extAdd = function _extAdd(p) { + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + var c = this.t.redMul(this.curve.dd).redMul(p.t); + var d = this.z.redMul(p.z.redAdd(p.z)); + var e = b.redSub(a); + var f = d.redSub(c); + var g = d.redAdd(c); + var h = b.redAdd(a); + var nx = e.redMul(f); + var ny = g.redMul(h); + var nt = e.redMul(h); + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); + }; + Point.prototype._projAdd = function _projAdd(p) { + var a = this.z.redMul(p.z); + var b = a.redSqr(); + var c = this.x.redMul(p.x); + var d = this.y.redMul(p.y); + var e = this.curve.d.redMul(c).redMul(d); + var f = b.redSub(e); + var g = b.redAdd(e); + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + var ny; + var nz; + if (this.curve.twisted) { + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + nz = f.redMul(g); + } else { + ny = a.redMul(g).redMul(d.redSub(c)); + nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); + }; + Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); + }; + Point.prototype.mul = function mul(k) { + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); + }; + Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, false); + }; + Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, true); + }; + Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; + }; + Point.prototype.neg = function neg() { + return this.curve.point( + this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg() + ); + }; + Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); + }; + Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); + }; + Point.prototype.eq = function eq(other) { + return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0; + }; + Point.prototype.eqXToP = function eqXToP(x) { + var rx = x.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(rx) === 0) + return true; + var xc = x.clone(); + var t = this.curve.redN.redMul(this.z); + 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; + } + }; + Point.prototype.toP = Point.prototype.normalize; + Point.prototype.mixedAdd = Point.prototype.add; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/index.js +var require_curve = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/index.js"(exports2) { + "use strict"; + var curve = exports2; + curve.base = require_base(); + curve.short = require_short(); + curve.mont = require_mont(); + curve.edwards = require_edwards(); + } +}); + +// node_modules/hash.js/lib/hash/utils.js +var require_utils3 = __commonJS({ + "node_modules/hash.js/lib/hash/utils.js"(exports2) { + "use strict"; + var assert = require_minimalistic_assert(); + var inherits = require_inherits(); + exports2.inherits = inherits; + function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 64512) !== 55296) { + return false; + } + if (i < 0 || i + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i + 1) & 64512) === 56320; + } + function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === "string") { + if (!enc) { + 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 = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023); + 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; + } + exports2.toArray = toArray; + function toHex(msg) { + var res = ""; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; + } + exports2.toHex = toHex; + function htonl(w) { + var res = w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (w & 255) << 24; + return res >>> 0; + } + exports2.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; + } + exports2.toHex32 = toHex32; + function zero2(word) { + if (word.length === 1) + return "0" + word; + else + return word; + } + exports2.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; + } + exports2.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; + } + exports2.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 & 255; + res[k + 2] = m >>> 8 & 255; + res[k + 3] = m & 255; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = m >>> 16 & 255; + res[k + 1] = m >>> 8 & 255; + res[k] = m & 255; + } + } + return res; + } + exports2.split32 = split32; + function rotr32(w, b) { + return w >>> b | w << 32 - b; + } + exports2.rotr32 = rotr32; + function rotl32(w, b) { + return w << b | w >>> 32 - b; + } + exports2.rotl32 = rotl32; + function sum32(a, b) { + return a + b >>> 0; + } + exports2.sum32 = sum32; + function sum32_3(a, b, c) { + return a + b + c >>> 0; + } + exports2.sum32_3 = sum32_3; + function sum32_4(a, b, c, d) { + return a + b + c + d >>> 0; + } + exports2.sum32_4 = sum32_4; + function sum32_5(a, b, c, d, e) { + return a + b + c + d + e >>> 0; + } + exports2.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; + } + exports2.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; + } + exports2.sum64_hi = sum64_hi; + function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; + } + exports2.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; + } + exports2.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; + } + exports2.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; + } + exports2.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; + } + exports2.sum64_5_lo = sum64_5_lo; + function rotr64_hi(ah, al, num) { + var r = al << 32 - num | ah >>> num; + return r >>> 0; + } + exports2.rotr64_hi = rotr64_hi; + function rotr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; + } + exports2.rotr64_lo = rotr64_lo; + function shr64_hi(ah, al, num) { + return ah >>> num; + } + exports2.shr64_hi = shr64_hi; + function shr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; + } + exports2.shr64_lo = shr64_lo; + } +}); + +// node_modules/hash.js/lib/hash/common.js +var require_common = __commonJS({ + "node_modules/hash.js/lib/hash/common.js"(exports2) { + "use strict"; + var utils = require_utils3(); + var assert = require_minimalistic_assert(); + 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; + } + exports2.BlockHash = BlockHash; + BlockHash.prototype.update = function update(msg, enc) { + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + if (this.pending.length >= this._delta8) { + msg = this.pending; + 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] = 128; + for (var i = 1; i < k; i++) + res[i] = 0; + 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 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len & 255; + } else { + res[i++] = len & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 24 & 255; + 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/sha/common.js +var require_common2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/common.js"(exports2) { + "use strict"; + var utils = require_utils3(); + 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); + } + exports2.ft_1 = ft_1; + function ch32(x, y, z) { + return x & y ^ ~x & z; + } + exports2.ch32 = ch32; + function maj32(x, y, z) { + return x & y ^ x & z ^ y & z; + } + exports2.maj32 = maj32; + function p32(x, y, z) { + return x ^ y ^ z; + } + exports2.p32 = p32; + function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); + } + exports2.s0_256 = s0_256; + function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); + } + exports2.s1_256 = s1_256; + function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3; + } + exports2.g0_256 = g0_256; + function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10; + } + exports2.g1_256 = g1_256; + } +}); + +// node_modules/hash.js/lib/hash/sha/1.js +var require__ = __commonJS({ + "node_modules/hash.js/lib/hash/sha/1.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var shaCommon = require_common2(); + 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 = [ + 1518500249, + 1859775393, + 2400959708, + 3395469782 + ]; + function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + BlockHash.call(this); + this.h = [ + 1732584193, + 4023233417, + 2562383102, + 271733878, + 3285377520 + ]; + this.W = new Array(80); + } + utils.inherits(SHA1, BlockHash); + module2.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/256.js +var require__2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/256.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var shaCommon = require_common2(); + var assert = require_minimalistic_assert(); + 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 = [ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]; + function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + BlockHash.call(this); + this.h = [ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ]; + this.k = sha256_K; + this.W = new Array(64); + } + utils.inherits(SHA256, BlockHash); + module2.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/224.js +var require__3 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/224.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var SHA256 = require__2(); + function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + SHA256.call(this); + this.h = [ + 3238371032, + 914150663, + 812702999, + 4144912697, + 4290775857, + 1750603025, + 1694076839, + 3204075428 + ]; + } + utils.inherits(SHA224, SHA256); + module2.exports = SHA224; + SHA224.blockSize = 512; + SHA224.outSize = 224; + SHA224.hmacStrength = 192; + SHA224.padLength = 64; + SHA224.prototype._digest = function digest(enc) { + 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/512.js +var require__4 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/512.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var assert = require_minimalistic_assert(); + 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 = [ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]; + function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + BlockHash.call(this); + this.h = [ + 1779033703, + 4089235720, + 3144134277, + 2227873595, + 1013904242, + 4271175723, + 2773480762, + 1595750129, + 1359893119, + 2917565137, + 2600822924, + 725511199, + 528734635, + 4215389547, + 1541459225, + 327033209 + ]; + this.k = sha512_K; + this.W = new Array(160); + } + utils.inherits(SHA512, BlockHash); + module2.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; + 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]); + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; + 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 += 4294967296; + return r; + } + function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ ~xl & zl; + if (r < 0) + r += 4294967296; + return r; + } + function maj64_hi(xh, xl, yh, yl, zh) { + var r = xh & yh ^ xh & zh ^ yh & zh; + if (r < 0) + r += 4294967296; + return r; + } + function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ xl & zl ^ yl & zl; + if (r < 0) + r += 4294967296; + return r; + } + function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); + var c2_hi = rotr64_hi(xl, xh, 7); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + return r; + } + function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); + var c2_lo = rotr64_lo(xl, xh, 7); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + 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); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + 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); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + 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 += 4294967296; + 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 += 4294967296; + return r; + } + function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); + var c2_hi = shr64_hi(xh, xl, 6); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + return r; + } + function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); + var c2_lo = shr64_lo(xh, xl, 6); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + return r; + } + } +}); + +// node_modules/hash.js/lib/hash/sha/384.js +var require__5 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/384.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var SHA512 = require__4(); + function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + SHA512.call(this); + this.h = [ + 3418070365, + 3238371032, + 1654270250, + 914150663, + 2438529370, + 812702999, + 355462360, + 4144912697, + 1731405415, + 4290775857, + 2394180231, + 1750603025, + 3675008525, + 1694076839, + 1203062813, + 3204075428 + ]; + } + utils.inherits(SHA384, SHA512); + module2.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.js +var require_sha = __commonJS({ + "node_modules/hash.js/lib/hash/sha.js"(exports2) { + "use strict"; + exports2.sha1 = require__(); + exports2.sha224 = require__3(); + exports2.sha256 = require__2(); + exports2.sha384 = require__5(); + exports2.sha512 = require__4(); + } +}); + +// node_modules/hash.js/lib/hash/ripemd.js +var require_ripemd = __commonJS({ + "node_modules/hash.js/lib/hash/ripemd.js"(exports2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + 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 = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]; + this.endian = "little"; + } + utils.inherits(RIPEMD160, BlockHash); + exports2.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 0; + else if (j <= 31) + return 1518500249; + else if (j <= 47) + return 1859775393; + else if (j <= 63) + return 2400959708; + else + return 2840853838; + } + function Kh(j) { + if (j <= 15) + return 1352829926; + else if (j <= 31) + return 1548603684; + else if (j <= 47) + return 1836072691; + else if (j <= 63) + return 2053994217; + else + return 0; + } + 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/hmac.js +var require_hmac = __commonJS({ + "node_modules/hash.js/lib/hash/hmac.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var assert = require_minimalistic_assert(); + 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)); + } + module2.exports = Hmac; + Hmac.prototype._init = function init(key) { + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + for (i = 0; i < key.length; i++) + key[i] ^= 54; + this.inner = new this.Hash().update(key); + for (i = 0; i < key.length; i++) + key[i] ^= 106; + 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.js +var require_hash = __commonJS({ + "node_modules/hash.js/lib/hash.js"(exports2) { + var hash = exports2; + hash.utils = require_utils3(); + hash.common = require_common(); + hash.sha = require_sha(); + hash.ripemd = require_ripemd(); + hash.hmac = require_hmac(); + 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/elliptic/lib/elliptic/precomputed/secp256k1.js +var require_secp256k1 = __commonJS({ + "node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js"(exports2, module2) { + module2.exports = { + doubles: { + step: 4, + points: [ + [ + "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", + "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821" + ], + [ + "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", + "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf" + ], + [ + "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", + "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695" + ], + [ + "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", + "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9" + ], + [ + "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", + "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36" + ], + [ + "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", + "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f" + ], + [ + "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", + "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999" + ], + [ + "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", + "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09" + ], + [ + "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", + "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d" + ], + [ + "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", + "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088" + ], + [ + "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", + "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d" + ], + [ + "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", + "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8" + ], + [ + "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", + "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a" + ], + [ + "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", + "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453" + ], + [ + "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", + "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160" + ], + [ + "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", + "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0" + ], + [ + "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", + "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6" + ], + [ + "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", + "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589" + ], + [ + "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", + "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17" + ], + [ + "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", + "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda" + ], + [ + "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", + "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd" + ], + [ + "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", + "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2" + ], + [ + "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", + "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6" + ], + [ + "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", + "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f" + ], + [ + "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", + "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01" + ], + [ + "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", + "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3" + ], + [ + "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", + "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f" + ], + [ + "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", + "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7" + ], + [ + "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", + "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78" + ], + [ + "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", + "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1" + ], + [ + "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", + "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150" + ], + [ + "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", + "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82" + ], + [ + "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", + "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc" + ], + [ + "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", + "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b" + ], + [ + "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", + "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51" + ], + [ + "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", + "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45" + ], + [ + "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", + "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120" + ], + [ + "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", + "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84" + ], + [ + "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", + "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d" + ], + [ + "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", + "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d" + ], + [ + "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", + "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8" + ], + [ + "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", + "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8" + ], + [ + "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", + "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac" + ], + [ + "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", + "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f" + ], + [ + "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", + "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962" + ], + [ + "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", + "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907" + ], + [ + "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", + "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec" + ], + [ + "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", + "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d" + ], + [ + "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", + "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414" + ], + [ + "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", + "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd" + ], + [ + "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", + "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0" + ], + [ + "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", + "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811" + ], + [ + "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", + "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1" + ], + [ + "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", + "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c" + ], + [ + "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", + "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73" + ], + [ + "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", + "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd" + ], + [ + "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", + "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405" + ], + [ + "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", + "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589" + ], + [ + "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", + "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e" + ], + [ + "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", + "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27" + ], + [ + "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", + "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1" + ], + [ + "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", + "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482" + ], + [ + "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", + "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945" + ], + [ + "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", + "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573" + ], + [ + "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", + "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82" + ] + ] + }, + naf: { + wnd: 7, + points: [ + [ + "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", + "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672" + ], + [ + "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", + "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6" + ], + [ + "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", + "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da" + ], + [ + "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", + "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37" + ], + [ + "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", + "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b" + ], + [ + "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", + "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81" + ], + [ + "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", + "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58" + ], + [ + "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", + "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77" + ], + [ + "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", + "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a" + ], + [ + "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", + "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c" + ], + [ + "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", + "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67" + ], + [ + "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", + "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402" + ], + [ + "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", + "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55" + ], + [ + "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", + "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482" + ], + [ + "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", + "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82" + ], + [ + "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", + "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396" + ], + [ + "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", + "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49" + ], + [ + "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", + "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf" + ], + [ + "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", + "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a" + ], + [ + "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", + "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7" + ], + [ + "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", + "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933" + ], + [ + "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", + "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a" + ], + [ + "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", + "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6" + ], + [ + "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", + "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37" + ], + [ + "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", + "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e" + ], + [ + "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", + "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6" + ], + [ + "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", + "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476" + ], + [ + "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", + "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40" + ], + [ + "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", + "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61" + ], + [ + "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", + "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683" + ], + [ + "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", + "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5" + ], + [ + "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", + "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b" + ], + [ + "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", + "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417" + ], + [ + "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", + "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868" + ], + [ + "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", + "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a" + ], + [ + "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", + "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6" + ], + [ + "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", + "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996" + ], + [ + "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", + "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e" + ], + [ + "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", + "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d" + ], + [ + "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", + "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2" + ], + [ + "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", + "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e" + ], + [ + "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", + "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437" + ], + [ + "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", + "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311" + ], + [ + "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", + "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4" + ], + [ + "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", + "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575" + ], + [ + "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", + "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d" + ], + [ + "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", + "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d" + ], + [ + "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", + "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629" + ], + [ + "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", + "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06" + ], + [ + "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", + "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374" + ], + [ + "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", + "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee" + ], + [ + "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", + "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1" + ], + [ + "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", + "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b" + ], + [ + "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", + "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661" + ], + [ + "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", + "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6" + ], + [ + "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", + "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e" + ], + [ + "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", + "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d" + ], + [ + "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", + "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc" + ], + [ + "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", + "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4" + ], + [ + "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", + "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c" + ], + [ + "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", + "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b" + ], + [ + "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", + "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913" + ], + [ + "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", + "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154" + ], + [ + "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", + "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865" + ], + [ + "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", + "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc" + ], + [ + "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", + "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224" + ], + [ + "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", + "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e" + ], + [ + "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", + "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6" + ], + [ + "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", + "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511" + ], + [ + "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", + "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b" + ], + [ + "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", + "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2" + ], + [ + "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", + "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c" + ], + [ + "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", + "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3" + ], + [ + "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", + "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d" + ], + [ + "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", + "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700" + ], + [ + "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", + "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4" + ], + [ + "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", + "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196" + ], + [ + "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", + "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4" + ], + [ + "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", + "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257" + ], + [ + "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", + "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13" + ], + [ + "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", + "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096" + ], + [ + "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", + "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38" + ], + [ + "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", + "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f" + ], + [ + "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", + "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448" + ], + [ + "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", + "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a" + ], + [ + "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", + "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4" + ], + [ + "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", + "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437" + ], + [ + "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", + "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7" + ], + [ + "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", + "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d" + ], + [ + "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", + "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a" + ], + [ + "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", + "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54" + ], + [ + "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", + "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77" + ], + [ + "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", + "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517" + ], + [ + "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", + "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10" + ], + [ + "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", + "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125" + ], + [ + "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", + "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e" + ], + [ + "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", + "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1" + ], + [ + "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", + "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2" + ], + [ + "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", + "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423" + ], + [ + "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", + "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8" + ], + [ + "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", + "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758" + ], + [ + "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", + "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375" + ], + [ + "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", + "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d" + ], + [ + "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", + "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec" + ], + [ + "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", + "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0" + ], + [ + "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", + "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c" + ], + [ + "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", + "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4" + ], + [ + "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", + "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f" + ], + [ + "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", + "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649" + ], + [ + "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", + "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826" + ], + [ + "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", + "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5" + ], + [ + "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", + "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87" + ], + [ + "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", + "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b" + ], + [ + "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", + "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc" + ], + [ + "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", + "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c" + ], + [ + "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", + "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f" + ], + [ + "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", + "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a" + ], + [ + "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", + "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46" + ], + [ + "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", + "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f" + ], + [ + "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", + "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03" + ], + [ + "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", + "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08" + ], + [ + "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", + "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8" + ], + [ + "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", + "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373" + ], + [ + "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", + "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3" + ], + [ + "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", + "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8" + ], + [ + "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", + "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1" + ], + [ + "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", + "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9" + ] + ] + } + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curves.js +var require_curves = __commonJS({ + "node_modules/elliptic/lib/elliptic/curves.js"(exports2) { + "use strict"; + var curves = exports2; + var hash = require_hash(); + var curve = require_curve(); + var utils = require_utils2(); + var assert = utils.assert; + function PresetCurve(options) { + if (options.type === "short") + this.curve = new curve.short(options); + else if (options.type === "edwards") + this.curve = new curve.edwards(options); + else + this.curve = new curve.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(name2, options) { + Object.defineProperty(curves, name2, { + configurable: true, + enumerable: true, + get: function() { + var curve2 = new PresetCurve(options); + Object.defineProperty(curves, name2, { + configurable: true, + enumerable: true, + value: curve2 + }); + return curve2; + } + }); + } + 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.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.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.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.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.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.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.sha256, + gRed: false, + g: [ + "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", + // 4/5 + "6666666666666666666666666666666666666666666666666666666666666658" + ] + }); + var pre; + try { + pre = require_secp256k1(); + } catch (e) { + pre = void 0; + } + 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.sha256, + // Precomputed endomorphism + beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", + lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", + basis: [ + { + a: "3086d221a7d46bcde86c90e49284eb15", + b: "-e4437ed6010e88286f547fa90abfe4c3" + }, + { + a: "114ca50f7a8e2f3f657c1108d9d44cfd8", + b: "3086d221a7d46bcde86c90e49284eb15" + } + ], + gRed: false, + g: [ + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + pre + ] + }); + } +}); + +// node_modules/hmac-drbg/lib/hmac-drbg.js +var require_hmac_drbg = __commonJS({ + "node_modules/hmac-drbg/lib/hmac-drbg.js"(exports2, module2) { + "use strict"; + var hash = require_hash(); + var utils = require_utils(); + var assert = require_minimalistic_assert(); + 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.toArray(options.entropy, options.entropyEnc || "hex"); + var nonce = utils.toArray(options.nonce, options.nonceEnc || "hex"); + var pers = utils.toArray(options.pers, options.persEnc || "hex"); + assert( + entropy.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ); + this._init(entropy, nonce, pers); + } + module2.exports = 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] = 0; + this.V[i] = 1; + } + this._update(seed); + this._reseed = 1; + this.reseedInterval = 281474976710656; + }; + HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); + }; + HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac().update(this.V).update([0]); + 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([1]).update(seed).digest(); + this.V = this._hmac().update(this.V).digest(); + }; + HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + if (typeof entropyEnc !== "string") { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + entropy = utils.toArray(entropy, entropyEnc); + add = utils.toArray(add, addEnc); + assert( + 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"); + if (typeof enc !== "string") { + addEnc = add; + add = enc; + enc = null; + } + if (add) { + add = utils.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.encode(res, enc); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/key.js +var require_key = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/key.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); + } + module2.exports = KeyPair; + KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(ec, { + pub, + pubEnc: enc + }); + }; + KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + return new KeyPair(ec, { + 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) { + 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(key, enc || 16); + this.priv = this.priv.umod(this.ec.curve.n); + }; + KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + if (this.ec.curve.type === "mont") { + assert(key.x, "Need x coordinate"); + } else if (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") { + assert(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); + }; + KeyPair.prototype.derive = function derive(pub) { + if (!pub.validate()) { + assert(pub.validate(), "public point not validated"); + } + return pub.mul(this.priv).getX(); + }; + 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 ""; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/signature.js +var require_signature = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/signature.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + function Signature(options, enc) { + if (options instanceof Signature) + return options; + if (this._importDER(options, enc)) + return; + assert(options.r && options.s, "Signature without r or s"); + this.r = new BN(options.r, 16); + this.s = new BN(options.s, 16); + if (options.recoveryParam === void 0) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; + } + module2.exports = Signature; + function Position() { + this.place = 0; + } + function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 128)) { + return initial; + } + var octetLen = initial & 15; + 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; + } + if (val <= 127) { + return false; + } + p.place = off; + return val; + } + function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 128) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); + } + Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 48) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if (len + p.place !== data.length) { + return false; + } + if (data[p.place++] !== 2) { + 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++] !== 2) { + 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] & 128) { + r = r.slice(1); + } else { + return false; + } + } + if (s[0] === 0) { + if (s[1] & 128) { + s = s.slice(1); + } else { + return false; + } + } + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + return true; + }; + function constructLength(arr, len) { + if (len < 128) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 128); + while (--octets) { + arr.push(len >>> (octets << 3) & 255); + } + arr.push(len); + } + Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + if (r[0] & 128) + r = [0].concat(r); + if (s[0] & 128) + s = [0].concat(s); + r = rmPadding(r); + s = rmPadding(s); + while (!s[0] && !(s[1] & 128)) { + s = s.slice(1); + } + var arr = [2]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(2); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [48]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/index.js +var require_ec = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/index.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var HmacDRBG = require_hmac_drbg(); + var utils = require_utils2(); + var curves = require_curves(); + var rand = require_brorand(); + var assert = utils.assert; + var KeyPair = require_key(); + var Signature = require_signature(); + function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + if (typeof options === "string") { + assert( + Object.prototype.hasOwnProperty.call(curves, options), + "Unknown curve " + options + ); + options = curves[options]; + } + if (options instanceof curves.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; + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + this.hash = options.hash || options.curve.hash; + } + module2.exports = EC; + EC.prototype.keyPair = function keyPair(options) { + return new KeyPair(this, options); + }; + EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return KeyPair.fromPrivate(this, priv, enc); + }; + EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return KeyPair.fromPublic(this, pub, enc); + }; + EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + 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(2)); + for (; ; ) { + var priv = new BN(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(msg, 16)); + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray("be", bytes); + var nonce = msg.toArray("be", bytes); + var drbg = new HmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce, + pers: options.pers, + persEnc: options.persEnc || "utf8" + }); + var ns1 = this.n.sub(new BN(1)); + for (var iter = 0; ; iter++) { + var k = options.k ? options.k(iter) : new BN(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); + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + return new Signature({ r, s, recoveryParam }); + } + }; + EC.prototype.verify = function verify(msg, signature, key, enc) { + msg = this._truncateToN(new BN(msg, 16)); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, "hex"); + var r = signature.r; + var s = signature.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; + 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; + } + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + return p.eqXToP(r); + }; + EC.prototype.recoverPubKey = function(msg, signature, j, enc) { + assert((3 & j) === j, "The recovery param is more than two bits"); + signature = new Signature(signature, enc); + var n = this.n; + var e = new BN(msg); + var r = signature.r; + var s = signature.s; + 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"); + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + return this.g.mulAdd(s1, r, s2); + }; + EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { + signature = new Signature(signature, enc); + if (signature.recoveryParam !== null) + return signature.recoveryParam; + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature, i); + } catch (e2) { + continue; + } + if (Qprime.eq(Q)) + return i; + } + throw new Error("Unable to find valid recovery factor"); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/key.js +var require_key2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/key.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var assert = utils.assert; + var parseBytes = utils.parseBytes; + var cachedProperty = utils.cachedProperty; + function KeyPair(eddsa, params2) { + this.eddsa = eddsa; + this._secret = parseBytes(params2.secret); + if (eddsa.isPoint(params2.pub)) + this._pub = params2.pub; + else + this._pubBytes = parseBytes(params2.pub); + } + KeyPair.fromPublic = function fromPublic(eddsa, pub) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(eddsa, { pub }); + }; + KeyPair.fromSecret = function fromSecret(eddsa, secret) { + if (secret instanceof KeyPair) + return secret; + return new KeyPair(eddsa, { secret }); + }; + KeyPair.prototype.secret = function secret() { + return this._secret; + }; + cachedProperty(KeyPair, "pubBytes", function pubBytes() { + return this.eddsa.encodePoint(this.pub()); + }); + cachedProperty(KeyPair, "pub", function pub() { + if (this._pubBytes) + return this.eddsa.decodePoint(this._pubBytes); + return this.eddsa.g.mul(this.priv()); + }); + cachedProperty(KeyPair, "privBytes", function privBytes() { + var eddsa = this.eddsa; + var hash = this.hash(); + var lastIx = eddsa.encodingLength - 1; + var a = hash.slice(0, eddsa.encodingLength); + a[0] &= 248; + a[lastIx] &= 127; + a[lastIx] |= 64; + return a; + }); + cachedProperty(KeyPair, "priv", function priv() { + return this.eddsa.decodeInt(this.privBytes()); + }); + cachedProperty(KeyPair, "hash", function hash() { + return this.eddsa.hash().update(this.secret()).digest(); + }); + cachedProperty(KeyPair, "messagePrefix", function messagePrefix() { + return this.hash().slice(this.eddsa.encodingLength); + }); + KeyPair.prototype.sign = function sign(message) { + assert(this._secret, "KeyPair can only verify"); + return this.eddsa.sign(message, this); + }; + KeyPair.prototype.verify = function verify(message, sig) { + return this.eddsa.verify(message, sig, this); + }; + KeyPair.prototype.getSecret = function getSecret(enc) { + assert(this._secret, "KeyPair is public only"); + return utils.encode(this.secret(), enc); + }; + KeyPair.prototype.getPublic = function getPublic(enc) { + return utils.encode(this.pubBytes(), enc); + }; + module2.exports = KeyPair; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/signature.js +var require_signature2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/signature.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + var cachedProperty = utils.cachedProperty; + var parseBytes = utils.parseBytes; + function Signature(eddsa, sig) { + this.eddsa = eddsa; + if (typeof sig !== "object") + sig = parseBytes(sig); + if (Array.isArray(sig)) { + sig = { + R: sig.slice(0, eddsa.encodingLength), + S: sig.slice(eddsa.encodingLength) + }; + } + assert(sig.R && sig.S, "Signature without R or S"); + if (eddsa.isPoint(sig.R)) + this._R = sig.R; + if (sig.S instanceof BN) + this._S = sig.S; + this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded; + this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded; + } + cachedProperty(Signature, "S", function S() { + return this.eddsa.decodeInt(this.Sencoded()); + }); + cachedProperty(Signature, "R", function R() { + return this.eddsa.decodePoint(this.Rencoded()); + }); + cachedProperty(Signature, "Rencoded", function Rencoded() { + return this.eddsa.encodePoint(this.R()); + }); + cachedProperty(Signature, "Sencoded", function Sencoded() { + return this.eddsa.encodeInt(this.S()); + }); + Signature.prototype.toBytes = function toBytes() { + return this.Rencoded().concat(this.Sencoded()); + }; + Signature.prototype.toHex = function toHex() { + return utils.encode(this.toBytes(), "hex").toUpperCase(); + }; + module2.exports = Signature; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/index.js +var require_eddsa = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/index.js"(exports2, module2) { + "use strict"; + var hash = require_hash(); + var curves = require_curves(); + var utils = require_utils2(); + var assert = utils.assert; + var parseBytes = utils.parseBytes; + var KeyPair = require_key2(); + var Signature = require_signature2(); + function EDDSA(curve) { + assert(curve === "ed25519", "only tested with ed25519 so far"); + if (!(this instanceof EDDSA)) + return new EDDSA(curve); + curve = curves[curve].curve; + this.curve = curve; + this.g = curve.g; + this.g.precompute(curve.n.bitLength() + 1); + this.pointClass = curve.point().constructor; + this.encodingLength = Math.ceil(curve.n.bitLength() / 8); + this.hash = hash.sha512; + } + module2.exports = EDDSA; + EDDSA.prototype.sign = function sign(message, secret) { + message = parseBytes(message); + var key = this.keyFromSecret(secret); + var r = this.hashInt(key.messagePrefix(), message); + var R = this.g.mul(r); + var Rencoded = this.encodePoint(R); + var s_ = this.hashInt(Rencoded, key.pubBytes(), message).mul(key.priv()); + var S = r.add(s_).umod(this.curve.n); + return this.makeSignature({ R, S, Rencoded }); + }; + EDDSA.prototype.verify = function verify(message, sig, pub) { + message = parseBytes(message); + sig = this.makeSignature(sig); + var key = this.keyFromPublic(pub); + var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); + var SG = this.g.mul(sig.S()); + var RplusAh = sig.R().add(key.pub().mul(h)); + return RplusAh.eq(SG); + }; + EDDSA.prototype.hashInt = function hashInt() { + var hash2 = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash2.update(arguments[i]); + return utils.intFromLE(hash2.digest()).umod(this.curve.n); + }; + EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { + return KeyPair.fromPublic(this, pub); + }; + EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { + return KeyPair.fromSecret(this, secret); + }; + EDDSA.prototype.makeSignature = function makeSignature(sig) { + if (sig instanceof Signature) + return sig; + return new Signature(this, sig); + }; + EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray("le", this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 128 : 0; + return enc; + }; + EDDSA.prototype.decodePoint = function decodePoint(bytes) { + bytes = utils.parseBytes(bytes); + var lastIx = bytes.length - 1; + var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~128); + var xIsOdd = (bytes[lastIx] & 128) !== 0; + var y = utils.intFromLE(normed); + return this.curve.pointFromY(y, xIsOdd); + }; + EDDSA.prototype.encodeInt = function encodeInt(num) { + return num.toArray("le", this.encodingLength); + }; + EDDSA.prototype.decodeInt = function decodeInt(bytes) { + return utils.intFromLE(bytes); + }; + EDDSA.prototype.isPoint = function isPoint(val) { + return val instanceof this.pointClass; + }; + } +}); + +// node_modules/elliptic/lib/elliptic.js +var require_elliptic = __commonJS({ + "node_modules/elliptic/lib/elliptic.js"(exports2) { + "use strict"; + var elliptic = exports2; + elliptic.version = require_package().version; + elliptic.utils = require_utils2(); + elliptic.rand = require_brorand(); + elliptic.curve = require_curve(); + elliptic.curves = require_curves(); + elliptic.ec = require_ec(); + elliptic.eddsa = require_eddsa(); + } +}); + +// node_modules/@ethersproject/signing-key/lib/elliptic.js +var require_elliptic2 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/elliptic.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EC = void 0; + var elliptic_1 = __importDefault(require_elliptic()); + var EC = elliptic_1.default.ec; + exports2.EC = EC; + } +}); + +// node_modules/@ethersproject/signing-key/lib/_version.js +var require_version12 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "signing-key/5.5.0"; + } +}); + +// node_modules/@ethersproject/signing-key/lib/index.js +var require_lib14 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.computePublicKey = exports2.recoverPublicKey = exports2.SigningKey = void 0; + var elliptic_1 = require_elliptic2(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version12(); + var logger = new logger_1.Logger(_version_1.version); + var _curve = null; + function getCurve() { + if (!_curve) { + _curve = new elliptic_1.EC("secp256k1"); + } + return _curve; + } + var SigningKey = ( + /** @class */ + function() { + function SigningKey2(privateKey) { + (0, properties_1.defineReadOnly)(this, "curve", "secp256k1"); + (0, properties_1.defineReadOnly)(this, "privateKey", (0, bytes_1.hexlify)(privateKey)); + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + (0, properties_1.defineReadOnly)(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); + (0, properties_1.defineReadOnly)(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); + (0, properties_1.defineReadOnly)(this, "_isSigningKey", true); + } + SigningKey2.prototype._addPoint = function(other) { + var p0 = getCurve().keyFromPublic((0, bytes_1.arrayify)(this.publicKey)); + var p1 = getCurve().keyFromPublic((0, bytes_1.arrayify)(other)); + return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex"); + }; + SigningKey2.prototype.signDigest = function(digest) { + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + var digestBytes = (0, bytes_1.arrayify)(digest); + if (digestBytes.length !== 32) { + logger.throwArgumentError("bad digest length", "digest", digest); + } + var signature = keyPair.sign(digestBytes, { canonical: true }); + return (0, bytes_1.splitSignature)({ + recoveryParam: signature.recoveryParam, + r: (0, bytes_1.hexZeroPad)("0x" + signature.r.toString(16), 32), + s: (0, bytes_1.hexZeroPad)("0x" + signature.s.toString(16), 32) + }); + }; + SigningKey2.prototype.computeSharedSecret = function(otherKey) { + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + var otherKeyPair = getCurve().keyFromPublic((0, bytes_1.arrayify)(computePublicKey(otherKey))); + return (0, bytes_1.hexZeroPad)("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32); + }; + SigningKey2.isSigningKey = function(value) { + return !!(value && value._isSigningKey); + }; + return SigningKey2; + }() + ); + exports2.SigningKey = SigningKey; + function recoverPublicKey(digest, signature) { + var sig = (0, bytes_1.splitSignature)(signature); + var rs = { r: (0, bytes_1.arrayify)(sig.r), s: (0, bytes_1.arrayify)(sig.s) }; + return "0x" + getCurve().recoverPubKey((0, bytes_1.arrayify)(digest), rs, sig.recoveryParam).encode("hex", false); + } + exports2.recoverPublicKey = recoverPublicKey; + function computePublicKey(key, compressed) { + var bytes = (0, bytes_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 (0, bytes_1.hexlify)(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(false, "hex"); + } else if (bytes.length === 65) { + if (!compressed) { + return (0, bytes_1.hexlify)(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(true, "hex"); + } + return logger.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + } + exports2.computePublicKey = computePublicKey; + } +}); + +// node_modules/@ethersproject/transactions/lib/_version.js +var require_version13 = __commonJS({ + "node_modules/@ethersproject/transactions/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "transactions/5.5.0"; + } +}); + +// node_modules/@ethersproject/transactions/lib/index.js +var require_lib15 = __commonJS({ + "node_modules/@ethersproject/transactions/lib/index.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result2 = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result2, mod, k); + } + __setModuleDefault(result2, mod); + return result2; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.parse = exports2.serialize = exports2.accessListify = exports2.recoverAddress = exports2.computeAddress = exports2.TransactionTypes = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var RLP = __importStar(require_lib6()); + var signing_key_1 = require_lib14(); + var logger_1 = require_lib(); + var _version_1 = require_version13(); + var logger = new logger_1.Logger(_version_1.version); + var TransactionTypes; + (function(TransactionTypes2) { + TransactionTypes2[TransactionTypes2["legacy"] = 0] = "legacy"; + TransactionTypes2[TransactionTypes2["eip2930"] = 1] = "eip2930"; + TransactionTypes2[TransactionTypes2["eip1559"] = 2] = "eip1559"; + })(TransactionTypes = exports2.TransactionTypes || (exports2.TransactionTypes = {})); + function handleAddress(value) { + if (value === "0x") { + return null; + } + return (0, address_1.getAddress)(value); + } + function handleNumber(value) { + if (value === "0x") { + return constants_1.Zero; + } + return bignumber_1.BigNumber.from(value); + } + 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 = (0, signing_key_1.computePublicKey)(key); + return (0, address_1.getAddress)((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.hexDataSlice)(publicKey, 1)), 12)); + } + exports2.computeAddress = computeAddress; + function recoverAddress(digest, signature) { + return computeAddress((0, signing_key_1.recoverPublicKey)((0, bytes_1.arrayify)(digest), signature)); + } + exports2.recoverAddress = recoverAddress; + function formatNumber(value, name2) { + var result2 = (0, bytes_1.stripZeros)(bignumber_1.BigNumber.from(value).toHexString()); + if (result2.length > 32) { + logger.throwArgumentError("invalid length for " + name2, "transaction:" + name2, value); + } + return result2; + } + function accessSetify(addr, storageKeys) { + return { + address: (0, address_1.getAddress)(addr), + storageKeys: (storageKeys || []).map(function(storageKey, index) { + if ((0, bytes_1.hexDataLength)(storageKey) !== 32) { + logger.throwArgumentError("invalid access list storageKey", "accessList[" + addr + ":" + 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[" + index + "]", set); + } + return accessSetify(set[0], set[1]); + } + return accessSetify(set.address, set.storageKeys); + }); + } + var result2 = 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()); + }); + result2.sort(function(a, b) { + return a.address.localeCompare(b.address); + }); + return result2; + } + exports2.accessListify = accessListify; + function formatAccessList(value) { + return accessListify(value).map(function(set) { + return [set.address, set.storageKeys]; + }); + } + function _serializeEip1559(transaction, signature) { + if (transaction.gasPrice != null) { + var gasPrice = bignumber_1.BigNumber.from(transaction.gasPrice); + var maxFeePerGas = bignumber_1.BigNumber.from(transaction.maxFeePerGas || 0); + if (!gasPrice.eq(maxFeePerGas)) { + logger.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + gasPrice, + 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 ? (0, address_1.getAddress)(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature) { + var sig = (0, bytes_1.splitSignature)(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push((0, bytes_1.stripZeros)(sig.r)); + fields.push((0, bytes_1.stripZeros)(sig.s)); + } + return (0, bytes_1.hexConcat)(["0x02", RLP.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 ? (0, address_1.getAddress)(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature) { + var sig = (0, bytes_1.splitSignature)(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push((0, bytes_1.stripZeros)(sig.r)); + fields.push((0, bytes_1.stripZeros)(sig.s)); + } + return (0, bytes_1.hexConcat)(["0x01", RLP.encode(fields)]); + } + function _serialize(transaction, signature) { + (0, properties_1.checkProperties)(transaction, allowedTransactionKeys); + var raw = []; + transactionFields.forEach(function(fieldInfo) { + var value = transaction[fieldInfo.name] || []; + var options = {}; + if (fieldInfo.numeric) { + options.hexPad = "left"; + } + value = (0, bytes_1.arrayify)((0, bytes_1.hexlify)(value, options)); + if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + if (fieldInfo.maxLength) { + value = (0, bytes_1.stripZeros)(value); + if (value.length > fieldInfo.maxLength) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + } + raw.push((0, bytes_1.hexlify)(value)); + }); + var chainId = 0; + if (transaction.chainId != null) { + chainId = transaction.chainId; + if (typeof chainId !== "number") { + logger.throwArgumentError("invalid transaction.chainId", "transaction", transaction); + } + } else if (signature && !(0, bytes_1.isBytesLike)(signature) && signature.v > 28) { + chainId = Math.floor((signature.v - 35) / 2); + } + if (chainId !== 0) { + raw.push((0, bytes_1.hexlify)(chainId)); + raw.push("0x"); + raw.push("0x"); + } + if (!signature) { + return RLP.encode(raw); + } + var sig = (0, bytes_1.splitSignature)(signature); + var v = 27 + sig.recoveryParam; + if (chainId !== 0) { + raw.pop(); + raw.pop(); + raw.pop(); + v += chainId * 2 + 8; + 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((0, bytes_1.hexlify)(v)); + raw.push((0, bytes_1.stripZeros)((0, bytes_1.arrayify)(sig.r))); + raw.push((0, bytes_1.stripZeros)((0, bytes_1.arrayify)(sig.s))); + return RLP.encode(raw); + } + function serialize(transaction, signature) { + 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); + } + switch (transaction.type) { + case 1: + return _serializeEip2930(transaction, signature); + case 2: + return _serializeEip1559(transaction, signature); + default: + break; + } + return logger.throwError("unsupported transaction type: " + transaction.type, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "serializeTransaction", + transactionType: transaction.type + }); + } + exports2.serialize = serialize; + function _parseEipSignature(tx, fields, serialize2) { + 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 = (0, bytes_1.hexZeroPad)(fields[1], 32); + tx.s = (0, bytes_1.hexZeroPad)(fields[2], 32); + try { + var digest = (0, keccak256_1.keccak256)(serialize2(tx)); + tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v }); + } catch (error) { + console.log(error); + } + } + function _parseEip1559(payload) { + var transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 9 && transaction.length !== 12) { + logger.throwArgumentError("invalid component count for transaction type: 2", "payload", (0, bytes_1.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, + maxFeePerGas, + gasPrice: null, + gasLimit: handleNumber(transaction[4]), + to: handleAddress(transaction[5]), + value: handleNumber(transaction[6]), + data: transaction[7], + accessList: accessListify(transaction[8]) + }; + if (transaction.length === 9) { + return tx; + } + tx.hash = (0, keccak256_1.keccak256)(payload); + _parseEipSignature(tx, transaction.slice(9), _serializeEip1559); + return tx; + } + function _parseEip2930(payload) { + var transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 8 && transaction.length !== 11) { + logger.throwArgumentError("invalid component count for transaction type: 1", "payload", (0, bytes_1.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]) + }; + if (transaction.length === 8) { + return tx; + } + tx.hash = (0, keccak256_1.keccak256)(payload); + _parseEipSignature(tx, transaction.slice(8), _serializeEip2930); + return tx; + } + function _parse(rawTransaction) { + var transaction = RLP.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 + }; + if (transaction.length === 6) { + return tx; + } + try { + tx.v = bignumber_1.BigNumber.from(transaction[6]).toNumber(); + } catch (error) { + console.log(error); + return tx; + } + tx.r = (0, bytes_1.hexZeroPad)(transaction[7], 32); + tx.s = (0, bytes_1.hexZeroPad)(transaction[8], 32); + if (bignumber_1.BigNumber.from(tx.r).isZero() && bignumber_1.BigNumber.from(tx.s).isZero()) { + tx.chainId = tx.v; + tx.v = 0; + } else { + 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((0, bytes_1.hexlify)(tx.chainId)); + raw.push("0x"); + raw.push("0x"); + recoveryParam -= tx.chainId * 2 + 8; + } + var digest = (0, keccak256_1.keccak256)(RLP.encode(raw)); + try { + tx.from = recoverAddress(digest, { r: (0, bytes_1.hexlify)(tx.r), s: (0, bytes_1.hexlify)(tx.s), recoveryParam }); + } catch (error) { + console.log(error); + } + tx.hash = (0, keccak256_1.keccak256)(rawTransaction); + } + tx.type = null; + return tx; + } + function parse(rawTransaction) { + var payload = (0, bytes_1.arrayify)(rawTransaction); + if (payload[0] > 127) { + return _parse(payload); + } + switch (payload[0]) { + case 1: + return _parseEip2930(payload); + case 2: + return _parseEip1559(payload); + default: + break; + } + return logger.throwError("unsupported transaction type: " + payload[0], logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "parseTransaction", + transactionType: payload[0] + }); + } + exports2.parse = parse; + } +}); + +// node_modules/@ethersproject/contracts/lib/_version.js +var require_version14 = __commonJS({ + "node_modules/@ethersproject/contracts/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "contracts/5.5.0"; + } +}); + +// node_modules/@ethersproject/contracts/lib/index.js +var require_lib16 = __commonJS({ + "node_modules/@ethersproject/contracts/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ContractFactory = exports2.Contract = exports2.BaseContract = void 0; + var abi_1 = require_lib11(); + var abstract_provider_1 = require_lib12(); + var abstract_signer_1 = require_lib13(); + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version14(); + var logger = new logger_1.Logger(_version_1.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, function() { + var name2, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, nameOrPromise]; + case 1: + name2 = _a.sent(); + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", name2); + } + try { + return [2, (0, address_1.getAddress)(name2)]; + } catch (error) { + } + if (!resolver) { + logger.throwError("a provider or signer is needed to resolve ENS names", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName" + }); + } + return [4, resolver.resolveName(name2)]; + case 2: + address = _a.sent(); + if (address == null) { + logger.throwArgumentError("resolver or addr is not configured for ENS name", "name", name2); + } + return [2, address]; + } + }); + }); + } + function resolveAddresses(resolver, value, paramType) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!Array.isArray(paramType)) return [3, 2]; + return [4, Promise.all(paramType.map(function(paramType2, index) { + return resolveAddresses(resolver, Array.isArray(value) ? value[index] : value[paramType2.name], paramType2); + }))]; + case 1: + return [2, _a.sent()]; + case 2: + if (!(paramType.type === "address")) return [3, 4]; + return [4, resolveName(resolver, value)]; + case 3: + return [2, _a.sent()]; + case 4: + if (!(paramType.type === "tuple")) return [3, 6]; + return [4, resolveAddresses(resolver, value, paramType.components)]; + case 5: + return [2, _a.sent()]; + case 6: + if (!(paramType.baseType === "array")) return [3, 8]; + if (!Array.isArray(value)) { + return [2, Promise.reject(logger.makeError("invalid value for array", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "value", + value + }))]; + } + return [4, Promise.all(value.map(function(v) { + return resolveAddresses(resolver, v, paramType.arrayChildren); + }))]; + case 7: + return [2, _a.sent()]; + case 8: + return [2, value]; + } + }); + }); + } + function populateTransaction(contract, fragment, args) { + return __awaiter(this, void 0, void 0, function() { + var overrides, resolved, data, tx, ro, intrinsic, bytes, i, roValue, leftovers; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + overrides = {}; + if (args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object") { + overrides = (0, properties_1.shallowCopy)(args.pop()); + } + logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); + if (contract.signer) { + if (overrides.from) { + overrides.from = (0, properties_1.resolveProperties)({ + override: resolveName(contract.signer, overrides.from), + signer: contract.signer.getAddress() + }).then(function(check) { + return __awaiter(_this, void 0, void 0, function() { + return __generator(this, function(_a2) { + if ((0, address_1.getAddress)(check.signer) !== check.override) { + logger.throwError("Contract with a Signer cannot override from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.from" + }); + } + return [2, check.override]; + }); + }); + }); + } else { + overrides.from = contract.signer.getAddress(); + } + } else if (overrides.from) { + overrides.from = resolveName(contract.provider, overrides.from); + } + return [4, (0, properties_1.resolveProperties)({ + args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), + address: contract.resolvedAddress, + overrides: (0, properties_1.resolveProperties)(overrides) || {} + })]; + case 1: + resolved = _a.sent(); + data = contract.interface.encodeFunctionData(fragment, resolved.args); + tx = { + data, + to: resolved.address + }; + ro = resolved.overrides; + if (ro.nonce != null) { + tx.nonce = bignumber_1.BigNumber.from(ro.nonce).toNumber(); + } + if (ro.gasLimit != null) { + tx.gasLimit = bignumber_1.BigNumber.from(ro.gasLimit); + } + if (ro.gasPrice != null) { + tx.gasPrice = bignumber_1.BigNumber.from(ro.gasPrice); + } + if (ro.maxFeePerGas != null) { + tx.maxFeePerGas = bignumber_1.BigNumber.from(ro.maxFeePerGas); + } + if (ro.maxPriorityFeePerGas != null) { + tx.maxPriorityFeePerGas = bignumber_1.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 = (0, transactions_1.accessListify)(ro.accessList); + } + if (tx.gasLimit == null && fragment.gas != null) { + intrinsic = 21e3; + bytes = (0, bytes_1.arrayify)(data); + for (i = 0; i < bytes.length; i++) { + intrinsic += 4; + if (bytes[i]) { + intrinsic += 64; + } + } + tx.gasLimit = bignumber_1.BigNumber.from(fragment.gas).add(intrinsic); + } + if (ro.value) { + roValue = bignumber_1.BigNumber.from(ro.value); + if (!roValue.isZero() && !fragment.payable) { + logger.throwError("non-payable method cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: overrides.value + }); + } + tx.value = roValue; + } + if (ro.customData) { + tx.customData = (0, properties_1.shallowCopy)(ro.customData); + } + 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; + leftovers = Object.keys(overrides).filter(function(key) { + return overrides[key] != null; + }); + if (leftovers.length) { + logger.throwError("cannot override " + leftovers.map(function(l) { + return JSON.stringify(l); + }).join(","), logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides", + overrides: leftovers + }); + } + return [2, tx]; + } + }); + }); + } + function buildPopulate(contract, fragment) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return populateTransaction(contract, fragment, args); + }; + } + function buildEstimate(contract, fragment) { + var signerOrProvider = contract.signer || contract.provider; + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!signerOrProvider) { + logger.throwError("estimate require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "estimateGas" + }); + } + return [4, populateTransaction(contract, fragment, args)]; + case 1: + tx = _a.sent(); + return [4, signerOrProvider.estimateGas(tx)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + } + 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 = (0, properties_1.deepCopy)(log); + var parsed = null; + try { + parsed = contract.interface.parseLog(log); + } catch (e) { + } + 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; + } + 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() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var blockTag, overrides, tx, result2, value; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + blockTag = void 0; + if (!(args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object")) return [3, 3]; + overrides = (0, properties_1.shallowCopy)(args.pop()); + if (!(overrides.blockTag != null)) return [3, 2]; + return [4, overrides.blockTag]; + case 1: + blockTag = _a.sent(); + _a.label = 2; + case 2: + delete overrides.blockTag; + args.push(overrides); + _a.label = 3; + case 3: + if (!(contract.deployTransaction != null)) return [3, 5]; + return [4, contract._deployed(blockTag)]; + case 4: + _a.sent(); + _a.label = 5; + case 5: + return [4, populateTransaction(contract, fragment, args)]; + case 6: + tx = _a.sent(); + return [4, signerOrProvider.call(tx, blockTag)]; + case 7: + result2 = _a.sent(); + try { + value = contract.interface.decodeFunctionResult(fragment, result2); + if (collapseSimple && fragment.outputs.length === 1) { + value = value[0]; + } + return [2, value]; + } catch (error) { + if (error.code === logger_1.Logger.errors.CALL_EXCEPTION) { + error.address = contract.address; + error.args = args; + error.transaction = tx; + } + throw error; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + } + function buildSend(contract, fragment) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var txRequest, tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!contract.signer) { + logger.throwError("sending a transaction requires a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "sendTransaction" + }); + } + if (!(contract.deployTransaction != null)) return [3, 2]; + return [4, contract._deployed()]; + case 1: + _a.sent(); + _a.label = 2; + case 2: + return [4, populateTransaction(contract, fragment, args)]; + case 3: + txRequest = _a.sent(); + return [4, contract.signer.sendTransaction(txRequest)]; + case 4: + tx = _a.sent(); + addContractWait(contract, tx); + return [2, tx]; + } + }); + }); + }; + } + 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 = ( + /** @class */ + function() { + function RunningEvent2(tag, filter) { + (0, properties_1.defineReadOnly)(this, "tag", tag); + (0, properties_1.defineReadOnly)(this, "filter", filter); + this._listeners = []; + } + RunningEvent2.prototype.addListener = function(listener, once) { + this._listeners.push({ listener, once }); + }; + RunningEvent2.prototype.removeListener = function(listener) { + var done = false; + this._listeners = this._listeners.filter(function(item) { + if (done || item.listener !== listener) { + return true; + } + done = true; + return false; + }); + }; + RunningEvent2.prototype.removeAllListeners = function() { + this._listeners = []; + }; + RunningEvent2.prototype.listeners = function() { + return this._listeners.map(function(i) { + return i.listener; + }); + }; + RunningEvent2.prototype.listenerCount = function() { + return this._listeners.length; + }; + RunningEvent2.prototype.run = function(args) { + var _this = this; + var listenerCount = this.listenerCount(); + this._listeners = this._listeners.filter(function(item) { + var argsCopy = args.slice(); + setTimeout(function() { + item.listener.apply(_this, argsCopy); + }, 0); + return !item.once; + }); + return listenerCount; + }; + RunningEvent2.prototype.prepareEvent = function(event) { + }; + RunningEvent2.prototype.getEmit = function(event) { + return [event]; + }; + return RunningEvent2; + }() + ); + var ErrorRunningEvent = ( + /** @class */ + function(_super) { + __extends(ErrorRunningEvent2, _super); + function ErrorRunningEvent2() { + return _super.call(this, "error", null) || this; + } + return ErrorRunningEvent2; + }(RunningEvent) + ); + var FragmentRunningEvent = ( + /** @class */ + function(_super) { + __extends(FragmentRunningEvent2, _super); + function FragmentRunningEvent2(address, contractInterface, fragment, topics) { + var _this = this; + var filter = { + 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]; + } + _this = _super.call(this, getEventTag(filter), filter) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "interface", contractInterface); + (0, properties_1.defineReadOnly)(_this, "fragment", fragment); + return _this; + } + FragmentRunningEvent2.prototype.prepareEvent = function(event) { + var _this = this; + _super.prototype.prepareEvent.call(this, event); + event.event = this.fragment.name; + event.eventSignature = this.fragment.format(); + event.decode = function(data, topics) { + return _this.interface.decodeEventLog(_this.fragment, data, topics); + }; + try { + event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics); + } catch (error) { + event.args = null; + event.decodeError = error; + } + }; + FragmentRunningEvent2.prototype.getEmit = function(event) { + var errors = (0, abi_1.checkResultErrors)(event.args); + if (errors.length) { + throw errors[0].error; + } + var args = (event.args || []).slice(); + args.push(event); + return args; + }; + return FragmentRunningEvent2; + }(RunningEvent) + ); + var WildcardRunningEvent = ( + /** @class */ + function(_super) { + __extends(WildcardRunningEvent2, _super); + function WildcardRunningEvent2(address, contractInterface) { + var _this = _super.call(this, "*", { address }) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "interface", contractInterface); + return _this; + } + WildcardRunningEvent2.prototype.prepareEvent = function(event) { + var _this = this; + _super.prototype.prepareEvent.call(this, event); + try { + var parsed_1 = this.interface.parseLog(event); + event.event = parsed_1.name; + event.eventSignature = parsed_1.signature; + event.decode = function(data, topics) { + return _this.interface.decodeEventLog(parsed_1.eventFragment, data, topics); + }; + event.args = parsed_1.args; + } catch (error) { + } + }; + return WildcardRunningEvent2; + }(RunningEvent) + ); + var BaseContract = ( + /** @class */ + function() { + function BaseContract2(addressOrName, contractInterface, signerOrProvider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Contract); + (0, properties_1.defineReadOnly)(this, "interface", (0, properties_1.getStatic)(_newTarget, "getInterface")(contractInterface)); + if (signerOrProvider == null) { + (0, properties_1.defineReadOnly)(this, "provider", null); + (0, properties_1.defineReadOnly)(this, "signer", null); + } else if (abstract_signer_1.Signer.isSigner(signerOrProvider)) { + (0, properties_1.defineReadOnly)(this, "provider", signerOrProvider.provider || null); + (0, properties_1.defineReadOnly)(this, "signer", signerOrProvider); + } else if (abstract_provider_1.Provider.isProvider(signerOrProvider)) { + (0, properties_1.defineReadOnly)(this, "provider", signerOrProvider); + (0, properties_1.defineReadOnly)(this, "signer", null); + } else { + logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); + } + (0, properties_1.defineReadOnly)(this, "callStatic", {}); + (0, properties_1.defineReadOnly)(this, "estimateGas", {}); + (0, properties_1.defineReadOnly)(this, "functions", {}); + (0, properties_1.defineReadOnly)(this, "populateTransaction", {}); + (0, properties_1.defineReadOnly)(this, "filters", {}); + { + var uniqueFilters_1 = {}; + Object.keys(this.interface.events).forEach(function(eventSignature) { + var event = _this.interface.events[eventSignature]; + (0, properties_1.defineReadOnly)(_this.filters, eventSignature, function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return { + address: _this.address, + topics: _this.interface.encodeFilterTopics(event, args) + }; + }); + if (!uniqueFilters_1[event.name]) { + uniqueFilters_1[event.name] = []; + } + uniqueFilters_1[event.name].push(eventSignature); + }); + Object.keys(uniqueFilters_1).forEach(function(name2) { + var filters = uniqueFilters_1[name2]; + if (filters.length === 1) { + (0, properties_1.defineReadOnly)(_this.filters, name2, _this.filters[filters[0]]); + } else { + logger.warn("Duplicate definition of " + name2 + " (" + filters.join(", ") + ")"); + } + }); + } + (0, properties_1.defineReadOnly)(this, "_runningEvents", {}); + (0, properties_1.defineReadOnly)(this, "_wrappedEmits", {}); + if (addressOrName == null) { + logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); + } + (0, properties_1.defineReadOnly)(this, "address", addressOrName); + if (this.provider) { + (0, properties_1.defineReadOnly)(this, "resolvedAddress", resolveName(this.provider, addressOrName)); + } else { + try { + (0, properties_1.defineReadOnly)(this, "resolvedAddress", Promise.resolve((0, address_1.getAddress)(addressOrName))); + } catch (error) { + logger.throwError("provider is required to use ENS name as contract address", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Contract" + }); + } + } + var uniqueNames = {}; + var uniqueSignatures = {}; + Object.keys(this.interface.functions).forEach(function(signature) { + var fragment = _this.interface.functions[signature]; + if (uniqueSignatures[signature]) { + logger.warn("Duplicate ABI entry for " + JSON.stringify(signature)); + return; + } + uniqueSignatures[signature] = true; + { + var name_1 = fragment.name; + if (!uniqueNames["%" + name_1]) { + uniqueNames["%" + name_1] = []; + } + uniqueNames["%" + name_1].push(signature); + } + if (_this[signature] == null) { + (0, properties_1.defineReadOnly)(_this, signature, buildDefault(_this, fragment, true)); + } + if (_this.functions[signature] == null) { + (0, properties_1.defineReadOnly)(_this.functions, signature, buildDefault(_this, fragment, false)); + } + if (_this.callStatic[signature] == null) { + (0, properties_1.defineReadOnly)(_this.callStatic, signature, buildCall(_this, fragment, true)); + } + if (_this.populateTransaction[signature] == null) { + (0, properties_1.defineReadOnly)(_this.populateTransaction, signature, buildPopulate(_this, fragment)); + } + if (_this.estimateGas[signature] == null) { + (0, properties_1.defineReadOnly)(_this.estimateGas, signature, buildEstimate(_this, fragment)); + } + }); + Object.keys(uniqueNames).forEach(function(name2) { + var signatures = uniqueNames[name2]; + if (signatures.length > 1) { + return; + } + name2 = name2.substring(1); + var signature = signatures[0]; + try { + if (_this[name2] == null) { + (0, properties_1.defineReadOnly)(_this, name2, _this[signature]); + } + } catch (e) { + } + if (_this.functions[name2] == null) { + (0, properties_1.defineReadOnly)(_this.functions, name2, _this.functions[signature]); + } + if (_this.callStatic[name2] == null) { + (0, properties_1.defineReadOnly)(_this.callStatic, name2, _this.callStatic[signature]); + } + if (_this.populateTransaction[name2] == null) { + (0, properties_1.defineReadOnly)(_this.populateTransaction, name2, _this.populateTransaction[signature]); + } + if (_this.estimateGas[name2] == null) { + (0, properties_1.defineReadOnly)(_this.estimateGas, name2, _this.estimateGas[signature]); + } + }); + } + BaseContract2.getContractAddress = function(transaction) { + return (0, address_1.getContractAddress)(transaction); + }; + BaseContract2.getInterface = function(contractInterface) { + if (abi_1.Interface.isInterface(contractInterface)) { + return contractInterface; + } + return new abi_1.Interface(contractInterface); + }; + BaseContract2.prototype.deployed = function() { + return this._deployed(); + }; + BaseContract2.prototype._deployed = function(blockTag) { + var _this = this; + if (!this._deployedPromise) { + if (this.deployTransaction) { + this._deployedPromise = this.deployTransaction.wait().then(function() { + return _this; + }); + } else { + this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function(code) { + if (code === "0x") { + logger.throwError("contract not deployed", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + contractAddress: _this.address, + operation: "getDeployed" + }); + } + return _this; + }); + } + } + return this._deployedPromise; + }; + BaseContract2.prototype.fallback = function(overrides) { + var _this = this; + if (!this.signer) { + logger.throwError("sending a transactions require a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); + } + var tx = (0, properties_1.shallowCopy)(overrides || {}); + ["from", "to"].forEach(function(key) { + if (tx[key] == null) { + return; + } + logger.throwError("cannot override " + key, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key }); + }); + tx.to = this.resolvedAddress; + return this.deployed().then(function() { + return _this.signer.sendTransaction(tx); + }); + }; + BaseContract2.prototype.connect = function(signerOrProvider) { + if (typeof signerOrProvider === "string") { + signerOrProvider = new abstract_signer_1.VoidSigner(signerOrProvider, this.provider); + } + var contract = new this.constructor(this.address, this.interface, signerOrProvider); + if (this.deployTransaction) { + (0, properties_1.defineReadOnly)(contract, "deployTransaction", this.deployTransaction); + } + return contract; + }; + BaseContract2.prototype.attach = function(addressOrName) { + return new this.constructor(addressOrName, this.interface, this.signer || this.provider); + }; + BaseContract2.isIndexed = function(value) { + return abi_1.Indexed.isIndexed(value); + }; + BaseContract2.prototype._normalizeRunningEvent = function(runningEvent) { + if (this._runningEvents[runningEvent.tag]) { + return this._runningEvents[runningEvent.tag]; + } + return runningEvent; + }; + BaseContract2.prototype._getRunningEvent = function(eventName) { + if (typeof eventName === "string") { + if (eventName === "error") { + return this._normalizeRunningEvent(new ErrorRunningEvent()); + } + if (eventName === "event") { + return this._normalizeRunningEvent(new RunningEvent("event", null)); + } + if (eventName === "*") { + return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface)); + } + var fragment = this.interface.getEvent(eventName); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment)); + } + if (eventName.topics && eventName.topics.length > 0) { + try { + var topic = eventName.topics[0]; + if (typeof topic !== "string") { + throw new Error("invalid topic"); + } + var fragment = this.interface.getEvent(topic); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics)); + } catch (error) { + } + 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)); + }; + BaseContract2.prototype._checkRunningEvents = function(runningEvent) { + if (runningEvent.listenerCount() === 0) { + delete this._runningEvents[runningEvent.tag]; + var emit = this._wrappedEmits[runningEvent.tag]; + if (emit && runningEvent.filter) { + this.provider.off(runningEvent.filter, emit); + delete this._wrappedEmits[runningEvent.tag]; + } + } + }; + BaseContract2.prototype._wrapEvent = function(runningEvent, log, listener) { + var _this = this; + var event = (0, properties_1.deepCopy)(log); + event.removeListener = function() { + if (!listener) { + return; + } + runningEvent.removeListener(listener); + _this._checkRunningEvents(runningEvent); + }; + event.getBlock = function() { + return _this.provider.getBlock(log.blockHash); + }; + event.getTransaction = function() { + return _this.provider.getTransaction(log.transactionHash); + }; + event.getTransactionReceipt = function() { + return _this.provider.getTransactionReceipt(log.transactionHash); + }; + runningEvent.prepareEvent(event); + return event; + }; + BaseContract2.prototype._addEventListener = function(runningEvent, listener, once) { + var _this = this; + if (!this.provider) { + logger.throwError("events require a provider or a signer with a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" }); + } + runningEvent.addListener(listener, once); + this._runningEvents[runningEvent.tag] = runningEvent; + if (!this._wrappedEmits[runningEvent.tag]) { + var wrappedEmit = function(log) { + var event = _this._wrapEvent(runningEvent, log, listener); + if (event.decodeError == null) { + try { + var args = runningEvent.getEmit(event); + _this.emit.apply(_this, __spreadArray([runningEvent.filter], args, false)); + } catch (error) { + event.decodeError = error.error; + } + } + if (runningEvent.filter != null) { + _this.emit("event", event); + } + if (event.decodeError != null) { + _this.emit("error", event.decodeError, event); + } + }; + this._wrappedEmits[runningEvent.tag] = wrappedEmit; + if (runningEvent.filter != null) { + this.provider.on(runningEvent.filter, wrappedEmit); + } + } + }; + BaseContract2.prototype.queryFilter = function(event, fromBlockOrBlockhash, toBlock) { + var _this = this; + var runningEvent = this._getRunningEvent(event); + var filter = (0, properties_1.shallowCopy)(runningEvent.filter); + if (typeof fromBlockOrBlockhash === "string" && (0, bytes_1.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 _this._wrapEvent(runningEvent, log, null); + }); + }); + }; + BaseContract2.prototype.on = function(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, false); + return this; + }; + BaseContract2.prototype.once = function(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, true); + return this; + }; + BaseContract2.prototype.emit = function(eventName) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!this.provider) { + return false; + } + var runningEvent = this._getRunningEvent(eventName); + var result2 = runningEvent.run(args) > 0; + this._checkRunningEvents(runningEvent); + return result2; + }; + BaseContract2.prototype.listenerCount = function(eventName) { + var _this = this; + if (!this.provider) { + return 0; + } + if (eventName == null) { + return Object.keys(this._runningEvents).reduce(function(accum, key) { + return accum + _this._runningEvents[key].listenerCount(); + }, 0); + } + return this._getRunningEvent(eventName).listenerCount(); + }; + BaseContract2.prototype.listeners = function(eventName) { + if (!this.provider) { + return []; + } + if (eventName == null) { + var result_1 = []; + for (var tag in this._runningEvents) { + this._runningEvents[tag].listeners().forEach(function(listener) { + result_1.push(listener); + }); + } + return result_1; + } + return this._getRunningEvent(eventName).listeners(); + }; + BaseContract2.prototype.removeAllListeners = function(eventName) { + if (!this.provider) { + return this; + } + if (eventName == null) { + for (var tag in this._runningEvents) { + var runningEvent_1 = this._runningEvents[tag]; + runningEvent_1.removeAllListeners(); + this._checkRunningEvents(runningEvent_1); + } + return this; + } + var runningEvent = this._getRunningEvent(eventName); + runningEvent.removeAllListeners(); + this._checkRunningEvents(runningEvent); + return this; + }; + BaseContract2.prototype.off = function(eventName, listener) { + if (!this.provider) { + return this; + } + var runningEvent = this._getRunningEvent(eventName); + runningEvent.removeListener(listener); + this._checkRunningEvents(runningEvent); + return this; + }; + BaseContract2.prototype.removeListener = function(eventName, listener) { + return this.off(eventName, listener); + }; + return BaseContract2; + }() + ); + exports2.BaseContract = BaseContract; + var Contract = ( + /** @class */ + function(_super) { + __extends(Contract2, _super); + function Contract2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Contract2; + }(BaseContract) + ); + exports2.Contract = Contract; + var ContractFactory = ( + /** @class */ + function() { + function ContractFactory2(contractInterface, bytecode, signer) { + var _newTarget = this.constructor; + var bytecodeHex = null; + if (typeof bytecode === "string") { + bytecodeHex = bytecode; + } else if ((0, bytes_1.isBytes)(bytecode)) { + bytecodeHex = (0, bytes_1.hexlify)(bytecode); + } else if (bytecode && typeof bytecode.object === "string") { + bytecodeHex = bytecode.object; + } else { + bytecodeHex = "!"; + } + if (bytecodeHex.substring(0, 2) !== "0x") { + bytecodeHex = "0x" + bytecodeHex; + } + if (!(0, bytes_1.isHexString)(bytecodeHex) || bytecodeHex.length % 2) { + logger.throwArgumentError("invalid bytecode", "bytecode", bytecode); + } + if (signer && !abstract_signer_1.Signer.isSigner(signer)) { + logger.throwArgumentError("invalid signer", "signer", signer); + } + (0, properties_1.defineReadOnly)(this, "bytecode", bytecodeHex); + (0, properties_1.defineReadOnly)(this, "interface", (0, properties_1.getStatic)(_newTarget, "getInterface")(contractInterface)); + (0, properties_1.defineReadOnly)(this, "signer", signer || null); + } + ContractFactory2.prototype.getDeployTransaction = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var tx = {}; + if (args.length === this.interface.deploy.inputs.length + 1 && typeof args[args.length - 1] === "object") { + tx = (0, properties_1.shallowCopy)(args.pop()); + for (var key in tx) { + if (!allowedTransactionKeys[key]) { + throw new Error("unknown transaction override " + key); + } + } + } + ["data", "from", "to"].forEach(function(key2) { + if (tx[key2] == null) { + return; + } + logger.throwError("cannot override " + key2, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key2 }); + }); + if (tx.value) { + var value = bignumber_1.BigNumber.from(tx.value); + if (!value.isZero() && !this.interface.deploy.payable) { + logger.throwError("non-payable constructor cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: tx.value + }); + } + } + logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + tx.data = (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.bytecode, + this.interface.encodeDeploy(args) + ])); + return tx; + }; + ContractFactory2.prototype.deploy = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var overrides, params2, unsignedTx, tx, address, contract; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + overrides = {}; + if (args.length === this.interface.deploy.inputs.length + 1) { + overrides = args.pop(); + } + logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + return [4, resolveAddresses(this.signer, args, this.interface.deploy.inputs)]; + case 1: + params2 = _a.sent(); + params2.push(overrides); + unsignedTx = this.getDeployTransaction.apply(this, params2); + return [4, this.signer.sendTransaction(unsignedTx)]; + case 2: + tx = _a.sent(); + address = (0, properties_1.getStatic)(this.constructor, "getContractAddress")(tx); + contract = (0, properties_1.getStatic)(this.constructor, "getContract")(address, this.interface, this.signer); + addContractWait(contract, tx); + (0, properties_1.defineReadOnly)(contract, "deployTransaction", tx); + return [2, contract]; + } + }); + }); + }; + ContractFactory2.prototype.attach = function(address) { + return this.constructor.getContract(address, this.interface, this.signer); + }; + ContractFactory2.prototype.connect = function(signer) { + return new this.constructor(this.interface, this.bytecode, signer); + }; + ContractFactory2.fromSolidity = function(compilerOutput, signer) { + if (compilerOutput == null) { + logger.throwError("missing compiler output", logger_1.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); + }; + ContractFactory2.getInterface = function(contractInterface) { + return Contract.getInterface(contractInterface); + }; + ContractFactory2.getContractAddress = function(tx) { + return (0, address_1.getContractAddress)(tx); + }; + ContractFactory2.getContract = function(address, contractInterface, signer) { + return new Contract(address, contractInterface, signer); + }; + return ContractFactory2; + }() + ); + exports2.ContractFactory = ContractFactory; + } +}); + +// node_modules/@ethersproject/basex/lib/index.js +var require_lib17 = __commonJS({ + "node_modules/@ethersproject/basex/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Base58 = exports2.Base32 = exports2.BaseX = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var BaseX = ( + /** @class */ + function() { + function BaseX2(alphabet) { + (0, properties_1.defineReadOnly)(this, "alphabet", alphabet); + (0, properties_1.defineReadOnly)(this, "base", alphabet.length); + (0, properties_1.defineReadOnly)(this, "_alphabetMap", {}); + (0, properties_1.defineReadOnly)(this, "_leader", alphabet.charAt(0)); + for (var i = 0; i < alphabet.length; i++) { + this._alphabetMap[alphabet.charAt(i)] = i; + } + } + BaseX2.prototype.encode = function(value) { + var source = (0, bytes_1.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 = ""; + for (var k = 0; source[k] === 0 && k < source.length - 1; ++k) { + string += this._leader; + } + for (var q = digits.length - 1; q >= 0; --q) { + string += this.alphabet[digits[q]]; + } + return string; + }; + BaseX2.prototype.decode = function(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 === void 0) { + 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 & 255; + carry >>= 8; + } + while (carry > 0) { + bytes.push(carry & 255); + carry >>= 8; + } + } + for (var k = 0; value[k] === this._leader && k < value.length - 1; ++k) { + bytes.push(0); + } + return (0, bytes_1.arrayify)(new Uint8Array(bytes.reverse())); + }; + return BaseX2; + }() + ); + exports2.BaseX = BaseX; + var Base32 = new BaseX("abcdefghijklmnopqrstuvwxyz234567"); + exports2.Base32 = Base32; + var Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); + exports2.Base58 = Base58; + } +}); + +// node_modules/@ethersproject/pbkdf2/lib/pbkdf2.js +var require_pbkdf2 = __commonJS({ + "node_modules/@ethersproject/pbkdf2/lib/pbkdf2.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.pbkdf2 = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + function bufferify(value) { + return Buffer.from((0, bytes_1.arrayify)(value)); + } + function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { + return (0, bytes_1.hexlify)((0, crypto_1.pbkdf2Sync)(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm)); + } + exports2.pbkdf2 = pbkdf2; + } +}); + +// node_modules/@ethersproject/pbkdf2/lib/index.js +var require_lib18 = __commonJS({ + "node_modules/@ethersproject/pbkdf2/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.pbkdf2 = void 0; + var pbkdf2_1 = require_pbkdf2(); + Object.defineProperty(exports2, "pbkdf2", { enumerable: true, get: function() { + return pbkdf2_1.pbkdf2; + } }); + } +}); + +// node_modules/@ethersproject/sha2/lib/types.js +var require_types = __commonJS({ + "node_modules/@ethersproject/sha2/lib/types.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SupportedAlgorithm = void 0; + var SupportedAlgorithm; + (function(SupportedAlgorithm2) { + SupportedAlgorithm2["sha256"] = "sha256"; + SupportedAlgorithm2["sha512"] = "sha512"; + })(SupportedAlgorithm = exports2.SupportedAlgorithm || (exports2.SupportedAlgorithm = {})); + } +}); + +// node_modules/@ethersproject/sha2/lib/_version.js +var require_version15 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "sha2/5.5.0"; + } +}); + +// node_modules/@ethersproject/sha2/lib/sha2.js +var require_sha2 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/sha2.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.computeHmac = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + var types_1 = require_types(); + var logger_1 = require_lib(); + var _version_1 = require_version15(); + var logger = new logger_1.Logger(_version_1.version); + function ripemd160(data) { + return "0x" + (0, crypto_1.createHash)("ripemd160").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.ripemd160 = ripemd160; + function sha256(data) { + return "0x" + (0, crypto_1.createHash)("sha256").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.sha256 = sha256; + function sha512(data) { + return "0x" + (0, crypto_1.createHash)("sha512").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.sha512 = sha512; + function computeHmac(algorithm, key, data) { + if (!types_1.SupportedAlgorithm[algorithm]) { + logger.throwError("unsupported algorithm - " + algorithm, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "computeHmac", + algorithm + }); + } + return "0x" + (0, crypto_1.createHmac)(algorithm, Buffer.from((0, bytes_1.arrayify)(key))).update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.computeHmac = computeHmac; + } +}); + +// node_modules/@ethersproject/sha2/lib/index.js +var require_lib19 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SupportedAlgorithm = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = exports2.computeHmac = void 0; + var sha2_1 = require_sha2(); + Object.defineProperty(exports2, "computeHmac", { enumerable: true, get: function() { + return sha2_1.computeHmac; + } }); + Object.defineProperty(exports2, "ripemd160", { enumerable: true, get: function() { + return sha2_1.ripemd160; + } }); + Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() { + return sha2_1.sha256; + } }); + Object.defineProperty(exports2, "sha512", { enumerable: true, get: function() { + return sha2_1.sha512; + } }); + var types_1 = require_types(); + Object.defineProperty(exports2, "SupportedAlgorithm", { enumerable: true, get: function() { + return types_1.SupportedAlgorithm; + } }); + } +}); + +// node_modules/@ethersproject/wordlists/lib/_version.js +var require_version16 = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "wordlists/5.5.0"; + } +}); + +// node_modules/@ethersproject/wordlists/lib/wordlist.js +var require_wordlist = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/wordlist.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.logger = void 0; + var exportWordlist = false; + var hash_1 = require_lib10(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version16(); + exports2.logger = new logger_1.Logger(_version_1.version); + var Wordlist = ( + /** @class */ + function() { + function Wordlist2(locale) { + var _newTarget = this.constructor; + exports2.logger.checkAbstract(_newTarget, Wordlist2); + (0, properties_1.defineReadOnly)(this, "locale", locale); + } + Wordlist2.prototype.split = function(mnemonic) { + return mnemonic.toLowerCase().split(/ +/g); + }; + Wordlist2.prototype.join = function(words) { + return words.join(" "); + }; + Wordlist2.check = function(wordlist) { + var words = []; + for (var i = 0; i < 2048; i++) { + var word = wordlist.getWord(i); + if (i !== wordlist.getWordIndex(word)) { + return "0x"; + } + words.push(word); + } + return (0, hash_1.id)(words.join("\n") + "\n"); + }; + Wordlist2.register = function(lang, name2) { + if (!name2) { + name2 = lang.locale; + } + if (exportWordlist) { + try { + var anyGlobal = window; + if (anyGlobal._ethers && anyGlobal._ethers.wordlists) { + if (!anyGlobal._ethers.wordlists[name2]) { + (0, properties_1.defineReadOnly)(anyGlobal._ethers.wordlists, name2, lang); + } + } + } catch (error) { + } + } + }; + return Wordlist2; + }() + ); + exports2.Wordlist = Wordlist; + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-cz.js +var require_lang_cz = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-cz.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langCz = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbdikaceAbecedaAdresaAgreseAkceAktovkaAlejAlkoholAmputaceAnanasAndulkaAnekdotaAnketaAntikaAnulovatArchaAroganceAsfaltAsistentAspiraceAstmaAstronomAtlasAtletikaAtolAutobusAzylBabkaBachorBacilBaculkaBadatelBagetaBagrBahnoBakterieBaladaBaletkaBalkonBalonekBalvanBalzaBambusBankomatBarbarBaretBarmanBarokoBarvaBaterkaBatohBavlnaBazalkaBazilikaBazukaBednaBeranBesedaBestieBetonBezinkaBezmocBeztakBicyklBidloBiftekBikinyBilanceBiografBiologBitvaBizonBlahobytBlatouchBlechaBleduleBleskBlikatBliznaBlokovatBlouditBludBobekBobrBodlinaBodnoutBohatostBojkotBojovatBokorysBolestBorecBoroviceBotaBoubelBouchatBoudaBouleBouratBoxerBradavkaBramboraBrankaBratrBreptaBriketaBrkoBrlohBronzBroskevBrunetkaBrusinkaBrzdaBrzyBublinaBubnovatBuchtaBuditelBudkaBudovaBufetBujarostBukviceBuldokBulvaBundaBunkrBurzaButikBuvolBuzolaBydletBylinaBytovkaBzukotCapartCarevnaCedrCeduleCejchCejnCelaCelerCelkemCelniceCeninaCennostCenovkaCentrumCenzorCestopisCetkaChalupaChapadloCharitaChataChechtatChemieChichotChirurgChladChlebaChlubitChmelChmuraChobotChocholChodbaCholeraChomoutChopitChorobaChovChrapotChrlitChrtChrupChtivostChudinaChutnatChvatChvilkaChvostChybaChystatChytitCibuleCigaretaCihelnaCihlaCinkotCirkusCisternaCitaceCitrusCizinecCizostClonaCokolivCouvatCtitelCtnostCudnostCuketaCukrCupotCvaknoutCvalCvikCvrkotCyklistaDalekoDarebaDatelDatumDceraDebataDechovkaDecibelDeficitDeflaceDeklDekretDemokratDepreseDerbyDeskaDetektivDikobrazDiktovatDiodaDiplomDiskDisplejDivadloDivochDlahaDlouhoDluhopisDnesDobroDobytekDocentDochutitDodnesDohledDohodaDohraDojemDojniceDokladDokolaDoktorDokumentDolarDolevaDolinaDomaDominantDomluvitDomovDonutitDopadDopisDoplnitDoposudDoprovodDopustitDorazitDorostDortDosahDoslovDostatekDosudDosytaDotazDotekDotknoutDoufatDoutnatDovozceDozaduDoznatDozorceDrahotaDrakDramatikDravecDrazeDrdolDrobnostDrogerieDrozdDrsnostDrtitDrzostDubenDuchovnoDudekDuhaDuhovkaDusitDusnoDutostDvojiceDvorecDynamitEkologEkonomieElektronElipsaEmailEmiseEmoceEmpatieEpizodaEpochaEpopejEposEsejEsenceEskortaEskymoEtiketaEuforieEvoluceExekuceExkurzeExpediceExplozeExportExtraktFackaFajfkaFakultaFanatikFantazieFarmacieFavoritFazoleFederaceFejetonFenkaFialkaFigurantFilozofFiltrFinanceFintaFixaceFjordFlanelFlirtFlotilaFondFosforFotbalFotkaFotonFrakceFreskaFrontaFukarFunkceFyzikaGalejeGarantGenetikaGeologGilotinaGlazuraGlejtGolemGolfistaGotikaGrafGramofonGranuleGrepGrilGrogGroteskaGumaHadiceHadrHalaHalenkaHanbaHanopisHarfaHarpunaHavranHebkostHejkalHejnoHejtmanHektarHelmaHematomHerecHernaHesloHezkyHistorikHladovkaHlasivkyHlavaHledatHlenHlodavecHlohHloupostHltatHlubinaHluchotaHmatHmotaHmyzHnisHnojivoHnoutHoblinaHobojHochHodinyHodlatHodnotaHodovatHojnostHokejHolinkaHolkaHolubHomoleHonitbaHonoraceHoralHordaHorizontHorkoHorlivecHormonHorninaHoroskopHorstvoHospodaHostinaHotovostHoubaHoufHoupatHouskaHovorHradbaHraniceHravostHrazdaHrbolekHrdinaHrdloHrdostHrnekHrobkaHromadaHrotHroudaHrozenHrstkaHrubostHryzatHubenostHubnoutHudbaHukotHumrHusitaHustotaHvozdHybnostHydrantHygienaHymnaHysterikIdylkaIhnedIkonaIluzeImunitaInfekceInflaceInkasoInovaceInspekceInternetInvalidaInvestorInzerceIronieJablkoJachtaJahodaJakmileJakostJalovecJantarJarmarkJaroJasanJasnoJatkaJavorJazykJedinecJedleJednatelJehlanJekotJelenJelitoJemnostJenomJepiceJeseterJevitJezdecJezeroJinakJindyJinochJiskraJistotaJitrniceJizvaJmenovatJogurtJurtaKabaretKabelKabinetKachnaKadetKadidloKahanKajakKajutaKakaoKaktusKalamitaKalhotyKalibrKalnostKameraKamkolivKamnaKanibalKanoeKantorKapalinaKapelaKapitolaKapkaKapleKapotaKaprKapustaKapybaraKaramelKarotkaKartonKasaKatalogKatedraKauceKauzaKavalecKazajkaKazetaKazivostKdekolivKdesiKedlubenKempKeramikaKinoKlacekKladivoKlamKlapotKlasikaKlaunKlecKlenbaKlepatKlesnoutKlidKlimaKlisnaKloboukKlokanKlopaKloubKlubovnaKlusatKluzkostKmenKmitatKmotrKnihaKnotKoaliceKoberecKobkaKoblihaKobylaKocourKohoutKojenecKokosKoktejlKolapsKoledaKolizeKoloKomandoKometaKomikKomnataKomoraKompasKomunitaKonatKonceptKondiceKonecKonfeseKongresKoninaKonkursKontaktKonzervaKopanecKopieKopnoutKoprovkaKorbelKorektorKormidloKoroptevKorpusKorunaKorytoKorzetKosatecKostkaKotelKotletaKotoulKoukatKoupelnaKousekKouzloKovbojKozaKozorohKrabiceKrachKrajinaKralovatKrasopisKravataKreditKrejcarKresbaKrevetaKriketKritikKrizeKrkavecKrmelecKrmivoKrocanKrokKronikaKropitKroupaKrovkaKrtekKruhadloKrupiceKrutostKrvinkaKrychleKryptaKrystalKrytKudlankaKufrKujnostKuklaKulajdaKulichKulkaKulometKulturaKunaKupodivuKurtKurzorKutilKvalitaKvasinkaKvestorKynologKyselinaKytaraKyticeKytkaKytovecKyvadloLabradorLachtanLadnostLaikLakomecLamelaLampaLanovkaLasiceLasoLasturaLatinkaLavinaLebkaLeckdyLedenLedniceLedovkaLedvinaLegendaLegieLegraceLehceLehkostLehnoutLektvarLenochodLentilkaLepenkaLepidloLetadloLetecLetmoLetokruhLevhartLevitaceLevobokLibraLichotkaLidojedLidskostLihovinaLijavecLilekLimetkaLinieLinkaLinoleumListopadLitinaLitovatLobistaLodivodLogikaLogopedLokalitaLoketLomcovatLopataLopuchLordLososLotrLoudalLouhLoukaLouskatLovecLstivostLucernaLuciferLumpLuskLustraceLviceLyraLyrikaLysinaMadamMadloMagistrMahagonMajetekMajitelMajoritaMakakMakoviceMakrelaMalbaMalinaMalovatMalviceMaminkaMandleMankoMarnostMasakrMaskotMasopustMaticeMatrikaMaturitaMazanecMazivoMazlitMazurkaMdlobaMechanikMeditaceMedovinaMelasaMelounMentolkaMetlaMetodaMetrMezeraMigraceMihnoutMihuleMikinaMikrofonMilenecMilimetrMilostMimikaMincovnaMinibarMinometMinulostMiskaMistrMixovatMladostMlhaMlhovinaMlokMlsatMluvitMnichMnohemMobilMocnostModelkaModlitbaMohylaMokroMolekulaMomentkaMonarchaMonoklMonstrumMontovatMonzunMosazMoskytMostMotivaceMotorkaMotykaMouchaMoudrostMozaikaMozekMozolMramorMravenecMrkevMrtvolaMrzetMrzutostMstitelMudrcMuflonMulatMumieMuniceMusetMutaceMuzeumMuzikantMyslivecMzdaNabouratNachytatNadaceNadbytekNadhozNadobroNadpisNahlasNahnatNahodileNahraditNaivitaNajednouNajistoNajmoutNaklonitNakonecNakrmitNalevoNamazatNamluvitNanometrNaokoNaopakNaostroNapadatNapevnoNaplnitNapnoutNaposledNaprostoNaroditNarubyNarychloNasaditNasekatNaslepoNastatNatolikNavenekNavrchNavzdoryNazvatNebeNechatNeckyNedalekoNedbatNeduhNegaceNehetNehodaNejenNejprveNeklidNelibostNemilostNemocNeochotaNeonkaNepokojNerostNervNesmyslNesouladNetvorNeuronNevinaNezvykleNicotaNijakNikamNikdyNiklNikterakNitroNoclehNohaviceNominaceNoraNorekNositelNosnostNouzeNovinyNovotaNozdraNudaNudleNugetNutitNutnostNutrieNymfaObalObarvitObavaObdivObecObehnatObejmoutObezitaObhajobaObilniceObjasnitObjektObklopitOblastOblekOblibaOblohaObludaObnosObohatitObojekOboutObrazecObrnaObrubaObrysObsahObsluhaObstaratObuvObvazObvinitObvodObvykleObyvatelObzorOcasOcelOcenitOchladitOchotaOchranaOcitnoutOdbojOdbytOdchodOdcizitOdebratOdeslatOdevzdatOdezvaOdhadceOdhoditOdjetOdjinudOdkazOdkoupitOdlivOdlukaOdmlkaOdolnostOdpadOdpisOdploutOdporOdpustitOdpykatOdrazkaOdsouditOdstupOdsunOdtokOdtudOdvahaOdvetaOdvolatOdvracetOdznakOfinaOfsajdOhlasOhniskoOhradaOhrozitOhryzekOkapOkeniceOklikaOknoOkouzlitOkovyOkrasaOkresOkrsekOkruhOkupantOkurkaOkusitOlejninaOlizovatOmakOmeletaOmezitOmladinaOmlouvatOmluvaOmylOnehdyOpakovatOpasekOperaceOpiceOpilostOpisovatOporaOpoziceOpravduOprotiOrbitalOrchestrOrgieOrliceOrlojOrtelOsadaOschnoutOsikaOsivoOslavaOslepitOslnitOslovitOsnovaOsobaOsolitOspalecOstenOstrahaOstudaOstychOsvojitOteplitOtiskOtopOtrhatOtrlostOtrokOtrubyOtvorOvanoutOvarOvesOvlivnitOvoceOxidOzdobaPachatelPacientPadouchPahorekPaktPalandaPalecPalivoPalubaPamfletPamlsekPanenkaPanikaPannaPanovatPanstvoPantoflePaprikaParketaParodiePartaParukaParybaPasekaPasivitaPastelkaPatentPatronaPavoukPaznehtPazourekPeckaPedagogPejsekPekloPelotonPenaltaPendrekPenzePeriskopPeroPestrostPetardaPeticePetrolejPevninaPexesoPianistaPihaPijavicePiklePiknikPilinaPilnostPilulkaPinzetaPipetaPisatelPistolePitevnaPivnicePivovarPlacentaPlakatPlamenPlanetaPlastikaPlatitPlavidloPlazPlechPlemenoPlentaPlesPletivoPlevelPlivatPlnitPlnoPlochaPlodinaPlombaPloutPlukPlynPobavitPobytPochodPocitPoctivecPodatPodcenitPodepsatPodhledPodivitPodkladPodmanitPodnikPodobaPodporaPodrazPodstataPodvodPodzimPoeziePohankaPohnutkaPohovorPohromaPohybPointaPojistkaPojmoutPokazitPoklesPokojPokrokPokutaPokynPolednePolibekPolknoutPolohaPolynomPomaluPominoutPomlkaPomocPomstaPomysletPonechatPonorkaPonurostPopadatPopelPopisekPoplachPoprositPopsatPopudPoradcePorcePorodPoruchaPoryvPosaditPosedPosilaPoskokPoslanecPosouditPospoluPostavaPosudekPosypPotahPotkanPotleskPotomekPotravaPotupaPotvoraPoukazPoutoPouzdroPovahaPovidlaPovlakPovozPovrchPovstatPovykPovzdechPozdravPozemekPoznatekPozorPozvatPracovatPrahoryPraktikaPralesPraotecPraporekPrasePravdaPrincipPrknoProbuditProcentoProdejProfeseProhraProjektProlomitPromilePronikatPropadProrokProsbaProtonProutekProvazPrskavkaPrstenPrudkostPrutPrvekPrvohoryPsanecPsovodPstruhPtactvoPubertaPuchPudlPukavecPuklinaPukrlePultPumpaPuncPupenPusaPusinkaPustinaPutovatPutykaPyramidaPyskPytelRacekRachotRadiaceRadniceRadonRaftRagbyRaketaRakovinaRamenoRampouchRandeRarachRaritaRasovnaRastrRatolestRazanceRazidloReagovatReakceReceptRedaktorReferentReflexRejnokReklamaRekordRekrutRektorReputaceRevizeRevmaRevolverRezervaRiskovatRizikoRobotikaRodokmenRohovkaRokleRokokoRomanetoRopovodRopuchaRorejsRosolRostlinaRotmistrRotopedRotundaRoubenkaRouchoRoupRouraRovinaRovniceRozborRozchodRozdatRozeznatRozhodceRozinkaRozjezdRozkazRozlohaRozmarRozpadRozruchRozsahRoztokRozumRozvodRubrikaRuchadloRukaviceRukopisRybaRybolovRychlostRydloRypadloRytinaRyzostSadistaSahatSakoSamecSamizdatSamotaSanitkaSardinkaSasankaSatelitSazbaSazeniceSborSchovatSebrankaSeceseSedadloSedimentSedloSehnatSejmoutSekeraSektaSekundaSekvojeSemenoSenoServisSesaditSeshoraSeskokSeslatSestraSesuvSesypatSetbaSetinaSetkatSetnoutSetrvatSeverSeznamShodaShrnoutSifonSilniceSirkaSirotekSirupSituaceSkafandrSkaliskoSkanzenSkautSkeptikSkicaSkladbaSkleniceSkloSkluzSkobaSkokanSkoroSkriptaSkrzSkupinaSkvostSkvrnaSlabikaSladidloSlaninaSlastSlavnostSledovatSlepecSlevaSlezinaSlibSlinaSlizniceSlonSloupekSlovoSluchSluhaSlunceSlupkaSlzaSmaragdSmetanaSmilstvoSmlouvaSmogSmradSmrkSmrtkaSmutekSmyslSnadSnahaSnobSobotaSochaSodovkaSokolSopkaSotvaSoubojSoucitSoudceSouhlasSouladSoumrakSoupravaSousedSoutokSouvisetSpalovnaSpasitelSpisSplavSpodekSpojenecSpoluSponzorSpornostSpoustaSprchaSpustitSrandaSrazSrdceSrnaSrnecSrovnatSrpenSrstSrubStaniceStarostaStatikaStavbaStehnoStezkaStodolaStolekStopaStornoStoupatStrachStresStrhnoutStromStrunaStudnaStupniceStvolStykSubjektSubtropySucharSudostSuknoSundatSunoutSurikataSurovinaSvahSvalstvoSvetrSvatbaSvazekSvisleSvitekSvobodaSvodidloSvorkaSvrabSykavkaSykotSynekSynovecSypatSypkostSyrovostSyselSytostTabletkaTabuleTahounTajemnoTajfunTajgaTajitTajnostTaktikaTamhleTamponTancovatTanecTankerTapetaTaveninaTazatelTechnikaTehdyTekutinaTelefonTemnotaTendenceTenistaTenorTeplotaTepnaTeprveTerapieTermoskaTextilTichoTiskopisTitulekTkadlecTkaninaTlapkaTleskatTlukotTlupaTmelToaletaTopinkaTopolTorzoTouhaToulecTradiceTraktorTrampTrasaTraverzaTrefitTrestTrezorTrhavinaTrhlinaTrochuTrojiceTroskaTroubaTrpceTrpitelTrpkostTrubecTruchlitTruhliceTrusTrvatTudyTuhnoutTuhostTundraTuristaTurnajTuzemskoTvarohTvorbaTvrdostTvrzTygrTykevUbohostUbozeUbratUbrousekUbrusUbytovnaUchoUctivostUdivitUhraditUjednatUjistitUjmoutUkazatelUklidnitUklonitUkotvitUkrojitUliceUlitaUlovitUmyvadloUnavitUniformaUniknoutUpadnoutUplatnitUplynoutUpoutatUpravitUranUrazitUsednoutUsilovatUsmrtitUsnadnitUsnoutUsouditUstlatUstrnoutUtahovatUtkatUtlumitUtonoutUtopenecUtrousitUvalitUvolnitUvozovkaUzdravitUzelUzeninaUzlinaUznatVagonValchaValounVanaVandalVanilkaVaranVarhanyVarovatVcelkuVchodVdovaVedroVegetaceVejceVelbloudVeletrhVelitelVelmocVelrybaVenkovVerandaVerzeVeselkaVeskrzeVesniceVespoduVestaVeterinaVeverkaVibraceVichrVideohraVidinaVidleVilaViniceVisetVitalitaVizeVizitkaVjezdVkladVkusVlajkaVlakVlasecVlevoVlhkostVlivVlnovkaVloupatVnucovatVnukVodaVodivostVodoznakVodstvoVojenskyVojnaVojskoVolantVolbaVolitVolnoVoskovkaVozidloVozovnaVpravoVrabecVracetVrahVrataVrbaVrcholekVrhatVrstvaVrtuleVsaditVstoupitVstupVtipVybavitVybratVychovatVydatVydraVyfotitVyhledatVyhnoutVyhoditVyhraditVyhubitVyjasnitVyjetVyjmoutVyklopitVykonatVylekatVymazatVymezitVymizetVymysletVynechatVynikatVynutitVypadatVyplatitVypravitVypustitVyrazitVyrovnatVyrvatVyslovitVysokoVystavitVysunoutVysypatVytasitVytesatVytratitVyvinoutVyvolatVyvrhelVyzdobitVyznatVzaduVzbuditVzchopitVzdorVzduchVzdychatVzestupVzhledemVzkazVzlykatVznikVzorekVzpouraVztahVztekXylofonZabratZabydletZachovatZadarmoZadusitZafoukatZahltitZahoditZahradaZahynoutZajatecZajetZajistitZaklepatZakoupitZalepitZamezitZamotatZamysletZanechatZanikatZaplatitZapojitZapsatZarazitZastavitZasunoutZatajitZatemnitZatknoutZaujmoutZavalitZaveletZavinitZavolatZavrtatZazvonitZbavitZbrusuZbudovatZbytekZdalekaZdarmaZdatnostZdivoZdobitZdrojZdvihZdymadloZeleninaZemanZeminaZeptatZezaduZezdolaZhatitZhltnoutZhlubokaZhotovitZhrubaZimaZimniceZjemnitZklamatZkoumatZkratkaZkumavkaZlatoZlehkaZlobaZlomZlostZlozvykZmapovatZmarZmatekZmijeZmizetZmocnitZmodratZmrzlinaZmutovatZnakZnalostZnamenatZnovuZobrazitZotavitZoubekZoufaleZploditZpomalitZpravaZprostitZprudkaZprvuZradaZranitZrcadloZrnitostZrnoZrovnaZrychlitZrzavostZtichaZtratitZubovinaZubrZvednoutZvenkuZveselaZvonZvratZvukovodZvyk"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } + } + var LangCz = ( + /** @class */ + function(_super) { + __extends(LangCz2, _super); + function LangCz2() { + return _super.call(this, "cz") || this; + } + LangCz2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangCz2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangCz2; + }(wordlist_1.Wordlist) + ); + var langCz = new LangCz(); + exports2.langCz = langCz; + wordlist_1.Wordlist.register(langCz); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-en.js +var require_lang_en = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-en.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langEn = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } + } + var LangEn = ( + /** @class */ + function(_super) { + __extends(LangEn2, _super); + function LangEn2() { + return _super.call(this, "en") || this; + } + LangEn2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangEn2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangEn2; + }(wordlist_1.Wordlist) + ); + var langEn = new LangEn(); + exports2.langEn = langEn; + wordlist_1.Wordlist.register(langEn); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-es.js +var require_lang_es = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-es.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langEs = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var words = "A/bacoAbdomenAbejaAbiertoAbogadoAbonoAbortoAbrazoAbrirAbueloAbusoAcabarAcademiaAccesoAccio/nAceiteAcelgaAcentoAceptarA/cidoAclararAcne/AcogerAcosoActivoActoActrizActuarAcudirAcuerdoAcusarAdictoAdmitirAdoptarAdornoAduanaAdultoAe/reoAfectarAficio/nAfinarAfirmarA/gilAgitarAgoni/aAgostoAgotarAgregarAgrioAguaAgudoA/guilaAgujaAhogoAhorroAireAislarAjedrezAjenoAjusteAlacra/nAlambreAlarmaAlbaA/lbumAlcaldeAldeaAlegreAlejarAlertaAletaAlfilerAlgaAlgodo/nAliadoAlientoAlivioAlmaAlmejaAlmi/barAltarAltezaAltivoAltoAlturaAlumnoAlzarAmableAmanteAmapolaAmargoAmasarA/mbarA/mbitoAmenoAmigoAmistadAmorAmparoAmplioAnchoAncianoAnclaAndarAnde/nAnemiaA/nguloAnilloA/nimoAni/sAnotarAntenaAntiguoAntojoAnualAnularAnuncioA~adirA~ejoA~oApagarAparatoApetitoApioAplicarApodoAporteApoyoAprenderAprobarApuestaApuroAradoAra~aArarA/rbitroA/rbolArbustoArchivoArcoArderArdillaArduoA/reaA/ridoAriesArmoni/aArne/sAromaArpaArpo/nArregloArrozArrugaArteArtistaAsaAsadoAsaltoAscensoAsegurarAseoAsesorAsientoAsiloAsistirAsnoAsombroA/speroAstillaAstroAstutoAsumirAsuntoAtajoAtaqueAtarAtentoAteoA/ticoAtletaA/tomoAtraerAtrozAtu/nAudazAudioAugeAulaAumentoAusenteAutorAvalAvanceAvaroAveAvellanaAvenaAvestruzAvio/nAvisoAyerAyudaAyunoAzafra/nAzarAzoteAzu/carAzufreAzulBabaBaborBacheBahi/aBaileBajarBalanzaBalco/nBaldeBambu/BancoBandaBa~oBarbaBarcoBarnizBarroBa/sculaBasto/nBasuraBatallaBateri/aBatirBatutaBau/lBazarBebe/BebidaBelloBesarBesoBestiaBichoBienBingoBlancoBloqueBlusaBoaBobinaBoboBocaBocinaBodaBodegaBoinaBolaBoleroBolsaBombaBondadBonitoBonoBonsa/iBordeBorrarBosqueBoteBoti/nBo/vedaBozalBravoBrazoBrechaBreveBrilloBrincoBrisaBrocaBromaBronceBroteBrujaBruscoBrutoBuceoBucleBuenoBueyBufandaBufo/nBu/hoBuitreBultoBurbujaBurlaBurroBuscarButacaBuzo/nCaballoCabezaCabinaCabraCacaoCada/verCadenaCaerCafe/Cai/daCaima/nCajaCajo/nCalCalamarCalcioCaldoCalidadCalleCalmaCalorCalvoCamaCambioCamelloCaminoCampoCa/ncerCandilCanelaCanguroCanicaCantoCa~aCa~o/nCaobaCaosCapazCapita/nCapoteCaptarCapuchaCaraCarbo/nCa/rcelCaretaCargaCari~oCarneCarpetaCarroCartaCasaCascoCaseroCaspaCastorCatorceCatreCaudalCausaCazoCebollaCederCedroCeldaCe/lebreCelosoCe/lulaCementoCenizaCentroCercaCerdoCerezaCeroCerrarCertezaCe/spedCetroChacalChalecoChampu/ChanclaChapaCharlaChicoChisteChivoChoqueChozaChuletaChuparCiclo/nCiegoCieloCienCiertoCifraCigarroCimaCincoCineCintaCipre/sCircoCiruelaCisneCitaCiudadClamorClanClaroClaseClaveClienteClimaCli/nicaCobreCoccio/nCochinoCocinaCocoCo/digoCodoCofreCogerCoheteCoji/nCojoColaColchaColegioColgarColinaCollarColmoColumnaCombateComerComidaCo/modoCompraCondeConejoCongaConocerConsejoContarCopaCopiaCorazo/nCorbataCorchoCordo/nCoronaCorrerCoserCosmosCostaCra/neoCra/terCrearCrecerCrei/doCremaCri/aCrimenCriptaCrisisCromoCro/nicaCroquetaCrudoCruzCuadroCuartoCuatroCuboCubrirCucharaCuelloCuentoCuerdaCuestaCuevaCuidarCulebraCulpaCultoCumbreCumplirCunaCunetaCuotaCupo/nCu/pulaCurarCuriosoCursoCurvaCutisDamaDanzaDarDardoDa/tilDeberDe/bilDe/cadaDecirDedoDefensaDefinirDejarDelfi/nDelgadoDelitoDemoraDensoDentalDeporteDerechoDerrotaDesayunoDeseoDesfileDesnudoDestinoDesvi/oDetalleDetenerDeudaDi/aDiabloDiademaDiamanteDianaDiarioDibujoDictarDienteDietaDiezDifi/cilDignoDilemaDiluirDineroDirectoDirigirDiscoDise~oDisfrazDivaDivinoDobleDoceDolorDomingoDonDonarDoradoDormirDorsoDosDosisDrago/nDrogaDuchaDudaDueloDue~oDulceDu/oDuqueDurarDurezaDuroE/banoEbrioEcharEcoEcuadorEdadEdicio/nEdificioEditorEducarEfectoEficazEjeEjemploElefanteElegirElementoElevarElipseE/liteElixirElogioEludirEmbudoEmitirEmocio/nEmpateEmpe~oEmpleoEmpresaEnanoEncargoEnchufeEnci/aEnemigoEneroEnfadoEnfermoEnga~oEnigmaEnlaceEnormeEnredoEnsayoEnse~arEnteroEntrarEnvaseEnvi/oE/pocaEquipoErizoEscalaEscenaEscolarEscribirEscudoEsenciaEsferaEsfuerzoEspadaEspejoEspi/aEsposaEspumaEsqui/EstarEsteEstiloEstufaEtapaEternoE/ticaEtniaEvadirEvaluarEventoEvitarExactoExamenExcesoExcusaExentoExigirExilioExistirE/xitoExpertoExplicarExponerExtremoFa/bricaFa/bulaFachadaFa/cilFactorFaenaFajaFaldaFalloFalsoFaltarFamaFamiliaFamosoFarao/nFarmaciaFarolFarsaFaseFatigaFaunaFavorFaxFebreroFechaFelizFeoFeriaFerozFe/rtilFervorFesti/nFiableFianzaFiarFibraFiccio/nFichaFideoFiebreFielFieraFiestaFiguraFijarFijoFilaFileteFilialFiltroFinFincaFingirFinitoFirmaFlacoFlautaFlechaFlorFlotaFluirFlujoFlu/orFobiaFocaFogataFogo/nFolioFolletoFondoFormaForroFortunaForzarFosaFotoFracasoFra/gilFranjaFraseFraudeFrei/rFrenoFresaFri/oFritoFrutaFuegoFuenteFuerzaFugaFumarFuncio/nFundaFurgo/nFuriaFusilFu/tbolFuturoGacelaGafasGaitaGajoGalaGaleri/aGalloGambaGanarGanchoGangaGansoGarajeGarzaGasolinaGastarGatoGavila/nGemeloGemirGenGe/neroGenioGenteGeranioGerenteGermenGestoGiganteGimnasioGirarGiroGlaciarGloboGloriaGolGolfoGolosoGolpeGomaGordoGorilaGorraGotaGoteoGozarGradaGra/ficoGranoGrasaGratisGraveGrietaGrilloGripeGrisGritoGrosorGru/aGruesoGrumoGrupoGuanteGuapoGuardiaGuerraGui/aGui~oGuionGuisoGuitarraGusanoGustarHaberHa/bilHablarHacerHachaHadaHallarHamacaHarinaHazHaza~aHebillaHebraHechoHeladoHelioHembraHerirHermanoHe/roeHervirHieloHierroHi/gadoHigieneHijoHimnoHistoriaHocicoHogarHogueraHojaHombreHongoHonorHonraHoraHormigaHornoHostilHoyoHuecoHuelgaHuertaHuesoHuevoHuidaHuirHumanoHu/medoHumildeHumoHundirHuraca/nHurtoIconoIdealIdiomaI/doloIglesiaIglu/IgualIlegalIlusio/nImagenIma/nImitarImparImperioImponerImpulsoIncapazI/ndiceInerteInfielInformeIngenioInicioInmensoInmuneInnatoInsectoInstanteIntere/sI/ntimoIntuirInu/tilInviernoIraIrisIroni/aIslaIsloteJabali/Jabo/nJamo/nJarabeJardi/nJarraJaulaJazmi/nJefeJeringaJineteJornadaJorobaJovenJoyaJuergaJuevesJuezJugadorJugoJugueteJuicioJuncoJunglaJunioJuntarJu/piterJurarJustoJuvenilJuzgarKiloKoalaLabioLacioLacraLadoLadro/nLagartoLa/grimaLagunaLaicoLamerLa/minaLa/mparaLanaLanchaLangostaLanzaLa/pizLargoLarvaLa/stimaLataLa/texLatirLaurelLavarLazoLealLeccio/nLecheLectorLeerLegio/nLegumbreLejanoLenguaLentoLe~aLeo/nLeopardoLesio/nLetalLetraLeveLeyendaLibertadLibroLicorLi/derLidiarLienzoLigaLigeroLimaLi/miteLimo/nLimpioLinceLindoLi/neaLingoteLinoLinternaLi/quidoLisoListaLiteraLitioLitroLlagaLlamaLlantoLlaveLlegarLlenarLlevarLlorarLloverLluviaLoboLocio/nLocoLocuraLo/gicaLogroLombrizLomoLonjaLoteLuchaLucirLugarLujoLunaLunesLupaLustroLutoLuzMacetaMachoMaderaMadreMaduroMaestroMafiaMagiaMagoMai/zMaldadMaletaMallaMaloMama/MamboMamutMancoMandoManejarMangaManiqui/ManjarManoMansoMantaMa~anaMapaMa/quinaMarMarcoMareaMarfilMargenMaridoMa/rmolMarro/nMartesMarzoMasaMa/scaraMasivoMatarMateriaMatizMatrizMa/ximoMayorMazorcaMechaMedallaMedioMe/dulaMejillaMejorMelenaMelo/nMemoriaMenorMensajeMenteMenu/MercadoMerengueMe/ritoMesMeso/nMetaMeterMe/todoMetroMezclaMiedoMielMiembroMigaMilMilagroMilitarMillo/nMimoMinaMineroMi/nimoMinutoMiopeMirarMisaMiseriaMisilMismoMitadMitoMochilaMocio/nModaModeloMohoMojarMoldeMolerMolinoMomentoMomiaMonarcaMonedaMonjaMontoMo~oMoradaMorderMorenoMorirMorroMorsaMortalMoscaMostrarMotivoMoverMo/vilMozoMuchoMudarMuebleMuelaMuerteMuestraMugreMujerMulaMuletaMultaMundoMu~ecaMuralMuroMu/sculoMuseoMusgoMu/sicaMusloNa/carNacio/nNadarNaipeNaranjaNarizNarrarNasalNatalNativoNaturalNa/useaNavalNaveNavidadNecioNe/ctarNegarNegocioNegroNeo/nNervioNetoNeutroNevarNeveraNichoNidoNieblaNietoNi~ezNi~oNi/tidoNivelNoblezaNocheNo/minaNoriaNormaNorteNotaNoticiaNovatoNovelaNovioNubeNucaNu/cleoNudilloNudoNueraNueveNuezNuloNu/meroNutriaOasisObesoObispoObjetoObraObreroObservarObtenerObvioOcaOcasoOce/anoOchentaOchoOcioOcreOctavoOctubreOcultoOcuparOcurrirOdiarOdioOdiseaOesteOfensaOfertaOficioOfrecerOgroOi/doOi/rOjoOlaOleadaOlfatoOlivoOllaOlmoOlorOlvidoOmbligoOndaOnzaOpacoOpcio/nO/peraOpinarOponerOptarO/pticaOpuestoOracio/nOradorOralO/rbitaOrcaOrdenOrejaO/rganoOrgi/aOrgulloOrienteOrigenOrillaOroOrquestaOrugaOsadi/aOscuroOseznoOsoOstraOto~oOtroOvejaO/vuloO/xidoOxi/genoOyenteOzonoPactoPadrePaellaPa/ginaPagoPai/sPa/jaroPalabraPalcoPaletaPa/lidoPalmaPalomaPalparPanPanalPa/nicoPanteraPa~ueloPapa/PapelPapillaPaquetePararParcelaParedParirParoPa/rpadoParquePa/rrafoPartePasarPaseoPasio/nPasoPastaPataPatioPatriaPausaPautaPavoPayasoPeato/nPecadoPeceraPechoPedalPedirPegarPeinePelarPelda~oPeleaPeligroPellejoPeloPelucaPenaPensarPe~o/nPeo/nPeorPepinoPeque~oPeraPerchaPerderPerezaPerfilPericoPerlaPermisoPerroPersonaPesaPescaPe/simoPesta~aPe/taloPetro/leoPezPezu~aPicarPicho/nPiePiedraPiernaPiezaPijamaPilarPilotoPimientaPinoPintorPinzaPi~aPiojoPipaPirataPisarPiscinaPisoPistaPito/nPizcaPlacaPlanPlataPlayaPlazaPleitoPlenoPlomoPlumaPluralPobrePocoPoderPodioPoemaPoesi/aPoetaPolenPolici/aPolloPolvoPomadaPomeloPomoPompaPonerPorcio/nPortalPosadaPoseerPosiblePostePotenciaPotroPozoPradoPrecozPreguntaPremioPrensaPresoPrevioPrimoPri/ncipePrisio/nPrivarProaProbarProcesoProductoProezaProfesorProgramaProlePromesaProntoPropioPro/ximoPruebaPu/blicoPucheroPudorPuebloPuertaPuestoPulgaPulirPulmo/nPulpoPulsoPumaPuntoPu~alPu~oPupaPupilaPure/QuedarQuejaQuemarQuererQuesoQuietoQui/micaQuinceQuitarRa/banoRabiaRaboRacio/nRadicalRai/zRamaRampaRanchoRangoRapazRa/pidoRaptoRasgoRaspaRatoRayoRazaRazo/nReaccio/nRealidadReba~oReboteRecaerRecetaRechazoRecogerRecreoRectoRecursoRedRedondoReducirReflejoReformaRefra/nRefugioRegaloRegirReglaRegresoRehe/nReinoRei/rRejaRelatoRelevoRelieveRellenoRelojRemarRemedioRemoRencorRendirRentaRepartoRepetirReposoReptilResRescateResinaRespetoRestoResumenRetiroRetornoRetratoReunirReve/sRevistaReyRezarRicoRiegoRiendaRiesgoRifaRi/gidoRigorRinco/nRi~o/nRi/oRiquezaRisaRitmoRitoRizoRobleRoceRociarRodarRodeoRodillaRoerRojizoRojoRomeroRomperRonRoncoRondaRopaRoperoRosaRoscaRostroRotarRubi/RuborRudoRuedaRugirRuidoRuinaRuletaRuloRumboRumorRupturaRutaRutinaSa/badoSaberSabioSableSacarSagazSagradoSalaSaldoSaleroSalirSalmo/nSalo/nSalsaSaltoSaludSalvarSambaSancio/nSandi/aSanearSangreSanidadSanoSantoSapoSaqueSardinaSarte/nSastreSata/nSaunaSaxofo/nSeccio/nSecoSecretoSectaSedSeguirSeisSelloSelvaSemanaSemillaSendaSensorSe~alSe~orSepararSepiaSequi/aSerSerieSermo/nServirSesentaSesio/nSetaSetentaSeveroSexoSextoSidraSiestaSieteSigloSignoSi/labaSilbarSilencioSillaSi/mboloSimioSirenaSistemaSitioSituarSobreSocioSodioSolSolapaSoldadoSoledadSo/lidoSoltarSolucio/nSombraSondeoSonidoSonoroSonrisaSopaSoplarSoporteSordoSorpresaSorteoSoste/nSo/tanoSuaveSubirSucesoSudorSuegraSueloSue~oSuerteSufrirSujetoSulta/nSumarSuperarSuplirSuponerSupremoSurSurcoSure~oSurgirSustoSutilTabacoTabiqueTablaTabu/TacoTactoTajoTalarTalcoTalentoTallaTalo/nTama~oTamborTangoTanqueTapaTapeteTapiaTapo/nTaquillaTardeTareaTarifaTarjetaTarotTarroTartaTatuajeTauroTazaTazo/nTeatroTechoTeclaTe/cnicaTejadoTejerTejidoTelaTele/fonoTemaTemorTemploTenazTenderTenerTenisTensoTeori/aTerapiaTercoTe/rminoTernuraTerrorTesisTesoroTestigoTeteraTextoTezTibioTiburo/nTiempoTiendaTierraTiesoTigreTijeraTildeTimbreTi/midoTimoTintaTi/oTi/picoTipoTiraTiro/nTita/nTi/tereTi/tuloTizaToallaTobilloTocarTocinoTodoTogaToldoTomarTonoTontoToparTopeToqueTo/raxToreroTormentaTorneoToroTorpedoTorreTorsoTortugaTosToscoToserTo/xicoTrabajoTractorTraerTra/ficoTragoTrajeTramoTranceTratoTraumaTrazarTre/bolTreguaTreintaTrenTreparTresTribuTrigoTripaTristeTriunfoTrofeoTrompaTroncoTropaTroteTrozoTrucoTruenoTrufaTuberi/aTuboTuertoTumbaTumorTu/nelTu/nicaTurbinaTurismoTurnoTutorUbicarU/lceraUmbralUnidadUnirUniversoUnoUntarU~aUrbanoUrbeUrgenteUrnaUsarUsuarioU/tilUtopi/aUvaVacaVaci/oVacunaVagarVagoVainaVajillaValeVa/lidoValleValorVa/lvulaVampiroVaraVariarVaro/nVasoVecinoVectorVehi/culoVeinteVejezVelaVeleroVelozVenaVencerVendaVenenoVengarVenirVentaVenusVerVeranoVerboVerdeVeredaVerjaVersoVerterVi/aViajeVibrarVicioVi/ctimaVidaVi/deoVidrioViejoViernesVigorVilVillaVinagreVinoVi~edoVioli/nViralVirgoVirtudVisorVi/speraVistaVitaminaViudoVivazViveroVivirVivoVolca/nVolumenVolverVorazVotarVotoVozVueloVulgarYacerYateYeguaYemaYernoYesoYodoYogaYogurZafiroZanjaZapatoZarzaZonaZorroZumoZurdo"; + var lookup = {}; + var wordlist = null; + function dropDiacritic(word) { + wordlist_1.logger.checkNormalize(); + return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word.normalize("NFD").toLowerCase()), function(c) { + return c >= 65 && c <= 90 || c >= 97 && c <= 123; + })); + } + function expand(word) { + var output = []; + Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word), function(c) { + if (c === 47) { + output.push(204); + output.push(129); + } else if (c === 126) { + output.push(110); + output.push(204); + output.push(131); + } else { + output.push(c); + } + }); + return (0, strings_1.toUtf8String)(output); + } + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) { + return expand(w); + }); + wordlist.forEach(function(word, index) { + lookup[dropDiacritic(word)] = index; + }); + if (wordlist_1.Wordlist.check(lang) !== "0xf74fb7092aeacdfbf8959557de22098da512207fb9f109cb526994938cf40300") { + wordlist = null; + throw new Error("BIP39 Wordlist for es (Spanish) FAILED"); + } + } + var LangEs = ( + /** @class */ + function(_super) { + __extends(LangEs2, _super); + function LangEs2() { + return _super.call(this, "es") || this; + } + LangEs2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangEs2.prototype.getWordIndex = function(word) { + loadWords(this); + return lookup[dropDiacritic(word)]; + }; + return LangEs2; + }(wordlist_1.Wordlist) + ); + var langEs = new LangEs(); + exports2.langEs = langEs; + wordlist_1.Wordlist.register(langEs); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-fr.js +var require_lang_fr = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-fr.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langFr = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var words = "AbaisserAbandonAbdiquerAbeilleAbolirAborderAboutirAboyerAbrasifAbreuverAbriterAbrogerAbruptAbsenceAbsoluAbsurdeAbusifAbyssalAcade/mieAcajouAcarienAccablerAccepterAcclamerAccoladeAccrocheAccuserAcerbeAchatAcheterAcidulerAcierAcompteAcque/rirAcronymeActeurActifActuelAdepteAde/quatAdhe/sifAdjectifAdjugerAdmettreAdmirerAdopterAdorerAdoucirAdresseAdroitAdulteAdverbeAe/rerAe/ronefAffaireAffecterAfficheAffreuxAffublerAgacerAgencerAgileAgiterAgraferAgre/ableAgrumeAiderAiguilleAilierAimableAisanceAjouterAjusterAlarmerAlchimieAlerteAlge-breAlgueAlie/nerAlimentAlle/gerAlliageAllouerAllumerAlourdirAlpagaAltesseAlve/oleAmateurAmbiguAmbreAme/nagerAmertumeAmidonAmiralAmorcerAmourAmovibleAmphibieAmpleurAmusantAnalyseAnaphoreAnarchieAnatomieAncienAne/antirAngleAngoisseAnguleuxAnimalAnnexerAnnonceAnnuelAnodinAnomalieAnonymeAnormalAntenneAntidoteAnxieuxApaiserApe/ritifAplanirApologieAppareilAppelerApporterAppuyerAquariumAqueducArbitreArbusteArdeurArdoiseArgentArlequinArmatureArmementArmoireArmureArpenterArracherArriverArroserArsenicArte/rielArticleAspectAsphalteAspirerAssautAsservirAssietteAssocierAssurerAsticotAstreAstuceAtelierAtomeAtriumAtroceAttaqueAttentifAttirerAttraperAubaineAubergeAudaceAudibleAugurerAuroreAutomneAutrucheAvalerAvancerAvariceAvenirAverseAveugleAviateurAvideAvionAviserAvoineAvouerAvrilAxialAxiomeBadgeBafouerBagageBaguetteBaignadeBalancerBalconBaleineBalisageBambinBancaireBandageBanlieueBannie-reBanquierBarbierBarilBaronBarqueBarrageBassinBastionBatailleBateauBatterieBaudrierBavarderBeletteBe/lierBeloteBe/ne/ficeBerceauBergerBerlineBermudaBesaceBesogneBe/tailBeurreBiberonBicycleBiduleBijouBilanBilingueBillardBinaireBiologieBiopsieBiotypeBiscuitBisonBistouriBitumeBizarreBlafardBlagueBlanchirBlessantBlinderBlondBloquerBlousonBobardBobineBoireBoiserBolideBonbonBondirBonheurBonifierBonusBordureBorneBotteBoucleBoueuxBougieBoulonBouquinBourseBoussoleBoutiqueBoxeurBrancheBrasierBraveBrebisBre-cheBreuvageBricolerBrigadeBrillantBriocheBriqueBrochureBroderBronzerBrousseBroyeurBrumeBrusqueBrutalBruyantBuffleBuissonBulletinBureauBurinBustierButinerButoirBuvableBuvetteCabanonCabineCachetteCadeauCadreCafe/ineCaillouCaissonCalculerCalepinCalibreCalmerCalomnieCalvaireCamaradeCame/raCamionCampagneCanalCanetonCanonCantineCanularCapableCaporalCapriceCapsuleCapterCapucheCarabineCarboneCaresserCaribouCarnageCarotteCarreauCartonCascadeCasierCasqueCassureCauserCautionCavalierCaverneCaviarCe/dilleCeintureCe/lesteCelluleCendrierCensurerCentralCercleCe/re/bralCeriseCernerCerveauCesserChagrinChaiseChaleurChambreChanceChapitreCharbonChasseurChatonChaussonChavirerChemiseChenilleChe/quierChercherChevalChienChiffreChignonChime-reChiotChlorureChocolatChoisirChoseChouetteChromeChuteCigareCigogneCimenterCine/maCintrerCirculerCirerCirqueCiterneCitoyenCitronCivilClaironClameurClaquerClasseClavierClientClignerClimatClivageClocheClonageCloporteCobaltCobraCocasseCocotierCoderCodifierCoffreCognerCohe/sionCoifferCoincerCole-reColibriCollineColmaterColonelCombatCome/dieCommandeCompactConcertConduireConfierCongelerConnoterConsonneContactConvexeCopainCopieCorailCorbeauCordageCornicheCorpusCorrectCorte-geCosmiqueCostumeCotonCoudeCoupureCourageCouteauCouvrirCoyoteCrabeCrainteCravateCrayonCre/atureCre/diterCre/meuxCreuserCrevetteCriblerCrierCristalCrite-reCroireCroquerCrotaleCrucialCruelCrypterCubiqueCueillirCuille-reCuisineCuivreCulminerCultiverCumulerCupideCuratifCurseurCyanureCycleCylindreCyniqueDaignerDamierDangerDanseurDauphinDe/battreDe/biterDe/borderDe/briderDe/butantDe/calerDe/cembreDe/chirerDe/ciderDe/clarerDe/corerDe/crireDe/cuplerDe/daleDe/ductifDe/esseDe/fensifDe/filerDe/frayerDe/gagerDe/givrerDe/glutirDe/graferDe/jeunerDe/liceDe/logerDemanderDemeurerDe/molirDe/nicherDe/nouerDentelleDe/nuderDe/partDe/penserDe/phaserDe/placerDe/poserDe/rangerDe/roberDe/sastreDescenteDe/sertDe/signerDe/sobe/irDessinerDestrierDe/tacherDe/testerDe/tourerDe/tresseDevancerDevenirDevinerDevoirDiableDialogueDiamantDicterDiffe/rerDige/rerDigitalDigneDiluerDimancheDiminuerDioxydeDirectifDirigerDiscuterDisposerDissiperDistanceDivertirDiviserDocileDocteurDogmeDoigtDomaineDomicileDompterDonateurDonjonDonnerDopamineDortoirDorureDosageDoseurDossierDotationDouanierDoubleDouceurDouterDoyenDragonDraperDresserDribblerDroitureDuperieDuplexeDurableDurcirDynastieE/blouirE/carterE/charpeE/chelleE/clairerE/clipseE/cloreE/cluseE/coleE/conomieE/corceE/couterE/craserE/cre/merE/crivainE/crouE/cumeE/cureuilE/difierE/duquerEffacerEffectifEffigieEffortEffrayerEffusionE/galiserE/garerE/jecterE/laborerE/largirE/lectronE/le/gantE/le/phantE/le-veE/ligibleE/litismeE/logeE/luciderE/luderEmballerEmbellirEmbryonE/meraudeE/missionEmmenerE/motionE/mouvoirEmpereurEmployerEmporterEmpriseE/mulsionEncadrerEnche-reEnclaveEncocheEndiguerEndosserEndroitEnduireE/nergieEnfanceEnfermerEnfouirEngagerEnginEngloberE/nigmeEnjamberEnjeuEnleverEnnemiEnnuyeuxEnrichirEnrobageEnseigneEntasserEntendreEntierEntourerEntraverE/nume/rerEnvahirEnviableEnvoyerEnzymeE/olienE/paissirE/pargneE/patantE/pauleE/picerieE/pide/mieE/pierE/pilogueE/pineE/pisodeE/pitapheE/poqueE/preuveE/prouverE/puisantE/querreE/quipeE/rigerE/rosionErreurE/ruptionEscalierEspadonEspe-ceEspie-gleEspoirEspritEsquiverEssayerEssenceEssieuEssorerEstimeEstomacEstradeE/tage-reE/talerE/tancheE/tatiqueE/teindreE/tendoirE/ternelE/thanolE/thiqueEthnieE/tirerE/tofferE/toileE/tonnantE/tourdirE/trangeE/troitE/tudeEuphorieE/valuerE/vasionE/ventailE/videnceE/viterE/volutifE/voquerExactExage/rerExaucerExcellerExcitantExclusifExcuseExe/cuterExempleExercerExhalerExhorterExigenceExilerExisterExotiqueExpe/dierExplorerExposerExprimerExquisExtensifExtraireExulterFableFabuleuxFacetteFacileFactureFaiblirFalaiseFameuxFamilleFarceurFarfeluFarineFaroucheFascinerFatalFatigueFauconFautifFaveurFavoriFe/brileFe/conderFe/de/rerFe/linFemmeFe/murFendoirFe/odalFermerFe/roceFerveurFestivalFeuilleFeutreFe/vrierFiascoFicelerFictifFide-leFigureFilatureFiletageFilie-reFilleulFilmerFilouFiltrerFinancerFinirFioleFirmeFissureFixerFlairerFlammeFlasqueFlatteurFle/auFle-cheFleurFlexionFloconFloreFluctuerFluideFluvialFolieFonderieFongibleFontaineForcerForgeronFormulerFortuneFossileFoudreFouge-reFouillerFoulureFourmiFragileFraiseFranchirFrapperFrayeurFre/gateFreinerFrelonFre/mirFre/ne/sieFre-reFriableFrictionFrissonFrivoleFroidFromageFrontalFrotterFruitFugitifFuiteFureurFurieuxFurtifFusionFuturGagnerGalaxieGalerieGambaderGarantirGardienGarnirGarrigueGazelleGazonGe/antGe/latineGe/luleGendarmeGe/ne/ralGe/nieGenouGentilGe/ologieGe/ome-treGe/raniumGermeGestuelGeyserGibierGiclerGirafeGivreGlaceGlaiveGlisserGlobeGloireGlorieuxGolfeurGommeGonflerGorgeGorilleGoudronGouffreGoulotGoupilleGourmandGoutteGraduelGraffitiGraineGrandGrappinGratuitGravirGrenatGriffureGrillerGrimperGrognerGronderGrotteGroupeGrugerGrutierGruye-reGue/pardGuerrierGuideGuimauveGuitareGustatifGymnasteGyrostatHabitudeHachoirHalteHameauHangarHannetonHaricotHarmonieHarponHasardHe/liumHe/matomeHerbeHe/rissonHermineHe/ronHe/siterHeureuxHibernerHibouHilarantHistoireHiverHomardHommageHomoge-neHonneurHonorerHonteuxHordeHorizonHorlogeHormoneHorribleHouleuxHousseHublotHuileuxHumainHumbleHumideHumourHurlerHydromelHygie-neHymneHypnoseIdylleIgnorerIguaneIlliciteIllusionImageImbiberImiterImmenseImmobileImmuableImpactImpe/rialImplorerImposerImprimerImputerIncarnerIncendieIncidentInclinerIncoloreIndexerIndiceInductifIne/ditIneptieInexactInfiniInfligerInformerInfusionInge/rerInhalerInhiberInjecterInjureInnocentInoculerInonderInscrireInsecteInsigneInsoliteInspirerInstinctInsulterIntactIntenseIntimeIntrigueIntuitifInutileInvasionInventerInviterInvoquerIroniqueIrradierIrre/elIrriterIsolerIvoireIvresseJaguarJaillirJambeJanvierJardinJaugerJauneJavelotJetableJetonJeudiJeunesseJoindreJoncherJonglerJoueurJouissifJournalJovialJoyauJoyeuxJubilerJugementJuniorJuponJuristeJusticeJuteuxJuve/nileKayakKimonoKiosqueLabelLabialLabourerLace/rerLactoseLaguneLaineLaisserLaitierLambeauLamelleLampeLanceurLangageLanterneLapinLargeurLarmeLaurierLavaboLavoirLectureLe/galLe/gerLe/gumeLessiveLettreLevierLexiqueLe/zardLiasseLibe/rerLibreLicenceLicorneLie-geLie-vreLigatureLigoterLigueLimerLimiteLimonadeLimpideLine/aireLingotLionceauLiquideLisie-reListerLithiumLitigeLittoralLivreurLogiqueLointainLoisirLombricLoterieLouerLourdLoutreLouveLoyalLubieLucideLucratifLueurLugubreLuisantLumie-reLunaireLundiLuronLutterLuxueuxMachineMagasinMagentaMagiqueMaigreMaillonMaintienMairieMaisonMajorerMalaxerMale/ficeMalheurMaliceMalletteMammouthMandaterManiableManquantManteauManuelMarathonMarbreMarchandMardiMaritimeMarqueurMarronMartelerMascotteMassifMate/rielMatie-reMatraqueMaudireMaussadeMauveMaximalMe/chantMe/connuMe/dailleMe/decinMe/diterMe/duseMeilleurMe/langeMe/lodieMembreMe/moireMenacerMenerMenhirMensongeMentorMercrediMe/riteMerleMessagerMesureMe/talMe/te/oreMe/thodeMe/tierMeubleMiaulerMicrobeMietteMignonMigrerMilieuMillionMimiqueMinceMine/ralMinimalMinorerMinuteMiracleMiroiterMissileMixteMobileModerneMoelleuxMondialMoniteurMonnaieMonotoneMonstreMontagneMonumentMoqueurMorceauMorsureMortierMoteurMotifMoucheMoufleMoulinMoussonMoutonMouvantMultipleMunitionMurailleMure-neMurmureMuscleMuse/umMusicienMutationMuterMutuelMyriadeMyrtilleMyste-reMythiqueNageurNappeNarquoisNarrerNatationNationNatureNaufrageNautiqueNavireNe/buleuxNectarNe/fasteNe/gationNe/gligerNe/gocierNeigeNerveuxNettoyerNeuroneNeutronNeveuNicheNickelNitrateNiveauNobleNocifNocturneNoirceurNoisetteNomadeNombreuxNommerNormatifNotableNotifierNotoireNourrirNouveauNovateurNovembreNoviceNuageNuancerNuireNuisibleNume/roNuptialNuqueNutritifObe/irObjectifObligerObscurObserverObstacleObtenirObturerOccasionOccuperOce/anOctobreOctroyerOctuplerOculaireOdeurOdorantOffenserOfficierOffrirOgiveOiseauOisillonOlfactifOlivierOmbrageOmettreOnctueuxOndulerOne/reuxOniriqueOpaleOpaqueOpe/rerOpinionOpportunOpprimerOpterOptiqueOrageuxOrangeOrbiteOrdonnerOreilleOrganeOrgueilOrificeOrnementOrqueOrtieOscillerOsmoseOssatureOtarieOuraganOursonOutilOutragerOuvrageOvationOxydeOxyge-neOzonePaisiblePalacePalmare-sPalourdePalperPanachePandaPangolinPaniquerPanneauPanoramaPantalonPapayePapierPapoterPapyrusParadoxeParcelleParesseParfumerParlerParoleParrainParsemerPartagerParureParvenirPassionPaste-quePaternelPatiencePatronPavillonPavoiserPayerPaysagePeignePeintrePelagePe/licanPellePelousePeluchePendulePe/ne/trerPe/niblePensifPe/nuriePe/pitePe/plumPerdrixPerforerPe/riodePermuterPerplexePersilPertePeserPe/talePetitPe/trirPeuplePharaonPhobiePhoquePhotonPhrasePhysiquePianoPicturalPie-cePierrePieuvrePilotePinceauPipettePiquerPiroguePiscinePistonPivoterPixelPizzaPlacardPlafondPlaisirPlanerPlaquePlastronPlateauPleurerPlexusPliagePlombPlongerPluiePlumagePochettePoe/siePoe-tePointePoirierPoissonPoivrePolairePolicierPollenPolygonePommadePompierPonctuelPonde/rerPoneyPortiquePositionPosse/derPosturePotagerPoteauPotionPoucePoulainPoumonPourprePoussinPouvoirPrairiePratiquePre/cieuxPre/direPre/fixePre/ludePre/nomPre/sencePre/textePre/voirPrimitifPrincePrisonPriverProble-meProce/derProdigeProfondProgre-sProieProjeterProloguePromenerPropreProspe-reProte/gerProuesseProverbePrudencePruneauPsychosePublicPuceronPuiserPulpePulsarPunaisePunitifPupitrePurifierPuzzlePyramideQuasarQuerelleQuestionQuie/tudeQuitterQuotientRacineRaconterRadieuxRagondinRaideurRaisinRalentirRallongeRamasserRapideRasageRatisserRavagerRavinRayonnerRe/actifRe/agirRe/aliserRe/animerRecevoirRe/citerRe/clamerRe/colterRecruterReculerRecyclerRe/digerRedouterRefaireRe/flexeRe/formerRefrainRefugeRe/galienRe/gionRe/glageRe/gulierRe/ite/rerRejeterRejouerRelatifReleverReliefRemarqueReme-deRemiseRemonterRemplirRemuerRenardRenfortReniflerRenoncerRentrerRenvoiReplierReporterRepriseReptileRequinRe/serveRe/sineuxRe/soudreRespectResterRe/sultatRe/tablirRetenirRe/ticuleRetomberRetracerRe/unionRe/ussirRevancheRevivreRe/volteRe/vulsifRichesseRideauRieurRigideRigolerRincerRiposterRisibleRisqueRituelRivalRivie-reRocheuxRomanceRompreRonceRondinRoseauRosierRotatifRotorRotuleRougeRouilleRouleauRoutineRoyaumeRubanRubisRucheRuelleRugueuxRuinerRuisseauRuserRustiqueRythmeSablerSaboterSabreSacocheSafariSagesseSaisirSaladeSaliveSalonSaluerSamediSanctionSanglierSarcasmeSardineSaturerSaugrenuSaumonSauterSauvageSavantSavonnerScalpelScandaleSce/le/ratSce/narioSceptreSche/maScienceScinderScoreScrutinSculpterSe/anceSe/cableSe/cherSecouerSe/cre/terSe/datifSe/duireSeigneurSe/jourSe/lectifSemaineSemblerSemenceSe/minalSe/nateurSensibleSentenceSe/parerSe/quenceSereinSergentSe/rieuxSerrureSe/rumServiceSe/sameSe/virSevrageSextupleSide/ralSie-cleSie/gerSifflerSigleSignalSilenceSiliciumSimpleSince-reSinistreSiphonSiropSismiqueSituerSkierSocialSocleSodiumSoigneuxSoldatSoleilSolitudeSolubleSombreSommeilSomnolerSondeSongeurSonnetteSonoreSorcierSortirSosieSottiseSoucieuxSoudureSouffleSouleverSoupapeSourceSoutirerSouvenirSpacieuxSpatialSpe/cialSphe-reSpiralStableStationSternumStimulusStipulerStrictStudieuxStupeurStylisteSublimeSubstratSubtilSubvenirSucce-sSucreSuffixeSugge/rerSuiveurSulfateSuperbeSupplierSurfaceSuricateSurmenerSurpriseSursautSurvieSuspectSyllabeSymboleSyme/trieSynapseSyntaxeSyste-meTabacTablierTactileTaillerTalentTalismanTalonnerTambourTamiserTangibleTapisTaquinerTarderTarifTartineTasseTatamiTatouageTaupeTaureauTaxerTe/moinTemporelTenailleTendreTeneurTenirTensionTerminerTerneTerribleTe/tineTexteThe-meThe/orieThe/rapieThoraxTibiaTie-deTimideTirelireTiroirTissuTitaneTitreTituberTobogganTole/rantTomateToniqueTonneauToponymeTorcheTordreTornadeTorpilleTorrentTorseTortueTotemToucherTournageTousserToxineTractionTraficTragiqueTrahirTrainTrancherTravailTre-fleTremperTre/sorTreuilTriageTribunalTricoterTrilogieTriompheTriplerTriturerTrivialTromboneTroncTropicalTroupeauTuileTulipeTumulteTunnelTurbineTuteurTutoyerTuyauTympanTyphonTypiqueTyranUbuesqueUltimeUltrasonUnanimeUnifierUnionUniqueUnitaireUniversUraniumUrbainUrticantUsageUsineUsuelUsureUtileUtopieVacarmeVaccinVagabondVagueVaillantVaincreVaisseauValableValiseVallonValveVampireVanilleVapeurVarierVaseuxVassalVasteVecteurVedetteVe/ge/talVe/hiculeVeinardVe/loceVendrediVe/ne/rerVengerVenimeuxVentouseVerdureVe/rinVernirVerrouVerserVertuVestonVe/te/ranVe/tusteVexantVexerViaducViandeVictoireVidangeVide/oVignetteVigueurVilainVillageVinaigreViolonVipe-reVirementVirtuoseVirusVisageViseurVisionVisqueuxVisuelVitalVitesseViticoleVitrineVivaceVivipareVocationVoguerVoileVoisinVoitureVolailleVolcanVoltigerVolumeVoraceVortexVoterVouloirVoyageVoyelleWagonXe/nonYachtZe-breZe/nithZesteZoologie"; + var wordlist = null; + var lookup = {}; + function dropDiacritic(word) { + wordlist_1.logger.checkNormalize(); + return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word.normalize("NFD").toLowerCase()), function(c) { + return c >= 65 && c <= 90 || c >= 97 && c <= 123; + })); + } + function expand(word) { + var output = []; + Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word), function(c) { + if (c === 47) { + output.push(204); + output.push(129); + } else if (c === 45) { + output.push(204); + output.push(128); + } else { + output.push(c); + } + }); + return (0, strings_1.toUtf8String)(output); + } + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) { + return expand(w); + }); + wordlist.forEach(function(word, index) { + lookup[dropDiacritic(word)] = index; + }); + if (wordlist_1.Wordlist.check(lang) !== "0x51deb7ae009149dc61a6bd18a918eb7ac78d2775726c68e598b92d002519b045") { + wordlist = null; + throw new Error("BIP39 Wordlist for fr (French) FAILED"); + } + } + var LangFr = ( + /** @class */ + function(_super) { + __extends(LangFr2, _super); + function LangFr2() { + return _super.call(this, "fr") || this; + } + LangFr2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangFr2.prototype.getWordIndex = function(word) { + loadWords(this); + return lookup[dropDiacritic(word)]; + }; + return LangFr2; + }(wordlist_1.Wordlist) + ); + var langFr = new LangFr(); + exports2.langFr = langFr; + wordlist_1.Wordlist.register(langFr); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-ja.js +var require_lang_ja = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-ja.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langJa = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = [ + // 4-kana words + "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgBQhBQhCQuFQmXQiDQUFQZDQsFQdRQkHQbRQlOQlmQPDQjDQwXQMBQMDQcFQTBQTHQrDDXQDNFDGBDGQDGRDpFDhFDmXDZXDbRDMYDRdDTRDrXSAhSBCSBrSGQSEQSHBSVRShYShkSyQSuFSiBSdcSoESocSlmSMBSFBSFKSFNSFdSFcCByCaRCKcCSBCSRCCrCGbCEHCYXCpBCpQCIBCIHCeNCgBCgFCVECVcCmkCmwCZXCZFCdRClOClmClFCjDCjdCnXCwBCwXCcRCFQCFjGXhGNhGDEGDMGCDGCHGIFGgBGVXGVEGVRGmXGsXGdYGoSGbRGnXGwXGwDGWRGFNGFLGFOGFdGFkEABEBDEBFEXOEaBEKSENBENDEYXEIgEIkEgBEgQEgHEhFEudEuFEiBEiHEiFEZDEvBEsXEsFEdXEdREkFEbBEbRElFEPCEfkEFNYAEYAhYBNYQdYDXYSRYCEYYoYgQYgRYuRYmCYZTYdBYbEYlXYjQYRbYWRpKXpQopQnpSFpCXpIBpISphNpdBpdRpbRpcZpFBpFNpFDpFopFrLADLBuLXQLXcLaFLCXLEhLpBLpFLHXLeVLhILdHLdRLoDLbRLrXIABIBQIBCIBsIBoIBMIBRIXaIaRIKYIKRINBINuICDIGBIIDIIkIgRIxFIyQIiHIdRIbYIbRIlHIwRIMYIcRIRVITRIFBIFNIFQOABOAFOBQOaFONBONMOQFOSFOCDOGBOEQOpBOLXOIBOIFOgQOgFOyQOycOmXOsXOdIOkHOMEOMkOWWHBNHXNHXWHNXHDuHDRHSuHSRHHoHhkHmRHdRHkQHlcHlRHwBHWcgAEgAggAkgBNgBQgBEgXOgYcgLXgHjgyQgiBgsFgdagMYgWSgFQgFEVBTVXEVKBVKNVKDVKYVKRVNBVNYVDBVDxVSBVSRVCjVGNVLXVIFVhBVhcVsXVdRVbRVlRhBYhKYhDYhGShxWhmNhdahdkhbRhjohMXhTRxAXxXSxKBxNBxEQxeNxeQxhXxsFxdbxlHxjcxFBxFNxFQxFOxFoyNYyYoybcyMYuBQuBRuBruDMuCouHBudQukkuoBulVuMXuFEmCYmCRmpRmeDmiMmjdmTFmFQiADiBOiaRiKRiNBiNRiSFiGkiGFiERipRiLFiIFihYibHijBijEiMXiWBiFBiFCUBQUXFUaRUNDUNcUNRUNFUDBUSHUCDUGBUGFUEqULNULoUIRUeEUeYUgBUhFUuRUiFUsXUdFUkHUbBUjSUjYUwXUMDUcHURdUTBUrBUrXUrQZAFZXZZaRZKFZNBZQFZCXZGBZYdZpBZLDZIFZHXZHNZeQZVRZVFZmXZiBZvFZdFZkFZbHZbFZwXZcCZcRZRBvBQvBGvBLvBWvCovMYsAFsBDsaRsKFsNFsDrsSHsSFsCXsCRsEBsEHsEfspBsLBsLDsIgsIRseGsbRsFBsFQsFSdNBdSRdCVdGHdYDdHcdVbdySduDdsXdlRdwXdWYdWcdWRkBMkXOkaRkNIkNFkSFkCFkYBkpRkeNkgBkhVkmXksFklVkMBkWDkFNoBNoaQoaFoNBoNXoNaoNEoSRoEroYXoYCoYbopRopFomXojkowXorFbBEbEIbdBbjYlaRlDElMXlFDjKjjSRjGBjYBjYkjpRjLXjIBjOFjeVjbRjwBnXQnSHnpFnLXnINnMBnTRwXBwXNwXYwNFwQFwSBwGFwLXwLDweNwgBwuHwjDwnXMBXMpFMIBMeNMTHcaQcNBcDHcSFcCXcpBcLXcLDcgFcuFcnXcwXccDcTQcrFTQErXNrCHrpFrgFrbFrTHrFcWNYWNbWEHWMXWTR", + // 5-kana words + "ABGHABIJAEAVAYJQALZJAIaRAHNXAHdcAHbRAZJMAZJRAZTRAdVJAklmAbcNAjdRAMnRAMWYAWpRAWgRAFgBAFhBAFdcBNJBBNJDBQKBBQhcBQlmBDEJBYJkBYJTBpNBBpJFBIJBBIJDBIcABOKXBOEJBOVJBOiJBOZJBepBBeLXBeIFBegBBgGJBVJXBuocBiJRBUJQBlXVBlITBwNFBMYVBcqXBTlmBWNFBWiJBWnRBFGHBFwXXKGJXNJBXNZJXDTTXSHSXSVRXSlHXCJDXGQJXEhXXYQJXYbRXOfXXeNcXVJFXhQJXhEJXdTRXjdXXMhBXcQTXRGBXTEBXTnQXFCXXFOFXFgFaBaFaBNJaBCJaBpBaBwXaNJKaNJDaQIBaDpRaEPDaHMFamDJalEJaMZJaFaFaFNBaFQJaFLDaFVHKBCYKBEBKBHDKXaFKXGdKXEJKXpHKXIBKXZDKXwXKKwLKNacKNYJKNJoKNWcKDGdKDTRKChXKGaRKGhBKGbRKEBTKEaRKEPTKLMDKLWRKOHDKVJcKdBcKlIBKlOPKFSBKFEPKFpFNBNJNJBQNBGHNBEPNBHXNBgFNBVXNBZDNBsXNBwXNNaRNNJDNNJENNJkNDCJNDVDNGJRNJiDNZJNNsCJNJFNNFSBNFCXNFEPNFLXNFIFQJBFQCaRQJEQQLJDQLJFQIaRQOqXQHaFQHHQQVJXQVJDQhNJQmEIQZJFQsJXQJrFQWbRDJABDBYJDXNFDXCXDXLXDXZDDXsJDQqXDSJFDJCXDEPkDEqXDYmQDpSJDOCkDOGQDHEIDVJDDuDuDWEBDJFgSBNDSBSFSBGHSBIBSBTQSKVYSJQNSJQiSJCXSEqXSJYVSIiJSOMYSHAHSHaQSeCFSepQSegBSHdHSHrFShSJSJuHSJUFSkNRSrSrSWEBSFaHSJFQSFCXSFGDSFYXSFODSFgBSFVXSFhBSFxFSFkFSFbBSFMFCADdCJXBCXaFCXKFCXNFCXCXCXGBCXEJCXYBCXLDCXIBCXOPCXHXCXgBCXhBCXiBCXlDCXcHCJNBCJNFCDCJCDGBCDVXCDhBCDiDCDJdCCmNCpJFCIaRCOqXCHCHCHZJCViJCuCuCmddCJiFCdNBCdHhClEJCnUJCreSCWlgCWTRCFBFCFNBCFYBCFVFCFhFCFdSCFTBCFWDGBNBGBQFGJBCGBEqGBpBGBgQGNBEGNJYGNkOGNJRGDUFGJpQGHaBGJeNGJeEGVBlGVKjGiJDGvJHGsVJGkEBGMIJGWjNGFBFGFCXGFGBGFYXGFpBGFMFEASJEAWpEJNFECJVEIXSEIQJEOqXEOcFEeNcEHEJEHlFEJgFEhlmEmDJEmZJEiMBEUqXEoSREPBFEPXFEPKFEPSFEPEFEPpFEPLXEPIBEJPdEPcFEPTBEJnXEqlHEMpREFCXEFODEFcFYASJYJAFYBaBYBVXYXpFYDhBYCJBYJGFYYbRYeNcYJeVYiIJYZJcYvJgYvJRYJsXYsJFYMYMYreVpBNHpBEJpBwXpQxFpYEJpeNDpJeDpeSFpeCHpHUJpHbBpHcHpmUJpiiJpUJrpsJuplITpFaBpFQqpFGBpFEfpFYBpFpBpFLJpFIDpFgBpFVXpFyQpFuFpFlFpFjDpFnXpFwXpJFMpFTBLXCJLXEFLXhFLXUJLXbFLalmLNJBLSJQLCLCLGJBLLDJLHaFLeNFLeSHLeCXLepFLhaRLZsJLsJDLsJrLocaLlLlLMdbLFNBLFSBLFEHLFkFIBBFIBXFIBaQIBKXIBSFIBpHIBLXIBgBIBhBIBuHIBmXIBiFIBZXIBvFIBbFIBjQIBwXIBWFIKTRIQUJIDGFICjQIYSRIINXIJeCIVaRImEkIZJFIvJRIsJXIdCJIJoRIbBQIjYBIcqXITFVIreVIFKFIFSFIFCJIFGFIFLDIFIBIJFOIFgBIFVXIJFhIFxFIFmXIFdHIFbBIJFrIJFWOBGBOQfXOOKjOUqXOfXBOqXEOcqXORVJOFIBOFlDHBIOHXiFHNTRHCJXHIaRHHJDHHEJHVbRHZJYHbIBHRsJHRkDHWlmgBKFgBSBgBCDgBGHgBpBgBIBgBVJgBuBgBvFgKDTgQVXgDUJgGSJgOqXgmUMgZIJgTUJgWIEgFBFgFNBgFDJgFSFgFGBgFYXgJFOgFgQgFVXgFhBgFbHgJFWVJABVQKcVDgFVOfXVeDFVhaRVmGdViJYVMaRVFNHhBNDhBCXhBEqhBpFhBLXhNJBhSJRheVXhhKEhxlmhZIJhdBQhkIJhbMNhMUJhMZJxNJgxQUJxDEkxDdFxSJRxplmxeSBxeCXxeGFxeYXxepQxegBxWVcxFEQxFLXxFIBxFgBxFxDxFZtxFdcxFbBxFwXyDJXyDlcuASJuDJpuDIBuCpJuGSJuIJFueEFuZIJusJXudWEuoIBuWGJuFBcuFKEuFNFuFQFuFDJuFGJuFVJuFUtuFdHuFTBmBYJmNJYmQhkmLJDmLJomIdXmiJYmvJRmsJRmklmmMBymMuCmclmmcnQiJABiJBNiJBDiBSFiBCJiBEFiBYBiBpFiBLXiBTHiJNciDEfiCZJiECJiJEqiOkHiHKFieNDiHJQieQcieDHieSFieCXieGFieEFieIHiegFihUJixNoioNXiFaBiFKFiFNDiFEPiFYXitFOitFHiFgBiFVEiFmXiFitiFbBiFMFiFrFUCXQUIoQUIJcUHQJUeCEUHwXUUJDUUqXUdWcUcqXUrnQUFNDUFSHUFCFUFEfUFLXUtFOZBXOZXSBZXpFZXVXZEQJZEJkZpDJZOqXZeNHZeCDZUqXZFBQZFEHZFLXvBAFvBKFvBCXvBEPvBpHvBIDvBgFvBuHvQNJvFNFvFGBvFIBvJFcsXCDsXLXsXsXsXlFsXcHsQqXsJQFsEqXseIFsFEHsFjDdBxOdNpRdNJRdEJbdpJRdhZJdnSJdrjNdFNJdFQHdFhNkNJDkYaRkHNRkHSRkVbRkuMRkjSJkcqDoSJFoEiJoYZJoOfXohEBoMGQocqXbBAFbBXFbBaFbBNDbBGBbBLXbBTBbBWDbGJYbIJHbFQqbFpQlDgQlOrFlVJRjGEBjZJRnXvJnXbBnEfHnOPDngJRnxfXnUJWwXEJwNpJwDpBwEfXwrEBMDCJMDGHMDIJMLJDcQGDcQpHcqXccqNFcqCXcFCJRBSBRBGBRBEJRBpQTBNFTBQJTBpBTBVXTFABTFSBTFCFTFGBTFMDrXCJrXLDrDNJrEfHrFQJrFitWNjdWNTR", + // 6-kana words + "AKLJMANOPFASNJIAEJWXAYJNRAIIbRAIcdaAeEfDAgidRAdjNYAMYEJAMIbRAFNJBAFpJFBBIJYBDZJFBSiJhBGdEBBEJfXBEJqXBEJWRBpaUJBLXrXBIYJMBOcfXBeEfFBestXBjNJRBcDJOBFEqXXNvJRXDMBhXCJNYXOAWpXONJWXHDEBXeIaRXhYJDXZJSJXMDJOXcASJXFVJXaBQqXaBZJFasXdQaFSJQaFEfXaFpJHaFOqXKBNSRKXvJBKQJhXKEJQJKEJGFKINJBKIJjNKgJNSKVElmKVhEBKiJGFKlBgJKjnUJKwsJYKMFIJKFNJDKFIJFKFOfXNJBSFNJBCXNBpJFNJBvQNJBMBNJLJXNJOqXNJeCXNJeGFNdsJCNbTKFNwXUJQNFEPQDiJcQDMSJQSFpBQGMQJQJeOcQyCJEQUJEBQJFBrQFEJqDXDJFDJXpBDJXIMDGiJhDIJGRDJeYcDHrDJDVXgFDkAWpDkIgRDjDEqDMvJRDJFNFDJFIBSKclmSJQOFSJQVHSJQjDSJGJBSJGJFSECJoSHEJqSJHTBSJVJDSViJYSZJNBSJsJDSFSJFSFEfXSJFLXCBUJVCJXSBCJXpBCXVJXCJXsXCJXdFCJNJHCLIJgCHiJFCVNJMChCJhCUHEJCsJTRCJdYcCoQJCCFEfXCFIJgCFUJxCFstFGJBaQGJBIDGQJqXGYJNRGJHKFGeQqDGHEJFGJeLXGHIiJGHdBlGUJEBGkIJTGFQPDGJFEqEAGegEJIJBEJVJXEhQJTEiJNcEJZJFEJoEqEjDEqEPDsXEPGJBEPOqXEPeQFEfDiDEJfEFEfepQEfMiJEqXNBEqDIDEqeSFEqVJXEMvJRYXNJDYXEJHYKVJcYYJEBYJeEcYJUqXYFpJFYFstXpAZJMpBSJFpNBNFpeQPDpHLJDpHIJFpHgJFpeitFpHZJFpJFADpFSJFpJFCJpFOqXpFitBpJFZJLXIJFLIJgRLVNJWLVHJMLwNpJLFGJBLFLJDLFOqXLJFUJIBDJXIBGJBIJBYQIJBIBIBOqXIBcqDIEGJFILNJTIIJEBIOiJhIJeNBIJeIBIhiJIIWoTRIJFAHIJFpBIJFuHIFUtFIJFTHOSBYJOEcqXOHEJqOvBpFOkVJrObBVJOncqDOcNJkHhNJRHuHJuHdMhBgBUqXgBsJXgONJBgHNJDgHHJQgJeitgHsJXgJyNagyDJBgZJDrgsVJQgkEJNgkjSJgJFAHgFCJDgFZtMVJXNFVXQfXVJXDJVXoQJVQVJQVDEfXVDvJHVEqNFVeQfXVHpJFVHxfXVVJSRVVmaRVlIJOhCXVJhHjYkhxCJVhWVUJhWiJcxBNJIxeEqDxfXBFxcFEPxFSJFxFYJXyBDQJydaUJyFOPDuYCJYuLvJRuHLJXuZJLDuFOPDuFZJHuFcqXmKHJdmCQJcmOsVJiJAGFitLCFieOfXiestXiZJMEikNJQirXzFiFQqXiFIJFiFZJFiFvtFUHpJFUteIcUteOcUVCJkUhdHcUbEJEUJqXQUMNJhURjYkUFitFZDGJHZJIxDZJVJXZJFDJZJFpQvBNJBvBSJFvJxBrseQqDsVFVJdFLJDkEJNBkmNJYkFLJDoQJOPoGsJRoEAHBoEJfFbBQqDbBZJHbFVJXlFIJBjYIrXjeitcjjCEBjWMNBwXQfXwXOaFwDsJXwCJTRwrCZJMDNJQcDDJFcqDOPRYiJFTBsJXTQIJBTFEfXTFLJDrXEJFrEJXMrFZJFWEJdEWYTlm", + // 7-kana words + "ABCDEFACNJTRAMBDJdAcNJVXBLNJEBXSIdWRXErNJkXYDJMBXZJCJaXMNJaYKKVJKcKDEJqXKDcNJhKVJrNYKbgJVXKFVJSBNBYBwDNJeQfXNJeEqXNhGJWENJFiJRQlIJbEQJfXxDQqXcfXQFNDEJQFwXUJDYcnUJDJIBgQDIUJTRDJFEqDSJQSJFSJQIJFSOPeZtSJFZJHCJXQfXCTDEqFGJBSJFGJBOfXGJBcqXGJHNJDGJRLiJEJfXEqEJFEJPEFpBEJYJBZJFYBwXUJYiJMEBYJZJyTYTONJXpQMFXFpeGIDdpJFstXpJFcPDLBVSJRLHQJqXLJFZJFIJBNJDIJBUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", + // 8-kana words + "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", + // 9-kana words + "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", + // 10-kana words + "IJBEJqXZJ" + ]; + var mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; + var wordlist = null; + function hex(word) { + return (0, bytes_1.hexlify)((0, strings_1.toUtf8Bytes)(word)); + } + var KiYoKu = "0xe3818de38284e3818f"; + var KyoKu = "0xe3818de38283e3818f"; + function loadWords(lang) { + if (wordlist !== null) { + return; + } + wordlist = []; + var transform = {}; + transform[(0, strings_1.toUtf8String)([227, 130, 154])] = false; + transform[(0, strings_1.toUtf8String)([227, 130, 153])] = false; + transform[(0, strings_1.toUtf8String)([227, 130, 133])] = (0, strings_1.toUtf8String)([227, 130, 134]); + transform[(0, strings_1.toUtf8String)([227, 129, 163])] = (0, strings_1.toUtf8String)([227, 129, 164]); + transform[(0, strings_1.toUtf8String)([227, 130, 131])] = (0, strings_1.toUtf8String)([227, 130, 132]); + transform[(0, strings_1.toUtf8String)([227, 130, 135])] = (0, strings_1.toUtf8String)([227, 130, 136]); + function normalize(word2) { + var result2 = ""; + for (var i2 = 0; i2 < word2.length; i2++) { + var kana = word2[i2]; + var target = transform[kana]; + if (target === false) { + continue; + } + if (target) { + kana = target; + } + result2 += kana; + } + return result2; + } + function sortJapanese(a, b) { + a = normalize(a); + b = normalize(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + for (var length_1 = 3; length_1 <= 9; length_1++) { + var d = data[length_1 - 3]; + for (var offset = 0; offset < d.length; offset += length_1) { + var word = []; + for (var i = 0; i < length_1; i++) { + var k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push(k & 64 ? 130 : 129); + word.push((k & 63) + 128); + } + wordlist.push((0, strings_1.toUtf8String)(word)); + } + } + wordlist.sort(sortJapanese); + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + var tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + if (wordlist_1.Wordlist.check(lang) !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + wordlist = null; + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + } + var LangJa = ( + /** @class */ + function(_super) { + __extends(LangJa2, _super); + function LangJa2() { + return _super.call(this, "ja") || this; + } + LangJa2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangJa2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + LangJa2.prototype.split = function(mnemonic) { + wordlist_1.logger.checkNormalize(); + return mnemonic.split(/(?:\u3000| )+/g); + }; + LangJa2.prototype.join = function(words) { + return words.join("\u3000"); + }; + return LangJa2; + }(wordlist_1.Wordlist) + ); + var langJa = new LangJa(); + exports2.langJa = langJa; + wordlist_1.Wordlist.register(langJa); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-ko.js +var require_lang_ko = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-ko.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langKo = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeAgrDUAgrJTAhrFnAhrLjAhrQgAjAgoAjJnrAkMX8AkOnoAlCTvAlCV8AlClvAlFg4AlFl6AlFn3AloSnAlrAXAlrAfAlrFUAlrFbAlrGgAlrOXAlvKnAlvMTAl3AbAl3MnAnATrAnAcrAnCZ3AnCl8AnDg8AnFboAnFl3AnHX4AnHbrAnHgrAnIl3AnJgvAnLXoAnLX4AnLbrAnLgrAnLhrAnMXoAnMgrAnOn3AnSbrAnSeoAnvLnAn3OnCTGgvCTSlvCTvAUCTvKnCTvNTCT3CZCT3GUCT3MTCT8HnCUCZrCULf8CULnvCU3HnCU3JUCY6NUCbDb8CbFZoCbLnrCboOTCboScCbrFnCbvLnCb8AgCb8HgCb$LnCkLfoClBn3CloDUDTHT8DTLl3DTSU8DTrAaDTrLXDTrLjDTrOYDTrOgDTvFXDTvFnDT3HUDT3LfDUCT9DUDT4DUFVoDUFV8DUFkoDUGgrDUJnrDULl8DUMT8DUMXrDUMX4DUMg8DUOUoDUOgvDUOg8DUSToDUSZ8DbDXoDbDgoDbGT8DbJn3DbLg3DbLn4DbMXrDbMg8DbOToDboJXGTClvGTDT8GTFZrGTLVoGTLlvGTLl3GTMg8GTOTvGTSlrGToCUGTrDgGTrJYGTrScGTtLnGTvAnGTvQgGUCZrGUDTvGUFZoGUHXrGULnvGUMT8GUoMgGXoLnGXrMXGXrMnGXvFnGYLnvGZOnvGZvOnGZ8LaGZ8LmGbAl3GbDYvGbDlrGbHX3GbJl4GbLV8GbLn3GbMn4GboJTGboRfGbvFUGb3GUGb4JnGgDX3GgFl$GgJlrGgLX6GgLZoGgLf8GgOXoGgrAgGgrJXGgrMYGgrScGgvATGgvOYGnAgoGnJgvGnLZoGnLg3GnLnrGnQn8GnSbrGnrMgHTClvHTDToHTFT3HTQT8HToJTHToJgHTrDUHTrMnHTvFYHTvRfHT8MnHT8SUHUAZ8HUBb4HUDTvHUoMYHXFl6HXJX6HXQlrHXrAUHXrMnHXrSbHXvFYHXvKXHX3LjHX3MeHYvQlHZrScHZvDbHbAcrHbFT3HbFl3HbJT8HbLTrHbMT8HbMXrHbMbrHbQb8HbSX3HboDbHboJTHbrFUHbrHgHbrJTHb8JTHb8MnHb8QgHgAlrHgDT3HgGgrHgHgrHgJTrHgJT8HgLX@HgLnrHgMT8HgMX8HgMboHgOnrHgQToHgRg3HgoHgHgrCbHgrFnHgrLVHgvAcHgvAfHnAloHnCTrHnCnvHnGTrHnGZ8HnGnvHnJT8HnLf8HnLkvHnMg8HnRTrITvFUITvFnJTAXrJTCV8JTFT3JTFT8JTFn4JTGgvJTHT8JTJT8JTJXvJTJl3JTJnvJTLX4JTLf8JTLhvJTMT8JTMXrJTMnrJTObrJTQT8JTSlvJT8DUJT8FkJT8MTJT8OXJT8OgJT8QUJT8RfJUHZoJXFT4JXFlrJXGZ8JXGnrJXLV8JXLgvJXMXoJXMX3JXNboJXPlvJXoJTJXoLkJXrAXJXrHUJXrJgJXvJTJXvOnJX4KnJYAl3JYJT8JYLhvJYQToJYrQXJY6NUJbAl3JbCZrJbDloJbGT8JbGgrJbJXvJbJboJbLf8JbLhrJbLl3JbMnvJbRg8JbSZ8JboDbJbrCZJbrSUJb3KnJb8LnJfRn8JgAXrJgCZrJgDTrJgGZrJgGZ8JgHToJgJT8JgJXoJgJgvJgLX4JgLZ3JgLZ8JgLn4JgMgrJgMn4JgOgvJgPX6JgRnvJgSToJgoCZJgoJbJgoMYJgrJXJgrJgJgrLjJg6MTJlCn3JlGgvJlJl8Jl4AnJl8FnJl8HgJnAToJnATrJnAbvJnDUoJnGnrJnJXrJnJXvJnLhvJnLnrJnLnvJnMToJnMT8JnMXvJnMX3JnMg8JnMlrJnMn4JnOX8JnST4JnSX3JnoAgJnoAnJnoJTJnoObJnrAbJnrAkJnrHnJnrJTJnrJYJnrOYJnrScJnvCUJnvFaJnvJgJnvJnJnvOYJnvQUJnvRUJn3FnJn3JTKnFl3KnLT6LTDlvLTMnoLTOn3LTRl3LTSb4LTSlrLToAnLToJgLTrAULTrAcLTrCULTrHgLTrMgLT3JnLULnrLUMX8LUoJgLVATrLVDTrLVLb8LVoJgLV8MgLV8RTLXDg3LXFlrLXrCnLXrLXLX3GTLX4GgLX4OYLZAXrLZAcrLZAgrLZAhrLZDXyLZDlrLZFbrLZFl3LZJX6LZJX8LZLc8LZLnrLZSU8LZoJTLZoJnLZrAgLZrAnLZrJYLZrLULZrMgLZrSkLZvAnLZvGULZvJeLZvOTLZ3FZLZ4JXLZ8STLZ8ScLaAT3LaAl3LaHT8LaJTrLaJT8LaJXrLaJgvLaJl4LaLVoLaMXrLaMXvLaMX8LbClvLbFToLbHlrLbJn4LbLZ3LbLhvLbMXrLbMnoLbvSULcLnrLc8HnLc8MTLdrMnLeAgoLeOgvLeOn3LfAl3LfLnvLfMl3LfOX8Lf8AnLf8JXLf8LXLgJTrLgJXrLgJl8LgMX8LgRZrLhCToLhrAbLhrFULhrJXLhvJYLjHTrLjHX4LjJX8LjLhrLjSX3LjSZ4LkFX4LkGZ8LkGgvLkJTrLkMXoLkSToLkSU8LkSZ8LkoOYLl3FfLl3MgLmAZrLmCbrLmGgrLmHboLmJnoLmJn3LmLfoLmLhrLmSToLnAX6LnAb6LnCZ3LnCb3LnDTvLnDb8LnFl3LnGnrLnHZvLnHgvLnITvLnJT8LnJX8LnJlvLnLf8LnLg6LnLhvLnLnoLnMXrLnMg8LnQlvLnSbrLnrAgLnrAnLnrDbLnrFkLnrJdLnrMULnrOYLnrSTLnvAnLnvDULnvHgLnvOYLnvOnLn3GgLn4DULn4JTLn4JnMTAZoMTAloMTDb8MTFT8MTJnoMTJnrMTLZrMTLhrMTLkvMTMX8MTRTrMToATMTrDnMTrOnMT3JnMT4MnMT8FUMT8FaMT8FlMT8GTMT8GbMT8GnMT8HnMT8JTMT8JbMT8OTMUCl8MUJTrMUJU8MUMX8MURTrMUSToMXAX6MXAb6MXCZoMXFXrMXHXrMXLgvMXOgoMXrAUMXrAnMXrHgMXrJYMXrJnMXrMTMXrMgMXrOYMXrSZMXrSgMXvDUMXvOTMX3JgMX3OTMX4JnMX8DbMX8FnMX8HbMX8HgMX8HnMX8LbMX8MnMX8OnMYAb8MYGboMYHTvMYHX4MYLTrMYLnvMYMToMYOgvMYRg3MYSTrMbAToMbAXrMbAl3MbAn8MbGZ8MbJT8MbJXrMbMXvMbMX8MbMnoMbrMUMb8AfMb8FbMb8FkMcJXoMeLnrMgFl3MgGTvMgGXoMgGgrMgGnrMgHT8MgHZrMgJnoMgLnrMgLnvMgMT8MgQUoMgrHnMgvAnMg8HgMg8JYMg8LfMloJnMl8ATMl8AXMl8JYMnAToMnAT4MnAZ8MnAl3MnAl4MnCl8MnHT8MnHg8MnJnoMnLZoMnLhrMnMXoMnMX3MnMnrMnOgvMnrFbMnrFfMnrFnMnrNTMnvJXNTMl8OTCT3OTFV8OTFn3OTHZvOTJXrOTOl3OT3ATOT3JUOT3LZOT3LeOT3MbOT8ATOT8AbOT8AgOT8MbOUCXvOUMX3OXHXvOXLl3OXrMUOXvDbOX6NUOX8JbOYFZoOYLbrOYLkoOYMg8OYSX3ObHTrObHT4ObJgrObLhrObMX3ObOX8Ob8FnOeAlrOeJT8OeJXrOeJnrOeLToOeMb8OgJXoOgLXoOgMnrOgOXrOgOloOgoAgOgoJbOgoMYOgoSTOg8AbOjLX4OjMnoOjSV8OnLVoOnrAgOn3DUPXQlrPXvFXPbvFTPdAT3PlFn3PnvFbQTLn4QToAgQToMTQULV8QURg8QUoJnQXCXvQbFbrQb8AaQb8AcQb8FbQb8MYQb8ScQeAlrQeLhrQjAn3QlFXoQloJgQloSnRTLnvRTrGURTrJTRUJZrRUoJlRUrQnRZrLmRZrMnRZrSnRZ8ATRZ8JbRZ8ScRbMT8RbST3RfGZrRfMX8RfMgrRfSZrRnAbrRnGT8RnvJgRnvLfRnvMTRn8AaSTClvSTJgrSTOXrSTRg3STRnvSToAcSToAfSToAnSToHnSToLjSToMTSTrAaSTrEUST3BYST8AgST8LmSUAZvSUAgrSUDT4SUDT8SUGgvSUJXoSUJXvSULTrSU8JTSU8LjSV8AnSV8JgSXFToSXLf8SYvAnSZrDUSZrMUSZrMnSZ8HgSZ8JTSZ8JgSZ8MYSZ8QUSaQUoSbCT3SbHToSbQYvSbSl4SboJnSbvFbSb8HbSb8JgSb8OTScGZrScHgrScJTvScMT8ScSToScoHbScrMTScvAnSeAZrSeAcrSeHboSeJUoSeLhrSeMT8SeMXrSe6JgSgHTrSkJnoSkLnvSk8CUSlFl3SlrSnSl8GnSmAboSmGT8SmJU8", + "ATLnDlATrAZoATrJX4ATrMT8ATrMX4ATrRTrATvDl8ATvJUoATvMl8AT3AToAT3MX8AT8CT3AT8DT8AT8HZrAT8HgoAUAgFnAUCTFnAXoMX8AXrAT8AXrGgvAXrJXvAXrOgoAXvLl3AZvAgoAZvFbrAZvJXoAZvJl8AZvJn3AZvMX8AZvSbrAZ8FZoAZ8LZ8AZ8MU8AZ8OTvAZ8SV8AZ8SX3AbAgFZAboJnoAbvGboAb8ATrAb8AZoAb8AgrAb8Al4Ab8Db8Ab8JnoAb8LX4Ab8LZrAb8LhrAb8MT8Ab8OUoAb8Qb8Ab8ST8AcrAUoAcrAc8AcrCZ3AcrFT3AcrFZrAcrJl4AcrJn3AcrMX3AcrOTvAc8AZ8Ac8MT8AfAcJXAgoFn4AgoGgvAgoGnrAgoLc8AgoMXoAgrLnrAkrSZ8AlFXCTAloHboAlrHbrAlrLhrAlrLkoAl3CZrAl3LUoAl3LZrAnrAl4AnrMT8An3HT4BT3IToBX4MnvBb!Ln$CTGXMnCToLZ4CTrHT8CT3JTrCT3RZrCT#GTvCU6GgvCU8Db8CU8GZrCU8HT8CboLl3CbrGgrCbrMU8Cb8DT3Cb8GnrCb8LX4Cb8MT8Cb8ObrCgrGgvCgrKX4Cl8FZoDTrAbvDTrDboDTrGT6DTrJgrDTrMX3DTrRZrDTrRg8DTvAVvDTvFZoDT3DT8DT3Ln3DT4HZrDT4MT8DT8AlrDT8MT8DUAkGbDUDbJnDYLnQlDbDUOYDbMTAnDbMXSnDboAT3DboFn4DboLnvDj6JTrGTCgFTGTGgFnGTJTMnGTLnPlGToJT8GTrCT3GTrLVoGTrLnvGTrMX3GTrMboGTvKl3GZClFnGZrDT3GZ8DTrGZ8FZ8GZ8MXvGZ8On8GZ8ST3GbCnQXGbMbFnGboFboGboJg3GboMXoGb3JTvGb3JboGb3Mn6Gb3Qb8GgDXLjGgMnAUGgrDloGgrHX4GgrSToGgvAXrGgvAZvGgvFbrGgvLl3GgvMnvGnDnLXGnrATrGnrMboGnuLl3HTATMnHTAgCnHTCTCTHTrGTvHTrHTvHTrJX8HTrLl8HTrMT8HTrMgoHTrOTrHTuOn3HTvAZrHTvDTvHTvGboHTvJU8HTvLl3HTvMXrHTvQb4HT4GT6HT4JT8HT4Jb#HT8Al3HT8GZrHT8GgrHT8HX4HT8Jb8HT8JnoHT8LTrHT8LgvHT8SToHT8SV8HUoJUoHUoJX8HUoLnrHXrLZoHXvAl3HX3LnrHX4FkvHX4LhrHX4MXoHX4OnoHZrAZ8HZrDb8HZrGZ8HZrJnrHZvGZ8HZvLnvHZ8JnvHZ8LhrHbCXJlHbMTAnHboJl4HbpLl3HbrJX8HbrLnrHbrMnvHbvRYrHgoSTrHgrFV8HgrGZ8HgrJXoHgrRnvHgvBb!HgvGTrHgvHX4HgvHn!HgvLTrHgvSU8HnDnLbHnFbJbHnvDn8Hn6GgvHn!BTvJTCTLnJTQgFnJTrAnvJTrLX4JTrOUoJTvFn3JTvLnrJTvNToJT3AgoJT3Jn4JT3LhvJT3ObrJT8AcrJT8Al3JT8JT8JT8JnoJT8LX4JT8LnrJT8MX3JT8Rg3JT8Sc8JUoBTvJU8AToJU8GZ8JU8GgvJU8JTrJU8JXrJU8JnrJU8LnvJU8ScvJXHnJlJXrGgvJXrJU8JXrLhrJXrMT8JXrMXrJXrQUoJXvCTvJXvGZ8JXvGgrJXvQT8JX8Ab8JX8DT8JX8GZ8JX8HZvJX8LnrJX8MT8JX8MXoJX8MnvJX8ST3JYGnCTJbAkGbJbCTAnJbLTAcJboDT3JboLb6JbrAnvJbrCn3JbrDl8JbrGboJbrIZoJbrJnvJbrMnvJbrQb4Jb8RZrJeAbAnJgJnFbJgScAnJgrATrJgvHZ8JgvMn4JlJlFbJlLiQXJlLjOnJlRbOlJlvNXoJlvRl3Jl4AcrJl8AUoJl8MnrJnFnMlJnHgGbJnoDT8JnoFV8JnoGgvJnoIT8JnoQToJnoRg3JnrCZ3JnrGgrJnrHTvJnrLf8JnrOX8JnvAT3JnvFZoJnvGT8JnvJl4JnvMT8JnvMX8JnvOXrJnvPX6JnvSX3JnvSZrJn3MT8Jn3MX8Jn3RTrLTATKnLTJnLTLTMXKnLTRTQlLToGb8LTrAZ8LTrCZ8LTrDb8LTrHT8LT3PX6LT4FZoLT$CTvLT$GgrLUvHX3LVoATrLVoAgoLVoJboLVoMX3LVoRg3LV8CZ3LV8FZoLV8GTvLXrDXoLXrFbrLXvAgvLXvFlrLXvLl3LXvRn6LX4Mb8LX8GT8LYCXMnLYrMnrLZoSTvLZrAZvLZrAloLZrFToLZrJXvLZrJboLZrJl4LZrLnrLZrMT8LZrOgvLZrRnvLZrST4LZvMX8LZvSlvLZ8AgoLZ8CT3LZ8JT8LZ8LV8LZ8LZoLZ8Lg8LZ8SV8LZ8SbrLZ$HT8LZ$Mn4La6CTvLbFbMnLbRYFTLbSnFZLboJT8LbrAT9LbrGb3LbrQb8LcrJX8LcrMXrLerHTvLerJbrLerNboLgrDb8LgrGZ8LgrHTrLgrMXrLgrSU8LgvJTrLgvLl3Lg6Ll3LhrLnrLhrMT8LhvAl4LiLnQXLkoAgrLkoJT8LkoJn4LlrSU8Ll3FZoLl3HTrLl3JX8Ll3JnoLl3LToLmLeFbLnDUFbLnLVAnLnrATrLnrAZoLnrAb8LnrAlrLnrGgvLnrJU8LnrLZrLnrLhrLnrMb8LnrOXrLnrSZ8LnvAb4LnvDTrLnvDl8LnvHTrLnvHbrLnvJT8LnvJU8LnvJbrLnvLhvLnvMX8LnvMb8LnvNnoLnvSU8Ln3Al3Ln4FZoLn4GT6Ln4JgvLn4LhrLn4MT8Ln4SToMToCZrMToJX8MToLX4MToLf8MToRg3MTrEloMTvGb6MT3BTrMT3Lb6MT8AcrMT8AgrMT8GZrMT8JnoMT8LnrMT8MX3MUOUAnMXAbFnMXoAloMXoJX8MXoLf8MXoLl8MXrAb8MXrDTvMXrGT8MXrGgrMXrHTrMXrLf8MXrMU8MXrOXvMXrQb8MXvGT8MXvHTrMXvLVoMX3AX3MX3Jn3MX3LhrMX3MX3MX4AlrMX4OboMX8GTvMX8GZrMX8GgrMX8JT8MX8JX8MX8LhrMX8MT8MYDUFbMYMgDbMbGnFfMbvLX4MbvLl3Mb8Mb8Mb8ST4MgGXCnMg8ATrMg8AgoMg8CZrMg8DTrMg8DboMg8HTrMg8JgrMg8LT8MloJXoMl8AhrMl8JT8MnLgAUMnoJXrMnoLX4MnoLhrMnoMT8MnrAl4MnrDb8MnrOTvMnrOgvMnrQb8MnrSU8MnvGgrMnvHZ8Mn3MToMn4DTrMn4LTrMn4Mg8NnBXAnOTFTFnOToAToOTrGgvOTrJX8OT3JXoOT6MTrOT8GgrOT8HTpOT8MToOUoHT8OUoJT8OUoLn3OXrAgoOXrDg8OXrMT8OXvSToOX6CTvOX8CZrOX8OgrOb6HgvOb8AToOb8MT8OcvLZ8OgvAlrOgvHTvOgvJTrOgvJnrOgvLZrOgvLn4OgvMT8OgvRTrOg8AZoOg8DbvOnrOXoOnvJn4OnvLhvOnvRTrOn3GgoOn3JnvOn6JbvOn8OTrPTGYFTPbBnFnPbGnDnPgDYQTPlrAnvPlrETvPlrLnvPlrMXvPlvFX4QTMTAnQTrJU8QYCnJlQYJlQlQbGTQbQb8JnrQb8LZoQb8LnvQb8MT8Qb8Ml8Qb8ST4QloAl4QloHZvQloJX8QloMn8QnJZOlRTrAZvRTrDTrRTvJn4RTvLhvRT4Jb8RZrAZrRZ8AkrRZ8JU8RZ8LV8RZ8LnvRbJlQXRg3GboRg3MnvRg8AZ8Rg8JboRg8Jl4RnLTCbRnvFl3RnvQb8SToAl4SToCZrSToFZoSToHXrSToJU8SToJgvSToJl4SToLhrSToMX3STrAlvSTrCT9STrCgrSTrGgrSTrHXrSTrHboSTrJnoSTrNboSTvLnrST4AZoST8Ab8ST8JT8SUoJn3SU6HZ#SU6JTvSU8Db8SU8HboSU8LgrSV8JT8SZrAcrSZrAl3SZrJT8SZrJnvSZrMT8SZvLUoSZ4FZoSZ8JnoSZ8RZrScoLnrScoMT8ScoMX8ScrAT4ScrAZ8ScrLZ8ScrLkvScvDb8ScvLf8ScvNToSgrFZrShvKnrSloHUoSloLnrSlrMXoSl8HgrSmrJUoSn3BX6", + "ATFlOn3ATLgrDYAT4MTAnAT8LTMnAYJnRTrAbGgJnrAbLV8LnAbvNTAnAeFbLg3AgOYMXoAlQbFboAnDboAfAnJgoJTBToDgAnBUJbAl3BboDUAnCTDlvLnCTFTrSnCYoQTLnDTwAbAnDUDTrSnDUHgHgrDX8LXFnDbJXAcrETvLTLnGTFTQbrGTMnGToGT3DUFbGUJlPX3GbQg8LnGboJbFnGb3GgAYGgAg8ScGgMbAXrGgvAbAnGnJTLnvGnvATFgHTDT6ATHTrDlJnHYLnMn8HZrSbJTHZ8LTFnHbFTJUoHgSeMT8HgrLjAnHgvAbAnHlFUrDlHnDgvAnHnHTFT3HnQTGnrJTAaMXvJTGbCn3JTOgrAnJXvAXMnJbMg8SnJbMnRg3Jb8LTMnJnAl3OnJnGYrQlJnJlQY3LTDlCn3LTJjLg3LTLgvFXLTMg3GTLV8HUOgLXFZLg3LXNXrMnLX8QXFnLX9AlMYLYLXPXrLZAbJU8LZDUJU8LZMXrSnLZ$AgFnLaPXrDULbFYrMnLbMn8LXLboJgJgLeFbLg3LgLZrSnLgOYAgoLhrRnJlLkCTrSnLkOnLhrLnFX%AYLnFZoJXLnHTvJbLnLloAbMTATLf8MTHgJn3MTMXrAXMT3MTFnMUITvFnMXFX%AYMXMXvFbMXrFTDbMYAcMX3MbLf8SnMb8JbFnMgMXrMTMgvAXFnMgvGgCmMnAloSnMnFnJTrOXvMXSnOX8HTMnObJT8ScObLZFl3ObMXCZoPTLgrQXPUFnoQXPU3RXJlPX3RkQXPbrJXQlPlrJbFnQUAhrDbQXGnCXvQYLnHlvQbLfLnvRTOgvJbRXJYrQlRYLnrQlRbLnrQlRlFT8JlRlFnrQXSTClCn3STHTrAnSTLZQlrSTMnGTrSToHgGbSTrGTDnSTvGXCnST3HgFbSU3HXAXSbAnJn3SbFT8LnScLfLnv", + "AT3JgJX8AT8FZoSnAT8JgFV8AT8LhrDbAZ8JT8DbAb8GgLhrAb8SkLnvAe8MT8SnAlMYJXLVAl3GYDTvAl3LfLnvBUDTvLl3CTOn3HTrCT3DUGgrCU8MT8AbCbFTrJUoCgrDb8MTDTLV8JX8DTLnLXQlDT8LZrSnDUQb8FZ8DUST4JnvDb8ScOUoDj6GbJl4GTLfCYMlGToAXvFnGboAXvLnGgAcrJn3GgvFnSToGnLf8JnvGn#HTDToHTLnFXJlHTvATFToHTvHTDToHTvMTAgoHT3STClvHT4AlFl6HT8HTDToHUoDgJTrHUoScMX3HbRZrMXoHboJg8LTHgDb8JTrHgMToLf8HgvLnLnoHnHn3HT4Hn6MgvAnJTJU8ScvJT3AaQT8JT8HTrAnJXrRg8AnJbAloMXoJbrATFToJbvMnoSnJgDb6GgvJgDb8MXoJgSX3JU8JguATFToJlPYLnQlJlQkDnLbJlQlFYJlJl8Lf8OTJnCTFnLbJnLTHXMnJnLXGXCnJnoFfRg3JnrMYRg3Jn3HgFl3KT8Dg8LnLTRlFnPTLTvPbLbvLVoSbrCZLXMY6HT3LXNU7DlrLXNXDTATLX8DX8LnLZDb8JU8LZMnoLhrLZSToJU8LZrLaLnrLZvJn3SnLZ8LhrSnLaJnoMT8LbFlrHTvLbrFTLnrLbvATLlvLb6OTFn3LcLnJZOlLeAT6Mn4LeJT3ObrLg6LXFlrLhrJg8LnLhvDlPX4LhvLfLnvLj6JTFT3LnFbrMXoLnQluCTvLnrQXCY6LnvLfLnvLnvMgLnvLnvSeLf8MTMbrJn3MT3JgST3MT8AnATrMT8LULnrMUMToCZrMUScvLf8MXoDT8SnMX6ATFToMX8AXMT8MX8FkMT8MX8HTrDUMX8ScoSnMYJT6CTvMgAcrMXoMg8SToAfMlvAXLg3MnFl3AnvOT3AnFl3OUoATHT8OU3RnLXrOXrOXrSnObPbvFn6Og8HgrSnOg8OX8DbPTvAgoJgPU3RYLnrPXrDnJZrPb8CTGgvPlrLTDlvPlvFUJnoQUvFXrQlQeMnoAl3QlrQlrSnRTFTrJUoSTDlLiLXSTFg6HT3STJgoMn4STrFTJTrSTrLZFl3ST4FnMXoSUrDlHUoScvHTvSnSfLkvMXo", + "AUoAcrMXoAZ8HboAg8AbOg6ATFgAg8AloMXoAl3AT8JTrAl8MX8MXoCT3SToJU8Cl8Db8MXoDT8HgrATrDboOT8MXoGTOTrATMnGT8LhrAZ8GnvFnGnQXHToGgvAcrHTvAXvLl3HbrAZoMXoHgBlFXLg3HgMnFXrSnHgrSb8JUoHn6HT8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg", + "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl" + ]; + var codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; + function getHangul(code) { + if (code >= 40) { + code = code + 168 - 40; + } else if (code >= 19) { + code = code + 97 - 19; + } + return (0, strings_1.toUtf8String)([225, (code >> 6) + 132, (code & 63) + 128]); + } + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = []; + data.forEach(function(data2, length) { + length += 4; + for (var i = 0; i < data2.length; i += length) { + var word = ""; + for (var j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data2[i + j])); + } + wordlist.push(word); + } + }); + wordlist.sort(); + if (wordlist_1.Wordlist.check(lang) !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + wordlist = null; + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + } + var LangKo = ( + /** @class */ + function(_super) { + __extends(LangKo2, _super); + function LangKo2() { + return _super.call(this, "ko") || this; + } + LangKo2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangKo2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangKo2; + }(wordlist_1.Wordlist) + ); + var langKo = new LangKo(); + exports2.langKo = langKo; + wordlist_1.Wordlist.register(langKo); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-it.js +var require_lang_it = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-it.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langIt = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbacoAbbaglioAbbinatoAbeteAbissoAbolireAbrasivoAbrogatoAccadereAccennoAccusatoAcetoneAchilleAcidoAcquaAcreAcrilicoAcrobataAcutoAdagioAddebitoAddomeAdeguatoAderireAdipeAdottareAdulareAffabileAffettoAffissoAffrantoAforismaAfosoAfricanoAgaveAgenteAgevoleAggancioAgireAgitareAgonismoAgricoloAgrumetoAguzzoAlabardaAlatoAlbatroAlberatoAlboAlbumeAlceAlcolicoAlettoneAlfaAlgebraAlianteAlibiAlimentoAllagatoAllegroAllievoAllodolaAllusivoAlmenoAlogenoAlpacaAlpestreAltalenaAlternoAlticcioAltroveAlunnoAlveoloAlzareAmalgamaAmanitaAmarenaAmbitoAmbratoAmebaAmericaAmetistaAmicoAmmassoAmmendaAmmirareAmmonitoAmoreAmpioAmpliareAmuletoAnacardoAnagrafeAnalistaAnarchiaAnatraAncaAncellaAncoraAndareAndreaAnelloAngeloAngolareAngustoAnimaAnnegareAnnidatoAnnoAnnuncioAnonimoAnticipoAnziApaticoAperturaApodeApparireAppetitoAppoggioApprodoAppuntoAprileArabicaArachideAragostaAraldicaArancioAraturaArazzoArbitroArchivioArditoArenileArgentoArgineArgutoAriaArmoniaArneseArredatoArringaArrostoArsenicoArsoArteficeArzilloAsciuttoAscoltoAsepsiAsetticoAsfaltoAsinoAsolaAspiratoAsproAssaggioAsseAssolutoAssurdoAstaAstenutoAsticeAstrattoAtavicoAteismoAtomicoAtonoAttesaAttivareAttornoAttritoAttualeAusilioAustriaAutistaAutonomoAutunnoAvanzatoAvereAvvenireAvvisoAvvolgereAzioneAzotoAzzimoAzzurroBabeleBaccanoBacinoBacoBadessaBadilataBagnatoBaitaBalconeBaldoBalenaBallataBalzanoBambinoBandireBaraondaBarbaroBarcaBaritonoBarlumeBaroccoBasilicoBassoBatostaBattutoBauleBavaBavosaBeccoBeffaBelgioBelvaBendaBenevoleBenignoBenzinaBereBerlinaBetaBibitaBiciBidoneBifidoBigaBilanciaBimboBinocoloBiologoBipedeBipolareBirbanteBirraBiscottoBisestoBisnonnoBisonteBisturiBizzarroBlandoBlattaBollitoBonificoBordoBoscoBotanicoBottinoBozzoloBraccioBradipoBramaBrancaBravuraBretellaBrevettoBrezzaBrigliaBrillanteBrindareBroccoloBrodoBronzinaBrulloBrunoBubboneBucaBudinoBuffoneBuioBulboBuonoBurloneBurrascaBussolaBustaCadettoCaducoCalamaroCalcoloCalesseCalibroCalmoCaloriaCambusaCamerataCamiciaCamminoCamolaCampaleCanapaCandelaCaneCaninoCanottoCantinaCapaceCapelloCapitoloCapogiroCapperoCapraCapsulaCarapaceCarcassaCardoCarismaCarovanaCarrettoCartolinaCasaccioCascataCasermaCasoCassoneCastelloCasualeCatastaCatenaCatrameCautoCavilloCedibileCedrataCefaloCelebreCellulareCenaCenoneCentesimoCeramicaCercareCertoCerumeCervelloCesoiaCespoCetoChelaChiaroChiccaChiedereChimeraChinaChirurgoChitarraCiaoCiclismoCifrareCignoCilindroCiottoloCircaCirrosiCitricoCittadinoCiuffoCivettaCivileClassicoClinicaCloroCoccoCodardoCodiceCoerenteCognomeCollareColmatoColoreColposoColtivatoColzaComaCometaCommandoComodoComputerComuneConcisoCondurreConfermaCongelareConiugeConnessoConoscereConsumoContinuoConvegnoCopertoCopioneCoppiaCopricapoCorazzaCordataCoricatoCorniceCorollaCorpoCorredoCorsiaCorteseCosmicoCostanteCotturaCovatoCratereCravattaCreatoCredereCremosoCrescitaCretaCricetoCrinaleCrisiCriticoCroceCronacaCrostataCrucialeCruscaCucireCuculoCuginoCullatoCupolaCuratoreCursoreCurvoCuscinoCustodeDadoDainoDalmataDamerinoDanielaDannosoDanzareDatatoDavantiDavveroDebuttoDecennioDecisoDeclinoDecolloDecretoDedicatoDefinitoDeformeDegnoDelegareDelfinoDelirioDeltaDemenzaDenotatoDentroDepositoDerapataDerivareDerogaDescrittoDesertoDesiderioDesumereDetersivoDevotoDiametroDicembreDiedroDifesoDiffusoDigerireDigitaleDiluvioDinamicoDinnanziDipintoDiplomaDipoloDiradareDireDirottoDirupoDisagioDiscretoDisfareDisgeloDispostoDistanzaDisumanoDitoDivanoDiveltoDividereDivoratoDobloneDocenteDoganaleDogmaDolceDomatoDomenicaDominareDondoloDonoDormireDoteDottoreDovutoDozzinaDragoDruidoDubbioDubitareDucaleDunaDuomoDupliceDuraturoEbanoEccessoEccoEclissiEconomiaEderaEdicolaEdileEditoriaEducareEgemoniaEgliEgoismoEgregioElaboratoElargireEleganteElencatoElettoElevareElficoElicaElmoElsaElusoEmanatoEmblemaEmessoEmiroEmotivoEmozioneEmpiricoEmuloEndemicoEnduroEnergiaEnfasiEnotecaEntrareEnzimaEpatiteEpilogoEpisodioEpocaleEppureEquatoreErarioErbaErbosoEredeEremitaErigereErmeticoEroeErosivoErranteEsagonoEsameEsanimeEsaudireEscaEsempioEsercitoEsibitoEsigenteEsistereEsitoEsofagoEsortatoEsosoEspansoEspressoEssenzaEssoEstesoEstimareEstoniaEstrosoEsultareEtilicoEtnicoEtruscoEttoEuclideoEuropaEvasoEvidenzaEvitatoEvolutoEvvivaFabbricaFaccendaFachiroFalcoFamigliaFanaleFanfaraFangoFantasmaFareFarfallaFarinosoFarmacoFasciaFastosoFasulloFaticareFatoFavolosoFebbreFecolaFedeFegatoFelpaFeltroFemminaFendereFenomenoFermentoFerroFertileFessuraFestivoFettaFeudoFiabaFiduciaFifaFiguratoFiloFinanzaFinestraFinireFioreFiscaleFisicoFiumeFlaconeFlamencoFleboFlemmaFloridoFluenteFluoroFobicoFocacciaFocosoFoderatoFoglioFolataFolcloreFolgoreFondenteFoneticoFoniaFontanaForbitoForchettaForestaFormicaFornaioForoFortezzaForzareFosfatoFossoFracassoFranaFrassinoFratelloFreccettaFrenataFrescoFrigoFrollinoFrondeFrugaleFruttaFucilataFucsiaFuggenteFulmineFulvoFumanteFumettoFumosoFuneFunzioneFuocoFurboFurgoneFuroreFusoFutileGabbianoGaffeGalateoGallinaGaloppoGamberoGammaGaranziaGarboGarofanoGarzoneGasdottoGasolioGastricoGattoGaudioGazeboGazzellaGecoGelatinaGelsoGemelloGemmatoGeneGenitoreGennaioGenotipoGergoGhepardoGhiaccioGhisaGialloGildaGineproGiocareGioielloGiornoGioveGiratoGironeGittataGiudizioGiuratoGiustoGlobuloGlutineGnomoGobbaGolfGomitoGommoneGonfioGonnaGovernoGracileGradoGraficoGrammoGrandeGrattareGravosoGraziaGrecaGreggeGrifoneGrigioGrinzaGrottaGruppoGuadagnoGuaioGuantoGuardareGufoGuidareIbernatoIconaIdenticoIdillioIdoloIdraIdricoIdrogenoIgieneIgnaroIgnoratoIlareIllesoIllogicoIlludereImballoImbevutoImboccoImbutoImmaneImmersoImmolatoImpaccoImpetoImpiegoImportoImprontaInalareInarcareInattivoIncantoIncendioInchinoIncisivoInclusoIncontroIncrocioIncuboIndagineIndiaIndoleIneditoInfattiInfilareInflittoIngaggioIngegnoIngleseIngordoIngrossoInnescoInodoreInoltrareInondatoInsanoInsettoInsiemeInsonniaInsulinaIntasatoInteroIntonacoIntuitoInumidireInvalidoInveceInvitoIperboleIpnoticoIpotesiIppicaIrideIrlandaIronicoIrrigatoIrrorareIsolatoIsotopoIstericoIstitutoIstriceItaliaIterareLabbroLabirintoLaccaLaceratoLacrimaLacunaLaddoveLagoLampoLancettaLanternaLardosoLargaLaringeLastraLatenzaLatinoLattugaLavagnaLavoroLegaleLeggeroLemboLentezzaLenzaLeoneLepreLesivoLessatoLestoLetteraleLevaLevigatoLiberoLidoLievitoLillaLimaturaLimitareLimpidoLineareLinguaLiquidoLiraLiricaLiscaLiteLitigioLivreaLocandaLodeLogicaLombareLondraLongevoLoquaceLorenzoLotoLotteriaLuceLucidatoLumacaLuminosoLungoLupoLuppoloLusingaLussoLuttoMacabroMacchinaMaceroMacinatoMadamaMagicoMagliaMagneteMagroMaiolicaMalafedeMalgradoMalintesoMalsanoMaltoMalumoreManaManciaMandorlaMangiareManifestoMannaroManovraMansardaMantideManubrioMappaMaratonaMarcireMarettaMarmoMarsupioMascheraMassaiaMastinoMaterassoMatricolaMattoneMaturoMazurcaMeandroMeccanicoMecenateMedesimoMeditareMegaMelassaMelisMelodiaMeningeMenoMensolaMercurioMerendaMerloMeschinoMeseMessereMestoloMetalloMetodoMettereMiagolareMicaMicelioMicheleMicroboMidolloMieleMiglioreMilanoMiliteMimosaMineraleMiniMinoreMirinoMirtilloMiscelaMissivaMistoMisurareMitezzaMitigareMitraMittenteMnemonicoModelloModificaModuloMoganoMogioMoleMolossoMonasteroMoncoMondinaMonetarioMonileMonotonoMonsoneMontatoMonvisoMoraMordereMorsicatoMostroMotivatoMotosegaMottoMovenzaMovimentoMozzoMuccaMucosaMuffaMughettoMugnaioMulattoMulinelloMultiploMummiaMuntoMuovereMuraleMusaMuscoloMusicaMutevoleMutoNababboNaftaNanometroNarcisoNariceNarratoNascereNastrareNaturaleNauticaNaviglioNebulosaNecrosiNegativoNegozioNemmenoNeofitaNerettoNervoNessunoNettunoNeutraleNeveNevroticoNicchiaNinfaNitidoNobileNocivoNodoNomeNominaNordicoNormaleNorvegeseNostranoNotareNotiziaNotturnoNovellaNucleoNullaNumeroNuovoNutrireNuvolaNuzialeOasiObbedireObbligoObeliscoOblioOboloObsoletoOccasioneOcchioOccidenteOccorrereOccultareOcraOculatoOdiernoOdorareOffertaOffrireOffuscatoOggettoOggiOgnunoOlandeseOlfattoOliatoOlivaOlogrammaOltreOmaggioOmbelicoOmbraOmegaOmissioneOndosoOnereOniceOnnivoroOnorevoleOntaOperatoOpinioneOppostoOracoloOrafoOrdineOrecchinoOreficeOrfanoOrganicoOrigineOrizzonteOrmaOrmeggioOrnativoOrologioOrrendoOrribileOrtensiaOrticaOrzataOrzoOsareOscurareOsmosiOspedaleOspiteOssaOssidareOstacoloOsteOtiteOtreOttagonoOttimoOttobreOvaleOvestOvinoOviparoOvocitoOvunqueOvviareOzioPacchettoPacePacificoPadellaPadronePaesePagaPaginaPalazzinaPalesarePallidoPaloPaludePandoroPannelloPaoloPaonazzoPapricaParabolaParcellaParerePargoloPariParlatoParolaPartireParvenzaParzialePassivoPasticcaPataccaPatologiaPattumePavonePeccatoPedalarePedonalePeggioPelosoPenarePendicePenisolaPennutoPenombraPensarePentolaPepePepitaPerbenePercorsoPerdonatoPerforarePergamenaPeriodoPermessoPernoPerplessoPersuasoPertugioPervasoPesatorePesistaPesoPestiferoPetaloPettinePetulantePezzoPiacerePiantaPiattinoPiccinoPicozzaPiegaPietraPifferoPigiamaPigolioPigroPilaPiliferoPillolaPilotaPimpantePinetaPinnaPinoloPioggiaPiomboPiramidePireticoPiritePirolisiPitonePizzicoPlaceboPlanarePlasmaPlatanoPlenarioPochezzaPoderosoPodismoPoesiaPoggiarePolentaPoligonoPollicePolmonitePolpettaPolsoPoltronaPolverePomicePomodoroPontePopolosoPorfidoPorosoPorporaPorrePortataPosaPositivoPossessoPostulatoPotassioPoterePranzoPrassiPraticaPreclusoPredicaPrefissoPregiatoPrelievoPremerePrenotarePreparatoPresenzaPretestoPrevalsoPrimaPrincipePrivatoProblemaProcuraProdurreProfumoProgettoProlungaPromessaPronomePropostaProrogaProtesoProvaPrudentePrugnaPruritoPsichePubblicoPudicaPugilatoPugnoPulcePulitoPulsantePuntarePupazzoPupillaPuroQuadroQualcosaQuasiQuerelaQuotaRaccoltoRaddoppioRadicaleRadunatoRafficaRagazzoRagioneRagnoRamarroRamingoRamoRandagioRantolareRapatoRapinaRappresoRasaturaRaschiatoRasenteRassegnaRastrelloRataRavvedutoRealeRecepireRecintoReclutaReconditoRecuperoRedditoRedimereRegalatoRegistroRegolaRegressoRelazioneRemareRemotoRennaReplicaReprimereReputareResaResidenteResponsoRestauroReteRetinaRetoricaRettificaRevocatoRiassuntoRibadireRibelleRibrezzoRicaricaRiccoRicevereRiciclatoRicordoRicredutoRidicoloRidurreRifasareRiflessoRiformaRifugioRigareRigettatoRighelloRilassatoRilevatoRimanereRimbalzoRimedioRimorchioRinascitaRincaroRinforzoRinnovoRinomatoRinsavitoRintoccoRinunciaRinvenireRiparatoRipetutoRipienoRiportareRipresaRipulireRisataRischioRiservaRisibileRisoRispettoRistoroRisultatoRisvoltoRitardoRitegnoRitmicoRitrovoRiunioneRivaRiversoRivincitaRivoltoRizomaRobaRoboticoRobustoRocciaRocoRodaggioRodereRoditoreRogitoRollioRomanticoRompereRonzioRosolareRospoRotanteRotondoRotulaRovescioRubizzoRubricaRugaRullinoRumineRumorosoRuoloRupeRussareRusticoSabatoSabbiareSabotatoSagomaSalassoSaldaturaSalgemmaSalivareSalmoneSaloneSaltareSalutoSalvoSapereSapidoSaporitoSaracenoSarcasmoSartoSassosoSatelliteSatiraSatolloSaturnoSavanaSavioSaziatoSbadiglioSbalzoSbancatoSbarraSbattereSbavareSbendareSbirciareSbloccatoSbocciatoSbrinareSbruffoneSbuffareScabrosoScadenzaScalaScambiareScandaloScapolaScarsoScatenareScavatoSceltoScenicoScettroSchedaSchienaSciarpaScienzaScindereScippoSciroppoScivoloSclerareScodellaScolpitoScompartoSconfortoScoprireScortaScossoneScozzeseScribaScrollareScrutinioScuderiaScultoreScuolaScuroScusareSdebitareSdoganareSeccaturaSecondoSedanoSeggiolaSegnalatoSegregatoSeguitoSelciatoSelettivoSellaSelvaggioSemaforoSembrareSemeSeminatoSempreSensoSentireSepoltoSequenzaSerataSerbatoSerenoSerioSerpenteSerraglioServireSestinaSetolaSettimanaSfaceloSfaldareSfamatoSfarzosoSfaticatoSferaSfidaSfilatoSfingeSfocatoSfoderareSfogoSfoltireSforzatoSfrattoSfruttatoSfuggitoSfumareSfusoSgabelloSgarbatoSgonfiareSgorbioSgrassatoSguardoSibiloSiccomeSierraSiglaSignoreSilenzioSillabaSimboloSimpaticoSimulatoSinfoniaSingoloSinistroSinoSintesiSinusoideSiparioSismaSistoleSituatoSlittaSlogaturaSlovenoSmarritoSmemoratoSmentitoSmeraldoSmilzoSmontareSmottatoSmussatoSnellireSnervatoSnodoSobbalzoSobrioSoccorsoSocialeSodaleSoffittoSognoSoldatoSolenneSolidoSollazzoSoloSolubileSolventeSomaticoSommaSondaSonettoSonniferoSopireSoppesoSopraSorgereSorpassoSorrisoSorsoSorteggioSorvolatoSospiroSostaSottileSpadaSpallaSpargereSpatolaSpaventoSpazzolaSpecieSpedireSpegnereSpelaturaSperanzaSpessoreSpettraleSpezzatoSpiaSpigolosoSpillatoSpinosoSpiraleSplendidoSportivoSposoSprangaSprecareSpronatoSpruzzoSpuntinoSquilloSradicareSrotolatoStabileStaccoStaffaStagnareStampatoStantioStarnutoStaseraStatutoSteloSteppaSterzoStilettoStimaStirpeStivaleStizzosoStonatoStoricoStrappoStregatoStriduloStrozzareStruttoStuccareStufoStupendoSubentroSuccosoSudoreSuggeritoSugoSultanoSuonareSuperboSupportoSurgelatoSurrogatoSussurroSuturaSvagareSvedeseSveglioSvelareSvenutoSveziaSviluppoSvistaSvizzeraSvoltaSvuotareTabaccoTabulatoTacciareTaciturnoTaleTalismanoTamponeTanninoTaraTardivoTargatoTariffaTarpareTartarugaTastoTatticoTavernaTavolataTazzaTecaTecnicoTelefonoTemerarioTempoTemutoTendoneTeneroTensioneTentacoloTeoremaTermeTerrazzoTerzettoTesiTesseratoTestatoTetroTettoiaTifareTigellaTimbroTintoTipicoTipografoTiraggioTiroTitanioTitoloTitubanteTizioTizzoneToccareTollerareToltoTombolaTomoTonfoTonsillaTopazioTopologiaToppaTorbaTornareTorroneTortoraToscanoTossireTostaturaTotanoTraboccoTracheaTrafilaTragediaTralcioTramontoTransitoTrapanoTrarreTraslocoTrattatoTraveTrecciaTremolioTrespoloTributoTrichecoTrifoglioTrilloTrinceaTrioTristezzaTrituratoTrivellaTrombaTronoTroppoTrottolaTrovareTruccatoTubaturaTuffatoTulipanoTumultoTunisiaTurbareTurchinoTutaTutelaUbicatoUccelloUccisoreUdireUditivoUffaUfficioUgualeUlisseUltimatoUmanoUmileUmorismoUncinettoUngereUnghereseUnicornoUnificatoUnisonoUnitarioUnteUovoUpupaUraganoUrgenzaUrloUsanzaUsatoUscitoUsignoloUsuraioUtensileUtilizzoUtopiaVacanteVaccinatoVagabondoVagliatoValangaValgoValicoVallettaValorosoValutareValvolaVampataVangareVanitosoVanoVantaggioVanveraVaporeVaranoVarcatoVarianteVascaVedettaVedovaVedutoVegetaleVeicoloVelcroVelinaVellutoVeloceVenatoVendemmiaVentoVeraceVerbaleVergognaVerificaVeroVerrucaVerticaleVescicaVessilloVestaleVeteranoVetrinaVetustoViandanteVibranteVicendaVichingoVicinanzaVidimareVigiliaVignetoVigoreVileVillanoViminiVincitoreViolaViperaVirgolaVirologoVirulentoViscosoVisioneVispoVissutoVisuraVitaVitelloVittimaVivandaVividoViziareVoceVogaVolatileVolereVolpeVoragineVulcanoZampognaZannaZappatoZatteraZavorraZefiroZelanteZeloZenzeroZerbinoZibettoZincoZirconeZittoZollaZoticoZuccheroZufoloZuluZuppa"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620") { + wordlist = null; + throw new Error("BIP39 Wordlist for it (Italian) FAILED"); + } + } + var LangIt = ( + /** @class */ + function(_super) { + __extends(LangIt2, _super); + function LangIt2() { + return _super.call(this, "it") || this; + } + LangIt2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangIt2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangIt2; + }(wordlist_1.Wordlist) + ); + var langIt = new LangIt(); + exports2.langIt = langIt; + wordlist_1.Wordlist.register(langIt); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-zh.js +var require_lang_zh = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-zh.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langZhTw = exports2.langZhCn = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]) + ]; + if (lang.locale === "zh_tw") { + var common = s % 4; + for (var i_1 = common; i_1 < 3; i_1++) { + bytes[i_1] = codes.indexOf(deltaData[deltaOffset++]) + (i_1 == 0 ? 228 : 128); + } + } + wordlist[lang.locale].push((0, strings_1.toUtf8String)(bytes)); + } + if (wordlist_1.Wordlist.check(lang) !== Checks[lang.locale]) { + wordlist[lang.locale] = null; + throw new Error("BIP39 Wordlist for " + lang.locale + " (Chinese) FAILED"); + } + } + var LangZh = ( + /** @class */ + function(_super) { + __extends(LangZh2, _super); + function LangZh2(country) { + return _super.call(this, "zh_" + country) || this; + } + LangZh2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[this.locale][index]; + }; + LangZh2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist[this.locale].indexOf(word); + }; + LangZh2.prototype.split = function(mnemonic) { + mnemonic = mnemonic.replace(/(?:\u3000| )+/g, ""); + return mnemonic.split(""); + }; + return LangZh2; + }(wordlist_1.Wordlist) + ); + var langZhCn = new LangZh("cn"); + exports2.langZhCn = langZhCn; + wordlist_1.Wordlist.register(langZhCn); + wordlist_1.Wordlist.register(langZhCn, "zh"); + var langZhTw = new LangZh("tw"); + exports2.langZhTw = langZhTw; + wordlist_1.Wordlist.register(langZhTw); + } +}); + +// node_modules/@ethersproject/wordlists/lib/wordlists.js +var require_wordlists = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/wordlists.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.wordlists = void 0; + var lang_cz_1 = require_lang_cz(); + var lang_en_1 = require_lang_en(); + var lang_es_1 = require_lang_es(); + var lang_fr_1 = require_lang_fr(); + var lang_ja_1 = require_lang_ja(); + var lang_ko_1 = require_lang_ko(); + var lang_it_1 = require_lang_it(); + var lang_zh_1 = require_lang_zh(); + exports2.wordlists = { + cz: lang_cz_1.langCz, + en: lang_en_1.langEn, + es: lang_es_1.langEs, + fr: lang_fr_1.langFr, + it: lang_it_1.langIt, + ja: lang_ja_1.langJa, + ko: lang_ko_1.langKo, + zh: lang_zh_1.langZhCn, + zh_cn: lang_zh_1.langZhCn, + zh_tw: lang_zh_1.langZhTw + }; + } +}); + +// node_modules/@ethersproject/wordlists/lib/index.js +var require_lib20 = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.wordlists = exports2.Wordlist = exports2.logger = void 0; + var wordlist_1 = require_wordlist(); + Object.defineProperty(exports2, "logger", { enumerable: true, get: function() { + return wordlist_1.logger; + } }); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return wordlist_1.Wordlist; + } }); + var wordlists_1 = require_wordlists(); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return wordlists_1.wordlists; + } }); + } +}); + +// node_modules/@ethersproject/hdnode/lib/_version.js +var require_version17 = __commonJS({ + "node_modules/@ethersproject/hdnode/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "hdnode/5.5.0"; + } +}); + +// node_modules/@ethersproject/hdnode/lib/index.js +var require_lib21 = __commonJS({ + "node_modules/@ethersproject/hdnode/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getAccountPath = exports2.isValidMnemonic = exports2.entropyToMnemonic = exports2.mnemonicToEntropy = exports2.mnemonicToSeed = exports2.HDNode = exports2.defaultPath = void 0; + var basex_1 = require_lib17(); + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var strings_1 = require_lib9(); + var pbkdf2_1 = require_lib18(); + var properties_1 = require_lib4(); + var signing_key_1 = require_lib14(); + var sha2_1 = require_lib19(); + var transactions_1 = require_lib15(); + var wordlists_1 = require_lib20(); + var logger_1 = require_lib(); + var _version_1 = require_version17(); + var logger = new logger_1.Logger(_version_1.version); + var N = bignumber_1.BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + var MasterSecret = (0, strings_1.toUtf8Bytes)("Bitcoin seed"); + var HardenedBit = 2147483648; + function getUpperMask(bits) { + return (1 << bits) - 1 << 8 - bits; + } + function getLowerMask(bits) { + return (1 << bits) - 1; + } + function bytes32(value) { + return (0, bytes_1.hexZeroPad)((0, bytes_1.hexlify)(value), 32); + } + function base58check(data) { + return basex_1.Base58.encode((0, bytes_1.concat)([data, (0, bytes_1.hexDataSlice)((0, sha2_1.sha256)((0, sha2_1.sha256)(data)), 0, 4)])); + } + function getWordlist(wordlist) { + if (wordlist == null) { + return wordlists_1.wordlists["en"]; + } + if (typeof wordlist === "string") { + var words = wordlists_1.wordlists[wordlist]; + if (words == null) { + logger.throwArgumentError("unknown locale", "wordlist", wordlist); + } + return words; + } + return wordlist; + } + var _constructorGuard = {}; + exports2.defaultPath = "m/44'/60'/0'/0/0"; + var HDNode = ( + /** @class */ + function() { + function HDNode2(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, HDNode2); + if (constructorGuard !== _constructorGuard) { + throw new Error("HDNode constructor cannot be called directly"); + } + if (privateKey) { + var signingKey = new signing_key_1.SigningKey(privateKey); + (0, properties_1.defineReadOnly)(this, "privateKey", signingKey.privateKey); + (0, properties_1.defineReadOnly)(this, "publicKey", signingKey.compressedPublicKey); + } else { + (0, properties_1.defineReadOnly)(this, "privateKey", null); + (0, properties_1.defineReadOnly)(this, "publicKey", (0, bytes_1.hexlify)(publicKey)); + } + (0, properties_1.defineReadOnly)(this, "parentFingerprint", parentFingerprint); + (0, properties_1.defineReadOnly)(this, "fingerprint", (0, bytes_1.hexDataSlice)((0, sha2_1.ripemd160)((0, sha2_1.sha256)(this.publicKey)), 0, 4)); + (0, properties_1.defineReadOnly)(this, "address", (0, transactions_1.computeAddress)(this.publicKey)); + (0, properties_1.defineReadOnly)(this, "chainCode", chainCode); + (0, properties_1.defineReadOnly)(this, "index", index); + (0, properties_1.defineReadOnly)(this, "depth", depth); + if (mnemonicOrPath == null) { + (0, properties_1.defineReadOnly)(this, "mnemonic", null); + (0, properties_1.defineReadOnly)(this, "path", null); + } else if (typeof mnemonicOrPath === "string") { + (0, properties_1.defineReadOnly)(this, "mnemonic", null); + (0, properties_1.defineReadOnly)(this, "path", mnemonicOrPath); + } else { + (0, properties_1.defineReadOnly)(this, "mnemonic", mnemonicOrPath); + (0, properties_1.defineReadOnly)(this, "path", mnemonicOrPath.path); + } + } + Object.defineProperty(HDNode2.prototype, "extendedKey", { + get: function() { + if (this.depth >= 256) { + throw new Error("Depth too large!"); + } + return base58check((0, bytes_1.concat)([ + this.privateKey != null ? "0x0488ADE4" : "0x0488B21E", + (0, bytes_1.hexlify)(this.depth), + this.parentFingerprint, + (0, bytes_1.hexZeroPad)((0, bytes_1.hexlify)(this.index), 4), + this.chainCode, + this.privateKey != null ? (0, bytes_1.concat)(["0x00", this.privateKey]) : this.publicKey + ])); + }, + enumerable: false, + configurable: true + }); + HDNode2.prototype.neuter = function() { + return new HDNode2(_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path); + }; + HDNode2.prototype._derive = function(index) { + if (index > 4294967295) { + throw new Error("invalid index - " + String(index)); + } + 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.set((0, bytes_1.arrayify)(this.privateKey), 1); + if (path) { + path += "'"; + } + } else { + data.set((0, bytes_1.arrayify)(this.publicKey)); + } + for (var i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = index >> 24 - i & 255; + } + var I = (0, bytes_1.arrayify)((0, sha2_1.computeHmac)(sha2_1.SupportedAlgorithm.sha512, this.chainCode, data)); + var IL = I.slice(0, 32); + var IR = I.slice(32); + var ki = null; + var Ki = null; + if (this.privateKey) { + ki = bytes32(bignumber_1.BigNumber.from(IL).add(this.privateKey).mod(N)); + } else { + var ek = new signing_key_1.SigningKey((0, bytes_1.hexlify)(IL)); + Ki = ek._addPoint(this.publicKey); + } + var mnemonicOrPath = path; + var srcMnemonic = this.mnemonic; + if (srcMnemonic) { + mnemonicOrPath = Object.freeze({ + phrase: srcMnemonic.phrase, + path, + locale: srcMnemonic.locale || "en" + }); + } + return new HDNode2(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath); + }; + HDNode2.prototype.derivePath = function(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 result2 = 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); + } + result2 = result2._derive(HardenedBit + index); + } else if (component.match(/^[0-9]+$/)) { + var index = parseInt(component); + if (index >= HardenedBit) { + throw new Error("invalid path index - " + component); + } + result2 = result2._derive(index); + } else { + throw new Error("invalid path component - " + component); + } + } + return result2; + }; + HDNode2._fromSeed = function(seed, mnemonic) { + var seedArray = (0, bytes_1.arrayify)(seed); + if (seedArray.length < 16 || seedArray.length > 64) { + throw new Error("invalid seed"); + } + var I = (0, bytes_1.arrayify)((0, sha2_1.computeHmac)(sha2_1.SupportedAlgorithm.sha512, MasterSecret, seedArray)); + return new HDNode2(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic); + }; + HDNode2.fromMnemonic = function(mnemonic, password, wordlist) { + wordlist = getWordlist(wordlist); + mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist); + return HDNode2._fromSeed(mnemonicToSeed(mnemonic, password), { + phrase: mnemonic, + path: "m", + locale: wordlist.locale + }); + }; + HDNode2.fromSeed = function(seed) { + return HDNode2._fromSeed(seed, null); + }; + HDNode2.fromExtendedKey = function(extendedKey) { + var bytes = basex_1.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 = (0, bytes_1.hexlify)(bytes.slice(5, 9)); + var index = parseInt((0, bytes_1.hexlify)(bytes.slice(9, 13)).substring(2), 16); + var chainCode = (0, bytes_1.hexlify)(bytes.slice(13, 45)); + var key = bytes.slice(45, 78); + switch ((0, bytes_1.hexlify)(bytes.slice(0, 4))) { + case "0x0488b21e": + case "0x043587cf": + return new HDNode2(_constructorGuard, null, (0, bytes_1.hexlify)(key), parentFingerprint, chainCode, index, depth, null); + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNode2(_constructorGuard, (0, bytes_1.hexlify)(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null); + } + return logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + }; + return HDNode2; + }() + ); + exports2.HDNode = HDNode; + function mnemonicToSeed(mnemonic, password) { + if (!password) { + password = ""; + } + var salt = (0, strings_1.toUtf8Bytes)("mnemonic" + password, strings_1.UnicodeNormalizationForm.NFKD); + return (0, pbkdf2_1.pbkdf2)((0, strings_1.toUtf8Bytes)(mnemonic, strings_1.UnicodeNormalizationForm.NFKD), salt, 2048, 64, "sha512"); + } + exports2.mnemonicToSeed = mnemonicToSeed; + 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 = (0, bytes_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 = (0, bytes_1.arrayify)((0, sha2_1.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { + throw new Error("invalid checksum"); + } + return (0, bytes_1.hexlify)(entropy.slice(0, entropyBits / 8)); + } + exports2.mnemonicToEntropy = mnemonicToEntropy; + function entropyToMnemonic(entropy, wordlist) { + wordlist = getWordlist(wordlist); + entropy = (0, bytes_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++) { + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + } else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> 8 - remainingBits; + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + var checksumBits = entropy.length / 4; + var checksum = (0, bytes_1.arrayify)((0, sha2_1.sha256)(entropy))[0] & getUpperMask(checksumBits); + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= checksum >> 8 - checksumBits; + return wordlist.join(indices.map(function(index) { + return wordlist.getWord(index); + })); + } + exports2.entropyToMnemonic = entropyToMnemonic; + function isValidMnemonic(mnemonic, wordlist) { + try { + mnemonicToEntropy(mnemonic, wordlist); + return true; + } catch (error) { + } + return false; + } + exports2.isValidMnemonic = isValidMnemonic; + function getAccountPath(index) { + if (typeof index !== "number" || index < 0 || index >= HardenedBit || index % 1) { + logger.throwArgumentError("invalid account index", "index", index); + } + return "m/44'/60'/" + index + "'/0/0"; + } + exports2.getAccountPath = getAccountPath; + } +}); + +// node_modules/@ethersproject/random/lib/random.js +var require_random = __commonJS({ + "node_modules/@ethersproject/random/lib/random.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.randomBytes = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + function randomBytes(length) { + return (0, bytes_1.arrayify)((0, crypto_1.randomBytes)(length)); + } + exports2.randomBytes = randomBytes; + } +}); + +// node_modules/@ethersproject/random/lib/shuffle.js +var require_shuffle = __commonJS({ + "node_modules/@ethersproject/random/lib/shuffle.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.shuffled = void 0; + 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; + } + exports2.shuffled = shuffled; + } +}); + +// node_modules/@ethersproject/random/lib/index.js +var require_lib22 = __commonJS({ + "node_modules/@ethersproject/random/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.shuffled = exports2.randomBytes = void 0; + var random_1 = require_random(); + Object.defineProperty(exports2, "randomBytes", { enumerable: true, get: function() { + return random_1.randomBytes; + } }); + var shuffle_1 = require_shuffle(); + Object.defineProperty(exports2, "shuffled", { enumerable: true, get: function() { + return shuffle_1.shuffled; + } }); + } +}); + +// node_modules/aes-js/index.js +var require_aes_js = __commonJS({ + "node_modules/aes-js/index.js"(exports2, module2) { + "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) { + 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; + } + if (Array.isArray(arg)) { + if (!checkInts(arg)) { + throw new Error("Array contains invalid value: " + arg); + } + return new Uint8Array(arg); + } + 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 = /* @__PURE__ */ function() { + function toBytes(text) { + var result2 = [], i = 0; + text = encodeURI(text); + while (i < text.length) { + var c = text.charCodeAt(i++); + if (c === 37) { + result2.push(parseInt(text.substr(i, 2), 16)); + i += 2; + } else { + result2.push(c); + } + } + return coerceArray(result2); + } + function fromBytes(bytes) { + var result2 = [], i = 0; + while (i < bytes.length) { + var c = bytes[i]; + if (c < 128) { + result2.push(String.fromCharCode(c)); + i++; + } else if (c > 191 && c < 224) { + result2.push(String.fromCharCode((c & 31) << 6 | bytes[i + 1] & 63)); + i += 2; + } else { + result2.push(String.fromCharCode((c & 15) << 12 | (bytes[i + 1] & 63) << 6 | bytes[i + 2] & 63)); + i += 3; + } + } + return result2.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var convertHex = /* @__PURE__ */ function() { + function toBytes(text) { + var result2 = []; + for (var i = 0; i < text.length; i += 2) { + result2.push(parseInt(text.substr(i, 2), 16)); + } + return result2; + } + var Hex = "0123456789abcdef"; + function fromBytes(bytes) { + var result2 = []; + for (var i = 0; i < bytes.length; i++) { + var v = bytes[i]; + result2.push(Hex[(v & 240) >> 4] + Hex[v & 15]); + } + return result2.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var numberOfRounds = { 16: 10, 24: 12, 32: 14 }; + var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145]; + var S = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22]; + var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125]; + var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986]; + var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766]; + var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126]; + var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436]; + var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890]; + var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935]; + var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600]; + var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480]; + var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795]; + var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855]; + var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150]; + var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925]; + function convertToInt32(bytes) { + var result2 = []; + for (var i = 0; i < bytes.length; i += 4) { + result2.push( + bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3] + ); + } + return result2; + } + var AES = function(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)"); + } + this._Ke = []; + 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; + var tk = convertToInt32(this.key); + 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]; + } + var rconpointer = 0; + var t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24; + rconpointer += 1; + if (KC != 8) { + for (var i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } else { + for (var i = 1; i < KC / 2; i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[KC / 2 - 1]; + tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24; + for (var i = KC / 2 + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + 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++; + } + } + 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 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255]; + } + } + }; + 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]; + var t = convertToInt32(plaintext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Ke[0][i]; + } + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T1[t[i] >> 24 & 255] ^ T2[t[(i + 1) % 4] >> 16 & 255] ^ T3[t[(i + 2) % 4] >> 8 & 255] ^ T4[t[(i + 3) % 4] & 255] ^ this._Ke[r][i]; + } + t = a.slice(); + } + var result2 = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Ke[rounds][i]; + result2[4 * i] = (S[t[i] >> 24 & 255] ^ tt >> 24) & 255; + result2[4 * i + 1] = (S[t[(i + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result2[4 * i + 2] = (S[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result2[4 * i + 3] = (S[t[(i + 3) % 4] & 255] ^ tt) & 255; + } + return result2; + }; + 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]; + var t = convertToInt32(ciphertext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Kd[0][i]; + } + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T5[t[i] >> 24 & 255] ^ T6[t[(i + 3) % 4] >> 16 & 255] ^ T7[t[(i + 2) % 4] >> 8 & 255] ^ T8[t[(i + 1) % 4] & 255] ^ this._Kd[r][i]; + } + t = a.slice(); + } + var result2 = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Kd[rounds][i]; + result2[4 * i] = (Si[t[i] >> 24 & 255] ^ tt >> 24) & 255; + result2[4 * i + 1] = (Si[t[(i + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result2[4 * i + 2] = (Si[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result2[4 * i + 3] = (Si[t[(i + 1) % 4] & 255] ^ tt) & 255; + } + return result2; + }; + var ModeOfOperationECB = function(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; + }; + var ModeOfOperationCBC = function(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; + }; + var ModeOfOperationCFB = function(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]; + } + 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]; + } + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } + return plaintext; + }; + var ModeOfOperationOFB = function(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; + }; + ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; + var Counter = function(initialValue) { + if (!(this instanceof Counter)) { + throw Error("Counter must be instanitated with `new`"); + } + 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; + } + } + }; + var ModeOfOperationCTR = function(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; + }; + ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; + function pkcs7pad(data) { + data = coerceArray(data, true); + var padder = 16 - data.length % 16; + var result2 = createArray(data.length + padder); + copyArray(data, result2); + for (var i = data.length; i < result2.length; i++) { + result2[i] = padder; + } + return result2; + } + 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 result2 = createArray(length); + copyArray(data, result2, 0, 0, length); + return result2; + } + var aesjs = { + AES, + 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, + createArray, + copyArray + } + }; + if (typeof exports2 !== "undefined") { + module2.exports = aesjs; + } else if (typeof define === "function" && define.amd) { + define(aesjs); + } else { + if (root.aesjs) { + aesjs._aesjs = root.aesjs; + } + root.aesjs = aesjs; + } + })(exports2); + } +}); + +// node_modules/@ethersproject/json-wallets/lib/_version.js +var require_version18 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "json-wallets/5.5.0"; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/utils.js +var require_utils4 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/utils.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.uuidV4 = exports2.searchPath = exports2.getPassword = exports2.zpad = exports2.looseArrayify = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + function looseArrayify(hexString) { + if (typeof hexString === "string" && hexString.substring(0, 2) !== "0x") { + hexString = "0x" + hexString; + } + return (0, bytes_1.arrayify)(hexString); + } + exports2.looseArrayify = looseArrayify; + function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = "0" + value; + } + return value; + } + exports2.zpad = zpad; + function getPassword(password) { + if (typeof password === "string") { + return (0, strings_1.toUtf8Bytes)(password, strings_1.UnicodeNormalizationForm.NFKC); + } + return (0, bytes_1.arrayify)(password); + } + exports2.getPassword = getPassword; + function searchPath(object, path) { + var currentChild = object; + var comps = path.toLowerCase().split("/"); + for (var i = 0; i < comps.length; i++) { + var matchingChild = null; + for (var key in currentChild) { + if (key.toLowerCase() === comps[i]) { + matchingChild = currentChild[key]; + break; + } + } + if (matchingChild === null) { + return null; + } + currentChild = matchingChild; + } + return currentChild; + } + exports2.searchPath = searchPath; + function uuidV4(randomBytes) { + var bytes = (0, bytes_1.arrayify)(randomBytes); + bytes[6] = bytes[6] & 15 | 64; + bytes[8] = bytes[8] & 63 | 128; + var value = (0, bytes_1.hexlify)(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34) + ].join("-"); + } + exports2.uuidV4 = uuidV4; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/crowdsale.js +var require_crowdsale = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/crowdsale.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decrypt = exports2.CrowdsaleAccount = void 0; + var aes_js_1 = __importDefault(require_aes_js()); + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var pbkdf2_1 = require_lib18(); + var strings_1 = require_lib9(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version18(); + var logger = new logger_1.Logger(_version_1.version); + var utils_1 = require_utils4(); + var CrowdsaleAccount = ( + /** @class */ + function(_super) { + __extends(CrowdsaleAccount2, _super); + function CrowdsaleAccount2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CrowdsaleAccount2.prototype.isCrowdsaleAccount = function(value) { + return !!(value && value._isCrowdsaleAccount); + }; + return CrowdsaleAccount2; + }(properties_1.Description) + ); + exports2.CrowdsaleAccount = CrowdsaleAccount; + function decrypt(json, password) { + var data = JSON.parse(json); + password = (0, utils_1.getPassword)(password); + var ethaddr = (0, address_1.getAddress)((0, utils_1.searchPath)(data, "ethaddr")); + var encseed = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "encseed")); + if (!encseed || encseed.length % 16 !== 0) { + logger.throwArgumentError("invalid encseed", "json", json); + } + var key = (0, bytes_1.arrayify)((0, pbkdf2_1.pbkdf2)(password, password, 2e3, 32, "sha256")).slice(0, 16); + var iv = encseed.slice(0, 16); + var encryptedSeed = encseed.slice(16); + var aesCbc = new aes_js_1.default.ModeOfOperation.cbc(key, iv); + var seed = aes_js_1.default.padding.pkcs7.strip((0, bytes_1.arrayify)(aesCbc.decrypt(encryptedSeed))); + var seedHex = ""; + for (var i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + var seedHexBytes = (0, strings_1.toUtf8Bytes)(seedHex); + var privateKey = (0, keccak256_1.keccak256)(seedHexBytes); + return new CrowdsaleAccount({ + _isCrowdsaleAccount: true, + address: ethaddr, + privateKey + }); + } + exports2.decrypt = decrypt; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/inspect.js +var require_inspect = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/inspect.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getJsonWalletAddress = exports2.isKeystoreWallet = exports2.isCrowdsaleWallet = void 0; + var address_1 = require_lib7(); + function isCrowdsaleWallet(json) { + var data = null; + try { + data = JSON.parse(json); + } catch (error) { + return false; + } + return data.encseed && data.ethaddr; + } + exports2.isCrowdsaleWallet = isCrowdsaleWallet; + 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; + } + return true; + } + exports2.isKeystoreWallet = isKeystoreWallet; + function getJsonWalletAddress(json) { + if (isCrowdsaleWallet(json)) { + try { + return (0, address_1.getAddress)(JSON.parse(json).ethaddr); + } catch (error) { + return null; + } + } + if (isKeystoreWallet(json)) { + try { + return (0, address_1.getAddress)(JSON.parse(json).address); + } catch (error) { + return null; + } + } + return null; + } + exports2.getJsonWalletAddress = getJsonWalletAddress; + } +}); + +// node_modules/scrypt-js/scrypt.js +var require_scrypt = __commonJS({ + "node_modules/scrypt-js/scrypt.js"(exports2, module2) { + "use strict"; + (function(root) { + const MAX_VALUE = 2147483647; + function SHA256(m) { + const K = new Uint32Array([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]); + let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762; + let h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225; + const w = new Uint32Array(64); + function blocks(p2) { + let off = 0, len = p2.length; + while (len >= 64) { + let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i2, j, t1, t2; + for (i2 = 0; i2 < 16; i2++) { + j = off + i2 * 4; + w[i2] = (p2[j] & 255) << 24 | (p2[j + 1] & 255) << 16 | (p2[j + 2] & 255) << 8 | p2[j + 3] & 255; + } + for (i2 = 16; i2 < 64; i2++) { + u = w[i2 - 2]; + t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10; + u = w[i2 - 15]; + t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3; + w[i2] = (t1 + w[i2 - 7] | 0) + (t2 + w[i2 - 16] | 0) | 0; + } + for (i2 = 0; i2 < 64; i2++) { + t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i2] + w[i2] | 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); + let i, bytesLeft = m.length % 64, bitLenHi = m.length / 536870912 | 0, bitLenLo = m.length << 3, numZeros = bytesLeft < 56 ? 56 : 120, p = m.slice(m.length - bytesLeft, m.length); + p.push(128); + for (i = bytesLeft + 1; i < numZeros; i++) { + p.push(0); + } + p.push(bitLenHi >>> 24 & 255); + p.push(bitLenHi >>> 16 & 255); + p.push(bitLenHi >>> 8 & 255); + p.push(bitLenHi >>> 0 & 255); + p.push(bitLenLo >>> 24 & 255); + p.push(bitLenLo >>> 16 & 255); + p.push(bitLenLo >>> 8 & 255); + p.push(bitLenLo >>> 0 & 255); + blocks(p); + return [ + h0 >>> 24 & 255, + h0 >>> 16 & 255, + h0 >>> 8 & 255, + h0 >>> 0 & 255, + h1 >>> 24 & 255, + h1 >>> 16 & 255, + h1 >>> 8 & 255, + h1 >>> 0 & 255, + h2 >>> 24 & 255, + h2 >>> 16 & 255, + h2 >>> 8 & 255, + h2 >>> 0 & 255, + h3 >>> 24 & 255, + h3 >>> 16 & 255, + h3 >>> 8 & 255, + h3 >>> 0 & 255, + h4 >>> 24 & 255, + h4 >>> 16 & 255, + h4 >>> 8 & 255, + h4 >>> 0 & 255, + h5 >>> 24 & 255, + h5 >>> 16 & 255, + h5 >>> 8 & 255, + h5 >>> 0 & 255, + h6 >>> 24 & 255, + h6 >>> 16 & 255, + h6 >>> 8 & 255, + h6 >>> 0 & 255, + h7 >>> 24 & 255, + h7 >>> 16 & 255, + h7 >>> 8 & 255, + h7 >>> 0 & 255 + ]; + } + function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) { + password = password.length <= 64 ? password : SHA256(password); + const innerLen = 64 + salt.length + 4; + const inner = new Array(innerLen); + const outerKey = new Array(64); + let i; + let dk = []; + for (i = 0; i < 64; i++) { + inner[i] = 54; + } + 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; + } + for (i = 0; i < 64; i++) outerKey[i] = 92; + for (i = 0; i < password.length; i++) outerKey[i] ^= password[i]; + function incrementCounter() { + for (let i2 = innerLen - 1; i2 >= innerLen - 4; i2--) { + inner[i2]++; + if (inner[i2] <= 255) return; + inner[i2] = 0; + } + } + 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; + } + function blockmix_salsa8(BY, Yi, r, x, _X) { + let 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 (let 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 (let i = 0; i < 16; ++i) { + B[i] += x[i]; + } + } + function blockxor(S, Si, D, len) { + for (let 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 (let i = 0; i < o.length; i++) { + const v = o[i]; + if (typeof v !== "number" || v % 1 || v < 0 || v >= 256) { + return false; + } + } + return true; + } + function ensureInteger(value, name2) { + if (typeof value !== "number" || value % 1) { + throw new Error("invalid " + name2); + } + return value; + } + 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); + let b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r); + const B = new Uint32Array(p * 32 * r); + for (let i = 0; i < B.length; i++) { + const j = i * 4; + B[i] = (b[j + 3] & 255) << 24 | (b[j + 2] & 255) << 16 | (b[j + 1] & 255) << 8 | (b[j + 0] & 255) << 0; + } + const XY = new Uint32Array(64 * r); + const V = new Uint32Array(32 * r * N); + const Yi = 32 * r; + const x = new Uint32Array(16); + const _X = new Uint32Array(16); + const totalOps = p * N * 2; + let currentOp = 0; + let lastPercent10 = null; + let stop = false; + let state = 0; + let i0 = 0, i1; + let Bi; + const limit = callback ? parseInt(1e3 / r) : 4294967295; + const nextTick = typeof setImmediate !== "undefined" ? setImmediate : setTimeout; + const incrementalSMix = function() { + if (stop) { + return callback(new Error("cancelled"), currentOp / totalOps); + } + let steps; + switch (state) { + case 0: + Bi = i0 * 32 * r; + arraycopy(B, Bi, XY, 0, Yi); + state = 1; + i1 = 0; + case 1: + steps = N - i1; + if (steps > limit) { + steps = limit; + } + for (let i = 0; i < steps; i++) { + arraycopy(XY, 0, V, (i1 + i) * Yi, Yi); + blockmix_salsa8(XY, Yi, r, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N) { + break; + } + i1 = 0; + state = 2; + case 2: + steps = N - i1; + if (steps > limit) { + steps = limit; + } + for (let i = 0; i < steps; i++) { + const offset = (2 * r - 1) * 16; + const j = XY[offset] & N - 1; + blockxor(V, j * Yi, XY, Yi); + blockmix_salsa8(XY, Yi, r, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N) { + break; + } + arraycopy(XY, 0, B, Bi, Yi); + i0++; + if (i0 < p) { + state = 0; + break; + } + b = []; + for (let i = 0; i < B.length; i++) { + b.push(B[i] >> 0 & 255); + b.push(B[i] >> 8 & 255); + b.push(B[i] >> 16 & 255); + b.push(B[i] >> 24 & 255); + } + const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen); + if (callback) { + callback(null, 1, derivedKey); + } + return derivedKey; + } + if (callback) { + nextTick(incrementalSMix); + } + }; + if (!callback) { + while (true) { + const derivedKey = incrementalSMix(); + if (derivedKey != void 0) { + return derivedKey; + } + } + } + incrementalSMix(); + } + const lib = { + scrypt: function(password, salt, N, r, p, dkLen, progressCallback) { + return new Promise(function(resolve, reject) { + let 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(password, salt, N, r, p, dkLen) { + return new Uint8Array(_scrypt(password, salt, N, r, p, dkLen)); + } + }; + if (typeof exports2 !== "undefined") { + module2.exports = lib; + } else if (typeof define === "function" && define.amd) { + define(lib); + } else if (root) { + if (root.scrypt) { + root._scrypt = root.scrypt; + } + root.scrypt = lib; + } + })(exports2); + } +}); + +// node_modules/@ethersproject/json-wallets/lib/keystore.js +var require_keystore = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/keystore.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encrypt = exports2.decrypt = exports2.decryptSync = exports2.KeystoreAccount = void 0; + var aes_js_1 = __importDefault(require_aes_js()); + var scrypt_js_1 = __importDefault(require_scrypt()); + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var hdnode_1 = require_lib21(); + var keccak256_1 = require_lib5(); + var pbkdf2_1 = require_lib18(); + var random_1 = require_lib22(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var utils_1 = require_utils4(); + var logger_1 = require_lib(); + var _version_1 = require_version18(); + var logger = new logger_1.Logger(_version_1.version); + function hasMnemonic(value) { + return value != null && value.mnemonic && value.mnemonic.phrase; + } + var KeystoreAccount = ( + /** @class */ + function(_super) { + __extends(KeystoreAccount2, _super); + function KeystoreAccount2() { + return _super !== null && _super.apply(this, arguments) || this; + } + KeystoreAccount2.prototype.isKeystoreAccount = function(value) { + return !!(value && value._isKeystoreAccount); + }; + return KeystoreAccount2; + }(properties_1.Description) + ); + exports2.KeystoreAccount = KeystoreAccount; + function _decrypt(data, key, ciphertext) { + var cipher = (0, utils_1.searchPath)(data, "crypto/cipher"); + if (cipher === "aes-128-ctr") { + var iv = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/cipherparams/iv")); + var counter = new aes_js_1.default.Counter(iv); + var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(key, counter); + return (0, bytes_1.arrayify)(aesCtr.decrypt(ciphertext)); + } + return null; + } + function _getAccount(data, key) { + var ciphertext = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/ciphertext")); + var computedMAC = (0, bytes_1.hexlify)((0, keccak256_1.keccak256)((0, bytes_1.concat)([key.slice(16, 32), ciphertext]))).substring(2); + if (computedMAC !== (0, utils_1.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", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "decrypt" + }); + } + var mnemonicKey = key.slice(32, 64); + var address = (0, transactions_1.computeAddress)(privateKey); + if (data.address) { + var check = data.address.toLowerCase(); + if (check.substring(0, 2) !== "0x") { + check = "0x" + check; + } + if ((0, address_1.getAddress)(check) !== address) { + throw new Error("address mismatch"); + } + } + var account = { + _isKeystoreAccount: true, + address, + privateKey: (0, bytes_1.hexlify)(privateKey) + }; + if ((0, utils_1.searchPath)(data, "x-ethers/version") === "0.1") { + var mnemonicCiphertext = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "x-ethers/mnemonicCiphertext")); + var mnemonicIv = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "x-ethers/mnemonicCounter")); + var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var path = (0, utils_1.searchPath)(data, "x-ethers/path") || hdnode_1.defaultPath; + var locale = (0, utils_1.searchPath)(data, "x-ethers/locale") || "en"; + var entropy = (0, bytes_1.arrayify)(mnemonicAesCtr.decrypt(mnemonicCiphertext)); + try { + var mnemonic = (0, hdnode_1.entropyToMnemonic)(entropy, locale); + var node = hdnode_1.HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + account.mnemonic = node.mnemonic; + } catch (error) { + if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { + throw error; + } + } + } + return new KeystoreAccount(account); + } + function pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) { + return (0, bytes_1.arrayify)((0, pbkdf2_1.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 = (0, utils_1.getPassword)(password); + var kdf = (0, utils_1.searchPath)(data, "crypto/kdf"); + if (kdf && typeof kdf === "string") { + var throwError = function(name2, value) { + return logger.throwArgumentError("invalid key-derivation function parameters", name2, value); + }; + if (kdf.toLowerCase() === "scrypt") { + var salt = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/kdfparams/salt")); + var N = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/n")); + var r = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/r")); + var p = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/p")); + if (!N || !r || !p) { + throwError("kdf", kdf); + } + if ((N & N - 1) !== 0) { + throwError("N", N); + } + var dkLen = parseInt((0, utils_1.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 = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/kdfparams/salt")); + var prfFunc = null; + var prf = (0, utils_1.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((0, utils_1.searchPath)(data, "crypto/kdfparams/c")); + var dkLen = parseInt((0, utils_1.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_1.default.syncScrypt); + return _getAccount(data, key); + } + exports2.decryptSync = decryptSync; + function decrypt(json, password, progressCallback) { + return __awaiter(this, void 0, void 0, function() { + var data, key; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = JSON.parse(json); + return [4, _computeKdfKey(data, password, pbkdf2, scrypt_js_1.default.scrypt, progressCallback)]; + case 1: + key = _a.sent(); + return [2, _getAccount(data, key)]; + } + }); + }); + } + exports2.decrypt = decrypt; + function encrypt(account, password, options, progressCallback) { + try { + if ((0, address_1.getAddress)(account.address) !== (0, transactions_1.computeAddress)(account.privateKey)) { + throw new Error("address/privateKey mismatch"); + } + if (hasMnemonic(account)) { + var mnemonic = account.mnemonic; + var node = hdnode_1.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || hdnode_1.defaultPath); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + } + } catch (e) { + return Promise.reject(e); + } + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (!options) { + options = {}; + } + var privateKey = (0, bytes_1.arrayify)(account.privateKey); + var passwordBytes = (0, utils_1.getPassword)(password); + var entropy = null; + var path = null; + var locale = null; + if (hasMnemonic(account)) { + var srcMnemonic = account.mnemonic; + entropy = (0, bytes_1.arrayify)((0, hdnode_1.mnemonicToEntropy)(srcMnemonic.phrase, srcMnemonic.locale || "en")); + path = srcMnemonic.path || hdnode_1.defaultPath; + locale = srcMnemonic.locale || "en"; + } + var client = options.client; + if (!client) { + client = "ethers.js"; + } + var salt = null; + if (options.salt) { + salt = (0, bytes_1.arrayify)(options.salt); + } else { + salt = (0, random_1.randomBytes)(32); + ; + } + var iv = null; + if (options.iv) { + iv = (0, bytes_1.arrayify)(options.iv); + if (iv.length !== 16) { + throw new Error("invalid iv"); + } + } else { + iv = (0, random_1.randomBytes)(16); + } + var uuidRandom = null; + if (options.uuid) { + uuidRandom = (0, bytes_1.arrayify)(options.uuid); + if (uuidRandom.length !== 16) { + throw new Error("invalid uuid"); + } + } else { + uuidRandom = (0, random_1.randomBytes)(16); + } + 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; + } + } + return scrypt_js_1.default.scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then(function(key) { + key = (0, bytes_1.arrayify)(key); + var derivedKey = key.slice(0, 16); + var macPrefix = key.slice(16, 32); + var mnemonicKey = key.slice(32, 64); + var counter = new aes_js_1.default.Counter(iv); + var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(derivedKey, counter); + var ciphertext = (0, bytes_1.arrayify)(aesCtr.encrypt(privateKey)); + var mac = (0, keccak256_1.keccak256)((0, bytes_1.concat)([macPrefix, ciphertext])); + var data = { + address: account.address.substring(2).toLowerCase(), + id: (0, utils_1.uuidV4)(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: (0, bytes_1.hexlify)(iv).substring(2) + }, + ciphertext: (0, bytes_1.hexlify)(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: (0, bytes_1.hexlify)(salt).substring(2), + n: N, + dklen: 32, + p, + r + }, + mac: mac.substring(2) + } + }; + if (entropy) { + var mnemonicIv = (0, random_1.randomBytes)(16); + var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var mnemonicCiphertext = (0, bytes_1.arrayify)(mnemonicAesCtr.encrypt(entropy)); + var now = /* @__PURE__ */ new Date(); + var timestamp = now.getUTCFullYear() + "-" + (0, utils_1.zpad)(now.getUTCMonth() + 1, 2) + "-" + (0, utils_1.zpad)(now.getUTCDate(), 2) + "T" + (0, utils_1.zpad)(now.getUTCHours(), 2) + "-" + (0, utils_1.zpad)(now.getUTCMinutes(), 2) + "-" + (0, utils_1.zpad)(now.getUTCSeconds(), 2) + ".0Z"; + data["x-ethers"] = { + client, + gethFilename: "UTC--" + timestamp + "--" + data.address, + mnemonicCounter: (0, bytes_1.hexlify)(mnemonicIv).substring(2), + mnemonicCiphertext: (0, bytes_1.hexlify)(mnemonicCiphertext).substring(2), + path, + locale, + version: "0.1" + }; + } + return JSON.stringify(data); + }); + } + exports2.encrypt = encrypt; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/index.js +var require_lib23 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decryptJsonWalletSync = exports2.decryptJsonWallet = exports2.getJsonWalletAddress = exports2.isKeystoreWallet = exports2.isCrowdsaleWallet = exports2.encryptKeystore = exports2.decryptKeystoreSync = exports2.decryptKeystore = exports2.decryptCrowdsale = void 0; + var crowdsale_1 = require_crowdsale(); + Object.defineProperty(exports2, "decryptCrowdsale", { enumerable: true, get: function() { + return crowdsale_1.decrypt; + } }); + var inspect_1 = require_inspect(); + Object.defineProperty(exports2, "getJsonWalletAddress", { enumerable: true, get: function() { + return inspect_1.getJsonWalletAddress; + } }); + Object.defineProperty(exports2, "isCrowdsaleWallet", { enumerable: true, get: function() { + return inspect_1.isCrowdsaleWallet; + } }); + Object.defineProperty(exports2, "isKeystoreWallet", { enumerable: true, get: function() { + return inspect_1.isKeystoreWallet; + } }); + var keystore_1 = require_keystore(); + Object.defineProperty(exports2, "decryptKeystore", { enumerable: true, get: function() { + return keystore_1.decrypt; + } }); + Object.defineProperty(exports2, "decryptKeystoreSync", { enumerable: true, get: function() { + return keystore_1.decryptSync; + } }); + Object.defineProperty(exports2, "encryptKeystore", { enumerable: true, get: function() { + return keystore_1.encrypt; + } }); + function decryptJsonWallet(json, password, progressCallback) { + if ((0, inspect_1.isCrowdsaleWallet)(json)) { + if (progressCallback) { + progressCallback(0); + } + var account = (0, crowdsale_1.decrypt)(json, password); + if (progressCallback) { + progressCallback(1); + } + return Promise.resolve(account); + } + if ((0, inspect_1.isKeystoreWallet)(json)) { + return (0, keystore_1.decrypt)(json, password, progressCallback); + } + return Promise.reject(new Error("invalid JSON wallet")); + } + exports2.decryptJsonWallet = decryptJsonWallet; + function decryptJsonWalletSync(json, password) { + if ((0, inspect_1.isCrowdsaleWallet)(json)) { + return (0, crowdsale_1.decrypt)(json, password); + } + if ((0, inspect_1.isKeystoreWallet)(json)) { + return (0, keystore_1.decryptSync)(json, password); + } + throw new Error("invalid JSON wallet"); + } + exports2.decryptJsonWalletSync = decryptJsonWalletSync; + } +}); + +// node_modules/@ethersproject/wallet/lib/_version.js +var require_version19 = __commonJS({ + "node_modules/@ethersproject/wallet/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "wallet/5.5.0"; + } +}); + +// node_modules/@ethersproject/wallet/lib/index.js +var require_lib24 = __commonJS({ + "node_modules/@ethersproject/wallet/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.verifyTypedData = exports2.verifyMessage = exports2.Wallet = void 0; + var address_1 = require_lib7(); + var abstract_provider_1 = require_lib12(); + var abstract_signer_1 = require_lib13(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var hdnode_1 = require_lib21(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var random_1 = require_lib22(); + var signing_key_1 = require_lib14(); + var json_wallets_1 = require_lib23(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version19(); + var logger = new logger_1.Logger(_version_1.version); + function isAccount(value) { + return value != null && (0, bytes_1.isHexString)(value.privateKey, 32) && value.address != null; + } + function hasMnemonic(value) { + var mnemonic = value.mnemonic; + return mnemonic && mnemonic.phrase; + } + var Wallet = ( + /** @class */ + function(_super) { + __extends(Wallet2, _super); + function Wallet2(privateKey, provider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Wallet2); + _this = _super.call(this) || this; + if (isAccount(privateKey)) { + var signingKey_1 = new signing_key_1.SigningKey(privateKey.privateKey); + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return signingKey_1; + }); + (0, properties_1.defineReadOnly)(_this, "address", (0, transactions_1.computeAddress)(_this.publicKey)); + if (_this.address !== (0, address_1.getAddress)(privateKey.address)) { + logger.throwArgumentError("privateKey/address mismatch", "privateKey", "[REDACTED]"); + } + if (hasMnemonic(privateKey)) { + var srcMnemonic_1 = privateKey.mnemonic; + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return { + phrase: srcMnemonic_1.phrase, + path: srcMnemonic_1.path || hdnode_1.defaultPath, + locale: srcMnemonic_1.locale || "en" + }; + }); + var mnemonic = _this.mnemonic; + var node = hdnode_1.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path); + if ((0, transactions_1.computeAddress)(node.privateKey) !== _this.address) { + logger.throwArgumentError("mnemonic/address mismatch", "privateKey", "[REDACTED]"); + } + } else { + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return null; + }); + } + } else { + if (signing_key_1.SigningKey.isSigningKey(privateKey)) { + if (privateKey.curve !== "secp256k1") { + logger.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]"); + } + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return privateKey; + }); + } else { + if (typeof privateKey === "string") { + if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { + privateKey = "0x" + privateKey; + } + } + var signingKey_2 = new signing_key_1.SigningKey(privateKey); + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return signingKey_2; + }); + } + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return null; + }); + (0, properties_1.defineReadOnly)(_this, "address", (0, transactions_1.computeAddress)(_this.publicKey)); + } + if (provider && !abstract_provider_1.Provider.isProvider(provider)) { + logger.throwArgumentError("invalid provider", "provider", provider); + } + (0, properties_1.defineReadOnly)(_this, "provider", provider || null); + return _this; + } + Object.defineProperty(Wallet2.prototype, "mnemonic", { + get: function() { + return this._mnemonic(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Wallet2.prototype, "privateKey", { + get: function() { + return this._signingKey().privateKey; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Wallet2.prototype, "publicKey", { + get: function() { + return this._signingKey().publicKey; + }, + enumerable: false, + configurable: true + }); + Wallet2.prototype.getAddress = function() { + return Promise.resolve(this.address); + }; + Wallet2.prototype.connect = function(provider) { + return new Wallet2(this, provider); + }; + Wallet2.prototype.signTransaction = function(transaction) { + var _this = this; + return (0, properties_1.resolveProperties)(transaction).then(function(tx) { + if (tx.from != null) { + if ((0, address_1.getAddress)(tx.from) !== _this.address) { + logger.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from); + } + delete tx.from; + } + var signature = _this._signingKey().signDigest((0, keccak256_1.keccak256)((0, transactions_1.serialize)(tx))); + return (0, transactions_1.serialize)(tx, signature); + }); + }; + Wallet2.prototype.signMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, (0, bytes_1.joinSignature)(this._signingKey().signDigest((0, hash_1.hashMessage)(message)))]; + }); + }); + }; + Wallet2.prototype._signTypedData = function(domain, types, value) { + return __awaiter(this, void 0, void 0, function() { + var populated; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, hash_1._TypedDataEncoder.resolveNames(domain, types, value, function(name2) { + if (_this.provider == null) { + logger.throwError("cannot resolve ENS names without a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName", + value: name2 + }); + } + return _this.provider.resolveName(name2); + })]; + case 1: + populated = _a.sent(); + return [2, (0, bytes_1.joinSignature)(this._signingKey().signDigest(hash_1._TypedDataEncoder.hash(populated.domain, types, populated.value)))]; + } + }); + }); + }; + Wallet2.prototype.encrypt = function(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 (0, json_wallets_1.encryptKeystore)(this, password, options, progressCallback); + }; + Wallet2.createRandom = function(options) { + var entropy = (0, random_1.randomBytes)(16); + if (!options) { + options = {}; + } + if (options.extraEntropy) { + entropy = (0, bytes_1.arrayify)((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.concat)([entropy, options.extraEntropy])), 0, 16)); + } + var mnemonic = (0, hdnode_1.entropyToMnemonic)(entropy, options.locale); + return Wallet2.fromMnemonic(mnemonic, options.path, options.locale); + }; + Wallet2.fromEncryptedJson = function(json, password, progressCallback) { + return (0, json_wallets_1.decryptJsonWallet)(json, password, progressCallback).then(function(account) { + return new Wallet2(account); + }); + }; + Wallet2.fromEncryptedJsonSync = function(json, password) { + return new Wallet2((0, json_wallets_1.decryptJsonWalletSync)(json, password)); + }; + Wallet2.fromMnemonic = function(mnemonic, path, wordlist) { + if (!path) { + path = hdnode_1.defaultPath; + } + return new Wallet2(hdnode_1.HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(path)); + }; + return Wallet2; + }(abstract_signer_1.Signer) + ); + exports2.Wallet = Wallet; + function verifyMessage(message, signature) { + return (0, transactions_1.recoverAddress)((0, hash_1.hashMessage)(message), signature); + } + exports2.verifyMessage = verifyMessage; + function verifyTypedData(domain, types, value, signature) { + return (0, transactions_1.recoverAddress)(hash_1._TypedDataEncoder.hash(domain, types, value), signature); + } + exports2.verifyTypedData = verifyTypedData; + } +}); + +// node_modules/@ethersproject/networks/lib/_version.js +var require_version20 = __commonJS({ + "node_modules/@ethersproject/networks/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "networks/5.5.1"; + } +}); + +// node_modules/@ethersproject/networks/lib/index.js +var require_lib25 = __commonJS({ + "node_modules/@ethersproject/networks/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getNetwork = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version20(); + var logger = new logger_1.Logger(_version_1.version); + function isRenetworkable(value) { + return value && typeof value.renetwork === "function"; + } + function ethDefaultProvider(network) { + var func = function(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) { + 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(network2) { + return ethDefaultProvider(network2); + }; + return func; + } + function etcDefaultProvider(url, network) { + var func = function(providers, options) { + if (providers.JsonRpcProvider) { + return new providers.JsonRpcProvider(url, network); + } + return null; + }; + func.renetwork = function(network2) { + return etcDefaultProvider(url, network2); + }; + 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") + }; + var networks = { + unspecified: { chainId: 0, name: "unspecified" }, + homestead, + mainnet: homestead, + morden: { chainId: 2, name: "morden" }, + 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") + }, + // ETC (See: #351) + classic: { + chainId: 61, + name: "classic", + _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/etc", "classic") + }, + classicMorden: { chainId: 62, name: "classicMorden" }, + 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" } + }; + function getNetwork(network) { + if (network == null) { + return null; + } + if (typeof network === "number") { + for (var name_1 in networks) { + var standard_1 = networks[name_1]; + if (standard_1.chainId === network) { + return { + name: standard_1.name, + chainId: standard_1.chainId, + ensAddress: standard_1.ensAddress || null, + _defaultProvider: standard_1._defaultProvider || null + }; + } + } + return { + chainId: network, + name: "unknown" + }; + } + if (typeof network === "string") { + var standard_2 = networks[network]; + if (standard_2 == null) { + return null; + } + return { + name: standard_2.name, + chainId: standard_2.chainId, + ensAddress: standard_2.ensAddress, + _defaultProvider: standard_2._defaultProvider || null + }; + } + var standard = networks[network.name]; + if (!standard) { + if (typeof network.chainId !== "number") { + logger.throwArgumentError("invalid network chainId", "network", network); + } + return network; + } + if (network.chainId !== 0 && network.chainId !== standard.chainId) { + logger.throwArgumentError("network chainId mismatch", "network", network); + } + var defaultProvider = network._defaultProvider || null; + if (defaultProvider == null && standard._defaultProvider) { + if (isRenetworkable(standard._defaultProvider)) { + defaultProvider = standard._defaultProvider.renetwork(network); + } else { + defaultProvider = standard._defaultProvider; + } + } + return { + name: network.name, + chainId: standard.chainId, + ensAddress: network.ensAddress || standard.ensAddress || null, + _defaultProvider: defaultProvider + }; + } + exports2.getNetwork = getNetwork; + } +}); + +// node_modules/@ethersproject/base64/lib/base64.js +var require_base64 = __commonJS({ + "node_modules/@ethersproject/base64/lib/base64.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encode = exports2.decode = void 0; + var bytes_1 = require_lib2(); + function decode(textData) { + return (0, bytes_1.arrayify)(new Uint8Array(Buffer.from(textData, "base64"))); + } + exports2.decode = decode; + function encode(data) { + return Buffer.from((0, bytes_1.arrayify)(data)).toString("base64"); + } + exports2.encode = encode; + } +}); + +// node_modules/@ethersproject/base64/lib/index.js +var require_lib26 = __commonJS({ + "node_modules/@ethersproject/base64/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encode = exports2.decode = void 0; + var base64_1 = require_base64(); + Object.defineProperty(exports2, "decode", { enumerable: true, get: function() { + return base64_1.decode; + } }); + Object.defineProperty(exports2, "encode", { enumerable: true, get: function() { + return base64_1.encode; + } }); + } +}); + +// node_modules/@ethersproject/web/lib/_version.js +var require_version21 = __commonJS({ + "node_modules/@ethersproject/web/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "web/5.5.1"; + } +}); + +// node_modules/@ethersproject/web/lib/geturl.js +var require_geturl = __commonJS({ + "node_modules/@ethersproject/web/lib/geturl.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getUrl = void 0; + var http_1 = __importDefault(require("http")); + var https_1 = __importDefault(require("https")); + var zlib_1 = require("zlib"); + var url_1 = require("url"); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version21(); + var logger = new logger_1.Logger(_version_1.version); + function getResponse(request) { + return new Promise(function(resolve, reject) { + request.once("response", function(resp) { + var response = { + statusCode: resp.statusCode, + statusMessage: resp.statusMessage, + headers: Object.keys(resp.headers).reduce(function(accum, name2) { + var value = resp.headers[name2]; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name2] = value; + return accum; + }, {}), + body: null + }; + resp.on("data", function(chunk) { + if (response.body == null) { + response.body = new Uint8Array(0); + } + response.body = (0, bytes_1.concat)([response.body, chunk]); + }); + resp.on("end", function() { + if (response.headers["content-encoding"] === "gzip") { + response.body = (0, bytes_1.arrayify)((0, zlib_1.gunzipSync)(response.body)); + } + resolve(response); + }); + resp.on("error", function(error) { + error.response = response; + reject(error); + }); + }); + request.on("error", function(error) { + reject(error); + }); + }); + } + function nonnull(value) { + if (value == null) { + return ""; + } + return value; + } + function getUrl(href, options) { + return __awaiter(this, void 0, void 0, function() { + var url, request, req, response; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (options == null) { + options = {}; + } + url = (0, url_1.parse)(href); + request = { + protocol: nonnull(url.protocol), + hostname: nonnull(url.hostname), + port: nonnull(url.port), + path: nonnull(url.pathname) + nonnull(url.search), + method: options.method || "GET", + headers: (0, properties_1.shallowCopy)(options.headers || {}) + }; + if (options.allowGzip) { + request.headers["accept-encoding"] = "gzip"; + } + req = null; + switch (nonnull(url.protocol)) { + case "http:": + req = http_1.default.request(request); + break; + case "https:": + req = https_1.default.request(request); + break; + default: + logger.throwError("unsupported protocol " + url.protocol, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + protocol: url.protocol, + operation: "request" + }); + } + if (options.body) { + req.write(Buffer.from(options.body)); + } + req.end(); + return [4, getResponse(req)]; + case 1: + response = _a.sent(); + return [2, response]; + } + }); + }); + } + exports2.getUrl = getUrl; + } +}); + +// node_modules/@ethersproject/web/lib/index.js +var require_lib27 = __commonJS({ + "node_modules/@ethersproject/web/lib/index.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.poll = exports2.fetchJson = exports2._fetchData = void 0; + var base64_1 = require_lib26(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var strings_1 = require_lib9(); + var logger_1 = require_lib(); + var _version_1 = require_version21(); + var logger = new logger_1.Logger(_version_1.version); + var geturl_1 = require_geturl(); + 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 ((0, bytes_1.isBytesLike)(value)) { + if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) { + try { + return (0, strings_1.toUtf8String)(value); + } catch (error) { + } + ; + } + return (0, bytes_1.hexlify)(value); + } + return value; + } + function _fetchData(connection, body, processFunc) { + 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; + var options = { + method: "GET" + }; + var allow304 = false; + var timeout = 2 * 60 * 1e3; + 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, 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", logger_1.Logger.errors.INVALID_ARGUMENT, { argument: "url", url, user: connection.user, password: "[REDACTED]" }); + } + var authorization = connection.user + ":" + connection.password; + headers["authorization"] = { + key: "Authorization", + value: "Basic " + (0, base64_1.encode)((0, strings_1.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: (0, base64_1.decode)(dataMatch[2]) + }; + var result2 = response.body; + if (processFunc) { + result2 = processFunc(response.body, response); + } + return Promise.resolve(result2); + } catch (error) { + logger.throwError("processing response error", logger_1.Logger.errors.SERVER_ERROR, { + body: bodyify(dataMatch[1], dataMatch[2]), + error, + requestBody: null, + requestMethod: "GET", + 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(key2) { + var header = headers[key2]; + 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", logger_1.Logger.errors.TIMEOUT, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + timeout, + url + })); + }, timeout); + } + }); + var cancel = function() { + if (timer == null) { + return; + } + clearTimeout(timer); + timer = null; + }; + return { promise, cancel }; + }(); + var runningFetch = function() { + return __awaiter(this, void 0, void 0, function() { + var attempt, response2, location_1, tryAgain, stall, retryAfter, error_1, body_1, result3, error_2, tryAgain, timeout_1; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + attempt = 0; + _a.label = 1; + case 1: + if (!(attempt < attemptLimit)) return [3, 20]; + response2 = null; + _a.label = 2; + case 2: + _a.trys.push([2, 9, , 10]); + return [4, (0, geturl_1.getUrl)(url, options)]; + case 3: + response2 = _a.sent(); + if (!(attempt < attemptLimit)) return [3, 8]; + if (!(response2.statusCode === 301 || response2.statusCode === 302)) return [3, 4]; + location_1 = response2.headers.location || ""; + if (options.method === "GET" && location_1.match(/^https:/)) { + url = response2.headers.location; + return [3, 19]; + } + return [3, 8]; + case 4: + if (!(response2.statusCode === 429)) return [3, 8]; + tryAgain = true; + if (!throttleCallback) return [3, 6]; + return [4, throttleCallback(attempt, url)]; + case 5: + tryAgain = _a.sent(); + _a.label = 6; + case 6: + if (!tryAgain) return [3, 8]; + stall = 0; + retryAfter = response2.headers["retry-after"]; + if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1e3; + } else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + return [4, staller(stall)]; + case 7: + _a.sent(); + return [3, 19]; + case 8: + return [3, 10]; + case 9: + error_1 = _a.sent(); + response2 = error_1.response; + if (response2 == null) { + runningTimeout.cancel(); + logger.throwError("missing response", logger_1.Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + serverError: error_1, + url + }); + } + return [3, 10]; + case 10: + body_1 = response2.body; + if (allow304 && response2.statusCode === 304) { + body_1 = null; + } else if (response2.statusCode < 200 || response2.statusCode >= 300) { + runningTimeout.cancel(); + logger.throwError("bad response", logger_1.Logger.errors.SERVER_ERROR, { + status: response2.statusCode, + headers: response2.headers, + body: bodyify(body_1, response2.headers ? response2.headers["content-type"] : null), + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + } + if (!processFunc) return [3, 18]; + _a.label = 11; + case 11: + _a.trys.push([11, 13, , 18]); + return [4, processFunc(body_1, response2)]; + case 12: + result3 = _a.sent(); + runningTimeout.cancel(); + return [2, result3]; + case 13: + error_2 = _a.sent(); + if (!(error_2.throttleRetry && attempt < attemptLimit)) return [3, 17]; + tryAgain = true; + if (!throttleCallback) return [3, 15]; + return [4, throttleCallback(attempt, url)]; + case 14: + tryAgain = _a.sent(); + _a.label = 15; + case 15: + if (!tryAgain) return [3, 17]; + timeout_1 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + return [4, staller(timeout_1)]; + case 16: + _a.sent(); + return [3, 19]; + case 17: + runningTimeout.cancel(); + logger.throwError("processing response error", logger_1.Logger.errors.SERVER_ERROR, { + body: bodyify(body_1, response2.headers ? response2.headers["content-type"] : null), + error: error_2, + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + return [3, 18]; + case 18: + runningTimeout.cancel(); + return [2, body_1]; + case 19: + attempt++; + return [3, 1]; + case 20: + return [2, logger.throwError("failed response", logger_1.Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + })]; + } + }); + }); + }(); + return Promise.race([runningTimeout.promise, runningFetch]); + } + exports2._fetchData = _fetchData; + function fetchJson(connection, json, processFunc) { + var processJsonFunc = function(value, response) { + var result2 = null; + if (value != null) { + try { + result2 = JSON.parse((0, strings_1.toUtf8String)(value)); + } catch (error) { + logger.throwError("invalid JSON", logger_1.Logger.errors.SERVER_ERROR, { + body: value, + error + }); + } + } + if (processFunc) { + result2 = processFunc(result2, response); + } + return result2; + }; + var body = null; + if (json != null) { + body = (0, strings_1.toUtf8Bytes)(json); + var updated = typeof connection === "string" ? { url: connection } : (0, properties_1.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 = (0, properties_1.shallowCopy)(updated.headers); + updated.headers["content-type"] = "application/json"; + } + } else { + updated.headers = { "content-type": "application/json" }; + } + connection = updated; + } + return _fetchData(connection, body, processJsonFunc); + } + exports2.fetchJson = fetchJson; + function poll(func, options) { + if (!options) { + options = {}; + } + options = (0, properties_1.shallowCopy)(options); + if (options.floor == null) { + options.floor = 0; + } + if (options.ceiling == null) { + options.ceiling = 1e4; + } + if (options.interval == null) { + options.interval = 250; + } + return new Promise(function(resolve, reject) { + var timer = null; + var done = false; + var cancel = function() { + 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(result2) { + if (result2 !== void 0) { + if (cancel()) { + resolve(result2); + } + } else if (options.oncePoll) { + options.oncePoll.once("poll", check); + } else if (options.onceBlock) { + options.onceBlock.once("block", check); + } 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(); + }); + } + exports2.poll = poll; + } +}); + +// node_modules/bech32/index.js +var require_bech32 = __commonJS({ + "node_modules/bech32/index.js"(exports2, module2) { + "use strict"; + var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; + var ALPHABET_MAP = {}; + for (z = 0; z < ALPHABET.length; z++) { + x = ALPHABET.charAt(z); + if (ALPHABET_MAP[x] !== void 0) throw new TypeError(x + " is ambiguous"); + ALPHABET_MAP[x] = z; + } + var x; + var z; + function polymodStep(pre) { + var b = pre >> 25; + return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059; + } + 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 & 31; + } + 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(); + var chk = prefixChk(prefix); + if (typeof chk === "string") throw new Error(chk); + var result2 = prefix + "1"; + for (var i = 0; i < words.length; ++i) { + var x2 = words[i]; + if (x2 >> 5 !== 0) throw new Error("Non 5-bit word"); + chk = polymodStep(chk) ^ x2; + result2 += ALPHABET.charAt(x2); + } + for (i = 0; i < 6; ++i) { + chk = polymodStep(chk); + } + chk ^= 1; + for (i = 0; i < 6; ++i) { + var v = chk >> (5 - i) * 5 & 31; + result2 += ALPHABET.charAt(v); + } + return result2; + } + function __decode(str, LIMIT) { + LIMIT = LIMIT || 90; + if (str.length < 8) return str + " too short"; + if (str.length > LIMIT) return "Exceeds length limit"; + 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 === void 0) return "Unknown character " + c; + chk = polymodStep(chk) ^ v; + if (i + 6 >= wordChars.length) continue; + words.push(v); + } + if (chk !== 1) return "Invalid checksum for " + str; + return { prefix, 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 result2 = []; + for (var i = 0; i < data.length; ++i) { + value = value << inBits | data[i]; + bits += inBits; + while (bits >= outBits) { + bits -= outBits; + result2.push(value >> bits & maxV); + } + } + if (pad) { + if (bits > 0) { + result2.push(value << outBits - bits & maxV); + } + } else { + if (bits >= inBits) return "Excess padding"; + if (value << outBits - bits & maxV) return "Non-zero padding"; + } + return result2; + } + 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); + } + module2.exports = { + decodeUnsafe, + decode, + encode, + toWordsUnsafe, + toWords, + fromWordsUnsafe, + fromWords + }; + } +}); + +// node_modules/@ethersproject/providers/lib/_version.js +var require_version22 = __commonJS({ + "node_modules/@ethersproject/providers/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "providers/5.5.1"; + } +}); + +// node_modules/@ethersproject/providers/lib/formatter.js +var require_formatter = __commonJS({ + "node_modules/@ethersproject/providers/lib/formatter.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.showThrottleMessage = exports2.isCommunityResource = exports2.isCommunityResourcable = exports2.Formatter = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var Formatter = ( + /** @class */ + function() { + function Formatter2() { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, Formatter2); + this.formats = this.getDefaultFormats(); + } + Formatter2.prototype.getDefaultFormats = function() { + 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(v) { + return _this.data(v, true); + }; + formats.transaction = { + hash, + type, + accessList: Formatter2.allowNull(this.accessList.bind(this), null), + blockHash: Formatter2.allowNull(hash, null), + blockNumber: Formatter2.allowNull(number, null), + transactionIndex: Formatter2.allowNull(number, null), + confirmations: Formatter2.allowNull(number, null), + from: address, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) + // must be set + gasPrice: Formatter2.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter2.allowNull(bigNumber), + maxFeePerGas: Formatter2.allowNull(bigNumber), + gasLimit: bigNumber, + to: Formatter2.allowNull(address, null), + value: bigNumber, + nonce: number, + data, + r: Formatter2.allowNull(this.uint256), + s: Formatter2.allowNull(this.uint256), + v: Formatter2.allowNull(number), + creates: Formatter2.allowNull(address, null), + raw: Formatter2.allowNull(data) + }; + formats.transactionRequest = { + from: Formatter2.allowNull(address), + nonce: Formatter2.allowNull(number), + gasLimit: Formatter2.allowNull(bigNumber), + gasPrice: Formatter2.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter2.allowNull(bigNumber), + maxFeePerGas: Formatter2.allowNull(bigNumber), + to: Formatter2.allowNull(address), + value: Formatter2.allowNull(bigNumber), + data: Formatter2.allowNull(strictData), + type: Formatter2.allowNull(number), + accessList: Formatter2.allowNull(this.accessList.bind(this), null) + }; + formats.receiptLog = { + transactionIndex: number, + blockNumber: number, + transactionHash: hash, + address, + topics: Formatter2.arrayOf(hash), + data, + logIndex: number, + blockHash: hash + }; + formats.receipt = { + to: Formatter2.allowNull(this.address, null), + from: Formatter2.allowNull(this.address, null), + contractAddress: Formatter2.allowNull(address, null), + transactionIndex: number, + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + root: Formatter2.allowNull(hex), + gasUsed: bigNumber, + logsBloom: Formatter2.allowNull(data), + blockHash: hash, + transactionHash: hash, + logs: Formatter2.arrayOf(this.receiptLog.bind(this)), + blockNumber: number, + confirmations: Formatter2.allowNull(number, null), + cumulativeGasUsed: bigNumber, + effectiveGasPrice: Formatter2.allowNull(bigNumber), + status: Formatter2.allowNull(number), + type + }; + formats.block = { + hash, + parentHash: hash, + number, + timestamp: number, + nonce: Formatter2.allowNull(hex), + difficulty: this.difficulty.bind(this), + gasLimit: bigNumber, + gasUsed: bigNumber, + miner: address, + extraData: data, + transactions: Formatter2.allowNull(Formatter2.arrayOf(hash)), + baseFeePerGas: Formatter2.allowNull(bigNumber) + }; + formats.blockWithTransactions = (0, properties_1.shallowCopy)(formats.block); + formats.blockWithTransactions.transactions = Formatter2.allowNull(Formatter2.arrayOf(this.transactionResponse.bind(this))); + formats.filter = { + fromBlock: Formatter2.allowNull(blockTag, void 0), + toBlock: Formatter2.allowNull(blockTag, void 0), + blockHash: Formatter2.allowNull(hash, void 0), + address: Formatter2.allowNull(address, void 0), + topics: Formatter2.allowNull(this.topics.bind(this), void 0) + }; + formats.filterLog = { + blockNumber: Formatter2.allowNull(number), + blockHash: Formatter2.allowNull(hash), + transactionIndex: number, + removed: Formatter2.allowNull(this.boolean.bind(this)), + address, + data: Formatter2.allowFalsish(data, "0x"), + topics: Formatter2.arrayOf(hash), + transactionHash: hash, + logIndex: number + }; + return formats; + }; + Formatter2.prototype.accessList = function(accessList) { + return (0, transactions_1.accessListify)(accessList || []); + }; + Formatter2.prototype.number = function(number) { + if (number === "0x") { + return 0; + } + return bignumber_1.BigNumber.from(number).toNumber(); + }; + Formatter2.prototype.type = function(number) { + if (number === "0x" || number == null) { + return 0; + } + return bignumber_1.BigNumber.from(number).toNumber(); + }; + Formatter2.prototype.bigNumber = function(value) { + return bignumber_1.BigNumber.from(value); + }; + Formatter2.prototype.boolean = function(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); + }; + Formatter2.prototype.hex = function(value, strict) { + if (typeof value === "string") { + if (!strict && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if ((0, bytes_1.isHexString)(value)) { + return value.toLowerCase(); + } + } + return logger.throwArgumentError("invalid hash", "value", value); + }; + Formatter2.prototype.data = function(value, strict) { + var result2 = this.hex(value, strict); + if (result2.length % 2 !== 0) { + throw new Error("invalid data; odd-length - " + value); + } + return result2; + }; + Formatter2.prototype.address = function(value) { + return (0, address_1.getAddress)(value); + }; + Formatter2.prototype.callAddress = function(value) { + if (!(0, bytes_1.isHexString)(value, 32)) { + return null; + } + var address = (0, address_1.getAddress)((0, bytes_1.hexDataSlice)(value, 12)); + return address === constants_1.AddressZero ? null : address; + }; + Formatter2.prototype.contractAddress = function(value) { + return (0, address_1.getContractAddress)(value); + }; + Formatter2.prototype.blockTag = function(blockTag) { + if (blockTag == null) { + return "latest"; + } + if (blockTag === "earliest") { + return "0x0"; + } + if (blockTag === "latest" || blockTag === "pending") { + return blockTag; + } + if (typeof blockTag === "number" || (0, bytes_1.isHexString)(blockTag)) { + return (0, bytes_1.hexValue)(blockTag); + } + throw new Error("invalid blockTag"); + }; + Formatter2.prototype.hash = function(value, strict) { + var result2 = this.hex(value, strict); + if ((0, bytes_1.hexDataLength)(result2) !== 32) { + return logger.throwArgumentError("invalid hash", "value", value); + } + return result2; + }; + Formatter2.prototype.difficulty = function(value) { + if (value == null) { + return null; + } + var v = bignumber_1.BigNumber.from(value); + try { + return v.toNumber(); + } catch (error) { + } + return null; + }; + Formatter2.prototype.uint256 = function(value) { + if (!(0, bytes_1.isHexString)(value)) { + throw new Error("invalid uint256"); + } + return (0, bytes_1.hexZeroPad)(value, 32); + }; + Formatter2.prototype._block = function(value, format) { + if (value.author != null && value.miner == null) { + value.miner = value.author; + } + var difficulty = value._difficulty != null ? value._difficulty : value.difficulty; + var result2 = Formatter2.check(format, value); + result2._difficulty = difficulty == null ? null : bignumber_1.BigNumber.from(difficulty); + return result2; + }; + Formatter2.prototype.block = function(value) { + return this._block(value, this.formats.block); + }; + Formatter2.prototype.blockWithTransactions = function(value) { + return this._block(value, this.formats.blockWithTransactions); + }; + Formatter2.prototype.transactionRequest = function(value) { + return Formatter2.check(this.formats.transactionRequest, value); + }; + Formatter2.prototype.transactionResponse = function(transaction) { + if (transaction.gas != null && transaction.gasLimit == null) { + transaction.gasLimit = transaction.gas; + } + if (transaction.to && bignumber_1.BigNumber.from(transaction.to).isZero()) { + transaction.to = "0x0000000000000000000000000000000000000000"; + } + if (transaction.input != null && transaction.data == null) { + transaction.data = transaction.input; + } + 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 result2 = Formatter2.check(this.formats.transaction, transaction); + if (transaction.chainId != null) { + var chainId = transaction.chainId; + if ((0, bytes_1.isHexString)(chainId)) { + chainId = bignumber_1.BigNumber.from(chainId).toNumber(); + } + result2.chainId = chainId; + } else { + var chainId = transaction.networkId; + if (chainId == null && result2.v == null) { + chainId = transaction.chainId; + } + if ((0, bytes_1.isHexString)(chainId)) { + chainId = bignumber_1.BigNumber.from(chainId).toNumber(); + } + if (typeof chainId !== "number" && result2.v != null) { + chainId = (result2.v - 35) / 2; + if (chainId < 0) { + chainId = 0; + } + chainId = parseInt(chainId); + } + if (typeof chainId !== "number") { + chainId = 0; + } + result2.chainId = chainId; + } + if (result2.blockHash && result2.blockHash.replace(/0/g, "") === "x") { + result2.blockHash = null; + } + return result2; + }; + Formatter2.prototype.transaction = function(value) { + return (0, transactions_1.parse)(value); + }; + Formatter2.prototype.receiptLog = function(value) { + return Formatter2.check(this.formats.receiptLog, value); + }; + Formatter2.prototype.receipt = function(value) { + var result2 = Formatter2.check(this.formats.receipt, value); + if (result2.root != null) { + if (result2.root.length <= 4) { + var value_1 = bignumber_1.BigNumber.from(result2.root).toNumber(); + if (value_1 === 0 || value_1 === 1) { + if (result2.status != null && result2.status !== value_1) { + logger.throwArgumentError("alt-root-status/status mismatch", "value", { root: result2.root, status: result2.status }); + } + result2.status = value_1; + delete result2.root; + } else { + logger.throwArgumentError("invalid alt-root-status", "value.root", result2.root); + } + } else if (result2.root.length !== 66) { + logger.throwArgumentError("invalid root hash", "value.root", result2.root); + } + } + if (result2.status != null) { + result2.byzantium = true; + } + return result2; + }; + Formatter2.prototype.topics = function(value) { + var _this = this; + if (Array.isArray(value)) { + return value.map(function(v) { + return _this.topics(v); + }); + } else if (value != null) { + return this.hash(value, true); + } + return null; + }; + Formatter2.prototype.filter = function(value) { + return Formatter2.check(this.formats.filter, value); + }; + Formatter2.prototype.filterLog = function(value) { + return Formatter2.check(this.formats.filterLog, value); + }; + Formatter2.check = function(format, object) { + var result2 = {}; + for (var key in format) { + try { + var value = format[key](object[key]); + if (value !== void 0) { + result2[key] = value; + } + } catch (error) { + error.checkKey = key; + error.checkValue = object[key]; + throw error; + } + } + return result2; + }; + Formatter2.allowNull = function(format, nullValue) { + return function(value) { + if (value == null) { + return nullValue; + } + return format(value); + }; + }; + Formatter2.allowFalsish = function(format, replaceValue) { + return function(value) { + if (!value) { + return replaceValue; + } + return format(value); + }; + }; + Formatter2.arrayOf = function(format) { + return function(array) { + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + var result2 = []; + array.forEach(function(value) { + result2.push(format(value)); + }); + return result2; + }; + }; + return Formatter2; + }() + ); + exports2.Formatter = Formatter; + function isCommunityResourcable(value) { + return value && typeof value.isCommunityResource === "function"; + } + exports2.isCommunityResourcable = isCommunityResourcable; + function isCommunityResource(value) { + return isCommunityResourcable(value) && value.isCommunityResource(); + } + exports2.isCommunityResource = isCommunityResource; + 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("=========================="); + } + exports2.showThrottleMessage = showThrottleMessage; + } +}); + +// node_modules/@ethersproject/providers/lib/base-provider.js +var require_base_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/base-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BaseProvider = exports2.Resolver = exports2.Event = void 0; + var abstract_provider_1 = require_lib12(); + var basex_1 = require_lib17(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var hash_1 = require_lib10(); + var networks_1 = require_lib25(); + var properties_1 = require_lib4(); + var sha2_1 = require_lib19(); + var strings_1 = require_lib9(); + var web_1 = require_lib27(); + var bech32_1 = __importDefault(require_bech32()); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var formatter_1 = require_formatter(); + function checkTopic(topic) { + if (topic == null) { + return "null"; + } + if ((0, bytes_1.hexDataLength)(topic) !== 32) { + logger.throwArgumentError("invalid topic", "topic", topic); + } + return topic.toLowerCase(); + } + function serializeTopics(topics) { + topics = topics.slice(); + while (topics.length > 0 && topics[topics.length - 1] == null) { + topics.pop(); + } + return topics.map(function(topic) { + if (Array.isArray(topic)) { + var unique_1 = {}; + topic.forEach(function(topic2) { + unique_1[checkTopic(topic2)] = true; + }); + var sorted = Object.keys(unique_1); + 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(topic2) { + return topic2 === "null" ? null : topic2; + }); + return comps.length === 1 ? comps[0] : comps; + }); + } + function getEventTag(eventName) { + if (typeof eventName === "string") { + eventName = eventName.toLowerCase(); + if ((0, bytes_1.hexDataLength)(eventName) === 32) { + return "tx:" + eventName; + } + if (eventName.indexOf(":") === -1) { + return eventName; + } + } else if (Array.isArray(eventName)) { + return "filter:*:" + serializeTopics(eventName); + } else if (abstract_provider_1.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); + } + function getTime() { + return (/* @__PURE__ */ new Date()).getTime(); + } + function stall(duration) { + return new Promise(function(resolve) { + setTimeout(resolve, duration); + }); + } + var PollableEvents = ["block", "network", "pending", "poll"]; + var Event = ( + /** @class */ + function() { + function Event2(tag, listener, once) { + (0, properties_1.defineReadOnly)(this, "tag", tag); + (0, properties_1.defineReadOnly)(this, "listener", listener); + (0, properties_1.defineReadOnly)(this, "once", once); + } + Object.defineProperty(Event2.prototype, "event", { + get: function() { + switch (this.type) { + case "tx": + return this.hash; + case "filter": + return this.filter; + } + return this.tag; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "type", { + get: function() { + return this.tag.split(":")[0]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "hash", { + get: function() { + var comps = this.tag.split(":"); + if (comps[0] !== "tx") { + return null; + } + return comps[1]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "filter", { + get: function() { + 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; + }, + enumerable: false, + configurable: true + }); + Event2.prototype.pollable = function() { + return this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0; + }; + return Event2; + }() + ); + exports2.Event = Event; + var coinInfos = { + "0": { symbol: "btc", p2pkh: 0, p2sh: 5, prefix: "bc" }, + "2": { symbol: "ltc", p2pkh: 48, p2sh: 50, prefix: "ltc" }, + "3": { symbol: "doge", p2pkh: 30, p2sh: 22 }, + "60": { symbol: "eth", ilk: "eth" }, + "61": { symbol: "etc", ilk: "eth" }, + "700": { symbol: "xdai", ilk: "eth" } + }; + function bytes32ify(value) { + return (0, bytes_1.hexZeroPad)(bignumber_1.BigNumber.from(value).toHexString(), 32); + } + function base58Encode(data) { + return basex_1.Base58.encode((0, bytes_1.concat)([data, (0, bytes_1.hexDataSlice)((0, sha2_1.sha256)((0, sha2_1.sha256)(data)), 0, 4)])); + } + var matchers = [ + new RegExp("^(https)://(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + new RegExp("^(ipfs)://(.*)$", "i"), + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i") + ]; + function _parseString(result2) { + try { + return (0, strings_1.toUtf8String)(_parseBytes(result2)); + } catch (error) { + } + return null; + } + function _parseBytes(result2) { + if (result2 === "0x") { + return null; + } + var offset = bignumber_1.BigNumber.from((0, bytes_1.hexDataSlice)(result2, 0, 32)).toNumber(); + var length = bignumber_1.BigNumber.from((0, bytes_1.hexDataSlice)(result2, offset, offset + 32)).toNumber(); + return (0, bytes_1.hexDataSlice)(result2, offset + 32, offset + 32 + length); + } + var Resolver = ( + /** @class */ + function() { + function Resolver2(provider, address, name2, resolvedAddress) { + (0, properties_1.defineReadOnly)(this, "provider", provider); + (0, properties_1.defineReadOnly)(this, "name", name2); + (0, properties_1.defineReadOnly)(this, "address", provider.formatter.address(address)); + (0, properties_1.defineReadOnly)(this, "_resolvedAddress", resolvedAddress); + } + Resolver2.prototype._fetchBytes = function(selector, parameters) { + return __awaiter(this, void 0, void 0, function() { + var tx, _a, error_1; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + tx = { + to: this.address, + data: (0, bytes_1.hexConcat)([selector, (0, hash_1.namehash)(this.name), parameters || "0x"]) + }; + _b.label = 1; + case 1: + _b.trys.push([1, 3, , 4]); + _a = _parseBytes; + return [4, this.provider.call(tx)]; + case 2: + return [2, _a.apply(void 0, [_b.sent()])]; + case 3: + error_1 = _b.sent(); + if (error_1.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + return [2, null]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + Resolver2.prototype._getAddress = function(coinType, hexBytes) { + var coinInfo = coinInfos[String(coinType)]; + if (coinInfo == null) { + logger.throwError("unsupported coin type: " + coinType, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(" + coinType + ")" + }); + } + if (coinInfo.ilk === "eth") { + return this.provider.formatter.address(hexBytes); + } + var bytes = (0, bytes_1.arrayify)(hexBytes); + if (coinInfo.p2pkh != null) { + var p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/); + if (p2pkh) { + var length_1 = parseInt(p2pkh[1], 16); + if (p2pkh[2].length === length_1 * 2 && length_1 >= 1 && length_1 <= 75) { + return base58Encode((0, bytes_1.concat)([[coinInfo.p2pkh], "0x" + p2pkh[2]])); + } + } + } + if (coinInfo.p2sh != null) { + var p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/); + if (p2sh) { + var length_2 = parseInt(p2sh[1], 16); + if (p2sh[2].length === length_2 * 2 && length_2 >= 1 && length_2 <= 75) { + return base58Encode((0, bytes_1.concat)([[coinInfo.p2sh], "0x" + p2sh[2]])); + } + } + } + if (coinInfo.prefix != null) { + var length_3 = bytes[1]; + var version_1 = bytes[0]; + if (version_1 === 0) { + if (length_3 !== 20 && length_3 !== 32) { + version_1 = -1; + } + } else { + version_1 = -1; + } + if (version_1 >= 0 && bytes.length === 2 + length_3 && length_3 >= 1 && length_3 <= 75) { + var words = bech32_1.default.toWords(bytes.slice(2)); + words.unshift(version_1); + return bech32_1.default.encode(coinInfo.prefix, words); + } + } + return null; + }; + Resolver2.prototype.getAddress = function(coinType) { + return __awaiter(this, void 0, void 0, function() { + var transaction, hexBytes_1, error_2, hexBytes, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (coinType == null) { + coinType = 60; + } + if (!(coinType === 60)) return [3, 4]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + transaction = { + to: this.address, + data: "0x3b3b57de" + (0, hash_1.namehash)(this.name).substring(2) + }; + return [4, this.provider.call(transaction)]; + case 2: + hexBytes_1 = _a.sent(); + if (hexBytes_1 === "0x" || hexBytes_1 === constants_1.HashZero) { + return [2, null]; + } + return [2, this.provider.formatter.callAddress(hexBytes_1)]; + case 3: + error_2 = _a.sent(); + if (error_2.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + throw error_2; + case 4: + return [4, this._fetchBytes("0xf1cb7e06", bytes32ify(coinType))]; + case 5: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + address = this._getAddress(coinType, hexBytes); + if (address == null) { + logger.throwError("invalid or unsupported coin data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(" + coinType + ")", + coinType, + data: hexBytes + }); + } + return [2, address]; + } + }); + }); + }; + Resolver2.prototype.getAvatar = function() { + return __awaiter(this, void 0, void 0, function() { + var linkage, avatar, i, match, _a, selector, owner, _b, comps, addr, tokenId, tokenOwner, _c, _d, balance, _e, _f, tx, metadataUrl, _g, metadata, error_3; + return __generator(this, function(_h) { + switch (_h.label) { + case 0: + linkage = []; + _h.label = 1; + case 1: + _h.trys.push([1, 19, , 20]); + return [4, this.getText("avatar")]; + case 2: + avatar = _h.sent(); + if (avatar == null) { + return [2, null]; + } + i = 0; + _h.label = 3; + case 3: + if (!(i < matchers.length)) return [3, 18]; + match = avatar.match(matchers[i]); + if (match == null) { + return [3, 17]; + } + _a = match[1]; + switch (_a) { + case "https": + return [3, 4]; + case "data": + return [3, 5]; + case "ipfs": + return [3, 6]; + case "erc721": + return [3, 7]; + case "erc1155": + return [3, 7]; + } + return [3, 17]; + case 4: + linkage.push({ type: "url", content: avatar }); + return [2, { linkage, url: avatar }]; + case 5: + linkage.push({ type: "data", content: avatar }); + return [2, { linkage, url: avatar }]; + case 6: + linkage.push({ type: "ipfs", content: avatar }); + return [2, { linkage, url: "https://gateway.ipfs.io/ipfs/" + avatar.substring(7) }]; + case 7: + selector = match[1] === "erc721" ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: match[1], content: avatar }); + _b = this._resolvedAddress; + if (_b) return [3, 9]; + return [4, this.getAddress()]; + case 8: + _b = _h.sent(); + _h.label = 9; + case 9: + owner = _b; + comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return [2, null]; + } + return [4, this.provider.formatter.address(comps[0])]; + case 10: + addr = _h.sent(); + tokenId = (0, bytes_1.hexZeroPad)(bignumber_1.BigNumber.from(comps[1]).toHexString(), 32); + if (!(match[1] === "erc721")) return [3, 12]; + _d = (_c = this.provider.formatter).callAddress; + return [4, this.provider.call({ + to: addr, + data: (0, bytes_1.hexConcat)(["0x6352211e", tokenId]) + })]; + case 11: + tokenOwner = _d.apply(_c, [_h.sent()]); + if (owner !== tokenOwner) { + return [2, null]; + } + linkage.push({ type: "owner", content: tokenOwner }); + return [3, 14]; + case 12: + if (!(match[1] === "erc1155")) return [3, 14]; + _f = (_e = bignumber_1.BigNumber).from; + return [4, this.provider.call({ + to: addr, + data: (0, bytes_1.hexConcat)(["0x00fdd58e", (0, bytes_1.hexZeroPad)(owner, 32), tokenId]) + })]; + case 13: + balance = _f.apply(_e, [_h.sent()]); + if (balance.isZero()) { + return [2, null]; + } + linkage.push({ type: "balance", content: balance.toString() }); + _h.label = 14; + case 14: + tx = { + to: this.provider.formatter.address(comps[0]), + data: (0, bytes_1.hexConcat)([selector, tokenId]) + }; + _g = _parseString; + return [4, this.provider.call(tx)]; + case 15: + metadataUrl = _g.apply(void 0, [_h.sent()]); + if (metadataUrl == null) { + return [2, null]; + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + if (match[1] === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + } + return [4, (0, web_1.fetchJson)(metadataUrl)]; + case 16: + metadata = _h.sent(); + if (!metadata || typeof metadata.image !== "string" || !metadata.image.match(/^(https:\/\/|data:)/i)) { + return [2, null]; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + linkage.push({ type: "url", content: metadata.image }); + return [2, { linkage, url: metadata.image }]; + case 17: + i++; + return [3, 3]; + case 18: + return [3, 20]; + case 19: + error_3 = _h.sent(); + return [3, 20]; + case 20: + return [2, null]; + } + }); + }); + }; + Resolver2.prototype.getContentHash = function() { + return __awaiter(this, void 0, void 0, function() { + var hexBytes, ipfs, length_4, swarm; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._fetchBytes("0xbc1c58d1")]; + case 1: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + length_4 = parseInt(ipfs[3], 16); + if (ipfs[4].length === length_4 * 2) { + return [2, "ipfs://" + basex_1.Base58.encode("0x" + ipfs[1])]; + } + } + swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm) { + if (swarm[1].length === 32 * 2) { + return [2, "bzz://" + swarm[1]]; + } + } + return [2, logger.throwError("invalid or unsupported content hash data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getContentHash()", + data: hexBytes + })]; + } + }); + }); + }; + Resolver2.prototype.getText = function(key) { + return __awaiter(this, void 0, void 0, function() { + var keyBytes, hexBytes; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + keyBytes = (0, strings_1.toUtf8Bytes)(key); + keyBytes = (0, bytes_1.concat)([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]); + if (keyBytes.length % 32 !== 0) { + keyBytes = (0, bytes_1.concat)([keyBytes, (0, bytes_1.hexZeroPad)("0x", 32 - key.length % 32)]); + } + return [4, this._fetchBytes("0x59d1d43c", (0, bytes_1.hexlify)(keyBytes))]; + case 1: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + return [2, (0, strings_1.toUtf8String)(hexBytes)]; + } + }); + }); + }; + return Resolver2; + }() + ); + exports2.Resolver = Resolver; + var defaultFormatter = null; + var nextPollId = 1; + var BaseProvider = ( + /** @class */ + function(_super) { + __extends(BaseProvider2, _super); + function BaseProvider2(network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, abstract_provider_1.Provider); + _this = _super.call(this) || this; + _this._events = []; + _this._emitted = { block: -2 }; + _this.formatter = _newTarget.getFormatter(); + (0, properties_1.defineReadOnly)(_this, "anyNetwork", network === "any"); + if (_this.anyNetwork) { + network = _this.detectNetwork(); + } + if (network instanceof Promise) { + _this._networkPromise = network; + network.catch(function(error) { + }); + _this._ready().catch(function(error) { + }); + } else { + var knownNetwork = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + if (knownNetwork) { + (0, properties_1.defineReadOnly)(_this, "_network", knownNetwork); + _this.emit("network", knownNetwork, null); + } else { + logger.throwArgumentError("invalid network", "network", network); + } + } + _this._maxInternalBlockNumber = -1024; + _this._lastBlockNumber = -2; + _this._pollingInterval = 4e3; + _this._fastQueryDate = 0; + return _this; + } + BaseProvider2.prototype._ready = function() { + return __awaiter(this, void 0, void 0, function() { + var network, error_4; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(this._network == null)) return [3, 7]; + network = null; + if (!this._networkPromise) return [3, 4]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, this._networkPromise]; + case 2: + network = _a.sent(); + return [3, 4]; + case 3: + error_4 = _a.sent(); + return [3, 4]; + case 4: + if (!(network == null)) return [3, 6]; + return [4, this.detectNetwork()]; + case 5: + network = _a.sent(); + _a.label = 6; + case 6: + if (!network) { + logger.throwError("no network detected", logger_1.Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + if (this.anyNetwork) { + this._network = network; + } else { + (0, properties_1.defineReadOnly)(this, "_network", network); + } + this.emit("network", network, null); + } + _a.label = 7; + case 7: + return [2, this._network]; + } + }); + }); + }; + Object.defineProperty(BaseProvider2.prototype, "ready", { + // 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 + get: function() { + var _this = this; + return (0, web_1.poll)(function() { + return _this._ready().then(function(network) { + return network; + }, function(error) { + if (error.code === logger_1.Logger.errors.NETWORK_ERROR && error.event === "noNetwork") { + return void 0; + } + throw error; + }); + }); + }, + enumerable: false, + configurable: true + }); + BaseProvider2.getFormatter = function() { + if (defaultFormatter == null) { + defaultFormatter = new formatter_1.Formatter(); + } + return defaultFormatter; + }; + BaseProvider2.getNetwork = function(network) { + return (0, networks_1.getNetwork)(network == null ? "homestead" : network); + }; + BaseProvider2.prototype._getInternalBlockNumber = function(maxAge) { + return __awaiter(this, void 0, void 0, function() { + var internalBlockNumber, result2, error_5, reqTime, checkInternalBlockNumber; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._ready()]; + case 1: + _a.sent(); + if (!(maxAge > 0)) return [3, 7]; + _a.label = 2; + case 2: + if (!this._internalBlockNumber) return [3, 7]; + internalBlockNumber = this._internalBlockNumber; + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, internalBlockNumber]; + case 4: + result2 = _a.sent(); + if (getTime() - result2.respTime <= maxAge) { + return [2, result2.blockNumber]; + } + return [3, 7]; + case 5: + error_5 = _a.sent(); + if (this._internalBlockNumber === internalBlockNumber) { + return [3, 7]; + } + return [3, 6]; + case 6: + return [3, 2]; + case 7: + reqTime = getTime(); + checkInternalBlockNumber = (0, properties_1.resolveProperties)({ + blockNumber: this.perform("getBlockNumber", {}), + networkError: this.getNetwork().then(function(network) { + return null; + }, function(error) { + return error; + }) + }).then(function(_a2) { + var blockNumber = _a2.blockNumber, networkError = _a2.networkError; + if (networkError) { + if (_this._internalBlockNumber === checkInternalBlockNumber) { + _this._internalBlockNumber = null; + } + throw networkError; + } + var respTime = getTime(); + blockNumber = bignumber_1.BigNumber.from(blockNumber).toNumber(); + if (blockNumber < _this._maxInternalBlockNumber) { + blockNumber = _this._maxInternalBlockNumber; + } + _this._maxInternalBlockNumber = blockNumber; + _this._setFastBlockNumber(blockNumber); + return { blockNumber, reqTime, respTime }; + }); + this._internalBlockNumber = checkInternalBlockNumber; + checkInternalBlockNumber.catch(function(error) { + if (_this._internalBlockNumber === checkInternalBlockNumber) { + _this._internalBlockNumber = null; + } + }); + return [4, checkInternalBlockNumber]; + case 8: + return [2, _a.sent().blockNumber]; + } + }); + }); + }; + BaseProvider2.prototype.poll = function() { + return __awaiter(this, void 0, void 0, function() { + var pollId, runners, blockNumber, error_6, i; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + pollId = nextPollId++; + runners = []; + blockNumber = null; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, this._getInternalBlockNumber(100 + this.pollingInterval / 2)]; + case 2: + blockNumber = _a.sent(); + return [3, 4]; + case 3: + error_6 = _a.sent(); + this.emit("error", error_6); + return [ + 2 + /*return*/ + ]; + case 4: + this._setFastBlockNumber(blockNumber); + this.emit("poll", pollId, blockNumber); + if (blockNumber === this._lastBlockNumber) { + this.emit("didPoll", pollId); + return [ + 2 + /*return*/ + ]; + } + if (this._emitted.block === -2) { + this._emitted.block = blockNumber - 1; + } + if (Math.abs(this._emitted.block - blockNumber) > 1e3) { + logger.warn("network block skew detected; skipping block events (emitted=" + this._emitted.block + " blockNumber" + blockNumber + ")"); + this.emit("error", logger.makeError("network block skew detected", logger_1.Logger.errors.NETWORK_ERROR, { + blockNumber, + event: "blockSkew", + previousBlockNumber: this._emitted.block + })); + this.emit("block", blockNumber); + } else { + for (i = this._emitted.block + 1; i <= blockNumber; i++) { + this.emit("block", i); + } + } + if (this._emitted.block !== blockNumber) { + this._emitted.block = blockNumber; + Object.keys(this._emitted).forEach(function(key) { + if (key === "block") { + return; + } + var eventBlockNumber = _this._emitted[key]; + if (eventBlockNumber === "pending") { + return; + } + if (blockNumber - eventBlockNumber > 12) { + delete _this._emitted[key]; + } + }); + } + if (this._lastBlockNumber === -2) { + this._lastBlockNumber = blockNumber - 1; + } + this._events.forEach(function(event) { + switch (event.type) { + case "tx": { + var hash_2 = event.hash; + var runner = _this.getTransactionReceipt(hash_2).then(function(receipt) { + if (!receipt || receipt.blockNumber == null) { + return null; + } + _this._emitted["t:" + hash_2] = receipt.blockNumber; + _this.emit(hash_2, receipt); + return null; + }).catch(function(error) { + _this.emit("error", error); + }); + runners.push(runner); + break; + } + case "filter": { + var filter_1 = event.filter; + filter_1.fromBlock = _this._lastBlockNumber + 1; + filter_1.toBlock = blockNumber; + var runner = _this.getLogs(filter_1).then(function(logs) { + if (logs.length === 0) { + return; + } + logs.forEach(function(log) { + _this._emitted["b:" + log.blockHash] = log.blockNumber; + _this._emitted["t:" + log.transactionHash] = log.blockNumber; + _this.emit(filter_1, log); + }); + }).catch(function(error) { + _this.emit("error", error); + }); + runners.push(runner); + break; + } + } + }); + this._lastBlockNumber = blockNumber; + Promise.all(runners).then(function() { + _this.emit("didPoll", pollId); + }).catch(function(error) { + _this.emit("error", error); + }); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.resetEventsBlock = function(blockNumber) { + this._lastBlockNumber = blockNumber - 1; + if (this.polling) { + this.poll(); + } + }; + Object.defineProperty(BaseProvider2.prototype, "network", { + get: function() { + return this._network; + }, + enumerable: false, + configurable: true + }); + BaseProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, logger.throwError("provider does not support network detection", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "provider.detectNetwork" + })]; + }); + }); + }; + BaseProvider2.prototype.getNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var network, currentNetwork, error; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._ready()]; + case 1: + network = _a.sent(); + return [4, this.detectNetwork()]; + case 2: + currentNetwork = _a.sent(); + if (!(network.chainId !== currentNetwork.chainId)) return [3, 5]; + if (!this.anyNetwork) return [3, 4]; + this._network = currentNetwork; + this._lastBlockNumber = -2; + this._fastBlockNumber = null; + this._fastBlockNumberPromise = null; + this._fastQueryDate = 0; + this._emitted.block = -2; + this._maxInternalBlockNumber = -1024; + this._internalBlockNumber = null; + this.emit("network", currentNetwork, network); + return [4, stall(0)]; + case 3: + _a.sent(); + return [2, this._network]; + case 4: + error = logger.makeError("underlying network changed", logger_1.Logger.errors.NETWORK_ERROR, { + event: "changed", + network, + detectedNetwork: currentNetwork + }); + this.emit("error", error); + throw error; + case 5: + return [2, network]; + } + }); + }); + }; + Object.defineProperty(BaseProvider2.prototype, "blockNumber", { + get: function() { + var _this = this; + this._getInternalBlockNumber(100 + this.pollingInterval / 2).then(function(blockNumber) { + _this._setFastBlockNumber(blockNumber); + }, function(error) { + }); + return this._fastBlockNumber != null ? this._fastBlockNumber : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseProvider2.prototype, "polling", { + get: function() { + return this._poller != null; + }, + set: function(value) { + var _this = this; + if (value && !this._poller) { + this._poller = setInterval(function() { + _this.poll(); + }, this.pollingInterval); + if (!this._bootstrapPoll) { + this._bootstrapPoll = setTimeout(function() { + _this.poll(); + _this._bootstrapPoll = setTimeout(function() { + if (!_this._poller) { + _this.poll(); + } + _this._bootstrapPoll = null; + }, _this.pollingInterval); + }, 0); + } + } else if (!value && this._poller) { + clearInterval(this._poller); + this._poller = null; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseProvider2.prototype, "pollingInterval", { + get: function() { + return this._pollingInterval; + }, + set: function(value) { + var _this = 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() { + _this.poll(); + }, this._pollingInterval); + } + }, + enumerable: false, + configurable: true + }); + BaseProvider2.prototype._getFastBlockNumber = function() { + var _this = this; + var now = getTime(); + if (now - this._fastQueryDate > 2 * this._pollingInterval) { + this._fastQueryDate = now; + this._fastBlockNumberPromise = this.getBlockNumber().then(function(blockNumber) { + if (_this._fastBlockNumber == null || blockNumber > _this._fastBlockNumber) { + _this._fastBlockNumber = blockNumber; + } + return _this._fastBlockNumber; + }); + } + return this._fastBlockNumberPromise; + }; + BaseProvider2.prototype._setFastBlockNumber = function(blockNumber) { + if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { + return; + } + this._fastQueryDate = getTime(); + if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { + this._fastBlockNumber = blockNumber; + this._fastBlockNumberPromise = Promise.resolve(blockNumber); + } + }; + BaseProvider2.prototype.waitForTransaction = function(transactionHash, confirmations, timeout) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this._waitForTransaction(transactionHash, confirmations == null ? 1 : confirmations, timeout || 0, null)]; + }); + }); + }; + BaseProvider2.prototype._waitForTransaction = function(transactionHash, confirmations, timeout, replaceable) { + return __awaiter(this, void 0, void 0, function() { + var receipt; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getTransactionReceipt(transactionHash)]; + case 1: + receipt = _a.sent(); + if ((receipt ? receipt.confirmations : 0) >= confirmations) { + return [2, receipt]; + } + return [2, new Promise(function(resolve, reject) { + var cancelFuncs = []; + var done = false; + var alreadyDone = function() { + if (done) { + return true; + } + done = true; + cancelFuncs.forEach(function(func) { + func(); + }); + return false; + }; + var minedHandler = function(receipt2) { + if (receipt2.confirmations < confirmations) { + return; + } + if (alreadyDone()) { + return; + } + resolve(receipt2); + }; + _this.on(transactionHash, minedHandler); + cancelFuncs.push(function() { + _this.removeListener(transactionHash, minedHandler); + }); + if (replaceable) { + var lastBlockNumber_1 = replaceable.startBlock; + var scannedBlock_1 = null; + var replaceHandler_1 = function(blockNumber) { + return __awaiter(_this, void 0, void 0, function() { + var _this2 = this; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, stall(1e3)]; + case 1: + _a2.sent(); + this.getTransactionCount(replaceable.from).then(function(nonce) { + return __awaiter(_this2, void 0, void 0, function() { + var mined, block, ti, tx, receipt_1, reason; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + if (done) { + return [ + 2 + /*return*/ + ]; + } + if (!(nonce <= replaceable.nonce)) return [3, 1]; + lastBlockNumber_1 = blockNumber; + return [3, 9]; + case 1: + return [4, this.getTransaction(transactionHash)]; + case 2: + mined = _a3.sent(); + if (mined && mined.blockNumber != null) { + return [ + 2 + /*return*/ + ]; + } + if (scannedBlock_1 == null) { + scannedBlock_1 = lastBlockNumber_1 - 3; + if (scannedBlock_1 < replaceable.startBlock) { + scannedBlock_1 = replaceable.startBlock; + } + } + _a3.label = 3; + case 3: + if (!(scannedBlock_1 <= blockNumber)) return [3, 9]; + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, this.getBlockWithTransactions(scannedBlock_1)]; + case 4: + block = _a3.sent(); + ti = 0; + _a3.label = 5; + case 5: + if (!(ti < block.transactions.length)) return [3, 8]; + tx = block.transactions[ti]; + if (tx.hash === transactionHash) { + return [ + 2 + /*return*/ + ]; + } + if (!(tx.from === replaceable.from && tx.nonce === replaceable.nonce)) return [3, 7]; + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, this.waitForTransaction(tx.hash, confirmations)]; + case 6: + receipt_1 = _a3.sent(); + if (alreadyDone()) { + return [ + 2 + /*return*/ + ]; + } + 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"; + } + reject(logger.makeError("transaction was replaced", logger_1.Logger.errors.TRANSACTION_REPLACED, { + cancelled: reason === "replaced" || reason === "cancelled", + reason, + replacement: this._wrapTransaction(tx), + hash: transactionHash, + receipt: receipt_1 + })); + return [ + 2 + /*return*/ + ]; + case 7: + ti++; + return [3, 5]; + case 8: + scannedBlock_1++; + return [3, 3]; + case 9: + if (done) { + return [ + 2 + /*return*/ + ]; + } + this.once("block", replaceHandler_1); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }, function(error) { + if (done) { + return; + } + _this2.once("block", replaceHandler_1); + }); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + if (done) { + return; + } + _this.once("block", replaceHandler_1); + cancelFuncs.push(function() { + _this.removeListener("block", replaceHandler_1); + }); + } + if (typeof timeout === "number" && timeout > 0) { + var timer_1 = setTimeout(function() { + if (alreadyDone()) { + return; + } + reject(logger.makeError("timeout exceeded", logger_1.Logger.errors.TIMEOUT, { timeout })); + }, timeout); + if (timer_1.unref) { + timer_1.unref(); + } + cancelFuncs.push(function() { + clearTimeout(timer_1); + }); + } + })]; + } + }); + }); + }; + BaseProvider2.prototype.getBlockNumber = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this._getInternalBlockNumber(0)]; + }); + }); + }; + BaseProvider2.prototype.getGasPrice = function() { + return __awaiter(this, void 0, void 0, function() { + var result2; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, this.perform("getGasPrice", {})]; + case 2: + result2 = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result2)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getGasPrice", + result: result2, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getBalance = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params2, result2; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params2 = _a.sent(); + return [4, this.perform("getBalance", params2)]; + case 3: + result2 = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result2)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getBalance", + params: params2, + result: result2, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getTransactionCount = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params2, result2; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params2 = _a.sent(); + return [4, this.perform("getTransactionCount", params2)]; + case 3: + result2 = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result2).toNumber()]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getTransactionCount", + params: params2, + result: result2, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getCode = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params2, result2; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params2 = _a.sent(); + return [4, this.perform("getCode", params2)]; + case 3: + result2 = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result2)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getCode", + params: params2, + result: result2, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getStorageAt = function(addressOrName, position, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params2, result2; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag), + position: Promise.resolve(position).then(function(p) { + return (0, bytes_1.hexValue)(p); + }) + })]; + case 2: + params2 = _a.sent(); + return [4, this.perform("getStorageAt", params2)]; + case 3: + result2 = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result2)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getStorageAt", + params: params2, + result: result2, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._wrapTransaction = function(tx, hash, startBlock) { + var _this = this; + if (hash != null && (0, bytes_1.hexDataLength)(hash) !== 32) { + throw new Error("invalid response - sendTransaction"); + } + var result2 = tx; + if (hash != null && tx.hash !== hash) { + logger.throwError("Transaction hash mismatch from Provider.sendTransaction.", logger_1.Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash }); + } + result2.wait = function(confirms, timeout) { + return __awaiter(_this, void 0, void 0, function() { + var replacement, receipt; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (confirms == null) { + confirms = 1; + } + if (timeout == null) { + timeout = 0; + } + replacement = void 0; + if (confirms !== 0 && startBlock != null) { + replacement = { + data: tx.data, + from: tx.from, + nonce: tx.nonce, + to: tx.to, + value: tx.value, + startBlock + }; + } + return [4, this._waitForTransaction(tx.hash, confirms, timeout, replacement)]; + case 1: + receipt = _a.sent(); + if (receipt == null && confirms === 0) { + return [2, null]; + } + this._emitted["t:" + tx.hash] = receipt.blockNumber; + if (receipt.status === 0) { + logger.throwError("transaction failed", logger_1.Logger.errors.CALL_EXCEPTION, { + transactionHash: tx.hash, + transaction: tx, + receipt + }); + } + return [2, receipt]; + } + }); + }); + }; + return result2; + }; + BaseProvider2.prototype.sendTransaction = function(signedTransaction) { + return __awaiter(this, void 0, void 0, function() { + var hexTx, tx, blockNumber, hash, error_7; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, Promise.resolve(signedTransaction).then(function(t) { + return (0, bytes_1.hexlify)(t); + })]; + case 2: + hexTx = _a.sent(); + tx = this.formatter.transaction(signedTransaction); + if (tx.confirmations == null) { + tx.confirmations = 0; + } + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a.sent(); + _a.label = 4; + case 4: + _a.trys.push([4, 6, , 7]); + return [4, this.perform("sendTransaction", { signedTransaction: hexTx })]; + case 5: + hash = _a.sent(); + return [2, this._wrapTransaction(tx, hash, blockNumber)]; + case 6: + error_7 = _a.sent(); + error_7.transaction = tx; + error_7.transactionHash = tx.hash; + throw error_7; + case 7: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getTransactionRequest = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var values, tx, _a, _b; + var _this = this; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, transaction]; + case 1: + values = _c.sent(); + tx = {}; + ["from", "to"].forEach(function(key) { + if (values[key] == null) { + return; + } + tx[key] = Promise.resolve(values[key]).then(function(v) { + return v ? _this._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 ? bignumber_1.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 ? (0, bytes_1.hexlify)(v) : null; + }); + }); + _b = (_a = this.formatter).transactionRequest; + return [4, (0, properties_1.resolveProperties)(tx)]; + case 2: + return [2, _b.apply(_a, [_c.sent()])]; + } + }); + }); + }; + BaseProvider2.prototype._getFilter = function(filter) { + return __awaiter(this, void 0, void 0, function() { + var result2, _a, _b; + var _this = this; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, filter]; + case 1: + filter = _c.sent(); + result2 = {}; + if (filter.address != null) { + result2.address = this._getAddress(filter.address); + } + ["blockHash", "topics"].forEach(function(key) { + if (filter[key] == null) { + return; + } + result2[key] = filter[key]; + }); + ["fromBlock", "toBlock"].forEach(function(key) { + if (filter[key] == null) { + return; + } + result2[key] = _this._getBlockTag(filter[key]); + }); + _b = (_a = this.formatter).filter; + return [4, (0, properties_1.resolveProperties)(result2)]; + case 2: + return [2, _b.apply(_a, [_c.sent()])]; + } + }); + }); + }; + BaseProvider2.prototype.call = function(transaction, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params2, result2; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params2 = _a.sent(); + return [4, this.perform("call", params2)]; + case 3: + result2 = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result2)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "call", + params: params2, + result: result2, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.estimateGas = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var params2, result2; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + transaction: this._getTransactionRequest(transaction) + })]; + case 2: + params2 = _a.sent(); + return [4, this.perform("estimateGas", params2)]; + case 3: + result2 = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result2)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "estimateGas", + params: params2, + result: result2, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getAddress = function(addressOrName) { + return __awaiter(this, void 0, void 0, function() { + var address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, addressOrName]; + case 1: + addressOrName = _a.sent(); + if (typeof addressOrName !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } + return [4, this.resolveName(addressOrName)]; + case 2: + address = _a.sent(); + if (address == null) { + logger.throwError("ENS name not configured", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName(" + JSON.stringify(addressOrName) + ")" + }); + } + return [2, address]; + } + }); + }); + }; + BaseProvider2.prototype._getBlock = function(blockHashOrBlockTag, includeTransactions) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber, params2, _a, error_8; + var _this = this; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _b.sent(); + return [4, blockHashOrBlockTag]; + case 2: + blockHashOrBlockTag = _b.sent(); + blockNumber = -128; + params2 = { + includeTransactions: !!includeTransactions + }; + if (!(0, bytes_1.isHexString)(blockHashOrBlockTag, 32)) return [3, 3]; + params2.blockHash = blockHashOrBlockTag; + return [3, 6]; + case 3: + _b.trys.push([3, 5, , 6]); + _a = params2; + return [4, this._getBlockTag(blockHashOrBlockTag)]; + case 4: + _a.blockTag = _b.sent(); + if ((0, bytes_1.isHexString)(params2.blockTag)) { + blockNumber = parseInt(params2.blockTag.substring(2), 16); + } + return [3, 6]; + case 5: + error_8 = _b.sent(); + logger.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag); + return [3, 6]; + case 6: + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var block, blockNumber_1, i, tx, confirmations, blockWithTxs; + var _this2 = this; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getBlock", params2)]; + case 1: + block = _a2.sent(); + if (block == null) { + if (params2.blockHash != null) { + if (this._emitted["b:" + params2.blockHash] == null) { + return [2, null]; + } + } + if (params2.blockTag != null) { + if (blockNumber > this._emitted.block) { + return [2, null]; + } + } + return [2, void 0]; + } + if (!includeTransactions) return [3, 8]; + blockNumber_1 = null; + i = 0; + _a2.label = 2; + case 2: + if (!(i < block.transactions.length)) return [3, 7]; + tx = block.transactions[i]; + if (!(tx.blockNumber == null)) return [3, 3]; + tx.confirmations = 0; + return [3, 6]; + case 3: + if (!(tx.confirmations == null)) return [3, 6]; + if (!(blockNumber_1 == null)) return [3, 5]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 4: + blockNumber_1 = _a2.sent(); + _a2.label = 5; + case 5: + confirmations = blockNumber_1 - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + _a2.label = 6; + case 6: + i++; + return [3, 2]; + case 7: + blockWithTxs = this.formatter.blockWithTransactions(block); + blockWithTxs.transactions = blockWithTxs.transactions.map(function(tx2) { + return _this2._wrapTransaction(tx2); + }); + return [2, blockWithTxs]; + case 8: + return [2, this.formatter.block(block)]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getBlock = function(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, false); + }; + BaseProvider2.prototype.getBlockWithTransactions = function(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, true); + }; + BaseProvider2.prototype.getTransaction = function(transactionHash) { + return __awaiter(this, void 0, void 0, function() { + var params2; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, transactionHash]; + case 2: + transactionHash = _a.sent(); + params2 = { transactionHash: this.formatter.hash(transactionHash, true) }; + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var result2, tx, blockNumber, confirmations; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getTransaction", params2)]; + case 1: + result2 = _a2.sent(); + if (result2 == null) { + if (this._emitted["t:" + transactionHash] == null) { + return [2, null]; + } + return [2, void 0]; + } + tx = this.formatter.transactionResponse(result2); + if (!(tx.blockNumber == null)) return [3, 2]; + tx.confirmations = 0; + return [3, 4]; + case 2: + if (!(tx.confirmations == null)) return [3, 4]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a2.sent(); + confirmations = blockNumber - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + _a2.label = 4; + case 4: + return [2, this._wrapTransaction(tx)]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getTransactionReceipt = function(transactionHash) { + return __awaiter(this, void 0, void 0, function() { + var params2; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, transactionHash]; + case 2: + transactionHash = _a.sent(); + params2 = { transactionHash: this.formatter.hash(transactionHash, true) }; + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var result2, receipt, blockNumber, confirmations; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getTransactionReceipt", params2)]; + case 1: + result2 = _a2.sent(); + if (result2 == null) { + if (this._emitted["t:" + transactionHash] == null) { + return [2, null]; + } + return [2, void 0]; + } + if (result2.blockHash == null) { + return [2, void 0]; + } + receipt = this.formatter.receipt(result2); + if (!(receipt.blockNumber == null)) return [3, 2]; + receipt.confirmations = 0; + return [3, 4]; + case 2: + if (!(receipt.confirmations == null)) return [3, 4]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a2.sent(); + confirmations = blockNumber - receipt.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + receipt.confirmations = confirmations; + _a2.label = 4; + case 4: + return [2, receipt]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getLogs = function(filter) { + return __awaiter(this, void 0, void 0, function() { + var params2, logs; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ filter: this._getFilter(filter) })]; + case 2: + params2 = _a.sent(); + return [4, this.perform("getLogs", params2)]; + case 3: + logs = _a.sent(); + logs.forEach(function(log) { + if (log.removed == null) { + log.removed = false; + } + }); + return [2, formatter_1.Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs)]; + } + }); + }); + }; + BaseProvider2.prototype.getEtherPrice = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [2, this.perform("getEtherPrice", {})]; + } + }); + }); + }; + BaseProvider2.prototype._getBlockTag = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, blockTag]; + case 1: + blockTag = _a.sent(); + if (!(typeof blockTag === "number" && blockTag < 0)) return [3, 3]; + if (blockTag % 1) { + logger.throwArgumentError("invalid BlockTag", "blockTag", blockTag); + } + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 2: + blockNumber = _a.sent(); + blockNumber += blockTag; + if (blockNumber < 0) { + blockNumber = 0; + } + return [2, this.formatter.blockTag(blockNumber)]; + case 3: + return [2, this.formatter.blockTag(blockTag)]; + } + }); + }); + }; + BaseProvider2.prototype.getResolver = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var address, error_9; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4, this._getResolver(name2)]; + case 1: + address = _a.sent(); + if (address == null) { + return [2, null]; + } + return [2, new Resolver(this, address, name2)]; + case 2: + error_9 = _a.sent(); + if (error_9.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + return [2, null]; + case 3: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getResolver = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var network, transaction, _a, _b, error_10; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + network = _c.sent(); + if (!network.ensAddress) { + logger.throwError("network does not support ENS", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name }); + } + transaction = { + to: network.ensAddress, + data: "0x0178b8bf" + (0, hash_1.namehash)(name2).substring(2) + }; + _c.label = 2; + case 2: + _c.trys.push([2, 4, , 5]); + _b = (_a = this.formatter).callAddress; + return [4, this.call(transaction)]; + case 3: + return [2, _b.apply(_a, [_c.sent()])]; + case 4: + error_10 = _c.sent(); + if (error_10.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + throw error_10; + case 5: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.resolveName = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var resolver; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, name2]; + case 1: + name2 = _a.sent(); + try { + return [2, Promise.resolve(this.formatter.address(name2))]; + } catch (error) { + if ((0, bytes_1.isHexString)(name2)) { + throw error; + } + } + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid ENS name", "name", name2); + } + return [4, this.getResolver(name2)]; + case 2: + resolver = _a.sent(); + if (!resolver) { + return [2, null]; + } + return [4, resolver.getAddress()]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + BaseProvider2.prototype.lookupAddress = function(address) { + return __awaiter(this, void 0, void 0, function() { + var reverseName, resolverAddress, bytes, _a, length, name2, addr; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, address]; + case 1: + address = _b.sent(); + address = this.formatter.address(address); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + return [4, this._getResolver(reverseName)]; + case 2: + resolverAddress = _b.sent(); + if (!resolverAddress) { + return [2, null]; + } + _a = bytes_1.arrayify; + return [4, this.call({ + to: resolverAddress, + data: "0x691f3431" + (0, hash_1.namehash)(reverseName).substring(2) + })]; + case 3: + bytes = _a.apply(void 0, [_b.sent()]); + if (bytes.length < 32 || !bignumber_1.BigNumber.from(bytes.slice(0, 32)).eq(32)) { + return [2, null]; + } + bytes = bytes.slice(32); + if (bytes.length < 32) { + return [2, null]; + } + length = bignumber_1.BigNumber.from(bytes.slice(0, 32)).toNumber(); + bytes = bytes.slice(32); + if (length > bytes.length) { + return [2, null]; + } + name2 = (0, strings_1.toUtf8String)(bytes.slice(0, length)); + return [4, this.resolveName(name2)]; + case 4: + addr = _b.sent(); + if (addr != address) { + return [2, null]; + } + return [2, name2]; + } + }); + }); + }; + BaseProvider2.prototype.getAvatar = function(nameOrAddress) { + return __awaiter(this, void 0, void 0, function() { + var resolver, address, reverseName, resolverAddress, avatar; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + resolver = null; + if (!(0, bytes_1.isHexString)(nameOrAddress)) return [3, 2]; + address = this.formatter.address(nameOrAddress); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + return [4, this._getResolver(reverseName)]; + case 1: + resolverAddress = _a.sent(); + if (!resolverAddress) { + return [2, null]; + } + resolver = new Resolver(this, resolverAddress, "_", address); + return [3, 4]; + case 2: + return [4, this.getResolver(nameOrAddress)]; + case 3: + resolver = _a.sent(); + if (!resolver) { + return [2, null]; + } + _a.label = 4; + case 4: + return [4, resolver.getAvatar()]; + case 5: + avatar = _a.sent(); + if (avatar == null) { + return [2, null]; + } + return [2, avatar.url]; + } + }); + }); + }; + BaseProvider2.prototype.perform = function(method, params2) { + return logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method }); + }; + BaseProvider2.prototype._startEvent = function(event) { + this.polling = this._events.filter(function(e) { + return e.pollable(); + }).length > 0; + }; + BaseProvider2.prototype._stopEvent = function(event) { + this.polling = this._events.filter(function(e) { + return e.pollable(); + }).length > 0; + }; + BaseProvider2.prototype._addEventListener = function(eventName, listener, once) { + var event = new Event(getEventTag(eventName), listener, once); + this._events.push(event); + this._startEvent(event); + return this; + }; + BaseProvider2.prototype.on = function(eventName, listener) { + return this._addEventListener(eventName, listener, false); + }; + BaseProvider2.prototype.once = function(eventName, listener) { + return this._addEventListener(eventName, listener, true); + }; + BaseProvider2.prototype.emit = function(eventName) { + var _this = this; + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + var result2 = 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(_this, args); + }, 0); + result2 = true; + if (event.once) { + stopped.push(event); + return false; + } + return true; + }); + stopped.forEach(function(event) { + _this._stopEvent(event); + }); + return result2; + }; + BaseProvider2.prototype.listenerCount = function(eventName) { + if (!eventName) { + return this._events.length; + } + var eventTag = getEventTag(eventName); + return this._events.filter(function(event) { + return event.tag === eventTag; + }).length; + }; + BaseProvider2.prototype.listeners = function(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; + }); + }; + BaseProvider2.prototype.off = function(eventName, listener) { + var _this = 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) { + _this._stopEvent(event); + }); + return this; + }; + BaseProvider2.prototype.removeAllListeners = function(eventName) { + var _this = this; + var stopped = []; + if (eventName == null) { + stopped = this._events; + this._events = []; + } else { + var eventTag_1 = getEventTag(eventName); + this._events = this._events.filter(function(event) { + if (event.tag !== eventTag_1) { + return true; + } + stopped.push(event); + return false; + }); + } + stopped.forEach(function(event) { + _this._stopEvent(event); + }); + return this; + }; + return BaseProvider2; + }(abstract_provider_1.Provider) + ); + exports2.BaseProvider = BaseProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/json-rpc-provider.js +var require_json_rpc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/json-rpc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.JsonRpcProvider = exports2.JsonRpcSigner = void 0; + var abstract_signer_1 = require_lib13(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var properties_1 = require_lib4(); + var strings_1 = require_lib9(); + var transactions_1 = require_lib15(); + var web_1 = require_lib27(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var base_provider_1 = require_base_provider(); + var errorGas = ["call", "estimateGas"]; + function checkError(method, error, params2) { + if (method === "call" && error.code === logger_1.Logger.errors.SERVER_ERROR) { + var e = error.error; + if (e && e.message.match("reverted") && (0, bytes_1.isHexString)(e.data)) { + return e.data; + } + logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { + error, + data: "0x" + }); + } + var message = error.message; + if (error.code === logger_1.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 = params2.transaction || params2.signedTransaction; + if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/nonce too low/)) { + logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/replacement transaction underpriced/)) { + logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + transaction + }); + } + if (message.match(/only replay-protected/)) { + logger.throwError("legacy pre-eip-155 transactions not supported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + error, + method, + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; + } + function timer(timeout) { + return new Promise(function(resolve) { + setTimeout(resolve, timeout); + }); + } + function getResult(payload) { + if (payload.error) { + 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 = ( + /** @class */ + function(_super) { + __extends(JsonRpcSigner2, _super); + function JsonRpcSigner2(constructorGuard, provider, addressOrIndex) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, JsonRpcSigner2); + _this = _super.call(this) || this; + if (constructorGuard !== _constructorGuard) { + throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); + } + (0, properties_1.defineReadOnly)(_this, "provider", provider); + if (addressOrIndex == null) { + addressOrIndex = 0; + } + if (typeof addressOrIndex === "string") { + (0, properties_1.defineReadOnly)(_this, "_address", _this.provider.formatter.address(addressOrIndex)); + (0, properties_1.defineReadOnly)(_this, "_index", null); + } else if (typeof addressOrIndex === "number") { + (0, properties_1.defineReadOnly)(_this, "_index", addressOrIndex); + (0, properties_1.defineReadOnly)(_this, "_address", null); + } else { + logger.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex); + } + return _this; + } + JsonRpcSigner2.prototype.connect = function(provider) { + return logger.throwError("cannot alter JSON-RPC Signer connection", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "connect" + }); + }; + JsonRpcSigner2.prototype.connectUnchecked = function() { + return new UncheckedJsonRpcSigner(_constructorGuard, this.provider, this._address || this._index); + }; + JsonRpcSigner2.prototype.getAddress = function() { + var _this = this; + if (this._address) { + return Promise.resolve(this._address); + } + return this.provider.send("eth_accounts", []).then(function(accounts) { + if (accounts.length <= _this._index) { + logger.throwError("unknown account #" + _this._index, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress" + }); + } + return _this.provider.formatter.address(accounts[_this._index]); + }); + }; + JsonRpcSigner2.prototype.sendUncheckedTransaction = function(transaction) { + var _this = this; + transaction = (0, properties_1.shallowCopy)(transaction); + var fromAddress = this.getAddress().then(function(address) { + if (address) { + address = address.toLowerCase(); + } + return address; + }); + if (transaction.gasLimit == null) { + var estimate = (0, properties_1.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(_this, void 0, void 0, function() { + var address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (to == null) { + return [2, null]; + } + return [4, this.provider.resolveName(to)]; + case 1: + address = _a.sent(); + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return [2, address]; + } + }); + }); + }); + } + return (0, properties_1.resolveProperties)({ + tx: (0, properties_1.resolveProperties)(transaction), + sender: fromAddress + }).then(function(_a) { + var tx = _a.tx, sender = _a.sender; + if (tx.from != null) { + if (tx.from.toLowerCase() !== sender) { + logger.throwArgumentError("from address mismatch", "transaction", transaction); + } + } else { + tx.from = sender; + } + var hexTx = _this.provider.constructor.hexlifyTransaction(tx, { from: true }); + return _this.provider.send("eth_sendTransaction", [hexTx]).then(function(hash) { + return hash; + }, function(error) { + return checkError("sendTransaction", error, hexTx); + }); + }); + }; + JsonRpcSigner2.prototype.signTransaction = function(transaction) { + return logger.throwError("signing transactions is unsupported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signTransaction" + }); + }; + JsonRpcSigner2.prototype.sendTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber, hash, error_1; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval)]; + case 1: + blockNumber = _a.sent(); + return [4, this.sendUncheckedTransaction(transaction)]; + case 2: + hash = _a.sent(); + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.provider.getTransaction(hash)]; + case 1: + tx = _a2.sent(); + if (tx === null) { + return [2, void 0]; + } + return [2, this.provider._wrapTransaction(tx, hash, blockNumber)]; + } + }); + }); + }, { oncePoll: this.provider })]; + case 4: + return [2, _a.sent()]; + case 5: + error_1 = _a.sent(); + error_1.transactionHash = hash; + throw error_1; + case 6: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + JsonRpcSigner2.prototype.signMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + var data, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = typeof message === "string" ? (0, strings_1.toUtf8Bytes)(message) : message; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [4, this.provider.send("personal_sign", [(0, bytes_1.hexlify)(data), address.toLowerCase()])]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype._legacySignMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + var data, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = typeof message === "string" ? (0, strings_1.toUtf8Bytes)(message) : message; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [4, this.provider.send("eth_sign", [address.toLowerCase(), (0, bytes_1.hexlify)(data)])]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype._signTypedData = function(domain, types, value) { + return __awaiter(this, void 0, void 0, function() { + var populated, address; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, hash_1._TypedDataEncoder.resolveNames(domain, types, value, function(name2) { + return _this.provider.resolveName(name2); + })]; + case 1: + populated = _a.sent(); + return [4, this.getAddress()]; + case 2: + address = _a.sent(); + return [4, this.provider.send("eth_signTypedData_v4", [ + address.toLowerCase(), + JSON.stringify(hash_1._TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ])]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype.unlock = function(password) { + return __awaiter(this, void 0, void 0, function() { + var provider, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + provider = this.provider; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [2, provider.send("personal_unlockAccount", [address.toLowerCase(), password, null])]; + } + }); + }); + }; + return JsonRpcSigner2; + }(abstract_signer_1.Signer) + ); + exports2.JsonRpcSigner = JsonRpcSigner; + var UncheckedJsonRpcSigner = ( + /** @class */ + function(_super) { + __extends(UncheckedJsonRpcSigner2, _super); + function UncheckedJsonRpcSigner2() { + return _super !== null && _super.apply(this, arguments) || this; + } + UncheckedJsonRpcSigner2.prototype.sendTransaction = function(transaction) { + var _this = this; + return this.sendUncheckedTransaction(transaction).then(function(hash) { + return { + hash, + nonce: null, + gasLimit: null, + gasPrice: null, + data: null, + value: null, + chainId: null, + confirmations: 0, + from: null, + wait: function(confirmations) { + return _this.provider.waitForTransaction(hash, confirmations); + } + }; + }); + }; + return UncheckedJsonRpcSigner2; + }(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 = ( + /** @class */ + function(_super) { + __extends(JsonRpcProvider2, _super); + function JsonRpcProvider2(url, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, JsonRpcProvider2); + var networkOrReady = network; + if (networkOrReady == null) { + networkOrReady = new Promise(function(resolve, reject) { + setTimeout(function() { + _this.detectNetwork().then(function(network2) { + resolve(network2); + }, function(error) { + reject(error); + }); + }, 0); + }); + } + _this = _super.call(this, networkOrReady) || this; + if (!url) { + url = (0, properties_1.getStatic)(_this.constructor, "defaultUrl")(); + } + if (typeof url === "string") { + (0, properties_1.defineReadOnly)(_this, "connection", Object.freeze({ + url + })); + } else { + (0, properties_1.defineReadOnly)(_this, "connection", Object.freeze((0, properties_1.shallowCopy)(url))); + } + _this._nextId = 42; + return _this; + } + Object.defineProperty(JsonRpcProvider2.prototype, "_cache", { + get: function() { + if (this._eventLoopCache == null) { + this._eventLoopCache = {}; + } + return this._eventLoopCache; + }, + enumerable: false, + configurable: true + }); + JsonRpcProvider2.defaultUrl = function() { + return "http://localhost:8545"; + }; + JsonRpcProvider2.prototype.detectNetwork = function() { + var _this = this; + if (!this._cache["detectNetwork"]) { + this._cache["detectNetwork"] = this._uncachedDetectNetwork(); + setTimeout(function() { + _this._cache["detectNetwork"] = null; + }, 0); + } + return this._cache["detectNetwork"]; + }; + JsonRpcProvider2.prototype._uncachedDetectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var chainId, error_2, error_3, getNetwork; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, timer(0)]; + case 1: + _a.sent(); + chainId = null; + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 9]); + return [4, this.send("eth_chainId", [])]; + case 3: + chainId = _a.sent(); + return [3, 9]; + case 4: + error_2 = _a.sent(); + _a.label = 5; + case 5: + _a.trys.push([5, 7, , 8]); + return [4, this.send("net_version", [])]; + case 6: + chainId = _a.sent(); + return [3, 8]; + case 7: + error_3 = _a.sent(); + return [3, 8]; + case 8: + return [3, 9]; + case 9: + if (chainId != null) { + getNetwork = (0, properties_1.getStatic)(this.constructor, "getNetwork"); + try { + return [2, getNetwork(bignumber_1.BigNumber.from(chainId).toNumber())]; + } catch (error) { + return [2, logger.throwError("could not detect network", logger_1.Logger.errors.NETWORK_ERROR, { + chainId, + event: "invalidNetwork", + serverError: error + })]; + } + } + return [2, logger.throwError("could not detect network", logger_1.Logger.errors.NETWORK_ERROR, { + event: "noNetwork" + })]; + } + }); + }); + }; + JsonRpcProvider2.prototype.getSigner = function(addressOrIndex) { + return new JsonRpcSigner(_constructorGuard, this, addressOrIndex); + }; + JsonRpcProvider2.prototype.getUncheckedSigner = function(addressOrIndex) { + return this.getSigner(addressOrIndex).connectUnchecked(); + }; + JsonRpcProvider2.prototype.listAccounts = function() { + var _this = this; + return this.send("eth_accounts", []).then(function(accounts) { + return accounts.map(function(a) { + return _this.formatter.address(a); + }); + }); + }; + JsonRpcProvider2.prototype.send = function(method, params2) { + var _this = this; + var request = { + method, + params: params2, + id: this._nextId++, + jsonrpc: "2.0" + }; + this.emit("debug", { + action: "request", + request: (0, properties_1.deepCopy)(request), + provider: this + }); + var cache = ["eth_chainId", "eth_blockNumber"].indexOf(method) >= 0; + if (cache && this._cache[method]) { + return this._cache[method]; + } + var result2 = (0, web_1.fetchJson)(this.connection, JSON.stringify(request), getResult).then(function(result3) { + _this.emit("debug", { + action: "response", + request, + response: result3, + provider: _this + }); + return result3; + }, function(error) { + _this.emit("debug", { + action: "response", + error, + request, + provider: _this + }); + throw error; + }); + if (cache) { + this._cache[method] = result2; + setTimeout(function() { + _this._cache[method] = null; + }, 0); + } + return result2; + }; + JsonRpcProvider2.prototype.prepareRequest = function(method, params2) { + switch (method) { + case "getBlockNumber": + return ["eth_blockNumber", []]; + case "getGasPrice": + return ["eth_gasPrice", []]; + case "getBalance": + return ["eth_getBalance", [getLowerCase(params2.address), params2.blockTag]]; + case "getTransactionCount": + return ["eth_getTransactionCount", [getLowerCase(params2.address), params2.blockTag]]; + case "getCode": + return ["eth_getCode", [getLowerCase(params2.address), params2.blockTag]]; + case "getStorageAt": + return ["eth_getStorageAt", [getLowerCase(params2.address), params2.position, params2.blockTag]]; + case "sendTransaction": + return ["eth_sendRawTransaction", [params2.signedTransaction]]; + case "getBlock": + if (params2.blockTag) { + return ["eth_getBlockByNumber", [params2.blockTag, !!params2.includeTransactions]]; + } else if (params2.blockHash) { + return ["eth_getBlockByHash", [params2.blockHash, !!params2.includeTransactions]]; + } + return null; + case "getTransaction": + return ["eth_getTransactionByHash", [params2.transactionHash]]; + case "getTransactionReceipt": + return ["eth_getTransactionReceipt", [params2.transactionHash]]; + case "call": { + var hexlifyTransaction = (0, properties_1.getStatic)(this.constructor, "hexlifyTransaction"); + return ["eth_call", [hexlifyTransaction(params2.transaction, { from: true }), params2.blockTag]]; + } + case "estimateGas": { + var hexlifyTransaction = (0, properties_1.getStatic)(this.constructor, "hexlifyTransaction"); + return ["eth_estimateGas", [hexlifyTransaction(params2.transaction, { from: true })]]; + } + case "getLogs": + if (params2.filter && params2.filter.address != null) { + params2.filter.address = getLowerCase(params2.filter.address); + } + return ["eth_getLogs", [params2.filter]]; + default: + break; + } + return null; + }; + JsonRpcProvider2.prototype.perform = function(method, params2) { + return __awaiter(this, void 0, void 0, function() { + var tx, feeData, args, error_4; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "call" || method === "estimateGas")) return [3, 2]; + tx = params2.transaction; + if (!(tx && tx.type != null && bignumber_1.BigNumber.from(tx.type).isZero())) return [3, 2]; + if (!(tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null)) return [3, 2]; + return [4, this.getFeeData()]; + case 1: + feeData = _a.sent(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + params2 = (0, properties_1.shallowCopy)(params2); + params2.transaction = (0, properties_1.shallowCopy)(tx); + delete params2.transaction.type; + } + _a.label = 2; + case 2: + args = this.prepareRequest(method, params2); + if (args == null) { + logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method }); + } + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, this.send(args[0], args[1])]; + case 4: + return [2, _a.sent()]; + case 5: + error_4 = _a.sent(); + return [2, checkError(method, error_4, params2)]; + case 6: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + JsonRpcProvider2.prototype._startEvent = function(event) { + if (event.tag === "pending") { + this._startPending(); + } + _super.prototype._startEvent.call(this, event); + }; + JsonRpcProvider2.prototype._startPending = function() { + if (this._pendingFilter != null) { + return; + } + var self2 = this; + var pendingFilter = this.send("eth_newPendingTransactionFilter", []); + this._pendingFilter = pendingFilter; + pendingFilter.then(function(filterId) { + function poll() { + self2.send("eth_getFilterChanges", [filterId]).then(function(hashes) { + if (self2._pendingFilter != pendingFilter) { + return null; + } + var seq = Promise.resolve(); + hashes.forEach(function(hash) { + self2._emitted["t:" + hash.toLowerCase()] = "pending"; + seq = seq.then(function() { + return self2.getTransaction(hash).then(function(tx) { + self2.emit("pending", tx); + return null; + }); + }); + }); + return seq.then(function() { + return timer(1e3); + }); + }).then(function() { + if (self2._pendingFilter != pendingFilter) { + self2.send("eth_uninstallFilter", [filterId]); + return; + } + setTimeout(function() { + poll(); + }, 0); + return null; + }).catch(function(error) { + }); + } + poll(); + return filterId; + }).catch(function(error) { + }); + }; + JsonRpcProvider2.prototype._stopEvent = function(event) { + if (event.tag === "pending" && this.listenerCount("pending") === 0) { + this._pendingFilter = null; + } + _super.prototype._stopEvent.call(this, event); + }; + JsonRpcProvider2.hexlifyTransaction = function(transaction, allowExtra) { + var allowed = (0, properties_1.shallowCopy)(allowedTransactionKeys); + if (allowExtra) { + for (var key in allowExtra) { + if (allowExtra[key]) { + allowed[key] = true; + } + } + } + (0, properties_1.checkProperties)(transaction, allowed); + var result2 = {}; + ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + var value = (0, bytes_1.hexValue)(transaction[key2]); + if (key2 === "gasLimit") { + key2 = "gas"; + } + result2[key2] = value; + }); + ["from", "to", "data"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + result2[key2] = (0, bytes_1.hexlify)(transaction[key2]); + }); + if (transaction.accessList) { + result2["accessList"] = (0, transactions_1.accessListify)(transaction.accessList); + } + return result2; + }; + return JsonRpcProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.JsonRpcProvider = JsonRpcProvider; + } +}); + +// node_modules/ws/lib/constants.js +var require_constants = __commonJS({ + "node_modules/ws/lib/constants.js"(exports2, module2) { + "use strict"; + module2.exports = { + BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"], + GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", + kStatusCode: Symbol("status-code"), + kWebSocket: Symbol("websocket"), + EMPTY_BUFFER: Buffer.alloc(0), + NOOP: () => { + } + }; + } +}); + +// node_modules/ws/lib/buffer-util.js +var require_buffer_util = __commonJS({ + "node_modules/ws/lib/buffer-util.js"(exports2, module2) { + "use strict"; + var { EMPTY_BUFFER } = require_constants(); + function concat(list, totalLength) { + if (list.length === 0) return EMPTY_BUFFER; + if (list.length === 1) return list[0]; + const target = Buffer.allocUnsafe(totalLength); + let offset = 0; + for (let i = 0; i < list.length; i++) { + const buf = list[i]; + target.set(buf, offset); + offset += buf.length; + } + if (offset < totalLength) return target.slice(0, offset); + return target; + } + function _mask(source, mask, output, offset, length) { + for (let i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } + } + function _unmask(buffer, mask) { + const length = buffer.length; + for (let i = 0; i < length; i++) { + buffer[i] ^= mask[i & 3]; + } + } + function toArrayBuffer(buf) { + if (buf.byteLength === buf.buffer.byteLength) { + return buf.buffer; + } + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + } + function toBuffer(data) { + toBuffer.readOnly = true; + if (Buffer.isBuffer(data)) return data; + let buf; + if (data instanceof ArrayBuffer) { + buf = Buffer.from(data); + } else if (ArrayBuffer.isView(data)) { + buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength); + } else { + buf = Buffer.from(data); + toBuffer.readOnly = false; + } + return buf; + } + try { + const bufferUtil = require("bufferutil"); + const bu = bufferUtil.BufferUtil || bufferUtil; + module2.exports = { + concat, + mask(source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bu.mask(source, mask, output, offset, length); + }, + toArrayBuffer, + toBuffer, + unmask(buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bu.unmask(buffer, mask); + } + }; + } catch (e) { + module2.exports = { + concat, + mask: _mask, + toArrayBuffer, + toBuffer, + unmask: _unmask + }; + } + } +}); + +// node_modules/ws/lib/limiter.js +var require_limiter = __commonJS({ + "node_modules/ws/lib/limiter.js"(exports2, module2) { + "use strict"; + var kDone = Symbol("kDone"); + var kRun = Symbol("kRun"); + var Limiter = class { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(concurrency) { + this[kDone] = () => { + this.pending--; + this[kRun](); + }; + this.concurrency = concurrency || Infinity; + this.jobs = []; + this.pending = 0; + } + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(job) { + this.jobs.push(job); + this[kRun](); + } + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [kRun]() { + if (this.pending === this.concurrency) return; + if (this.jobs.length) { + const job = this.jobs.shift(); + this.pending++; + job(this[kDone]); + } + } + }; + module2.exports = Limiter; + } +}); + +// node_modules/ws/lib/permessage-deflate.js +var require_permessage_deflate = __commonJS({ + "node_modules/ws/lib/permessage-deflate.js"(exports2, module2) { + "use strict"; + var zlib = require("zlib"); + var bufferUtil = require_buffer_util(); + var Limiter = require_limiter(); + var { kStatusCode, NOOP } = require_constants(); + var TRAILER = Buffer.from([0, 0, 255, 255]); + var kPerMessageDeflate = Symbol("permessage-deflate"); + var kTotalLength = Symbol("total-length"); + var kCallback = Symbol("callback"); + var kBuffers = Symbol("buffers"); + var kError = Symbol("error"); + var zlibLimiter; + var PerMessageDeflate = class { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + this.params = null; + if (!zlibLimiter) { + const concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10; + zlibLimiter = new Limiter(concurrency); + } + } + /** + * @type {String} + */ + static get extensionName() { + return "permessage-deflate"; + } + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params2 = {}; + if (this._options.serverNoContextTakeover) { + params2.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params2.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params2.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params2.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params2.client_max_window_bits = true; + } + return params2; + } + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations); + return this.params; + } + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + if (this._deflate) { + const callback = this._deflate[kCallback]; + this._deflate.close(); + this._deflate = null; + if (callback) { + callback( + new Error( + "The deflate stream was closed while data was being processed" + ) + ); + } + } + } + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params2) => { + if (opts.serverNoContextTakeover === false && params2.server_no_context_takeover || params2.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params2.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params2.client_max_window_bits) { + return false; + } + return true; + }); + if (!accepted) { + throw new Error("None of the extension offers can be accepted"); + } + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === "number") { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === "number") { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) { + delete accepted.client_max_window_bits; + } + return accepted; + } + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params2 = response[0]; + if (this._options.clientNoContextTakeover === false && params2.client_no_context_takeover) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + if (!params2.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === "number") { + params2.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params2.client_max_window_bits > this._options.clientMaxWindowBits) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + return params2; + } + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params2) => { + Object.keys(params2).forEach((key) => { + let value = params2[key]; + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + value = value[0]; + if (key === "client_max_window_bits") { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === "server_max_window_bits") { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + params2[key] = value; + }); + }); + return configurations; + } + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.add((done) => { + this._decompress(data, fin, (err, result2) => { + done(); + callback(err, result2); + }); + }); + } + /** + * Compress data. Concurrency limited. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.add((done) => { + this._compress(data, fin, (err, result2) => { + done(); + callback(err, result2); + }); + }); + } + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? "client" : "server"; + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key]; + this._inflate = zlib.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits + }); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on("error", inflateOnError); + this._inflate.on("data", inflateOnData); + } + this._inflate[kCallback] = callback; + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + this._inflate.flush(() => { + const err = this._inflate[kError]; + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + const data2 = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + if (this._inflate._readableState.endEmitted) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.reset(); + } + } + callback(null, data2); + }); + } + /** + * Compress data. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + const endpoint = this._isServer ? "server" : "client"; + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key]; + this._deflate = zlib.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits + }); + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + this._deflate.on("error", NOOP); + this._deflate.on("data", deflateOnData); + } + this._deflate[kCallback] = callback; + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + return; + } + let data2 = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + if (fin) data2 = data2.slice(0, data2.length - 4); + this._deflate[kCallback] = null; + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.reset(); + } + callback(null, data2); + }); + } + }; + module2.exports = PerMessageDeflate; + function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; + } + function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) { + this[kBuffers].push(chunk); + return; + } + this[kError] = new RangeError("Max payload size exceeded"); + this[kError][kStatusCode] = 1009; + this.removeListener("data", inflateOnData); + this.reset(); + } + function inflateOnError(err) { + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); + } + } +}); + +// node_modules/ws/lib/validation.js +var require_validation = __commonJS({ + "node_modules/ws/lib/validation.js"(exports2, module2) { + "use strict"; + function isValidStatusCode(code) { + return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999; + } + function _isValidUTF8(buf) { + const len = buf.length; + let i = 0; + while (i < len) { + if ((buf[i] & 128) === 0) { + i++; + } else if ((buf[i] & 224) === 192) { + if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) { + return false; + } + i += 2; + } else if ((buf[i] & 240) === 224) { + if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || // Overlong + buf[i] === 237 && (buf[i + 1] & 224) === 160) { + return false; + } + i += 3; + } else if ((buf[i] & 248) === 240) { + if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || // Overlong + buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) { + return false; + } + i += 4; + } else { + return false; + } + } + return true; + } + try { + let isValidUTF8 = require("utf-8-validate"); + if (typeof isValidUTF8 === "object") { + isValidUTF8 = isValidUTF8.Validation.isValidUTF8; + } + module2.exports = { + isValidStatusCode, + isValidUTF8(buf) { + return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf); + } + }; + } catch (e) { + module2.exports = { + isValidStatusCode, + isValidUTF8: _isValidUTF8 + }; + } + } +}); + +// node_modules/ws/lib/receiver.js +var require_receiver = __commonJS({ + "node_modules/ws/lib/receiver.js"(exports2, module2) { + "use strict"; + var { Writable } = require("stream"); + var PerMessageDeflate = require_permessage_deflate(); + var { + BINARY_TYPES, + EMPTY_BUFFER, + kStatusCode, + kWebSocket + } = require_constants(); + var { concat, toArrayBuffer, unmask } = require_buffer_util(); + var { isValidStatusCode, isValidUTF8 } = require_validation(); + var GET_INFO = 0; + var GET_PAYLOAD_LENGTH_16 = 1; + var GET_PAYLOAD_LENGTH_64 = 2; + var GET_MASK = 3; + var GET_DATA = 4; + var INFLATING = 5; + var Receiver = class extends Writable { + /** + * Creates a Receiver instance. + * + * @param {String} [binaryType=nodebuffer] The type for binary data + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Boolean} [isServer=false] Specifies whether to operate in client or + * server mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(binaryType, extensions, isServer, maxPayload) { + super(); + this._binaryType = binaryType || BINARY_TYPES[0]; + this[kWebSocket] = void 0; + this._extensions = extensions || {}; + this._isServer = !!isServer; + this._maxPayload = maxPayload | 0; + this._bufferedBytes = 0; + this._buffers = []; + this._compressed = false; + this._payloadLength = 0; + this._mask = void 0; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + this._state = GET_INFO; + this._loop = false; + } + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(chunk, encoding, cb) { + if (this._opcode === 8 && this._state == GET_INFO) return cb(); + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + if (n === this._buffers[0].length) return this._buffers.shift(); + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = buf.slice(n); + return buf.slice(0, n); + } + const dst = Buffer.allocUnsafe(n); + do { + const buf = this._buffers[0]; + const offset = dst.length - n; + if (n >= buf.length) { + dst.set(this._buffers.shift(), offset); + } else { + dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); + this._buffers[0] = buf.slice(n); + } + n -= buf.length; + } while (n > 0); + return dst; + } + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + let err; + this._loop = true; + do { + switch (this._state) { + case GET_INFO: + err = this.getInfo(); + break; + case GET_PAYLOAD_LENGTH_16: + err = this.getPayloadLength16(); + break; + case GET_PAYLOAD_LENGTH_64: + err = this.getPayloadLength64(); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + err = this.getData(cb); + break; + default: + this._loop = false; + return; + } + } while (this._loop); + cb(err); + } + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + const buf = this.consume(2); + if ((buf[0] & 48) !== 0) { + this._loop = false; + return error(RangeError, "RSV2 and RSV3 must be clear", true, 1002); + } + const compressed = (buf[0] & 64) === 64; + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + this._fin = (buf[0] & 128) === 128; + this._opcode = buf[0] & 15; + this._payloadLength = buf[1] & 127; + if (this._opcode === 0) { + if (compressed) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + if (!this._fragmented) { + this._loop = false; + return error(RangeError, "invalid opcode 0", true, 1002); + } + this._opcode = this._fragmented; + } else if (this._opcode === 1 || this._opcode === 2) { + if (this._fragmented) { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + this._compressed = compressed; + } else if (this._opcode > 7 && this._opcode < 11) { + if (!this._fin) { + this._loop = false; + return error(RangeError, "FIN must be set", true, 1002); + } + if (compressed) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + if (this._payloadLength > 125) { + this._loop = false; + return error( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002 + ); + } + } else { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 128) === 128; + if (this._isServer) { + if (!this._masked) { + this._loop = false; + return error(RangeError, "MASK must be set", true, 1002); + } + } else if (this._masked) { + this._loop = false; + return error(RangeError, "MASK must be clear", true, 1002); + } + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else return this.haveLength(); + } + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + this._payloadLength = this.consume(2).readUInt16BE(0); + return this.haveLength(); + } + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + if (num > Math.pow(2, 53 - 32) - 1) { + this._loop = false; + return error( + RangeError, + "Unsupported WebSocket frame: payload length > 2^53 - 1", + false, + 1009 + ); + } + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + return this.haveLength(); + } + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 8) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + this._loop = false; + return error(RangeError, "Max payload size exceeded", false, 1009); + } + } + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + this._mask = this.consume(4); + this._state = GET_DATA; + } + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(cb) { + let data = EMPTY_BUFFER; + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + data = this.consume(this._payloadLength); + if (this._masked) unmask(data, this._mask); + } + if (this._opcode > 7) return this.controlMessage(data); + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + if (data.length) { + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + return this.dataMessage(); + } + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + return cb( + error(RangeError, "Max payload size exceeded", false, 1009) + ); + } + this._fragments.push(buf); + } + const er = this.dataMessage(); + if (er) return cb(er); + this.startLoop(cb); + }); + } + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const messageLength = this._messageLength; + const fragments = this._fragments; + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + if (this._opcode === 2) { + let data; + if (this._binaryType === "nodebuffer") { + data = concat(fragments, messageLength); + } else if (this._binaryType === "arraybuffer") { + data = toArrayBuffer(concat(fragments, messageLength)); + } else { + data = fragments; + } + this.emit("message", data); + } else { + const buf = concat(fragments, messageLength); + if (!isValidUTF8(buf)) { + this._loop = false; + return error(Error, "invalid UTF-8 sequence", true, 1007); + } + this.emit("message", buf.toString()); + } + } + this._state = GET_INFO; + } + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data) { + if (this._opcode === 8) { + this._loop = false; + if (data.length === 0) { + this.emit("conclude", 1005, ""); + this.end(); + } else if (data.length === 1) { + return error(RangeError, "invalid payload length 1", true, 1002); + } else { + const code = data.readUInt16BE(0); + if (!isValidStatusCode(code)) { + return error(RangeError, `invalid status code ${code}`, true, 1002); + } + const buf = data.slice(2); + if (!isValidUTF8(buf)) { + return error(Error, "invalid UTF-8 sequence", true, 1007); + } + this.emit("conclude", code, buf.toString()); + this.end(); + } + } else if (this._opcode === 9) { + this.emit("ping", data); + } else { + this.emit("pong", data); + } + this._state = GET_INFO; + } + }; + module2.exports = Receiver; + function error(ErrorCtor, message, prefix, statusCode) { + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + Error.captureStackTrace(err, error); + err[kStatusCode] = statusCode; + return err; + } + } +}); + +// node_modules/ws/lib/sender.js +var require_sender = __commonJS({ + "node_modules/ws/lib/sender.js"(exports2, module2) { + "use strict"; + var { randomFillSync } = require("crypto"); + var PerMessageDeflate = require_permessage_deflate(); + var { EMPTY_BUFFER } = require_constants(); + var { isValidStatusCode } = require_validation(); + var { mask: applyMask, toBuffer } = require_buffer_util(); + var mask = Buffer.alloc(4); + var Sender = class _Sender { + /** + * Creates a Sender instance. + * + * @param {net.Socket} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + */ + constructor(socket, extensions) { + this._extensions = extensions || {}; + this._socket = socket; + this._firstFragment = true; + this._compress = false; + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {Buffer} data The data to frame + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {Buffer[]} The framed data as a list of `Buffer` instances + * @public + */ + static frame(data, options) { + const merge = options.mask && options.readOnly; + let offset = options.mask ? 6 : 2; + let payloadLength = data.length; + if (data.length >= 65536) { + offset += 8; + payloadLength = 127; + } else if (data.length > 125) { + offset += 2; + payloadLength = 126; + } + const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); + target[0] = options.fin ? options.opcode | 128 : options.opcode; + if (options.rsv1) target[0] |= 64; + target[1] = payloadLength; + if (payloadLength === 126) { + target.writeUInt16BE(data.length, 2); + } else if (payloadLength === 127) { + target.writeUInt32BE(0, 2); + target.writeUInt32BE(data.length, 6); + } + if (!options.mask) return [target, data]; + randomFillSync(mask, 0, 4); + target[1] |= 128; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + if (merge) { + applyMask(data, mask, target, offset, data.length); + return [target]; + } + applyMask(data, mask, data, 0, data.length); + return [target, data]; + } + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {String} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(code, data, mask2, cb) { + let buf; + if (code === void 0) { + buf = EMPTY_BUFFER; + } else if (typeof code !== "number" || !isValidStatusCode(code)) { + throw new TypeError("First argument must be a valid error code number"); + } else if (data === void 0 || data === "") { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + const length = Buffer.byteLength(data); + if (length > 123) { + throw new RangeError("The message must not be greater than 123 bytes"); + } + buf = Buffer.allocUnsafe(2 + length); + buf.writeUInt16BE(code, 0); + buf.write(data, 2); + } + if (this._deflating) { + this.enqueue([this.doClose, buf, mask2, cb]); + } else { + this.doClose(buf, mask2, cb); + } + } + /** + * Frames and sends a close message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @private + */ + doClose(data, mask2, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 8, + mask: mask2, + readOnly: false + }), + cb + ); + } + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(data, mask2, cb) { + const buf = toBuffer(data); + if (buf.length > 125) { + throw new RangeError("The data size must not be greater than 125 bytes"); + } + if (this._deflating) { + this.enqueue([this.doPing, buf, mask2, toBuffer.readOnly, cb]); + } else { + this.doPing(buf, mask2, toBuffer.readOnly, cb); + } + } + /** + * Frames and sends a ping message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified + * @param {Function} [cb] Callback + * @private + */ + doPing(data, mask2, readOnly, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 9, + mask: mask2, + readOnly + }), + cb + ); + } + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(data, mask2, cb) { + const buf = toBuffer(data); + if (buf.length > 125) { + throw new RangeError("The data size must not be greater than 125 bytes"); + } + if (this._deflating) { + this.enqueue([this.doPong, buf, mask2, toBuffer.readOnly, cb]); + } else { + this.doPong(buf, mask2, toBuffer.readOnly, cb); + } + } + /** + * Frames and sends a pong message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified + * @param {Function} [cb] Callback + * @private + */ + doPong(data, mask2, readOnly, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 10, + mask: mask2, + readOnly + }), + cb + ); + } + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(data, options, cb) { + const buf = toBuffer(data); + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + let opcode = options.binary ? 2 : 1; + let rsv1 = options.compress; + if (this._firstFragment) { + this._firstFragment = false; + if (rsv1 && perMessageDeflate) { + rsv1 = buf.length >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + if (options.fin) this._firstFragment = true; + if (perMessageDeflate) { + const opts = { + fin: options.fin, + rsv1, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }; + if (this._deflating) { + this.enqueue([this.dispatch, buf, this._compress, opts, cb]); + } else { + this.dispatch(buf, this._compress, opts, cb); + } + } else { + this.sendFrame( + _Sender.frame(buf, { + fin: options.fin, + rsv1: false, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }), + cb + ); + } + } + /** + * Dispatches a data message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(_Sender.frame(data, options), cb); + return; + } + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + this._bufferedBytes += data.length; + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + if (this._socket.destroyed) { + const err = new Error( + "The socket was closed while data was being compressed" + ); + if (typeof cb === "function") cb(err); + for (let i = 0; i < this._queue.length; i++) { + const callback = this._queue[i][4]; + if (typeof callback === "function") callback(err); + } + return; + } + this._bufferedBytes -= data.length; + this._deflating = false; + options.readOnly = false; + this.sendFrame(_Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params2 = this._queue.shift(); + this._bufferedBytes -= params2[1].length; + Reflect.apply(params2[0], this, params2.slice(1)); + } + } + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params2) { + this._bufferedBytes += params2[1].length; + this._queue.push(params2); + } + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.cork(); + this._socket.write(list[0]); + this._socket.write(list[1], cb); + this._socket.uncork(); + } else { + this._socket.write(list[0], cb); + } + } + }; + module2.exports = Sender; + } +}); + +// node_modules/ws/lib/event-target.js +var require_event_target = __commonJS({ + "node_modules/ws/lib/event-target.js"(exports2, module2) { + "use strict"; + var Event = class { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @param {Object} target A reference to the target to which the event was + * dispatched + */ + constructor(type, target) { + this.target = target; + this.type = type; + } + }; + var MessageEvent = class extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(data, target) { + super("message", target); + this.data = data; + } + }; + var CloseEvent = class extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {Number} code The status code explaining why the connection is being + * closed + * @param {String} reason A human-readable string explaining why the + * connection is closing + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(code, reason, target) { + super("close", target); + this.wasClean = target._closeFrameReceived && target._closeFrameSent; + this.reason = reason; + this.code = code; + } + }; + var OpenEvent = class extends Event { + /** + * Create a new `OpenEvent`. + * + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(target) { + super("open", target); + } + }; + var ErrorEvent = class extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {Object} error The error that generated this event + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(error, target) { + super("error", target); + this.message = error.message; + this.error = error; + } + }; + var EventTarget = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {Function} listener The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean`` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(type, listener, options) { + if (typeof listener !== "function") return; + function onMessage(data) { + listener.call(this, new MessageEvent(data, this)); + } + function onClose(code, message) { + listener.call(this, new CloseEvent(code, message, this)); + } + function onError(error) { + listener.call(this, new ErrorEvent(error, this)); + } + function onOpen() { + listener.call(this, new OpenEvent(this)); + } + const method = options && options.once ? "once" : "on"; + if (type === "message") { + onMessage._listener = listener; + this[method](type, onMessage); + } else if (type === "close") { + onClose._listener = listener; + this[method](type, onClose); + } else if (type === "error") { + onError._listener = listener; + this[method](type, onError); + } else if (type === "open") { + onOpen._listener = listener; + this[method](type, onOpen); + } else { + this[method](type, listener); + } + }, + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {Function} listener The listener to remove + * @public + */ + removeEventListener(type, listener) { + const listeners = this.listeners(type); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i] === listener || listeners[i]._listener === listener) { + this.removeListener(type, listeners[i]); + } + } + } + }; + module2.exports = EventTarget; + } +}); + +// node_modules/ws/lib/extension.js +var require_extension = __commonJS({ + "node_modules/ws/lib/extension.js"(exports2, module2) { + "use strict"; + var tokenChars = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 0 - 15 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 16 - 31 + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + // 32 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + // 48 - 63 + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 64 - 79 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + // 80 - 95 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 96 - 111 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0 + // 112 - 127 + ]; + function push(dest, name2, elem) { + if (dest[name2] === void 0) dest[name2] = [elem]; + else dest[name2].push(elem); + } + function parse(header) { + const offers = /* @__PURE__ */ Object.create(null); + if (header === void 0 || header === "") return offers; + let params2 = /* @__PURE__ */ Object.create(null); + let mustUnescape = false; + let isEscaping = false; + let inQuotes = false; + let extensionName; + let paramName; + let start = -1; + let end = -1; + let i = 0; + for (; i < header.length; i++) { + const code = header.charCodeAt(i); + if (extensionName === void 0) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 32 || code === 9) { + if (end === -1 && start !== -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + const name2 = header.slice(start, end); + if (code === 44) { + push(offers, name2, params2); + params2 = /* @__PURE__ */ Object.create(null); + } else { + extensionName = name2; + } + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === void 0) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 32 || code === 9) { + if (end === -1 && start !== -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + push(params2, header.slice(start, end), true); + if (code === 44) { + push(offers, extensionName, params2); + params2 = /* @__PURE__ */ Object.create(null); + extensionName = void 0; + } + start = end = -1; + } else if (code === 61 && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 34 && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 92) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 34 && header.charCodeAt(i - 1) === 61) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 32 || code === 9)) { + if (end === -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + let value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ""); + mustUnescape = false; + } + push(params2, paramName, value); + if (code === 44) { + push(offers, extensionName, params2); + params2 = /* @__PURE__ */ Object.create(null); + extensionName = void 0; + } + paramName = void 0; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + if (start === -1 || inQuotes) { + throw new SyntaxError("Unexpected end of input"); + } + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === void 0) { + push(offers, token, params2); + } else { + if (paramName === void 0) { + push(params2, token, true); + } else if (mustUnescape) { + push(params2, paramName, token.replace(/\\/g, "")); + } else { + push(params2, paramName, token); + } + push(offers, extensionName, params2); + } + return offers; + } + function format(extensions) { + return Object.keys(extensions).map((extension) => { + let configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations.map((params2) => { + return [extension].concat( + Object.keys(params2).map((k) => { + let values = params2[k]; + if (!Array.isArray(values)) values = [values]; + return values.map((v) => v === true ? k : `${k}=${v}`).join("; "); + }) + ).join("; "); + }).join(", "); + }).join(", "); + } + module2.exports = { format, parse }; + } +}); + +// node_modules/ws/lib/websocket.js +var require_websocket = __commonJS({ + "node_modules/ws/lib/websocket.js"(exports2, module2) { + "use strict"; + var EventEmitter = require("events"); + var https = require("https"); + var http = require("http"); + var net = require("net"); + var tls = require("tls"); + var { randomBytes, createHash } = require("crypto"); + var { URL } = require("url"); + var PerMessageDeflate = require_permessage_deflate(); + var Receiver = require_receiver(); + var Sender = require_sender(); + var { + BINARY_TYPES, + EMPTY_BUFFER, + GUID, + kStatusCode, + kWebSocket, + NOOP + } = require_constants(); + var { addEventListener, removeEventListener } = require_event_target(); + var { format, parse } = require_extension(); + var { toBuffer } = require_buffer_util(); + var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"]; + var protocolVersions = [8, 13]; + var closeTimeout = 30 * 1e3; + var WebSocket = class _WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|url.URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(address, protocols, options) { + super(); + this._binaryType = BINARY_TYPES[0]; + this._closeCode = 1006; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = ""; + this._closeTimer = null; + this._extensions = {}; + this._protocol = ""; + this._readyState = _WebSocket.CONNECTING; + this._receiver = null; + this._sender = null; + this._socket = null; + if (address !== null) { + this._bufferedAmount = 0; + this._isServer = false; + this._redirects = 0; + if (Array.isArray(protocols)) { + protocols = protocols.join(", "); + } else if (typeof protocols === "object" && protocols !== null) { + options = protocols; + protocols = void 0; + } + initAsClient(this, address, protocols, options); + } else { + this._isServer = true; + } + } + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + set binaryType(type) { + if (!BINARY_TYPES.includes(type)) return; + this._binaryType = type; + if (this._receiver) this._receiver._binaryType = type; + } + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return this._bufferedAmount; + return this._socket._writableState.length + this._sender._bufferedBytes; + } + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + /** + * @type {String} + */ + get url() { + return this._url; + } + /** + * Set up the socket and the internal resources. + * + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Number} [maxPayload=0] The maximum allowed message size + * @private + */ + setSocket(socket, head, maxPayload) { + const receiver = new Receiver( + this.binaryType, + this._extensions, + this._isServer, + maxPayload + ); + this._sender = new Sender(socket, this._extensions); + this._receiver = receiver; + this._socket = socket; + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + receiver.on("conclude", receiverOnConclude); + receiver.on("drain", receiverOnDrain); + receiver.on("error", receiverOnError); + receiver.on("message", receiverOnMessage); + receiver.on("ping", receiverOnPing); + receiver.on("pong", receiverOnPong); + socket.setTimeout(0); + socket.setNoDelay(); + if (head.length > 0) socket.unshift(head); + socket.on("close", socketOnClose); + socket.on("data", socketOnData); + socket.on("end", socketOnEnd); + socket.on("error", socketOnError); + this._readyState = _WebSocket.OPEN; + this.emit("open"); + } + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = _WebSocket.CLOSED; + this.emit("close", this._closeCode, this._closeMessage); + return; + } + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + this._receiver.removeAllListeners(); + this._readyState = _WebSocket.CLOSED; + this.emit("close", this._closeCode, this._closeMessage); + } + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {String} [data] A string explaining why the connection is closing + * @public + */ + close(code, data) { + if (this.readyState === _WebSocket.CLOSED) return; + if (this.readyState === _WebSocket.CONNECTING) { + const msg = "WebSocket was closed before the connection was established"; + return abortHandshake(this, this._req, msg); + } + if (this.readyState === _WebSocket.CLOSING) { + if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); + return; + } + this._readyState = _WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + if (err) return; + this._closeFrameSent = true; + if (this._closeFrameReceived) this._socket.end(); + }); + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof data === "function") { + cb = data; + data = mask = void 0; + } else if (typeof mask === "function") { + cb = mask; + mask = void 0; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + if (mask === void 0) mask = !this._isServer; + this._sender.ping(data || EMPTY_BUFFER, mask, cb); + } + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof data === "function") { + cb = data; + data = mask = void 0; + } else if (typeof mask === "function") { + cb = mask; + mask = void 0; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + if (mask === void 0) mask = !this._isServer; + this._sender.pong(data || EMPTY_BUFFER, mask, cb); + } + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof options === "function") { + cb = options; + options = {}; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + const opts = { + binary: typeof data !== "string", + mask: !this._isServer, + compress: true, + fin: true, + ...options + }; + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + this._sender.send(data || EMPTY_BUFFER, opts, cb); + } + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === _WebSocket.CLOSED) return; + if (this.readyState === _WebSocket.CONNECTING) { + const msg = "WebSocket was closed before the connection was established"; + return abortHandshake(this, this._req, msg); + } + if (this._socket) { + this._readyState = _WebSocket.CLOSING; + this._socket.destroy(); + } + } + }; + readyStates.forEach((readyState, i) => { + const descriptor = { enumerable: true, value: i }; + Object.defineProperty(WebSocket.prototype, readyState, descriptor); + Object.defineProperty(WebSocket, readyState, descriptor); + }); + [ + "binaryType", + "bufferedAmount", + "extensions", + "protocol", + "readyState", + "url" + ].forEach((property) => { + Object.defineProperty(WebSocket.prototype, property, { enumerable: true }); + }); + ["open", "error", "close", "message"].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + configurable: true, + enumerable: true, + /** + * Return the listener of the event. + * + * @return {(Function|undefined)} The event listener or `undefined` + * @public + */ + get() { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) return listeners[i]._listener; + } + return void 0; + }, + /** + * Add a listener for the event. + * + * @param {Function} listener The listener to add + * @public + */ + set(listener) { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) this.removeListener(method, listeners[i]); + } + this.addEventListener(method, listener); + } + }); + }); + WebSocket.prototype.addEventListener = addEventListener; + WebSocket.prototype.removeEventListener = removeEventListener; + module2.exports = WebSocket; + function initAsClient(websocket, address, protocols, options) { + const opts = { + protocolVersion: protocolVersions[1], + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: true, + followRedirects: false, + maxRedirects: 10, + ...options, + createConnection: void 0, + socketPath: void 0, + hostname: void 0, + protocol: void 0, + timeout: void 0, + method: void 0, + host: void 0, + path: void 0, + port: void 0 + }; + if (!protocolVersions.includes(opts.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})` + ); + } + let parsedUrl; + if (address instanceof URL) { + parsedUrl = address; + websocket._url = address.href; + } else { + parsedUrl = new URL(address); + websocket._url = address; + } + const isUnixSocket = parsedUrl.protocol === "ws+unix:"; + if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { + throw new Error(`Invalid URL: ${websocket.url}`); + } + const isSecure = parsedUrl.protocol === "wss:" || parsedUrl.protocol === "https:"; + const defaultPort = isSecure ? 443 : 80; + const key = randomBytes(16).toString("base64"); + const get = isSecure ? https.get : http.get; + let perMessageDeflate; + opts.createConnection = isSecure ? tlsConnect : netConnect; + opts.defaultPort = opts.defaultPort || defaultPort; + opts.port = parsedUrl.port || defaultPort; + opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname; + opts.headers = { + "Sec-WebSocket-Version": opts.protocolVersion, + "Sec-WebSocket-Key": key, + Connection: "Upgrade", + Upgrade: "websocket", + ...opts.headers + }; + opts.path = parsedUrl.pathname + parsedUrl.search; + opts.timeout = opts.handshakeTimeout; + if (opts.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, + false, + opts.maxPayload + ); + opts.headers["Sec-WebSocket-Extensions"] = format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols) { + opts.headers["Sec-WebSocket-Protocol"] = protocols; + } + if (opts.origin) { + if (opts.protocolVersion < 13) { + opts.headers["Sec-WebSocket-Origin"] = opts.origin; + } else { + opts.headers.Origin = opts.origin; + } + } + if (parsedUrl.username || parsedUrl.password) { + opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + if (isUnixSocket) { + const parts = opts.path.split(":"); + opts.socketPath = parts[0]; + opts.path = parts[1]; + } + let req = websocket._req = get(opts); + if (opts.timeout) { + req.on("timeout", () => { + abortHandshake(websocket, req, "Opening handshake has timed out"); + }); + } + req.on("error", (err) => { + if (req === null || req.aborted) return; + req = websocket._req = null; + websocket._readyState = WebSocket.CLOSING; + websocket.emit("error", err); + websocket.emitClose(); + }); + req.on("response", (res) => { + const location = res.headers.location; + const statusCode = res.statusCode; + if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) { + if (++websocket._redirects > opts.maxRedirects) { + abortHandshake(websocket, req, "Maximum redirects exceeded"); + return; + } + req.abort(); + const addr = new URL(location, address); + initAsClient(websocket, addr, protocols, options); + } else if (!websocket.emit("unexpected-response", req, res)) { + abortHandshake( + websocket, + req, + `Unexpected server response: ${res.statusCode}` + ); + } + }); + req.on("upgrade", (res, socket, head) => { + websocket.emit("upgrade", res); + if (websocket.readyState !== WebSocket.CONNECTING) return; + req = websocket._req = null; + const digest = createHash("sha1").update(key + GUID).digest("base64"); + if (res.headers["sec-websocket-accept"] !== digest) { + abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header"); + return; + } + const serverProt = res.headers["sec-websocket-protocol"]; + const protList = (protocols || "").split(/, */); + let protError; + if (!protocols && serverProt) { + protError = "Server sent a subprotocol but none was requested"; + } else if (protocols && !serverProt) { + protError = "Server sent no subprotocol"; + } else if (serverProt && !protList.includes(serverProt)) { + protError = "Server sent an invalid subprotocol"; + } + if (protError) { + abortHandshake(websocket, socket, protError); + return; + } + if (serverProt) websocket._protocol = serverProt; + if (perMessageDeflate) { + try { + const extensions = parse(res.headers["sec-websocket-extensions"]); + if (extensions[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + abortHandshake( + websocket, + socket, + "Invalid Sec-WebSocket-Extensions header" + ); + return; + } + } + websocket.setSocket(socket, head, opts.maxPayload); + }); + } + function netConnect(options) { + options.path = options.socketPath; + return net.connect(options); + } + function tlsConnect(options) { + options.path = void 0; + if (!options.servername && options.servername !== "") { + options.servername = net.isIP(options.host) ? "" : options.host; + } + return tls.connect(options); + } + function abortHandshake(websocket, stream, message) { + websocket._readyState = WebSocket.CLOSING; + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + if (stream.setHeader) { + stream.abort(); + if (stream.socket && !stream.socket.destroyed) { + stream.socket.destroy(); + } + stream.once("abort", websocket.emitClose.bind(websocket)); + websocket.emit("error", err); + } else { + stream.destroy(err); + stream.once("error", websocket.emit.bind(websocket, "error")); + stream.once("close", websocket.emitClose.bind(websocket)); + } + } + function sendAfterClose(websocket, data, cb) { + if (data) { + const length = toBuffer(data).length; + if (websocket._socket) websocket._sender._bufferedBytes += length; + else websocket._bufferedAmount += length; + } + if (cb) { + const err = new Error( + `WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})` + ); + cb(err); + } + } + function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + websocket._socket.removeListener("data", socketOnData); + websocket._socket.resume(); + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + if (code === 1005) websocket.close(); + else websocket.close(code, reason); + } + function receiverOnDrain() { + this[kWebSocket]._socket.resume(); + } + function receiverOnError(err) { + const websocket = this[kWebSocket]; + websocket._socket.removeListener("data", socketOnData); + websocket._readyState = WebSocket.CLOSING; + websocket._closeCode = err[kStatusCode]; + websocket.emit("error", err); + websocket._socket.destroy(); + } + function receiverOnFinish() { + this[kWebSocket].emitClose(); + } + function receiverOnMessage(data) { + this[kWebSocket].emit("message", data); + } + function receiverOnPing(data) { + const websocket = this[kWebSocket]; + websocket.pong(data, !websocket._isServer, NOOP); + websocket.emit("ping", data); + } + function receiverOnPong(data) { + this[kWebSocket].emit("pong", data); + } + function socketOnClose() { + const websocket = this[kWebSocket]; + this.removeListener("close", socketOnClose); + this.removeListener("end", socketOnEnd); + websocket._readyState = WebSocket.CLOSING; + websocket._socket.read(); + websocket._receiver.end(); + this.removeListener("data", socketOnData); + this[kWebSocket] = void 0; + clearTimeout(websocket._closeTimer); + if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) { + websocket.emitClose(); + } else { + websocket._receiver.on("error", receiverOnFinish); + websocket._receiver.on("finish", receiverOnFinish); + } + } + function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } + } + function socketOnEnd() { + const websocket = this[kWebSocket]; + websocket._readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); + } + function socketOnError() { + const websocket = this[kWebSocket]; + this.removeListener("error", socketOnError); + this.on("error", NOOP); + if (websocket) { + websocket._readyState = WebSocket.CLOSING; + this.destroy(); + } + } + } +}); + +// node_modules/ws/lib/stream.js +var require_stream = __commonJS({ + "node_modules/ws/lib/stream.js"(exports2, module2) { + "use strict"; + var { Duplex } = require("stream"); + function emitClose(stream) { + stream.emit("close"); + } + function duplexOnEnd() { + if (!this.destroyed && this._writableState.finished) { + this.destroy(); + } + } + function duplexOnError(err) { + this.removeListener("error", duplexOnError); + this.destroy(); + if (this.listenerCount("error") === 0) { + this.emit("error", err); + } + } + function createWebSocketStream(ws, options) { + let resumeOnReceiverDrain = true; + function receiverOnDrain() { + if (resumeOnReceiverDrain) ws._socket.resume(); + } + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + ws._receiver.removeAllListeners("drain"); + ws._receiver.on("drain", receiverOnDrain); + }); + } else { + ws._receiver.removeAllListeners("drain"); + ws._receiver.on("drain", receiverOnDrain); + } + const duplex = new Duplex({ + ...options, + autoDestroy: false, + emitClose: false, + objectMode: false, + writableObjectMode: false + }); + ws.on("message", function message(msg) { + if (!duplex.push(msg)) { + resumeOnReceiverDrain = false; + ws._socket.pause(); + } + }); + ws.once("error", function error(err) { + if (duplex.destroyed) return; + duplex.destroy(err); + }); + ws.once("close", function close() { + if (duplex.destroyed) return; + duplex.push(null); + }); + duplex._destroy = function(err, callback) { + if (ws.readyState === ws.CLOSED) { + callback(err); + process.nextTick(emitClose, duplex); + return; + } + let called = false; + ws.once("error", function error(err2) { + called = true; + callback(err2); + }); + ws.once("close", function close() { + if (!called) callback(err); + process.nextTick(emitClose, duplex); + }); + ws.terminate(); + }; + duplex._final = function(callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + duplex._final(callback); + }); + return; + } + if (ws._socket === null) return; + if (ws._socket._writableState.finished) { + callback(); + if (duplex._readableState.endEmitted) duplex.destroy(); + } else { + ws._socket.once("finish", function finish() { + callback(); + }); + ws.close(); + } + }; + duplex._read = function() { + if (ws.readyState === ws.OPEN && !resumeOnReceiverDrain) { + resumeOnReceiverDrain = true; + if (!ws._receiver._writableState.needDrain) ws._socket.resume(); + } + }; + duplex._write = function(chunk, encoding, callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + duplex._write(chunk, encoding, callback); + }); + return; + } + ws.send(chunk, callback); + }; + duplex.on("end", duplexOnEnd); + duplex.on("error", duplexOnError); + return duplex; + } + module2.exports = createWebSocketStream; + } +}); + +// node_modules/ws/lib/websocket-server.js +var require_websocket_server = __commonJS({ + "node_modules/ws/lib/websocket-server.js"(exports2, module2) { + "use strict"; + var EventEmitter = require("events"); + var { createHash } = require("crypto"); + var { createServer, STATUS_CODES } = require("http"); + var PerMessageDeflate = require_permessage_deflate(); + var WebSocket = require_websocket(); + var { format, parse } = require_extension(); + var { GUID, kWebSocket } = require_constants(); + var keyRegex = /^[+/0-9A-Za-z]{22}==$/; + var WebSocketServer = class extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {http.Server} [options.server] A pre-created HTTP/S server to use + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(options, callback) { + super(); + options = { + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, + // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + ...options + }; + if (options.port == null && !options.server && !options.noServer) { + throw new TypeError( + 'One of the "port", "server", or "noServer" options must be specified' + ); + } + if (options.port != null) { + this._server = createServer((req, res) => { + const body = STATUS_CODES[426]; + res.writeHead(426, { + "Content-Length": body.length, + "Content-Type": "text/plain" + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + this._server = options.server; + } + if (this._server) { + const emitConnection = this.emit.bind(this, "connection"); + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, "listening"), + error: this.emit.bind(this, "error"), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, emitConnection); + } + }); + } + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) this.clients = /* @__PURE__ */ new Set(); + this.options = options; + } + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + if (!this._server) return null; + return this._server.address(); + } + /** + * Close the server. + * + * @param {Function} [cb] Callback + * @public + */ + close(cb) { + if (cb) this.once("close", cb); + if (this.clients) { + for (const client of this.clients) client.terminate(); + } + const server = this._server; + if (server) { + this._removeListeners(); + this._removeListeners = this._server = null; + if (this.options.port != null) { + server.close(() => this.emit("close")); + return; + } + } + process.nextTick(emitClose, this); + } + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf("?"); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + if (pathname !== this.options.path) return false; + } + return true; + } + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on("error", socketOnError); + const key = req.headers["sec-websocket-key"] !== void 0 ? req.headers["sec-websocket-key"].trim() : false; + const version = +req.headers["sec-websocket-version"]; + const extensions = {}; + if (req.method !== "GET" || req.headers.upgrade.toLowerCase() !== "websocket" || !key || !keyRegex.test(key) || version !== 8 && version !== 13 || !this.shouldHandle(req)) { + return abortHandshake(socket, 400); + } + if (this.options.perMessageDeflate) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + try { + const offers = parse(req.headers["sec-websocket-extensions"]); + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + return abortHandshake(socket, 400); + } + } + if (this.options.verifyClient) { + const info = { + origin: req.headers[`${version === 8 ? "sec-websocket-origin" : "origin"}`], + secure: !!(req.socket.authorized || req.socket.encrypted), + req + }; + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + this.completeUpgrade(key, extensions, req, socket, head, cb); + }); + return; + } + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + this.completeUpgrade(key, extensions, req, socket, head, cb); + } + /** + * Upgrade the connection to WebSocket. + * + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Object} extensions The accepted extensions + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(key, extensions, req, socket, head, cb) { + if (!socket.readable || !socket.writable) return socket.destroy(); + if (socket[kWebSocket]) { + throw new Error( + "server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration" + ); + } + const digest = createHash("sha1").update(key + GUID).digest("base64"); + const headers = [ + "HTTP/1.1 101 Switching Protocols", + "Upgrade: websocket", + "Connection: Upgrade", + `Sec-WebSocket-Accept: ${digest}` + ]; + const ws = new WebSocket(null); + let protocol = req.headers["sec-websocket-protocol"]; + if (protocol) { + protocol = protocol.split(",").map(trim); + if (this.options.handleProtocols) { + protocol = this.options.handleProtocols(protocol, req); + } else { + protocol = protocol[0]; + } + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws._protocol = protocol; + } + } + if (extensions[PerMessageDeflate.extensionName]) { + const params2 = extensions[PerMessageDeflate.extensionName].params; + const value = format({ + [PerMessageDeflate.extensionName]: [params2] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + this.emit("headers", headers, req); + socket.write(headers.concat("\r\n").join("\r\n")); + socket.removeListener("error", socketOnError); + ws.setSocket(socket, head, this.options.maxPayload); + if (this.clients) { + this.clients.add(ws); + ws.on("close", () => this.clients.delete(ws)); + } + cb(ws, req); + } + }; + module2.exports = WebSocketServer; + function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; + } + function emitClose(server) { + server.emit("close"); + } + function socketOnError() { + this.destroy(); + } + function abortHandshake(socket, code, message, headers) { + if (socket.writable) { + message = message || STATUS_CODES[code]; + headers = { + Connection: "close", + "Content-Type": "text/html", + "Content-Length": Buffer.byteLength(message), + ...headers + }; + socket.write( + `HTTP/1.1 ${code} ${STATUS_CODES[code]}\r +` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message + ); + } + socket.removeListener("error", socketOnError); + socket.destroy(); + } + function trim(str) { + return str.trim(); + } + } +}); + +// node_modules/ws/index.js +var require_ws = __commonJS({ + "node_modules/ws/index.js"(exports2, module2) { + "use strict"; + var WebSocket = require_websocket(); + WebSocket.createWebSocketStream = require_stream(); + WebSocket.Server = require_websocket_server(); + WebSocket.Receiver = require_receiver(); + WebSocket.Sender = require_sender(); + module2.exports = WebSocket; + } +}); + +// node_modules/@ethersproject/providers/lib/ws.js +var require_ws2 = __commonJS({ + "node_modules/@ethersproject/providers/lib/ws.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WebSocket = void 0; + var ws_1 = __importDefault(require_ws()); + exports2.WebSocket = ws_1.default; + } +}); + +// node_modules/@ethersproject/providers/lib/websocket-provider.js +var require_websocket_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/websocket-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WebSocketProvider = void 0; + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var json_rpc_provider_1 = require_json_rpc_provider(); + var ws_1 = require_ws2(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var NextId = 1; + var WebSocketProvider = ( + /** @class */ + function(_super) { + __extends(WebSocketProvider2, _super); + function WebSocketProvider2(url, network) { + var _this = this; + if (network === "any") { + logger.throwError("WebSocketProvider does not support 'any' network yet", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "network:any" + }); + } + _this = _super.call(this, url, network) || this; + _this._pollingInterval = -1; + _this._wsReady = false; + (0, properties_1.defineReadOnly)(_this, "_websocket", new ws_1.WebSocket(_this.connection.url)); + (0, properties_1.defineReadOnly)(_this, "_requests", {}); + (0, properties_1.defineReadOnly)(_this, "_subs", {}); + (0, properties_1.defineReadOnly)(_this, "_subIds", {}); + (0, properties_1.defineReadOnly)(_this, "_detectNetwork", _super.prototype.detectNetwork.call(_this)); + _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 result2 = JSON.parse(data); + if (result2.id != null) { + var id = String(result2.id); + var request = _this._requests[id]; + delete _this._requests[id]; + if (result2.result !== void 0) { + request.callback(null, result2.result); + _this.emit("debug", { + action: "response", + request: JSON.parse(request.payload), + response: result2.result, + provider: _this + }); + } else { + var error = null; + if (result2.error) { + error = new Error(result2.error.message || "unknown error"); + (0, properties_1.defineReadOnly)(error, "code", result2.error.code || null); + (0, properties_1.defineReadOnly)(error, "response", data); + } else { + error = new Error("unknown error"); + } + request.callback(error, void 0); + _this.emit("debug", { + action: "response", + error, + request: JSON.parse(request.payload), + provider: _this + }); + } + } else if (result2.method === "eth_subscription") { + var sub = _this._subs[result2.params.subscription]; + if (sub) { + sub.processFunc(result2.params.result); + } + } else { + console.warn("this should not happen"); + } + }; + var fauxPoll = setInterval(function() { + _this.emit("poll"); + }, 1e3); + if (fauxPoll.unref) { + fauxPoll.unref(); + } + return _this; + } + WebSocketProvider2.prototype.detectNetwork = function() { + return this._detectNetwork; + }; + Object.defineProperty(WebSocketProvider2.prototype, "pollingInterval", { + get: function() { + return 0; + }, + set: function(value) { + logger.throwError("cannot set polling interval on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPollingInterval" + }); + }, + enumerable: false, + configurable: true + }); + WebSocketProvider2.prototype.resetEventsBlock = function(blockNumber) { + logger.throwError("cannot reset events block on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resetEventBlock" + }); + }; + WebSocketProvider2.prototype.poll = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, null]; + }); + }); + }; + Object.defineProperty(WebSocketProvider2.prototype, "polling", { + set: function(value) { + if (!value) { + return; + } + logger.throwError("cannot set polling on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPolling" + }); + }, + enumerable: false, + configurable: true + }); + WebSocketProvider2.prototype.send = function(method, params2) { + var _this = this; + var rid = NextId++; + return new Promise(function(resolve, reject) { + function callback(error, result2) { + if (error) { + return reject(error); + } + return resolve(result2); + } + var payload = JSON.stringify({ + method, + params: params2, + id: rid, + jsonrpc: "2.0" + }); + _this.emit("debug", { + action: "request", + request: JSON.parse(payload), + provider: _this + }); + _this._requests[String(rid)] = { callback, payload }; + if (_this._wsReady) { + _this._websocket.send(payload); + } + }); + }; + WebSocketProvider2.defaultUrl = function() { + return "ws://localhost:8546"; + }; + WebSocketProvider2.prototype._subscribe = function(tag, param, processFunc) { + return __awaiter(this, void 0, void 0, function() { + var subIdPromise, subId; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + subIdPromise = this._subIds[tag]; + if (subIdPromise == null) { + subIdPromise = Promise.all(param).then(function(param2) { + return _this.send("eth_subscribe", param2); + }); + this._subIds[tag] = subIdPromise; + } + return [4, subIdPromise]; + case 1: + subId = _a.sent(); + this._subs[subId] = { tag, processFunc }; + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + WebSocketProvider2.prototype._startEvent = function(event) { + var _this = this; + switch (event.type) { + case "block": + this._subscribe("block", ["newHeads"], function(result2) { + var blockNumber = bignumber_1.BigNumber.from(result2.number).toNumber(); + _this._emitted.block = blockNumber; + _this.emit("block", blockNumber); + }); + break; + case "pending": + this._subscribe("pending", ["newPendingTransactions"], function(result2) { + _this.emit("pending", result2); + }); + break; + case "filter": + this._subscribe(event.tag, ["logs", this._getFilter(event.filter)], function(result2) { + if (result2.removed == null) { + result2.removed = false; + } + _this.emit(event.filter, _this.formatter.filterLog(result2)); + }); + break; + case "tx": { + var emitReceipt_1 = function(event2) { + var hash = event2.hash; + _this.getTransactionReceipt(hash).then(function(receipt) { + if (!receipt) { + return; + } + _this.emit(hash, receipt); + }); + }; + emitReceipt_1(event); + this._subscribe("tx", ["newHeads"], function(result2) { + _this._events.filter(function(e) { + return e.type === "tx"; + }).forEach(emitReceipt_1); + }); + break; + } + case "debug": + case "poll": + case "willPoll": + case "didPoll": + case "error": + break; + default: + console.log("unhandled:", event); + break; + } + }; + WebSocketProvider2.prototype._stopEvent = function(event) { + var _this = this; + var tag = event.tag; + if (event.type === "tx") { + if (this._events.filter(function(e) { + return e.type === "tx"; + }).length) { + return; + } + tag = "tx"; + } else if (this.listenerCount(event.event)) { + return; + } + var subId = this._subIds[tag]; + if (!subId) { + return; + } + delete this._subIds[tag]; + subId.then(function(subId2) { + if (!_this._subs[subId2]) { + return; + } + delete _this._subs[subId2]; + _this.send("eth_unsubscribe", [subId2]); + }); + }; + WebSocketProvider2.prototype.destroy = function() { + return __awaiter(this, void 0, void 0, function() { + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(this._websocket.readyState === ws_1.WebSocket.CONNECTING)) return [3, 2]; + return [4, new Promise(function(resolve) { + _this._websocket.onopen = function() { + resolve(true); + }; + _this._websocket.onerror = function() { + resolve(false); + }; + })]; + case 1: + _a.sent(); + _a.label = 2; + case 2: + this._websocket.close(1e3); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + return WebSocketProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.WebSocketProvider = WebSocketProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/url-json-rpc-provider.js +var require_url_json_rpc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/url-json-rpc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.UrlJsonRpcProvider = exports2.StaticJsonRpcProvider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var StaticJsonRpcProvider = ( + /** @class */ + function(_super) { + __extends(StaticJsonRpcProvider2, _super); + function StaticJsonRpcProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + StaticJsonRpcProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var network; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + network = this.network; + if (!(network == null)) return [3, 2]; + return [4, _super.prototype.detectNetwork.call(this)]; + case 1: + network = _a.sent(); + if (!network) { + logger.throwError("no network detected", logger_1.Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + (0, properties_1.defineReadOnly)(this, "_network", network); + this.emit("network", network, null); + } + _a.label = 2; + case 2: + return [2, network]; + } + }); + }); + }; + return StaticJsonRpcProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.StaticJsonRpcProvider = StaticJsonRpcProvider; + var UrlJsonRpcProvider = ( + /** @class */ + function(_super) { + __extends(UrlJsonRpcProvider2, _super); + function UrlJsonRpcProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + logger.checkAbstract(_newTarget, UrlJsonRpcProvider2); + network = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + apiKey = (0, properties_1.getStatic)(_newTarget, "getApiKey")(apiKey); + var connection = (0, properties_1.getStatic)(_newTarget, "getUrl")(network, apiKey); + _this = _super.call(this, connection, network) || this; + if (typeof apiKey === "string") { + (0, properties_1.defineReadOnly)(_this, "apiKey", apiKey); + } else if (apiKey != null) { + Object.keys(apiKey).forEach(function(key) { + (0, properties_1.defineReadOnly)(_this, key, apiKey[key]); + }); + } + return _this; + } + UrlJsonRpcProvider2.prototype._startPending = function() { + logger.warn("WARNING: API provider does not support pending filters"); + }; + UrlJsonRpcProvider2.prototype.isCommunityResource = function() { + return false; + }; + UrlJsonRpcProvider2.prototype.getSigner = function(address) { + return logger.throwError("API provider does not support signing", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" }); + }; + UrlJsonRpcProvider2.prototype.listAccounts = function() { + return Promise.resolve([]); + }; + UrlJsonRpcProvider2.getApiKey = function(apiKey) { + return apiKey; + }; + UrlJsonRpcProvider2.getUrl = function(network, apiKey) { + return logger.throwError("not implemented; sub-classes must override getUrl", logger_1.Logger.errors.NOT_IMPLEMENTED, { + operation: "getUrl" + }); + }; + return UrlJsonRpcProvider2; + }(StaticJsonRpcProvider) + ); + exports2.UrlJsonRpcProvider = UrlJsonRpcProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/alchemy-provider.js +var require_alchemy_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/alchemy-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AlchemyProvider = exports2.AlchemyWebSocketProvider = void 0; + var properties_1 = require_lib4(); + var formatter_1 = require_formatter(); + var websocket_provider_1 = require_websocket_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; + var AlchemyWebSocketProvider = ( + /** @class */ + function(_super) { + __extends(AlchemyWebSocketProvider2, _super); + function AlchemyWebSocketProvider2(network, apiKey) { + var _this = this; + 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) || this; + (0, properties_1.defineReadOnly)(_this, "apiKey", provider.apiKey); + return _this; + } + AlchemyWebSocketProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return AlchemyWebSocketProvider2; + }(websocket_provider_1.WebSocketProvider) + ); + exports2.AlchemyWebSocketProvider = AlchemyWebSocketProvider; + var AlchemyProvider = ( + /** @class */ + function(_super) { + __extends(AlchemyProvider2, _super); + function AlchemyProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + AlchemyProvider2.getWebSocketProvider = function(network, apiKey) { + return new AlchemyWebSocketProvider(network, apiKey); + }; + AlchemyProvider2.getApiKey = function(apiKey) { + if (apiKey == null) { + return defaultApiKey; + } + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey; + }; + AlchemyProvider2.getUrl = function(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(attempt, url) { + if (apiKey === defaultApiKey) { + (0, formatter_1.showThrottleMessage)(); + } + return Promise.resolve(true); + } + }; + }; + AlchemyProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return AlchemyProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.AlchemyProvider = AlchemyProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/cloudflare-provider.js +var require_cloudflare_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/cloudflare-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CloudflareProvider = void 0; + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var CloudflareProvider = ( + /** @class */ + function(_super) { + __extends(CloudflareProvider2, _super); + function CloudflareProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CloudflareProvider2.getApiKey = function(apiKey) { + if (apiKey != null) { + logger.throwArgumentError("apiKey not supported for cloudflare", "apiKey", apiKey); + } + return null; + }; + CloudflareProvider2.getUrl = function(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; + }; + CloudflareProvider2.prototype.perform = function(method, params2) { + return __awaiter(this, void 0, void 0, function() { + var block; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "getBlockNumber")) return [3, 2]; + return [4, _super.prototype.perform.call(this, "getBlock", { blockTag: "latest" })]; + case 1: + block = _a.sent(); + return [2, block.number]; + case 2: + return [2, _super.prototype.perform.call(this, method, params2)]; + } + }); + }); + }; + return CloudflareProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.CloudflareProvider = CloudflareProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/etherscan-provider.js +var require_etherscan_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/etherscan-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherscanProvider = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var web_1 = require_lib27(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var base_provider_1 = require_base_provider(); + function getTransactionPostData(transaction) { + var result2 = {}; + for (var key in transaction) { + if (transaction[key] == null) { + continue; + } + var value = transaction[key]; + if (key === "type" && value === 0) { + continue; + } + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = (0, bytes_1.hexValue)((0, bytes_1.hexlify)(value)); + } else if (key === "accessList") { + value = "[" + (0, transactions_1.accessListify)(value).map(function(set) { + return '{address:"' + set.address + '",storageKeys:["' + set.storageKeys.join('","') + '"]}'; + }).join(",") + "]"; + } else { + value = (0, bytes_1.hexlify)(value); + } + result2[key] = value; + } + return result2; + } + function getResult(result2) { + if (result2.status == 0 && (result2.message === "No records found" || result2.message === "No transactions found")) { + return result2.result; + } + if (result2.status != 1 || result2.message != "OK") { + var error = new Error("invalid response"); + error.result = JSON.stringify(result2); + if ((result2.result || "").toLowerCase().indexOf("rate limit") >= 0) { + error.throttleRetry = true; + } + throw error; + } + return result2.result; + } + function getJsonResult(result2) { + if (result2 && result2.status == 0 && result2.message == "NOTOK" && (result2.result || "").toLowerCase().indexOf("rate limit") >= 0) { + var error = new Error("throttled response"); + error.result = JSON.stringify(result2); + error.throttleRetry = true; + throw error; + } + if (result2.jsonrpc != "2.0") { + var error = new Error("invalid response"); + error.result = JSON.stringify(result2); + throw error; + } + if (result2.error) { + var error = new Error(result2.error.message || "unknown error"); + if (result2.error.code) { + error.code = result2.error.code; + } + if (result2.error.data) { + error.data = result2.error.data; + } + throw error; + } + return result2.result; + } + 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) { + if (method === "call" && error.code === logger_1.Logger.errors.SERVER_ERROR) { + var e = error.error; + if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { + var data = e.data; + if (data) { + data = "0x" + data.replace(/^.*0x/i, ""); + } + if ((0, bytes_1.isHexString)(data)) { + return data; + } + logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { + error, + data: "0x" + }); + } + } + var message = error.message; + if (error.code === logger_1.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(); + if (message.match(/insufficient funds/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/another transaction with same nonce/)) { + logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; + } + var EtherscanProvider = ( + /** @class */ + function(_super) { + __extends(EtherscanProvider2, _super); + function EtherscanProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, EtherscanProvider2); + _this = _super.call(this, network) || this; + (0, properties_1.defineReadOnly)(_this, "baseUrl", _this.getBaseUrl()); + (0, properties_1.defineReadOnly)(_this, "apiKey", apiKey || defaultApiKey); + return _this; + } + EtherscanProvider2.prototype.getBaseUrl = function() { + 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); + }; + EtherscanProvider2.prototype.getUrl = function(module3, params2) { + var query = Object.keys(params2).reduce(function(accum, key) { + var value = params2[key]; + if (value != null) { + accum += "&" + key + "=" + value; + } + return accum; + }, ""); + var apiKey = this.apiKey ? "&apikey=" + this.apiKey : ""; + return this.baseUrl + "/api?module=" + module3 + query + apiKey; + }; + EtherscanProvider2.prototype.getPostUrl = function() { + return this.baseUrl + "/api"; + }; + EtherscanProvider2.prototype.getPostData = function(module3, params2) { + params2.module = module3; + params2.apikey = this.apiKey; + return params2; + }; + EtherscanProvider2.prototype.fetch = function(module3, params2, post) { + return __awaiter(this, void 0, void 0, function() { + var url, payload, procFunc, connection, payloadStr, result2; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + url = post ? this.getPostUrl() : this.getUrl(module3, params2); + payload = post ? this.getPostData(module3, params2) : null; + procFunc = module3 === "proxy" ? getJsonResult : getResult; + this.emit("debug", { + action: "request", + request: url, + provider: this + }); + connection = { + url, + throttleSlotInterval: 1e3, + throttleCallback: function(attempt, url2) { + if (_this.isCommunityResource()) { + (0, formatter_1.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 key + "=" + payload[key]; + }).join("&"); + } + return [4, (0, web_1.fetchJson)(connection, payloadStr, procFunc || getJsonResult)]; + case 1: + result2 = _a.sent(); + this.emit("debug", { + action: "response", + request: url, + response: (0, properties_1.deepCopy)(result2), + provider: this + }); + return [2, result2]; + } + }); + }); + }; + EtherscanProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this.network]; + }); + }); + }; + EtherscanProvider2.prototype.perform = function(method, params2) { + return __awaiter(this, void 0, void 0, function() { + var _a, postData, error_1, postData, error_2, args, topic0, logs, blocks, i, log, block, _b; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + _a = method; + switch (_a) { + case "getBlockNumber": + return [3, 1]; + case "getGasPrice": + return [3, 2]; + case "getBalance": + return [3, 3]; + case "getTransactionCount": + return [3, 4]; + case "getCode": + return [3, 5]; + case "getStorageAt": + return [3, 6]; + case "sendTransaction": + return [3, 7]; + case "getBlock": + return [3, 8]; + case "getTransaction": + return [3, 9]; + case "getTransactionReceipt": + return [3, 10]; + case "call": + return [3, 11]; + case "estimateGas": + return [3, 15]; + case "getLogs": + return [3, 19]; + case "getEtherPrice": + return [3, 26]; + } + return [3, 28]; + case 1: + return [2, this.fetch("proxy", { action: "eth_blockNumber" })]; + case 2: + return [2, this.fetch("proxy", { action: "eth_gasPrice" })]; + case 3: + return [2, this.fetch("account", { + action: "balance", + address: params2.address, + tag: params2.blockTag + })]; + case 4: + return [2, this.fetch("proxy", { + action: "eth_getTransactionCount", + address: params2.address, + tag: params2.blockTag + })]; + case 5: + return [2, this.fetch("proxy", { + action: "eth_getCode", + address: params2.address, + tag: params2.blockTag + })]; + case 6: + return [2, this.fetch("proxy", { + action: "eth_getStorageAt", + address: params2.address, + position: params2.position, + tag: params2.blockTag + })]; + case 7: + return [2, this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: params2.signedTransaction + }, true).catch(function(error) { + return checkError("sendTransaction", error, params2.signedTransaction); + })]; + case 8: + if (params2.blockTag) { + return [2, this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: params2.blockTag, + boolean: params2.includeTransactions ? "true" : "false" + })]; + } + throw new Error("getBlock by blockHash not implemented"); + case 9: + return [2, this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: params2.transactionHash + })]; + case 10: + return [2, this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: params2.transactionHash + })]; + case 11: + if (params2.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + postData = getTransactionPostData(params2.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + _c.label = 12; + case 12: + _c.trys.push([12, 14, , 15]); + return [4, this.fetch("proxy", postData, true)]; + case 13: + return [2, _c.sent()]; + case 14: + error_1 = _c.sent(); + return [2, checkError("call", error_1, params2.transaction)]; + case 15: + postData = getTransactionPostData(params2.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + _c.label = 16; + case 16: + _c.trys.push([16, 18, , 19]); + return [4, this.fetch("proxy", postData, true)]; + case 17: + return [2, _c.sent()]; + case 18: + error_2 = _c.sent(); + return [2, checkError("estimateGas", error_2, params2.transaction)]; + case 19: + args = { action: "getLogs" }; + if (params2.filter.fromBlock) { + args.fromBlock = checkLogTag(params2.filter.fromBlock); + } + if (params2.filter.toBlock) { + args.toBlock = checkLogTag(params2.filter.toBlock); + } + if (params2.filter.address) { + args.address = params2.filter.address; + } + if (params2.filter.topics && params2.filter.topics.length > 0) { + if (params2.filter.topics.length > 1) { + logger.throwError("unsupported topic count", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { topics: params2.filter.topics }); + } + if (params2.filter.topics.length === 1) { + topic0 = params2.filter.topics[0]; + if (typeof topic0 !== "string" || topic0.length !== 66) { + logger.throwError("unsupported topic format", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { topic0 }); + } + args.topic0 = topic0; + } + } + return [4, this.fetch("logs", args)]; + case 20: + logs = _c.sent(); + blocks = {}; + i = 0; + _c.label = 21; + case 21: + if (!(i < logs.length)) return [3, 25]; + log = logs[i]; + if (log.blockHash != null) { + return [3, 24]; + } + if (!(blocks[log.blockNumber] == null)) return [3, 23]; + return [4, this.getBlock(log.blockNumber)]; + case 22: + block = _c.sent(); + if (block) { + blocks[log.blockNumber] = block.hash; + } + _c.label = 23; + case 23: + log.blockHash = blocks[log.blockNumber]; + _c.label = 24; + case 24: + i++; + return [3, 21]; + case 25: + return [2, logs]; + case 26: + if (this.network.name !== "homestead") { + return [2, 0]; + } + _b = parseFloat; + return [4, this.fetch("stats", { action: "ethprice" })]; + case 27: + return [2, _b.apply(void 0, [_c.sent().ethusd])]; + case 28: + return [3, 29]; + case 29: + return [2, _super.prototype.perform.call(this, method, params2)]; + } + }); + }); + }; + EtherscanProvider2.prototype.getHistory = function(addressOrName, startBlock, endBlock) { + return __awaiter(this, void 0, void 0, function() { + var params2, result2; + var _a; + var _this = this; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + _a = { + action: "txlist" + }; + return [4, this.resolveName(addressOrName)]; + case 1: + params2 = (_a.address = _b.sent(), _a.startblock = startBlock == null ? 0 : startBlock, _a.endblock = endBlock == null ? 99999999 : endBlock, _a.sort = "asc", _a); + return [4, this.fetch("account", params2)]; + case 2: + result2 = _b.sent(); + return [2, result2.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 = _this.formatter.transactionResponse(tx); + if (tx.timeStamp) { + item.timestamp = parseInt(tx.timeStamp); + } + return item; + })]; + } + }); + }); + }; + EtherscanProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return EtherscanProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.EtherscanProvider = EtherscanProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/fallback-provider.js +var require_fallback_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/fallback-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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(result2) { + result2.done ? resolve(result2.value) : adopt(result2.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + var __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FallbackProvider = void 0; + var abstract_provider_1 = require_lib12(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var random_1 = require_lib22(); + var web_1 = require_lib27(); + var base_provider_1 = require_base_provider(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + function now() { + return (/* @__PURE__ */ new Date()).getTime(); + } + function checkNetworks(networks) { + var result2 = null; + for (var i = 0; i < networks.length; i++) { + var network = networks[i]; + if (network == null) { + return null; + } + if (result2) { + if (!(result2.name === network.name && result2.chainId === network.chainId && (result2.ensAddress === network.ensAddress || result2.ensAddress == null && network.ensAddress == null))) { + logger.throwArgumentError("provider mismatch", "networks", networks); + } + } else { + result2 = network; + } + } + return result2; + } + function median(values, maxDelta) { + values = values.slice().sort(); + var middle = Math.floor(values.length / 2); + if (values.length % 2) { + return values[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 (bignumber_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); + } + var nextRid = 1; + function stall(duration) { + var cancel = null; + var timer = null; + var promise = new Promise(function(resolve) { + cancel = function() { + if (timer) { + clearTimeout(timer); + timer = null; + } + resolve(); + }; + timer = setTimeout(cancel, duration); + }); + var wait = function(func) { + promise = promise.then(func); + return promise; + }; + function getPromise() { + return promise; + } + return { cancel, getPromise, wait }; + } + var ForwardErrors = [ + logger_1.Logger.errors.CALL_EXCEPTION, + logger_1.Logger.errors.INSUFFICIENT_FUNDS, + logger_1.Logger.errors.NONCE_EXPIRED, + logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, + logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT + ]; + var ForwardProperties = [ + "address", + "args", + "errorArgs", + "errorSignature", + "method", + "transaction" + ]; + function exposeDebugConfig(config, now2) { + var result2 = { + weight: config.weight + }; + Object.defineProperty(result2, "provider", { get: function() { + return config.provider; + } }); + if (config.start) { + result2.start = config.start; + } + if (now2) { + result2.duration = now2 - config.start; + } + if (config.done) { + if (config.error) { + result2.error = config.error; + } else { + result2.result = config.result || null; + } + } + return result2; + } + function normalizedTally(normalize, quorum) { + return function(configs) { + var tally = {}; + configs.forEach(function(c) { + var value = normalize(c.result); + if (!tally[value]) { + tally[value] = { count: 0, result: c.result }; + } + tally[value].count++; + }); + 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; + } + } + return void 0; + }; + } + function getProcessFunc(provider, method, params2) { + var normalize = serialize; + switch (method) { + case "getBlockNumber": + return function(configs) { + var values = configs.map(function(c) { + return c.result; + }); + var blockNumber = median(configs.map(function(c) { + return c.result; + }), 2); + if (blockNumber == null) { + return void 0; + } + blockNumber = Math.ceil(blockNumber); + if (values.indexOf(blockNumber + 1) >= 0) { + blockNumber++; + } + if (blockNumber >= provider._highestBlockNumber) { + provider._highestBlockNumber = blockNumber; + } + return provider._highestBlockNumber; + }; + case "getGasPrice": + return function(configs) { + var values = configs.map(function(c) { + return c.result; + }); + values.sort(); + return values[Math.floor(values.length / 2)]; + }; + case "getEtherPrice": + return function(configs) { + return median(configs.map(function(c) { + return c.result; + })); + }; + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorageAt": + case "call": + case "estimateGas": + case "getLogs": + break; + case "getTransaction": + case "getTransactionReceipt": + normalize = function(tx) { + if (tx == null) { + return null; + } + tx = (0, properties_1.shallowCopy)(tx); + tx.confirmations = -1; + return serialize(tx); + }; + break; + case "getBlock": + if (params2.includeTransactions) { + normalize = function(block) { + if (block == null) { + return null; + } + block = (0, properties_1.shallowCopy)(block); + block.transactions = block.transactions.map(function(tx) { + tx = (0, properties_1.shallowCopy)(tx); + tx.confirmations = -1; + return tx; + }); + return serialize(block); + }; + } else { + normalize = function(block) { + if (block == null) { + return null; + } + return serialize(block); + }; + } + break; + default: + throw new Error("unknown method: " + method); + } + return normalizedTally(normalize, provider.quorum); + } + function waitForSync(config, blockNumber) { + return __awaiter(this, void 0, void 0, function() { + var provider; + return __generator(this, function(_a) { + provider = config.provider; + if (provider.blockNumber != null && provider.blockNumber >= blockNumber || blockNumber === -1) { + return [2, provider]; + } + return [2, (0, web_1.poll)(function() { + return new Promise(function(resolve, reject) { + setTimeout(function() { + if (provider.blockNumber >= blockNumber) { + return resolve(provider); + } + if (config.cancelled) { + return resolve(null); + } + return resolve(void 0); + }, 0); + }); + }, { oncePoll: provider })]; + }); + }); + } + function getRunner(config, currentBlockNumber, method, params2) { + return __awaiter(this, void 0, void 0, function() { + var provider, _a, filter; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + provider = config.provider; + _a = method; + switch (_a) { + case "getBlockNumber": + return [3, 1]; + case "getGasPrice": + return [3, 1]; + case "getEtherPrice": + return [3, 2]; + case "getBalance": + return [3, 3]; + case "getTransactionCount": + return [3, 3]; + case "getCode": + return [3, 3]; + case "getStorageAt": + return [3, 6]; + case "getBlock": + return [3, 9]; + case "call": + return [3, 12]; + case "estimateGas": + return [3, 12]; + case "getTransaction": + return [3, 15]; + case "getTransactionReceipt": + return [3, 15]; + case "getLogs": + return [3, 16]; + } + return [3, 19]; + case 1: + return [2, provider[method]()]; + case 2: + if (provider.getEtherPrice) { + return [2, provider.getEtherPrice()]; + } + return [3, 19]; + case 3: + if (!(params2.blockTag && (0, bytes_1.isHexString)(params2.blockTag))) return [3, 5]; + return [4, waitForSync(config, currentBlockNumber)]; + case 4: + provider = _b.sent(); + _b.label = 5; + case 5: + return [2, provider[method](params2.address, params2.blockTag || "latest")]; + case 6: + if (!(params2.blockTag && (0, bytes_1.isHexString)(params2.blockTag))) return [3, 8]; + return [4, waitForSync(config, currentBlockNumber)]; + case 7: + provider = _b.sent(); + _b.label = 8; + case 8: + return [2, provider.getStorageAt(params2.address, params2.position, params2.blockTag || "latest")]; + case 9: + if (!(params2.blockTag && (0, bytes_1.isHexString)(params2.blockTag))) return [3, 11]; + return [4, waitForSync(config, currentBlockNumber)]; + case 10: + provider = _b.sent(); + _b.label = 11; + case 11: + return [2, provider[params2.includeTransactions ? "getBlockWithTransactions" : "getBlock"](params2.blockTag || params2.blockHash)]; + case 12: + if (!(params2.blockTag && (0, bytes_1.isHexString)(params2.blockTag))) return [3, 14]; + return [4, waitForSync(config, currentBlockNumber)]; + case 13: + provider = _b.sent(); + _b.label = 14; + case 14: + return [2, provider[method](params2.transaction)]; + case 15: + return [2, provider[method](params2.transactionHash)]; + case 16: + filter = params2.filter; + if (!(filter.fromBlock && (0, bytes_1.isHexString)(filter.fromBlock) || filter.toBlock && (0, bytes_1.isHexString)(filter.toBlock))) return [3, 18]; + return [4, waitForSync(config, currentBlockNumber)]; + case 17: + provider = _b.sent(); + _b.label = 18; + case 18: + return [2, provider.getLogs(filter)]; + case 19: + return [2, logger.throwError("unknown method error", logger_1.Logger.errors.UNKNOWN_ERROR, { + method, + params: params2 + })]; + } + }); + }); + } + var FallbackProvider = ( + /** @class */ + function(_super) { + __extends(FallbackProvider2, _super); + function FallbackProvider2(providers, quorum) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, FallbackProvider2); + if (providers.length === 0) { + logger.throwArgumentError("missing providers", "providers", providers); + } + var providerConfigs = providers.map(function(configOrProvider, index) { + if (abstract_provider_1.Provider.isProvider(configOrProvider)) { + var stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2e3 : 750; + var priority = 1; + return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority }); + } + var config = (0, properties_1.shallowCopy)(configOrProvider); + if (config.priority == null) { + config.priority = 1; + } + if (config.stallTimeout == null) { + config.stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2e3 : 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[" + 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); + } + var networkOrReady = checkNetworks(providerConfigs.map(function(c) { + return c.provider.network; + })); + if (networkOrReady == null) { + networkOrReady = new Promise(function(resolve, reject) { + setTimeout(function() { + _this.detectNetwork().then(resolve, reject); + }, 0); + }); + } + _this = _super.call(this, networkOrReady) || this; + (0, properties_1.defineReadOnly)(_this, "providerConfigs", Object.freeze(providerConfigs)); + (0, properties_1.defineReadOnly)(_this, "quorum", quorum); + _this._highestBlockNumber = -1; + return _this; + } + FallbackProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var networks; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, Promise.all(this.providerConfigs.map(function(c) { + return c.provider.getNetwork(); + }))]; + case 1: + networks = _a.sent(); + return [2, checkNetworks(networks)]; + } + }); + }); + }; + FallbackProvider2.prototype.perform = function(method, params2) { + return __awaiter(this, void 0, void 0, function() { + var results, i_1, result2, processFunc, configs, currentBlockNumber, i, first, _loop_1, this_1, state_1; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "sendTransaction")) return [3, 2]; + return [4, Promise.all(this.providerConfigs.map(function(c) { + return c.provider.sendTransaction(params2.signedTransaction).then(function(result3) { + return result3.hash; + }, function(error) { + return error; + }); + }))]; + case 1: + results = _a.sent(); + for (i_1 = 0; i_1 < results.length; i_1++) { + result2 = results[i_1]; + if (typeof result2 === "string") { + return [2, result2]; + } + } + throw results[0]; + case 2: + if (!(this._highestBlockNumber === -1 && method !== "getBlockNumber")) return [3, 4]; + return [4, this.getBlockNumber()]; + case 3: + _a.sent(); + _a.label = 4; + case 4: + processFunc = getProcessFunc(this, method, params2); + configs = (0, random_1.shuffled)(this.providerConfigs.map(properties_1.shallowCopy)); + configs.sort(function(a, b) { + return a.priority - b.priority; + }); + currentBlockNumber = this._highestBlockNumber; + i = 0; + first = true; + _loop_1 = function() { + var t0, inflightWeight, _loop_2, waiting, results2, result3, errors; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + t0 = now(); + inflightWeight = configs.filter(function(c) { + return c.runner && t0 - c.start < c.stallTimeout; + }).reduce(function(accum, c) { + return accum + c.weight; + }, 0); + _loop_2 = function() { + 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, params2).then(function(result4) { + config.done = true; + config.result = result4; + if (_this.listenerCount("debug")) { + _this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, now()), + request: { method, params: (0, properties_1.deepCopy)(params2) }, + provider: _this + }); + } + }, function(error) { + config.done = true; + config.error = error; + if (_this.listenerCount("debug")) { + _this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, now()), + request: { method, params: (0, properties_1.deepCopy)(params2) }, + provider: _this + }); + } + }); + if (this_1.listenerCount("debug")) { + this_1.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, null), + request: { method, params: (0, properties_1.deepCopy)(params2) }, + provider: this_1 + }); + } + inflightWeight += config.weight; + }; + while (inflightWeight < this_1.quorum && i < configs.length) { + _loop_2(); + } + 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) return [3, 2]; + return [4, Promise.race(waiting)]; + case 1: + _b.sent(); + _b.label = 2; + case 2: + results2 = configs.filter(function(c) { + return c.done && c.error == null; + }); + if (!(results2.length >= this_1.quorum)) return [3, 5]; + result3 = processFunc(results2); + if (result3 !== void 0) { + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return [2, { value: result3 }]; + } + if (!!first) return [3, 4]; + return [4, stall(100).getPromise()]; + case 3: + _b.sent(); + _b.label = 4; + case 4: + first = false; + _b.label = 5; + case 5: + 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 < _this.quorum) { + return; + } + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + var e = tally.error; + var props = {}; + ForwardProperties.forEach(function(name2) { + if (e[name2] == null) { + return; + } + props[name2] = e[name2]; + }); + logger.throwError(e.reason || e.message, errorCode, props); + }); + if (configs.filter(function(c) { + return !c.done; + }).length === 0) { + return [2, "break"]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }; + this_1 = this; + _a.label = 5; + case 5: + if (false) return [3, 7]; + return [5, _loop_1()]; + case 6: + state_1 = _a.sent(); + if (typeof state_1 === "object") + return [2, state_1.value]; + if (state_1 === "break") + return [3, 7]; + return [3, 5]; + case 7: + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return [2, logger.throwError("failed to meet quorum", logger_1.Logger.errors.SERVER_ERROR, { + method, + params: params2, + //results: configs.map((c) => c.result), + //errors: configs.map((c) => c.error), + results: configs.map(function(c) { + return exposeDebugConfig(c); + }), + provider: this + })]; + } + }); + }); + }; + return FallbackProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.FallbackProvider = FallbackProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/ipc-provider.js +var require_ipc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/ipc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.IpcProvider = void 0; + var net_1 = require("net"); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var IpcProvider = ( + /** @class */ + function(_super) { + __extends(IpcProvider2, _super); + function IpcProvider2(path, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, IpcProvider2); + if (path == null) { + logger.throwError("missing path", logger_1.Logger.errors.MISSING_ARGUMENT, { arg: "path" }); + } + _this = _super.call(this, "ipc://" + path, network) || this; + (0, properties_1.defineReadOnly)(_this, "path", path); + return _this; + } + IpcProvider2.prototype.send = function(method, params2) { + var _this = this; + var payload = JSON.stringify({ + method, + params: params2, + id: 42, + jsonrpc: "2.0" + }); + return new Promise(function(resolve, reject) { + var response = Buffer.alloc(0); + var stream = (0, net_1.connect)(_this.path); + stream.on("data", function(data) { + response = Buffer.concat([response, data]); + }); + stream.on("end", function() { + try { + resolve(JSON.parse(response.toString()).result); + stream.destroy(); + } catch (error) { + reject(error); + stream.destroy(); + } + }); + stream.on("error", function(error) { + reject(error); + stream.destroy(); + }); + stream.write(payload); + stream.end(); + }); + }; + return IpcProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.IpcProvider = IpcProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/infura-provider.js +var require_infura_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/infura-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InfuraProvider = exports2.InfuraWebSocketProvider = void 0; + var properties_1 = require_lib4(); + var websocket_provider_1 = require_websocket_provider(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultProjectId = "84842078b09946638c03157f83405213"; + var InfuraWebSocketProvider = ( + /** @class */ + function(_super) { + __extends(InfuraWebSocketProvider2, _super); + function InfuraWebSocketProvider2(network, apiKey) { + var _this = this; + var provider = new InfuraProvider(network, apiKey); + var connection = provider.connection; + if (connection.password) { + logger.throwError("INFURA WebSocket project secrets unsupported", logger_1.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) || this; + (0, properties_1.defineReadOnly)(_this, "apiKey", provider.projectId); + (0, properties_1.defineReadOnly)(_this, "projectId", provider.projectId); + (0, properties_1.defineReadOnly)(_this, "projectSecret", provider.projectSecret); + return _this; + } + InfuraWebSocketProvider2.prototype.isCommunityResource = function() { + return this.projectId === defaultProjectId; + }; + return InfuraWebSocketProvider2; + }(websocket_provider_1.WebSocketProvider) + ); + exports2.InfuraWebSocketProvider = InfuraWebSocketProvider; + var InfuraProvider = ( + /** @class */ + function(_super) { + __extends(InfuraProvider2, _super); + function InfuraProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + InfuraProvider2.getWebSocketProvider = function(network, apiKey) { + return new InfuraWebSocketProvider(network, apiKey); + }; + InfuraProvider2.getApiKey = function(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; + }; + InfuraProvider2.getUrl = function(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", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + var connection = { + allowGzip: true, + url: "https://" + host + "/v3/" + apiKey.projectId, + throttleCallback: function(attempt, url) { + if (apiKey.projectId === defaultProjectId) { + (0, formatter_1.showThrottleMessage)(); + } + return Promise.resolve(true); + } + }; + if (apiKey.projectSecret != null) { + connection.user = ""; + connection.password = apiKey.projectSecret; + } + return connection; + }; + InfuraProvider2.prototype.isCommunityResource = function() { + return this.projectId === defaultProjectId; + }; + return InfuraProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.InfuraProvider = InfuraProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/json-rpc-batch-provider.js +var require_json_rpc_batch_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/json-rpc-batch-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.JsonRpcBatchProvider = void 0; + var properties_1 = require_lib4(); + var web_1 = require_lib27(); + var json_rpc_provider_1 = require_json_rpc_provider(); + var JsonRpcBatchProvider = ( + /** @class */ + function(_super) { + __extends(JsonRpcBatchProvider2, _super); + function JsonRpcBatchProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + JsonRpcBatchProvider2.prototype.send = function(method, params2) { + var _this = this; + var request = { + method, + params: params2, + id: this._nextId++, + jsonrpc: "2.0" + }; + if (this._pendingBatch == null) { + this._pendingBatch = []; + } + var inflightRequest = { 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) { + this._pendingBatchAggregator = setTimeout(function() { + var batch = _this._pendingBatch; + _this._pendingBatch = null; + _this._pendingBatchAggregator = null; + var request2 = batch.map(function(inflight) { + return inflight.request; + }); + _this.emit("debug", { + action: "requestBatch", + request: (0, properties_1.deepCopy)(request2), + provider: _this + }); + return (0, web_1.fetchJson)(_this.connection, JSON.stringify(request2)).then(function(result2) { + _this.emit("debug", { + action: "response", + request: request2, + response: result2, + provider: _this + }); + batch.forEach(function(inflightRequest2, index) { + var payload = result2[index]; + if (payload.error) { + var error = new Error(payload.error.message); + error.code = payload.error.code; + error.data = payload.error.data; + inflightRequest2.reject(error); + } else { + inflightRequest2.resolve(payload.result); + } + }); + }, function(error) { + _this.emit("debug", { + action: "response", + error, + request: request2, + provider: _this + }); + batch.forEach(function(inflightRequest2) { + inflightRequest2.reject(error); + }); + }); + }, 10); + } + return promise; + }; + return JsonRpcBatchProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.JsonRpcBatchProvider = JsonRpcBatchProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/nodesmith-provider.js +var require_nodesmith_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/nodesmith-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NodesmithProvider = void 0; + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var defaultApiKey = "ETHERS_JS_SHARED"; + var NodesmithProvider = ( + /** @class */ + function(_super) { + __extends(NodesmithProvider2, _super); + function NodesmithProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + NodesmithProvider2.getApiKey = function(apiKey) { + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey || defaultApiKey; + }; + NodesmithProvider2.getUrl = function(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 NodesmithProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.NodesmithProvider = NodesmithProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/pocket-provider.js +var require_pocket_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/pocket-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PocketProvider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultApplicationIds = { + homestead: "6004bcd10040261633ade990", + ropsten: "6004bd4d0040261633ade991", + rinkeby: "6004bda20040261633ade994", + goerli: "6004bd860040261633ade992" + }; + var PocketProvider = ( + /** @class */ + function(_super) { + __extends(PocketProvider2, _super); + function PocketProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + if (apiKey == null) { + var n = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + if (n) { + var applicationId = defaultApplicationIds[n.name]; + if (applicationId) { + apiKey = { + applicationId, + loadBalancer: true + }; + } + } + if (apiKey == null) { + logger.throwError("unsupported network", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + } + _this = _super.call(this, network, apiKey) || this; + return _this; + } + PocketProvider2.getApiKey = function(apiKey) { + if (apiKey == null) { + logger.throwArgumentError("PocketProvider.getApiKey does not support null apiKey", "apiKey", apiKey); + } + var apiKeyObj = { + applicationId: null, + loadBalancer: false, + applicationSecretKey: null + }; + 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; + }; + PocketProvider2.getUrl = function(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", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + var url = null; + if (apiKey.loadBalancer) { + url = "https://" + host + "/v1/lb/" + apiKey.applicationId; + } else { + url = "https://" + host + "/v1/" + apiKey.applicationId; + } + var connection = { url }; + connection.headers = {}; + if (apiKey.applicationSecretKey != null) { + connection.user = ""; + connection.password = apiKey.applicationSecretKey; + } + return connection; + }; + PocketProvider2.prototype.isCommunityResource = function() { + return this.applicationId === defaultApplicationIds[this.network.name]; + }; + return PocketProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.PocketProvider = PocketProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/web3-provider.js +var require_web3_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/web3-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Web3Provider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var _nextId = 1; + function buildWeb3LegacyFetcher(provider, sendFunc) { + var fetcher = "Web3LegacyFetcher"; + return function(method, params2) { + var _this = this; + var request = { + method, + params: params2, + id: _nextId++, + jsonrpc: "2.0" + }; + return new Promise(function(resolve, reject) { + _this.emit("debug", { + action: "request", + fetcher, + request: (0, properties_1.deepCopy)(request), + provider: _this + }); + sendFunc(request, function(error, response) { + if (error) { + _this.emit("debug", { + action: "response", + fetcher, + error, + request, + provider: _this + }); + return reject(error); + } + _this.emit("debug", { + action: "response", + fetcher, + request, + response, + provider: _this + }); + if (response.error) { + var error_1 = new Error(response.error.message); + error_1.code = response.error.code; + error_1.data = response.error.data; + return reject(error_1); + } + resolve(response.result); + }); + }); + }; + } + function buildEip1193Fetcher(provider) { + return function(method, params2) { + var _this = this; + if (params2 == null) { + params2 = []; + } + var request = { method, params: params2 }; + this.emit("debug", { + action: "request", + fetcher: "Eip1193Fetcher", + request: (0, properties_1.deepCopy)(request), + provider: this + }); + return provider.request(request).then(function(response) { + _this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + response, + provider: _this + }); + return response; + }, function(error) { + _this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + error, + provider: _this + }); + throw error; + }); + }; + } + var Web3Provider = ( + /** @class */ + function(_super) { + __extends(Web3Provider2, _super); + function Web3Provider2(provider, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Web3Provider2); + 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:"; + } + } + _this = _super.call(this, path, network) || this; + (0, properties_1.defineReadOnly)(_this, "jsonRpcFetchFunc", jsonRpcFetchFunc); + (0, properties_1.defineReadOnly)(_this, "provider", subprovider); + return _this; + } + Web3Provider2.prototype.send = function(method, params2) { + return this.jsonRpcFetchFunc(method, params2); + }; + return Web3Provider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.Web3Provider = Web3Provider; + } +}); + +// node_modules/@ethersproject/providers/lib/index.js +var require_lib28 = __commonJS({ + "node_modules/@ethersproject/providers/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Formatter = exports2.showThrottleMessage = exports2.isCommunityResourcable = exports2.isCommunityResource = exports2.getNetwork = exports2.getDefaultProvider = exports2.JsonRpcSigner = exports2.IpcProvider = exports2.WebSocketProvider = exports2.Web3Provider = exports2.StaticJsonRpcProvider = exports2.PocketProvider = exports2.NodesmithProvider = exports2.JsonRpcBatchProvider = exports2.JsonRpcProvider = exports2.InfuraWebSocketProvider = exports2.InfuraProvider = exports2.EtherscanProvider = exports2.CloudflareProvider = exports2.AlchemyWebSocketProvider = exports2.AlchemyProvider = exports2.FallbackProvider = exports2.UrlJsonRpcProvider = exports2.Resolver = exports2.BaseProvider = exports2.Provider = void 0; + var abstract_provider_1 = require_lib12(); + Object.defineProperty(exports2, "Provider", { enumerable: true, get: function() { + return abstract_provider_1.Provider; + } }); + var networks_1 = require_lib25(); + Object.defineProperty(exports2, "getNetwork", { enumerable: true, get: function() { + return networks_1.getNetwork; + } }); + var base_provider_1 = require_base_provider(); + Object.defineProperty(exports2, "BaseProvider", { enumerable: true, get: function() { + return base_provider_1.BaseProvider; + } }); + Object.defineProperty(exports2, "Resolver", { enumerable: true, get: function() { + return base_provider_1.Resolver; + } }); + var alchemy_provider_1 = require_alchemy_provider(); + Object.defineProperty(exports2, "AlchemyProvider", { enumerable: true, get: function() { + return alchemy_provider_1.AlchemyProvider; + } }); + Object.defineProperty(exports2, "AlchemyWebSocketProvider", { enumerable: true, get: function() { + return alchemy_provider_1.AlchemyWebSocketProvider; + } }); + var cloudflare_provider_1 = require_cloudflare_provider(); + Object.defineProperty(exports2, "CloudflareProvider", { enumerable: true, get: function() { + return cloudflare_provider_1.CloudflareProvider; + } }); + var etherscan_provider_1 = require_etherscan_provider(); + Object.defineProperty(exports2, "EtherscanProvider", { enumerable: true, get: function() { + return etherscan_provider_1.EtherscanProvider; + } }); + var fallback_provider_1 = require_fallback_provider(); + Object.defineProperty(exports2, "FallbackProvider", { enumerable: true, get: function() { + return fallback_provider_1.FallbackProvider; + } }); + var ipc_provider_1 = require_ipc_provider(); + Object.defineProperty(exports2, "IpcProvider", { enumerable: true, get: function() { + return ipc_provider_1.IpcProvider; + } }); + var infura_provider_1 = require_infura_provider(); + Object.defineProperty(exports2, "InfuraProvider", { enumerable: true, get: function() { + return infura_provider_1.InfuraProvider; + } }); + Object.defineProperty(exports2, "InfuraWebSocketProvider", { enumerable: true, get: function() { + return infura_provider_1.InfuraWebSocketProvider; + } }); + var json_rpc_provider_1 = require_json_rpc_provider(); + Object.defineProperty(exports2, "JsonRpcProvider", { enumerable: true, get: function() { + return json_rpc_provider_1.JsonRpcProvider; + } }); + Object.defineProperty(exports2, "JsonRpcSigner", { enumerable: true, get: function() { + return json_rpc_provider_1.JsonRpcSigner; + } }); + var json_rpc_batch_provider_1 = require_json_rpc_batch_provider(); + Object.defineProperty(exports2, "JsonRpcBatchProvider", { enumerable: true, get: function() { + return json_rpc_batch_provider_1.JsonRpcBatchProvider; + } }); + var nodesmith_provider_1 = require_nodesmith_provider(); + Object.defineProperty(exports2, "NodesmithProvider", { enumerable: true, get: function() { + return nodesmith_provider_1.NodesmithProvider; + } }); + var pocket_provider_1 = require_pocket_provider(); + Object.defineProperty(exports2, "PocketProvider", { enumerable: true, get: function() { + return pocket_provider_1.PocketProvider; + } }); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + Object.defineProperty(exports2, "StaticJsonRpcProvider", { enumerable: true, get: function() { + return url_json_rpc_provider_1.StaticJsonRpcProvider; + } }); + Object.defineProperty(exports2, "UrlJsonRpcProvider", { enumerable: true, get: function() { + return url_json_rpc_provider_1.UrlJsonRpcProvider; + } }); + var web3_provider_1 = require_web3_provider(); + Object.defineProperty(exports2, "Web3Provider", { enumerable: true, get: function() { + return web3_provider_1.Web3Provider; + } }); + var websocket_provider_1 = require_websocket_provider(); + Object.defineProperty(exports2, "WebSocketProvider", { enumerable: true, get: function() { + return websocket_provider_1.WebSocketProvider; + } }); + var formatter_1 = require_formatter(); + Object.defineProperty(exports2, "Formatter", { enumerable: true, get: function() { + return formatter_1.Formatter; + } }); + Object.defineProperty(exports2, "isCommunityResourcable", { enumerable: true, get: function() { + return formatter_1.isCommunityResourcable; + } }); + Object.defineProperty(exports2, "isCommunityResource", { enumerable: true, get: function() { + return formatter_1.isCommunityResource; + } }); + Object.defineProperty(exports2, "showThrottleMessage", { enumerable: true, get: function() { + return formatter_1.showThrottleMessage; + } }); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + function getDefaultProvider(network, options) { + if (network == null) { + network = "homestead"; + } + if (typeof network === "string") { + var match = network.match(/^(ws|http)s?:/i); + if (match) { + switch (match[1]) { + case "http": + return new json_rpc_provider_1.JsonRpcProvider(network); + case "ws": + return new websocket_provider_1.WebSocketProvider(network); + default: + logger.throwArgumentError("unsupported URL scheme", "network", network); + } + } + } + var n = (0, networks_1.getNetwork)(network); + if (!n || !n._defaultProvider) { + logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, { + operation: "getDefaultProvider", + network + }); + } + return n._defaultProvider({ + FallbackProvider: fallback_provider_1.FallbackProvider, + AlchemyProvider: alchemy_provider_1.AlchemyProvider, + CloudflareProvider: cloudflare_provider_1.CloudflareProvider, + EtherscanProvider: etherscan_provider_1.EtherscanProvider, + InfuraProvider: infura_provider_1.InfuraProvider, + JsonRpcProvider: json_rpc_provider_1.JsonRpcProvider, + NodesmithProvider: nodesmith_provider_1.NodesmithProvider, + PocketProvider: pocket_provider_1.PocketProvider, + Web3Provider: web3_provider_1.Web3Provider, + IpcProvider: ipc_provider_1.IpcProvider + }, options); + } + exports2.getDefaultProvider = getDefaultProvider; + } +}); + +// node_modules/@ethersproject/solidity/lib/_version.js +var require_version23 = __commonJS({ + "node_modules/@ethersproject/solidity/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "solidity/5.5.0"; + } +}); + +// node_modules/@ethersproject/solidity/lib/index.js +var require_lib29 = __commonJS({ + "node_modules/@ethersproject/solidity/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sha256 = exports2.keccak256 = exports2.pack = void 0; + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var sha2_1 = require_lib19(); + var strings_1 = require_lib9(); + 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_1 = require_lib(); + var _version_1 = require_version23(); + var logger = new logger_1.Logger(_version_1.version); + function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return (0, bytes_1.zeroPad)(value, 32); + } + return (0, bytes_1.arrayify)(value); + case "string": + return (0, strings_1.toUtf8Bytes)(value); + case "bytes": + return (0, bytes_1.arrayify)(value); + case "bool": + value = value ? "0x01" : "0x00"; + if (isArray) { + return (0, bytes_1.zeroPad)(value, 32); + } + return (0, bytes_1.arrayify)(value); + } + var match = type.match(regexNumber); + if (match) { + 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 = bignumber_1.BigNumber.from(value).toTwos(size); + return (0, bytes_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 ((0, bytes_1.arrayify)(value).byteLength !== size) { + logger.throwArgumentError("invalid value for " + type, "value", value); + } + if (isArray) { + return (0, bytes_1.arrayify)((value + Zeros).substring(0, 66)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + var baseType_1 = match[1]; + var count = parseInt(match[2] || String(value.length)); + if (count != value.length) { + logger.throwArgumentError("invalid array length for " + type, "value", value); + } + var result_1 = []; + value.forEach(function(value2) { + result_1.push(_pack(baseType_1, value2, true)); + }); + return (0, bytes_1.concat)(result_1); + } + return logger.throwArgumentError("invalid type", "type", type); + } + 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 (0, bytes_1.hexlify)((0, bytes_1.concat)(tight)); + } + exports2.pack = pack; + function keccak256(types, values) { + return (0, keccak256_1.keccak256)(pack(types, values)); + } + exports2.keccak256 = keccak256; + function sha256(types, values) { + return (0, sha2_1.sha256)(pack(types, values)); + } + exports2.sha256 = sha256; + } +}); + +// node_modules/@ethersproject/units/lib/_version.js +var require_version24 = __commonJS({ + "node_modules/@ethersproject/units/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "units/5.5.0"; + } +}); + +// node_modules/@ethersproject/units/lib/index.js +var require_lib30 = __commonJS({ + "node_modules/@ethersproject/units/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.parseEther = exports2.formatEther = exports2.parseUnits = exports2.formatUnits = exports2.commify = void 0; + var bignumber_1 = require_lib3(); + var logger_1 = require_lib(); + var _version_1 = require_version24(); + var logger = new logger_1.Logger(_version_1.version); + var names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether" + ]; + 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); + } + var whole = comps[0]; + var negative = ""; + if (whole.substring(0, 1) === "-") { + negative = "-"; + whole = whole.substring(1); + } + 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; + } + exports2.commify = commify; + function formatUnits(value, unitName) { + if (typeof unitName === "string") { + var index = names.indexOf(unitName); + if (index !== -1) { + unitName = 3 * index; + } + } + return (0, bignumber_1.formatFixed)(value, unitName != null ? unitName : 18); + } + exports2.formatUnits = formatUnits; + 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 (0, bignumber_1.parseFixed)(value, unitName != null ? unitName : 18); + } + exports2.parseUnits = parseUnits; + function formatEther(wei) { + return formatUnits(wei, 18); + } + exports2.formatEther = formatEther; + function parseEther(ether) { + return parseUnits(ether, 18); + } + exports2.parseEther = parseEther; + } +}); + +// node_modules/ethers/lib/utils.js +var require_utils5 = __commonJS({ + "node_modules/ethers/lib/utils.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result2 = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result2, mod, k); + } + __setModuleDefault(result2, mod); + return result2; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.formatBytes32String = exports2.Utf8ErrorFuncs = exports2.toUtf8String = exports2.toUtf8CodePoints = exports2.toUtf8Bytes = exports2._toEscapedUtf8String = exports2.nameprep = exports2.hexDataSlice = exports2.hexDataLength = exports2.hexZeroPad = exports2.hexValue = exports2.hexStripZeros = exports2.hexConcat = exports2.isHexString = exports2.hexlify = exports2.base64 = exports2.base58 = exports2.TransactionDescription = exports2.LogDescription = exports2.Interface = exports2.SigningKey = exports2.HDNode = exports2.defaultPath = exports2.isBytesLike = exports2.isBytes = exports2.zeroPad = exports2.stripZeros = exports2.concat = exports2.arrayify = exports2.shallowCopy = exports2.resolveProperties = exports2.getStatic = exports2.defineReadOnly = exports2.deepCopy = exports2.checkProperties = exports2.poll = exports2.fetchJson = exports2._fetchData = exports2.RLP = exports2.Logger = exports2.checkResultErrors = exports2.FormatTypes = exports2.ParamType = exports2.FunctionFragment = exports2.EventFragment = exports2.ErrorFragment = exports2.ConstructorFragment = exports2.Fragment = exports2.defaultAbiCoder = exports2.AbiCoder = void 0; + exports2.Indexed = exports2.Utf8ErrorReason = exports2.UnicodeNormalizationForm = exports2.SupportedAlgorithm = exports2.mnemonicToSeed = exports2.isValidMnemonic = exports2.entropyToMnemonic = exports2.mnemonicToEntropy = exports2.getAccountPath = exports2.verifyTypedData = exports2.verifyMessage = exports2.recoverPublicKey = exports2.computePublicKey = exports2.recoverAddress = exports2.computeAddress = exports2.getJsonWalletAddress = exports2.TransactionTypes = exports2.serializeTransaction = exports2.parseTransaction = exports2.accessListify = exports2.joinSignature = exports2.splitSignature = exports2.soliditySha256 = exports2.solidityKeccak256 = exports2.solidityPack = exports2.shuffled = exports2.randomBytes = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = exports2.keccak256 = exports2.computeHmac = exports2.commify = exports2.parseUnits = exports2.formatUnits = exports2.parseEther = exports2.formatEther = exports2.isAddress = exports2.getCreate2Address = exports2.getContractAddress = exports2.getIcapAddress = exports2.getAddress = exports2._TypedDataEncoder = exports2.id = exports2.isValidName = exports2.namehash = exports2.hashMessage = exports2.parseBytes32String = void 0; + var abi_1 = require_lib11(); + Object.defineProperty(exports2, "AbiCoder", { enumerable: true, get: function() { + return abi_1.AbiCoder; + } }); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return abi_1.checkResultErrors; + } }); + Object.defineProperty(exports2, "ConstructorFragment", { enumerable: true, get: function() { + return abi_1.ConstructorFragment; + } }); + Object.defineProperty(exports2, "defaultAbiCoder", { enumerable: true, get: function() { + return abi_1.defaultAbiCoder; + } }); + Object.defineProperty(exports2, "ErrorFragment", { enumerable: true, get: function() { + return abi_1.ErrorFragment; + } }); + Object.defineProperty(exports2, "EventFragment", { enumerable: true, get: function() { + return abi_1.EventFragment; + } }); + Object.defineProperty(exports2, "FormatTypes", { enumerable: true, get: function() { + return abi_1.FormatTypes; + } }); + Object.defineProperty(exports2, "Fragment", { enumerable: true, get: function() { + return abi_1.Fragment; + } }); + Object.defineProperty(exports2, "FunctionFragment", { enumerable: true, get: function() { + return abi_1.FunctionFragment; + } }); + Object.defineProperty(exports2, "Indexed", { enumerable: true, get: function() { + return abi_1.Indexed; + } }); + Object.defineProperty(exports2, "Interface", { enumerable: true, get: function() { + return abi_1.Interface; + } }); + Object.defineProperty(exports2, "LogDescription", { enumerable: true, get: function() { + return abi_1.LogDescription; + } }); + Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() { + return abi_1.ParamType; + } }); + Object.defineProperty(exports2, "TransactionDescription", { enumerable: true, get: function() { + return abi_1.TransactionDescription; + } }); + var address_1 = require_lib7(); + Object.defineProperty(exports2, "getAddress", { enumerable: true, get: function() { + return address_1.getAddress; + } }); + Object.defineProperty(exports2, "getCreate2Address", { enumerable: true, get: function() { + return address_1.getCreate2Address; + } }); + Object.defineProperty(exports2, "getContractAddress", { enumerable: true, get: function() { + return address_1.getContractAddress; + } }); + Object.defineProperty(exports2, "getIcapAddress", { enumerable: true, get: function() { + return address_1.getIcapAddress; + } }); + Object.defineProperty(exports2, "isAddress", { enumerable: true, get: function() { + return address_1.isAddress; + } }); + var base64 = __importStar(require_lib26()); + exports2.base64 = base64; + var basex_1 = require_lib17(); + Object.defineProperty(exports2, "base58", { enumerable: true, get: function() { + return basex_1.Base58; + } }); + var bytes_1 = require_lib2(); + Object.defineProperty(exports2, "arrayify", { enumerable: true, get: function() { + return bytes_1.arrayify; + } }); + Object.defineProperty(exports2, "concat", { enumerable: true, get: function() { + return bytes_1.concat; + } }); + Object.defineProperty(exports2, "hexConcat", { enumerable: true, get: function() { + return bytes_1.hexConcat; + } }); + Object.defineProperty(exports2, "hexDataSlice", { enumerable: true, get: function() { + return bytes_1.hexDataSlice; + } }); + Object.defineProperty(exports2, "hexDataLength", { enumerable: true, get: function() { + return bytes_1.hexDataLength; + } }); + Object.defineProperty(exports2, "hexlify", { enumerable: true, get: function() { + return bytes_1.hexlify; + } }); + Object.defineProperty(exports2, "hexStripZeros", { enumerable: true, get: function() { + return bytes_1.hexStripZeros; + } }); + Object.defineProperty(exports2, "hexValue", { enumerable: true, get: function() { + return bytes_1.hexValue; + } }); + Object.defineProperty(exports2, "hexZeroPad", { enumerable: true, get: function() { + return bytes_1.hexZeroPad; + } }); + Object.defineProperty(exports2, "isBytes", { enumerable: true, get: function() { + return bytes_1.isBytes; + } }); + Object.defineProperty(exports2, "isBytesLike", { enumerable: true, get: function() { + return bytes_1.isBytesLike; + } }); + Object.defineProperty(exports2, "isHexString", { enumerable: true, get: function() { + return bytes_1.isHexString; + } }); + Object.defineProperty(exports2, "joinSignature", { enumerable: true, get: function() { + return bytes_1.joinSignature; + } }); + Object.defineProperty(exports2, "zeroPad", { enumerable: true, get: function() { + return bytes_1.zeroPad; + } }); + Object.defineProperty(exports2, "splitSignature", { enumerable: true, get: function() { + return bytes_1.splitSignature; + } }); + Object.defineProperty(exports2, "stripZeros", { enumerable: true, get: function() { + return bytes_1.stripZeros; + } }); + var hash_1 = require_lib10(); + Object.defineProperty(exports2, "_TypedDataEncoder", { enumerable: true, get: function() { + return hash_1._TypedDataEncoder; + } }); + Object.defineProperty(exports2, "hashMessage", { enumerable: true, get: function() { + return hash_1.hashMessage; + } }); + Object.defineProperty(exports2, "id", { enumerable: true, get: function() { + return hash_1.id; + } }); + Object.defineProperty(exports2, "isValidName", { enumerable: true, get: function() { + return hash_1.isValidName; + } }); + Object.defineProperty(exports2, "namehash", { enumerable: true, get: function() { + return hash_1.namehash; + } }); + var hdnode_1 = require_lib21(); + Object.defineProperty(exports2, "defaultPath", { enumerable: true, get: function() { + return hdnode_1.defaultPath; + } }); + Object.defineProperty(exports2, "entropyToMnemonic", { enumerable: true, get: function() { + return hdnode_1.entropyToMnemonic; + } }); + Object.defineProperty(exports2, "getAccountPath", { enumerable: true, get: function() { + return hdnode_1.getAccountPath; + } }); + Object.defineProperty(exports2, "HDNode", { enumerable: true, get: function() { + return hdnode_1.HDNode; + } }); + Object.defineProperty(exports2, "isValidMnemonic", { enumerable: true, get: function() { + return hdnode_1.isValidMnemonic; + } }); + Object.defineProperty(exports2, "mnemonicToEntropy", { enumerable: true, get: function() { + return hdnode_1.mnemonicToEntropy; + } }); + Object.defineProperty(exports2, "mnemonicToSeed", { enumerable: true, get: function() { + return hdnode_1.mnemonicToSeed; + } }); + var json_wallets_1 = require_lib23(); + Object.defineProperty(exports2, "getJsonWalletAddress", { enumerable: true, get: function() { + return json_wallets_1.getJsonWalletAddress; + } }); + var keccak256_1 = require_lib5(); + Object.defineProperty(exports2, "keccak256", { enumerable: true, get: function() { + return keccak256_1.keccak256; + } }); + var logger_1 = require_lib(); + Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() { + return logger_1.Logger; + } }); + var sha2_1 = require_lib19(); + Object.defineProperty(exports2, "computeHmac", { enumerable: true, get: function() { + return sha2_1.computeHmac; + } }); + Object.defineProperty(exports2, "ripemd160", { enumerable: true, get: function() { + return sha2_1.ripemd160; + } }); + Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() { + return sha2_1.sha256; + } }); + Object.defineProperty(exports2, "sha512", { enumerable: true, get: function() { + return sha2_1.sha512; + } }); + var solidity_1 = require_lib29(); + Object.defineProperty(exports2, "solidityKeccak256", { enumerable: true, get: function() { + return solidity_1.keccak256; + } }); + Object.defineProperty(exports2, "solidityPack", { enumerable: true, get: function() { + return solidity_1.pack; + } }); + Object.defineProperty(exports2, "soliditySha256", { enumerable: true, get: function() { + return solidity_1.sha256; + } }); + var random_1 = require_lib22(); + Object.defineProperty(exports2, "randomBytes", { enumerable: true, get: function() { + return random_1.randomBytes; + } }); + Object.defineProperty(exports2, "shuffled", { enumerable: true, get: function() { + return random_1.shuffled; + } }); + var properties_1 = require_lib4(); + Object.defineProperty(exports2, "checkProperties", { enumerable: true, get: function() { + return properties_1.checkProperties; + } }); + Object.defineProperty(exports2, "deepCopy", { enumerable: true, get: function() { + return properties_1.deepCopy; + } }); + Object.defineProperty(exports2, "defineReadOnly", { enumerable: true, get: function() { + return properties_1.defineReadOnly; + } }); + Object.defineProperty(exports2, "getStatic", { enumerable: true, get: function() { + return properties_1.getStatic; + } }); + Object.defineProperty(exports2, "resolveProperties", { enumerable: true, get: function() { + return properties_1.resolveProperties; + } }); + Object.defineProperty(exports2, "shallowCopy", { enumerable: true, get: function() { + return properties_1.shallowCopy; + } }); + var RLP = __importStar(require_lib6()); + exports2.RLP = RLP; + var signing_key_1 = require_lib14(); + Object.defineProperty(exports2, "computePublicKey", { enumerable: true, get: function() { + return signing_key_1.computePublicKey; + } }); + Object.defineProperty(exports2, "recoverPublicKey", { enumerable: true, get: function() { + return signing_key_1.recoverPublicKey; + } }); + Object.defineProperty(exports2, "SigningKey", { enumerable: true, get: function() { + return signing_key_1.SigningKey; + } }); + var strings_1 = require_lib9(); + Object.defineProperty(exports2, "formatBytes32String", { enumerable: true, get: function() { + return strings_1.formatBytes32String; + } }); + Object.defineProperty(exports2, "nameprep", { enumerable: true, get: function() { + return strings_1.nameprep; + } }); + Object.defineProperty(exports2, "parseBytes32String", { enumerable: true, get: function() { + return strings_1.parseBytes32String; + } }); + Object.defineProperty(exports2, "_toEscapedUtf8String", { enumerable: true, get: function() { + return strings_1._toEscapedUtf8String; + } }); + Object.defineProperty(exports2, "toUtf8Bytes", { enumerable: true, get: function() { + return strings_1.toUtf8Bytes; + } }); + Object.defineProperty(exports2, "toUtf8CodePoints", { enumerable: true, get: function() { + return strings_1.toUtf8CodePoints; + } }); + Object.defineProperty(exports2, "toUtf8String", { enumerable: true, get: function() { + return strings_1.toUtf8String; + } }); + Object.defineProperty(exports2, "Utf8ErrorFuncs", { enumerable: true, get: function() { + return strings_1.Utf8ErrorFuncs; + } }); + var transactions_1 = require_lib15(); + Object.defineProperty(exports2, "accessListify", { enumerable: true, get: function() { + return transactions_1.accessListify; + } }); + Object.defineProperty(exports2, "computeAddress", { enumerable: true, get: function() { + return transactions_1.computeAddress; + } }); + Object.defineProperty(exports2, "parseTransaction", { enumerable: true, get: function() { + return transactions_1.parse; + } }); + Object.defineProperty(exports2, "recoverAddress", { enumerable: true, get: function() { + return transactions_1.recoverAddress; + } }); + Object.defineProperty(exports2, "serializeTransaction", { enumerable: true, get: function() { + return transactions_1.serialize; + } }); + Object.defineProperty(exports2, "TransactionTypes", { enumerable: true, get: function() { + return transactions_1.TransactionTypes; + } }); + var units_1 = require_lib30(); + Object.defineProperty(exports2, "commify", { enumerable: true, get: function() { + return units_1.commify; + } }); + Object.defineProperty(exports2, "formatEther", { enumerable: true, get: function() { + return units_1.formatEther; + } }); + Object.defineProperty(exports2, "parseEther", { enumerable: true, get: function() { + return units_1.parseEther; + } }); + Object.defineProperty(exports2, "formatUnits", { enumerable: true, get: function() { + return units_1.formatUnits; + } }); + Object.defineProperty(exports2, "parseUnits", { enumerable: true, get: function() { + return units_1.parseUnits; + } }); + var wallet_1 = require_lib24(); + Object.defineProperty(exports2, "verifyMessage", { enumerable: true, get: function() { + return wallet_1.verifyMessage; + } }); + Object.defineProperty(exports2, "verifyTypedData", { enumerable: true, get: function() { + return wallet_1.verifyTypedData; + } }); + var web_1 = require_lib27(); + Object.defineProperty(exports2, "_fetchData", { enumerable: true, get: function() { + return web_1._fetchData; + } }); + Object.defineProperty(exports2, "fetchJson", { enumerable: true, get: function() { + return web_1.fetchJson; + } }); + Object.defineProperty(exports2, "poll", { enumerable: true, get: function() { + return web_1.poll; + } }); + var sha2_2 = require_lib19(); + Object.defineProperty(exports2, "SupportedAlgorithm", { enumerable: true, get: function() { + return sha2_2.SupportedAlgorithm; + } }); + var strings_2 = require_lib9(); + Object.defineProperty(exports2, "UnicodeNormalizationForm", { enumerable: true, get: function() { + return strings_2.UnicodeNormalizationForm; + } }); + Object.defineProperty(exports2, "Utf8ErrorReason", { enumerable: true, get: function() { + return strings_2.Utf8ErrorReason; + } }); + } +}); + +// node_modules/ethers/lib/_version.js +var require_version25 = __commonJS({ + "node_modules/ethers/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "ethers/5.5.2"; + } +}); + +// node_modules/ethers/lib/ethers.js +var require_ethers = __commonJS({ + "node_modules/ethers/lib/ethers.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result2 = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result2, mod, k); + } + __setModuleDefault(result2, mod); + return result2; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.version = exports2.wordlists = exports2.utils = exports2.logger = exports2.errors = exports2.constants = exports2.FixedNumber = exports2.BigNumber = exports2.ContractFactory = exports2.Contract = exports2.BaseContract = exports2.providers = exports2.getDefaultProvider = exports2.VoidSigner = exports2.Wallet = exports2.Signer = void 0; + var contracts_1 = require_lib16(); + Object.defineProperty(exports2, "BaseContract", { enumerable: true, get: function() { + return contracts_1.BaseContract; + } }); + Object.defineProperty(exports2, "Contract", { enumerable: true, get: function() { + return contracts_1.Contract; + } }); + Object.defineProperty(exports2, "ContractFactory", { enumerable: true, get: function() { + return contracts_1.ContractFactory; + } }); + var bignumber_1 = require_lib3(); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return bignumber_1.BigNumber; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return bignumber_1.FixedNumber; + } }); + var abstract_signer_1 = require_lib13(); + Object.defineProperty(exports2, "Signer", { enumerable: true, get: function() { + return abstract_signer_1.Signer; + } }); + Object.defineProperty(exports2, "VoidSigner", { enumerable: true, get: function() { + return abstract_signer_1.VoidSigner; + } }); + var wallet_1 = require_lib24(); + Object.defineProperty(exports2, "Wallet", { enumerable: true, get: function() { + return wallet_1.Wallet; + } }); + var constants = __importStar(require_lib8()); + exports2.constants = constants; + var providers = __importStar(require_lib28()); + exports2.providers = providers; + var providers_1 = require_lib28(); + Object.defineProperty(exports2, "getDefaultProvider", { enumerable: true, get: function() { + return providers_1.getDefaultProvider; + } }); + var wordlists_1 = require_lib20(); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return wordlists_1.Wordlist; + } }); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return wordlists_1.wordlists; + } }); + var utils = __importStar(require_utils5()); + exports2.utils = utils; + var logger_1 = require_lib(); + Object.defineProperty(exports2, "errors", { enumerable: true, get: function() { + return logger_1.ErrorCode; + } }); + var _version_1 = require_version25(); + Object.defineProperty(exports2, "version", { enumerable: true, get: function() { + return _version_1.version; + } }); + var logger = new logger_1.Logger(_version_1.version); + exports2.logger = logger; + } +}); + +// node_modules/ethers/lib/index.js +var require_lib31 = __commonJS({ + "node_modules/ethers/lib/index.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__importStar || function(mod) { + if (mod && mod.__esModule) return mod; + var result2 = {}; + if (mod != null) { + for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result2, mod, k); + } + __setModuleDefault(result2, mod); + return result2; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.version = exports2.wordlists = exports2.utils = exports2.logger = exports2.errors = exports2.constants = exports2.FixedNumber = exports2.BigNumber = exports2.ContractFactory = exports2.Contract = exports2.BaseContract = exports2.providers = exports2.getDefaultProvider = exports2.VoidSigner = exports2.Wallet = exports2.Signer = exports2.ethers = void 0; + var ethers2 = __importStar(require_ethers()); + exports2.ethers = ethers2; + try { + anyGlobal = window; + if (anyGlobal._ethers == null) { + anyGlobal._ethers = ethers2; + } + } catch (error) { + } + var anyGlobal; + var ethers_1 = require_ethers(); + Object.defineProperty(exports2, "Signer", { enumerable: true, get: function() { + return ethers_1.Signer; + } }); + Object.defineProperty(exports2, "Wallet", { enumerable: true, get: function() { + return ethers_1.Wallet; + } }); + Object.defineProperty(exports2, "VoidSigner", { enumerable: true, get: function() { + return ethers_1.VoidSigner; + } }); + Object.defineProperty(exports2, "getDefaultProvider", { enumerable: true, get: function() { + return ethers_1.getDefaultProvider; + } }); + Object.defineProperty(exports2, "providers", { enumerable: true, get: function() { + return ethers_1.providers; + } }); + Object.defineProperty(exports2, "BaseContract", { enumerable: true, get: function() { + return ethers_1.BaseContract; + } }); + Object.defineProperty(exports2, "Contract", { enumerable: true, get: function() { + return ethers_1.Contract; + } }); + Object.defineProperty(exports2, "ContractFactory", { enumerable: true, get: function() { + return ethers_1.ContractFactory; + } }); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return ethers_1.BigNumber; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return ethers_1.FixedNumber; + } }); + Object.defineProperty(exports2, "constants", { enumerable: true, get: function() { + return ethers_1.constants; + } }); + Object.defineProperty(exports2, "errors", { enumerable: true, get: function() { + return ethers_1.errors; + } }); + Object.defineProperty(exports2, "logger", { enumerable: true, get: function() { + return ethers_1.logger; + } }); + Object.defineProperty(exports2, "utils", { enumerable: true, get: function() { + return ethers_1.utils; + } }); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return ethers_1.wordlists; + } }); + Object.defineProperty(exports2, "version", { enumerable: true, get: function() { + return ethers_1.version; + } }); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return ethers_1.Wordlist; + } }); + } +}); + +// node_modules/jsbi/dist/jsbi-cjs.js +var require_jsbi_cjs = __commonJS({ + "node_modules/jsbi/dist/jsbi-cjs.js"(exports2, module2) { + "use strict"; + var JSBI3 = class _JSBI extends Array { + constructor(i, _) { + if (super(i), this.sign = _, i > _JSBI.__kMaxLength) throw new RangeError("Maximum BigInt size exceeded"); + } + static BigInt(i) { + var _ = Math.floor, t = Number.isFinite; + if ("number" == typeof i) { + if (0 === i) return _JSBI.__zero(); + if (_JSBI.__isOneDigitInt(i)) return 0 > i ? _JSBI.__oneDigit(-i, true) : _JSBI.__oneDigit(i, false); + if (!t(i) || _(i) !== i) throw new RangeError("The number " + i + " cannot be converted to BigInt because it is not an integer"); + return _JSBI.__fromDouble(i); + } + if ("string" == typeof i) { + const _2 = _JSBI.__fromString(i); + if (null === _2) throw new SyntaxError("Cannot convert " + i + " to a BigInt"); + return _2; + } + if ("boolean" == typeof i) return true === i ? _JSBI.__oneDigit(1, false) : _JSBI.__zero(); + if ("object" == typeof i) { + if (i.constructor === _JSBI) return i; + const _2 = _JSBI.__toPrimitive(i); + return _JSBI.BigInt(_2); + } + throw new TypeError("Cannot convert " + i + " to a BigInt"); + } + toDebugString() { + const i = ["BigInt["]; + for (const _ of this) i.push((_ ? (_ >>> 0).toString(16) : _) + ", "); + return i.push("]"), i.join(""); + } + toString(i = 10) { + if (2 > i || 36 < i) throw new RangeError("toString() radix argument must be between 2 and 36"); + return 0 === this.length ? "0" : 0 == (i & i - 1) ? _JSBI.__toStringBasePowerOfTwo(this, i) : _JSBI.__toStringGeneric(this, i, false); + } + static toNumber(i) { + const _ = i.length; + if (0 === _) return 0; + if (1 === _) { + const _2 = i.__unsignedDigit(0); + return i.sign ? -_2 : _2; + } + const t = i.__digit(_ - 1), e = _JSBI.__clz30(t), n = 30 * _ - e; + if (1024 < n) return i.sign ? -Infinity : 1 / 0; + let g = n - 1, o = t, s = _ - 1; + const l = e + 3; + let r = 32 === l ? 0 : o << l; + r >>>= 12; + const a = l - 12; + let u = 12 <= l ? 0 : o << 20 + l, d = 20 + l; + for (0 < a && 0 < s && (s--, o = i.__digit(s), r |= o >>> 30 - a, u = o << a + 2, d = a + 2); 0 < d && 0 < s; ) s--, o = i.__digit(s), u |= 30 <= d ? o << d - 30 : o >>> 30 - d, d -= 30; + const h = _JSBI.__decideRounding(i, d, s, o); + if ((1 === h || 0 === h && 1 == (1 & u)) && (u = u + 1 >>> 0, 0 === u && (r++, 0 != r >>> 20 && (r = 0, g++, 1023 < g)))) return i.sign ? -Infinity : 1 / 0; + const m = i.sign ? -2147483648 : 0; + return g = g + 1023 << 20, _JSBI.__kBitConversionInts[1] = m | g | r, _JSBI.__kBitConversionInts[0] = u, _JSBI.__kBitConversionDouble[0]; + } + static unaryMinus(i) { + if (0 === i.length) return i; + const _ = i.__copy(); + return _.sign = !i.sign, _; + } + static bitwiseNot(i) { + return i.sign ? _JSBI.__absoluteSubOne(i).__trim() : _JSBI.__absoluteAddOne(i, true); + } + static exponentiate(i, _) { + if (_.sign) throw new RangeError("Exponent must be positive"); + if (0 === _.length) return _JSBI.__oneDigit(1, false); + if (0 === i.length) return i; + if (1 === i.length && 1 === i.__digit(0)) return i.sign && 0 == (1 & _.__digit(0)) ? _JSBI.unaryMinus(i) : i; + if (1 < _.length) throw new RangeError("BigInt too big"); + let t = _.__unsignedDigit(0); + if (1 === t) return i; + if (t >= _JSBI.__kMaxLengthBits) throw new RangeError("BigInt too big"); + if (1 === i.length && 2 === i.__digit(0)) { + const _2 = 1 + (0 | t / 30), e2 = i.sign && 0 != (1 & t), n2 = new _JSBI(_2, e2); + n2.__initializeDigits(); + const g = 1 << t % 30; + return n2.__setDigit(_2 - 1, g), n2; + } + let e = null, n = i; + for (0 != (1 & t) && (e = i), t >>= 1; 0 !== t; t >>= 1) n = _JSBI.multiply(n, n), 0 != (1 & t) && (null === e ? e = n : e = _JSBI.multiply(e, n)); + return e; + } + static multiply(_, t) { + if (0 === _.length) return _; + if (0 === t.length) return t; + let i = _.length + t.length; + 30 <= _.__clzmsd() + t.__clzmsd() && i--; + const e = new _JSBI(i, _.sign !== t.sign); + e.__initializeDigits(); + for (let n = 0; n < _.length; n++) _JSBI.__multiplyAccumulate(t, _.__digit(n), e, n); + return e.__trim(); + } + static divide(i, _) { + if (0 === _.length) throw new RangeError("Division by zero"); + if (0 > _JSBI.__absoluteCompare(i, _)) return _JSBI.__zero(); + const t = i.sign !== _.sign, e = _.__unsignedDigit(0); + let n; + if (1 === _.length && 32767 >= e) { + if (1 === e) return t === i.sign ? i : _JSBI.unaryMinus(i); + n = _JSBI.__absoluteDivSmall(i, e, null); + } else n = _JSBI.__absoluteDivLarge(i, _, true, false); + return n.sign = t, n.__trim(); + } + static remainder(i, _) { + if (0 === _.length) throw new RangeError("Division by zero"); + if (0 > _JSBI.__absoluteCompare(i, _)) return i; + const t = _.__unsignedDigit(0); + if (1 === _.length && 32767 >= t) { + if (1 === t) return _JSBI.__zero(); + const _2 = _JSBI.__absoluteModSmall(i, t); + return 0 === _2 ? _JSBI.__zero() : _JSBI.__oneDigit(_2, i.sign); + } + const e = _JSBI.__absoluteDivLarge(i, _, false, true); + return e.sign = i.sign, e.__trim(); + } + static add(i, _) { + const t = i.sign; + return t === _.sign ? _JSBI.__absoluteAdd(i, _, t) : 0 <= _JSBI.__absoluteCompare(i, _) ? _JSBI.__absoluteSub(i, _, t) : _JSBI.__absoluteSub(_, i, !t); + } + static subtract(i, _) { + const t = i.sign; + return t === _.sign ? 0 <= _JSBI.__absoluteCompare(i, _) ? _JSBI.__absoluteSub(i, _, t) : _JSBI.__absoluteSub(_, i, !t) : _JSBI.__absoluteAdd(i, _, t); + } + static leftShift(i, _) { + return 0 === _.length || 0 === i.length ? i : _.sign ? _JSBI.__rightShiftByAbsolute(i, _) : _JSBI.__leftShiftByAbsolute(i, _); + } + static signedRightShift(i, _) { + return 0 === _.length || 0 === i.length ? i : _.sign ? _JSBI.__leftShiftByAbsolute(i, _) : _JSBI.__rightShiftByAbsolute(i, _); + } + static unsignedRightShift() { + throw new TypeError("BigInts have no unsigned right shift; use >> instead"); + } + static lessThan(i, _) { + return 0 > _JSBI.__compareToBigInt(i, _); + } + static lessThanOrEqual(i, _) { + return 0 >= _JSBI.__compareToBigInt(i, _); + } + static greaterThan(i, _) { + return 0 < _JSBI.__compareToBigInt(i, _); + } + static greaterThanOrEqual(i, _) { + return 0 <= _JSBI.__compareToBigInt(i, _); + } + static equal(_, t) { + if (_.sign !== t.sign) return false; + if (_.length !== t.length) return false; + for (let e = 0; e < _.length; e++) if (_.__digit(e) !== t.__digit(e)) return false; + return true; + } + static notEqual(i, _) { + return !_JSBI.equal(i, _); + } + static bitwiseAnd(i, _) { + var t = Math.max; + if (!i.sign && !_.sign) return _JSBI.__absoluteAnd(i, _).__trim(); + if (i.sign && _.sign) { + const e = t(i.length, _.length) + 1; + let n = _JSBI.__absoluteSubOne(i, e); + const g = _JSBI.__absoluteSubOne(_); + return n = _JSBI.__absoluteOr(n, g, n), _JSBI.__absoluteAddOne(n, true, n).__trim(); + } + return i.sign && ([i, _] = [_, i]), _JSBI.__absoluteAndNot(i, _JSBI.__absoluteSubOne(_)).__trim(); + } + static bitwiseXor(i, _) { + var t = Math.max; + if (!i.sign && !_.sign) return _JSBI.__absoluteXor(i, _).__trim(); + if (i.sign && _.sign) { + const e2 = t(i.length, _.length), n2 = _JSBI.__absoluteSubOne(i, e2), g = _JSBI.__absoluteSubOne(_); + return _JSBI.__absoluteXor(n2, g, n2).__trim(); + } + const e = t(i.length, _.length) + 1; + i.sign && ([i, _] = [_, i]); + let n = _JSBI.__absoluteSubOne(_, e); + return n = _JSBI.__absoluteXor(n, i, n), _JSBI.__absoluteAddOne(n, true, n).__trim(); + } + static bitwiseOr(i, _) { + var t = Math.max; + const e = t(i.length, _.length); + if (!i.sign && !_.sign) return _JSBI.__absoluteOr(i, _).__trim(); + if (i.sign && _.sign) { + let t2 = _JSBI.__absoluteSubOne(i, e); + const n2 = _JSBI.__absoluteSubOne(_); + return t2 = _JSBI.__absoluteAnd(t2, n2, t2), _JSBI.__absoluteAddOne(t2, true, t2).__trim(); + } + i.sign && ([i, _] = [_, i]); + let n = _JSBI.__absoluteSubOne(_, e); + return n = _JSBI.__absoluteAndNot(n, i, n), _JSBI.__absoluteAddOne(n, true, n).__trim(); + } + static asIntN(_, t) { + var i = Math.floor; + if (0 === t.length) return t; + if (_ = i(_), 0 > _) throw new RangeError("Invalid value: not (convertible to) a safe integer"); + if (0 === _) return _JSBI.__zero(); + if (_ >= _JSBI.__kMaxLengthBits) return t; + const e = 0 | (_ + 29) / 30; + if (t.length < e) return t; + const g = t.__unsignedDigit(e - 1), o = 1 << (_ - 1) % 30; + if (t.length === e && g < o) return t; + if (!((g & o) === o)) return _JSBI.__truncateToNBits(_, t); + if (!t.sign) return _JSBI.__truncateAndSubFromPowerOfTwo(_, t, true); + if (0 == (g & o - 1)) { + for (let n = e - 2; 0 <= n; n--) if (0 !== t.__digit(n)) return _JSBI.__truncateAndSubFromPowerOfTwo(_, t, false); + return t.length === e && g === o ? t : _JSBI.__truncateToNBits(_, t); + } + return _JSBI.__truncateAndSubFromPowerOfTwo(_, t, false); + } + static asUintN(i, _) { + var t = Math.floor; + if (0 === _.length) return _; + if (i = t(i), 0 > i) throw new RangeError("Invalid value: not (convertible to) a safe integer"); + if (0 === i) return _JSBI.__zero(); + if (_.sign) { + if (i > _JSBI.__kMaxLengthBits) throw new RangeError("BigInt too big"); + return _JSBI.__truncateAndSubFromPowerOfTwo(i, _, false); + } + if (i >= _JSBI.__kMaxLengthBits) return _; + const e = 0 | (i + 29) / 30; + if (_.length < e) return _; + const g = i % 30; + if (_.length == e) { + if (0 === g) return _; + const i2 = _.__digit(e - 1); + if (0 == i2 >>> g) return _; + } + return _JSBI.__truncateToNBits(i, _); + } + static ADD(i, _) { + if (i = _JSBI.__toPrimitive(i), _ = _JSBI.__toPrimitive(_), "string" == typeof i) return "string" != typeof _ && (_ = _.toString()), i + _; + if ("string" == typeof _) return i.toString() + _; + if (i = _JSBI.__toNumeric(i), _ = _JSBI.__toNumeric(_), _JSBI.__isBigInt(i) && _JSBI.__isBigInt(_)) return _JSBI.add(i, _); + if ("number" == typeof i && "number" == typeof _) return i + _; + throw new TypeError("Cannot mix BigInt and other types, use explicit conversions"); + } + static LT(i, _) { + return _JSBI.__compare(i, _, 0); + } + static LE(i, _) { + return _JSBI.__compare(i, _, 1); + } + static GT(i, _) { + return _JSBI.__compare(i, _, 2); + } + static GE(i, _) { + return _JSBI.__compare(i, _, 3); + } + static EQ(i, _) { + for (; ; ) { + if (_JSBI.__isBigInt(i)) return _JSBI.__isBigInt(_) ? _JSBI.equal(i, _) : _JSBI.EQ(_, i); + if ("number" == typeof i) { + if (_JSBI.__isBigInt(_)) return _JSBI.__equalToNumber(_, i); + if ("object" != typeof _) return i == _; + _ = _JSBI.__toPrimitive(_); + } else if ("string" == typeof i) { + if (_JSBI.__isBigInt(_)) return i = _JSBI.__fromString(i), null !== i && _JSBI.equal(i, _); + if ("object" != typeof _) return i == _; + _ = _JSBI.__toPrimitive(_); + } else if ("boolean" == typeof i) { + if (_JSBI.__isBigInt(_)) return _JSBI.__equalToNumber(_, +i); + if ("object" != typeof _) return i == _; + _ = _JSBI.__toPrimitive(_); + } else if ("symbol" == typeof i) { + if (_JSBI.__isBigInt(_)) return false; + if ("object" != typeof _) return i == _; + _ = _JSBI.__toPrimitive(_); + } else if ("object" == typeof i) { + if ("object" == typeof _ && _.constructor !== _JSBI) return i == _; + i = _JSBI.__toPrimitive(i); + } else return i == _; + } + } + static NE(i, _) { + return !_JSBI.EQ(i, _); + } + static __zero() { + return new _JSBI(0, false); + } + static __oneDigit(i, _) { + const t = new _JSBI(1, _); + return t.__setDigit(0, i), t; + } + __copy() { + const _ = new _JSBI(this.length, this.sign); + for (let t = 0; t < this.length; t++) _[t] = this[t]; + return _; + } + __trim() { + let i = this.length, _ = this[i - 1]; + for (; 0 === _; ) i--, _ = this[i - 1], this.pop(); + return 0 === i && (this.sign = false), this; + } + __initializeDigits() { + for (let _ = 0; _ < this.length; _++) this[_] = 0; + } + static __decideRounding(i, _, t, e) { + if (0 < _) return -1; + let n; + if (0 > _) n = -_ - 1; + else { + if (0 === t) return -1; + t--, e = i.__digit(t), n = 29; + } + let g = 1 << n; + if (0 == (e & g)) return -1; + if (g -= 1, 0 != (e & g)) return 1; + for (; 0 < t; ) if (t--, 0 !== i.__digit(t)) return 1; + return 0; + } + static __fromDouble(i) { + _JSBI.__kBitConversionDouble[0] = i; + const _ = 2047 & _JSBI.__kBitConversionInts[1] >>> 20, t = _ - 1023, e = (0 | t / 30) + 1, n = new _JSBI(e, 0 > i); + let g = 1048575 & _JSBI.__kBitConversionInts[1] | 1048576, o = _JSBI.__kBitConversionInts[0]; + const s = 20, l = t % 30; + let r, a = 0; + if (l < 20) { + const i2 = s - l; + a = i2 + 32, r = g >>> i2, g = g << 32 - i2 | o >>> i2, o <<= 32 - i2; + } else if (l === 20) a = 32, r = g, g = o, o = 0; + else { + const i2 = l - s; + a = 32 - i2, r = g << i2 | o >>> 32 - i2, g = o << i2, o = 0; + } + n.__setDigit(e - 1, r); + for (let _2 = e - 2; 0 <= _2; _2--) 0 < a ? (a -= 30, r = g >>> 2, g = g << 30 | o >>> 2, o <<= 30) : r = 0, n.__setDigit(_2, r); + return n.__trim(); + } + static __isWhitespace(i) { + return !!(13 >= i && 9 <= i) || (159 >= i ? 32 == i : 131071 >= i ? 160 == i || 5760 == i : 196607 >= i ? (i &= 131071, 10 >= i || 40 == i || 41 == i || 47 == i || 95 == i || 4096 == i) : 65279 == i); + } + static __fromString(i, _ = 0) { + let t = 0; + const e = i.length; + let n = 0; + if (n === e) return _JSBI.__zero(); + let g = i.charCodeAt(n); + for (; _JSBI.__isWhitespace(g); ) { + if (++n === e) return _JSBI.__zero(); + g = i.charCodeAt(n); + } + if (43 === g) { + if (++n === e) return null; + g = i.charCodeAt(n), t = 1; + } else if (45 === g) { + if (++n === e) return null; + g = i.charCodeAt(n), t = -1; + } + if (0 === _) { + if (_ = 10, 48 === g) { + if (++n === e) return _JSBI.__zero(); + if (g = i.charCodeAt(n), 88 === g || 120 === g) { + if (_ = 16, ++n === e) return null; + g = i.charCodeAt(n); + } else if (79 === g || 111 === g) { + if (_ = 8, ++n === e) return null; + g = i.charCodeAt(n); + } else if (66 === g || 98 === g) { + if (_ = 2, ++n === e) return null; + g = i.charCodeAt(n); + } + } + } else if (16 === _ && 48 === g) { + if (++n === e) return _JSBI.__zero(); + if (g = i.charCodeAt(n), 88 === g || 120 === g) { + if (++n === e) return null; + g = i.charCodeAt(n); + } + } + if (0 != t && 10 !== _) return null; + for (; 48 === g; ) { + if (++n === e) return _JSBI.__zero(); + g = i.charCodeAt(n); + } + const o = e - n; + let s = _JSBI.__kMaxBitsPerChar[_], l = _JSBI.__kBitsPerCharTableMultiplier - 1; + if (o > 1073741824 / s) return null; + const r = s * o + l >>> _JSBI.__kBitsPerCharTableShift, a = new _JSBI(0 | (r + 29) / 30, false), u = 10 > _ ? _ : 10, h = 10 < _ ? _ - 10 : 0; + if (0 == (_ & _ - 1)) { + s >>= _JSBI.__kBitsPerCharTableShift; + const _2 = [], t2 = []; + let o2 = false; + do { + let l2 = 0, r2 = 0; + for (; ; ) { + let _3; + if (g - 48 >>> 0 < u) _3 = g - 48; + else if ((32 | g) - 97 >>> 0 < h) _3 = (32 | g) - 87; + else { + o2 = true; + break; + } + if (r2 += s, l2 = l2 << s | _3, ++n === e) { + o2 = true; + break; + } + if (g = i.charCodeAt(n), 30 < r2 + s) break; + } + _2.push(l2), t2.push(r2); + } while (!o2); + _JSBI.__fillFromParts(a, _2, t2); + } else { + a.__initializeDigits(); + let t2 = false, o2 = 0; + do { + let r2 = 0, b = 1; + for (; ; ) { + let s2; + if (g - 48 >>> 0 < u) s2 = g - 48; + else if ((32 | g) - 97 >>> 0 < h) s2 = (32 | g) - 87; + else { + t2 = true; + break; + } + const l2 = b * _; + if (1073741823 < l2) break; + if (b = l2, r2 = r2 * _ + s2, o2++, ++n === e) { + t2 = true; + break; + } + g = i.charCodeAt(n); + } + l = 30 * _JSBI.__kBitsPerCharTableMultiplier - 1; + const D = 0 | (s * o2 + l >>> _JSBI.__kBitsPerCharTableShift) / 30; + a.__inplaceMultiplyAdd(b, r2, D); + } while (!t2); + } + if (n !== e) { + if (!_JSBI.__isWhitespace(g)) return null; + for (n++; n < e; n++) if (g = i.charCodeAt(n), !_JSBI.__isWhitespace(g)) return null; + } + return a.sign = -1 == t, a.__trim(); + } + static __fillFromParts(_, t, e) { + let n = 0, g = 0, o = 0; + for (let s = t.length - 1; 0 <= s; s--) { + const i = t[s], l = e[s]; + g |= i << o, o += l, 30 === o ? (_.__setDigit(n++, g), o = 0, g = 0) : 30 < o && (_.__setDigit(n++, 1073741823 & g), o -= 30, g = i >>> l - o); + } + if (0 !== g) { + if (n >= _.length) throw new Error("implementation bug"); + _.__setDigit(n++, g); + } + for (; n < _.length; n++) _.__setDigit(n, 0); + } + static __toStringBasePowerOfTwo(_, i) { + const t = _.length; + let e = i - 1; + e = (85 & e >>> 1) + (85 & e), e = (51 & e >>> 2) + (51 & e), e = (15 & e >>> 4) + (15 & e); + const n = e, g = i - 1, o = _.__digit(t - 1), s = _JSBI.__clz30(o); + let l = 0 | (30 * t - s + n - 1) / n; + if (_.sign && l++, 268435456 < l) throw new Error("string too long"); + const r = Array(l); + let a = l - 1, u = 0, d = 0; + for (let e2 = 0; e2 < t - 1; e2++) { + const i2 = _.__digit(e2), t2 = (u | i2 << d) & g; + r[a--] = _JSBI.__kConversionChars[t2]; + const o2 = n - d; + for (u = i2 >>> o2, d = 30 - o2; d >= n; ) r[a--] = _JSBI.__kConversionChars[u & g], u >>>= n, d -= n; + } + const h = (u | o << d) & g; + for (r[a--] = _JSBI.__kConversionChars[h], u = o >>> n - d; 0 !== u; ) r[a--] = _JSBI.__kConversionChars[u & g], u >>>= n; + if (_.sign && (r[a--] = "-"), -1 != a) throw new Error("implementation bug"); + return r.join(""); + } + static __toStringGeneric(_, i, t) { + const e = _.length; + if (0 === e) return ""; + if (1 === e) { + let e2 = _.__unsignedDigit(0).toString(i); + return false === t && _.sign && (e2 = "-" + e2), e2; + } + const n = 30 * e - _JSBI.__clz30(_.__digit(e - 1)), g = _JSBI.__kMaxBitsPerChar[i], o = g - 1; + let s = n * _JSBI.__kBitsPerCharTableMultiplier; + s += o - 1, s = 0 | s / o; + const l = s + 1 >> 1, r = _JSBI.exponentiate(_JSBI.__oneDigit(i, false), _JSBI.__oneDigit(l, false)); + let a, u; + const d = r.__unsignedDigit(0); + if (1 === r.length && 32767 >= d) { + a = new _JSBI(_.length, false), a.__initializeDigits(); + let t2 = 0; + for (let e2 = 2 * _.length - 1; 0 <= e2; e2--) { + const i2 = t2 << 15 | _.__halfDigit(e2); + a.__setHalfDigit(e2, 0 | i2 / d), t2 = 0 | i2 % d; + } + u = t2.toString(i); + } else { + const t2 = _JSBI.__absoluteDivLarge(_, r, true, true); + a = t2.quotient; + const e2 = t2.remainder.__trim(); + u = _JSBI.__toStringGeneric(e2, i, true); + } + a.__trim(); + let h = _JSBI.__toStringGeneric(a, i, true); + for (; u.length < l; ) u = "0" + u; + return false === t && _.sign && (h = "-" + h), h + u; + } + static __unequalSign(i) { + return i ? -1 : 1; + } + static __absoluteGreater(i) { + return i ? -1 : 1; + } + static __absoluteLess(i) { + return i ? 1 : -1; + } + static __compareToBigInt(i, _) { + const t = i.sign; + if (t !== _.sign) return _JSBI.__unequalSign(t); + const e = _JSBI.__absoluteCompare(i, _); + return 0 < e ? _JSBI.__absoluteGreater(t) : 0 > e ? _JSBI.__absoluteLess(t) : 0; + } + static __compareToNumber(i, _) { + if (_JSBI.__isOneDigitInt(_)) { + const t = i.sign, e = 0 > _; + if (t !== e) return _JSBI.__unequalSign(t); + if (0 === i.length) { + if (e) throw new Error("implementation bug"); + return 0 === _ ? 0 : -1; + } + if (1 < i.length) return _JSBI.__absoluteGreater(t); + const n = Math.abs(_), g = i.__unsignedDigit(0); + return g > n ? _JSBI.__absoluteGreater(t) : g < n ? _JSBI.__absoluteLess(t) : 0; + } + return _JSBI.__compareToDouble(i, _); + } + static __compareToDouble(i, _) { + if (_ !== _) return _; + if (_ === 1 / 0) return -1; + if (_ === -Infinity) return 1; + const t = i.sign; + if (t !== 0 > _) return _JSBI.__unequalSign(t); + if (0 === _) throw new Error("implementation bug: should be handled elsewhere"); + if (0 === i.length) return -1; + _JSBI.__kBitConversionDouble[0] = _; + const e = 2047 & _JSBI.__kBitConversionInts[1] >>> 20; + if (2047 == e) throw new Error("implementation bug: handled elsewhere"); + const n = e - 1023; + if (0 > n) return _JSBI.__absoluteGreater(t); + const g = i.length; + let o = i.__digit(g - 1); + const s = _JSBI.__clz30(o), l = 30 * g - s, r = n + 1; + if (l < r) return _JSBI.__absoluteLess(t); + if (l > r) return _JSBI.__absoluteGreater(t); + let a = 1048576 | 1048575 & _JSBI.__kBitConversionInts[1], u = _JSBI.__kBitConversionInts[0]; + const d = 20, h = 29 - s; + if (h !== (0 | (l - 1) % 30)) throw new Error("implementation bug"); + let m, b = 0; + if (20 > h) { + const i2 = d - h; + b = i2 + 32, m = a >>> i2, a = a << 32 - i2 | u >>> i2, u <<= 32 - i2; + } else if (20 === h) b = 32, m = a, a = u, u = 0; + else { + const i2 = h - d; + b = 32 - i2, m = a << i2 | u >>> 32 - i2, a = u << i2, u = 0; + } + if (o >>>= 0, m >>>= 0, o > m) return _JSBI.__absoluteGreater(t); + if (o < m) return _JSBI.__absoluteLess(t); + for (let e2 = g - 2; 0 <= e2; e2--) { + 0 < b ? (b -= 30, m = a >>> 2, a = a << 30 | u >>> 2, u <<= 30) : m = 0; + const _2 = i.__unsignedDigit(e2); + if (_2 > m) return _JSBI.__absoluteGreater(t); + if (_2 < m) return _JSBI.__absoluteLess(t); + } + if (0 !== a || 0 !== u) { + if (0 === b) throw new Error("implementation bug"); + return _JSBI.__absoluteLess(t); + } + return 0; + } + static __equalToNumber(i, _) { + var t = Math.abs; + return _JSBI.__isOneDigitInt(_) ? 0 === _ ? 0 === i.length : 1 === i.length && i.sign === 0 > _ && i.__unsignedDigit(0) === t(_) : 0 === _JSBI.__compareToDouble(i, _); + } + static __comparisonResultToBool(i, _) { + return 0 === _ ? 0 > i : 1 === _ ? 0 >= i : 2 === _ ? 0 < i : 3 === _ ? 0 <= i : void 0; + } + static __compare(i, _, t) { + if (i = _JSBI.__toPrimitive(i), _ = _JSBI.__toPrimitive(_), "string" == typeof i && "string" == typeof _) switch (t) { + case 0: + return i < _; + case 1: + return i <= _; + case 2: + return i > _; + case 3: + return i >= _; + } + if (_JSBI.__isBigInt(i) && "string" == typeof _) return _ = _JSBI.__fromString(_), null !== _ && _JSBI.__comparisonResultToBool(_JSBI.__compareToBigInt(i, _), t); + if ("string" == typeof i && _JSBI.__isBigInt(_)) return i = _JSBI.__fromString(i), null !== i && _JSBI.__comparisonResultToBool(_JSBI.__compareToBigInt(i, _), t); + if (i = _JSBI.__toNumeric(i), _ = _JSBI.__toNumeric(_), _JSBI.__isBigInt(i)) { + if (_JSBI.__isBigInt(_)) return _JSBI.__comparisonResultToBool(_JSBI.__compareToBigInt(i, _), t); + if ("number" != typeof _) throw new Error("implementation bug"); + return _JSBI.__comparisonResultToBool(_JSBI.__compareToNumber(i, _), t); + } + if ("number" != typeof i) throw new Error("implementation bug"); + if (_JSBI.__isBigInt(_)) return _JSBI.__comparisonResultToBool(_JSBI.__compareToNumber(_, i), 2 ^ t); + if ("number" != typeof _) throw new Error("implementation bug"); + return 0 === t ? i < _ : 1 === t ? i <= _ : 2 === t ? i > _ : 3 === t ? i >= _ : void 0; + } + __clzmsd() { + return _JSBI.__clz30(this.__digit(this.length - 1)); + } + static __absoluteAdd(_, t, e) { + if (_.length < t.length) return _JSBI.__absoluteAdd(t, _, e); + if (0 === _.length) return _; + if (0 === t.length) return _.sign === e ? _ : _JSBI.unaryMinus(_); + let n = _.length; + (0 === _.__clzmsd() || t.length === _.length && 0 === t.__clzmsd()) && n++; + const g = new _JSBI(n, e); + let o = 0, s = 0; + for (; s < t.length; s++) { + const i = _.__digit(s) + t.__digit(s) + o; + o = i >>> 30, g.__setDigit(s, 1073741823 & i); + } + for (; s < _.length; s++) { + const i = _.__digit(s) + o; + o = i >>> 30, g.__setDigit(s, 1073741823 & i); + } + return s < g.length && g.__setDigit(s, o), g.__trim(); + } + static __absoluteSub(_, t, e) { + if (0 === _.length) return _; + if (0 === t.length) return _.sign === e ? _ : _JSBI.unaryMinus(_); + const n = new _JSBI(_.length, e); + let g = 0, o = 0; + for (; o < t.length; o++) { + const i = _.__digit(o) - t.__digit(o) - g; + g = 1 & i >>> 30, n.__setDigit(o, 1073741823 & i); + } + for (; o < _.length; o++) { + const i = _.__digit(o) - g; + g = 1 & i >>> 30, n.__setDigit(o, 1073741823 & i); + } + return n.__trim(); + } + static __absoluteAddOne(_, i, t = null) { + const e = _.length; + null === t ? t = new _JSBI(e, i) : t.sign = i; + let n = 1; + for (let g = 0; g < e; g++) { + const i2 = _.__digit(g) + n; + n = i2 >>> 30, t.__setDigit(g, 1073741823 & i2); + } + return 0 != n && t.__setDigitGrow(e, 1), t; + } + static __absoluteSubOne(_, t) { + const e = _.length; + t = t || e; + const n = new _JSBI(t, false); + let g = 1; + for (let o = 0; o < e; o++) { + const i = _.__digit(o) - g; + g = 1 & i >>> 30, n.__setDigit(o, 1073741823 & i); + } + if (0 != g) throw new Error("implementation bug"); + for (let g2 = e; g2 < t; g2++) n.__setDigit(g2, 0); + return n; + } + static __absoluteAnd(_, t, e = null) { + let n = _.length, g = t.length, o = g; + if (n < g) { + o = n; + const i = _, e2 = n; + _ = t, n = g, t = i, g = e2; + } + let s = o; + null === e ? e = new _JSBI(s, false) : s = e.length; + let l = 0; + for (; l < o; l++) e.__setDigit(l, _.__digit(l) & t.__digit(l)); + for (; l < s; l++) e.__setDigit(l, 0); + return e; + } + static __absoluteAndNot(_, t, e = null) { + const n = _.length, g = t.length; + let o = g; + n < g && (o = n); + let s = n; + null === e ? e = new _JSBI(s, false) : s = e.length; + let l = 0; + for (; l < o; l++) e.__setDigit(l, _.__digit(l) & ~t.__digit(l)); + for (; l < n; l++) e.__setDigit(l, _.__digit(l)); + for (; l < s; l++) e.__setDigit(l, 0); + return e; + } + static __absoluteOr(_, t, e = null) { + let n = _.length, g = t.length, o = g; + if (n < g) { + o = n; + const i = _, e2 = n; + _ = t, n = g, t = i, g = e2; + } + let s = n; + null === e ? e = new _JSBI(s, false) : s = e.length; + let l = 0; + for (; l < o; l++) e.__setDigit(l, _.__digit(l) | t.__digit(l)); + for (; l < n; l++) e.__setDigit(l, _.__digit(l)); + for (; l < s; l++) e.__setDigit(l, 0); + return e; + } + static __absoluteXor(_, t, e = null) { + let n = _.length, g = t.length, o = g; + if (n < g) { + o = n; + const i = _, e2 = n; + _ = t, n = g, t = i, g = e2; + } + let s = n; + null === e ? e = new _JSBI(s, false) : s = e.length; + let l = 0; + for (; l < o; l++) e.__setDigit(l, _.__digit(l) ^ t.__digit(l)); + for (; l < n; l++) e.__setDigit(l, _.__digit(l)); + for (; l < s; l++) e.__setDigit(l, 0); + return e; + } + static __absoluteCompare(_, t) { + const e = _.length - t.length; + if (0 != e) return e; + let n = _.length - 1; + for (; 0 <= n && _.__digit(n) === t.__digit(n); ) n--; + return 0 > n ? 0 : _.__unsignedDigit(n) > t.__unsignedDigit(n) ? 1 : -1; + } + static __multiplyAccumulate(_, t, e, n) { + if (0 === t) return; + const g = 32767 & t, o = t >>> 15; + let s = 0, l = 0; + for (let r, a = 0; a < _.length; a++, n++) { + r = e.__digit(n); + const i = _.__digit(a), t2 = 32767 & i, u = i >>> 15, d = _JSBI.__imul(t2, g), h = _JSBI.__imul(t2, o), m = _JSBI.__imul(u, g), b = _JSBI.__imul(u, o); + r += l + d + s, s = r >>> 30, r &= 1073741823, r += ((32767 & h) << 15) + ((32767 & m) << 15), s += r >>> 30, l = b + (h >>> 15) + (m >>> 15), e.__setDigit(n, 1073741823 & r); + } + for (; 0 != s || 0 !== l; n++) { + let i = e.__digit(n); + i += s + l, l = 0, s = i >>> 30, e.__setDigit(n, 1073741823 & i); + } + } + static __internalMultiplyAdd(_, t, e, g, o) { + let s = e, l = 0; + for (let n = 0; n < g; n++) { + const i = _.__digit(n), e2 = _JSBI.__imul(32767 & i, t), g2 = _JSBI.__imul(i >>> 15, t), a = e2 + ((32767 & g2) << 15) + l + s; + s = a >>> 30, l = g2 >>> 15, o.__setDigit(n, 1073741823 & a); + } + if (o.length > g) for (o.__setDigit(g++, s + l); g < o.length; ) o.__setDigit(g++, 0); + else if (0 !== s + l) throw new Error("implementation bug"); + } + __inplaceMultiplyAdd(i, _, t) { + t > this.length && (t = this.length); + const e = 32767 & i, n = i >>> 15; + let g = 0, o = _; + for (let s = 0; s < t; s++) { + const i2 = this.__digit(s), _2 = 32767 & i2, t2 = i2 >>> 15, l = _JSBI.__imul(_2, e), r = _JSBI.__imul(_2, n), a = _JSBI.__imul(t2, e), u = _JSBI.__imul(t2, n); + let d = o + l + g; + g = d >>> 30, d &= 1073741823, d += ((32767 & r) << 15) + ((32767 & a) << 15), g += d >>> 30, o = u + (r >>> 15) + (a >>> 15), this.__setDigit(s, 1073741823 & d); + } + if (0 != g || 0 !== o) throw new Error("implementation bug"); + } + static __absoluteDivSmall(_, t, e = null) { + null === e && (e = new _JSBI(_.length, false)); + let n = 0; + for (let g, o = 2 * _.length - 1; 0 <= o; o -= 2) { + g = (n << 15 | _.__halfDigit(o)) >>> 0; + const i = 0 | g / t; + n = 0 | g % t, g = (n << 15 | _.__halfDigit(o - 1)) >>> 0; + const s = 0 | g / t; + n = 0 | g % t, e.__setDigit(o >>> 1, i << 15 | s); + } + return e; + } + static __absoluteModSmall(_, t) { + let e = 0; + for (let n = 2 * _.length - 1; 0 <= n; n--) { + const i = (e << 15 | _.__halfDigit(n)) >>> 0; + e = 0 | i % t; + } + return e; + } + static __absoluteDivLarge(i, _, t, e) { + const g = _.__halfDigitLength(), n = _.length, o = i.__halfDigitLength() - g; + let s = null; + t && (s = new _JSBI(o + 2 >>> 1, false), s.__initializeDigits()); + const l = new _JSBI(g + 2 >>> 1, false); + l.__initializeDigits(); + const r = _JSBI.__clz15(_.__halfDigit(g - 1)); + 0 < r && (_ = _JSBI.__specialLeftShift(_, r, 0)); + const a = _JSBI.__specialLeftShift(i, r, 1), u = _.__halfDigit(g - 1); + let d = 0; + for (let r2, h = o; 0 <= h; h--) { + r2 = 32767; + const i2 = a.__halfDigit(h + g); + if (i2 !== u) { + const t2 = (i2 << 15 | a.__halfDigit(h + g - 1)) >>> 0; + r2 = 0 | t2 / u; + let e3 = 0 | t2 % u; + const n2 = _.__halfDigit(g - 2), o2 = a.__halfDigit(h + g - 2); + for (; _JSBI.__imul(r2, n2) >>> 0 > (e3 << 16 | o2) >>> 0 && (r2--, e3 += u, !(32767 < e3)); ) ; + } + _JSBI.__internalMultiplyAdd(_, r2, 0, n, l); + let e2 = a.__inplaceSub(l, h, g + 1); + 0 !== e2 && (e2 = a.__inplaceAdd(_, h, g), a.__setHalfDigit(h + g, 32767 & a.__halfDigit(h + g) + e2), r2--), t && (1 & h ? d = r2 << 15 : s.__setDigit(h >>> 1, d | r2)); + } + if (e) return a.__inplaceRightShift(r), t ? { quotient: s, remainder: a } : a; + if (t) return s; + throw new Error("unreachable"); + } + static __clz15(i) { + return _JSBI.__clz30(i) - 15; + } + __inplaceAdd(_, t, e) { + let n = 0; + for (let g = 0; g < e; g++) { + const i = this.__halfDigit(t + g) + _.__halfDigit(g) + n; + n = i >>> 15, this.__setHalfDigit(t + g, 32767 & i); + } + return n; + } + __inplaceSub(_, t, e) { + let n = 0; + if (1 & t) { + t >>= 1; + let g = this.__digit(t), o = 32767 & g, s = 0; + for (; s < e - 1 >>> 1; s++) { + const i2 = _.__digit(s), e2 = (g >>> 15) - (32767 & i2) - n; + n = 1 & e2 >>> 15, this.__setDigit(t + s, (32767 & e2) << 15 | 32767 & o), g = this.__digit(t + s + 1), o = (32767 & g) - (i2 >>> 15) - n, n = 1 & o >>> 15; + } + const i = _.__digit(s), l = (g >>> 15) - (32767 & i) - n; + n = 1 & l >>> 15, this.__setDigit(t + s, (32767 & l) << 15 | 32767 & o); + if (t + s + 1 >= this.length) throw new RangeError("out of bounds"); + 0 == (1 & e) && (g = this.__digit(t + s + 1), o = (32767 & g) - (i >>> 15) - n, n = 1 & o >>> 15, this.__setDigit(t + _.length, 1073709056 & g | 32767 & o)); + } else { + t >>= 1; + let g = 0; + for (; g < _.length - 1; g++) { + const i2 = this.__digit(t + g), e2 = _.__digit(g), o2 = (32767 & i2) - (32767 & e2) - n; + n = 1 & o2 >>> 15; + const s2 = (i2 >>> 15) - (e2 >>> 15) - n; + n = 1 & s2 >>> 15, this.__setDigit(t + g, (32767 & s2) << 15 | 32767 & o2); + } + const i = this.__digit(t + g), o = _.__digit(g), s = (32767 & i) - (32767 & o) - n; + n = 1 & s >>> 15; + let l = 0; + 0 == (1 & e) && (l = (i >>> 15) - (o >>> 15) - n, n = 1 & l >>> 15), this.__setDigit(t + g, (32767 & l) << 15 | 32767 & s); + } + return n; + } + __inplaceRightShift(_) { + if (0 === _) return; + let t = this.__digit(0) >>> _; + const e = this.length - 1; + for (let n = 0; n < e; n++) { + const i = this.__digit(n + 1); + this.__setDigit(n, 1073741823 & i << 30 - _ | t), t = i >>> _; + } + this.__setDigit(e, t); + } + static __specialLeftShift(_, t, e) { + const g = _.length, n = new _JSBI(g + e, false); + if (0 === t) { + for (let t2 = 0; t2 < g; t2++) n.__setDigit(t2, _.__digit(t2)); + return 0 < e && n.__setDigit(g, 0), n; + } + let o = 0; + for (let s = 0; s < g; s++) { + const i = _.__digit(s); + n.__setDigit(s, 1073741823 & i << t | o), o = i >>> 30 - t; + } + return 0 < e && n.__setDigit(g, o), n; + } + static __leftShiftByAbsolute(_, i) { + const t = _JSBI.__toShiftAmount(i); + if (0 > t) throw new RangeError("BigInt too big"); + const e = 0 | t / 30, n = t % 30, g = _.length, o = 0 !== n && 0 != _.__digit(g - 1) >>> 30 - n, s = g + e + (o ? 1 : 0), l = new _JSBI(s, _.sign); + if (0 === n) { + let t2 = 0; + for (; t2 < e; t2++) l.__setDigit(t2, 0); + for (; t2 < s; t2++) l.__setDigit(t2, _.__digit(t2 - e)); + } else { + let t2 = 0; + for (let _2 = 0; _2 < e; _2++) l.__setDigit(_2, 0); + for (let o2 = 0; o2 < g; o2++) { + const i2 = _.__digit(o2); + l.__setDigit(o2 + e, 1073741823 & i2 << n | t2), t2 = i2 >>> 30 - n; + } + if (o) l.__setDigit(g + e, t2); + else if (0 !== t2) throw new Error("implementation bug"); + } + return l.__trim(); + } + static __rightShiftByAbsolute(_, i) { + const t = _.length, e = _.sign, n = _JSBI.__toShiftAmount(i); + if (0 > n) return _JSBI.__rightShiftByMaximum(e); + const g = 0 | n / 30, o = n % 30; + let s = t - g; + if (0 >= s) return _JSBI.__rightShiftByMaximum(e); + let l = false; + if (e) { + if (0 != (_.__digit(g) & (1 << o) - 1)) l = true; + else for (let t2 = 0; t2 < g; t2++) if (0 !== _.__digit(t2)) { + l = true; + break; + } + } + if (l && 0 === o) { + const i2 = _.__digit(t - 1); + 0 == ~i2 && s++; + } + let r = new _JSBI(s, e); + if (0 === o) { + r.__setDigit(s - 1, 0); + for (let e2 = g; e2 < t; e2++) r.__setDigit(e2 - g, _.__digit(e2)); + } else { + let e2 = _.__digit(g) >>> o; + const n2 = t - g - 1; + for (let t2 = 0; t2 < n2; t2++) { + const i2 = _.__digit(t2 + g + 1); + r.__setDigit(t2, 1073741823 & i2 << 30 - o | e2), e2 = i2 >>> o; + } + r.__setDigit(n2, e2); + } + return l && (r = _JSBI.__absoluteAddOne(r, true, r)), r.__trim(); + } + static __rightShiftByMaximum(i) { + return i ? _JSBI.__oneDigit(1, true) : _JSBI.__zero(); + } + static __toShiftAmount(i) { + if (1 < i.length) return -1; + const _ = i.__unsignedDigit(0); + return _ > _JSBI.__kMaxLengthBits ? -1 : _; + } + static __toPrimitive(i, _ = "default") { + if ("object" != typeof i) return i; + if (i.constructor === _JSBI) return i; + if ("undefined" != typeof Symbol && "symbol" == typeof Symbol.toPrimitive) { + const t2 = i[Symbol.toPrimitive]; + if (t2) { + const i2 = t2(_); + if ("object" != typeof i2) return i2; + throw new TypeError("Cannot convert object to primitive value"); + } + } + const t = i.valueOf; + if (t) { + const _2 = t.call(i); + if ("object" != typeof _2) return _2; + } + const e = i.toString; + if (e) { + const _2 = e.call(i); + if ("object" != typeof _2) return _2; + } + throw new TypeError("Cannot convert object to primitive value"); + } + static __toNumeric(i) { + return _JSBI.__isBigInt(i) ? i : +i; + } + static __isBigInt(i) { + return "object" == typeof i && null !== i && i.constructor === _JSBI; + } + static __truncateToNBits(i, _) { + const t = 0 | (i + 29) / 30, e = new _JSBI(t, _.sign), n = t - 1; + for (let t2 = 0; t2 < n; t2++) e.__setDigit(t2, _.__digit(t2)); + let g = _.__digit(n); + if (0 != i % 30) { + const _2 = 32 - i % 30; + g = g << _2 >>> _2; + } + return e.__setDigit(n, g), e.__trim(); + } + static __truncateAndSubFromPowerOfTwo(_, t, e) { + var n = Math.min; + const g = 0 | (_ + 29) / 30, o = new _JSBI(g, e); + let s = 0; + const l = g - 1; + let a = 0; + for (const i = n(l, t.length); s < i; s++) { + const i2 = 0 - t.__digit(s) - a; + a = 1 & i2 >>> 30, o.__setDigit(s, 1073741823 & i2); + } + for (; s < l; s++) o.__setDigit(s, 0 | 1073741823 & -a); + let u = l < t.length ? t.__digit(l) : 0; + const d = _ % 30; + let h; + if (0 == d) h = 0 - u - a, h &= 1073741823; + else { + const i = 32 - d; + u = u << i >>> i; + const _2 = 1 << 32 - i; + h = _2 - u - a, h &= _2 - 1; + } + return o.__setDigit(l, h), o.__trim(); + } + __digit(_) { + return this[_]; + } + __unsignedDigit(_) { + return this[_] >>> 0; + } + __setDigit(_, i) { + this[_] = 0 | i; + } + __setDigitGrow(_, i) { + this[_] = 0 | i; + } + __halfDigitLength() { + const i = this.length; + return 32767 >= this.__unsignedDigit(i - 1) ? 2 * i - 1 : 2 * i; + } + __halfDigit(_) { + return 32767 & this[_ >>> 1] >>> 15 * (1 & _); + } + __setHalfDigit(_, i) { + const t = _ >>> 1, e = this.__digit(t), n = 1 & _ ? 32767 & e | i << 15 : 1073709056 & e | 32767 & i; + this.__setDigit(t, n); + } + static __digitPow(i, _) { + let t = 1; + for (; 0 < _; ) 1 & _ && (t *= i), _ >>>= 1, i *= i; + return t; + } + static __isOneDigitInt(i) { + return (1073741823 & i) === i; + } + }; + JSBI3.__kMaxLength = 33554432, JSBI3.__kMaxLengthBits = JSBI3.__kMaxLength << 5, JSBI3.__kMaxBitsPerChar = [0, 0, 32, 51, 64, 75, 83, 90, 96, 102, 107, 111, 115, 119, 122, 126, 128, 131, 134, 136, 139, 141, 143, 145, 147, 149, 151, 153, 154, 156, 158, 159, 160, 162, 163, 165, 166], JSBI3.__kBitsPerCharTableShift = 5, JSBI3.__kBitsPerCharTableMultiplier = 1 << JSBI3.__kBitsPerCharTableShift, JSBI3.__kConversionChars = ["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"], JSBI3.__kBitConversionBuffer = new ArrayBuffer(8), JSBI3.__kBitConversionDouble = new Float64Array(JSBI3.__kBitConversionBuffer), JSBI3.__kBitConversionInts = new Int32Array(JSBI3.__kBitConversionBuffer), JSBI3.__clz30 = Math.clz32 ? function(i) { + return Math.clz32(i) - 2; + } : function(i) { + return 0 === i ? 30 : 0 | 29 - (0 | Math.log(i >>> 0) / Math.LN2); + }, JSBI3.__imul = Math.imul || function(i, _) { + return 0 | i * _; + }, module2.exports = JSBI3; + } +}); + +// node_modules/decimal.js/decimal.js +var require_decimal = __commonJS({ + "node_modules/decimal.js/decimal.js"(exports2, module2) { + (function(globalScope) { + "use strict"; + var EXP_LIMIT = 9e15, MAX_DIGITS = 1e9, NUMERALS = "0123456789abcdef", LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", DEFAULTS = { + // These values must be integers within the stated ranges (inclusive). + // Most of these values can be changed at run-time using the `Decimal.config` method. + // The maximum number of significant digits of the result of a calculation or base conversion. + // E.g. `Decimal.config({ precision: 20 });` + precision: 20, + // 1 to MAX_DIGITS + // The rounding mode used when rounding to `precision`. + // + // ROUND_UP 0 Away from zero. + // ROUND_DOWN 1 Towards zero. + // ROUND_CEIL 2 Towards +Infinity. + // ROUND_FLOOR 3 Towards -Infinity. + // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + // + // E.g. + // `Decimal.rounding = 4;` + // `Decimal.rounding = Decimal.ROUND_HALF_UP;` + rounding: 4, + // 0 to 8 + // The modulo mode used when calculating the modulus: a mod n. + // The quotient (q = a / n) is calculated according to the corresponding rounding mode. + // The remainder (r) is calculated as: r = a - n * q. + // + // UP 0 The remainder is positive if the dividend is negative, else is negative. + // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 The IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. + // + // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian + // division (9) are commonly used for the modulus operation. The other rounding modes can also + // be used, but they may not give useful results. + modulo: 1, + // 0 to 9 + // The exponent value at and beneath which `toString` returns exponential notation. + // JavaScript numbers: -7 + toExpNeg: -7, + // 0 to -EXP_LIMIT + // The exponent value at and above which `toString` returns exponential notation. + // JavaScript numbers: 21 + toExpPos: 21, + // 0 to EXP_LIMIT + // The minimum exponent value, beneath which underflow to zero occurs. + // JavaScript numbers: -324 (5e-324) + minE: -EXP_LIMIT, + // -1 to -EXP_LIMIT + // The maximum exponent value, above which overflow to Infinity occurs. + // JavaScript numbers: 308 (1.7976931348623157e+308) + maxE: EXP_LIMIT, + // 1 to EXP_LIMIT + // Whether to use cryptographically-secure random number generation, if available. + crypto: false + // true/false + }, Decimal2, inexact, noConflict, quadrant, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", precisionLimitExceeded = decimalError + "Precision limit exceeded", cryptoUnavailable = decimalError + "crypto unavailable", tag = "[object Decimal]", mathfloor = Math.floor, mathpow = Math.pow, isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, LN10_PRECISION = LN10.length - 1, PI_PRECISION = PI.length - 1, P = { toStringTag: tag }; + P.absoluteValue = P.abs = function() { + var x = new this.constructor(this); + if (x.s < 0) x.s = 1; + return finalise(x); + }; + P.ceil = function() { + return finalise(new this.constructor(this), this.e + 1, 2); + }; + P.clampedTo = P.clamp = function(min2, max2) { + var k, x = this, Ctor = x.constructor; + min2 = new Ctor(min2); + max2 = new Ctor(max2); + if (!min2.s || !max2.s) return new Ctor(NaN); + if (min2.gt(max2)) throw Error(invalidArgument + max2); + k = x.cmp(min2); + return k < 0 ? min2 : x.cmp(max2) > 0 ? max2 : new Ctor(x); + }; + P.comparedTo = P.cmp = function(y) { + var i, j, xdL, ydL, x = this, xd = x.d, yd = (y = new x.constructor(y)).d, xs = x.s, ys = y.s; + if (!xd || !yd) { + return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; + } + if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; + if (xs !== ys) return xs; + if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; + xdL = xd.length; + ydL = yd.length; + for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { + if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; + } + return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; + }; + P.cosine = P.cos = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.d) return new Ctor(NaN); + if (!x.d[0]) return new Ctor(1); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); + }; + P.cubeRoot = P.cbrt = function() { + var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + external = false; + s = x.s * mathpow(x.s * x, 1 / 3); + if (!s || Math.abs(s) == 1 / 0) { + n = digitsToString(x.d); + e = x.e; + if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? "0" : "00"; + s = mathpow(n, 1 / 3); + e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new Ctor(n); + r.s = x.s; + } else { + r = new Ctor(s.toString()); + } + sd = (e = Ctor.precision) + 3; + for (; ; ) { + t = r; + t3 = t.times(t).times(t); + t3plusx = t3.plus(x); + r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + if (n == "9999" || !rep && n == "4999") { + if (!rep) { + finalise(t, e + 1, 0); + if (t.times(t).times(t).eq(x)) { + r = t; + break; + } + } + sd += 4; + rep = 1; + } else { + if (!+n || !+n.slice(1) && n.charAt(0) == "5") { + finalise(r, e + 1, 1); + m = !r.times(r).times(r).eq(x); + } + break; + } + } + } + external = true; + return finalise(r, e, Ctor.rounding, m); + }; + P.decimalPlaces = P.dp = function() { + var w, d = this.d, n = NaN; + if (d) { + w = d.length - 1; + n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; + w = d[w]; + if (w) for (; w % 10 == 0; w /= 10) n--; + if (n < 0) n = 0; + } + return n; + }; + P.dividedBy = P.div = function(y) { + return divide(this, new this.constructor(y)); + }; + P.dividedToIntegerBy = P.divToInt = function(y) { + var x = this, Ctor = x.constructor; + return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); + }; + P.equals = P.eq = function(y) { + return this.cmp(y) === 0; + }; + P.floor = function() { + return finalise(new this.constructor(this), this.e + 1, 3); + }; + P.greaterThan = P.gt = function(y) { + return this.cmp(y) > 0; + }; + P.greaterThanOrEqualTo = P.gte = function(y) { + var k = this.cmp(y); + return k == 1 || k === 0; + }; + P.hyperbolicCosine = P.cosh = function() { + var k, n, pr, rm, len, x = this, Ctor = x.constructor, one = new Ctor(1); + if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); + if (x.isZero()) return one; + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + n = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + n = "2.3283064365386962890625e-10"; + } + x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); + var cosh2_x, i = k, d8 = new Ctor(8); + for (; i--; ) { + cosh2_x = x.times(x); + x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); + } + return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + P.hyperbolicSine = P.sinh = function() { + var k, pr, rm, len, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + if (len < 3) { + x = taylorSeries(Ctor, 2, x, x, true); + } else { + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x, true); + var sinh2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); + for (; k--; ) { + sinh2_x = x.times(x); + x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); + } + } + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(x, pr, rm, true); + }; + P.hyperbolicTangent = P.tanh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(x.s); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 7; + Ctor.rounding = 1; + return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); + }; + P.inverseCosine = P.acos = function() { + var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding; + if (k !== -1) { + return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN); + } + if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); + Ctor.precision = pr + 6; + Ctor.rounding = 1; + x = x.asin(); + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + Ctor.precision = pr; + Ctor.rounding = rm; + return halfPi.minus(x); + }; + P.inverseHyperbolicCosine = P.acosh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); + if (!x.isFinite()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; + Ctor.rounding = 1; + external = false; + x = x.times(x).minus(1).sqrt().plus(x); + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + return x.ln(); + }; + P.inverseHyperbolicSine = P.asinh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; + Ctor.rounding = 1; + external = false; + x = x.times(x).plus(1).sqrt().plus(x); + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + return x.ln(); + }; + P.inverseHyperbolicTangent = P.atanh = function() { + var pr, rm, wpr, xsd, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); + pr = Ctor.precision; + rm = Ctor.rounding; + xsd = x.sd(); + if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); + Ctor.precision = wpr = xsd - x.e; + x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); + Ctor.precision = pr + 4; + Ctor.rounding = 1; + x = x.ln(); + Ctor.precision = pr; + Ctor.rounding = rm; + return x.times(0.5); + }; + P.inverseSine = P.asin = function() { + var halfPi, k, pr, rm, x = this, Ctor = x.constructor; + if (x.isZero()) return new Ctor(x); + k = x.abs().cmp(1); + pr = Ctor.precision; + rm = Ctor.rounding; + if (k !== -1) { + if (k === 0) { + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + halfPi.s = x.s; + return halfPi; + } + return new Ctor(NaN); + } + Ctor.precision = pr + 6; + Ctor.rounding = 1; + x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); + Ctor.precision = pr; + Ctor.rounding = rm; + return x.times(2); + }; + P.inverseTangent = P.atan = function() { + var i, j, k, n, px, t, r, wpr, x2, x = this, Ctor = x.constructor, pr = Ctor.precision, rm = Ctor.rounding; + if (!x.isFinite()) { + if (!x.s) return new Ctor(NaN); + if (pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.5); + r.s = x.s; + return r; + } + } else if (x.isZero()) { + return new Ctor(x); + } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.25); + r.s = x.s; + return r; + } + Ctor.precision = wpr = pr + 10; + Ctor.rounding = 1; + k = Math.min(28, wpr / LOG_BASE + 2 | 0); + for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); + external = false; + j = Math.ceil(wpr / LOG_BASE); + n = 1; + x2 = x.times(x); + r = new Ctor(x); + px = x; + for (; i !== -1; ) { + px = px.times(x2); + t = r.minus(px.div(n += 2)); + px = px.times(x2); + r = t.plus(px.div(n += 2)); + if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--; ) ; + } + if (k) r = r.times(2 << k - 1); + external = true; + return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + P.isFinite = function() { + return !!this.d; + }; + P.isInteger = P.isInt = function() { + return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; + }; + P.isNaN = function() { + return !this.s; + }; + P.isNegative = P.isNeg = function() { + return this.s < 0; + }; + P.isPositive = P.isPos = function() { + return this.s > 0; + }; + P.isZero = function() { + return !!this.d && this.d[0] === 0; + }; + P.lessThan = P.lt = function(y) { + return this.cmp(y) < 0; + }; + P.lessThanOrEqualTo = P.lte = function(y) { + return this.cmp(y) < 1; + }; + P.logarithm = P.log = function(base) { + var isBase10, d, denominator, k, inf, num, sd, r, arg = this, Ctor = arg.constructor, pr = Ctor.precision, rm = Ctor.rounding, guard = 5; + if (base == null) { + base = new Ctor(10); + isBase10 = true; + } else { + base = new Ctor(base); + d = base.d; + if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); + isBase10 = base.eq(10); + } + d = arg.d; + if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { + return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); + } + if (isBase10) { + if (d.length > 1) { + inf = true; + } else { + for (k = d[0]; k % 10 === 0; ) k /= 10; + inf = k !== 1; + } + } + external = false; + sd = pr + guard; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + if (checkRoundingDigits(r.d, k = pr, rm)) { + do { + sd += 10; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + if (!inf) { + if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + break; + } + } while (checkRoundingDigits(r.d, k += 10, rm)); + } + external = true; + return finalise(r, pr, rm); + }; + P.minus = P.sub = function(y) { + var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.d) { + if (!x.s || !y.s) y = new Ctor(NaN); + else if (x.d) y.s = -y.s; + else y = new Ctor(y.d || x.s !== y.s ? x : NaN); + return y; + } + if (x.s != y.s) { + y.s = -y.s; + return x.plus(y); + } + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + if (!xd[0] || !yd[0]) { + if (yd[0]) y.s = -y.s; + else if (xd[0]) y = new Ctor(x); + else return new Ctor(rm === 3 ? -0 : 0); + return external ? finalise(y, pr, rm) : y; + } + e = mathfloor(y.e / LOG_BASE); + xe = mathfloor(x.e / LOG_BASE); + xd = xd.slice(); + k = xe - e; + if (k) { + xLTy = k < 0; + if (xLTy) { + d = xd; + k = -k; + len = yd.length; + } else { + d = yd; + e = xe; + len = xd.length; + } + i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; + if (k > i) { + k = i; + d.length = 1; + } + d.reverse(); + for (i = k; i--; ) d.push(0); + d.reverse(); + } else { + i = xd.length; + len = yd.length; + xLTy = i < len; + if (xLTy) len = i; + for (i = 0; i < len; i++) { + if (xd[i] != yd[i]) { + xLTy = xd[i] < yd[i]; + break; + } + } + k = 0; + } + if (xLTy) { + d = xd; + xd = yd; + yd = d; + y.s = -y.s; + } + len = xd.length; + for (i = yd.length - len; i > 0; --i) xd[len++] = 0; + for (i = yd.length; i > k; ) { + if (xd[--i] < yd[i]) { + for (j = i; j && xd[--j] === 0; ) xd[j] = BASE - 1; + --xd[j]; + xd[i] += BASE; + } + xd[i] -= yd[i]; + } + for (; xd[--len] === 0; ) xd.pop(); + for (; xd[0] === 0; xd.shift()) --e; + if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); + y.d = xd; + y.e = getBase10Exponent(xd, e); + return external ? finalise(y, pr, rm) : y; + }; + P.modulo = P.mod = function(y) { + var q, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); + if (!y.d || x.d && !x.d[0]) { + return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); + } + external = false; + if (Ctor.modulo == 9) { + q = divide(x, y.abs(), 0, 3, 1); + q.s *= y.s; + } else { + q = divide(x, y, 0, Ctor.modulo, 1); + } + q = q.times(y); + external = true; + return x.minus(q); + }; + P.naturalExponential = P.exp = function() { + return naturalExponential(this); + }; + P.naturalLogarithm = P.ln = function() { + return naturalLogarithm(this); + }; + P.negated = P.neg = function() { + var x = new this.constructor(this); + x.s = -x.s; + return finalise(x); + }; + P.plus = P.add = function(y) { + var carry, d, e, i, k, len, pr, rm, xd, yd, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.d) { + if (!x.s || !y.s) y = new Ctor(NaN); + else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); + return y; + } + if (x.s != y.s) { + y.s = -y.s; + return x.minus(y); + } + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + if (!xd[0] || !yd[0]) { + if (!yd[0]) y = new Ctor(x); + return external ? finalise(y, pr, rm) : y; + } + k = mathfloor(x.e / LOG_BASE); + e = mathfloor(y.e / LOG_BASE); + xd = xd.slice(); + i = k - e; + if (i) { + if (i < 0) { + d = xd; + i = -i; + len = yd.length; + } else { + d = yd; + e = k; + len = xd.length; + } + k = Math.ceil(pr / LOG_BASE); + len = k > len ? k + 1 : len + 1; + if (i > len) { + i = len; + d.length = 1; + } + d.reverse(); + for (; i--; ) d.push(0); + d.reverse(); + } + len = xd.length; + i = yd.length; + if (len - i < 0) { + i = len; + d = yd; + yd = xd; + xd = d; + } + for (carry = 0; i; ) { + carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; + xd[i] %= BASE; + } + if (carry) { + xd.unshift(carry); + ++e; + } + for (len = xd.length; xd[--len] == 0; ) xd.pop(); + y.d = xd; + y.e = getBase10Exponent(xd, e); + return external ? finalise(y, pr, rm) : y; + }; + P.precision = P.sd = function(z) { + var k, x = this; + if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); + if (x.d) { + k = getPrecision(x.d); + if (z && x.e + 1 > k) k = x.e + 1; + } else { + k = NaN; + } + return k; + }; + P.round = function() { + var x = this, Ctor = x.constructor; + return finalise(new Ctor(x), x.e + 1, Ctor.rounding); + }; + P.sine = P.sin = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + x = sine(Ctor, toLessThanHalfPi(Ctor, x)); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); + }; + P.squareRoot = P.sqrt = function() { + var m, n, sd, r, rep, t, x = this, d = x.d, e = x.e, s = x.s, Ctor = x.constructor; + if (s !== 1 || !d || !d[0]) { + return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); + } + external = false; + s = Math.sqrt(+x); + if (s == 0 || s == 1 / 0) { + n = digitsToString(d); + if ((n.length + e) % 2 == 0) n += "0"; + s = Math.sqrt(n); + e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new Ctor(n); + } else { + r = new Ctor(s.toString()); + } + sd = (e = Ctor.precision) + 3; + for (; ; ) { + t = r; + r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + if (n == "9999" || !rep && n == "4999") { + if (!rep) { + finalise(t, e + 1, 0); + if (t.times(t).eq(x)) { + r = t; + break; + } + } + sd += 4; + rep = 1; + } else { + if (!+n || !+n.slice(1) && n.charAt(0) == "5") { + finalise(r, e + 1, 1); + m = !r.times(r).eq(x); + } + break; + } + } + } + external = true; + return finalise(r, e, Ctor.rounding, m); + }; + P.tangent = P.tan = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 10; + Ctor.rounding = 1; + x = x.sin(); + x.s = 1; + x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); + }; + P.times = P.mul = function(y) { + var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d; + y.s *= x.s; + if (!xd || !xd[0] || !yd || !yd[0]) { + return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd ? NaN : !xd || !yd ? y.s / 0 : y.s * 0); + } + e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); + xdL = xd.length; + ydL = yd.length; + if (xdL < ydL) { + r = xd; + xd = yd; + yd = r; + rL = xdL; + xdL = ydL; + ydL = rL; + } + r = []; + rL = xdL + ydL; + for (i = rL; i--; ) r.push(0); + for (i = ydL; --i >= 0; ) { + carry = 0; + for (k = xdL + i; k > i; ) { + t = r[k] + yd[i] * xd[k - i - 1] + carry; + r[k--] = t % BASE | 0; + carry = t / BASE | 0; + } + r[k] = (r[k] + carry) % BASE | 0; + } + for (; !r[--rL]; ) r.pop(); + if (carry) ++e; + else r.shift(); + y.d = r; + y.e = getBase10Exponent(r, e); + return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; + }; + P.toBinary = function(sd, rm) { + return toStringBinary(this, 2, sd, rm); + }; + P.toDecimalPlaces = P.toDP = function(dp, rm) { + var x = this, Ctor = x.constructor; + x = new Ctor(x); + if (dp === void 0) return x; + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + return finalise(x, dp + x.e + 1, rm); + }; + P.toExponential = function(dp, rm) { + var str, x = this, Ctor = x.constructor; + if (dp === void 0) { + str = finiteToString(x, true); + } else { + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = finalise(new Ctor(x), dp + 1, rm); + str = finiteToString(x, true, dp + 1); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toFixed = function(dp, rm) { + var str, y, x = this, Ctor = x.constructor; + if (dp === void 0) { + str = finiteToString(x); + } else { + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + y = finalise(new Ctor(x), dp + x.e + 1, rm); + str = finiteToString(y, false, dp + y.e + 1); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toFraction = function(maxD) { + var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, x = this, xd = x.d, Ctor = x.constructor; + if (!xd) return new Ctor(x); + n1 = d0 = new Ctor(1); + d1 = n0 = new Ctor(0); + d = new Ctor(d1); + e = d.e = getPrecision(xd) - x.e - 1; + k = e % LOG_BASE; + d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); + if (maxD == null) { + maxD = e > 0 ? d : n1; + } else { + n = new Ctor(maxD); + if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); + maxD = n.gt(d) ? e > 0 ? d : n1 : n; + } + external = false; + n = new Ctor(digitsToString(xd)); + pr = Ctor.precision; + Ctor.precision = e = xd.length * LOG_BASE * 2; + for (; ; ) { + q = divide(n, d, 0, 1, 1); + d2 = d0.plus(q.times(d1)); + if (d2.cmp(maxD) == 1) break; + d0 = d1; + d1 = d2; + d2 = n1; + n1 = n0.plus(q.times(d2)); + n0 = d2; + d2 = d; + d = n.minus(q.times(d2)); + n = d2; + } + d2 = divide(maxD.minus(d0), d1, 0, 1, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; + Ctor.precision = pr; + external = true; + return r; + }; + P.toHexadecimal = P.toHex = function(sd, rm) { + return toStringBinary(this, 16, sd, rm); + }; + P.toNearest = function(y, rm) { + var x = this, Ctor = x.constructor; + x = new Ctor(x); + if (y == null) { + if (!x.d) return x; + y = new Ctor(1); + rm = Ctor.rounding; + } else { + y = new Ctor(y); + if (rm === void 0) { + rm = Ctor.rounding; + } else { + checkInt32(rm, 0, 8); + } + if (!x.d) return y.s ? x : y; + if (!y.d) { + if (y.s) y.s = x.s; + return y; + } + } + if (y.d[0]) { + external = false; + x = divide(x, y, 0, rm, 1).times(y); + external = true; + finalise(x); + } else { + y.s = x.s; + x = y; + } + return x; + }; + P.toNumber = function() { + return +this; + }; + P.toOctal = function(sd, rm) { + return toStringBinary(this, 8, sd, rm); + }; + P.toPower = P.pow = function(y) { + var e, k, pr, r, rm, s, x = this, Ctor = x.constructor, yn = +(y = new Ctor(y)); + if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); + x = new Ctor(x); + if (x.eq(1)) return x; + pr = Ctor.precision; + rm = Ctor.rounding; + if (y.eq(1)) return finalise(x, pr, rm); + e = mathfloor(y.e / LOG_BASE); + if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { + r = intPow(Ctor, x, k, pr); + return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); + } + s = x.s; + if (s < 0) { + if (e < y.d.length - 1) return new Ctor(NaN); + if ((y.d[e] & 1) == 0) s = 1; + if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { + x.s = s; + return x; + } + } + k = mathpow(+x, yn); + e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log("0." + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + "").e; + if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); + external = false; + Ctor.rounding = x.s = 1; + k = Math.min(12, (e + "").length); + r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); + if (r.d) { + r = finalise(r, pr + 5, 1); + if (checkRoundingDigits(r.d, pr, rm)) { + e = pr + 10; + r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); + if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + } + } + r.s = s; + external = true; + Ctor.rounding = rm; + return finalise(r, pr, rm); + }; + P.toPrecision = function(sd, rm) { + var str, x = this, Ctor = x.constructor; + if (sd === void 0) { + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = finalise(new Ctor(x), sd, rm); + str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toSignificantDigits = P.toSD = function(sd, rm) { + var x = this, Ctor = x.constructor; + if (sd === void 0) { + sd = Ctor.precision; + rm = Ctor.rounding; + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } + return finalise(new Ctor(x), sd, rm); + }; + P.toString = function() { + var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.truncated = P.trunc = function() { + return finalise(new this.constructor(this), this.e + 1, 1); + }; + P.valueOf = P.toJSON = function() { + var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + return x.isNeg() ? "-" + str : str; + }; + function digitsToString(d) { + var i, k, ws, indexOfLastWord = d.length - 1, str = "", w = d[0]; + if (indexOfLastWord > 0) { + str += w; + for (i = 1; i < indexOfLastWord; i++) { + ws = d[i] + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + str += ws; + } + w = d[i]; + ws = w + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + } else if (w === 0) { + return "0"; + } + for (; w % 10 === 0; ) w /= 10; + return str + w; + } + function checkInt32(i, min2, max2) { + if (i !== ~~i || i < min2 || i > max2) { + throw Error(invalidArgument + i); + } + } + function checkRoundingDigits(d, i, rm, repeating) { + var di, k, r, rd; + for (k = d[0]; k >= 10; k /= 10) --i; + if (--i < 0) { + i += LOG_BASE; + di = 0; + } else { + di = Math.ceil((i + 1) / LOG_BASE); + i %= LOG_BASE; + } + k = mathpow(10, LOG_BASE - i); + rd = d[di] % k | 0; + if (repeating == null) { + if (i < 3) { + if (i == 0) rd = rd / 100 | 0; + else if (i == 1) rd = rd / 10 | 0; + r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 5e4 || rd == 0; + } else { + r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; + } + } else { + if (i < 4) { + if (i == 0) rd = rd / 1e3 | 0; + else if (i == 1) rd = rd / 100 | 0; + else if (i == 2) rd = rd / 10 | 0; + r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; + } else { + r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1e3 | 0) == mathpow(10, i - 3) - 1; + } + } + return r; + } + function convertBase(str, baseIn, baseOut) { + var j, arr = [0], arrL, i = 0, strL = str.length; + for (; i < strL; ) { + for (arrL = arr.length; arrL--; ) arr[arrL] *= baseIn; + arr[0] += NUMERALS.indexOf(str.charAt(i++)); + for (j = 0; j < arr.length; j++) { + if (arr[j] > baseOut - 1) { + if (arr[j + 1] === void 0) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + return arr.reverse(); + } + function cosine(Ctor, x) { + var k, len, y; + if (x.isZero()) return x; + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + y = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + y = "2.3283064365386962890625e-10"; + } + Ctor.precision += k; + x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); + for (var i = k; i--; ) { + var cos2x = x.times(x); + x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); + } + Ctor.precision -= k; + return x; + } + var divide = /* @__PURE__ */ function() { + function multiplyInteger(x, k, base) { + var temp, carry = 0, i = x.length; + for (x = x.slice(); i--; ) { + temp = x[i] * k + carry; + x[i] = temp % base | 0; + carry = temp / base | 0; + } + if (carry) x.unshift(carry); + return x; + } + function compare(a, b, aL, bL) { + var i, r; + if (aL != bL) { + r = aL > bL ? 1 : -1; + } else { + for (i = r = 0; i < aL; i++) { + if (a[i] != b[i]) { + r = a[i] > b[i] ? 1 : -1; + break; + } + } + } + return r; + } + function subtract(a, b, aL, base) { + var i = 0; + for (; aL--; ) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + for (; !a[0] && a.length > 1; ) a.shift(); + } + return function(x, y, pr, rm, dp, base) { + var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign2 = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d; + if (!xd || !xd[0] || !yd || !yd[0]) { + return new Ctor( + // Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : ( + // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. + xd && xd[0] == 0 || !yd ? sign2 * 0 : sign2 / 0 + ) + ); + } + if (base) { + logBase = 1; + e = x.e - y.e; + } else { + base = BASE; + logBase = LOG_BASE; + e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); + } + yL = yd.length; + xL = xd.length; + q = new Ctor(sign2); + qd = q.d = []; + for (i = 0; yd[i] == (xd[i] || 0); i++) ; + if (yd[i] > (xd[i] || 0)) e--; + if (pr == null) { + sd = pr = Ctor.precision; + rm = Ctor.rounding; + } else if (dp) { + sd = pr + (x.e - y.e) + 1; + } else { + sd = pr; + } + if (sd < 0) { + qd.push(1); + more = true; + } else { + sd = sd / logBase + 2 | 0; + i = 0; + if (yL == 1) { + k = 0; + yd = yd[0]; + sd++; + for (; (i < xL || k) && sd--; i++) { + t = k * base + (xd[i] || 0); + qd[i] = t / yd | 0; + k = t % yd | 0; + } + more = k || i < xL; + } else { + k = base / (yd[0] + 1) | 0; + if (k > 1) { + yd = multiplyInteger(yd, k, base); + xd = multiplyInteger(xd, k, base); + yL = yd.length; + xL = xd.length; + } + xi = yL; + rem = xd.slice(0, yL); + remL = rem.length; + for (; remL < yL; ) rem[remL++] = 0; + yz = yd.slice(); + yz.unshift(0); + yd0 = yd[0]; + if (yd[1] >= base / 2) ++yd0; + do { + k = 0; + cmp = compare(yd, rem, yL, remL); + if (cmp < 0) { + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + k = rem0 / yd0 | 0; + if (k > 1) { + if (k >= base) k = base - 1; + prod = multiplyInteger(yd, k, base); + prodL = prod.length; + remL = rem.length; + cmp = compare(prod, rem, prodL, remL); + if (cmp == 1) { + k--; + subtract(prod, yL < prodL ? yz : yd, prodL, base); + } + } else { + if (k == 0) cmp = k = 1; + prod = yd.slice(); + } + prodL = prod.length; + if (prodL < remL) prod.unshift(0); + subtract(rem, prod, remL, base); + if (cmp == -1) { + remL = rem.length; + cmp = compare(yd, rem, yL, remL); + if (cmp < 1) { + k++; + subtract(rem, yL < remL ? yz : yd, remL, base); + } + } + remL = rem.length; + } else if (cmp === 0) { + k++; + rem = [0]; + } + qd[i++] = k; + if (cmp && rem[0]) { + rem[remL++] = xd[xi] || 0; + } else { + rem = [xd[xi]]; + remL = 1; + } + } while ((xi++ < xL || rem[0] !== void 0) && sd--); + more = rem[0] !== void 0; + } + if (!qd[0]) qd.shift(); + } + if (logBase == 1) { + q.e = e; + inexact = more; + } else { + for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; + q.e = i + e * logBase - 1; + finalise(q, dp ? pr + q.e + 1 : pr, rm, more); + } + return q; + }; + }(); + function finalise(x, sd, rm, isTruncated) { + var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor; + out: if (sd != null) { + xd = x.d; + if (!xd) return x; + for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; + i = sd - digits; + if (i < 0) { + i += LOG_BASE; + j = sd; + w = xd[xdi = 0]; + rd = w / mathpow(10, digits - j - 1) % 10 | 0; + } else { + xdi = Math.ceil((i + 1) / LOG_BASE); + k = xd.length; + if (xdi >= k) { + if (isTruncated) { + for (; k++ <= xdi; ) xd.push(0); + w = rd = 0; + digits = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + w = k = xd[xdi]; + for (digits = 1; k >= 10; k /= 10) digits++; + i %= LOG_BASE; + j = i - LOG_BASE + digits; + rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; + } + } + isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); + roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. + (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7)); + if (sd < 1 || !xd[0]) { + xd.length = 0; + if (roundUp) { + sd -= x.e + 1; + xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); + x.e = -sd || 0; + } else { + xd[0] = x.e = 0; + } + return x; + } + if (i == 0) { + xd.length = xdi; + k = 1; + xdi--; + } else { + xd.length = xdi + 1; + k = mathpow(10, LOG_BASE - i); + xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; + } + if (roundUp) { + for (; ; ) { + if (xdi == 0) { + for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; + j = xd[0] += k; + for (k = 1; j >= 10; j /= 10) k++; + if (i != k) { + x.e++; + if (xd[0] == BASE) xd[0] = 1; + } + break; + } else { + xd[xdi] += k; + if (xd[xdi] != BASE) break; + xd[xdi--] = 0; + k = 1; + } + } + } + for (i = xd.length; xd[--i] === 0; ) xd.pop(); + } + if (external) { + if (x.e > Ctor.maxE) { + x.d = null; + x.e = NaN; + } else if (x.e < Ctor.minE) { + x.e = 0; + x.d = [0]; + } + } + return x; + } + function finiteToString(x, isExp, sd) { + if (!x.isFinite()) return nonFiniteToString(x); + var k, e = x.e, str = digitsToString(x.d), len = str.length; + if (isExp) { + if (sd && (k = sd - len) > 0) { + str = str.charAt(0) + "." + str.slice(1) + getZeroString(k); + } else if (len > 1) { + str = str.charAt(0) + "." + str.slice(1); + } + str = str + (x.e < 0 ? "e" : "e+") + x.e; + } else if (e < 0) { + str = "0." + getZeroString(-e - 1) + str; + if (sd && (k = sd - len) > 0) str += getZeroString(k); + } else if (e >= len) { + str += getZeroString(e + 1 - len); + if (sd && (k = sd - e - 1) > 0) str = str + "." + getZeroString(k); + } else { + if ((k = e + 1) < len) str = str.slice(0, k) + "." + str.slice(k); + if (sd && (k = sd - len) > 0) { + if (e + 1 === len) str += "."; + str += getZeroString(k); + } + } + return str; + } + function getBase10Exponent(digits, e) { + var w = digits[0]; + for (e *= LOG_BASE; w >= 10; w /= 10) e++; + return e; + } + function getLn10(Ctor, sd, pr) { + if (sd > LN10_PRECISION) { + external = true; + if (pr) Ctor.precision = pr; + throw Error(precisionLimitExceeded); + } + return finalise(new Ctor(LN10), sd, 1, true); + } + function getPi(Ctor, sd, rm) { + if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); + return finalise(new Ctor(PI), sd, rm, true); + } + function getPrecision(digits) { + var w = digits.length - 1, len = w * LOG_BASE + 1; + w = digits[w]; + if (w) { + for (; w % 10 == 0; w /= 10) len--; + for (w = digits[0]; w >= 10; w /= 10) len++; + } + return len; + } + function getZeroString(k) { + var zs = ""; + for (; k--; ) zs += "0"; + return zs; + } + function intPow(Ctor, x, n, pr) { + var isTruncated, r = new Ctor(1), k = Math.ceil(pr / LOG_BASE + 4); + external = false; + for (; ; ) { + if (n % 2) { + r = r.times(x); + if (truncate(r.d, k)) isTruncated = true; + } + n = mathfloor(n / 2); + if (n === 0) { + n = r.d.length - 1; + if (isTruncated && r.d[n] === 0) ++r.d[n]; + break; + } + x = x.times(x); + truncate(x.d, k); + } + external = true; + return r; + } + function isOdd(n) { + return n.d[n.d.length - 1] & 1; + } + function maxOrMin(Ctor, args, ltgt) { + var y, x = new Ctor(args[0]), i = 0; + for (; ++i < args.length; ) { + y = new Ctor(args[i]); + if (!y.s) { + x = y; + break; + } else if (x[ltgt](y)) { + x = y; + } + } + return x; + } + function naturalExponential(x, sd) { + var denominator, guard, j, pow2, sum2, t, wpr, rep = 0, i = 0, k = 0, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; + if (!x.d || !x.d[0] || x.e > 17) { + return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0); + } + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + t = new Ctor(0.03125); + while (x.e > -2) { + x = x.times(t); + k += 5; + } + guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; + wpr += guard; + denominator = pow2 = sum2 = new Ctor(1); + Ctor.precision = wpr; + for (; ; ) { + pow2 = finalise(pow2.times(x), wpr, 1); + denominator = denominator.times(++i); + t = sum2.plus(divide(pow2, denominator, wpr, 1)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { + j = k; + while (j--) sum2 = finalise(sum2.times(sum2), wpr, 1); + if (sd == null) { + if (rep < 3 && checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += 10; + denominator = pow2 = t = new Ctor(1); + i = 0; + rep++; + } else { + return finalise(sum2, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum2; + } + } + sum2 = t; + } + } + function naturalLogarithm(y, sd) { + var c, c0, denominator, e, numerator, rep, sum2, t, wpr, x1, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; + if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { + return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); + } + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + Ctor.precision = wpr += guard; + c = digitsToString(xd); + c0 = c.charAt(0); + if (Math.abs(e = x.e) < 15e14) { + while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { + x = x.times(y); + c = digitsToString(x.d); + c0 = c.charAt(0); + n++; + } + e = x.e; + if (c0 > 1) { + x = new Ctor("0." + c); + e++; + } else { + x = new Ctor(c0 + "." + c.slice(1)); + } + } else { + t = getLn10(Ctor, wpr + 2, pr).times(e + ""); + x = naturalLogarithm(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t); + Ctor.precision = pr; + return sd == null ? finalise(x, pr, rm, external = true) : x; + } + x1 = x; + sum2 = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = 3; + for (; ; ) { + numerator = finalise(numerator.times(x2), wpr, 1); + t = sum2.plus(divide(numerator, new Ctor(denominator), wpr, 1)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { + sum2 = sum2.times(2); + if (e !== 0) sum2 = sum2.plus(getLn10(Ctor, wpr + 2, pr).times(e + "")); + sum2 = divide(sum2, new Ctor(n), wpr, 1); + if (sd == null) { + if (checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += guard; + t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = rep = 1; + } else { + return finalise(sum2, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum2; + } + } + sum2 = t; + denominator += 2; + } + } + function nonFiniteToString(x) { + return String(x.s * x.s / 0); + } + function parseDecimal(x, str) { + var e, i, len; + if ((e = str.indexOf(".")) > -1) str = str.replace(".", ""); + if ((i = str.search(/e/i)) > 0) { + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + e = str.length; + } + for (i = 0; str.charCodeAt(i) === 48; i++) ; + for (len = str.length; str.charCodeAt(len - 1) === 48; --len) ; + str = str.slice(i, len); + if (str) { + len -= i; + x.e = e = e - i - 1; + x.d = []; + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; + if (i < len) { + if (i) x.d.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len; ) x.d.push(+str.slice(i, i += LOG_BASE)); + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + for (; i--; ) str += "0"; + x.d.push(+str); + if (external) { + if (x.e > x.constructor.maxE) { + x.d = null; + x.e = NaN; + } else if (x.e < x.constructor.minE) { + x.e = 0; + x.d = [0]; + } + } + } else { + x.e = 0; + x.d = [0]; + } + return x; + } + function parseOther(x, str) { + var base, Ctor, divisor, i, isFloat, len, p, xd, xe; + if (str.indexOf("_") > -1) { + str = str.replace(/(\d)_(?=\d)/g, "$1"); + if (isDecimal.test(str)) return parseDecimal(x, str); + } else if (str === "Infinity" || str === "NaN") { + if (!+str) x.s = NaN; + x.e = NaN; + x.d = null; + return x; + } + if (isHex.test(str)) { + base = 16; + str = str.toLowerCase(); + } else if (isBinary.test(str)) { + base = 2; + } else if (isOctal.test(str)) { + base = 8; + } else { + throw Error(invalidArgument + str); + } + i = str.search(/p/i); + if (i > 0) { + p = +str.slice(i + 1); + str = str.substring(2, i); + } else { + str = str.slice(2); + } + i = str.indexOf("."); + isFloat = i >= 0; + Ctor = x.constructor; + if (isFloat) { + str = str.replace(".", ""); + len = str.length; + i = len - i; + divisor = intPow(Ctor, new Ctor(base), i, i * 2); + } + xd = convertBase(str, base, BASE); + xe = xd.length - 1; + for (i = xe; xd[i] === 0; --i) xd.pop(); + if (i < 0) return new Ctor(x.s * 0); + x.e = getBase10Exponent(xd, xe); + x.d = xd; + external = false; + if (isFloat) x = divide(x, divisor, len * 4); + if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal2.pow(2, p)); + external = true; + return x; + } + function sine(Ctor, x) { + var k, len = x.d.length; + if (len < 3) { + return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); + } + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x); + var sin2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); + for (; k--; ) { + sin2_x = x.times(x); + x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); + } + return x; + } + function taylorSeries(Ctor, n, x, y, isHyperbolic) { + var j, t, u, x2, i = 1, pr = Ctor.precision, k = Math.ceil(pr / LOG_BASE); + external = false; + x2 = x.times(x); + u = new Ctor(y); + for (; ; ) { + t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); + u = isHyperbolic ? y.plus(t) : y.minus(t); + y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); + t = u.plus(y); + if (t.d[k] !== void 0) { + for (j = k; t.d[j] === u.d[j] && j--; ) ; + if (j == -1) break; + } + j = u; + u = y; + y = t; + t = j; + i++; + } + external = true; + t.d.length = k + 1; + return t; + } + function tinyPow(b, e) { + var n = b; + while (--e) n *= b; + return n; + } + function toLessThanHalfPi(Ctor, x) { + var t, isNeg = x.s < 0, pi = getPi(Ctor, Ctor.precision, 1), halfPi = pi.times(0.5); + x = x.abs(); + if (x.lte(halfPi)) { + quadrant = isNeg ? 4 : 1; + return x; + } + t = x.divToInt(pi); + if (t.isZero()) { + quadrant = isNeg ? 3 : 2; + } else { + x = x.minus(t.times(pi)); + if (x.lte(halfPi)) { + quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1; + return x; + } + quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2; + } + return x.minus(pi).abs(); + } + function toStringBinary(x, baseOut, sd, rm) { + var base, e, i, k, len, roundUp, str, xd, y, Ctor = x.constructor, isExp = sd !== void 0; + if (isExp) { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } else { + sd = Ctor.precision; + rm = Ctor.rounding; + } + if (!x.isFinite()) { + str = nonFiniteToString(x); + } else { + str = finiteToString(x); + i = str.indexOf("."); + if (isExp) { + base = 2; + if (baseOut == 16) { + sd = sd * 4 - 3; + } else if (baseOut == 8) { + sd = sd * 3 - 2; + } + } else { + base = baseOut; + } + if (i >= 0) { + str = str.replace(".", ""); + y = new Ctor(1); + y.e = str.length - i; + y.d = convertBase(finiteToString(y), 10, base); + y.e = y.d.length; + } + xd = convertBase(str, 10, base); + e = len = xd.length; + for (; xd[--len] == 0; ) xd.pop(); + if (!xd[0]) { + str = isExp ? "0p+0" : "0"; + } else { + if (i < 0) { + e--; + } else { + x = new Ctor(x); + x.d = xd; + x.e = e; + x = divide(x, y, sd, rm, 0, base); + xd = x.d; + e = x.e; + roundUp = inexact; + } + i = xd[sd]; + k = base / 2; + roundUp = roundUp || xd[sd + 1] !== void 0; + roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7)); + xd.length = sd; + if (roundUp) { + for (; ++xd[--sd] > base - 1; ) { + xd[sd] = 0; + if (!sd) { + ++e; + xd.unshift(1); + } + } + } + for (len = xd.length; !xd[len - 1]; --len) ; + for (i = 0, str = ""; i < len; i++) str += NUMERALS.charAt(xd[i]); + if (isExp) { + if (len > 1) { + if (baseOut == 16 || baseOut == 8) { + i = baseOut == 16 ? 4 : 3; + for (--len; len % i; len++) str += "0"; + xd = convertBase(str, base, baseOut); + for (len = xd.length; !xd[len - 1]; --len) ; + for (i = 1, str = "1."; i < len; i++) str += NUMERALS.charAt(xd[i]); + } else { + str = str.charAt(0) + "." + str.slice(1); + } + } + str = str + (e < 0 ? "p" : "p+") + e; + } else if (e < 0) { + for (; ++e; ) str = "0" + str; + str = "0." + str; + } else { + if (++e > len) for (e -= len; e--; ) str += "0"; + else if (e < len) str = str.slice(0, e) + "." + str.slice(e); + } + } + str = (baseOut == 16 ? "0x" : baseOut == 2 ? "0b" : baseOut == 8 ? "0o" : "") + str; + } + return x.s < 0 ? "-" + str : str; + } + function truncate(arr, len) { + if (arr.length > len) { + arr.length = len; + return true; + } + } + function abs(x) { + return new this(x).abs(); + } + function acos(x) { + return new this(x).acos(); + } + function acosh(x) { + return new this(x).acosh(); + } + function add(x, y) { + return new this(x).plus(y); + } + function asin(x) { + return new this(x).asin(); + } + function asinh(x) { + return new this(x).asinh(); + } + function atan(x) { + return new this(x).atan(); + } + function atanh(x) { + return new this(x).atanh(); + } + function atan2(y, x) { + y = new this(y); + x = new this(x); + var r, pr = this.precision, rm = this.rounding, wpr = pr + 4; + if (!y.s || !x.s) { + r = new this(NaN); + } else if (!y.d && !x.d) { + r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); + r.s = y.s; + } else if (!x.d || y.isZero()) { + r = x.s < 0 ? getPi(this, pr, rm) : new this(0); + r.s = y.s; + } else if (!y.d || x.isZero()) { + r = getPi(this, wpr, 1).times(0.5); + r.s = y.s; + } else if (x.s < 0) { + this.precision = wpr; + this.rounding = 1; + r = this.atan(divide(y, x, wpr, 1)); + x = getPi(this, wpr, 1); + this.precision = pr; + this.rounding = rm; + r = y.s < 0 ? r.minus(x) : r.plus(x); + } else { + r = this.atan(divide(y, x, wpr, 1)); + } + return r; + } + function cbrt(x) { + return new this(x).cbrt(); + } + function ceil(x) { + return finalise(x = new this(x), x.e + 1, 2); + } + function clamp(x, min2, max2) { + return new this(x).clamp(min2, max2); + } + function config(obj) { + if (!obj || typeof obj !== "object") throw Error(decimalError + "Object expected"); + var i, p, v, useDefaults = obj.defaults === true, ps = [ + "precision", + 1, + MAX_DIGITS, + "rounding", + 0, + 8, + "toExpNeg", + -EXP_LIMIT, + 0, + "toExpPos", + 0, + EXP_LIMIT, + "maxE", + 0, + EXP_LIMIT, + "minE", + -EXP_LIMIT, + 0, + "modulo", + 0, + 9 + ]; + for (i = 0; i < ps.length; i += 3) { + if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; + else throw Error(invalidArgument + p + ": " + v); + } + } + if (p = "crypto", useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (v === true || v === false || v === 0 || v === 1) { + if (v) { + if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) { + this[p] = true; + } else { + throw Error(cryptoUnavailable); + } + } else { + this[p] = false; + } + } else { + throw Error(invalidArgument + p + ": " + v); + } + } + return this; + } + function cos(x) { + return new this(x).cos(); + } + function cosh(x) { + return new this(x).cosh(); + } + function clone(obj) { + var i, p, ps; + function Decimal3(v) { + var e, i2, t, x = this; + if (!(x instanceof Decimal3)) return new Decimal3(v); + x.constructor = Decimal3; + if (isDecimalInstance(v)) { + x.s = v.s; + if (external) { + if (!v.d || v.e > Decimal3.maxE) { + x.e = NaN; + x.d = null; + } else if (v.e < Decimal3.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + return; + } + t = typeof v; + if (t === "number") { + if (v === 0) { + x.s = 1 / v < 0 ? -1 : 1; + x.e = 0; + x.d = [0]; + return; + } + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + if (v === ~~v && v < 1e7) { + for (e = 0, i2 = v; i2 >= 10; i2 /= 10) e++; + if (external) { + if (e > Decimal3.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal3.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + return; + } else if (v * 0 !== 0) { + if (!v) x.s = NaN; + x.e = NaN; + x.d = null; + return; + } + return parseDecimal(x, v.toString()); + } else if (t !== "string") { + throw Error(invalidArgument + v); + } + if ((i2 = v.charCodeAt(0)) === 45) { + v = v.slice(1); + x.s = -1; + } else { + if (i2 === 43) v = v.slice(1); + x.s = 1; + } + return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); + } + Decimal3.prototype = P; + Decimal3.ROUND_UP = 0; + Decimal3.ROUND_DOWN = 1; + Decimal3.ROUND_CEIL = 2; + Decimal3.ROUND_FLOOR = 3; + Decimal3.ROUND_HALF_UP = 4; + Decimal3.ROUND_HALF_DOWN = 5; + Decimal3.ROUND_HALF_EVEN = 6; + Decimal3.ROUND_HALF_CEIL = 7; + Decimal3.ROUND_HALF_FLOOR = 8; + Decimal3.EUCLID = 9; + Decimal3.config = Decimal3.set = config; + Decimal3.clone = clone; + Decimal3.isDecimal = isDecimalInstance; + Decimal3.abs = abs; + Decimal3.acos = acos; + Decimal3.acosh = acosh; + Decimal3.add = add; + Decimal3.asin = asin; + Decimal3.asinh = asinh; + Decimal3.atan = atan; + Decimal3.atanh = atanh; + Decimal3.atan2 = atan2; + Decimal3.cbrt = cbrt; + Decimal3.ceil = ceil; + Decimal3.clamp = clamp; + Decimal3.cos = cos; + Decimal3.cosh = cosh; + Decimal3.div = div; + Decimal3.exp = exp; + Decimal3.floor = floor; + Decimal3.hypot = hypot; + Decimal3.ln = ln; + Decimal3.log = log; + Decimal3.log10 = log10; + Decimal3.log2 = log2; + Decimal3.max = max; + Decimal3.min = min; + Decimal3.mod = mod; + Decimal3.mul = mul; + Decimal3.pow = pow; + Decimal3.random = random; + Decimal3.round = round; + Decimal3.sign = sign; + Decimal3.sin = sin; + Decimal3.sinh = sinh; + Decimal3.sqrt = sqrt; + Decimal3.sub = sub; + Decimal3.sum = sum; + Decimal3.tan = tan; + Decimal3.tanh = tanh; + Decimal3.trunc = trunc; + if (obj === void 0) obj = {}; + if (obj) { + if (obj.defaults !== true) { + ps = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"]; + for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; + } + } + Decimal3.config(obj); + return Decimal3; + } + function div(x, y) { + return new this(x).div(y); + } + function exp(x) { + return new this(x).exp(); + } + function floor(x) { + return finalise(x = new this(x), x.e + 1, 3); + } + function hypot() { + var i, n, t = new this(0); + external = false; + for (i = 0; i < arguments.length; ) { + n = new this(arguments[i++]); + if (!n.d) { + if (n.s) { + external = true; + return new this(1 / 0); + } + t = n; + } else if (t.d) { + t = t.plus(n.times(n)); + } + } + external = true; + return t.sqrt(); + } + function isDecimalInstance(obj) { + return obj instanceof Decimal2 || obj && obj.toStringTag === tag || false; + } + function ln(x) { + return new this(x).ln(); + } + function log(x, y) { + return new this(x).log(y); + } + function log2(x) { + return new this(x).log(2); + } + function log10(x) { + return new this(x).log(10); + } + function max() { + return maxOrMin(this, arguments, "lt"); + } + function min() { + return maxOrMin(this, arguments, "gt"); + } + function mod(x, y) { + return new this(x).mod(y); + } + function mul(x, y) { + return new this(x).mul(y); + } + function pow(x, y) { + return new this(x).pow(y); + } + function random(sd) { + var d, e, k, n, i = 0, r = new this(1), rd = []; + if (sd === void 0) sd = this.precision; + else checkInt32(sd, 1, MAX_DIGITS); + k = Math.ceil(sd / LOG_BASE); + if (!this.crypto) { + for (; i < k; ) rd[i++] = Math.random() * 1e7 | 0; + } else if (crypto.getRandomValues) { + d = crypto.getRandomValues(new Uint32Array(k)); + for (; i < k; ) { + n = d[i]; + if (n >= 429e7) { + d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; + } else { + rd[i++] = n % 1e7; + } + } + } else if (crypto.randomBytes) { + d = crypto.randomBytes(k *= 4); + for (; i < k; ) { + n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 127) << 24); + if (n >= 214e7) { + crypto.randomBytes(4).copy(d, i); + } else { + rd.push(n % 1e7); + i += 4; + } + } + i = k / 4; + } else { + throw Error(cryptoUnavailable); + } + k = rd[--i]; + sd %= LOG_BASE; + if (k && sd) { + n = mathpow(10, LOG_BASE - sd); + rd[i] = (k / n | 0) * n; + } + for (; rd[i] === 0; i--) rd.pop(); + if (i < 0) { + e = 0; + rd = [0]; + } else { + e = -1; + for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); + for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; + if (k < LOG_BASE) e -= LOG_BASE - k; + } + r.e = e; + r.d = rd; + return r; + } + function round(x) { + return finalise(x = new this(x), x.e + 1, this.rounding); + } + function sign(x) { + x = new this(x); + return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN; + } + function sin(x) { + return new this(x).sin(); + } + function sinh(x) { + return new this(x).sinh(); + } + function sqrt(x) { + return new this(x).sqrt(); + } + function sub(x, y) { + return new this(x).sub(y); + } + function sum() { + var i = 0, args = arguments, x = new this(args[i]); + external = false; + for (; x.s && ++i < args.length; ) x = x.plus(args[i]); + external = true; + return finalise(x, this.precision, this.rounding); + } + function tan(x) { + return new this(x).tan(); + } + function tanh(x) { + return new this(x).tanh(); + } + function trunc(x) { + return finalise(x = new this(x), x.e + 1, 1); + } + Decimal2 = clone(DEFAULTS); + Decimal2.prototype.constructor = Decimal2; + Decimal2["default"] = Decimal2.Decimal = Decimal2; + LN10 = new Decimal2(LN10); + PI = new Decimal2(PI); + if (typeof define == "function" && define.amd) { + define(function() { + return Decimal2; + }); + } else if (typeof module2 != "undefined" && module2.exports) { + if (typeof Symbol == "function" && typeof Symbol.iterator == "symbol") { + P[Symbol["for"]("nodejs.util.inspect.custom")] = P.toString; + P[Symbol.toStringTag] = "Decimal"; + } + module2.exports = Decimal2; + } else { + if (!globalScope) { + globalScope = typeof self != "undefined" && self && self.self == self ? self : window; + } + noConflict = globalScope.Decimal; + Decimal2.noConflict = function() { + globalScope.Decimal = noConflict; + return Decimal2; + }; + globalScope.Decimal = Decimal2; + } + })(exports2); + } +}); + +// node_modules/tiny-invariant/dist/tiny-invariant.cjs.js +var require_tiny_invariant_cjs = __commonJS({ + "node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"(exports2, module2) { + "use strict"; + var isProduction = process.env.NODE_ENV === "production"; + var prefix = "Invariant failed"; + function invariant(condition, message) { + if (condition) { + return; + } + if (isProduction) { + throw new Error(prefix); + } + var provided = typeof message === "function" ? message() : message; + var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix; + throw new Error(value); + } + module2.exports = invariant; + } +}); + +// node_modules/decimal.js-light/decimal.js +var require_decimal2 = __commonJS({ + "node_modules/decimal.js-light/decimal.js"(exports2, module2) { + (function(globalScope) { + "use strict"; + var MAX_DIGITS = 1e9, Decimal2 = { + // These values must be integers within the stated ranges (inclusive). + // Most of these values can be changed during run-time using `Decimal.config`. + // The maximum number of significant digits of the result of a calculation or base conversion. + // E.g. `Decimal.config({ precision: 20 });` + precision: 20, + // 1 to MAX_DIGITS + // The rounding mode used by default by `toInteger`, `toDecimalPlaces`, `toExponential`, + // `toFixed`, `toPrecision` and `toSignificantDigits`. + // + // ROUND_UP 0 Away from zero. + // ROUND_DOWN 1 Towards zero. + // ROUND_CEIL 2 Towards +Infinity. + // ROUND_FLOOR 3 Towards -Infinity. + // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + // + // E.g. + // `Decimal.rounding = 4;` + // `Decimal.rounding = Decimal.ROUND_HALF_UP;` + rounding: 4, + // 0 to 8 + // The exponent value at and beneath which `toString` returns exponential notation. + // JavaScript numbers: -7 + toExpNeg: -7, + // 0 to -MAX_E + // The exponent value at and above which `toString` returns exponential notation. + // JavaScript numbers: 21 + toExpPos: 21, + // 0 to MAX_E + // The natural logarithm of 10. + // 115 digits + LN10: "2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286" + }, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", exponentOutOfRange = decimalError + "Exponent out of range: ", mathfloor = Math.floor, mathpow = Math.pow, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, ONE, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, MAX_E = mathfloor(MAX_SAFE_INTEGER / LOG_BASE), P = {}; + P.absoluteValue = P.abs = function() { + var x = new this.constructor(this); + if (x.s) x.s = 1; + return x; + }; + P.comparedTo = P.cmp = function(y) { + var i, j, xdL, ydL, x = this; + y = new x.constructor(y); + if (x.s !== y.s) return x.s || -y.s; + if (x.e !== y.e) return x.e > y.e ^ x.s < 0 ? 1 : -1; + xdL = x.d.length; + ydL = y.d.length; + for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { + if (x.d[i] !== y.d[i]) return x.d[i] > y.d[i] ^ x.s < 0 ? 1 : -1; + } + return xdL === ydL ? 0 : xdL > ydL ^ x.s < 0 ? 1 : -1; + }; + P.decimalPlaces = P.dp = function() { + var x = this, w = x.d.length - 1, dp = (w - x.e) * LOG_BASE; + w = x.d[w]; + if (w) for (; w % 10 == 0; w /= 10) dp--; + return dp < 0 ? 0 : dp; + }; + P.dividedBy = P.div = function(y) { + return divide(this, new this.constructor(y)); + }; + P.dividedToIntegerBy = P.idiv = function(y) { + var x = this, Ctor = x.constructor; + return round(divide(x, new Ctor(y), 0, 1), Ctor.precision); + }; + P.equals = P.eq = function(y) { + return !this.cmp(y); + }; + P.exponent = function() { + return getBase10Exponent(this); + }; + P.greaterThan = P.gt = function(y) { + return this.cmp(y) > 0; + }; + P.greaterThanOrEqualTo = P.gte = function(y) { + return this.cmp(y) >= 0; + }; + P.isInteger = P.isint = function() { + return this.e > this.d.length - 2; + }; + P.isNegative = P.isneg = function() { + return this.s < 0; + }; + P.isPositive = P.ispos = function() { + return this.s > 0; + }; + P.isZero = function() { + return this.s === 0; + }; + P.lessThan = P.lt = function(y) { + return this.cmp(y) < 0; + }; + P.lessThanOrEqualTo = P.lte = function(y) { + return this.cmp(y) < 1; + }; + P.logarithm = P.log = function(base) { + var r, x = this, Ctor = x.constructor, pr = Ctor.precision, wpr = pr + 5; + if (base === void 0) { + base = new Ctor(10); + } else { + base = new Ctor(base); + if (base.s < 1 || base.eq(ONE)) throw Error(decimalError + "NaN"); + } + if (x.s < 1) throw Error(decimalError + (x.s ? "NaN" : "-Infinity")); + if (x.eq(ONE)) return new Ctor(0); + external = false; + r = divide(ln(x, wpr), ln(base, wpr), wpr); + external = true; + return round(r, pr); + }; + P.minus = P.sub = function(y) { + var x = this; + y = new x.constructor(y); + return x.s == y.s ? subtract(x, y) : add(x, (y.s = -y.s, y)); + }; + P.modulo = P.mod = function(y) { + var q, x = this, Ctor = x.constructor, pr = Ctor.precision; + y = new Ctor(y); + if (!y.s) throw Error(decimalError + "NaN"); + if (!x.s) return round(new Ctor(x), pr); + external = false; + q = divide(x, y, 0, 1).times(y); + external = true; + return x.minus(q); + }; + P.naturalExponential = P.exp = function() { + return exp(this); + }; + P.naturalLogarithm = P.ln = function() { + return ln(this); + }; + P.negated = P.neg = function() { + var x = new this.constructor(this); + x.s = -x.s || 0; + return x; + }; + P.plus = P.add = function(y) { + var x = this; + y = new x.constructor(y); + return x.s == y.s ? add(x, y) : subtract(x, (y.s = -y.s, y)); + }; + P.precision = P.sd = function(z) { + var e, sd, w, x = this; + if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); + e = getBase10Exponent(x) + 1; + w = x.d.length - 1; + sd = w * LOG_BASE + 1; + w = x.d[w]; + if (w) { + for (; w % 10 == 0; w /= 10) sd--; + for (w = x.d[0]; w >= 10; w /= 10) sd++; + } + return z && e > sd ? e : sd; + }; + P.squareRoot = P.sqrt = function() { + var e, n, pr, r, s, t, wpr, x = this, Ctor = x.constructor; + if (x.s < 1) { + if (!x.s) return new Ctor(0); + throw Error(decimalError + "NaN"); + } + e = getBase10Exponent(x); + external = false; + s = Math.sqrt(+x); + if (s == 0 || s == 1 / 0) { + n = digitsToString(x.d); + if ((n.length + e) % 2 == 0) n += "0"; + s = Math.sqrt(n); + e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new Ctor(n); + } else { + r = new Ctor(s.toString()); + } + pr = Ctor.precision; + s = wpr = pr + 3; + for (; ; ) { + t = r; + r = t.plus(divide(x, t, wpr + 2)).times(0.5); + if (digitsToString(t.d).slice(0, wpr) === (n = digitsToString(r.d)).slice(0, wpr)) { + n = n.slice(wpr - 3, wpr + 1); + if (s == wpr && n == "4999") { + round(t, pr + 1, 0); + if (t.times(t).eq(x)) { + r = t; + break; + } + } else if (n != "9999") { + break; + } + wpr += 4; + } + } + external = true; + return round(r, pr); + }; + P.times = P.mul = function(y) { + var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d; + if (!x.s || !y.s) return new Ctor(0); + y.s *= x.s; + e = x.e + y.e; + xdL = xd.length; + ydL = yd.length; + if (xdL < ydL) { + r = xd; + xd = yd; + yd = r; + rL = xdL; + xdL = ydL; + ydL = rL; + } + r = []; + rL = xdL + ydL; + for (i = rL; i--; ) r.push(0); + for (i = ydL; --i >= 0; ) { + carry = 0; + for (k = xdL + i; k > i; ) { + t = r[k] + yd[i] * xd[k - i - 1] + carry; + r[k--] = t % BASE | 0; + carry = t / BASE | 0; + } + r[k] = (r[k] + carry) % BASE | 0; + } + for (; !r[--rL]; ) r.pop(); + if (carry) ++e; + else r.shift(); + y.d = r; + y.e = e; + return external ? round(y, Ctor.precision) : y; + }; + P.toDecimalPlaces = P.todp = function(dp, rm) { + var x = this, Ctor = x.constructor; + x = new Ctor(x); + if (dp === void 0) return x; + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + return round(x, dp + getBase10Exponent(x) + 1, rm); + }; + P.toExponential = function(dp, rm) { + var str, x = this, Ctor = x.constructor; + if (dp === void 0) { + str = toString(x, true); + } else { + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = round(new Ctor(x), dp + 1, rm); + str = toString(x, true, dp + 1); + } + return str; + }; + P.toFixed = function(dp, rm) { + var str, y, x = this, Ctor = x.constructor; + if (dp === void 0) return toString(x); + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + y = round(new Ctor(x), dp + getBase10Exponent(x) + 1, rm); + str = toString(y.abs(), false, dp + getBase10Exponent(y) + 1); + return x.isneg() && !x.isZero() ? "-" + str : str; + }; + P.toInteger = P.toint = function() { + var x = this, Ctor = x.constructor; + return round(new Ctor(x), getBase10Exponent(x) + 1, Ctor.rounding); + }; + P.toNumber = function() { + return +this; + }; + P.toPower = P.pow = function(y) { + var e, k, pr, r, sign, yIsInt, x = this, Ctor = x.constructor, guard = 12, yn = +(y = new Ctor(y)); + if (!y.s) return new Ctor(ONE); + x = new Ctor(x); + if (!x.s) { + if (y.s < 1) throw Error(decimalError + "Infinity"); + return x; + } + if (x.eq(ONE)) return x; + pr = Ctor.precision; + if (y.eq(ONE)) return round(x, pr); + e = y.e; + k = y.d.length - 1; + yIsInt = e >= k; + sign = x.s; + if (!yIsInt) { + if (sign < 0) throw Error(decimalError + "NaN"); + } else if ((k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { + r = new Ctor(ONE); + e = Math.ceil(pr / LOG_BASE + 4); + external = false; + for (; ; ) { + if (k % 2) { + r = r.times(x); + truncate(r.d, e); + } + k = mathfloor(k / 2); + if (k === 0) break; + x = x.times(x); + truncate(x.d, e); + } + external = true; + return y.s < 0 ? new Ctor(ONE).div(r) : round(r, pr); + } + sign = sign < 0 && y.d[Math.max(e, k)] & 1 ? -1 : 1; + x.s = 1; + external = false; + r = y.times(ln(x, pr + guard)); + external = true; + r = exp(r); + r.s = sign; + return r; + }; + P.toPrecision = function(sd, rm) { + var e, str, x = this, Ctor = x.constructor; + if (sd === void 0) { + e = getBase10Exponent(x); + str = toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos); + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = round(new Ctor(x), sd, rm); + e = getBase10Exponent(x); + str = toString(x, sd <= e || e <= Ctor.toExpNeg, sd); + } + return str; + }; + P.toSignificantDigits = P.tosd = function(sd, rm) { + var x = this, Ctor = x.constructor; + if (sd === void 0) { + sd = Ctor.precision; + rm = Ctor.rounding; + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } + return round(new Ctor(x), sd, rm); + }; + P.toString = P.valueOf = P.val = P.toJSON = function() { + var x = this, e = getBase10Exponent(x), Ctor = x.constructor; + return toString(x, e <= Ctor.toExpNeg || e >= Ctor.toExpPos); + }; + function add(x, y) { + var carry, d, e, i, k, len, xd, yd, Ctor = x.constructor, pr = Ctor.precision; + if (!x.s || !y.s) { + if (!y.s) y = new Ctor(x); + return external ? round(y, pr) : y; + } + xd = x.d; + yd = y.d; + k = x.e; + e = y.e; + xd = xd.slice(); + i = k - e; + if (i) { + if (i < 0) { + d = xd; + i = -i; + len = yd.length; + } else { + d = yd; + e = k; + len = xd.length; + } + k = Math.ceil(pr / LOG_BASE); + len = k > len ? k + 1 : len + 1; + if (i > len) { + i = len; + d.length = 1; + } + d.reverse(); + for (; i--; ) d.push(0); + d.reverse(); + } + len = xd.length; + i = yd.length; + if (len - i < 0) { + i = len; + d = yd; + yd = xd; + xd = d; + } + for (carry = 0; i; ) { + carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; + xd[i] %= BASE; + } + if (carry) { + xd.unshift(carry); + ++e; + } + for (len = xd.length; xd[--len] == 0; ) xd.pop(); + y.d = xd; + y.e = e; + return external ? round(y, pr) : y; + } + function checkInt32(i, min, max) { + if (i !== ~~i || i < min || i > max) { + throw Error(invalidArgument + i); + } + } + function digitsToString(d) { + var i, k, ws, indexOfLastWord = d.length - 1, str = "", w = d[0]; + if (indexOfLastWord > 0) { + str += w; + for (i = 1; i < indexOfLastWord; i++) { + ws = d[i] + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + str += ws; + } + w = d[i]; + ws = w + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + } else if (w === 0) { + return "0"; + } + for (; w % 10 === 0; ) w /= 10; + return str + w; + } + var divide = /* @__PURE__ */ function() { + function multiplyInteger(x, k) { + var temp, carry = 0, i = x.length; + for (x = x.slice(); i--; ) { + temp = x[i] * k + carry; + x[i] = temp % BASE | 0; + carry = temp / BASE | 0; + } + if (carry) x.unshift(carry); + return x; + } + function compare(a, b, aL, bL) { + var i, r; + if (aL != bL) { + r = aL > bL ? 1 : -1; + } else { + for (i = r = 0; i < aL; i++) { + if (a[i] != b[i]) { + r = a[i] > b[i] ? 1 : -1; + break; + } + } + } + return r; + } + function subtract2(a, b, aL) { + var i = 0; + for (; aL--; ) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * BASE + a[aL] - b[aL]; + } + for (; !a[0] && a.length > 1; ) a.shift(); + } + return function(x, y, pr, dp) { + var cmp, e, i, k, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d; + if (!x.s) return new Ctor(x); + if (!y.s) throw Error(decimalError + "Division by zero"); + e = x.e - y.e; + yL = yd.length; + xL = xd.length; + q = new Ctor(sign); + qd = q.d = []; + for (i = 0; yd[i] == (xd[i] || 0); ) ++i; + if (yd[i] > (xd[i] || 0)) --e; + if (pr == null) { + sd = pr = Ctor.precision; + } else if (dp) { + sd = pr + (getBase10Exponent(x) - getBase10Exponent(y)) + 1; + } else { + sd = pr; + } + if (sd < 0) return new Ctor(0); + sd = sd / LOG_BASE + 2 | 0; + i = 0; + if (yL == 1) { + k = 0; + yd = yd[0]; + sd++; + for (; (i < xL || k) && sd--; i++) { + t = k * BASE + (xd[i] || 0); + qd[i] = t / yd | 0; + k = t % yd | 0; + } + } else { + k = BASE / (yd[0] + 1) | 0; + if (k > 1) { + yd = multiplyInteger(yd, k); + xd = multiplyInteger(xd, k); + yL = yd.length; + xL = xd.length; + } + xi = yL; + rem = xd.slice(0, yL); + remL = rem.length; + for (; remL < yL; ) rem[remL++] = 0; + yz = yd.slice(); + yz.unshift(0); + yd0 = yd[0]; + if (yd[1] >= BASE / 2) ++yd0; + do { + k = 0; + cmp = compare(yd, rem, yL, remL); + if (cmp < 0) { + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * BASE + (rem[1] || 0); + k = rem0 / yd0 | 0; + if (k > 1) { + if (k >= BASE) k = BASE - 1; + prod = multiplyInteger(yd, k); + prodL = prod.length; + remL = rem.length; + cmp = compare(prod, rem, prodL, remL); + if (cmp == 1) { + k--; + subtract2(prod, yL < prodL ? yz : yd, prodL); + } + } else { + if (k == 0) cmp = k = 1; + prod = yd.slice(); + } + prodL = prod.length; + if (prodL < remL) prod.unshift(0); + subtract2(rem, prod, remL); + if (cmp == -1) { + remL = rem.length; + cmp = compare(yd, rem, yL, remL); + if (cmp < 1) { + k++; + subtract2(rem, yL < remL ? yz : yd, remL); + } + } + remL = rem.length; + } else if (cmp === 0) { + k++; + rem = [0]; + } + qd[i++] = k; + if (cmp && rem[0]) { + rem[remL++] = xd[xi] || 0; + } else { + rem = [xd[xi]]; + remL = 1; + } + } while ((xi++ < xL || rem[0] !== void 0) && sd--); + } + if (!qd[0]) qd.shift(); + q.e = e; + return round(q, dp ? pr + getBase10Exponent(q) + 1 : pr); + }; + }(); + function exp(x, sd) { + var denominator, guard, pow, sum, t, wpr, i = 0, k = 0, Ctor = x.constructor, pr = Ctor.precision; + if (getBase10Exponent(x) > 16) throw Error(exponentOutOfRange + getBase10Exponent(x)); + if (!x.s) return new Ctor(ONE); + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + t = new Ctor(0.03125); + while (x.abs().gte(0.1)) { + x = x.times(t); + k += 5; + } + guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; + wpr += guard; + denominator = pow = sum = new Ctor(ONE); + Ctor.precision = wpr; + for (; ; ) { + pow = round(pow.times(x), wpr); + denominator = denominator.times(++i); + t = sum.plus(divide(pow, denominator, wpr)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + while (k--) sum = round(sum.times(sum), wpr); + Ctor.precision = pr; + return sd == null ? (external = true, round(sum, pr)) : sum; + } + sum = t; + } + } + function getBase10Exponent(x) { + var e = x.e * LOG_BASE, w = x.d[0]; + for (; w >= 10; w /= 10) e++; + return e; + } + function getLn10(Ctor, sd, pr) { + if (sd > Ctor.LN10.sd()) { + external = true; + if (pr) Ctor.precision = pr; + throw Error(decimalError + "LN10 precision limit exceeded"); + } + return round(new Ctor(Ctor.LN10), sd); + } + function getZeroString(k) { + var zs = ""; + for (; k--; ) zs += "0"; + return zs; + } + function ln(y, sd) { + var c, c0, denominator, e, numerator, sum, t, wpr, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, pr = Ctor.precision; + if (x.s < 1) throw Error(decimalError + (x.s ? "NaN" : "-Infinity")); + if (x.eq(ONE)) return new Ctor(0); + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + if (x.eq(10)) { + if (sd == null) external = true; + return getLn10(Ctor, wpr); + } + wpr += guard; + Ctor.precision = wpr; + c = digitsToString(xd); + c0 = c.charAt(0); + e = getBase10Exponent(x); + if (Math.abs(e) < 15e14) { + while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { + x = x.times(y); + c = digitsToString(x.d); + c0 = c.charAt(0); + n++; + } + e = getBase10Exponent(x); + if (c0 > 1) { + x = new Ctor("0." + c); + e++; + } else { + x = new Ctor(c0 + "." + c.slice(1)); + } + } else { + t = getLn10(Ctor, wpr + 2, pr).times(e + ""); + x = ln(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t); + Ctor.precision = pr; + return sd == null ? (external = true, round(x, pr)) : x; + } + sum = numerator = x = divide(x.minus(ONE), x.plus(ONE), wpr); + x2 = round(x.times(x), wpr); + denominator = 3; + for (; ; ) { + numerator = round(numerator.times(x2), wpr); + t = sum.plus(divide(numerator, new Ctor(denominator), wpr)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) { + sum = sum.times(2); + if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + "")); + sum = divide(sum, new Ctor(n), wpr); + Ctor.precision = pr; + return sd == null ? (external = true, round(sum, pr)) : sum; + } + sum = t; + denominator += 2; + } + } + function parseDecimal(x, str) { + var e, i, len; + if ((e = str.indexOf(".")) > -1) str = str.replace(".", ""); + if ((i = str.search(/e/i)) > 0) { + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + e = str.length; + } + for (i = 0; str.charCodeAt(i) === 48; ) ++i; + for (len = str.length; str.charCodeAt(len - 1) === 48; ) --len; + str = str.slice(i, len); + if (str) { + len -= i; + e = e - i - 1; + x.e = mathfloor(e / LOG_BASE); + x.d = []; + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; + if (i < len) { + if (i) x.d.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len; ) x.d.push(+str.slice(i, i += LOG_BASE)); + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + for (; i--; ) str += "0"; + x.d.push(+str); + if (external && (x.e > MAX_E || x.e < -MAX_E)) throw Error(exponentOutOfRange + e); + } else { + x.s = 0; + x.e = 0; + x.d = [0]; + } + return x; + } + function round(x, sd, rm) { + var i, j, k, n, rd, doRound, w, xdi, xd = x.d; + for (n = 1, k = xd[0]; k >= 10; k /= 10) n++; + i = sd - n; + if (i < 0) { + i += LOG_BASE; + j = sd; + w = xd[xdi = 0]; + } else { + xdi = Math.ceil((i + 1) / LOG_BASE); + k = xd.length; + if (xdi >= k) return x; + w = k = xd[xdi]; + for (n = 1; k >= 10; k /= 10) n++; + i %= LOG_BASE; + j = i - LOG_BASE + n; + } + if (rm !== void 0) { + k = mathpow(10, n - j - 1); + rd = w / k % 10 | 0; + doRound = sd < 0 || xd[xdi + 1] !== void 0 || w % k; + doRound = rm < 4 ? (rd || doRound) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || doRound || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. + (i > 0 ? j > 0 ? w / mathpow(10, n - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7)); + } + if (sd < 1 || !xd[0]) { + if (doRound) { + k = getBase10Exponent(x); + xd.length = 1; + sd = sd - k - 1; + xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); + x.e = mathfloor(-sd / LOG_BASE) || 0; + } else { + xd.length = 1; + xd[0] = x.e = x.s = 0; + } + return x; + } + if (i == 0) { + xd.length = xdi; + k = 1; + xdi--; + } else { + xd.length = xdi + 1; + k = mathpow(10, LOG_BASE - i); + xd[xdi] = j > 0 ? (w / mathpow(10, n - j) % mathpow(10, j) | 0) * k : 0; + } + if (doRound) { + for (; ; ) { + if (xdi == 0) { + if ((xd[0] += k) == BASE) { + xd[0] = 1; + ++x.e; + } + break; + } else { + xd[xdi] += k; + if (xd[xdi] != BASE) break; + xd[xdi--] = 0; + k = 1; + } + } + } + for (i = xd.length; xd[--i] === 0; ) xd.pop(); + if (external && (x.e > MAX_E || x.e < -MAX_E)) { + throw Error(exponentOutOfRange + getBase10Exponent(x)); + } + return x; + } + function subtract(x, y) { + var d, e, i, j, k, len, xd, xe, xLTy, yd, Ctor = x.constructor, pr = Ctor.precision; + if (!x.s || !y.s) { + if (y.s) y.s = -y.s; + else y = new Ctor(x); + return external ? round(y, pr) : y; + } + xd = x.d; + yd = y.d; + e = y.e; + xe = x.e; + xd = xd.slice(); + k = xe - e; + if (k) { + xLTy = k < 0; + if (xLTy) { + d = xd; + k = -k; + len = yd.length; + } else { + d = yd; + e = xe; + len = xd.length; + } + i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; + if (k > i) { + k = i; + d.length = 1; + } + d.reverse(); + for (i = k; i--; ) d.push(0); + d.reverse(); + } else { + i = xd.length; + len = yd.length; + xLTy = i < len; + if (xLTy) len = i; + for (i = 0; i < len; i++) { + if (xd[i] != yd[i]) { + xLTy = xd[i] < yd[i]; + break; + } + } + k = 0; + } + if (xLTy) { + d = xd; + xd = yd; + yd = d; + y.s = -y.s; + } + len = xd.length; + for (i = yd.length - len; i > 0; --i) xd[len++] = 0; + for (i = yd.length; i > k; ) { + if (xd[--i] < yd[i]) { + for (j = i; j && xd[--j] === 0; ) xd[j] = BASE - 1; + --xd[j]; + xd[i] += BASE; + } + xd[i] -= yd[i]; + } + for (; xd[--len] === 0; ) xd.pop(); + for (; xd[0] === 0; xd.shift()) --e; + if (!xd[0]) return new Ctor(0); + y.d = xd; + y.e = e; + return external ? round(y, pr) : y; + } + function toString(x, isExp, sd) { + var k, e = getBase10Exponent(x), str = digitsToString(x.d), len = str.length; + if (isExp) { + if (sd && (k = sd - len) > 0) { + str = str.charAt(0) + "." + str.slice(1) + getZeroString(k); + } else if (len > 1) { + str = str.charAt(0) + "." + str.slice(1); + } + str = str + (e < 0 ? "e" : "e+") + e; + } else if (e < 0) { + str = "0." + getZeroString(-e - 1) + str; + if (sd && (k = sd - len) > 0) str += getZeroString(k); + } else if (e >= len) { + str += getZeroString(e + 1 - len); + if (sd && (k = sd - e - 1) > 0) str = str + "." + getZeroString(k); + } else { + if ((k = e + 1) < len) str = str.slice(0, k) + "." + str.slice(k); + if (sd && (k = sd - len) > 0) { + if (e + 1 === len) str += "."; + str += getZeroString(k); + } + } + return x.s < 0 ? "-" + str : str; + } + function truncate(arr, len) { + if (arr.length > len) { + arr.length = len; + return true; + } + } + function clone(obj) { + var i, p, ps; + function Decimal3(value) { + var x = this; + if (!(x instanceof Decimal3)) return new Decimal3(value); + x.constructor = Decimal3; + if (value instanceof Decimal3) { + x.s = value.s; + x.e = value.e; + x.d = (value = value.d) ? value.slice() : value; + return; + } + if (typeof value === "number") { + if (value * 0 !== 0) { + throw Error(invalidArgument + value); + } + if (value > 0) { + x.s = 1; + } else if (value < 0) { + value = -value; + x.s = -1; + } else { + x.s = 0; + x.e = 0; + x.d = [0]; + return; + } + if (value === ~~value && value < 1e7) { + x.e = 0; + x.d = [value]; + return; + } + return parseDecimal(x, value.toString()); + } else if (typeof value !== "string") { + throw Error(invalidArgument + value); + } + if (value.charCodeAt(0) === 45) { + value = value.slice(1); + x.s = -1; + } else { + x.s = 1; + } + if (isDecimal.test(value)) parseDecimal(x, value); + else throw Error(invalidArgument + value); + } + Decimal3.prototype = P; + Decimal3.ROUND_UP = 0; + Decimal3.ROUND_DOWN = 1; + Decimal3.ROUND_CEIL = 2; + Decimal3.ROUND_FLOOR = 3; + Decimal3.ROUND_HALF_UP = 4; + Decimal3.ROUND_HALF_DOWN = 5; + Decimal3.ROUND_HALF_EVEN = 6; + Decimal3.ROUND_HALF_CEIL = 7; + Decimal3.ROUND_HALF_FLOOR = 8; + Decimal3.clone = clone; + Decimal3.config = Decimal3.set = config; + if (obj === void 0) obj = {}; + if (obj) { + ps = ["precision", "rounding", "toExpNeg", "toExpPos", "LN10"]; + for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; + } + Decimal3.config(obj); + return Decimal3; + } + function config(obj) { + if (!obj || typeof obj !== "object") { + throw Error(decimalError + "Object expected"); + } + var i, p, v, ps = [ + "precision", + 1, + MAX_DIGITS, + "rounding", + 0, + 8, + "toExpNeg", + -1 / 0, + 0, + "toExpPos", + 0, + 1 / 0 + ]; + for (i = 0; i < ps.length; i += 3) { + if ((v = obj[p = ps[i]]) !== void 0) { + if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; + else throw Error(invalidArgument + p + ": " + v); + } + } + if ((v = obj[p = "LN10"]) !== void 0) { + if (v == Math.LN10) this[p] = new this(v); + else throw Error(invalidArgument + p + ": " + v); + } + return this; + } + Decimal2 = clone(Decimal2); + Decimal2["default"] = Decimal2.Decimal = Decimal2; + ONE = new Decimal2(1); + if (typeof define == "function" && define.amd) { + define(function() { + return Decimal2; + }); + } else if (typeof module2 != "undefined" && module2.exports) { + module2.exports = Decimal2; + } else { + if (!globalScope) { + globalScope = typeof self != "undefined" && self && self.self == self ? self : Function("return this")(); + } + globalScope.Decimal = Decimal2; + } + })(exports2); + } +}); + +// node_modules/big.js/big.js +var require_big = __commonJS({ + "node_modules/big.js/big.js"(exports2, module2) { + (function(GLOBAL) { + "use strict"; + var Big, DP = 20, RM = 1, MAX_DP = 1e6, MAX_POWER = 1e6, NE = -7, PE = 21, NAME = "[big.js] ", INVALID = NAME + "Invalid ", INVALID_DP = INVALID + "decimal places", INVALID_RM = INVALID + "rounding mode", DIV_BY_ZERO = NAME + "Division by zero", P = {}, UNDEFINED = void 0, NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; + function _Big_() { + function Big2(n) { + var x = this; + if (!(x instanceof Big2)) return n === UNDEFINED ? _Big_() : new Big2(n); + if (n instanceof Big2) { + x.s = n.s; + x.e = n.e; + x.c = n.c.slice(); + } else { + parse(x, n); + } + x.constructor = Big2; + } + Big2.prototype = P; + Big2.DP = DP; + Big2.RM = RM; + Big2.NE = NE; + Big2.PE = PE; + Big2.version = "5.2.2"; + return Big2; + } + function parse(x, n) { + var e, i, nl; + if (n === 0 && 1 / n < 0) n = "-0"; + else if (!NUMERIC.test(n += "")) throw Error(INVALID + "number"); + x.s = n.charAt(0) == "-" ? (n = n.slice(1), -1) : 1; + if ((e = n.indexOf(".")) > -1) n = n.replace(".", ""); + if ((i = n.search(/e/i)) > 0) { + if (e < 0) e = i; + e += +n.slice(i + 1); + n = n.substring(0, i); + } else if (e < 0) { + e = n.length; + } + nl = n.length; + for (i = 0; i < nl && n.charAt(i) == "0"; ) ++i; + if (i == nl) { + x.c = [x.e = 0]; + } else { + for (; nl > 0 && n.charAt(--nl) == "0"; ) ; + x.e = e - i - 1; + x.c = []; + for (e = 0; i <= nl; ) x.c[e++] = +n.charAt(i++); + } + return x; + } + function round(x, dp, rm, more) { + var xc = x.c, i = x.e + dp + 1; + if (i < xc.length) { + if (rm === 1) { + more = xc[i] >= 5; + } else if (rm === 2) { + more = xc[i] > 5 || xc[i] == 5 && (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1); + } else if (rm === 3) { + more = more || !!xc[0]; + } else { + more = false; + if (rm !== 0) throw Error(INVALID_RM); + } + if (i < 1) { + xc.length = 1; + if (more) { + x.e = -dp; + xc[0] = 1; + } else { + xc[0] = x.e = 0; + } + } else { + xc.length = i--; + if (more) { + for (; ++xc[i] > 9; ) { + xc[i] = 0; + if (!i--) { + ++x.e; + xc.unshift(1); + } + } + } + for (i = xc.length; !xc[--i]; ) xc.pop(); + } + } else if (rm < 0 || rm > 3 || rm !== ~~rm) { + throw Error(INVALID_RM); + } + return x; + } + function stringify(x, id, n, k) { + var e, s, Big2 = x.constructor, z = !x.c[0]; + if (n !== UNDEFINED) { + if (n !== ~~n || n < (id == 3) || n > MAX_DP) { + throw Error(id == 3 ? INVALID + "precision" : INVALID_DP); + } + x = new Big2(x); + n = k - x.e; + if (x.c.length > ++k) round(x, n, Big2.RM); + if (id == 2) k = x.e + n + 1; + for (; x.c.length < k; ) x.c.push(0); + } + e = x.e; + s = x.c.join(""); + n = s.length; + if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big2.NE || e >= Big2.PE)) { + s = s.charAt(0) + (n > 1 ? "." + s.slice(1) : "") + (e < 0 ? "e" : "e+") + e; + } else if (e < 0) { + for (; ++e; ) s = "0" + s; + s = "0." + s; + } else if (e > 0) { + if (++e > n) for (e -= n; e--; ) s += "0"; + else if (e < n) s = s.slice(0, e) + "." + s.slice(e); + } else if (n > 1) { + s = s.charAt(0) + "." + s.slice(1); + } + return x.s < 0 && (!z || id == 4) ? "-" + s : s; + } + P.abs = function() { + var x = new this.constructor(this); + x.s = 1; + return x; + }; + P.cmp = function(y) { + var isneg, x = this, xc = x.c, yc = (y = new x.constructor(y)).c, i = x.s, j = y.s, k = x.e, l = y.e; + if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i; + if (i != j) return i; + isneg = i < 0; + if (k != l) return k > l ^ isneg ? 1 : -1; + j = (k = xc.length) < (l = yc.length) ? k : l; + for (i = -1; ++i < j; ) { + if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1; + } + return k == l ? 0 : k > l ^ isneg ? 1 : -1; + }; + P.div = function(y) { + var x = this, Big2 = x.constructor, a = x.c, b = (y = new Big2(y)).c, k = x.s == y.s ? 1 : -1, dp = Big2.DP; + if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP); + if (!b[0]) throw Error(DIV_BY_ZERO); + if (!a[0]) return new Big2(k * 0); + var bl, bt, n, cmp, ri, bz = b.slice(), ai = bl = b.length, al = a.length, r = a.slice(0, bl), rl = r.length, q = y, qc = q.c = [], qi = 0, d = dp + (q.e = x.e - y.e) + 1; + q.s = k; + k = d < 0 ? 0 : d; + bz.unshift(0); + for (; rl++ < bl; ) r.push(0); + do { + for (n = 0; n < 10; n++) { + if (bl != (rl = r.length)) { + cmp = bl > rl ? 1 : -1; + } else { + for (ri = -1, cmp = 0; ++ri < bl; ) { + if (b[ri] != r[ri]) { + cmp = b[ri] > r[ri] ? 1 : -1; + break; + } + } + } + if (cmp < 0) { + for (bt = rl == bl ? b : bz; rl; ) { + if (r[--rl] < bt[rl]) { + ri = rl; + for (; ri && !r[--ri]; ) r[ri] = 9; + --r[ri]; + r[rl] += 10; + } + r[rl] -= bt[rl]; + } + for (; !r[0]; ) r.shift(); + } else { + break; + } + } + qc[qi++] = cmp ? n : ++n; + if (r[0] && cmp) r[rl] = a[ai] || 0; + else r = [a[ai]]; + } while ((ai++ < al || r[0] !== UNDEFINED) && k--); + if (!qc[0] && qi != 1) { + qc.shift(); + q.e--; + } + if (qi > d) round(q, dp, Big2.RM, r[0] !== UNDEFINED); + return q; + }; + P.eq = function(y) { + return !this.cmp(y); + }; + P.gt = function(y) { + return this.cmp(y) > 0; + }; + P.gte = function(y) { + return this.cmp(y) > -1; + }; + P.lt = function(y) { + return this.cmp(y) < 0; + }; + P.lte = function(y) { + return this.cmp(y) < 1; + }; + P.minus = P.sub = function(y) { + var i, j, t, xlty, x = this, Big2 = x.constructor, a = x.s, b = (y = new Big2(y)).s; + if (a != b) { + y.s = -b; + return x.plus(y); + } + var xc = x.c.slice(), xe = x.e, yc = y.c, ye = y.e; + if (!xc[0] || !yc[0]) { + return yc[0] ? (y.s = -b, y) : new Big2(xc[0] ? x : 0); + } + if (a = xe - ye) { + if (xlty = a < 0) { + a = -a; + t = xc; + } else { + ye = xe; + t = yc; + } + t.reverse(); + for (b = a; b--; ) t.push(0); + t.reverse(); + } else { + j = ((xlty = xc.length < yc.length) ? xc : yc).length; + for (a = b = 0; b < j; b++) { + if (xc[b] != yc[b]) { + xlty = xc[b] < yc[b]; + break; + } + } + } + if (xlty) { + t = xc; + xc = yc; + yc = t; + y.s = -y.s; + } + if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--; ) xc[i++] = 0; + for (b = i; j > a; ) { + if (xc[--j] < yc[j]) { + for (i = j; i && !xc[--i]; ) xc[i] = 9; + --xc[i]; + xc[j] += 10; + } + xc[j] -= yc[j]; + } + for (; xc[--b] === 0; ) xc.pop(); + for (; xc[0] === 0; ) { + xc.shift(); + --ye; + } + if (!xc[0]) { + y.s = 1; + xc = [ye = 0]; + } + y.c = xc; + y.e = ye; + return y; + }; + P.mod = function(y) { + var ygtx, x = this, Big2 = x.constructor, a = x.s, b = (y = new Big2(y)).s; + if (!y.c[0]) throw Error(DIV_BY_ZERO); + x.s = y.s = 1; + ygtx = y.cmp(x) == 1; + x.s = a; + y.s = b; + if (ygtx) return new Big2(x); + a = Big2.DP; + b = Big2.RM; + Big2.DP = Big2.RM = 0; + x = x.div(y); + Big2.DP = a; + Big2.RM = b; + return this.minus(x.times(y)); + }; + P.plus = P.add = function(y) { + var t, x = this, Big2 = x.constructor, a = x.s, b = (y = new Big2(y)).s; + if (a != b) { + y.s = -b; + return x.minus(y); + } + var xe = x.e, xc = x.c, ye = y.e, yc = y.c; + if (!xc[0] || !yc[0]) return yc[0] ? y : new Big2(xc[0] ? x : a * 0); + xc = xc.slice(); + if (a = xe - ye) { + if (a > 0) { + ye = xe; + t = yc; + } else { + a = -a; + t = xc; + } + t.reverse(); + for (; a--; ) t.push(0); + t.reverse(); + } + if (xc.length - yc.length < 0) { + t = yc; + yc = xc; + xc = t; + } + a = yc.length; + for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0; + if (b) { + xc.unshift(b); + ++ye; + } + for (a = xc.length; xc[--a] === 0; ) xc.pop(); + y.c = xc; + y.e = ye; + return y; + }; + P.pow = function(n) { + var x = this, one = new x.constructor(1), y = one, isneg = n < 0; + if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + "exponent"); + if (isneg) n = -n; + for (; ; ) { + if (n & 1) y = y.times(x); + n >>= 1; + if (!n) break; + x = x.times(x); + } + return isneg ? one.div(y) : y; + }; + P.round = function(dp, rm) { + var Big2 = this.constructor; + if (dp === UNDEFINED) dp = 0; + else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP); + return round(new Big2(this), dp, rm === UNDEFINED ? Big2.RM : rm); + }; + P.sqrt = function() { + var r, c, t, x = this, Big2 = x.constructor, s = x.s, e = x.e, half = new Big2(0.5); + if (!x.c[0]) return new Big2(x); + if (s < 0) throw Error(NAME + "No square root"); + s = Math.sqrt(x + ""); + if (s === 0 || s === 1 / 0) { + c = x.c.join(""); + if (!(c.length + e & 1)) c += "0"; + s = Math.sqrt(c); + e = ((e + 1) / 2 | 0) - (e < 0 || e & 1); + r = new Big2((s == 1 / 0 ? "1e" : (s = s.toExponential()).slice(0, s.indexOf("e") + 1)) + e); + } else { + r = new Big2(s); + } + e = r.e + (Big2.DP += 4); + do { + t = r; + r = half.times(t.plus(x.div(t))); + } while (t.c.slice(0, e).join("") !== r.c.slice(0, e).join("")); + return round(r, Big2.DP -= 4, Big2.RM); + }; + P.times = P.mul = function(y) { + var c, x = this, Big2 = x.constructor, xc = x.c, yc = (y = new Big2(y)).c, a = xc.length, b = yc.length, i = x.e, j = y.e; + y.s = x.s == y.s ? 1 : -1; + if (!xc[0] || !yc[0]) return new Big2(y.s * 0); + y.e = i + j; + if (a < b) { + c = xc; + xc = yc; + yc = c; + j = a; + a = b; + b = j; + } + for (c = new Array(j = a + b); j--; ) c[j] = 0; + for (i = b; i--; ) { + b = 0; + for (j = a + i; j > i; ) { + b = c[j] + yc[i] * xc[j - i - 1] + b; + c[j--] = b % 10; + b = b / 10 | 0; + } + c[j] = (c[j] + b) % 10; + } + if (b) ++y.e; + else c.shift(); + for (i = c.length; !c[--i]; ) c.pop(); + y.c = c; + return y; + }; + P.toExponential = function(dp) { + return stringify(this, 1, dp, dp); + }; + P.toFixed = function(dp) { + return stringify(this, 2, dp, this.e + dp); + }; + P.toPrecision = function(sd) { + return stringify(this, 3, sd, sd - 1); + }; + P.toString = function() { + return stringify(this); + }; + P.valueOf = P.toJSON = function() { + return stringify(this, 4); + }; + Big = _Big_(); + Big["default"] = Big.Big = Big; + if (typeof define === "function" && define.amd) { + define(function() { + return Big; + }); + } else if (typeof module2 !== "undefined" && module2.exports) { + module2.exports = Big; + } else { + GLOBAL.Big = Big; + } + })(exports2); + } +}); + +// node_modules/toformat/toFormat.js +var require_toFormat = __commonJS({ + "node_modules/toformat/toFormat.js"(exports2, module2) { + function toFormat(Ctor) { + "use strict"; + Ctor.prototype.toFormat = function toFormat2(dp, rm, fmt) { + if (!this.e && this.e !== 0) return this.toString(); + var arr, g1, g2, i, u, nd, intd, intp, fracp, dsep, gsep, gsize, sgsize, fgsep, fgsize, tfmt = this.format || {}, cfmt = this.constructor.format || {}; + if (dp != u) { + if (typeof dp == "object") { + fmt = dp; + dp = u; + } else if (rm != u) { + if (typeof rm == "object") { + fmt = rm; + rm = u; + } else if (typeof fmt != "object") { + fmt = {}; + } + } else { + fmt = {}; + } + } else { + fmt = {}; + } + arr = this.toFixed(dp, rm).split("."); + intp = arr[0]; + fracp = arr[1]; + intd = this.s < 0 ? intp.slice(1) : intp; + nd = intd.length; + dsep = fmt.decimalSeparator; + if (dsep == u) { + dsep = tfmt.decimalSeparator; + if (dsep == u) { + dsep = cfmt.decimalSeparator; + if (dsep == u) dsep = "."; + } + } + gsep = fmt.groupSeparator; + if (gsep == u) { + gsep = tfmt.groupSeparator; + if (gsep == u) gsep = cfmt.groupSeparator; + } + if (gsep) { + gsize = fmt.groupSize; + if (gsize == u) { + gsize = tfmt.groupSize; + if (gsize == u) { + gsize = cfmt.groupSize; + if (gsize == u) gsize = 0; + } + } + sgsize = fmt.secondaryGroupSize; + if (sgsize == u) { + sgsize = tfmt.secondaryGroupSize; + if (sgsize == u) { + sgsize = cfmt.secondaryGroupSize; + if (sgsize == u) sgsize = 0; + } + } + if (sgsize) { + g1 = +sgsize; + g2 = +gsize; + nd -= g2; + } else { + g1 = +gsize; + g2 = +sgsize; + } + if (g1 > 0 && nd > 0) { + i = nd % g1 || g1; + intp = intd.substr(0, i); + for (; i < nd; i += g1) intp += gsep + intd.substr(i, g1); + if (g2 > 0) intp += gsep + intd.slice(i); + if (this.s < 0) intp = "-" + intp; + } + } + if (fracp) { + fgsep = fmt.fractionGroupSeparator; + if (fgsep == u) { + fgsep = tfmt.fractionGroupSeparator; + if (fgsep == u) fgsep = cfmt.fractionGroupSeparator; + } + if (fgsep) { + fgsize = fmt.fractionGroupSize; + if (fgsize == u) { + fgsize = tfmt.fractionGroupSize; + if (fgsize == u) { + fgsize = cfmt.fractionGroupSize; + if (fgsize == u) fgsize = 0; + } + } + fgsize = +fgsize; + if (fgsize) { + fracp = fracp.replace(new RegExp("\\d{" + fgsize + "}\\B", "g"), "$&" + fgsep); + } + } + return intp + dsep + fracp; + } else { + return intp; + } + }; + Ctor.format = { + decimalSeparator: ".", + groupSeparator: ",", + groupSize: 3, + secondaryGroupSize: 0, + fractionGroupSeparator: "", + fractionGroupSize: 0 + }; + return Ctor; + } + if (typeof module2 !== "undefined" && module2.exports) module2.exports = toFormat; + } +}); + +// node_modules/@uniswap/sdk-core/dist/sdk-core.cjs.production.min.js +var require_sdk_core_cjs_production_min = __commonJS({ + "node_modules/@uniswap/sdk-core/dist/sdk-core.cjs.production.min.js"(exports2) { + "use strict"; + function e(e2) { + return e2 && "object" == typeof e2 && "default" in e2 ? e2.default : e2; + } + Object.defineProperty(exports2, "__esModule", { value: true }); + var r; + var t = e(require_jsbi_cjs()); + var n = e(require_tiny_invariant_cjs()); + var d = e(require_decimal2()); + var o = e(require_big()); + var a = e(require_toFormat()); + var i = require_lib3(); + var s = require_lib7(); + function c(e2) { + var r2 = function(e3, r3) { + if ("object" != typeof e3 || !e3) return e3; + var t2 = e3[Symbol.toPrimitive]; + if (void 0 !== t2) { + var n2 = t2.call(e3, "string"); + if ("object" != typeof n2) return n2; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return String(e3); + }(e2); + return "symbol" == typeof r2 ? r2 : String(r2); + } + function A(e2, r2) { + for (var t2 = 0; t2 < r2.length; t2++) { + var n2 = r2[t2]; + n2.enumerable = n2.enumerable || false, n2.configurable = true, "value" in n2 && (n2.writable = true), Object.defineProperty(e2, c(n2.key), n2); + } + } + function u(e2, r2, t2) { + return r2 && A(e2.prototype, r2), t2 && A(e2, t2), Object.defineProperty(e2, "prototype", { writable: false }), e2; + } + function f() { + return (f = Object.assign ? Object.assign.bind() : function(e2) { + for (var r2 = 1; r2 < arguments.length; r2++) { + var t2 = arguments[r2]; + for (var n2 in t2) Object.prototype.hasOwnProperty.call(t2, n2) && (e2[n2] = t2[n2]); + } + return e2; + }).apply(this, arguments); + } + function E(e2, r2) { + var t2, n2; + e2.prototype = Object.create(r2.prototype), e2.prototype.constructor = e2, t2 = e2, n2 = r2, (Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e3, r3) { + return e3.__proto__ = r3, e3; + })(t2, n2); + } + (r = exports2.ChainId || (exports2.ChainId = {}))[r.MAINNET = 1] = "MAINNET", r[r.GOERLI = 5] = "GOERLI", r[r.SEPOLIA = 11155111] = "SEPOLIA", r[r.OPTIMISM = 10] = "OPTIMISM", r[r.OPTIMISM_GOERLI = 420] = "OPTIMISM_GOERLI", r[r.OPTIMISM_SEPOLIA = 11155420] = "OPTIMISM_SEPOLIA", r[r.ARBITRUM_ONE = 42161] = "ARBITRUM_ONE", r[r.ARBITRUM_GOERLI = 421613] = "ARBITRUM_GOERLI", r[r.ARBITRUM_SEPOLIA = 421614] = "ARBITRUM_SEPOLIA", r[r.POLYGON = 137] = "POLYGON", r[r.POLYGON_MUMBAI = 80001] = "POLYGON_MUMBAI", r[r.CELO = 42220] = "CELO", r[r.CELO_ALFAJORES = 44787] = "CELO_ALFAJORES", r[r.GNOSIS = 100] = "GNOSIS", r[r.MOONBEAM = 1284] = "MOONBEAM", r[r.BNB = 56] = "BNB", r[r.AVALANCHE = 43114] = "AVALANCHE", r[r.BASE_GOERLI = 84531] = "BASE_GOERLI", r[r.BASE = 8453] = "BASE", r[r.ZORA = 7777777] = "ZORA", r[r.ZORA_SEPOLIA = 999999999] = "ZORA_SEPOLIA", r[r.ROOTSTOCK = 30] = "ROOTSTOCK", r[r.BLAST = 81457] = "BLAST"; + var C; + var p; + var x; + var b; + var D; + var l; + var B; + var h; + var I; + var F = [exports2.ChainId.MAINNET, exports2.ChainId.OPTIMISM, exports2.ChainId.OPTIMISM_GOERLI, exports2.ChainId.OPTIMISM_SEPOLIA, exports2.ChainId.ARBITRUM_ONE, exports2.ChainId.ARBITRUM_GOERLI, exports2.ChainId.ARBITRUM_SEPOLIA, exports2.ChainId.POLYGON, exports2.ChainId.POLYGON_MUMBAI, exports2.ChainId.GOERLI, exports2.ChainId.SEPOLIA, exports2.ChainId.CELO_ALFAJORES, exports2.ChainId.CELO, exports2.ChainId.BNB, exports2.ChainId.AVALANCHE, exports2.ChainId.BASE, exports2.ChainId.BASE_GOERLI, exports2.ChainId.ZORA, exports2.ChainId.ZORA_SEPOLIA, exports2.ChainId.ROOTSTOCK, exports2.ChainId.BLAST]; + (C = exports2.NativeCurrencyName || (exports2.NativeCurrencyName = {})).ETHER = "ETH", C.MATIC = "MATIC", C.CELO = "CELO", C.GNOSIS = "XDAI", C.MOONBEAM = "GLMR", C.BNB = "BNB", C.AVAX = "AVAX", C.ROOTSTOCK = "RBTC"; + var O = [exports2.ChainId.MAINNET, exports2.ChainId.GOERLI, exports2.ChainId.SEPOLIA]; + function m(e2, r2) { + return void 0 === r2 && (r2 = []), O.concat(r2).reduce(function(r3, t2) { + return r3[t2] = e2, r3; + }, {}); + } + var R; + var S; + var y = m("0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", [exports2.ChainId.OPTIMISM, exports2.ChainId.ARBITRUM_ONE, exports2.ChainId.POLYGON, exports2.ChainId.POLYGON_MUMBAI, exports2.ChainId.SEPOLIA]); + var v = ((p = {})[exports2.ChainId.MAINNET] = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", p[exports2.ChainId.GOERLI] = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", p[exports2.ChainId.SEPOLIA] = "0xB7f907f7A9eBC822a80BD25E224be42Ce0A698A0", p[exports2.ChainId.OPTIMISM] = "0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf", p[exports2.ChainId.ARBITRUM_ONE] = "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9", p[exports2.ChainId.AVALANCHE] = "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", p[exports2.ChainId.BASE] = "0x8909dc15e40173ff4699343b6eb8132c65e18ec6", p[exports2.ChainId.BNB] = "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", p[exports2.ChainId.POLYGON] = "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", p[exports2.ChainId.CELO] = "0x79a530c8e2fA8748B7B40dd3629C0520c2cCf03f", p[exports2.ChainId.BLAST] = "0x5C346464d33F90bABaf70dB6388507CC889C1070", p); + var _ = ((x = {})[exports2.ChainId.MAINNET] = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", x[exports2.ChainId.GOERLI] = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", x[exports2.ChainId.ARBITRUM_ONE] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", x[exports2.ChainId.OPTIMISM] = "0x4a7b5da61326a6379179b40d00f57e5bbdc962c2", x[exports2.ChainId.BASE] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", x[exports2.ChainId.AVALANCHE] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", x[exports2.ChainId.BNB] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", x[exports2.ChainId.POLYGON] = "0xedf6066a2b290c185783862c7f4776a2c8077ad1", x[exports2.ChainId.BLAST] = "0xBB66Eb1c5e875933D44DAe661dbD80e5D9B03035", x); + var T = { v3CoreFactoryAddress: "0x1F98431c8aD98523631AE4a59f267346ea31F984", multicallAddress: "0x1F98415757620B543A52E61c46B32eB19261F984", quoterAddress: "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6", v3MigratorAddress: "0xA5644E29708357803b5A882D272c41cC0dF92B34", nonfungiblePositionManagerAddress: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" }; + var g = f({}, T, { mixedRouteQuoterV1Address: "0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E" }); + var N = f({}, T, { mixedRouteQuoterV1Address: "0xBa60b6e6fF25488308789E6e0A65D838be34194e" }); + var M = T; + var L = f({}, T, { multicallAddress: "0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB", tickLensAddress: "0xbfd8137f7d1516D3ea5cA83523914859ec47F573" }); + var P = T; + var w = { v3CoreFactoryAddress: "0xAfE208a311B21f13EF87E33A90049fC17A7acDEc", multicallAddress: "0x633987602DE5C4F337e3DbF265303A1080324204", quoterAddress: "0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8", v3MigratorAddress: "0x3cFd4d48EDfDCC53D3f173F596f621064614C582", nonfungiblePositionManagerAddress: "0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A", tickLensAddress: "0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D" }; + var U = ((b = {})[exports2.ChainId.MAINNET] = g, b[exports2.ChainId.OPTIMISM] = M, b[exports2.ChainId.ARBITRUM_ONE] = L, b[exports2.ChainId.POLYGON] = P, b[exports2.ChainId.POLYGON_MUMBAI] = P, b[exports2.ChainId.GOERLI] = N, b[exports2.ChainId.CELO] = w, b[exports2.ChainId.CELO_ALFAJORES] = w, b[exports2.ChainId.BNB] = { v3CoreFactoryAddress: "0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7", multicallAddress: "0x963Df249eD09c358A4819E39d9Cd5736c3087184", quoterAddress: "0x78D78E420Da98ad378D7799bE8f4AF69033EB077", v3MigratorAddress: "0x32681814957e0C13117ddc0c2aba232b5c9e760f", nonfungiblePositionManagerAddress: "0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613", tickLensAddress: "0xD9270014D396281579760619CCf4c3af0501A47C", swapRouter02Address: "0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2" }, b[exports2.ChainId.OPTIMISM_GOERLI] = { v3CoreFactoryAddress: "0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10", multicallAddress: "0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd", quoterAddress: "0x9569CbA925c8ca2248772A9A4976A516743A246F", v3MigratorAddress: "0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8", nonfungiblePositionManagerAddress: "0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6", tickLensAddress: "0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e" }, b[exports2.ChainId.OPTIMISM_SEPOLIA] = { v3CoreFactoryAddress: "0x8CE191193D15ea94e11d327b4c7ad8bbE520f6aF", multicallAddress: "0x80e4e06841bb76AA9735E0448cB8d003C0EF009a", quoterAddress: "0x0FBEa6cf957d95ee9313490050F6A0DA68039404", v3MigratorAddress: "0xE7EcbAAaA54D007A00dbb6c1d2f150066D69dA07", nonfungiblePositionManagerAddress: "0xdA75cEf1C93078e8b736FCA5D5a30adb97C8957d", tickLensAddress: "0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5", swapRouter02Address: "0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4" }, b[exports2.ChainId.ARBITRUM_GOERLI] = { v3CoreFactoryAddress: "0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6", multicallAddress: "0x8260CB40247290317a4c062F3542622367F206Ee", quoterAddress: "0x1dd92b83591781D0C6d98d07391eea4b9a6008FA", v3MigratorAddress: "0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3", nonfungiblePositionManagerAddress: "0x622e4726a167799826d1E1D150b076A7725f5D81", tickLensAddress: "0xb52429333da969a0C79a60930a4Bf0020E5D1DE8" }, b[exports2.ChainId.ARBITRUM_SEPOLIA] = { v3CoreFactoryAddress: "0x248AB79Bbb9bC29bB72f7Cd42F17e054Fc40188e", multicallAddress: "0x2B718b475e385eD29F56775a66aAB1F5cC6B2A0A", quoterAddress: "0x2779a0CC1c3e0E44D2542EC3e79e3864Ae93Ef0B", v3MigratorAddress: "0x398f43ef2c67B941147157DA1c5a868E906E043D", nonfungiblePositionManagerAddress: "0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65", tickLensAddress: "0x0fd18587734e5C2dcE2dccDcC7DD1EC89ba557d9", swapRouter02Address: "0x101F443B4d1b059569D643917553c771E1b9663E" }, b[exports2.ChainId.SEPOLIA] = { v3CoreFactoryAddress: "0x0227628f3F023bb0B980b67D528571c95c6DaC1c", multicallAddress: "0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07", quoterAddress: "0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3", v3MigratorAddress: "0x729004182cF005CEC8Bd85df140094b6aCbe8b15", nonfungiblePositionManagerAddress: "0x1238536071E1c677A632429e3655c799b22cDA52", tickLensAddress: "0xd7f33bcdb21b359c8ee6f0251d30e94832baad07", swapRouter02Address: "0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E" }, b[exports2.ChainId.AVALANCHE] = { v3CoreFactoryAddress: "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", multicallAddress: "0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2", quoterAddress: "0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F", v3MigratorAddress: "0x44f5f1f5E452ea8d29C890E8F6e893fC0f1f0f97", nonfungiblePositionManagerAddress: "0x655C406EBFa14EE2006250925e54ec43AD184f8B", tickLensAddress: "0xEB9fFC8bf81b4fFd11fb6A63a6B0f098c6e21950", swapRouter02Address: "0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE" }, b[exports2.ChainId.BASE] = { v3CoreFactoryAddress: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD", multicallAddress: "0x091e99cb1C49331a94dD62755D168E941AbD0693", quoterAddress: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a", v3MigratorAddress: "0x23cF10b1ee3AdfCA73B0eF17C07F7577e7ACd2d7", nonfungiblePositionManagerAddress: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1", tickLensAddress: "0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d", swapRouter02Address: "0x2626664c2603336E57B271c5C0b26F421741e481", mixedRouteQuoterV1Address: "0xe544efae946f0008ae9a8d64493efa7886b73776" }, b[exports2.ChainId.BASE_GOERLI] = { v3CoreFactoryAddress: "0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2", multicallAddress: "0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439", quoterAddress: "0xedf539058e28E5937dAef3f69cEd0b25fbE66Ae9", v3MigratorAddress: "0x3efe5d02a04b7351D671Db7008ec6eBA9AD9e3aE", nonfungiblePositionManagerAddress: "0x3c61369ef0D1D2AFa70d8feC2F31C5D6Ce134F30", tickLensAddress: "0x1acB873Ee909D0c98adB18e4474943249F931b92", swapRouter02Address: "0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d" }, b[exports2.ChainId.ZORA] = { v3CoreFactoryAddress: "0x7145F8aeef1f6510E92164038E1B6F8cB2c42Cbb", multicallAddress: "0xA51c76bEE6746cB487a7e9312E43e2b8f4A37C15", quoterAddress: "0x11867e1b3348F3ce4FcC170BC5af3d23E07E64Df", v3MigratorAddress: "0x048352d8dCF13686982C799da63fA6426a9D0b60", nonfungiblePositionManagerAddress: "0xbC91e8DfA3fF18De43853372A3d7dfe585137D78", tickLensAddress: "0x209AAda09D74Ad3B8D0E92910Eaf85D2357e3044", swapRouter02Address: "0x7De04c96BE5159c3b5CeffC82aa176dc81281557" }, b[exports2.ChainId.ZORA_SEPOLIA] = { v3CoreFactoryAddress: "0x4324A677D74764f46f33ED447964252441aA8Db6", multicallAddress: "0xA1E7e3A69671C4494EC59Dbd442de930a93F911A", quoterAddress: "0xC195976fEF0985886E37036E2DF62bF371E12Df0", v3MigratorAddress: "0x65ef259b31bf1d977c37e9434658694267674897", nonfungiblePositionManagerAddress: "0xB8458EaAe43292e3c1F7994EFd016bd653d23c20", tickLensAddress: "0x23C0F71877a1Fc4e20A78018f9831365c85f3064" }, b[exports2.ChainId.ROOTSTOCK] = { v3CoreFactoryAddress: "0xaF37EC98A00FD63689CF3060BF3B6784E00caD82", multicallAddress: "0x996a9858cDfa45Ad68E47c9A30a7201E29c6a386", quoterAddress: "0xb51727c996C68E60F598A923a5006853cd2fEB31", v3MigratorAddress: "0x16678977CA4ec3DAD5efc7b15780295FE5f56162", nonfungiblePositionManagerAddress: "0x9d9386c042F194B460Ec424a1e57ACDE25f5C4b1", tickLensAddress: "0x55B9dF5bF68ADe972191a91980459f48ecA16afC", swapRouter02Address: "0x0B14ff67f0014046b4b99057Aec4509640b3947A" }, b[exports2.ChainId.BLAST] = { v3CoreFactoryAddress: "0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd", multicallAddress: "0xdC7f370de7631cE9e2c2e1DCDA6B3B5744Cf4705", quoterAddress: "0x6Cdcd65e03c1CEc3730AeeCd45bc140D57A25C77", v3MigratorAddress: "0x15CA7043CD84C5D21Ae76Ba0A1A967d42c40ecE0", nonfungiblePositionManagerAddress: "0xB218e4f7cF0533d4696fDfC419A0023D33345F28", tickLensAddress: "0x2E95185bCdD928a3e984B7e2D6560Ab1b17d7274", swapRouter02Address: "0x549FEB8c9bd4c12Ad2AB27022dA12492aC452B66" }, b); + var q = f({}, F.reduce(function(e2, r2) { + return e2[r2] = U[r2].v3CoreFactoryAddress, e2; + }, {})); + var G = f({}, F.reduce(function(e2, r2) { + var t2 = U[r2].v3MigratorAddress; + return t2 && (e2[r2] = t2), e2; + }, {})); + var W = f({}, F.reduce(function(e2, r2) { + return e2[r2] = U[r2].multicallAddress, e2; + }, {})); + var H = m("0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F"); + var k = ((D = {})[exports2.ChainId.MAINNET] = "0xC4e172459f1E7939D522503B81AFAaC1014CE6F6", D); + var V = ((l = {})[exports2.ChainId.MAINNET] = "0x408ED6354d4973f66138C91495F2f2FCbd8724C3", l); + var j = m("0x1a9C8182C09F50C8318d769245beA52c32BE35BC"); + var Y = ((B = {})[exports2.ChainId.MAINNET] = "0x090D4613473dEE047c3f2706764f49E0821D256e", B); + var X = ((h = {})[exports2.ChainId.MAINNET] = "0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8", h); + var K = f({}, F.reduce(function(e2, r2) { + return e2[r2] = U[r2].quoterAddress, e2; + }, {})); + var Z = f({}, F.reduce(function(e2, r2) { + var t2 = U[r2].nonfungiblePositionManagerAddress; + return t2 && (e2[r2] = t2), e2; + }, {})); + var Q = f({}, m("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e")); + var J = ((I = {})[exports2.ChainId.MAINNET] = "0x65770b5283117639760beA3F867b69b3697a91dd", I); + var $ = f({}, F.reduce(function(e2, r2) { + var t2 = U[r2].tickLensAddress; + return t2 && (e2[r2] = t2), e2; + }, {})); + var z = F.reduce(function(e2, r2) { + var t2 = U[r2].mixedRouteQuoterV1Address; + return t2 && (e2[r2] = t2), e2; + }, {}); + (R = exports2.TradeType || (exports2.TradeType = {}))[R.EXACT_INPUT = 0] = "EXACT_INPUT", R[R.EXACT_OUTPUT = 1] = "EXACT_OUTPUT", (S = exports2.Rounding || (exports2.Rounding = {}))[S.ROUND_DOWN = 0] = "ROUND_DOWN", S[S.ROUND_HALF_UP = 1] = "ROUND_HALF_UP", S[S.ROUND_UP = 2] = "ROUND_UP"; + var ee; + var re; + var te = t.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + var ne = a(d); + var de = a(o); + var oe = ((ee = {})[exports2.Rounding.ROUND_DOWN] = ne.ROUND_DOWN, ee[exports2.Rounding.ROUND_HALF_UP] = ne.ROUND_HALF_UP, ee[exports2.Rounding.ROUND_UP] = ne.ROUND_UP, ee); + var ae = ((re = {})[exports2.Rounding.ROUND_DOWN] = 0, re[exports2.Rounding.ROUND_HALF_UP] = 1, re[exports2.Rounding.ROUND_UP] = 3, re); + var ie = function() { + function e2(e3, r3) { + void 0 === r3 && (r3 = t.BigInt(1)), this.numerator = t.BigInt(e3), this.denominator = t.BigInt(r3); + } + e2.tryParseFraction = function(r3) { + if (r3 instanceof t || "number" == typeof r3 || "string" == typeof r3) return new e2(r3); + if ("numerator" in r3 && "denominator" in r3) return r3; + throw new Error("Could not parse fraction"); + }; + var r2 = e2.prototype; + return r2.invert = function() { + return new e2(this.denominator, this.numerator); + }, r2.add = function(r3) { + var n2 = e2.tryParseFraction(r3); + return t.equal(this.denominator, n2.denominator) ? new e2(t.add(this.numerator, n2.numerator), this.denominator) : new e2(t.add(t.multiply(this.numerator, n2.denominator), t.multiply(n2.numerator, this.denominator)), t.multiply(this.denominator, n2.denominator)); + }, r2.subtract = function(r3) { + var n2 = e2.tryParseFraction(r3); + return t.equal(this.denominator, n2.denominator) ? new e2(t.subtract(this.numerator, n2.numerator), this.denominator) : new e2(t.subtract(t.multiply(this.numerator, n2.denominator), t.multiply(n2.numerator, this.denominator)), t.multiply(this.denominator, n2.denominator)); + }, r2.lessThan = function(r3) { + var n2 = e2.tryParseFraction(r3); + return t.lessThan(t.multiply(this.numerator, n2.denominator), t.multiply(n2.numerator, this.denominator)); + }, r2.equalTo = function(r3) { + var n2 = e2.tryParseFraction(r3); + return t.equal(t.multiply(this.numerator, n2.denominator), t.multiply(n2.numerator, this.denominator)); + }, r2.greaterThan = function(r3) { + var n2 = e2.tryParseFraction(r3); + return t.greaterThan(t.multiply(this.numerator, n2.denominator), t.multiply(n2.numerator, this.denominator)); + }, r2.multiply = function(r3) { + var n2 = e2.tryParseFraction(r3); + return new e2(t.multiply(this.numerator, n2.numerator), t.multiply(this.denominator, n2.denominator)); + }, r2.divide = function(r3) { + var n2 = e2.tryParseFraction(r3); + return new e2(t.multiply(this.numerator, n2.denominator), t.multiply(this.denominator, n2.numerator)); + }, r2.toSignificant = function(e3, r3, t2) { + void 0 === r3 && (r3 = { groupSeparator: "" }), void 0 === t2 && (t2 = exports2.Rounding.ROUND_HALF_UP), Number.isInteger(e3) || n(false), e3 > 0 || n(false), ne.set({ precision: e3 + 1, rounding: oe[t2] }); + var d2 = new ne(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(e3); + return d2.toFormat(d2.decimalPlaces(), r3); + }, r2.toFixed = function(e3, r3, t2) { + return void 0 === r3 && (r3 = { groupSeparator: "" }), void 0 === t2 && (t2 = exports2.Rounding.ROUND_HALF_UP), Number.isInteger(e3) || n(false), e3 >= 0 || n(false), de.DP = e3, de.RM = ae[t2], new de(this.numerator.toString()).div(this.denominator.toString()).toFormat(e3, r3); + }, u(e2, [{ key: "quotient", get: function() { + return t.divide(this.numerator, this.denominator); + } }, { key: "remainder", get: function() { + return new e2(t.remainder(this.numerator, this.denominator), this.denominator); + } }, { key: "asFraction", get: function() { + return new e2(this.numerator, this.denominator); + } }]), e2; + }(); + var se = a(o); + var ce = function(e2) { + function r2(r3, d3, o2) { + var a2; + return a2 = e2.call(this, d3, o2) || this, t.lessThanOrEqual(a2.quotient, te) || n(false), a2.currency = r3, a2.decimalScale = t.exponentiate(t.BigInt(10), t.BigInt(r3.decimals)), a2; + } + E(r2, e2), r2.fromRawAmount = function(e3, t2) { + return new r2(e3, t2); + }, r2.fromFractionalAmount = function(e3, t2, n2) { + return new r2(e3, t2, n2); + }; + var d2 = r2.prototype; + return d2.add = function(t2) { + this.currency.equals(t2.currency) || n(false); + var d3 = e2.prototype.add.call(this, t2); + return r2.fromFractionalAmount(this.currency, d3.numerator, d3.denominator); + }, d2.subtract = function(t2) { + this.currency.equals(t2.currency) || n(false); + var d3 = e2.prototype.subtract.call(this, t2); + return r2.fromFractionalAmount(this.currency, d3.numerator, d3.denominator); + }, d2.multiply = function(t2) { + var n2 = e2.prototype.multiply.call(this, t2); + return r2.fromFractionalAmount(this.currency, n2.numerator, n2.denominator); + }, d2.divide = function(t2) { + var n2 = e2.prototype.divide.call(this, t2); + return r2.fromFractionalAmount(this.currency, n2.numerator, n2.denominator); + }, d2.toSignificant = function(r3, t2, n2) { + return void 0 === r3 && (r3 = 6), void 0 === n2 && (n2 = exports2.Rounding.ROUND_DOWN), e2.prototype.divide.call(this, this.decimalScale).toSignificant(r3, t2, n2); + }, d2.toFixed = function(r3, t2, d3) { + return void 0 === r3 && (r3 = this.currency.decimals), void 0 === d3 && (d3 = exports2.Rounding.ROUND_DOWN), r3 <= this.currency.decimals || n(false), e2.prototype.divide.call(this, this.decimalScale).toFixed(r3, t2, d3); + }, d2.toExact = function(e3) { + return void 0 === e3 && (e3 = { groupSeparator: "" }), se.DP = this.currency.decimals, new se(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(e3); + }, u(r2, [{ key: "wrapped", get: function() { + return this.currency.isToken ? this : r2.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator); + } }]), r2; + }(ie); + var Ae = new ie(t.BigInt(100)); + function ue(e2) { + return new fe(e2.numerator, e2.denominator); + } + var fe = function(e2) { + function r2() { + var r3; + return (r3 = e2.apply(this, arguments) || this).isPercent = true, r3; + } + E(r2, e2); + var t2 = r2.prototype; + return t2.add = function(r3) { + return ue(e2.prototype.add.call(this, r3)); + }, t2.subtract = function(r3) { + return ue(e2.prototype.subtract.call(this, r3)); + }, t2.multiply = function(r3) { + return ue(e2.prototype.multiply.call(this, r3)); + }, t2.divide = function(r3) { + return ue(e2.prototype.divide.call(this, r3)); + }, t2.toSignificant = function(r3, t3, n2) { + return void 0 === r3 && (r3 = 5), e2.prototype.multiply.call(this, Ae).toSignificant(r3, t3, n2); + }, t2.toFixed = function(r3, t3, n2) { + return void 0 === r3 && (r3 = 2), e2.prototype.multiply.call(this, Ae).toFixed(r3, t3, n2); + }, r2; + }(ie); + var Ee = function(e2) { + function r2() { + for (var r3, n2, d3, o2, a2, i2 = arguments.length, s2 = new Array(i2), c2 = 0; c2 < i2; c2++) s2[c2] = arguments[c2]; + if (4 === s2.length) n2 = s2[0], d3 = s2[1], o2 = s2[2], a2 = s2[3]; + else { + var A2 = s2[0].quoteAmount.divide(s2[0].baseAmount), u2 = [s2[0].baseAmount.currency, s2[0].quoteAmount.currency, A2.denominator, A2.numerator]; + n2 = u2[0], d3 = u2[1], o2 = u2[2], a2 = u2[3]; + } + return (r3 = e2.call(this, a2, o2) || this).baseCurrency = n2, r3.quoteCurrency = d3, r3.scalar = new ie(t.exponentiate(t.BigInt(10), t.BigInt(n2.decimals)), t.exponentiate(t.BigInt(10), t.BigInt(d3.decimals))), r3; + } + E(r2, e2); + var d2 = r2.prototype; + return d2.invert = function() { + return new r2(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator); + }, d2.multiply = function(t2) { + this.quoteCurrency.equals(t2.baseCurrency) || n(false); + var d3 = e2.prototype.multiply.call(this, t2); + return new r2(this.baseCurrency, t2.quoteCurrency, d3.denominator, d3.numerator); + }, d2.quote = function(r3) { + r3.currency.equals(this.baseCurrency) || n(false); + var t2 = e2.prototype.multiply.call(this, r3); + return ce.fromFractionalAmount(this.quoteCurrency, t2.numerator, t2.denominator); + }, d2.toSignificant = function(e3, r3, t2) { + return void 0 === e3 && (e3 = 6), this.adjustedForDecimals.toSignificant(e3, r3, t2); + }, d2.toFixed = function(e3, r3, t2) { + return void 0 === e3 && (e3 = 4), this.adjustedForDecimals.toFixed(e3, r3, t2); + }, u(r2, [{ key: "adjustedForDecimals", get: function() { + return e2.prototype.multiply.call(this, this.scalar); + } }]), r2; + }(ie); + var Ce = function(e2, r2, t2, d2) { + Number.isSafeInteger(e2) || n(false), r2 >= 0 && r2 < 255 && Number.isInteger(r2) || n(false), this.chainId = e2, this.decimals = r2, this.symbol = t2, this.name = d2; + }; + var pe = function(e2) { + function r2() { + var r3; + return (r3 = e2.apply(this, arguments) || this).isNative = true, r3.isToken = false, r3; + } + return E(r2, e2), r2; + }(Ce); + function xe(e2) { + try { + return s.getAddress(e2); + } catch (r2) { + throw new Error(e2 + " is not a valid address."); + } + } + var be = /^0x[0-9a-fA-F]{40}$/; + var De = function(e2) { + function r2(r3, t3, d2, o2, a2, s2, c2, A2) { + var u2; + return (u2 = e2.call(this, r3, d2, o2, a2) || this).isNative = false, u2.isToken = true, u2.address = s2 ? function(e3) { + if (be.test(e3)) return e3; + throw new Error(e3 + " is not a valid address."); + }(t3) : xe(t3), c2 && (c2.gte(i.BigNumber.from(0)) || n(false)), A2 && (A2.gte(i.BigNumber.from(0)) || n(false)), u2.buyFeeBps = c2, u2.sellFeeBps = A2, u2; + } + E(r2, e2); + var t2 = r2.prototype; + return t2.equals = function(e3) { + return e3.isToken && this.chainId === e3.chainId && this.address.toLowerCase() === e3.address.toLowerCase(); + }, t2.sortsBefore = function(e3) { + return this.chainId !== e3.chainId && n(false), this.address.toLowerCase() === e3.address.toLowerCase() && n(false), this.address.toLowerCase() < e3.address.toLowerCase(); + }, u(r2, [{ key: "wrapped", get: function() { + return this; + } }]), r2; + }(Ce); + var le = { 1: new De(1, "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 18, "WETH", "Wrapped Ether"), 3: new De(3, "0xc778417E063141139Fce010982780140Aa0cD5Ab", 18, "WETH", "Wrapped Ether"), 4: new De(4, "0xc778417E063141139Fce010982780140Aa0cD5Ab", 18, "WETH", "Wrapped Ether"), 5: new De(5, "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", 18, "WETH", "Wrapped Ether"), 42: new De(42, "0xd0A1E359811322d97991E03f863a0C30C2cF029C", 18, "WETH", "Wrapped Ether"), 10: new De(10, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), 69: new De(69, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), 11155420: new De(11155420, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), 42161: new De(42161, "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", 18, "WETH", "Wrapped Ether"), 421611: new De(421611, "0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681", 18, "WETH", "Wrapped Ether"), 421614: new De(421614, "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73", 18, "WETH", "Wrapped Ether"), 8453: new De(8453, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), 56: new De(56, "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", 18, "WBNB", "Wrapped BNB"), 137: new De(137, "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", 18, "WMATIC", "Wrapped MATIC"), 43114: new De(43114, "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", 18, "WAVAX", "Wrapped AVAX") }; + var Be = function(e2) { + function r2(r3) { + return e2.call(this, r3, 18, "ETH", "Ether") || this; + } + return E(r2, e2), r2.onChain = function(e3) { + var t2; + return null != (t2 = this._etherCache[e3]) ? t2 : this._etherCache[e3] = new r2(e3); + }, r2.prototype.equals = function(e3) { + return e3.isNative && e3.chainId === this.chainId; + }, u(r2, [{ key: "wrapped", get: function() { + var e3 = le[this.chainId]; + return e3 || n(false), e3; + } }]), r2; + }(pe); + Be._etherCache = {}; + var he = t.BigInt(Number.MAX_SAFE_INTEGER); + var Ie = t.BigInt(0); + var Fe = t.BigInt(1); + var Oe = t.BigInt(2); + exports2.ARGENT_WALLET_DETECTOR_ADDRESS = X, exports2.CHAIN_TO_ADDRESSES_MAP = U, exports2.CurrencyAmount = ce, exports2.ENS_REGISTRAR_ADDRESSES = Q, exports2.Ether = Be, exports2.Fraction = ie, exports2.GOVERNANCE_ALPHA_V0_ADDRESSES = H, exports2.GOVERNANCE_ALPHA_V1_ADDRESSES = k, exports2.GOVERNANCE_BRAVO_ADDRESSES = V, exports2.MERKLE_DISTRIBUTOR_ADDRESS = Y, exports2.MIXED_ROUTE_QUOTER_V1_ADDRESSES = z, exports2.MULTICALL_ADDRESSES = W, exports2.MaxUint256 = te, exports2.NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = Z, exports2.NativeCurrency = pe, exports2.Percent = fe, exports2.Price = Ee, exports2.QUOTER_ADDRESSES = K, exports2.SOCKS_CONTROLLER_ADDRESSES = J, exports2.SUPPORTED_CHAINS = F, exports2.SWAP_ROUTER_02_ADDRESSES = function(e2) { + var r2; + return F.includes(e2) ? null != (r2 = U[e2].swapRouter02Address) ? r2 : "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45" : ""; + }, exports2.TICK_LENS_ADDRESSES = $, exports2.TIMELOCK_ADDRESSES = j, exports2.Token = De, exports2.UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS = "0x8B799381ac40b838BBA4131ffB26197C432AFe78", exports2.UNI_ADDRESSES = y, exports2.V2_FACTORY_ADDRESS = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", exports2.V2_FACTORY_ADDRESSES = v, exports2.V2_ROUTER_ADDRESS = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", exports2.V2_ROUTER_ADDRESSES = _, exports2.V3_CORE_FACTORY_ADDRESSES = q, exports2.V3_MIGRATOR_ADDRESSES = G, exports2.WETH9 = le, exports2.computePriceImpact = function(e2, r2, t2) { + var n2 = e2.quote(r2), d2 = n2.subtract(t2).divide(n2); + return new fe(d2.numerator, d2.denominator); + }, exports2.sortedInsert = function(e2, r2, t2, d2) { + if (t2 > 0 || n(false), e2.length <= t2 || n(false), 0 === e2.length) return e2.push(r2), null; + var o2 = e2.length === t2; + if (o2 && d2(e2[e2.length - 1], r2) <= 0) return r2; + for (var a2 = 0, i2 = e2.length; a2 < i2; ) { + var s2 = a2 + i2 >>> 1; + d2(e2[s2], r2) <= 0 ? a2 = s2 + 1 : i2 = s2; + } + return e2.splice(a2, 0, r2), o2 ? e2.pop() : null; + }, exports2.sqrt = function(e2) { + if (t.greaterThanOrEqual(e2, Ie) || n(false), t.lessThan(e2, he)) return t.BigInt(Math.floor(Math.sqrt(t.toNumber(e2)))); + var r2, d2; + for (r2 = e2, d2 = t.add(t.divide(e2, Oe), Fe); t.lessThan(d2, r2); ) r2 = d2, d2 = t.divide(t.add(t.divide(e2, d2), d2), Oe); + return r2; + }, exports2.validateAndParseAddress = xe; + } +}); + +// node_modules/@uniswap/sdk-core/dist/sdk-core.cjs.development.js +var require_sdk_core_cjs_development = __commonJS({ + "node_modules/@uniswap/sdk-core/dist/sdk-core.cjs.development.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + function _interopDefault(ex) { + return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex; + } + var JSBI3 = _interopDefault(require_jsbi_cjs()); + var invariant = _interopDefault(require_tiny_invariant_cjs()); + var _Decimal = _interopDefault(require_decimal2()); + var _Big = _interopDefault(require_big()); + var toFormat = _interopDefault(require_toFormat()); + var bignumber = require_lib3(); + var address = require_lib7(); + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : String(i); + } + 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, _toPropertyKey(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 _extends() { + _extends = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); + } + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + _setPrototypeOf(subClass, superClass); + } + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) { + o2.__proto__ = p2; + return o2; + }; + return _setPrototypeOf(o, p); + } + (function(ChainId) { + ChainId[ChainId["MAINNET"] = 1] = "MAINNET"; + ChainId[ChainId["GOERLI"] = 5] = "GOERLI"; + ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA"; + ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM"; + ChainId[ChainId["OPTIMISM_GOERLI"] = 420] = "OPTIMISM_GOERLI"; + ChainId[ChainId["OPTIMISM_SEPOLIA"] = 11155420] = "OPTIMISM_SEPOLIA"; + ChainId[ChainId["ARBITRUM_ONE"] = 42161] = "ARBITRUM_ONE"; + ChainId[ChainId["ARBITRUM_GOERLI"] = 421613] = "ARBITRUM_GOERLI"; + ChainId[ChainId["ARBITRUM_SEPOLIA"] = 421614] = "ARBITRUM_SEPOLIA"; + ChainId[ChainId["POLYGON"] = 137] = "POLYGON"; + ChainId[ChainId["POLYGON_MUMBAI"] = 80001] = "POLYGON_MUMBAI"; + ChainId[ChainId["CELO"] = 42220] = "CELO"; + ChainId[ChainId["CELO_ALFAJORES"] = 44787] = "CELO_ALFAJORES"; + ChainId[ChainId["GNOSIS"] = 100] = "GNOSIS"; + ChainId[ChainId["MOONBEAM"] = 1284] = "MOONBEAM"; + ChainId[ChainId["BNB"] = 56] = "BNB"; + ChainId[ChainId["AVALANCHE"] = 43114] = "AVALANCHE"; + ChainId[ChainId["BASE_GOERLI"] = 84531] = "BASE_GOERLI"; + ChainId[ChainId["BASE"] = 8453] = "BASE"; + ChainId[ChainId["ZORA"] = 7777777] = "ZORA"; + ChainId[ChainId["ZORA_SEPOLIA"] = 999999999] = "ZORA_SEPOLIA"; + ChainId[ChainId["ROOTSTOCK"] = 30] = "ROOTSTOCK"; + ChainId[ChainId["BLAST"] = 81457] = "BLAST"; + })(exports2.ChainId || (exports2.ChainId = {})); + var SUPPORTED_CHAINS = [exports2.ChainId.MAINNET, exports2.ChainId.OPTIMISM, exports2.ChainId.OPTIMISM_GOERLI, exports2.ChainId.OPTIMISM_SEPOLIA, exports2.ChainId.ARBITRUM_ONE, exports2.ChainId.ARBITRUM_GOERLI, exports2.ChainId.ARBITRUM_SEPOLIA, exports2.ChainId.POLYGON, exports2.ChainId.POLYGON_MUMBAI, exports2.ChainId.GOERLI, exports2.ChainId.SEPOLIA, exports2.ChainId.CELO_ALFAJORES, exports2.ChainId.CELO, exports2.ChainId.BNB, exports2.ChainId.AVALANCHE, exports2.ChainId.BASE, exports2.ChainId.BASE_GOERLI, exports2.ChainId.ZORA, exports2.ChainId.ZORA_SEPOLIA, exports2.ChainId.ROOTSTOCK, exports2.ChainId.BLAST]; + (function(NativeCurrencyName) { + NativeCurrencyName["ETHER"] = "ETH"; + NativeCurrencyName["MATIC"] = "MATIC"; + NativeCurrencyName["CELO"] = "CELO"; + NativeCurrencyName["GNOSIS"] = "XDAI"; + NativeCurrencyName["MOONBEAM"] = "GLMR"; + NativeCurrencyName["BNB"] = "BNB"; + NativeCurrencyName["AVAX"] = "AVAX"; + NativeCurrencyName["ROOTSTOCK"] = "RBTC"; + })(exports2.NativeCurrencyName || (exports2.NativeCurrencyName = {})); + var _V2_FACTORY_ADDRESSES; + var _V2_ROUTER_ADDRESSES; + var _CHAIN_TO_ADDRESSES_M; + var _GOVERNANCE_ALPHA_V1_; + var _GOVERNANCE_BRAVO_ADD; + var _MERKLE_DISTRIBUTOR_A; + var _ARGENT_WALLET_DETECT; + var _SOCKS_CONTROLLER_ADD; + var DEFAULT_NETWORKS = [exports2.ChainId.MAINNET, exports2.ChainId.GOERLI, exports2.ChainId.SEPOLIA]; + function constructSameAddressMap(address2, additionalNetworks) { + if (additionalNetworks === void 0) { + additionalNetworks = []; + } + return DEFAULT_NETWORKS.concat(additionalNetworks).reduce(function(memo, chainId) { + memo[chainId] = address2; + return memo; + }, {}); + } + var UNI_ADDRESSES = /* @__PURE__ */ constructSameAddressMap("0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984", [exports2.ChainId.OPTIMISM, exports2.ChainId.ARBITRUM_ONE, exports2.ChainId.POLYGON, exports2.ChainId.POLYGON_MUMBAI, exports2.ChainId.SEPOLIA]); + var UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS = "0x8B799381ac40b838BBA4131ffB26197C432AFe78"; + var V2_FACTORY_ADDRESS = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f"; + var V2_FACTORY_ADDRESSES = (_V2_FACTORY_ADDRESSES = {}, _V2_FACTORY_ADDRESSES[exports2.ChainId.MAINNET] = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", _V2_FACTORY_ADDRESSES[exports2.ChainId.GOERLI] = "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f", _V2_FACTORY_ADDRESSES[exports2.ChainId.SEPOLIA] = "0xB7f907f7A9eBC822a80BD25E224be42Ce0A698A0", _V2_FACTORY_ADDRESSES[exports2.ChainId.OPTIMISM] = "0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf", _V2_FACTORY_ADDRESSES[exports2.ChainId.ARBITRUM_ONE] = "0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9", _V2_FACTORY_ADDRESSES[exports2.ChainId.AVALANCHE] = "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", _V2_FACTORY_ADDRESSES[exports2.ChainId.BASE] = "0x8909dc15e40173ff4699343b6eb8132c65e18ec6", _V2_FACTORY_ADDRESSES[exports2.ChainId.BNB] = "0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6", _V2_FACTORY_ADDRESSES[exports2.ChainId.POLYGON] = "0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C", _V2_FACTORY_ADDRESSES[exports2.ChainId.CELO] = "0x79a530c8e2fA8748B7B40dd3629C0520c2cCf03f", _V2_FACTORY_ADDRESSES[exports2.ChainId.BLAST] = "0x5C346464d33F90bABaf70dB6388507CC889C1070", _V2_FACTORY_ADDRESSES); + var V2_ROUTER_ADDRESS = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"; + var V2_ROUTER_ADDRESSES = (_V2_ROUTER_ADDRESSES = {}, _V2_ROUTER_ADDRESSES[exports2.ChainId.MAINNET] = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", _V2_ROUTER_ADDRESSES[exports2.ChainId.GOERLI] = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D", _V2_ROUTER_ADDRESSES[exports2.ChainId.ARBITRUM_ONE] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", _V2_ROUTER_ADDRESSES[exports2.ChainId.OPTIMISM] = "0x4a7b5da61326a6379179b40d00f57e5bbdc962c2", _V2_ROUTER_ADDRESSES[exports2.ChainId.BASE] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", _V2_ROUTER_ADDRESSES[exports2.ChainId.AVALANCHE] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", _V2_ROUTER_ADDRESSES[exports2.ChainId.BNB] = "0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24", _V2_ROUTER_ADDRESSES[exports2.ChainId.POLYGON] = "0xedf6066a2b290c185783862c7f4776a2c8077ad1", _V2_ROUTER_ADDRESSES[exports2.ChainId.BLAST] = "0xBB66Eb1c5e875933D44DAe661dbD80e5D9B03035", _V2_ROUTER_ADDRESSES); + var DEFAULT_ADDRESSES = { + v3CoreFactoryAddress: "0x1F98431c8aD98523631AE4a59f267346ea31F984", + multicallAddress: "0x1F98415757620B543A52E61c46B32eB19261F984", + quoterAddress: "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6", + v3MigratorAddress: "0xA5644E29708357803b5A882D272c41cC0dF92B34", + nonfungiblePositionManagerAddress: "0xC36442b4a4522E871399CD717aBDD847Ab11FE88" + }; + var MAINNET_ADDRESSES = /* @__PURE__ */ _extends({}, DEFAULT_ADDRESSES, { + mixedRouteQuoterV1Address: "0x84E44095eeBfEC7793Cd7d5b57B7e401D7f1cA2E" + }); + var GOERLI_ADDRESSES = /* @__PURE__ */ _extends({}, DEFAULT_ADDRESSES, { + mixedRouteQuoterV1Address: "0xBa60b6e6fF25488308789E6e0A65D838be34194e" + }); + var OPTIMISM_ADDRESSES = DEFAULT_ADDRESSES; + var ARBITRUM_ONE_ADDRESSES = /* @__PURE__ */ _extends({}, DEFAULT_ADDRESSES, { + multicallAddress: "0xadF885960B47eA2CD9B55E6DAc6B42b7Cb2806dB", + tickLensAddress: "0xbfd8137f7d1516D3ea5cA83523914859ec47F573" + }); + var POLYGON_ADDRESSES = DEFAULT_ADDRESSES; + var CELO_ADDRESSES = { + v3CoreFactoryAddress: "0xAfE208a311B21f13EF87E33A90049fC17A7acDEc", + multicallAddress: "0x633987602DE5C4F337e3DbF265303A1080324204", + quoterAddress: "0x82825d0554fA07f7FC52Ab63c961F330fdEFa8E8", + v3MigratorAddress: "0x3cFd4d48EDfDCC53D3f173F596f621064614C582", + nonfungiblePositionManagerAddress: "0x3d79EdAaBC0EaB6F08ED885C05Fc0B014290D95A", + tickLensAddress: "0x5f115D9113F88e0a0Db1b5033D90D4a9690AcD3D" + }; + var BNB_ADDRESSES = { + v3CoreFactoryAddress: "0xdB1d10011AD0Ff90774D0C6Bb92e5C5c8b4461F7", + multicallAddress: "0x963Df249eD09c358A4819E39d9Cd5736c3087184", + quoterAddress: "0x78D78E420Da98ad378D7799bE8f4AF69033EB077", + v3MigratorAddress: "0x32681814957e0C13117ddc0c2aba232b5c9e760f", + nonfungiblePositionManagerAddress: "0x7b8A01B39D58278b5DE7e48c8449c9f4F5170613", + tickLensAddress: "0xD9270014D396281579760619CCf4c3af0501A47C", + swapRouter02Address: "0xB971eF87ede563556b2ED4b1C0b0019111Dd85d2" + }; + var OPTIMISM_GOERLI_ADDRESSES = { + v3CoreFactoryAddress: "0xB656dA17129e7EB733A557f4EBc57B76CFbB5d10", + multicallAddress: "0x07F2D8a2a02251B62af965f22fC4744A5f96BCCd", + quoterAddress: "0x9569CbA925c8ca2248772A9A4976A516743A246F", + v3MigratorAddress: "0xf6c55fBe84B1C8c3283533c53F51bC32F5C7Aba8", + nonfungiblePositionManagerAddress: "0x39Ca85Af2F383190cBf7d7c41ED9202D27426EF6", + tickLensAddress: "0xe6140Bd164b63E8BfCfc40D5dF952f83e171758e" + }; + var OPTIMISM_SEPOLIA_ADDRESSES = { + v3CoreFactoryAddress: "0x8CE191193D15ea94e11d327b4c7ad8bbE520f6aF", + multicallAddress: "0x80e4e06841bb76AA9735E0448cB8d003C0EF009a", + quoterAddress: "0x0FBEa6cf957d95ee9313490050F6A0DA68039404", + v3MigratorAddress: "0xE7EcbAAaA54D007A00dbb6c1d2f150066D69dA07", + nonfungiblePositionManagerAddress: "0xdA75cEf1C93078e8b736FCA5D5a30adb97C8957d", + tickLensAddress: "0xCb7f54747F58F8944973cea5b8f4ac2209BadDC5", + swapRouter02Address: "0x94cC0AaC535CCDB3C01d6787D6413C739ae12bc4" + }; + var ARBITRUM_GOERLI_ADDRESSES = { + v3CoreFactoryAddress: "0x4893376342d5D7b3e31d4184c08b265e5aB2A3f6", + multicallAddress: "0x8260CB40247290317a4c062F3542622367F206Ee", + quoterAddress: "0x1dd92b83591781D0C6d98d07391eea4b9a6008FA", + v3MigratorAddress: "0xA815919D2584Ac3F76ea9CB62E6Fd40a43BCe0C3", + nonfungiblePositionManagerAddress: "0x622e4726a167799826d1E1D150b076A7725f5D81", + tickLensAddress: "0xb52429333da969a0C79a60930a4Bf0020E5D1DE8" + }; + var ARBITRUM_SEPOLIA_ADDRESSES = { + v3CoreFactoryAddress: "0x248AB79Bbb9bC29bB72f7Cd42F17e054Fc40188e", + multicallAddress: "0x2B718b475e385eD29F56775a66aAB1F5cC6B2A0A", + quoterAddress: "0x2779a0CC1c3e0E44D2542EC3e79e3864Ae93Ef0B", + v3MigratorAddress: "0x398f43ef2c67B941147157DA1c5a868E906E043D", + nonfungiblePositionManagerAddress: "0x6b2937Bde17889EDCf8fbD8dE31C3C2a70Bc4d65", + tickLensAddress: "0x0fd18587734e5C2dcE2dccDcC7DD1EC89ba557d9", + swapRouter02Address: "0x101F443B4d1b059569D643917553c771E1b9663E" + }; + var SEPOLIA_ADDRESSES = { + v3CoreFactoryAddress: "0x0227628f3F023bb0B980b67D528571c95c6DaC1c", + multicallAddress: "0xD7F33bCdb21b359c8ee6F0251d30E94832baAd07", + quoterAddress: "0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3", + v3MigratorAddress: "0x729004182cF005CEC8Bd85df140094b6aCbe8b15", + nonfungiblePositionManagerAddress: "0x1238536071E1c677A632429e3655c799b22cDA52", + tickLensAddress: "0xd7f33bcdb21b359c8ee6f0251d30e94832baad07", + swapRouter02Address: "0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E" + }; + var AVALANCHE_ADDRESSES = { + v3CoreFactoryAddress: "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", + multicallAddress: "0x0139141Cd4Ee88dF3Cdb65881D411bAE271Ef0C2", + quoterAddress: "0xbe0F5544EC67e9B3b2D979aaA43f18Fd87E6257F", + v3MigratorAddress: "0x44f5f1f5E452ea8d29C890E8F6e893fC0f1f0f97", + nonfungiblePositionManagerAddress: "0x655C406EBFa14EE2006250925e54ec43AD184f8B", + tickLensAddress: "0xEB9fFC8bf81b4fFd11fb6A63a6B0f098c6e21950", + swapRouter02Address: "0xbb00FF08d01D300023C629E8fFfFcb65A5a578cE" + }; + var BASE_ADDRESSES = { + v3CoreFactoryAddress: "0x33128a8fC17869897dcE68Ed026d694621f6FDfD", + multicallAddress: "0x091e99cb1C49331a94dD62755D168E941AbD0693", + quoterAddress: "0x3d4e44Eb1374240CE5F1B871ab261CD16335B76a", + v3MigratorAddress: "0x23cF10b1ee3AdfCA73B0eF17C07F7577e7ACd2d7", + nonfungiblePositionManagerAddress: "0x03a520b32C04BF3bEEf7BEb72E919cf822Ed34f1", + tickLensAddress: "0x0CdeE061c75D43c82520eD998C23ac2991c9ac6d", + swapRouter02Address: "0x2626664c2603336E57B271c5C0b26F421741e481", + mixedRouteQuoterV1Address: "0xe544efae946f0008ae9a8d64493efa7886b73776" + }; + var BASE_GOERLI_ADDRESSES = { + v3CoreFactoryAddress: "0x9323c1d6D800ed51Bd7C6B216cfBec678B7d0BC2", + multicallAddress: "0xB206027a9E0E13F05eBEFa5D2402Bab3eA716439", + quoterAddress: "0xedf539058e28E5937dAef3f69cEd0b25fbE66Ae9", + v3MigratorAddress: "0x3efe5d02a04b7351D671Db7008ec6eBA9AD9e3aE", + nonfungiblePositionManagerAddress: "0x3c61369ef0D1D2AFa70d8feC2F31C5D6Ce134F30", + tickLensAddress: "0x1acB873Ee909D0c98adB18e4474943249F931b92", + swapRouter02Address: "0x8357227D4eDc78991Db6FDB9bD6ADE250536dE1d" + }; + var ZORA_ADDRESSES = { + v3CoreFactoryAddress: "0x7145F8aeef1f6510E92164038E1B6F8cB2c42Cbb", + multicallAddress: "0xA51c76bEE6746cB487a7e9312E43e2b8f4A37C15", + quoterAddress: "0x11867e1b3348F3ce4FcC170BC5af3d23E07E64Df", + v3MigratorAddress: "0x048352d8dCF13686982C799da63fA6426a9D0b60", + nonfungiblePositionManagerAddress: "0xbC91e8DfA3fF18De43853372A3d7dfe585137D78", + tickLensAddress: "0x209AAda09D74Ad3B8D0E92910Eaf85D2357e3044", + swapRouter02Address: "0x7De04c96BE5159c3b5CeffC82aa176dc81281557" + }; + var ZORA_SEPOLIA_ADDRESSES = { + v3CoreFactoryAddress: "0x4324A677D74764f46f33ED447964252441aA8Db6", + multicallAddress: "0xA1E7e3A69671C4494EC59Dbd442de930a93F911A", + quoterAddress: "0xC195976fEF0985886E37036E2DF62bF371E12Df0", + v3MigratorAddress: "0x65ef259b31bf1d977c37e9434658694267674897", + nonfungiblePositionManagerAddress: "0xB8458EaAe43292e3c1F7994EFd016bd653d23c20", + tickLensAddress: "0x23C0F71877a1Fc4e20A78018f9831365c85f3064" + }; + var ROOTSTOCK_ADDRESSES = { + v3CoreFactoryAddress: "0xaF37EC98A00FD63689CF3060BF3B6784E00caD82", + multicallAddress: "0x996a9858cDfa45Ad68E47c9A30a7201E29c6a386", + quoterAddress: "0xb51727c996C68E60F598A923a5006853cd2fEB31", + v3MigratorAddress: "0x16678977CA4ec3DAD5efc7b15780295FE5f56162", + nonfungiblePositionManagerAddress: "0x9d9386c042F194B460Ec424a1e57ACDE25f5C4b1", + tickLensAddress: "0x55B9dF5bF68ADe972191a91980459f48ecA16afC", + swapRouter02Address: "0x0B14ff67f0014046b4b99057Aec4509640b3947A" + }; + var BLAST_ADDRESSES = { + v3CoreFactoryAddress: "0x792edAdE80af5fC680d96a2eD80A44247D2Cf6Fd", + multicallAddress: "0xdC7f370de7631cE9e2c2e1DCDA6B3B5744Cf4705", + quoterAddress: "0x6Cdcd65e03c1CEc3730AeeCd45bc140D57A25C77", + v3MigratorAddress: "0x15CA7043CD84C5D21Ae76Ba0A1A967d42c40ecE0", + nonfungiblePositionManagerAddress: "0xB218e4f7cF0533d4696fDfC419A0023D33345F28", + tickLensAddress: "0x2E95185bCdD928a3e984B7e2D6560Ab1b17d7274", + swapRouter02Address: "0x549FEB8c9bd4c12Ad2AB27022dA12492aC452B66" + }; + var CHAIN_TO_ADDRESSES_MAP = (_CHAIN_TO_ADDRESSES_M = {}, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.MAINNET] = MAINNET_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.OPTIMISM] = OPTIMISM_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.ARBITRUM_ONE] = ARBITRUM_ONE_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.POLYGON] = POLYGON_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.POLYGON_MUMBAI] = POLYGON_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.GOERLI] = GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.CELO] = CELO_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.CELO_ALFAJORES] = CELO_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.BNB] = BNB_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.OPTIMISM_GOERLI] = OPTIMISM_GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.OPTIMISM_SEPOLIA] = OPTIMISM_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.ARBITRUM_GOERLI] = ARBITRUM_GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.ARBITRUM_SEPOLIA] = ARBITRUM_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.SEPOLIA] = SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.AVALANCHE] = AVALANCHE_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.BASE] = BASE_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.BASE_GOERLI] = BASE_GOERLI_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.ZORA] = ZORA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.ZORA_SEPOLIA] = ZORA_SEPOLIA_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.ROOTSTOCK] = ROOTSTOCK_ADDRESSES, _CHAIN_TO_ADDRESSES_M[exports2.ChainId.BLAST] = BLAST_ADDRESSES, _CHAIN_TO_ADDRESSES_M); + var V3_CORE_FACTORY_ADDRESSES = /* @__PURE__ */ _extends({}, /* @__PURE__ */ SUPPORTED_CHAINS.reduce(function(memo, chainId) { + memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].v3CoreFactoryAddress; + return memo; + }, {})); + var V3_MIGRATOR_ADDRESSES = /* @__PURE__ */ _extends({}, /* @__PURE__ */ SUPPORTED_CHAINS.reduce(function(memo, chainId) { + var v3MigratorAddress = CHAIN_TO_ADDRESSES_MAP[chainId].v3MigratorAddress; + if (v3MigratorAddress) { + memo[chainId] = v3MigratorAddress; + } + return memo; + }, {})); + var MULTICALL_ADDRESSES = /* @__PURE__ */ _extends({}, /* @__PURE__ */ SUPPORTED_CHAINS.reduce(function(memo, chainId) { + memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].multicallAddress; + return memo; + }, {})); + var GOVERNANCE_ALPHA_V0_ADDRESSES = /* @__PURE__ */ constructSameAddressMap("0x5e4be8Bc9637f0EAA1A755019e06A68ce081D58F"); + var GOVERNANCE_ALPHA_V1_ADDRESSES = (_GOVERNANCE_ALPHA_V1_ = {}, _GOVERNANCE_ALPHA_V1_[exports2.ChainId.MAINNET] = "0xC4e172459f1E7939D522503B81AFAaC1014CE6F6", _GOVERNANCE_ALPHA_V1_); + var GOVERNANCE_BRAVO_ADDRESSES = (_GOVERNANCE_BRAVO_ADD = {}, _GOVERNANCE_BRAVO_ADD[exports2.ChainId.MAINNET] = "0x408ED6354d4973f66138C91495F2f2FCbd8724C3", _GOVERNANCE_BRAVO_ADD); + var TIMELOCK_ADDRESSES = /* @__PURE__ */ constructSameAddressMap("0x1a9C8182C09F50C8318d769245beA52c32BE35BC"); + var MERKLE_DISTRIBUTOR_ADDRESS = (_MERKLE_DISTRIBUTOR_A = {}, _MERKLE_DISTRIBUTOR_A[exports2.ChainId.MAINNET] = "0x090D4613473dEE047c3f2706764f49E0821D256e", _MERKLE_DISTRIBUTOR_A); + var ARGENT_WALLET_DETECTOR_ADDRESS = (_ARGENT_WALLET_DETECT = {}, _ARGENT_WALLET_DETECT[exports2.ChainId.MAINNET] = "0xeca4B0bDBf7c55E9b7925919d03CbF8Dc82537E8", _ARGENT_WALLET_DETECT); + var QUOTER_ADDRESSES = /* @__PURE__ */ _extends({}, /* @__PURE__ */ SUPPORTED_CHAINS.reduce(function(memo, chainId) { + memo[chainId] = CHAIN_TO_ADDRESSES_MAP[chainId].quoterAddress; + return memo; + }, {})); + var NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = /* @__PURE__ */ _extends({}, /* @__PURE__ */ SUPPORTED_CHAINS.reduce(function(memo, chainId) { + var nonfungiblePositionManagerAddress = CHAIN_TO_ADDRESSES_MAP[chainId].nonfungiblePositionManagerAddress; + if (nonfungiblePositionManagerAddress) { + memo[chainId] = nonfungiblePositionManagerAddress; + } + return memo; + }, {})); + var ENS_REGISTRAR_ADDRESSES = /* @__PURE__ */ _extends({}, /* @__PURE__ */ constructSameAddressMap("0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e")); + var SOCKS_CONTROLLER_ADDRESSES = (_SOCKS_CONTROLLER_ADD = {}, _SOCKS_CONTROLLER_ADD[exports2.ChainId.MAINNET] = "0x65770b5283117639760beA3F867b69b3697a91dd", _SOCKS_CONTROLLER_ADD); + var TICK_LENS_ADDRESSES = /* @__PURE__ */ _extends({}, /* @__PURE__ */ SUPPORTED_CHAINS.reduce(function(memo, chainId) { + var tickLensAddress = CHAIN_TO_ADDRESSES_MAP[chainId].tickLensAddress; + if (tickLensAddress) { + memo[chainId] = tickLensAddress; + } + return memo; + }, {})); + var MIXED_ROUTE_QUOTER_V1_ADDRESSES = /* @__PURE__ */ SUPPORTED_CHAINS.reduce(function(memo, chainId) { + var mixedRouteQuoterV1Address = CHAIN_TO_ADDRESSES_MAP[chainId].mixedRouteQuoterV1Address; + if (mixedRouteQuoterV1Address) { + memo[chainId] = mixedRouteQuoterV1Address; + } + return memo; + }, {}); + var SWAP_ROUTER_02_ADDRESSES = function SWAP_ROUTER_02_ADDRESSES2(chainId) { + if (SUPPORTED_CHAINS.includes(chainId)) { + var _CHAIN_TO_ADDRESSES_M2; + var id = chainId; + return (_CHAIN_TO_ADDRESSES_M2 = CHAIN_TO_ADDRESSES_MAP[id].swapRouter02Address) != null ? _CHAIN_TO_ADDRESSES_M2 : "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45"; + } + return ""; + }; + (function(TradeType) { + TradeType[TradeType["EXACT_INPUT"] = 0] = "EXACT_INPUT"; + TradeType[TradeType["EXACT_OUTPUT"] = 1] = "EXACT_OUTPUT"; + })(exports2.TradeType || (exports2.TradeType = {})); + (function(Rounding) { + Rounding[Rounding["ROUND_DOWN"] = 0] = "ROUND_DOWN"; + Rounding[Rounding["ROUND_HALF_UP"] = 1] = "ROUND_HALF_UP"; + Rounding[Rounding["ROUND_UP"] = 2] = "ROUND_UP"; + })(exports2.Rounding || (exports2.Rounding = {})); + var MaxUint256 = /* @__PURE__ */ JSBI3.BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + var _toSignificantRoundin; + var _toFixedRounding; + var Decimal2 = /* @__PURE__ */ toFormat(_Decimal); + var Big = /* @__PURE__ */ toFormat(_Big); + var toSignificantRounding = (_toSignificantRoundin = {}, _toSignificantRoundin[exports2.Rounding.ROUND_DOWN] = Decimal2.ROUND_DOWN, _toSignificantRoundin[exports2.Rounding.ROUND_HALF_UP] = Decimal2.ROUND_HALF_UP, _toSignificantRoundin[exports2.Rounding.ROUND_UP] = Decimal2.ROUND_UP, _toSignificantRoundin); + var toFixedRounding = (_toFixedRounding = {}, _toFixedRounding[exports2.Rounding.ROUND_DOWN] = 0, _toFixedRounding[exports2.Rounding.ROUND_HALF_UP] = 1, _toFixedRounding[exports2.Rounding.ROUND_UP] = 3, _toFixedRounding); + var Fraction = /* @__PURE__ */ function() { + function Fraction2(numerator, denominator) { + if (denominator === void 0) { + denominator = JSBI3.BigInt(1); + } + this.numerator = JSBI3.BigInt(numerator); + this.denominator = JSBI3.BigInt(denominator); + } + Fraction2.tryParseFraction = function tryParseFraction(fractionish) { + if (fractionish instanceof JSBI3 || typeof fractionish === "number" || typeof fractionish === "string") return new Fraction2(fractionish); + if ("numerator" in fractionish && "denominator" in fractionish) return fractionish; + throw new Error("Could not parse fraction"); + }; + var _proto = Fraction2.prototype; + _proto.invert = function invert() { + return new Fraction2(this.denominator, this.numerator); + }; + _proto.add = function add(other) { + var otherParsed = Fraction2.tryParseFraction(other); + if (JSBI3.equal(this.denominator, otherParsed.denominator)) { + return new Fraction2(JSBI3.add(this.numerator, otherParsed.numerator), this.denominator); + } + return new Fraction2(JSBI3.add(JSBI3.multiply(this.numerator, otherParsed.denominator), JSBI3.multiply(otherParsed.numerator, this.denominator)), JSBI3.multiply(this.denominator, otherParsed.denominator)); + }; + _proto.subtract = function subtract(other) { + var otherParsed = Fraction2.tryParseFraction(other); + if (JSBI3.equal(this.denominator, otherParsed.denominator)) { + return new Fraction2(JSBI3.subtract(this.numerator, otherParsed.numerator), this.denominator); + } + return new Fraction2(JSBI3.subtract(JSBI3.multiply(this.numerator, otherParsed.denominator), JSBI3.multiply(otherParsed.numerator, this.denominator)), JSBI3.multiply(this.denominator, otherParsed.denominator)); + }; + _proto.lessThan = function lessThan(other) { + var otherParsed = Fraction2.tryParseFraction(other); + return JSBI3.lessThan(JSBI3.multiply(this.numerator, otherParsed.denominator), JSBI3.multiply(otherParsed.numerator, this.denominator)); + }; + _proto.equalTo = function equalTo(other) { + var otherParsed = Fraction2.tryParseFraction(other); + return JSBI3.equal(JSBI3.multiply(this.numerator, otherParsed.denominator), JSBI3.multiply(otherParsed.numerator, this.denominator)); + }; + _proto.greaterThan = function greaterThan(other) { + var otherParsed = Fraction2.tryParseFraction(other); + return JSBI3.greaterThan(JSBI3.multiply(this.numerator, otherParsed.denominator), JSBI3.multiply(otherParsed.numerator, this.denominator)); + }; + _proto.multiply = function multiply(other) { + var otherParsed = Fraction2.tryParseFraction(other); + return new Fraction2(JSBI3.multiply(this.numerator, otherParsed.numerator), JSBI3.multiply(this.denominator, otherParsed.denominator)); + }; + _proto.divide = function divide(other) { + var otherParsed = Fraction2.tryParseFraction(other); + return new Fraction2(JSBI3.multiply(this.numerator, otherParsed.denominator), JSBI3.multiply(this.denominator, otherParsed.numerator)); + }; + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (format === void 0) { + format = { + groupSeparator: "" + }; + } + if (rounding === void 0) { + rounding = exports2.Rounding.ROUND_HALF_UP; + } + !Number.isInteger(significantDigits) ? invariant(false, significantDigits + " is not an integer.") : void 0; + !(significantDigits > 0) ? invariant(false, significantDigits + " is not positive.") : void 0; + Decimal2.set({ + precision: significantDigits + 1, + rounding: toSignificantRounding[rounding] + }); + var quotient = new Decimal2(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits); + return quotient.toFormat(quotient.decimalPlaces(), format); + }; + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (format === void 0) { + format = { + groupSeparator: "" + }; + } + if (rounding === void 0) { + rounding = exports2.Rounding.ROUND_HALF_UP; + } + !Number.isInteger(decimalPlaces) ? invariant(false, decimalPlaces + " is not an integer.") : void 0; + !(decimalPlaces >= 0) ? invariant(false, decimalPlaces + " is negative.") : void 0; + Big.DP = decimalPlaces; + Big.RM = toFixedRounding[rounding]; + return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format); + }; + _createClass(Fraction2, [{ + key: "quotient", + get: function get() { + return JSBI3.divide(this.numerator, this.denominator); + } + // remainder after floor division + }, { + key: "remainder", + get: function get() { + return new Fraction2(JSBI3.remainder(this.numerator, this.denominator), this.denominator); + } + }, { + key: "asFraction", + get: function get() { + return new Fraction2(this.numerator, this.denominator); + } + }]); + return Fraction2; + }(); + var Big$1 = /* @__PURE__ */ toFormat(_Big); + var CurrencyAmount = /* @__PURE__ */ function(_Fraction) { + _inheritsLoose(CurrencyAmount2, _Fraction); + function CurrencyAmount2(currency, numerator, denominator) { + var _this; + _this = _Fraction.call(this, numerator, denominator) || this; + !JSBI3.lessThanOrEqual(_this.quotient, MaxUint256) ? invariant(false, "AMOUNT") : void 0; + _this.currency = currency; + _this.decimalScale = JSBI3.exponentiate(JSBI3.BigInt(10), JSBI3.BigInt(currency.decimals)); + return _this; + } + CurrencyAmount2.fromRawAmount = function fromRawAmount(currency, rawAmount) { + return new CurrencyAmount2(currency, rawAmount); + }; + CurrencyAmount2.fromFractionalAmount = function fromFractionalAmount(currency, numerator, denominator) { + return new CurrencyAmount2(currency, numerator, denominator); + }; + var _proto = CurrencyAmount2.prototype; + _proto.add = function add(other) { + !this.currency.equals(other.currency) ? invariant(false, "CURRENCY") : void 0; + var added = _Fraction.prototype.add.call(this, other); + return CurrencyAmount2.fromFractionalAmount(this.currency, added.numerator, added.denominator); + }; + _proto.subtract = function subtract(other) { + !this.currency.equals(other.currency) ? invariant(false, "CURRENCY") : void 0; + var subtracted = _Fraction.prototype.subtract.call(this, other); + return CurrencyAmount2.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator); + }; + _proto.multiply = function multiply(other) { + var multiplied = _Fraction.prototype.multiply.call(this, other); + return CurrencyAmount2.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator); + }; + _proto.divide = function divide(other) { + var divided = _Fraction.prototype.divide.call(this, other); + return CurrencyAmount2.fromFractionalAmount(this.currency, divided.numerator, divided.denominator); + }; + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 6; + } + if (rounding === void 0) { + rounding = exports2.Rounding.ROUND_DOWN; + } + return _Fraction.prototype.divide.call(this, this.decimalScale).toSignificant(significantDigits, format, rounding); + }; + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = this.currency.decimals; + } + if (rounding === void 0) { + rounding = exports2.Rounding.ROUND_DOWN; + } + !(decimalPlaces <= this.currency.decimals) ? invariant(false, "DECIMALS") : void 0; + return _Fraction.prototype.divide.call(this, this.decimalScale).toFixed(decimalPlaces, format, rounding); + }; + _proto.toExact = function toExact(format) { + if (format === void 0) { + format = { + groupSeparator: "" + }; + } + Big$1.DP = this.currency.decimals; + return new Big$1(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(format); + }; + _createClass(CurrencyAmount2, [{ + key: "wrapped", + get: function get() { + if (this.currency.isToken) return this; + return CurrencyAmount2.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator); + } + }]); + return CurrencyAmount2; + }(Fraction); + var ONE_HUNDRED = /* @__PURE__ */ new Fraction(/* @__PURE__ */ JSBI3.BigInt(100)); + function toPercent(fraction) { + return new Percent(fraction.numerator, fraction.denominator); + } + var Percent = /* @__PURE__ */ function(_Fraction) { + _inheritsLoose(Percent2, _Fraction); + function Percent2() { + var _this; + _this = _Fraction.apply(this, arguments) || this; + _this.isPercent = true; + return _this; + } + var _proto = Percent2.prototype; + _proto.add = function add(other) { + return toPercent(_Fraction.prototype.add.call(this, other)); + }; + _proto.subtract = function subtract(other) { + return toPercent(_Fraction.prototype.subtract.call(this, other)); + }; + _proto.multiply = function multiply(other) { + return toPercent(_Fraction.prototype.multiply.call(this, other)); + }; + _proto.divide = function divide(other) { + return toPercent(_Fraction.prototype.divide.call(this, other)); + }; + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 5; + } + return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toSignificant(significantDigits, format, rounding); + }; + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = 2; + } + return _Fraction.prototype.multiply.call(this, ONE_HUNDRED).toFixed(decimalPlaces, format, rounding); + }; + return Percent2; + }(Fraction); + var Price = /* @__PURE__ */ function(_Fraction) { + _inheritsLoose(Price2, _Fraction); + function Price2() { + var _this; + var baseCurrency, quoteCurrency, denominator, numerator; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + if (args.length === 4) { + baseCurrency = args[0]; + quoteCurrency = args[1]; + denominator = args[2]; + numerator = args[3]; + } else { + var result2 = args[0].quoteAmount.divide(args[0].baseAmount); + var _ref = [args[0].baseAmount.currency, args[0].quoteAmount.currency, result2.denominator, result2.numerator]; + baseCurrency = _ref[0]; + quoteCurrency = _ref[1]; + denominator = _ref[2]; + numerator = _ref[3]; + } + _this = _Fraction.call(this, numerator, denominator) || this; + _this.baseCurrency = baseCurrency; + _this.quoteCurrency = quoteCurrency; + _this.scalar = new Fraction(JSBI3.exponentiate(JSBI3.BigInt(10), JSBI3.BigInt(baseCurrency.decimals)), JSBI3.exponentiate(JSBI3.BigInt(10), JSBI3.BigInt(quoteCurrency.decimals))); + return _this; + } + var _proto = Price2.prototype; + _proto.invert = function invert() { + return new Price2(this.quoteCurrency, this.baseCurrency, this.numerator, this.denominator); + }; + _proto.multiply = function multiply(other) { + !this.quoteCurrency.equals(other.baseCurrency) ? invariant(false, "TOKEN") : void 0; + var fraction = _Fraction.prototype.multiply.call(this, other); + return new Price2(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator); + }; + _proto.quote = function quote(currencyAmount) { + !currencyAmount.currency.equals(this.baseCurrency) ? invariant(false, "TOKEN") : void 0; + var result2 = _Fraction.prototype.multiply.call(this, currencyAmount); + return CurrencyAmount.fromFractionalAmount(this.quoteCurrency, result2.numerator, result2.denominator); + }; + _proto.toSignificant = function toSignificant(significantDigits, format, rounding) { + if (significantDigits === void 0) { + significantDigits = 6; + } + return this.adjustedForDecimals.toSignificant(significantDigits, format, rounding); + }; + _proto.toFixed = function toFixed(decimalPlaces, format, rounding) { + if (decimalPlaces === void 0) { + decimalPlaces = 4; + } + return this.adjustedForDecimals.toFixed(decimalPlaces, format, rounding); + }; + _createClass(Price2, [{ + key: "adjustedForDecimals", + get: function get() { + return _Fraction.prototype.multiply.call(this, this.scalar); + } + }]); + return Price2; + }(Fraction); + var BaseCurrency = ( + /** + * Constructs an instance of the base class `BaseCurrency`. + * @param chainId the chain ID on which this currency resides + * @param decimals decimals of the currency + * @param symbol symbol of the currency + * @param name of the currency + */ + function BaseCurrency2(chainId, decimals, symbol, name2) { + !Number.isSafeInteger(chainId) ? invariant(false, "CHAIN_ID") : void 0; + !(decimals >= 0 && decimals < 255 && Number.isInteger(decimals)) ? invariant(false, "DECIMALS") : void 0; + this.chainId = chainId; + this.decimals = decimals; + this.symbol = symbol; + this.name = name2; + } + ); + var NativeCurrency = /* @__PURE__ */ function(_BaseCurrency) { + _inheritsLoose(NativeCurrency2, _BaseCurrency); + function NativeCurrency2() { + var _this; + _this = _BaseCurrency.apply(this, arguments) || this; + _this.isNative = true; + _this.isToken = false; + return _this; + } + return NativeCurrency2; + }(BaseCurrency); + function validateAndParseAddress(address$1) { + try { + return address.getAddress(address$1); + } catch (error) { + throw new Error(address$1 + " is not a valid address."); + } + } + var startsWith0xLen42HexRegex = /^0x[0-9a-fA-F]{40}$/; + function checkValidAddress(address2) { + if (startsWith0xLen42HexRegex.test(address2)) { + return address2; + } + throw new Error(address2 + " is not a valid address."); + } + var Token = /* @__PURE__ */ function(_BaseCurrency) { + _inheritsLoose(Token2, _BaseCurrency); + function Token2(chainId, address2, decimals, symbol, name2, bypassChecksum, buyFeeBps, sellFeeBps) { + var _this; + _this = _BaseCurrency.call(this, chainId, decimals, symbol, name2) || this; + _this.isNative = false; + _this.isToken = true; + if (bypassChecksum) { + _this.address = checkValidAddress(address2); + } else { + _this.address = validateAndParseAddress(address2); + } + if (buyFeeBps) { + !buyFeeBps.gte(bignumber.BigNumber.from(0)) ? invariant(false, "NON-NEGATIVE FOT FEES") : void 0; + } + if (sellFeeBps) { + !sellFeeBps.gte(bignumber.BigNumber.from(0)) ? invariant(false, "NON-NEGATIVE FOT FEES") : void 0; + } + _this.buyFeeBps = buyFeeBps; + _this.sellFeeBps = sellFeeBps; + return _this; + } + var _proto = Token2.prototype; + _proto.equals = function equals(other) { + return other.isToken && this.chainId === other.chainId && this.address.toLowerCase() === other.address.toLowerCase(); + }; + _proto.sortsBefore = function sortsBefore(other) { + !(this.chainId === other.chainId) ? invariant(false, "CHAIN_IDS") : void 0; + !(this.address.toLowerCase() !== other.address.toLowerCase()) ? invariant(false, "ADDRESSES") : void 0; + return this.address.toLowerCase() < other.address.toLowerCase(); + }; + _createClass(Token2, [{ + key: "wrapped", + get: function get() { + return this; + } + }]); + return Token2; + }(BaseCurrency); + var WETH9 = { + 1: /* @__PURE__ */ new Token(1, "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 18, "WETH", "Wrapped Ether"), + 3: /* @__PURE__ */ new Token(3, "0xc778417E063141139Fce010982780140Aa0cD5Ab", 18, "WETH", "Wrapped Ether"), + 4: /* @__PURE__ */ new Token(4, "0xc778417E063141139Fce010982780140Aa0cD5Ab", 18, "WETH", "Wrapped Ether"), + 5: /* @__PURE__ */ new Token(5, "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6", 18, "WETH", "Wrapped Ether"), + 42: /* @__PURE__ */ new Token(42, "0xd0A1E359811322d97991E03f863a0C30C2cF029C", 18, "WETH", "Wrapped Ether"), + 10: /* @__PURE__ */ new Token(10, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), + 69: /* @__PURE__ */ new Token(69, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), + 11155420: /* @__PURE__ */ new Token(11155420, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), + 42161: /* @__PURE__ */ new Token(42161, "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", 18, "WETH", "Wrapped Ether"), + 421611: /* @__PURE__ */ new Token(421611, "0xB47e6A5f8b33b3F17603C83a0535A9dcD7E32681", 18, "WETH", "Wrapped Ether"), + 421614: /* @__PURE__ */ new Token(421614, "0x980B62Da83eFf3D4576C647993b0c1D7faf17c73", 18, "WETH", "Wrapped Ether"), + 8453: /* @__PURE__ */ new Token(8453, "0x4200000000000000000000000000000000000006", 18, "WETH", "Wrapped Ether"), + 56: /* @__PURE__ */ new Token(56, "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", 18, "WBNB", "Wrapped BNB"), + 137: /* @__PURE__ */ new Token(137, "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", 18, "WMATIC", "Wrapped MATIC"), + 43114: /* @__PURE__ */ new Token(43114, "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", 18, "WAVAX", "Wrapped AVAX") + }; + var Ether = /* @__PURE__ */ function(_NativeCurrency) { + _inheritsLoose(Ether2, _NativeCurrency); + function Ether2(chainId) { + return _NativeCurrency.call(this, chainId, 18, "ETH", "Ether") || this; + } + Ether2.onChain = function onChain(chainId) { + var _this$_etherCache$cha; + return (_this$_etherCache$cha = this._etherCache[chainId]) != null ? _this$_etherCache$cha : this._etherCache[chainId] = new Ether2(chainId); + }; + var _proto = Ether2.prototype; + _proto.equals = function equals(other) { + return other.isNative && other.chainId === this.chainId; + }; + _createClass(Ether2, [{ + key: "wrapped", + get: function get() { + var weth9 = WETH9[this.chainId]; + !!!weth9 ? invariant(false, "WRAPPED") : void 0; + return weth9; + } + }]); + return Ether2; + }(NativeCurrency); + Ether._etherCache = {}; + function computePriceImpact(midPrice, inputAmount, outputAmount) { + var quotedOutputAmount = midPrice.quote(inputAmount); + var priceImpact = quotedOutputAmount.subtract(outputAmount).divide(quotedOutputAmount); + return new Percent(priceImpact.numerator, priceImpact.denominator); + } + function sortedInsert(items, add, maxSize, comparator) { + !(maxSize > 0) ? invariant(false, "MAX_SIZE_ZERO") : void 0; + !(items.length <= maxSize) ? invariant(false, "ITEMS_SIZE") : void 0; + if (items.length === 0) { + items.push(add); + return null; + } else { + var isFull = items.length === maxSize; + if (isFull && comparator(items[items.length - 1], add) <= 0) { + return add; + } + var lo = 0, hi = items.length; + while (lo < hi) { + var mid = lo + hi >>> 1; + if (comparator(items[mid], add) <= 0) { + lo = mid + 1; + } else { + hi = mid; + } + } + items.splice(lo, 0, add); + return isFull ? items.pop() : null; + } + } + var MAX_SAFE_INTEGER = /* @__PURE__ */ JSBI3.BigInt(Number.MAX_SAFE_INTEGER); + var ZERO = /* @__PURE__ */ JSBI3.BigInt(0); + var ONE = /* @__PURE__ */ JSBI3.BigInt(1); + var TWO = /* @__PURE__ */ JSBI3.BigInt(2); + function sqrt(value) { + !JSBI3.greaterThanOrEqual(value, ZERO) ? invariant(false, "NEGATIVE") : void 0; + if (JSBI3.lessThan(value, MAX_SAFE_INTEGER)) { + return JSBI3.BigInt(Math.floor(Math.sqrt(JSBI3.toNumber(value)))); + } + var z; + var x; + z = value; + x = JSBI3.add(JSBI3.divide(value, TWO), ONE); + while (JSBI3.lessThan(x, z)) { + z = x; + x = JSBI3.divide(JSBI3.add(JSBI3.divide(value, x), x), TWO); + } + return z; + } + exports2.ARGENT_WALLET_DETECTOR_ADDRESS = ARGENT_WALLET_DETECTOR_ADDRESS; + exports2.CHAIN_TO_ADDRESSES_MAP = CHAIN_TO_ADDRESSES_MAP; + exports2.CurrencyAmount = CurrencyAmount; + exports2.ENS_REGISTRAR_ADDRESSES = ENS_REGISTRAR_ADDRESSES; + exports2.Ether = Ether; + exports2.Fraction = Fraction; + exports2.GOVERNANCE_ALPHA_V0_ADDRESSES = GOVERNANCE_ALPHA_V0_ADDRESSES; + exports2.GOVERNANCE_ALPHA_V1_ADDRESSES = GOVERNANCE_ALPHA_V1_ADDRESSES; + exports2.GOVERNANCE_BRAVO_ADDRESSES = GOVERNANCE_BRAVO_ADDRESSES; + exports2.MERKLE_DISTRIBUTOR_ADDRESS = MERKLE_DISTRIBUTOR_ADDRESS; + exports2.MIXED_ROUTE_QUOTER_V1_ADDRESSES = MIXED_ROUTE_QUOTER_V1_ADDRESSES; + exports2.MULTICALL_ADDRESSES = MULTICALL_ADDRESSES; + exports2.MaxUint256 = MaxUint256; + exports2.NONFUNGIBLE_POSITION_MANAGER_ADDRESSES = NONFUNGIBLE_POSITION_MANAGER_ADDRESSES; + exports2.NativeCurrency = NativeCurrency; + exports2.Percent = Percent; + exports2.Price = Price; + exports2.QUOTER_ADDRESSES = QUOTER_ADDRESSES; + exports2.SOCKS_CONTROLLER_ADDRESSES = SOCKS_CONTROLLER_ADDRESSES; + exports2.SUPPORTED_CHAINS = SUPPORTED_CHAINS; + exports2.SWAP_ROUTER_02_ADDRESSES = SWAP_ROUTER_02_ADDRESSES; + exports2.TICK_LENS_ADDRESSES = TICK_LENS_ADDRESSES; + exports2.TIMELOCK_ADDRESSES = TIMELOCK_ADDRESSES; + exports2.Token = Token; + exports2.UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS = UNISWAP_NFT_AIRDROP_CLAIM_ADDRESS; + exports2.UNI_ADDRESSES = UNI_ADDRESSES; + exports2.V2_FACTORY_ADDRESS = V2_FACTORY_ADDRESS; + exports2.V2_FACTORY_ADDRESSES = V2_FACTORY_ADDRESSES; + exports2.V2_ROUTER_ADDRESS = V2_ROUTER_ADDRESS; + exports2.V2_ROUTER_ADDRESSES = V2_ROUTER_ADDRESSES; + exports2.V3_CORE_FACTORY_ADDRESSES = V3_CORE_FACTORY_ADDRESSES; + exports2.V3_MIGRATOR_ADDRESSES = V3_MIGRATOR_ADDRESSES; + exports2.WETH9 = WETH9; + exports2.computePriceImpact = computePriceImpact; + exports2.sortedInsert = sortedInsert; + exports2.sqrt = sqrt; + exports2.validateAndParseAddress = validateAndParseAddress; + } +}); + +// node_modules/@uniswap/sdk-core/dist/index.js +var require_dist = __commonJS({ + "node_modules/@uniswap/sdk-core/dist/index.js"(exports2, module2) { + "use strict"; + if (process.env.NODE_ENV === "production") { + module2.exports = require_sdk_core_cjs_production_min(); + } else { + module2.exports = require_sdk_core_cjs_development(); + } + } +}); + +// node_modules/@uniswap/v3-periphery/artifacts/contracts/interfaces/IMulticall.sol/IMulticall.json +var require_IMulticall = __commonJS({ + "node_modules/@uniswap/v3-periphery/artifacts/contracts/interfaces/IMulticall.sol/IMulticall.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "IMulticall", + sourceName: "contracts/interfaces/IMulticall.sol", + abi: [ + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "payable", + type: "function" + } + ], + bytecode: "0x", + deployedBytecode: "0x", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json +var require_NonfungiblePositionManager = __commonJS({ + "node_modules/@uniswap/v3-periphery/artifacts/contracts/NonfungiblePositionManager.sol/NonfungiblePositionManager.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "NonfungiblePositionManager", + sourceName: "contracts/NonfungiblePositionManager.sol", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_factory", + type: "address" + }, + { + internalType: "address", + name: "_WETH9", + type: "address" + }, + { + internalType: "address", + name: "_tokenDescriptor_", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "approved", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Approval", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "owner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "operator", + type: "address" + }, + { + indexed: false, + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "ApprovalForAll", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "address", + name: "recipient", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "Collect", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "DecreaseLiquidity", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + indexed: false, + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + name: "IncreaseLiquidity", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "from", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "Transfer", + type: "event" + }, + { + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "PERMIT_TYPEHASH", + outputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "WETH9", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "approve", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + } + ], + name: "balanceOf", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "baseURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "pure", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "burn", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint128", + name: "amount0Max", + type: "uint128" + }, + { + internalType: "uint128", + name: "amount1Max", + type: "uint128" + } + ], + internalType: "struct INonfungiblePositionManager.CollectParams", + name: "params", + type: "tuple" + } + ], + name: "collect", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token0", + type: "address" + }, + { + internalType: "address", + name: "token1", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "uint160", + name: "sqrtPriceX96", + type: "uint160" + } + ], + name: "createAndInitializePoolIfNecessary", + outputs: [ + { + internalType: "address", + name: "pool", + type: "address" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "amount0Min", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1Min", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct INonfungiblePositionManager.DecreaseLiquidityParams", + name: "params", + type: "tuple" + } + ], + name: "decreaseLiquidity", + outputs: [ + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getApproved", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount0Desired", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1Desired", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount0Min", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1Min", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct INonfungiblePositionManager.IncreaseLiquidityParams", + name: "params", + type: "tuple" + } + ], + name: "increaseLiquidity", + outputs: [ + { + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "address", + name: "operator", + type: "address" + } + ], + name: "isApprovedForAll", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "token0", + type: "address" + }, + { + internalType: "address", + name: "token1", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint256", + name: "amount0Desired", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1Desired", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount0Min", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1Min", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + } + ], + internalType: "struct INonfungiblePositionManager.MintParams", + name: "params", + type: "tuple" + } + ], + name: "mint", + outputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "amount0", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "name", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "ownerOf", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "spender", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "permit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "positions", + outputs: [ + { + internalType: "uint96", + name: "nonce", + type: "uint96" + }, + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "address", + name: "token0", + type: "address" + }, + { + internalType: "address", + name: "token1", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + }, + { + internalType: "uint128", + name: "liquidity", + type: "uint128" + }, + { + internalType: "uint256", + name: "feeGrowthInside0LastX128", + type: "uint256" + }, + { + internalType: "uint256", + name: "feeGrowthInside1LastX128", + type: "uint256" + }, + { + internalType: "uint128", + name: "tokensOwed0", + type: "uint128" + }, + { + internalType: "uint128", + name: "tokensOwed1", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "refundETH", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + name: "safeTransferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitAllowed", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitAllowedIfNecessary", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitIfNecessary", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "operator", + type: "address" + }, + { + internalType: "bool", + name: "approved", + type: "bool" + } + ], + name: "setApprovalForAll", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes4", + name: "interfaceId", + type: "bytes4" + } + ], + name: "supportsInterface", + outputs: [ + { + internalType: "bool", + name: "", + type: "bool" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "sweepToken", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "symbol", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint256", + name: "index", + type: "uint256" + } + ], + name: "tokenOfOwnerByIndex", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "tokenURI", + outputs: [ + { + internalType: "string", + name: "", + type: "string" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "totalSupply", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "transferFrom", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amount0Owed", + type: "uint256" + }, + { + internalType: "uint256", + name: "amount1Owed", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "uniswapV3MintCallback", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "unwrapWETH9", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } + ], + bytecode: "0x610120604052600d80546001600160b01b0319166001176001600160b01b0316600160b01b1790553480156200003457600080fd5b50604051620062e9380380620062e98339810160408190526200005791620002db565b82826040518060400160405280601b81526020017f556e697377617020563320506f736974696f6e73204e46542d563100000000008152506040518060400160405280600a815260200169554e492d56332d504f5360b01b815250604051806040016040528060018152602001603160f81b8152508282620000e66301ffc9a760e01b6200018d60201b60201c565b8151620000fb90600690602085019062000212565b5080516200011190600790602084019062000212565b50620001246380ac58cd60e01b6200018d565b62000136635b5e139f60e01b6200018d565b6200014863780e9d6360e01b6200018d565b50508251602093840120608052805192019190912060a052506001600160601b0319606092831b811660c05290821b811660e05291901b166101005250620003249050565b6001600160e01b03198082161415620001ed576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b828054600181600116156101000203166002900490600052602060002090601f0160209004810192826200024a576000855562000295565b82601f106200026557805160ff191683800117855562000295565b8280016001018555821562000295579182015b828111156200029557825182559160200191906001019062000278565b50620002a3929150620002a7565b5090565b5b80821115620002a35760008155600101620002a8565b80516001600160a01b0381168114620002d657600080fd5b919050565b600080600060608486031215620002f0578283fd5b620002fb84620002be565b92506200030b60208501620002be565b91506200031b60408501620002be565b90509250925092565b60805160a05160c05160601c60e05160601c6101005160601c615f40620003a960003980612a835250806102995280611718528061180e52806118965280613e5d5280613ea35280613f17525080610aa75280610dde5280610ea55280612a1d5280612b235280612e4452806136e15250806114ff5250806114de5250615f406000f3fe6080604052600436106102895760003560e01c80636352211e11610153578063ac9650d8116100cb578063d34879971161007f578063e985e9c511610064578063e985e9c5146106f5578063f3995c6714610715578063fc6f7865146107285761030d565b8063d3487997146106c2578063df2ab5bb146106e25761030d565b8063c2e3140a116100b0578063c2e3140a1461067a578063c45a01551461068d578063c87b56dd146106a25761030d565b8063ac9650d81461063a578063b88d4fde1461065a5761030d565b8063883164561161012257806399fbab881161010757806399fbab88146105cf578063a22cb46514610607578063a4a78f0c146106275761030d565b8063883164561461059757806395d89b41146105ba5761030d565b80636352211e1461052f5780636c0360eb1461054f57806370a08231146105645780637ac2ff7b146105845761030d565b806323b872dd1161020157806342966c68116101b557806349404b7c1161019a57806349404b7c146104e75780634aa4a4fc146104fa5780634f6ccce71461050f5761030d565b806342966c68146104c15780634659a494146104d45761030d565b806330adf81f116101e657806330adf81f146104775780633644e5151461048c57806342842e0e146104a15761030d565b806323b872dd146104375780632f745c59146104575761030d565b80630c49ccbe1161025857806313ead5621161023d57806313ead562146103e057806318160ddd146103f3578063219f5d17146104155761030d565b80630c49ccbe146103b757806312210e8a146103d85761030d565b806301ffc9a71461031257806306fdde0314610348578063081812fc1461036a578063095ea7b3146103975761030d565b3661030d57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461030b576040805162461bcd60e51b815260206004820152600960248201527f4e6f742057455448390000000000000000000000000000000000000000000000604482015290519081900360640190fd5b005b600080fd5b34801561031e57600080fd5b5061033261032d3660046153a6565b61073b565b60405161033f919061591e565b60405180910390f35b34801561035457600080fd5b5061035d610776565b60405161033f9190615971565b34801561037657600080fd5b5061038a6103853660046156b8565b61080c565b60405161033f91906157e2565b3480156103a357600080fd5b5061030b6103b2366004615270565b610868565b6103ca6103c5366004615483565b61093e565b60405161033f929190615b42565b61030b610daa565b61038a6103ee366004615103565b610dbc565b3480156103ff57600080fd5b506104086110c9565b60405161033f9190615929565b610428610423366004615494565b6110da565b60405161033f93929190615afd565b34801561044357600080fd5b5061030b61045236600461515c565b611413565b34801561046357600080fd5b50610408610472366004615270565b61146a565b34801561048357600080fd5b50610408611495565b34801561049857600080fd5b506104086114b9565b3480156104ad57600080fd5b5061030b6104bc36600461515c565b611577565b61030b6104cf3660046156b8565b611592565b61030b6104e23660046152dc565b611661565b61030b6104f53660046156d0565b611714565b34801561050657600080fd5b5061038a611894565b34801561051b57600080fd5b5061040861052a3660046156b8565b6118b8565b34801561053b57600080fd5b5061038a61054a3660046156b8565b6118ce565b34801561055b57600080fd5b5061035d6118f6565b34801561057057600080fd5b5061040861057f3660046150af565b6118fb565b61030b6105923660046152dc565b611963565b6105aa6105a5366004615550565b611e0f565b60405161033f9493929190615b1e565b3480156105c657600080fd5b5061035d612370565b3480156105db57600080fd5b506105ef6105ea3660046156b8565b6123d1565b60405161033f9c9b9a99989796959493929190615b50565b34801561061357600080fd5b5061030b610622366004615243565b612600565b61030b6106353660046152dc565b612723565b61064d610648366004615337565b6127d5565b60405161033f91906158a0565b34801561066657600080fd5b5061030b61067536600461519c565b612915565b61030b6106883660046152dc565b612973565b34801561069957600080fd5b5061038a612a1b565b3480156106ae57600080fd5b5061035d6106bd3660046156b8565b612a3f565b3480156106ce57600080fd5b5061030b6106dd366004615717565b612b0e565b61030b6106f036600461529b565b612b8c565b34801561070157600080fd5b506103326107103660046150cb565b612c6f565b61030b6107233660046152dc565b612c9d565b6103ca61073636600461546c565b612d28565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108025780601f106107d757610100808354040283529160200191610802565b820191906000526020600020905b8154815290600101906020018083116107e557829003601f168201915b5050505050905090565b600061081782613246565b61083c5760405162461bcd60e51b8152600401610833906159bb565b60405180910390fd5b506000908152600c60205260409020546c0100000000000000000000000090046001600160a01b031690565b6000610873826118ce565b9050806001600160a01b0316836001600160a01b031614156108c65760405162461bcd60e51b8152600401808060200182810382526021815260200180615ee26021913960400191505060405180910390fd5b806001600160a01b03166108d8613253565b6001600160a01b031614806108f457506108f481610710613253565b61092f5760405162461bcd60e51b8152600401808060200182810382526038815260200180615e0c6038913960400191505060405180910390fd5b6109398383613257565b505050565b600080823561094d33826132db565b6109695760405162461bcd60e51b815260040161083390615984565b836080013580610977613377565b11156109ca576040805162461bcd60e51b815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b60006109dc6040870160208801615562565b6001600160801b0316116109ef57600080fd5b84356000908152600c602090815260409182902060018101549092600160801b9091046001600160801b031691610a2a918901908901615562565b6001600160801b0316816001600160801b03161015610a4857600080fd5b60018281015469ffffffffffffffffffff166000908152600b60209081526040808320815160608101835281546001600160a01b039081168252919095015490811692850192909252600160a01b90910462ffffff1690830152610acc7f00000000000000000000000000000000000000000000000000000000000000008361337b565b60018501549091506001600160a01b0382169063a34123a7906a01000000000000000000008104600290810b91600160681b9004900b610b1260408e0160208f01615562565b6040518463ffffffff1660e01b8152600401610b309392919061594b565b6040805180830381600087803b158015610b4957600080fd5b505af1158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8191906156f4565b909850965060408901358810801590610b9e575088606001358710155b610bba5760405162461bcd60e51b815260040161083390615a18565b6001840154600090610bea9030906a01000000000000000000008104600290810b91600160681b9004900b613477565b9050600080836001600160a01b031663514ea4bf846040518263ffffffff1660e01b8152600401610c1b9190615929565b60a06040518083038186803b158015610c3357600080fd5b505afa158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b91906155ac565b50509250925050610c9087600201548303876001600160801b0316600160801b6134d1565b6004880180546fffffffffffffffffffffffffffffffff198116928e016001600160801b039182160181169290921790556003880154610cda91908303908816600160801b6134d1565b6004880180546001600160801b03808216938e01600160801b9283900482160116029190911790556002870182905560038701819055610d2060408d0160208e01615562565b86038760010160106101000a8154816001600160801b0302191690836001600160801b031602179055508b600001357f26f6a048ee9138f2c0ce266f322cb99228e8d619ae2bff30c67f8dcf9d2377b48d6020016020810190610d839190615562565b8d8d604051610d9493929190615afd565b60405180910390a2505050505050505050915091565b4715610dba57610dba3347613580565b565b6000836001600160a01b0316856001600160a01b031610610ddc57600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631698ee828686866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018262ffffff168152602001935050505060206040518083038186803b158015610e6757600080fd5b505afa158015610e7b573d6000803e3d6000fd5b505050506040513d6020811015610e9157600080fd5b505190506001600160a01b038116610fe0577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a16712958686866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018262ffffff1681526020019350505050602060405180830381600087803b158015610f3057600080fd5b505af1158015610f44573d6000803e3d6000fd5b505050506040513d6020811015610f5a57600080fd5b5051604080517ff637731d0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015291519293509083169163f637731d9160248082019260009290919082900301818387803b158015610fc357600080fd5b505af1158015610fd7573d6000803e3d6000fd5b505050506110c1565b6000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561101b57600080fd5b505afa15801561102f573d6000803e3d6000fd5b505050506040513d60e081101561104557600080fd5b505190506001600160a01b0381166110bf57816001600160a01b031663f637731d846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156110a657600080fd5b505af11580156110ba573d6000803e3d6000fd5b505050505b505b949350505050565b60006110d56002613689565b905090565b60008060008360a00135806110ed613377565b1115611140576040805162461bcd60e51b815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b84356000908152600c6020908152604080832060018082015469ffffffffffffffffffff81168652600b855283862084516060808201875282546001600160a01b039081168352929094015480831682890190815262ffffff600160a01b9092048216838901908152885161014081018a528451861681529151909416818a01529251168287015230828501526a01000000000000000000008304600290810b810b608080850191909152600160681b909404810b900b60a0830152958c013560c0820152938b013560e0850152908a0135610100840152890135610120830152929061122c90613694565b6001870154939a50919850965091506000906112669030906a01000000000000000000008104600290810b91600160681b9004900b613477565b9050600080836001600160a01b031663514ea4bf846040518263ffffffff1660e01b81526004016112979190615929565b60a06040518083038186803b1580156112af57600080fd5b505afa1580156112c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e791906155ac565b50509250925050611323866002015483038760010160109054906101000a90046001600160801b03166001600160801b0316600160801b6134d1565b6004870180546001600160801b0380821690930183166fffffffffffffffffffffffffffffffff19909116179055600387015460018801546113739291840391600160801b9182900416906134d1565b6004870180546001600160801b03600160801b80830482169094018116840291811691909117909155600288018490556003880183905560018801805483810483168e018316909302929091169190911790556040518b35907f3067048beee31b25b2f1681f88dac838c8bba36af25bfb2b7cf7473a5847e35f906113fd908d908d908d90615afd565b60405180910390a2505050505050509193909250565b61142461141e613253565b826132db565b61145f5760405162461bcd60e51b8152600401808060200182810382526031815260200180615f036031913960400191505060405180910390fd5b6109398383836138cf565b6001600160a01b038216600090815260016020526040812061148c9083613a1b565b90505b92915050565b7f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad81565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611526613a27565b3060405160200180868152602001858152602001848152602001838152602001826001600160a01b031681526020019550505050505060405160208183030381529060405280519060200120905090565b61093983838360405180602001604052806000815250612915565b8061159d33826132db565b6115b95760405162461bcd60e51b815260040161083390615984565b6000828152600c602052604090206001810154600160801b90046001600160801b03161580156115f4575060048101546001600160801b0316155b801561161257506004810154600160801b90046001600160801b0316155b61162e5760405162461bcd60e51b815260040161083390615a86565b6000838152600c602052604081208181556001810182905560028101829055600381018290556004015561093983613a2b565b604080517f8fcbaf0c00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052606481018690526001608482015260ff851660a482015260c4810184905260e4810183905290516001600160a01b03881691638fcbaf0c9161010480830192600092919082900301818387803b1580156116f457600080fd5b505af1158015611708573d6000803e3d6000fd5b50505050505050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561178357600080fd5b505afa158015611797573d6000803e3d6000fd5b505050506040513d60208110156117ad57600080fd5b5051905082811015611806576040805162461bcd60e51b815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b8015610939577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506109398282613580565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806118c6600284613af8565b509392505050565b600061148f82604051806060016040528060298152602001615e6e6029913960029190613b16565b606090565b60006001600160a01b0382166119425760405162461bcd60e51b815260040180806020018281038252602a815260200180615e44602a913960400191505060405180910390fd5b6001600160a01b038216600090815260016020526040902061148f90613689565b8361196c613377565b11156119bf576040805162461bcd60e51b815260206004820152600e60248201527f5065726d69742065787069726564000000000000000000000000000000000000604482015290519081900360640190fd5b60006119c96114b9565b7f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad88886119f581613b23565b604080516020808201969096526001600160a01b03909416848201526060840192909252608083015260a08083018a90528151808403909101815260c0830182528051908401207f190100000000000000000000000000000000000000000000000000000000000060e084015260e283019490945261010280830194909452805180830390940184526101229091019052815191012090506000611a98876118ce565b9050806001600160a01b0316886001600160a01b03161415611aeb5760405162461bcd60e51b8152600401808060200182810382526027815260200180615d6f6027913960400191505060405180910390fd5b611af481613b62565b15611ccf576040805160208082018790528183018690527fff0000000000000000000000000000000000000000000000000000000000000060f889901b16606083015282516041818403018152606183018085527f1626ba7e0000000000000000000000000000000000000000000000000000000090526065830186815260858401948552815160a585015281516001600160a01b03871695631626ba7e958995919260c59091019185019080838360005b83811015611bbe578181015183820152602001611ba6565b50505050905090810190601f168015611beb5780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b158015611c0957600080fd5b505afa158015611c1d573d6000803e3d6000fd5b505050506040513d6020811015611c3357600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f1626ba7e0000000000000000000000000000000000000000000000000000000014611cca576040805162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b611dfb565b600060018387878760405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611d2b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d93576040805162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e6174757265000000000000000000000000000000604482015290519081900360640190fd5b816001600160a01b0316816001600160a01b031614611df9576040805162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b505b611e058888613257565b5050505050505050565b60008060008084610140013580611e24613377565b1115611e77576040805162461bcd60e51b815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b604080516101408101909152600090611f439080611e9860208b018b6150af565b6001600160a01b03168152602001896020016020810190611eb991906150af565b6001600160a01b03168152602001611ed760608b0160408c0161569e565b62ffffff168152306020820152604001611ef760808b0160608c016153e6565b60020b8152602001611f0f60a08b0160808c016153e6565b60020b81526020018960a0013581526020018960c0013581526020018960e001358152602001896101000135815250613694565b92975090955093509050611fb7611f6261014089016101208a016150af565b600d80547fffffffffffffffffffff000000000000000000000000000000000000000000008116600175ffffffffffffffffffffffffffffffffffffffffffff92831690810190921617909155975087613b68565b6000611fe230611fcd60808b0160608c016153e6565b611fdd60a08c0160808d016153e6565b613477565b9050600080836001600160a01b031663514ea4bf846040518263ffffffff1660e01b81526004016120139190615929565b60a06040518083038186803b15801561202b57600080fd5b505afa15801561203f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206391906155ac565b5050925092505060006120dc8560405180606001604052808e600001602081019061208e91906150af565b6001600160a01b031681526020018e60200160208101906120af91906150af565b6001600160a01b031681526020018e60400160208101906120d0919061569e565b62ffffff169052613c96565b905060405180610140016040528060006bffffffffffffffffffffffff16815260200160006001600160a01b031681526020018269ffffffffffffffffffff1681526020018c606001602081019061213491906153e6565b60020b815260200161214c60a08e0160808f016153e6565b60020b81526020018a6001600160801b0316815260200184815260200183815260200160006001600160801b0316815260200160006001600160801b0316815250600c60008c815260200190815260200160002060008201518160000160006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550602082015181600001600c6101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a81548169ffffffffffffffffffff021916908369ffffffffffffffffffff160217905550606082015181600101600a6101000a81548162ffffff021916908360020b62ffffff160217905550608082015181600101600d6101000a81548162ffffff021916908360020b62ffffff16021790555060a08201518160010160106101000a8154816001600160801b0302191690836001600160801b0316021790555060c0820151816002015560e082015181600301556101008201518160040160006101000a8154816001600160801b0302191690836001600160801b031602179055506101208201518160040160106101000a8154816001600160801b0302191690836001600160801b03160217905550905050897f3067048beee31b25b2f1681f88dac838c8bba36af25bfb2b7cf7473a5847e35f8a8a8a60405161235b93929190615afd565b60405180910390a25050505050509193509193565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108025780601f106107d757610100808354040283529160200191610802565b6000818152600c6020908152604080832081516101408101835281546bffffffffffffffffffffffff811682526001600160a01b036c010000000000000000000000009091041693810193909352600181015469ffffffffffffffffffff81169284018390526a01000000000000000000008104600290810b810b810b6060860152600160681b8204810b810b810b60808601526001600160801b03600160801b92839004811660a08701529083015460c0860152600383015460e0860152600490920154808316610100860152041661012083015282918291829182918291829182918291829182918291906124da5760405162461bcd60e51b815260040161083390615a4f565b6000600b6000836040015169ffffffffffffffffffff1669ffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160149054906101000a900462ffffff1662ffffff1662ffffff1681525050905081600001518260200151826000015183602001518460400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001519d509d509d509d509d509d509d509d509d509d509d509d50505091939597999b5091939597999b565b612608613253565b6001600160a01b0316826001600160a01b0316141561266e576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b806005600061267b613253565b6001600160a01b0390811682526020808301939093526040918201600090812091871680825291909352912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016921515929092179091556126dd613253565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b604080517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201529051600019916001600160a01b0389169163dd62ed3e91604480820192602092909190829003018186803b15801561278d57600080fd5b505afa1580156127a1573d6000803e3d6000fd5b505050506040513d60208110156127b757600080fd5b505110156127cd576127cd868686868686611661565b505050505050565b60608167ffffffffffffffff811180156127ee57600080fd5b5060405190808252806020026020018201604052801561282257816020015b606081526020019060019003908161280d5790505b50905060005b8281101561290e576000803086868581811061284057fe5b90506020028101906128529190615bef565b6040516128609291906157d2565b600060405180830381855af49150503d806000811461289b576040519150601f19603f3d011682016040523d82523d6000602084013e6128a0565b606091505b5091509150816128ec576044815110156128b957600080fd5b600481019050808060200190518101906128d39190615402565b60405162461bcd60e51b81526004016108339190615971565b808484815181106128f957fe5b60209081029190910101525050600101612828565b5092915050565b612926612920613253565b836132db565b6129615760405162461bcd60e51b8152600401808060200182810382526031815260200180615f036031913960400191505060405180910390fd5b61296d84848484613de6565b50505050565b604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152905186916001600160a01b0389169163dd62ed3e91604480820192602092909190829003018186803b1580156129db57600080fd5b505afa1580156129ef573d6000803e3d6000fd5b505050506040513d6020811015612a0557600080fd5b505110156127cd576127cd868686868686612c9d565b7f000000000000000000000000000000000000000000000000000000000000000081565b6060612a4a82613246565b612a5357600080fd5b6040517fe9dc63750000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e9dc637590612aba9030908690600401615932565b60006040518083038186803b158015612ad257600080fd5b505afa158015612ae6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261148f9190810190615402565b6000612b1c828401846154a5565b9050612b4c7f00000000000000000000000000000000000000000000000000000000000000008260000151613e38565b508415612b67578051516020820151612b6791903388613e5b565b8315612b8557612b8581600001516020015182602001513387613e5b565b5050505050565b6000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612bdb57600080fd5b505afa158015612bef573d6000803e3d6000fd5b505050506040513d6020811015612c0557600080fd5b5051905082811015612c5e576040805162461bcd60e51b815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b801561296d5761296d848383613feb565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790526064810186905260ff8516608482015260a4810184905260c4810183905290516001600160a01b0388169163d505accf9160e480830192600092919082900301818387803b1580156116f457600080fd5b6000808235612d3733826132db565b612d535760405162461bcd60e51b815260040161083390615984565b6000612d656060860160408701615562565b6001600160801b03161180612d9257506000612d876080860160608701615562565b6001600160801b0316115b612d9b57600080fd5b600080612dae60408701602088016150af565b6001600160a01b031614612dd157612dcc60408601602087016150af565b612dd3565b305b85356000908152600c6020908152604080832060018082015469ffffffffffffffffffff168552600b8452828520835160608101855281546001600160a01b039081168252919092015490811694820194909452600160a01b90930462ffffff169183019190915292935090612e697f00000000000000000000000000000000000000000000000000000000000000008361337b565b600484015460018501549192506001600160801b0380821692600160801b92839004821692900416156130865760018501546040517fa34123a70000000000000000000000000000000000000000000000000000000081526001600160a01b0385169163a34123a791612f00916a01000000000000000000008104600290810b92600160681b909204900b9060009060040161594b565b6040805180830381600087803b158015612f1957600080fd5b505af1158015612f2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f5191906156f4565b5050600185015460009081906001600160a01b0386169063514ea4bf90612f969030906a01000000000000000000008104600290810b91600160681b9004900b613477565b6040518263ffffffff1660e01b8152600401612fb29190615929565b60a06040518083038186803b158015612fca57600080fd5b505afa158015612fde573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300291906155ac565b5050925092505061303e876002015483038860010160109054906101000a90046001600160801b03166001600160801b0316600160801b6134d1565b84019350613077876003015482038860010160109054906101000a90046001600160801b03166001600160801b0316600160801b6134d1565b60028801929092556003870155015b6000806001600160801b0384166130a360608e0160408f01615562565b6001600160801b0316116130c6576130c160608d0160408e01615562565b6130c8565b835b836001600160801b03168d60600160208101906130e59190615562565b6001600160801b0316116131085761310360808e0160608f01615562565b61310a565b835b60018901546040517f4f1eb3d80000000000000000000000000000000000000000000000000000000081529294509092506001600160a01b03871691634f1eb3d89161317d918c916a01000000000000000000008104600290810b92600160681b909204900b9088908890600401615839565b6040805180830381600087803b15801561319657600080fd5b505af11580156131aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ce919061557e565b6004890180546fffffffffffffffffffffffffffffffff196001600160801b03918216600160801b878a0384160217168689038216179091556040519281169d50169a508c35907f40d0efd1a53d60ecbf40971b9daf7dc90178c3aadc7aab1765632738fa8b8f0190610d94908b9086908690615876565b600061148f60028361417b565b3390565b6000818152600c6020526040902080546bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0385169081029190911790915581906132a2826118ce565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006132e682613246565b6133215760405162461bcd60e51b815260040180806020018281038252602c815260200180615de0602c913960400191505060405180910390fd5b600061332c836118ce565b9050806001600160a01b0316846001600160a01b031614806133675750836001600160a01b031661335c8461080c565b6001600160a01b0316145b806110c157506110c18185612c6f565b4290565b600081602001516001600160a01b031682600001516001600160a01b0316106133a357600080fd5b50805160208083015160409384015184516001600160a01b0394851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b6bffffffffffffffffffffffff191660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516bffffffffffffffffffffffff19606086901b16602080830191909152600285810b60e890811b60348501529085900b901b60378301528251601a818403018152603a90920190925280519101205b9392505050565b600080806000198587098686029250828110908390030390508061350757600084116134fc57600080fd5b5082900490506134ca565b80841161351357600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106135cc5780518252601f1990920191602091820191016135ad565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461362e576040519150601f19603f3d011682016040523d82523d6000602084013e613633565b606091505b5050905080610939576040805162461bcd60e51b815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600061148f82614187565b6000806000806000604051806060016040528087600001516001600160a01b0316815260200187602001516001600160a01b03168152602001876040015162ffffff1681525090506137067f00000000000000000000000000000000000000000000000000000000000000008261337b565b91506000826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561374357600080fd5b505afa158015613757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377b919061560d565b50505050505090506000613792886080015161418b565b905060006137a38960a0015161418b565b90506137ba8383838c60c001518d60e001516144d9565b9750505050816001600160a01b0316633c8a7d8d876060015188608001518960a00151896040518060400160405280888152602001336001600160a01b031681525060405160200161380c9190615abd565b6040516020818303038152906040526040518663ffffffff1660e01b815260040161383b9594939291906157f6565b6040805180830381600087803b15801561385457600080fd5b505af1158015613868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061388c91906156f4565b610100880151919550935084108015906138ab57508561012001518310155b6138c75760405162461bcd60e51b815260040161083390615a18565b509193509193565b826001600160a01b03166138e2826118ce565b6001600160a01b0316146139275760405162461bcd60e51b8152600401808060200182810382526029815260200180615eb96029913960400191505060405180910390fd5b6001600160a01b03821661396c5760405162461bcd60e51b8152600401808060200182810382526024815260200180615d966024913960400191505060405180910390fd5b613977838383610939565b613982600082613257565b6001600160a01b03831660009081526001602052604090206139a4908261459d565b506001600160a01b03821660009081526001602052604090206139c790826145a9565b506139d4600282846145b5565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600061148c83836145cb565b4690565b6000613a36826118ce565b9050613a4481600084610939565b613a4f600083613257565b6000828152600860205260409020546002600019610100600184161502019091160415613a8d576000828152600860205260408120613a8d9161501f565b6001600160a01b0381166000908152600160205260409020613aaf908361459d565b50613abb60028361462f565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000808080613b07868661463b565b909450925050505b9250929050565b60006110c18484846146b6565b6000908152600c6020526040902080546bffffffffffffffffffffffff19811660016bffffffffffffffffffffffff9283169081019092161790915590565b3b151590565b6001600160a01b038216613bc3576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b613bcc81613246565b15613c1e576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b613c2a60008383610939565b6001600160a01b0382166000908152600160205260409020613c4c90826145a9565b50613c59600282846145b5565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b0382166000908152600a602052604090205469ffffffffffffffffffff168061148f5750600d8054600169ffffffffffffffffffff76010000000000000000000000000000000000000000000080840482168381019092160275ffffffffffffffffffffffffffffffffffffffffffff909316929092179092556001600160a01b038085166000908152600a6020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffff000000000000000000001686179055848352600b825291829020865181549085167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617825591870151950180549287015162ffffff16600160a01b027fffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffff969094169290911691909117939093161790915592915050565b613df18484846138cf565b613dfd84848484614780565b61296d5760405162461bcd60e51b8152600401808060200182810382526032815260200180615d3d6032913960400191505060405180910390fd5b6000613e44838361337b565b9050336001600160a01b0382161461148f57600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316148015613e9c5750804710155b15613fbe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613efc57600080fd5b505af1158015613f10573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015613f8c57600080fd5b505af1158015613fa0573d6000803e3d6000fd5b505050506040513d6020811015613fb657600080fd5b5061296d9050565b6001600160a01b038316301415613fdf57613fda848383613feb565b61296d565b61296d8484848461495c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b602083106140955780518252601f199092019160209182019101614076565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146140f7576040519150601f19603f3d011682016040523d82523d6000602084013e6140fc565b606091505b509150915081801561412a57508051158061412a575080806020019051602081101561412757600080fd5b50515b612b85576040805162461bcd60e51b815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600061148c8383614af4565b5490565b60008060008360020b126141a2578260020b6141aa565b8260020b6000035b9050620d89e8811115614204576040805162461bcd60e51b815260206004820152600160248201527f5400000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60006001821661421857600160801b61422a565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561425e576ffff97272373d413259a46990580e213a0260801c5b600482161561427d576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b600882161561429c576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156142bb576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156142da576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156142f9576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615614318576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615614338576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615614358576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615614378576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615614398576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156143b8576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156143d8576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156143f8576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615614418576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615614439576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615614459576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615614478576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615614495576b048a170391f7dc42444e8fa20260801c5b60008460020b13156144b05780600019816144ac57fe5b0490505b6401000000008106156144c45760016144c7565b60005b60ff16602082901c0192505050919050565b6000836001600160a01b0316856001600160a01b031611156144f9579293925b846001600160a01b0316866001600160a01b0316116145245761451d858585614b0c565b9050614594565b836001600160a01b0316866001600160a01b0316101561458657600061454b878686614b0c565b9050600061455a878986614b78565b9050806001600160801b0316826001600160801b03161061457b578061457d565b815b92505050614594565b614591858584614b78565b90505b95945050505050565b600061148c8383614bbe565b600061148c8383614c84565b60006110c184846001600160a01b038516614cce565b8154600090821061460d5760405162461bcd60e51b8152600401808060200182810382526022815260200180615d1b6022913960400191505060405180910390fd5b82600001828154811061461c57fe5b9060005260206000200154905092915050565b600061148c8383614d65565b81546000908190831061467f5760405162461bcd60e51b8152600401808060200182810382526022815260200180615e976022913960400191505060405180910390fd5b600084600001848154811061469057fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816147515760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156147165781810151838201526020016146fe565b50505050905090810190601f1680156147435780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061476457fe5b9060005260206000209060020201600101549150509392505050565b6000614794846001600160a01b0316613b62565b6147a0575060016110c1565b60006148f17f150b7a02000000000000000000000000000000000000000000000000000000006147ce613253565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561483557818101518382015260200161481d565b50505050905090810190601f1680156148625780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001615d3d603291396001600160a01b0388169190614e39565b9050600081806020019051602081101561490a57600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001492505050949350505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b60208310614a0e5780518252601f1990920191602091820191016149ef565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614a70576040519150601f19603f3d011682016040523d82523d6000602084013e614a75565b606091505b5091509150818015614aa3575080511580614aa35750808060200190516020811015614aa057600080fd5b50515b6127cd576040805162461bcd60e51b815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60009081526001919091016020526040902054151590565b6000826001600160a01b0316846001600160a01b03161115614b2c579192915b6000614b58856001600160a01b0316856001600160a01b03166c010000000000000000000000006134d1565b9050614594614b7384838888036001600160a01b03166134d1565b614e48565b6000826001600160a01b0316846001600160a01b03161115614b98579192915b6110c1614b73836c010000000000000000000000008787036001600160a01b03166134d1565b60008181526001830160205260408120548015614c7a5783546000198083019190810190600090879083908110614bf157fe5b9060005260206000200154905080876000018481548110614c0e57fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080614c3e57fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061148f565b600091505061148f565b6000614c908383614af4565b614cc65750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561148f565b50600061148f565b600082815260018401602052604081205480614d335750506040805180820182528381526020808201848152865460018181018955600089815284812095516002909302909501918255915190820155865486845281880190925292909120556134ca565b82856000016001830381548110614d4657fe5b90600052602060002090600202016001018190555060009150506134ca565b60008181526001830160205260408120548015614c7a5783546000198083019190810190600090879083908110614d9857fe5b9060005260206000209060020201905080876000018481548110614db857fe5b600091825260208083208454600290930201918255600193840154918401919091558354825289830190526040902090840190558654879080614df757fe5b600082815260208082206002600019909401938402018281556001908101839055929093558881528982019092526040822091909155945061148f9350505050565b60606110c18484600085614e5e565b806001600160801b038116811461077157600080fd5b606082471015614e9f5760405162461bcd60e51b8152600401808060200182810382526026815260200180615dba6026913960400191505060405180910390fd5b614ea885613b62565b614ef9576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310614f375780518252601f199092019160209182019101614f18565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614f99576040519150601f19603f3d011682016040523d82523d6000602084013e614f9e565b606091505b5091509150614fae828286614fb9565b979650505050505050565b60608315614fc85750816134ca565b825115614fd85782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156147165781810151838201526020016146fe565b50805460018160011615610100020316600290046000825580601f106150455750615063565b601f0160209004906000526020600020908101906150639190615066565b50565b5b8082111561507b5760008155600101615067565b5090565b803561077181615cc4565b805161ffff8116811461077157600080fd5b803562ffffff8116811461077157600080fd5b6000602082840312156150c0578081fd5b81356134ca81615cc4565b600080604083850312156150dd578081fd5b82356150e881615cc4565b915060208301356150f881615cc4565b809150509250929050565b60008060008060808587031215615118578182fd5b843561512381615cc4565b9350602085013561513381615cc4565b92506151416040860161509c565b9150606085013561515181615cc4565b939692955090935050565b600080600060608486031215615170578081fd5b833561517b81615cc4565b9250602084013561518b81615cc4565b929592945050506040919091013590565b600080600080608085870312156151b1578182fd5b84356151bc81615cc4565b935060208501356151cc81615cc4565b925060408501359150606085013567ffffffffffffffff8111156151ee578182fd5b8501601f810187136151fe578182fd5b803561521161520c82615c76565b615c52565b818152886020838501011115615225578384fd5b81602084016020830137908101602001929092525092959194509250565b60008060408385031215615255578182fd5b823561526081615cc4565b915060208301356150f881615cd9565b60008060408385031215615282578182fd5b823561528d81615cc4565b946020939093013593505050565b6000806000606084860312156152af578081fd5b83356152ba81615cc4565b92506020840135915060408401356152d181615cc4565b809150509250925092565b60008060008060008060c087890312156152f4578384fd5b86356152ff81615cc4565b95506020870135945060408701359350606087013561531d81615d0b565b9598949750929560808101359460a0909101359350915050565b60008060208385031215615349578182fd5b823567ffffffffffffffff80821115615360578384fd5b818501915085601f830112615373578384fd5b813581811115615381578485fd5b8660208083028501011115615394578485fd5b60209290920196919550909350505050565b6000602082840312156153b7578081fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146134ca578182fd5b6000602082840312156153f7578081fd5b81356134ca81615ce7565b600060208284031215615413578081fd5b815167ffffffffffffffff811115615429578182fd5b8201601f81018413615439578182fd5b805161544761520c82615c76565b81815285602083850101111561545b578384fd5b614594826020830160208601615c98565b60006080828403121561547d578081fd5b50919050565b600060a0828403121561547d578081fd5b600060c0828403121561547d578081fd5b600081830360808112156154b7578182fd5b6040516040810167ffffffffffffffff82821081831117156154d557fe5b8160405260608412156154e6578485fd5b60a08301935081841081851117156154fa57fe5b50826040528435925061550c83615cc4565b91825260208401359161551e83615cc4565b8260608301526155306040860161509c565b608083015281526155436060850161507f565b6020820152949350505050565b6000610160828403121561547d578081fd5b600060208284031215615573578081fd5b81356134ca81615cf6565b60008060408385031215615590578182fd5b825161559b81615cf6565b60208401519092506150f881615cf6565b600080600080600060a086880312156155c3578283fd5b85516155ce81615cf6565b80955050602086015193506040860151925060608601516155ee81615cf6565b60808701519092506155ff81615cf6565b809150509295509295909350565b600080600080600080600060e0888a031215615627578485fd5b875161563281615cc4565b602089015190975061564381615ce7565b95506156516040890161508a565b945061565f6060890161508a565b935061566d6080890161508a565b925060a088015161567d81615d0b565b60c089015190925061568e81615cd9565b8091505092959891949750929550565b6000602082840312156156af578081fd5b61148c8261509c565b6000602082840312156156c9578081fd5b5035919050565b600080604083850312156156e2578182fd5b8235915060208301356150f881615cc4565b60008060408385031215615706578182fd5b505080516020909101519092909150565b6000806000806060858703121561572c578182fd5b8435935060208501359250604085013567ffffffffffffffff80821115615751578384fd5b818701915087601f830112615764578384fd5b813581811115615772578485fd5b886020828501011115615783578485fd5b95989497505060200194505050565b600081518084526157aa816020860160208601615c98565b601f01601f19169290920160200192915050565b60020b9052565b6001600160801b03169052565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b60006001600160a01b03871682528560020b60208301528460020b60408301526001600160801b038416606083015260a06080830152614fae60a0830184615792565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b6001600160a01b039390931683526001600160801b03918216602084015216604082015260600190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015615911577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526158ff858351615792565b945092850192908501906001016158c5565b5092979650505050505050565b901515815260200190565b90815260200190565b6001600160a01b03929092168252602082015260400190565b600293840b81529190920b60208201526001600160801b03909116604082015260600190565b60006020825261148c6020830184615792565b6020808252600c908201527f4e6f7420617070726f7665640000000000000000000000000000000000000000604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201527f697374656e7420746f6b656e0000000000000000000000000000000000000000606082015260800190565b60208082526014908201527f507269636520736c69707061676520636865636b000000000000000000000000604082015260600190565b60208082526010908201527f496e76616c696420746f6b656e20494400000000000000000000000000000000604082015260600190565b6020808252600b908201527f4e6f7420636c6561726564000000000000000000000000000000000000000000604082015260600190565b815180516001600160a01b03908116835260208083015182168185015260409283015162ffffff1692840192909252920151909116606082015260800190565b6001600160801b039390931683526020830191909152604082015260600190565b9384526001600160801b039290921660208401526040830152606082015260800190565b918252602082015260400190565b6bffffffffffffffffffffffff8d1681526001600160a01b038c811660208301528b811660408301528a16606082015262ffffff89166080820152600288900b60a08201526101808101615ba760c08301896157be565b615bb460e08301886157c5565b8561010083015284610120830152615bd06101408301856157c5565b615bde6101608301846157c5565b9d9c50505050505050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112615c23578283fd5b83018035915067ffffffffffffffff821115615c3d578283fd5b602001915036819003821315613b0f57600080fd5b60405181810167ffffffffffffffff81118282101715615c6e57fe5b604052919050565b600067ffffffffffffffff821115615c8a57fe5b50601f01601f191660200190565b60005b83811015615cb3578181015183820152602001615c9b565b8381111561296d5750506000910152565b6001600160a01b038116811461506357600080fd5b801515811461506357600080fd5b8060020b811461506357600080fd5b6001600160801b038116811461506357600080fd5b60ff8116811461506357600080fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732315065726d69743a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e7366657220746f20746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a164736f6c6343000706000a", + deployedBytecode: "0x6080604052600436106102895760003560e01c80636352211e11610153578063ac9650d8116100cb578063d34879971161007f578063e985e9c511610064578063e985e9c5146106f5578063f3995c6714610715578063fc6f7865146107285761030d565b8063d3487997146106c2578063df2ab5bb146106e25761030d565b8063c2e3140a116100b0578063c2e3140a1461067a578063c45a01551461068d578063c87b56dd146106a25761030d565b8063ac9650d81461063a578063b88d4fde1461065a5761030d565b8063883164561161012257806399fbab881161010757806399fbab88146105cf578063a22cb46514610607578063a4a78f0c146106275761030d565b8063883164561461059757806395d89b41146105ba5761030d565b80636352211e1461052f5780636c0360eb1461054f57806370a08231146105645780637ac2ff7b146105845761030d565b806323b872dd1161020157806342966c68116101b557806349404b7c1161019a57806349404b7c146104e75780634aa4a4fc146104fa5780634f6ccce71461050f5761030d565b806342966c68146104c15780634659a494146104d45761030d565b806330adf81f116101e657806330adf81f146104775780633644e5151461048c57806342842e0e146104a15761030d565b806323b872dd146104375780632f745c59146104575761030d565b80630c49ccbe1161025857806313ead5621161023d57806313ead562146103e057806318160ddd146103f3578063219f5d17146104155761030d565b80630c49ccbe146103b757806312210e8a146103d85761030d565b806301ffc9a71461031257806306fdde0314610348578063081812fc1461036a578063095ea7b3146103975761030d565b3661030d57336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461030b576040805162461bcd60e51b815260206004820152600960248201527f4e6f742057455448390000000000000000000000000000000000000000000000604482015290519081900360640190fd5b005b600080fd5b34801561031e57600080fd5b5061033261032d3660046153a6565b61073b565b60405161033f919061591e565b60405180910390f35b34801561035457600080fd5b5061035d610776565b60405161033f9190615971565b34801561037657600080fd5b5061038a6103853660046156b8565b61080c565b60405161033f91906157e2565b3480156103a357600080fd5b5061030b6103b2366004615270565b610868565b6103ca6103c5366004615483565b61093e565b60405161033f929190615b42565b61030b610daa565b61038a6103ee366004615103565b610dbc565b3480156103ff57600080fd5b506104086110c9565b60405161033f9190615929565b610428610423366004615494565b6110da565b60405161033f93929190615afd565b34801561044357600080fd5b5061030b61045236600461515c565b611413565b34801561046357600080fd5b50610408610472366004615270565b61146a565b34801561048357600080fd5b50610408611495565b34801561049857600080fd5b506104086114b9565b3480156104ad57600080fd5b5061030b6104bc36600461515c565b611577565b61030b6104cf3660046156b8565b611592565b61030b6104e23660046152dc565b611661565b61030b6104f53660046156d0565b611714565b34801561050657600080fd5b5061038a611894565b34801561051b57600080fd5b5061040861052a3660046156b8565b6118b8565b34801561053b57600080fd5b5061038a61054a3660046156b8565b6118ce565b34801561055b57600080fd5b5061035d6118f6565b34801561057057600080fd5b5061040861057f3660046150af565b6118fb565b61030b6105923660046152dc565b611963565b6105aa6105a5366004615550565b611e0f565b60405161033f9493929190615b1e565b3480156105c657600080fd5b5061035d612370565b3480156105db57600080fd5b506105ef6105ea3660046156b8565b6123d1565b60405161033f9c9b9a99989796959493929190615b50565b34801561061357600080fd5b5061030b610622366004615243565b612600565b61030b6106353660046152dc565b612723565b61064d610648366004615337565b6127d5565b60405161033f91906158a0565b34801561066657600080fd5b5061030b61067536600461519c565b612915565b61030b6106883660046152dc565b612973565b34801561069957600080fd5b5061038a612a1b565b3480156106ae57600080fd5b5061035d6106bd3660046156b8565b612a3f565b3480156106ce57600080fd5b5061030b6106dd366004615717565b612b0e565b61030b6106f036600461529b565b612b8c565b34801561070157600080fd5b506103326107103660046150cb565b612c6f565b61030b6107233660046152dc565b612c9d565b6103ca61073636600461546c565b612d28565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108025780601f106107d757610100808354040283529160200191610802565b820191906000526020600020905b8154815290600101906020018083116107e557829003601f168201915b5050505050905090565b600061081782613246565b61083c5760405162461bcd60e51b8152600401610833906159bb565b60405180910390fd5b506000908152600c60205260409020546c0100000000000000000000000090046001600160a01b031690565b6000610873826118ce565b9050806001600160a01b0316836001600160a01b031614156108c65760405162461bcd60e51b8152600401808060200182810382526021815260200180615ee26021913960400191505060405180910390fd5b806001600160a01b03166108d8613253565b6001600160a01b031614806108f457506108f481610710613253565b61092f5760405162461bcd60e51b8152600401808060200182810382526038815260200180615e0c6038913960400191505060405180910390fd5b6109398383613257565b505050565b600080823561094d33826132db565b6109695760405162461bcd60e51b815260040161083390615984565b836080013580610977613377565b11156109ca576040805162461bcd60e51b815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b60006109dc6040870160208801615562565b6001600160801b0316116109ef57600080fd5b84356000908152600c602090815260409182902060018101549092600160801b9091046001600160801b031691610a2a918901908901615562565b6001600160801b0316816001600160801b03161015610a4857600080fd5b60018281015469ffffffffffffffffffff166000908152600b60209081526040808320815160608101835281546001600160a01b039081168252919095015490811692850192909252600160a01b90910462ffffff1690830152610acc7f00000000000000000000000000000000000000000000000000000000000000008361337b565b60018501549091506001600160a01b0382169063a34123a7906a01000000000000000000008104600290810b91600160681b9004900b610b1260408e0160208f01615562565b6040518463ffffffff1660e01b8152600401610b309392919061594b565b6040805180830381600087803b158015610b4957600080fd5b505af1158015610b5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b8191906156f4565b909850965060408901358810801590610b9e575088606001358710155b610bba5760405162461bcd60e51b815260040161083390615a18565b6001840154600090610bea9030906a01000000000000000000008104600290810b91600160681b9004900b613477565b9050600080836001600160a01b031663514ea4bf846040518263ffffffff1660e01b8152600401610c1b9190615929565b60a06040518083038186803b158015610c3357600080fd5b505afa158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b91906155ac565b50509250925050610c9087600201548303876001600160801b0316600160801b6134d1565b6004880180546fffffffffffffffffffffffffffffffff198116928e016001600160801b039182160181169290921790556003880154610cda91908303908816600160801b6134d1565b6004880180546001600160801b03808216938e01600160801b9283900482160116029190911790556002870182905560038701819055610d2060408d0160208e01615562565b86038760010160106101000a8154816001600160801b0302191690836001600160801b031602179055508b600001357f26f6a048ee9138f2c0ce266f322cb99228e8d619ae2bff30c67f8dcf9d2377b48d6020016020810190610d839190615562565b8d8d604051610d9493929190615afd565b60405180910390a2505050505050505050915091565b4715610dba57610dba3347613580565b565b6000836001600160a01b0316856001600160a01b031610610ddc57600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631698ee828686866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018262ffffff168152602001935050505060206040518083038186803b158015610e6757600080fd5b505afa158015610e7b573d6000803e3d6000fd5b505050506040513d6020811015610e9157600080fd5b505190506001600160a01b038116610fe0577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a16712958686866040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018262ffffff1681526020019350505050602060405180830381600087803b158015610f3057600080fd5b505af1158015610f44573d6000803e3d6000fd5b505050506040513d6020811015610f5a57600080fd5b5051604080517ff637731d0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015291519293509083169163f637731d9160248082019260009290919082900301818387803b158015610fc357600080fd5b505af1158015610fd7573d6000803e3d6000fd5b505050506110c1565b6000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561101b57600080fd5b505afa15801561102f573d6000803e3d6000fd5b505050506040513d60e081101561104557600080fd5b505190506001600160a01b0381166110bf57816001600160a01b031663f637731d846040518263ffffffff1660e01b815260040180826001600160a01b03168152602001915050600060405180830381600087803b1580156110a657600080fd5b505af11580156110ba573d6000803e3d6000fd5b505050505b505b949350505050565b60006110d56002613689565b905090565b60008060008360a00135806110ed613377565b1115611140576040805162461bcd60e51b815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b84356000908152600c6020908152604080832060018082015469ffffffffffffffffffff81168652600b855283862084516060808201875282546001600160a01b039081168352929094015480831682890190815262ffffff600160a01b9092048216838901908152885161014081018a528451861681529151909416818a01529251168287015230828501526a01000000000000000000008304600290810b810b608080850191909152600160681b909404810b900b60a0830152958c013560c0820152938b013560e0850152908a0135610100840152890135610120830152929061122c90613694565b6001870154939a50919850965091506000906112669030906a01000000000000000000008104600290810b91600160681b9004900b613477565b9050600080836001600160a01b031663514ea4bf846040518263ffffffff1660e01b81526004016112979190615929565b60a06040518083038186803b1580156112af57600080fd5b505afa1580156112c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112e791906155ac565b50509250925050611323866002015483038760010160109054906101000a90046001600160801b03166001600160801b0316600160801b6134d1565b6004870180546001600160801b0380821690930183166fffffffffffffffffffffffffffffffff19909116179055600387015460018801546113739291840391600160801b9182900416906134d1565b6004870180546001600160801b03600160801b80830482169094018116840291811691909117909155600288018490556003880183905560018801805483810483168e018316909302929091169190911790556040518b35907f3067048beee31b25b2f1681f88dac838c8bba36af25bfb2b7cf7473a5847e35f906113fd908d908d908d90615afd565b60405180910390a2505050505050509193909250565b61142461141e613253565b826132db565b61145f5760405162461bcd60e51b8152600401808060200182810382526031815260200180615f036031913960400191505060405180910390fd5b6109398383836138cf565b6001600160a01b038216600090815260016020526040812061148c9083613a1b565b90505b92915050565b7f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad81565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000611526613a27565b3060405160200180868152602001858152602001848152602001838152602001826001600160a01b031681526020019550505050505060405160208183030381529060405280519060200120905090565b61093983838360405180602001604052806000815250612915565b8061159d33826132db565b6115b95760405162461bcd60e51b815260040161083390615984565b6000828152600c602052604090206001810154600160801b90046001600160801b03161580156115f4575060048101546001600160801b0316155b801561161257506004810154600160801b90046001600160801b0316155b61162e5760405162461bcd60e51b815260040161083390615a86565b6000838152600c602052604081208181556001810182905560028101829055600381018290556004015561093983613a2b565b604080517f8fcbaf0c00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052606481018690526001608482015260ff851660a482015260c4810184905260e4810183905290516001600160a01b03881691638fcbaf0c9161010480830192600092919082900301818387803b1580156116f457600080fd5b505af1158015611708573d6000803e3d6000fd5b50505050505050505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561178357600080fd5b505afa158015611797573d6000803e3d6000fd5b505050506040513d60208110156117ad57600080fd5b5051905082811015611806576040805162461bcd60e51b815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b8015610939577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561187257600080fd5b505af1158015611886573d6000803e3d6000fd5b505050506109398282613580565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000806118c6600284613af8565b509392505050565b600061148f82604051806060016040528060298152602001615e6e6029913960029190613b16565b606090565b60006001600160a01b0382166119425760405162461bcd60e51b815260040180806020018281038252602a815260200180615e44602a913960400191505060405180910390fd5b6001600160a01b038216600090815260016020526040902061148f90613689565b8361196c613377565b11156119bf576040805162461bcd60e51b815260206004820152600e60248201527f5065726d69742065787069726564000000000000000000000000000000000000604482015290519081900360640190fd5b60006119c96114b9565b7f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad88886119f581613b23565b604080516020808201969096526001600160a01b03909416848201526060840192909252608083015260a08083018a90528151808403909101815260c0830182528051908401207f190100000000000000000000000000000000000000000000000000000000000060e084015260e283019490945261010280830194909452805180830390940184526101229091019052815191012090506000611a98876118ce565b9050806001600160a01b0316886001600160a01b03161415611aeb5760405162461bcd60e51b8152600401808060200182810382526027815260200180615d6f6027913960400191505060405180910390fd5b611af481613b62565b15611ccf576040805160208082018790528183018690527fff0000000000000000000000000000000000000000000000000000000000000060f889901b16606083015282516041818403018152606183018085527f1626ba7e0000000000000000000000000000000000000000000000000000000090526065830186815260858401948552815160a585015281516001600160a01b03871695631626ba7e958995919260c59091019185019080838360005b83811015611bbe578181015183820152602001611ba6565b50505050905090810190601f168015611beb5780820380516001836020036101000a031916815260200191505b50935050505060206040518083038186803b158015611c0957600080fd5b505afa158015611c1d573d6000803e3d6000fd5b505050506040513d6020811015611c3357600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f1626ba7e0000000000000000000000000000000000000000000000000000000014611cca576040805162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b611dfb565b600060018387878760405160008152602001604052604051808581526020018460ff1681526020018381526020018281526020019450505050506020604051602081039080840390855afa158015611d2b573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611d93576040805162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e6174757265000000000000000000000000000000604482015290519081900360640190fd5b816001600160a01b0316816001600160a01b031614611df9576040805162461bcd60e51b815260206004820152600c60248201527f556e617574686f72697a65640000000000000000000000000000000000000000604482015290519081900360640190fd5b505b611e058888613257565b5050505050505050565b60008060008084610140013580611e24613377565b1115611e77576040805162461bcd60e51b815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b604080516101408101909152600090611f439080611e9860208b018b6150af565b6001600160a01b03168152602001896020016020810190611eb991906150af565b6001600160a01b03168152602001611ed760608b0160408c0161569e565b62ffffff168152306020820152604001611ef760808b0160608c016153e6565b60020b8152602001611f0f60a08b0160808c016153e6565b60020b81526020018960a0013581526020018960c0013581526020018960e001358152602001896101000135815250613694565b92975090955093509050611fb7611f6261014089016101208a016150af565b600d80547fffffffffffffffffffff000000000000000000000000000000000000000000008116600175ffffffffffffffffffffffffffffffffffffffffffff92831690810190921617909155975087613b68565b6000611fe230611fcd60808b0160608c016153e6565b611fdd60a08c0160808d016153e6565b613477565b9050600080836001600160a01b031663514ea4bf846040518263ffffffff1660e01b81526004016120139190615929565b60a06040518083038186803b15801561202b57600080fd5b505afa15801561203f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206391906155ac565b5050925092505060006120dc8560405180606001604052808e600001602081019061208e91906150af565b6001600160a01b031681526020018e60200160208101906120af91906150af565b6001600160a01b031681526020018e60400160208101906120d0919061569e565b62ffffff169052613c96565b905060405180610140016040528060006bffffffffffffffffffffffff16815260200160006001600160a01b031681526020018269ffffffffffffffffffff1681526020018c606001602081019061213491906153e6565b60020b815260200161214c60a08e0160808f016153e6565b60020b81526020018a6001600160801b0316815260200184815260200183815260200160006001600160801b0316815260200160006001600160801b0316815250600c60008c815260200190815260200160002060008201518160000160006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff160217905550602082015181600001600c6101000a8154816001600160a01b0302191690836001600160a01b0316021790555060408201518160010160006101000a81548169ffffffffffffffffffff021916908369ffffffffffffffffffff160217905550606082015181600101600a6101000a81548162ffffff021916908360020b62ffffff160217905550608082015181600101600d6101000a81548162ffffff021916908360020b62ffffff16021790555060a08201518160010160106101000a8154816001600160801b0302191690836001600160801b0316021790555060c0820151816002015560e082015181600301556101008201518160040160006101000a8154816001600160801b0302191690836001600160801b031602179055506101208201518160040160106101000a8154816001600160801b0302191690836001600160801b03160217905550905050897f3067048beee31b25b2f1681f88dac838c8bba36af25bfb2b7cf7473a5847e35f8a8a8a60405161235b93929190615afd565b60405180910390a25050505050509193509193565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108025780601f106107d757610100808354040283529160200191610802565b6000818152600c6020908152604080832081516101408101835281546bffffffffffffffffffffffff811682526001600160a01b036c010000000000000000000000009091041693810193909352600181015469ffffffffffffffffffff81169284018390526a01000000000000000000008104600290810b810b810b6060860152600160681b8204810b810b810b60808601526001600160801b03600160801b92839004811660a08701529083015460c0860152600383015460e0860152600490920154808316610100860152041661012083015282918291829182918291829182918291829182918291906124da5760405162461bcd60e51b815260040161083390615a4f565b6000600b6000836040015169ffffffffffffffffffff1669ffffffffffffffffffff1681526020019081526020016000206040518060600160405290816000820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020016001820160149054906101000a900462ffffff1662ffffff1662ffffff1681525050905081600001518260200151826000015183602001518460400151866060015187608001518860a001518960c001518a60e001518b61010001518c61012001519d509d509d509d509d509d509d509d509d509d509d509d50505091939597999b5091939597999b565b612608613253565b6001600160a01b0316826001600160a01b0316141561266e576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b806005600061267b613253565b6001600160a01b0390811682526020808301939093526040918201600090812091871680825291909352912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016921515929092179091556126dd613253565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b604080517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201529051600019916001600160a01b0389169163dd62ed3e91604480820192602092909190829003018186803b15801561278d57600080fd5b505afa1580156127a1573d6000803e3d6000fd5b505050506040513d60208110156127b757600080fd5b505110156127cd576127cd868686868686611661565b505050505050565b60608167ffffffffffffffff811180156127ee57600080fd5b5060405190808252806020026020018201604052801561282257816020015b606081526020019060019003908161280d5790505b50905060005b8281101561290e576000803086868581811061284057fe5b90506020028101906128529190615bef565b6040516128609291906157d2565b600060405180830381855af49150503d806000811461289b576040519150601f19603f3d011682016040523d82523d6000602084013e6128a0565b606091505b5091509150816128ec576044815110156128b957600080fd5b600481019050808060200190518101906128d39190615402565b60405162461bcd60e51b81526004016108339190615971565b808484815181106128f957fe5b60209081029190910101525050600101612828565b5092915050565b612926612920613253565b836132db565b6129615760405162461bcd60e51b8152600401808060200182810382526031815260200180615f036031913960400191505060405180910390fd5b61296d84848484613de6565b50505050565b604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152336004820152306024820152905186916001600160a01b0389169163dd62ed3e91604480820192602092909190829003018186803b1580156129db57600080fd5b505afa1580156129ef573d6000803e3d6000fd5b505050506040513d6020811015612a0557600080fd5b505110156127cd576127cd868686868686612c9d565b7f000000000000000000000000000000000000000000000000000000000000000081565b6060612a4a82613246565b612a5357600080fd5b6040517fe9dc63750000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e9dc637590612aba9030908690600401615932565b60006040518083038186803b158015612ad257600080fd5b505afa158015612ae6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261148f9190810190615402565b6000612b1c828401846154a5565b9050612b4c7f00000000000000000000000000000000000000000000000000000000000000008260000151613e38565b508415612b67578051516020820151612b6791903388613e5b565b8315612b8557612b8581600001516020015182602001513387613e5b565b5050505050565b6000836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015612bdb57600080fd5b505afa158015612bef573d6000803e3d6000fd5b505050506040513d6020811015612c0557600080fd5b5051905082811015612c5e576040805162461bcd60e51b815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b801561296d5761296d848383613feb565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790526064810186905260ff8516608482015260a4810184905260c4810183905290516001600160a01b0388169163d505accf9160e480830192600092919082900301818387803b1580156116f457600080fd5b6000808235612d3733826132db565b612d535760405162461bcd60e51b815260040161083390615984565b6000612d656060860160408701615562565b6001600160801b03161180612d9257506000612d876080860160608701615562565b6001600160801b0316115b612d9b57600080fd5b600080612dae60408701602088016150af565b6001600160a01b031614612dd157612dcc60408601602087016150af565b612dd3565b305b85356000908152600c6020908152604080832060018082015469ffffffffffffffffffff168552600b8452828520835160608101855281546001600160a01b039081168252919092015490811694820194909452600160a01b90930462ffffff169183019190915292935090612e697f00000000000000000000000000000000000000000000000000000000000000008361337b565b600484015460018501549192506001600160801b0380821692600160801b92839004821692900416156130865760018501546040517fa34123a70000000000000000000000000000000000000000000000000000000081526001600160a01b0385169163a34123a791612f00916a01000000000000000000008104600290810b92600160681b909204900b9060009060040161594b565b6040805180830381600087803b158015612f1957600080fd5b505af1158015612f2d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f5191906156f4565b5050600185015460009081906001600160a01b0386169063514ea4bf90612f969030906a01000000000000000000008104600290810b91600160681b9004900b613477565b6040518263ffffffff1660e01b8152600401612fb29190615929565b60a06040518083038186803b158015612fca57600080fd5b505afa158015612fde573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061300291906155ac565b5050925092505061303e876002015483038860010160109054906101000a90046001600160801b03166001600160801b0316600160801b6134d1565b84019350613077876003015482038860010160109054906101000a90046001600160801b03166001600160801b0316600160801b6134d1565b60028801929092556003870155015b6000806001600160801b0384166130a360608e0160408f01615562565b6001600160801b0316116130c6576130c160608d0160408e01615562565b6130c8565b835b836001600160801b03168d60600160208101906130e59190615562565b6001600160801b0316116131085761310360808e0160608f01615562565b61310a565b835b60018901546040517f4f1eb3d80000000000000000000000000000000000000000000000000000000081529294509092506001600160a01b03871691634f1eb3d89161317d918c916a01000000000000000000008104600290810b92600160681b909204900b9088908890600401615839565b6040805180830381600087803b15801561319657600080fd5b505af11580156131aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ce919061557e565b6004890180546fffffffffffffffffffffffffffffffff196001600160801b03918216600160801b878a0384160217168689038216179091556040519281169d50169a508c35907f40d0efd1a53d60ecbf40971b9daf7dc90178c3aadc7aab1765632738fa8b8f0190610d94908b9086908690615876565b600061148f60028361417b565b3390565b6000818152600c6020526040902080546bffffffffffffffffffffffff166c010000000000000000000000006001600160a01b0385169081029190911790915581906132a2826118ce565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006132e682613246565b6133215760405162461bcd60e51b815260040180806020018281038252602c815260200180615de0602c913960400191505060405180910390fd5b600061332c836118ce565b9050806001600160a01b0316846001600160a01b031614806133675750836001600160a01b031661335c8461080c565b6001600160a01b0316145b806110c157506110c18185612c6f565b4290565b600081602001516001600160a01b031682600001516001600160a01b0316106133a357600080fd5b50805160208083015160409384015184516001600160a01b0394851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b6bffffffffffffffffffffffff191660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516bffffffffffffffffffffffff19606086901b16602080830191909152600285810b60e890811b60348501529085900b901b60378301528251601a818403018152603a90920190925280519101205b9392505050565b600080806000198587098686029250828110908390030390508061350757600084116134fc57600080fd5b5082900490506134ca565b80841161351357600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b604080516000808252602082019092526001600160a01b0384169083906040518082805190602001908083835b602083106135cc5780518252601f1990920191602091820191016135ad565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811461362e576040519150601f19603f3d011682016040523d82523d6000602084013e613633565b606091505b5050905080610939576040805162461bcd60e51b815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600061148f82614187565b6000806000806000604051806060016040528087600001516001600160a01b0316815260200187602001516001600160a01b03168152602001876040015162ffffff1681525090506137067f00000000000000000000000000000000000000000000000000000000000000008261337b565b91506000826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561374357600080fd5b505afa158015613757573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377b919061560d565b50505050505090506000613792886080015161418b565b905060006137a38960a0015161418b565b90506137ba8383838c60c001518d60e001516144d9565b9750505050816001600160a01b0316633c8a7d8d876060015188608001518960a00151896040518060400160405280888152602001336001600160a01b031681525060405160200161380c9190615abd565b6040516020818303038152906040526040518663ffffffff1660e01b815260040161383b9594939291906157f6565b6040805180830381600087803b15801561385457600080fd5b505af1158015613868573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061388c91906156f4565b610100880151919550935084108015906138ab57508561012001518310155b6138c75760405162461bcd60e51b815260040161083390615a18565b509193509193565b826001600160a01b03166138e2826118ce565b6001600160a01b0316146139275760405162461bcd60e51b8152600401808060200182810382526029815260200180615eb96029913960400191505060405180910390fd5b6001600160a01b03821661396c5760405162461bcd60e51b8152600401808060200182810382526024815260200180615d966024913960400191505060405180910390fd5b613977838383610939565b613982600082613257565b6001600160a01b03831660009081526001602052604090206139a4908261459d565b506001600160a01b03821660009081526001602052604090206139c790826145a9565b506139d4600282846145b5565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b600061148c83836145cb565b4690565b6000613a36826118ce565b9050613a4481600084610939565b613a4f600083613257565b6000828152600860205260409020546002600019610100600184161502019091160415613a8d576000828152600860205260408120613a8d9161501f565b6001600160a01b0381166000908152600160205260409020613aaf908361459d565b50613abb60028361462f565b5060405182906000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b6000808080613b07868661463b565b909450925050505b9250929050565b60006110c18484846146b6565b6000908152600c6020526040902080546bffffffffffffffffffffffff19811660016bffffffffffffffffffffffff9283169081019092161790915590565b3b151590565b6001600160a01b038216613bc3576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b613bcc81613246565b15613c1e576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b613c2a60008383610939565b6001600160a01b0382166000908152600160205260409020613c4c90826145a9565b50613c59600282846145b5565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160a01b0382166000908152600a602052604090205469ffffffffffffffffffff168061148f5750600d8054600169ffffffffffffffffffff76010000000000000000000000000000000000000000000080840482168381019092160275ffffffffffffffffffffffffffffffffffffffffffff909316929092179092556001600160a01b038085166000908152600a6020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffff000000000000000000001686179055848352600b825291829020865181549085167fffffffffffffffffffffffff000000000000000000000000000000000000000091821617825591870151950180549287015162ffffff16600160a01b027fffffffffffffffffff000000ffffffffffffffffffffffffffffffffffffffff969094169290911691909117939093161790915592915050565b613df18484846138cf565b613dfd84848484614780565b61296d5760405162461bcd60e51b8152600401808060200182810382526032815260200180615d3d6032913960400191505060405180910390fd5b6000613e44838361337b565b9050336001600160a01b0382161461148f57600080fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316148015613e9c5750804710155b15613fbe577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613efc57600080fd5b505af1158015613f10573d6000803e3d6000fd5b50505050507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a9059cbb83836040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015613f8c57600080fd5b505af1158015613fa0573d6000803e3d6000fd5b505050506040513d6020811015613fb657600080fd5b5061296d9050565b6001600160a01b038316301415613fdf57613fda848383613feb565b61296d565b61296d8484848461495c565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b602083106140955780518252601f199092019160209182019101614076565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146140f7576040519150601f19603f3d011682016040523d82523d6000602084013e6140fc565b606091505b509150915081801561412a57508051158061412a575080806020019051602081101561412757600080fd5b50515b612b85576040805162461bcd60e51b815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b600061148c8383614af4565b5490565b60008060008360020b126141a2578260020b6141aa565b8260020b6000035b9050620d89e8811115614204576040805162461bcd60e51b815260206004820152600160248201527f5400000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60006001821661421857600160801b61422a565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561425e576ffff97272373d413259a46990580e213a0260801c5b600482161561427d576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b600882161561429c576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156142bb576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156142da576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156142f9576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615614318576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615614338576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615614358576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615614378576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615614398576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156143b8576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156143d8576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156143f8576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615614418576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615614439576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615614459576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615614478576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615614495576b048a170391f7dc42444e8fa20260801c5b60008460020b13156144b05780600019816144ac57fe5b0490505b6401000000008106156144c45760016144c7565b60005b60ff16602082901c0192505050919050565b6000836001600160a01b0316856001600160a01b031611156144f9579293925b846001600160a01b0316866001600160a01b0316116145245761451d858585614b0c565b9050614594565b836001600160a01b0316866001600160a01b0316101561458657600061454b878686614b0c565b9050600061455a878986614b78565b9050806001600160801b0316826001600160801b03161061457b578061457d565b815b92505050614594565b614591858584614b78565b90505b95945050505050565b600061148c8383614bbe565b600061148c8383614c84565b60006110c184846001600160a01b038516614cce565b8154600090821061460d5760405162461bcd60e51b8152600401808060200182810382526022815260200180615d1b6022913960400191505060405180910390fd5b82600001828154811061461c57fe5b9060005260206000200154905092915050565b600061148c8383614d65565b81546000908190831061467f5760405162461bcd60e51b8152600401808060200182810382526022815260200180615e976022913960400191505060405180910390fd5b600084600001848154811061469057fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816147515760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156147165781810151838201526020016146fe565b50505050905090810190601f1680156147435780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061476457fe5b9060005260206000209060020201600101549150509392505050565b6000614794846001600160a01b0316613b62565b6147a0575060016110c1565b60006148f17f150b7a02000000000000000000000000000000000000000000000000000000006147ce613253565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561483557818101518382015260200161481d565b50505050905090810190601f1680156148625780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050604051806060016040528060328152602001615d3d603291396001600160a01b0388169190614e39565b9050600081806020019051602081101561490a57600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a02000000000000000000000000000000000000000000000000000000001492505050949350505050565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b60208310614a0e5780518252601f1990920191602091820191016149ef565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114614a70576040519150601f19603f3d011682016040523d82523d6000602084013e614a75565b606091505b5091509150818015614aa3575080511580614aa35750808060200190516020811015614aa057600080fd5b50515b6127cd576040805162461bcd60e51b815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60009081526001919091016020526040902054151590565b6000826001600160a01b0316846001600160a01b03161115614b2c579192915b6000614b58856001600160a01b0316856001600160a01b03166c010000000000000000000000006134d1565b9050614594614b7384838888036001600160a01b03166134d1565b614e48565b6000826001600160a01b0316846001600160a01b03161115614b98579192915b6110c1614b73836c010000000000000000000000008787036001600160a01b03166134d1565b60008181526001830160205260408120548015614c7a5783546000198083019190810190600090879083908110614bf157fe5b9060005260206000200154905080876000018481548110614c0e57fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080614c3e57fe5b6001900381819060005260206000200160009055905586600101600087815260200190815260200160002060009055600194505050505061148f565b600091505061148f565b6000614c908383614af4565b614cc65750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561148f565b50600061148f565b600082815260018401602052604081205480614d335750506040805180820182528381526020808201848152865460018181018955600089815284812095516002909302909501918255915190820155865486845281880190925292909120556134ca565b82856000016001830381548110614d4657fe5b90600052602060002090600202016001018190555060009150506134ca565b60008181526001830160205260408120548015614c7a5783546000198083019190810190600090879083908110614d9857fe5b9060005260206000209060020201905080876000018481548110614db857fe5b600091825260208083208454600290930201918255600193840154918401919091558354825289830190526040902090840190558654879080614df757fe5b600082815260208082206002600019909401938402018281556001908101839055929093558881528982019092526040822091909155945061148f9350505050565b60606110c18484600085614e5e565b806001600160801b038116811461077157600080fd5b606082471015614e9f5760405162461bcd60e51b8152600401808060200182810382526026815260200180615dba6026913960400191505060405180910390fd5b614ea885613b62565b614ef9576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310614f375780518252601f199092019160209182019101614f18565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614f99576040519150601f19603f3d011682016040523d82523d6000602084013e614f9e565b606091505b5091509150614fae828286614fb9565b979650505050505050565b60608315614fc85750816134ca565b825115614fd85782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156147165781810151838201526020016146fe565b50805460018160011615610100020316600290046000825580601f106150455750615063565b601f0160209004906000526020600020908101906150639190615066565b50565b5b8082111561507b5760008155600101615067565b5090565b803561077181615cc4565b805161ffff8116811461077157600080fd5b803562ffffff8116811461077157600080fd5b6000602082840312156150c0578081fd5b81356134ca81615cc4565b600080604083850312156150dd578081fd5b82356150e881615cc4565b915060208301356150f881615cc4565b809150509250929050565b60008060008060808587031215615118578182fd5b843561512381615cc4565b9350602085013561513381615cc4565b92506151416040860161509c565b9150606085013561515181615cc4565b939692955090935050565b600080600060608486031215615170578081fd5b833561517b81615cc4565b9250602084013561518b81615cc4565b929592945050506040919091013590565b600080600080608085870312156151b1578182fd5b84356151bc81615cc4565b935060208501356151cc81615cc4565b925060408501359150606085013567ffffffffffffffff8111156151ee578182fd5b8501601f810187136151fe578182fd5b803561521161520c82615c76565b615c52565b818152886020838501011115615225578384fd5b81602084016020830137908101602001929092525092959194509250565b60008060408385031215615255578182fd5b823561526081615cc4565b915060208301356150f881615cd9565b60008060408385031215615282578182fd5b823561528d81615cc4565b946020939093013593505050565b6000806000606084860312156152af578081fd5b83356152ba81615cc4565b92506020840135915060408401356152d181615cc4565b809150509250925092565b60008060008060008060c087890312156152f4578384fd5b86356152ff81615cc4565b95506020870135945060408701359350606087013561531d81615d0b565b9598949750929560808101359460a0909101359350915050565b60008060208385031215615349578182fd5b823567ffffffffffffffff80821115615360578384fd5b818501915085601f830112615373578384fd5b813581811115615381578485fd5b8660208083028501011115615394578485fd5b60209290920196919550909350505050565b6000602082840312156153b7578081fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146134ca578182fd5b6000602082840312156153f7578081fd5b81356134ca81615ce7565b600060208284031215615413578081fd5b815167ffffffffffffffff811115615429578182fd5b8201601f81018413615439578182fd5b805161544761520c82615c76565b81815285602083850101111561545b578384fd5b614594826020830160208601615c98565b60006080828403121561547d578081fd5b50919050565b600060a0828403121561547d578081fd5b600060c0828403121561547d578081fd5b600081830360808112156154b7578182fd5b6040516040810167ffffffffffffffff82821081831117156154d557fe5b8160405260608412156154e6578485fd5b60a08301935081841081851117156154fa57fe5b50826040528435925061550c83615cc4565b91825260208401359161551e83615cc4565b8260608301526155306040860161509c565b608083015281526155436060850161507f565b6020820152949350505050565b6000610160828403121561547d578081fd5b600060208284031215615573578081fd5b81356134ca81615cf6565b60008060408385031215615590578182fd5b825161559b81615cf6565b60208401519092506150f881615cf6565b600080600080600060a086880312156155c3578283fd5b85516155ce81615cf6565b80955050602086015193506040860151925060608601516155ee81615cf6565b60808701519092506155ff81615cf6565b809150509295509295909350565b600080600080600080600060e0888a031215615627578485fd5b875161563281615cc4565b602089015190975061564381615ce7565b95506156516040890161508a565b945061565f6060890161508a565b935061566d6080890161508a565b925060a088015161567d81615d0b565b60c089015190925061568e81615cd9565b8091505092959891949750929550565b6000602082840312156156af578081fd5b61148c8261509c565b6000602082840312156156c9578081fd5b5035919050565b600080604083850312156156e2578182fd5b8235915060208301356150f881615cc4565b60008060408385031215615706578182fd5b505080516020909101519092909150565b6000806000806060858703121561572c578182fd5b8435935060208501359250604085013567ffffffffffffffff80821115615751578384fd5b818701915087601f830112615764578384fd5b813581811115615772578485fd5b886020828501011115615783578485fd5b95989497505060200194505050565b600081518084526157aa816020860160208601615c98565b601f01601f19169290920160200192915050565b60020b9052565b6001600160801b03169052565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b60006001600160a01b03871682528560020b60208301528460020b60408301526001600160801b038416606083015260a06080830152614fae60a0830184615792565b6001600160a01b03959095168552600293840b60208601529190920b60408401526001600160801b03918216606084015216608082015260a00190565b6001600160a01b039390931683526001600160801b03918216602084015216604082015260600190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015615911577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526158ff858351615792565b945092850192908501906001016158c5565b5092979650505050505050565b901515815260200190565b90815260200190565b6001600160a01b03929092168252602082015260400190565b600293840b81529190920b60208201526001600160801b03909116604082015260600190565b60006020825261148c6020830184615792565b6020808252600c908201527f4e6f7420617070726f7665640000000000000000000000000000000000000000604082015260600190565b6020808252602c908201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860408201527f697374656e7420746f6b656e0000000000000000000000000000000000000000606082015260800190565b60208082526014908201527f507269636520736c69707061676520636865636b000000000000000000000000604082015260600190565b60208082526010908201527f496e76616c696420746f6b656e20494400000000000000000000000000000000604082015260600190565b6020808252600b908201527f4e6f7420636c6561726564000000000000000000000000000000000000000000604082015260600190565b815180516001600160a01b03908116835260208083015182168185015260409283015162ffffff1692840192909252920151909116606082015260800190565b6001600160801b039390931683526020830191909152604082015260600190565b9384526001600160801b039290921660208401526040830152606082015260800190565b918252602082015260400190565b6bffffffffffffffffffffffff8d1681526001600160a01b038c811660208301528b811660408301528a16606082015262ffffff89166080820152600288900b60a08201526101808101615ba760c08301896157be565b615bb460e08301886157c5565b8561010083015284610120830152615bd06101408301856157c5565b615bde6101608301846157c5565b9d9c50505050505050505050505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112615c23578283fd5b83018035915067ffffffffffffffff821115615c3d578283fd5b602001915036819003821315613b0f57600080fd5b60405181810167ffffffffffffffff81118282101715615c6e57fe5b604052919050565b600067ffffffffffffffff821115615c8a57fe5b50601f01601f191660200190565b60005b83811015615cb3578181015183820152602001615c9b565b8381111561296d5750506000910152565b6001600160a01b038116811461506357600080fd5b801515811461506357600080fd5b8060020b811461506357600080fd5b6001600160801b038116811461506357600080fd5b60ff8116811461506357600080fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724552433732315065726d69743a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e7366657220746f20746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a164736f6c6343000706000a", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/v3-periphery/artifacts/contracts/interfaces/ISelfPermit.sol/ISelfPermit.json +var require_ISelfPermit = __commonJS({ + "node_modules/@uniswap/v3-periphery/artifacts/contracts/interfaces/ISelfPermit.sol/ISelfPermit.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "ISelfPermit", + sourceName: "contracts/interfaces/ISelfPermit.sol", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitAllowed", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitAllowedIfNecessary", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitIfNecessary", + outputs: [], + stateMutability: "payable", + type: "function" + } + ], + bytecode: "0x", + deployedBytecode: "0x", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/v3-periphery/artifacts/contracts/interfaces/IPeripheryPaymentsWithFee.sol/IPeripheryPaymentsWithFee.json +var require_IPeripheryPaymentsWithFee = __commonJS({ + "node_modules/@uniswap/v3-periphery/artifacts/contracts/interfaces/IPeripheryPaymentsWithFee.sol/IPeripheryPaymentsWithFee.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "IPeripheryPaymentsWithFee", + sourceName: "contracts/interfaces/IPeripheryPaymentsWithFee.sol", + abi: [ + { + inputs: [], + name: "refundETH", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "sweepToken", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "feeBips", + type: "uint256" + }, + { + internalType: "address", + name: "feeRecipient", + type: "address" + } + ], + name: "sweepTokenWithFee", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "unwrapWETH9", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "feeBips", + type: "uint256" + }, + { + internalType: "address", + name: "feeRecipient", + type: "address" + } + ], + name: "unwrapWETH9WithFee", + outputs: [], + stateMutability: "payable", + type: "function" + } + ], + bytecode: "0x", + deployedBytecode: "0x", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/v3-periphery/artifacts/contracts/lens/Quoter.sol/Quoter.json +var require_Quoter = __commonJS({ + "node_modules/@uniswap/v3-periphery/artifacts/contracts/lens/Quoter.sol/Quoter.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "Quoter", + sourceName: "contracts/lens/Quoter.sol", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_factory", + type: "address" + }, + { + internalType: "address", + name: "_WETH9", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "WETH9", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "path", + type: "bytes" + }, + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + } + ], + name: "quoteExactInput", + outputs: [ + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenIn", + type: "address" + }, + { + internalType: "address", + name: "tokenOut", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + } + ], + name: "quoteExactInputSingle", + outputs: [ + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "path", + type: "bytes" + }, + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + } + ], + name: "quoteExactOutput", + outputs: [ + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "tokenIn", + type: "address" + }, + { + internalType: "address", + name: "tokenOut", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + } + ], + name: "quoteExactOutputSingle", + outputs: [ + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "int256", + name: "amount0Delta", + type: "int256" + }, + { + internalType: "int256", + name: "amount1Delta", + type: "int256" + }, + { + internalType: "bytes", + name: "path", + type: "bytes" + } + ], + name: "uniswapV3SwapCallback", + outputs: [], + stateMutability: "view", + type: "function" + } + ], + bytecode: "0x60c060405234801561001057600080fd5b506040516112e53803806112e583398101604081905261002f91610069565b6001600160601b0319606092831b8116608052911b1660a05261009b565b80516001600160a01b038116811461006457600080fd5b919050565b6000806040838503121561007b578182fd5b6100848361004d565b91506100926020840161004d565b90509250929050565b60805160601c60a05160601c6112176100ce60003980610342525080610366528061058652806106d552506112176000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063c45a01551161005b578063c45a0155146100d3578063cdca1753146100db578063f7729d43146100ee578063fa461e33146101015761007d565b80632f80bb1d1461008257806330d07f21146100ab5780634aa4a4fc146100be575b600080fd5b610095610090366004610e9e565b610116565b6040516100a29190611148565b60405180910390f35b6100956100b9366004610e30565b61017b565b6100c6610340565b6040516100a29190611084565b6100c6610364565b6100956100e9366004610e9e565b610388565b6100956100fc366004610e30565b6103d6565b61011461010f366004610f04565b610555565b005b60005b600061012484610660565b9050600080600061013487610668565b92509250925061014882848389600061017b565b955083156101605761015987610699565b965061016c565b85945050505050610175565b50505050610119565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff808616878216109083166101a65760008490555b6101b18787876106ce565b73ffffffffffffffffffffffffffffffffffffffff1663128acb0830836101d78861070c565b60000373ffffffffffffffffffffffffffffffffffffffff8816156101fc5787610222565b8561021b5773fffd8963efd1fc6a506488495d951d5263988d25610222565b6401000276a45b8b8b8e6040516020016102379392919061101e565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016102669594939291906110a5565b6040805180830381600087803b15801561027f57600080fd5b505af19250505080156102cd575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526102ca91810190610ee1565b60015b610333573d8080156102fb576040519150601f19603f3d011682016040523d82523d6000602084013e610300565b606091505b5073ffffffffffffffffffffffffffffffffffffffff841661032157600080555b61032a8161073e565b92505050610337565b5050505b95945050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005b600061039684610660565b905060008060006103a687610668565b9250925092506103ba8383838960006103d6565b95508315610160576103cb87610699565b96505050505061038b565b600073ffffffffffffffffffffffffffffffffffffffff808616908716106103ff8787876106ce565b73ffffffffffffffffffffffffffffffffffffffff1663128acb0830836104258861070c565b73ffffffffffffffffffffffffffffffffffffffff881615610447578761046d565b856104665773fffd8963efd1fc6a506488495d951d5263988d2561046d565b6401000276a45b8c8b8d6040516020016104829392919061101e565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016104b19594939291906110a5565b6040805180830381600087803b1580156104ca57600080fd5b505af1925050508015610518575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261051591810190610ee1565b60015b610333573d808015610546576040519150601f19603f3d011682016040523d82523d6000602084013e61054b565b606091505b5061032a8161073e565b60008313806105645750600082135b61056d57600080fd5b600080600061057b84610668565b9250925092506105ad7f00000000000000000000000000000000000000000000000000000000000000008484846107ef565b5060008060008089136105f3578573ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1610888a600003610628565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161089896000035b925092509250821561063f57604051818152602081fd5b6000541561065557600054811461065557600080fd5b604051828152602081fd5b516042111590565b600080806106768482610805565b9250610683846014610905565b9050610690846017610805565b91509193909250565b80516060906101759083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9016109f5565b60006107047f00000000000000000000000000000000000000000000000000000000000000006106ff868686610bdc565b610c59565b949350505050565b60007f8000000000000000000000000000000000000000000000000000000000000000821061073a57600080fd5b5090565b600081516020146107db5760448251101561078e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078590611111565b60405180910390fd5b600482019150818060200190518101906107a89190610f52565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078591906110f7565b818060200190518101906101759190610fbc565b600061033785610800868686610bdc565b610d8f565b60008182601401101561087957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b81601401835110156108ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b60008182600301101561097957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b81600301835110156109ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b60608182601f011015610a6957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015610ada57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b81830184511015610b4c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b606082158015610b6b5760405191506000825260208201604052610bd3565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015610ba4578051835260209283019201610b8c565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b610be4610dbf565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115610c1c579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1610610c9b57600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b6000610d9b8383610c59565b90503373ffffffffffffffffffffffffffffffffffffffff82161461017557600080fd5b604080516060810182526000808252602082018190529181019190915290565b600082601f830112610def578081fd5b8135610e02610dfd82611175565b611151565b818152846020838601011115610e16578283fd5b816020850160208301379081016020019190915292915050565b600080600080600060a08688031215610e47578081fd5b8535610e52816111e5565b94506020860135610e62816111e5565b9350604086013562ffffff81168114610e79578182fd5b9250606086013591506080860135610e90816111e5565b809150509295509295909350565b60008060408385031215610eb0578182fd5b823567ffffffffffffffff811115610ec6578283fd5b610ed285828601610ddf565b95602094909401359450505050565b60008060408385031215610ef3578182fd5b505080516020909101519092909150565b600080600060608486031215610f18578283fd5b8335925060208401359150604084013567ffffffffffffffff811115610f3c578182fd5b610f4886828701610ddf565b9150509250925092565b600060208284031215610f63578081fd5b815167ffffffffffffffff811115610f79578182fd5b8201601f81018413610f89578182fd5b8051610f97610dfd82611175565b818152856020838501011115610fab578384fd5b6103378260208301602086016111b5565b600060208284031215610fcd578081fd5b5051919050565b60008151808452610fec8160208601602086016111b5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a060808301526110ec60a0830184610fd4565b979650505050505050565b60006020825261110a6020830184610fd4565b9392505050565b60208082526010908201527f556e6578706563746564206572726f7200000000000000000000000000000000604082015260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561116d57fe5b604052919050565b600067ffffffffffffffff82111561118957fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b838110156111d05781810151838201526020016111b8565b838111156111df576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461120757600080fd5b5056fea164736f6c6343000706000a", + deployedBytecode: "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063c45a01551161005b578063c45a0155146100d3578063cdca1753146100db578063f7729d43146100ee578063fa461e33146101015761007d565b80632f80bb1d1461008257806330d07f21146100ab5780634aa4a4fc146100be575b600080fd5b610095610090366004610e9e565b610116565b6040516100a29190611148565b60405180910390f35b6100956100b9366004610e30565b61017b565b6100c6610340565b6040516100a29190611084565b6100c6610364565b6100956100e9366004610e9e565b610388565b6100956100fc366004610e30565b6103d6565b61011461010f366004610f04565b610555565b005b60005b600061012484610660565b9050600080600061013487610668565b92509250925061014882848389600061017b565b955083156101605761015987610699565b965061016c565b85945050505050610175565b50505050610119565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff808616878216109083166101a65760008490555b6101b18787876106ce565b73ffffffffffffffffffffffffffffffffffffffff1663128acb0830836101d78861070c565b60000373ffffffffffffffffffffffffffffffffffffffff8816156101fc5787610222565b8561021b5773fffd8963efd1fc6a506488495d951d5263988d25610222565b6401000276a45b8b8b8e6040516020016102379392919061101e565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016102669594939291906110a5565b6040805180830381600087803b15801561027f57600080fd5b505af19250505080156102cd575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526102ca91810190610ee1565b60015b610333573d8080156102fb576040519150601f19603f3d011682016040523d82523d6000602084013e610300565b606091505b5073ffffffffffffffffffffffffffffffffffffffff841661032157600080555b61032a8161073e565b92505050610337565b5050505b95945050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b60005b600061039684610660565b905060008060006103a687610668565b9250925092506103ba8383838960006103d6565b95508315610160576103cb87610699565b96505050505061038b565b600073ffffffffffffffffffffffffffffffffffffffff808616908716106103ff8787876106ce565b73ffffffffffffffffffffffffffffffffffffffff1663128acb0830836104258861070c565b73ffffffffffffffffffffffffffffffffffffffff881615610447578761046d565b856104665773fffd8963efd1fc6a506488495d951d5263988d2561046d565b6401000276a45b8c8b8d6040516020016104829392919061101e565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016104b19594939291906110a5565b6040805180830381600087803b1580156104ca57600080fd5b505af1925050508015610518575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261051591810190610ee1565b60015b610333573d808015610546576040519150601f19603f3d011682016040523d82523d6000602084013e61054b565b606091505b5061032a8161073e565b60008313806105645750600082135b61056d57600080fd5b600080600061057b84610668565b9250925092506105ad7f00000000000000000000000000000000000000000000000000000000000000008484846107ef565b5060008060008089136105f3578573ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1610888a600003610628565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161089896000035b925092509250821561063f57604051818152602081fd5b6000541561065557600054811461065557600080fd5b604051828152602081fd5b516042111590565b600080806106768482610805565b9250610683846014610905565b9050610690846017610805565b91509193909250565b80516060906101759083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe9016109f5565b60006107047f00000000000000000000000000000000000000000000000000000000000000006106ff868686610bdc565b610c59565b949350505050565b60007f8000000000000000000000000000000000000000000000000000000000000000821061073a57600080fd5b5090565b600081516020146107db5760448251101561078e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078590611111565b60405180910390fd5b600482019150818060200190518101906107a89190610f52565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078591906110f7565b818060200190518101906101759190610fbc565b600061033785610800868686610bdc565b610d8f565b60008182601401101561087957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b81601401835110156108ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b60008182600301101561097957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b81600301835110156109ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b60608182601f011015610a6957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015610ada57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b81830184511015610b4c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b606082158015610b6b5760405191506000825260208201604052610bd3565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015610ba4578051835260209283019201610b8c565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b610be4610dbf565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115610c1c579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1610610c9b57600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b6000610d9b8383610c59565b90503373ffffffffffffffffffffffffffffffffffffffff82161461017557600080fd5b604080516060810182526000808252602082018190529181019190915290565b600082601f830112610def578081fd5b8135610e02610dfd82611175565b611151565b818152846020838601011115610e16578283fd5b816020850160208301379081016020019190915292915050565b600080600080600060a08688031215610e47578081fd5b8535610e52816111e5565b94506020860135610e62816111e5565b9350604086013562ffffff81168114610e79578182fd5b9250606086013591506080860135610e90816111e5565b809150509295509295909350565b60008060408385031215610eb0578182fd5b823567ffffffffffffffff811115610ec6578283fd5b610ed285828601610ddf565b95602094909401359450505050565b60008060408385031215610ef3578182fd5b505080516020909101519092909150565b600080600060608486031215610f18578283fd5b8335925060208401359150604084013567ffffffffffffffff811115610f3c578182fd5b610f4886828701610ddf565b9150509250925092565b600060208284031215610f63578081fd5b815167ffffffffffffffff811115610f79578182fd5b8201601f81018413610f89578182fd5b8051610f97610dfd82611175565b818152856020838501011115610fab578384fd5b6103378260208301602086016111b5565b600060208284031215610fcd578081fd5b5051919050565b60008151808452610fec8160208601602086016111b5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a060808301526110ec60a0830184610fd4565b979650505050505050565b60006020825261110a6020830184610fd4565b9392505050565b60208082526010908201527f556e6578706563746564206572726f7200000000000000000000000000000000604082015260600190565b90815260200190565b60405181810167ffffffffffffffff8111828210171561116d57fe5b604052919050565b600067ffffffffffffffff82111561118957fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b838110156111d05781810151838201526020016111b8565b838111156111df576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461120757600080fd5b5056fea164736f6c6343000706000a", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/swap-router-contracts/artifacts/contracts/lens/QuoterV2.sol/QuoterV2.json +var require_QuoterV2 = __commonJS({ + "node_modules/@uniswap/swap-router-contracts/artifacts/contracts/lens/QuoterV2.sol/QuoterV2.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "QuoterV2", + sourceName: "contracts/lens/QuoterV2.sol", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_factory", + type: "address" + }, + { + internalType: "address", + name: "_WETH9", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "WETH9", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "path", + type: "bytes" + }, + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + } + ], + name: "quoteExactInput", + outputs: [ + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + }, + { + internalType: "uint160[]", + name: "sqrtPriceX96AfterList", + type: "uint160[]" + }, + { + internalType: "uint32[]", + name: "initializedTicksCrossedList", + type: "uint32[]" + }, + { + internalType: "uint256", + name: "gasEstimate", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "tokenIn", + type: "address" + }, + { + internalType: "address", + name: "tokenOut", + type: "address" + }, + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + } + ], + internalType: "struct IQuoterV2.QuoteExactInputSingleParams", + name: "params", + type: "tuple" + } + ], + name: "quoteExactInputSingle", + outputs: [ + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + }, + { + internalType: "uint160", + name: "sqrtPriceX96After", + type: "uint160" + }, + { + internalType: "uint32", + name: "initializedTicksCrossed", + type: "uint32" + }, + { + internalType: "uint256", + name: "gasEstimate", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes", + name: "path", + type: "bytes" + }, + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + } + ], + name: "quoteExactOutput", + outputs: [ + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + }, + { + internalType: "uint160[]", + name: "sqrtPriceX96AfterList", + type: "uint160[]" + }, + { + internalType: "uint32[]", + name: "initializedTicksCrossedList", + type: "uint32[]" + }, + { + internalType: "uint256", + name: "gasEstimate", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "tokenIn", + type: "address" + }, + { + internalType: "address", + name: "tokenOut", + type: "address" + }, + { + internalType: "uint256", + name: "amount", + type: "uint256" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + } + ], + internalType: "struct IQuoterV2.QuoteExactOutputSingleParams", + name: "params", + type: "tuple" + } + ], + name: "quoteExactOutputSingle", + outputs: [ + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + }, + { + internalType: "uint160", + name: "sqrtPriceX96After", + type: "uint160" + }, + { + internalType: "uint32", + name: "initializedTicksCrossed", + type: "uint32" + }, + { + internalType: "uint256", + name: "gasEstimate", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "int256", + name: "amount0Delta", + type: "int256" + }, + { + internalType: "int256", + name: "amount1Delta", + type: "int256" + }, + { + internalType: "bytes", + name: "path", + type: "bytes" + } + ], + name: "uniswapV3SwapCallback", + outputs: [], + stateMutability: "view", + type: "function" + } + ], + bytecode: "0x60c06040523480156200001157600080fd5b506040516200212c3803806200212c833981016040819052620000349162000070565b6001600160601b0319606092831b8116608052911b1660a052620000a7565b80516001600160a01b03811681146200006b57600080fd5b919050565b6000806040838503121562000083578182fd5b6200008e8362000053565b91506200009e6020840162000053565b90509250929050565b60805160601c60a05160601c612051620000db60003980610321525080610577528061095d5280610b9252506120516000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063c45a01551161005b578063c45a0155146100e6578063c6a5026a146100ee578063cdca175314610101578063fa461e33146101145761007d565b80632f80bb1d146100825780634aa4a4fc146100ae578063bd21704a146100c3575b600080fd5b610095610090366004611b2b565b610129565b6040516100a59493929190611eac565b60405180910390f35b6100b661031f565b6040516100a59190611def565b6100d66100d1366004611c49565b610343565b6040516100a59493929190611f54565b6100b6610575565b6100d66100fc366004611c49565b610599565b61009561010f366004611b2b565b610754565b610127610122366004611b91565b61092c565b005b6000606080600061013986610ae8565b67ffffffffffffffff8111801561014f57600080fd5b50604051908082528060200260200182016040528015610179578160200160208202803683370190505b50925061018586610ae8565b67ffffffffffffffff8111801561019b57600080fd5b506040519080825280602002602001820160405280156101c5578160200160208202803683370190505b50915060005b60008060006101d98a610b17565b92509250925060008060008061025c6040518060a001604052808873ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018f81526020018762ffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815250610343565b9350935093509350828b898151811061027157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818a89815181106102b857fe5b63ffffffff90921660209283029190910190910152929b50968201966001909601958b926102e58e610b48565b156102fa576102f38e610b50565b9d5061030a565b8c9b505050505050505050610316565b505050505050506101cb565b92959194509250565b7f000000000000000000000000000000000000000000000000000000000000000081565b60208101518151606083015160009283928392839273ffffffffffffffffffffffffffffffffffffffff808216908416109284926103819290610b8b565b9050866080015173ffffffffffffffffffffffffffffffffffffffff16600014156103af5760408701516000555b60005a90508173ffffffffffffffffffffffffffffffffffffffff1663128acb0830856103df8c60400151610bc9565b6000038c6080015173ffffffffffffffffffffffffffffffffffffffff1660001461040e578c60800151610434565b8761042d5773fffd8963efd1fc6a506488495d951d5263988d25610434565b6401000276a45b8d602001518e606001518f6000015160405160200161045593929190611d89565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401610484959493929190611e10565b6040805180830381600087803b15801561049d57600080fd5b505af19250505080156104eb575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526104e891810190611b6e565b60015b610568573d808015610519576040519150601f19603f3d011682016040523d82523d6000602084013e61051e565b606091505b505a82039450886080015173ffffffffffffffffffffffffffffffffffffffff166000141561054c57600080555b610557818487610bfb565b97509750975097505050505061056e565b50505050505b9193509193565b7f000000000000000000000000000000000000000000000000000000000000000081565b60208101518151606083015160009283928392839273ffffffffffffffffffffffffffffffffffffffff808216908416109284926105d79290610b8b565b905060005a90508173ffffffffffffffffffffffffffffffffffffffff1663128acb0830856106098c60400151610bc9565b60808d015173ffffffffffffffffffffffffffffffffffffffff1615610633578c60800151610659565b876106525773fffd8963efd1fc6a506488495d951d5263988d25610659565b6401000276a45b8d600001518e606001518f6020015160405160200161067a93929190611d89565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016106a9959493929190611e10565b6040805180830381600087803b1580156106c257600080fd5b505af1925050508015610710575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261070d91810190611b6e565b60015b610568573d80801561073e576040519150601f19603f3d011682016040523d82523d6000602084013e610743565b606091505b505a82039450610557818487610bfb565b6000606080600061076486610ae8565b67ffffffffffffffff8111801561077a57600080fd5b506040519080825280602002602001820160405280156107a4578160200160208202803683370190505b5092506107b086610ae8565b67ffffffffffffffff811180156107c657600080fd5b506040519080825280602002602001820160405280156107f0578160200160208202803683370190505b50915060005b60008060006108048a610b17565b9250925092506000806000806108876040518060a001604052808973ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018f81526020018762ffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815250610599565b9350935093509350828b898151811061089c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818a89815181106108e357fe5b63ffffffff90921660209283029190910190910152929b50968201966001909601958b926109108e610b48565b156102fa5761091e8e610b50565b9d50505050505050506107f6565b600083138061093b5750600082135b61094457600080fd5b600080600061095284610b17565b9250925092506109847f0000000000000000000000000000000000000000000000000000000000000000848484610ccf565b5060008060008089136109ca578573ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1610888a6000036109ff565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161089896000035b9250925092506000610a12878787610b8b565b90506000808273ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610a5d57600080fd5b505afa158015610a71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a959190611c6b565b5050505050915091508515610abb57604051848152826020820152816040820152606081fd5b60005415610ad1576000548414610ad157600080fd5b604051858152826020820152816040820152606081fd5b805160177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec909101045b919050565b60008080610b258482610cee565b9250610b32846014610dee565b9050610b3f846017610cee565b91509193909250565b516042111590565b8051606090610b859083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe901610ede565b92915050565b6000610bc17f0000000000000000000000000000000000000000000000000000000000000000610bbc8686866110c5565b611142565b949350505050565b60007f80000000000000000000000000000000000000000000000000000000000000008210610bf757600080fd5b5090565b6000806000806000808773ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c829190611c6b565b50939650610c9794508d935061127892505050565b91975095509050610cbf73ffffffffffffffffffffffffffffffffffffffff89168383611339565b9350869250505093509350935093565b6000610ce585610ce08686866110c5565b611991565b95945050505050565b600081826014011015610d6257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b8160140183511015610dd557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b600081826003011015610e6257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b8160030183511015610ed557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b60608182601f011015610f5257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015610fc357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b8183018451101561103557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b60608215801561105457604051915060008252602082016040526110bc565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561108d578051835260209283019201611075565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b6110cd6119fa565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115611105579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff161061118457600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b60008060008351606014611318576044845110156112cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c290611e75565b60405180910390fd5b600484019350838060200190518101906112e59190611bdf565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c29190611e62565b8380602001905181019061132c9190611d02565b9250925092509193909250565b60008060008060008060008060088b73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561138d57600080fd5b505afa1580156113a1573d6000803e3d6000fd5b505050506040513d60208110156113b757600080fd5b5051600290810b908c900b816113c957fe5b0560020b901d905060006101008c73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561141c57600080fd5b505afa158015611430573d6000803e3d6000fd5b505050506040513d602081101561144657600080fd5b5051600290810b908d900b8161145857fe5b0560020b8161146357fe5b079050600060088d73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114b057600080fd5b505afa1580156114c4573d6000803e3d6000fd5b505050506040513d60208110156114da57600080fd5b5051600290810b908d900b816114ec57fe5b0560020b901d905060006101008e73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561153f57600080fd5b505afa158015611553573d6000803e3d6000fd5b505050506040513d602081101561156957600080fd5b5051600290810b908e900b8161157b57fe5b0560020b8161158657fe5b07905060008160ff166001901b8f73ffffffffffffffffffffffffffffffffffffffff16635339c296856040518263ffffffff1660e01b8152600401808260010b815260200191505060206040518083038186803b1580156115e757600080fd5b505afa1580156115fb573d6000803e3d6000fd5b505050506040513d602081101561161157600080fd5b5051161180156116a457508d73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561166257600080fd5b505afa158015611676573d6000803e3d6000fd5b505050506040513d602081101561168c57600080fd5b5051600290810b908d900b8161169e57fe5b0760020b155b80156116b557508b60020b8d60020b135b945060008360ff166001901b8f73ffffffffffffffffffffffffffffffffffffffff16635339c296876040518263ffffffff1660e01b8152600401808260010b815260200191505060206040518083038186803b15801561171557600080fd5b505afa158015611729573d6000803e3d6000fd5b505050506040513d602081101561173f57600080fd5b5051161180156117d257508d73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561179057600080fd5b505afa1580156117a4573d6000803e3d6000fd5b505050506040513d60208110156117ba57600080fd5b5051600290810b908e900b816117cc57fe5b0760020b155b80156117e357508b60020b8d60020b125b95508160010b8460010b128061180f57508160010b8460010b14801561180f57508060ff168360ff1611155b1561182557839950829750819850809650611832565b8199508097508398508296505b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60ff87161b9150505b8560010b8760010b13611969578560010b8760010b14156118a3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60ff858103161c165b6000818c73ffffffffffffffffffffffffffffffffffffffff16635339c2968a6040518263ffffffff1660e01b8152600401808260010b815260200191505060206040518083038186803b1580156118fa57600080fd5b505afa15801561190e573d6000803e3d6000fd5b505050506040513d602081101561192457600080fd5b5051169050611932816119c1565b61ffff16989098019750506001909501947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61185e565b8115611976576001880397505b8215611983576001880397505b505050505050509392505050565b600061199d8383611142565b90503373ffffffffffffffffffffffffffffffffffffffff821614610b8557600080fd5b6000805b8215610b85577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301909216916001016119c5565b604080516060810182526000808252602082018190529181019190915290565b600082601f830112611a2a578081fd5b8135611a3d611a3882611faf565b611f8b565b818152846020838601011115611a51578283fd5b816020850160208301379081016020019190915292915050565b8051600281900b8114610b1257600080fd5b600060a08284031215611a8e578081fd5b60405160a0810181811067ffffffffffffffff82111715611aab57fe5b6040529050808235611abc8161201f565b81526020830135611acc8161201f565b602082015260408381013590820152606083013562ffffff81168114611af157600080fd5b6060820152611b0260808401611b0e565b60808201525092915050565b8035610b128161201f565b805161ffff81168114610b1257600080fd5b60008060408385031215611b3d578182fd5b823567ffffffffffffffff811115611b53578283fd5b611b5f85828601611a1a565b95602094909401359450505050565b60008060408385031215611b80578182fd5b505080516020909101519092909150565b600080600060608486031215611ba5578081fd5b8335925060208401359150604084013567ffffffffffffffff811115611bc9578182fd5b611bd586828701611a1a565b9150509250925092565b600060208284031215611bf0578081fd5b815167ffffffffffffffff811115611c06578182fd5b8201601f81018413611c16578182fd5b8051611c24611a3882611faf565b818152856020838501011115611c38578384fd5b610ce5826020830160208601611fef565b600060a08284031215611c5a578081fd5b611c648383611a7d565b9392505050565b600080600080600080600060e0888a031215611c85578283fd5b8751611c908161201f565b9650611c9e60208901611a6b565b9550611cac60408901611b19565b9450611cba60608901611b19565b9350611cc860808901611b19565b925060a088015160ff81168114611cdd578283fd5b60c08901519092508015158114611cf2578182fd5b8091505092959891949750929550565b600080600060608486031215611d16578081fd5b835192506020840151611d288161201f565b9150611d3660408501611a6b565b90509250925092565b60008151808452611d57816020860160208601611fef565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a06080830152611e5760a0830184611d3f565b979650505050505050565b600060208252611c646020830184611d3f565b60208082526010908201527f556e6578706563746564206572726f7200000000000000000000000000000000604082015260600190565b600060808201868352602060808185015281875180845260a0860191508289019350845b81811015611f0257845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101611ed0565b505084810360408601528651808252908201925081870190845b81811015611f3e57825163ffffffff1685529383019391830191600101611f1c565b5050505060609290920192909252949350505050565b93845273ffffffffffffffffffffffffffffffffffffffff92909216602084015263ffffffff166040830152606082015260800190565b60405181810167ffffffffffffffff81118282101715611fa757fe5b604052919050565b600067ffffffffffffffff821115611fc357fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b8381101561200a578181015183820152602001611ff2565b83811115612019576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461204157600080fd5b5056fea164736f6c6343000706000a", + deployedBytecode: "0x608060405234801561001057600080fd5b506004361061007d5760003560e01c8063c45a01551161005b578063c45a0155146100e6578063c6a5026a146100ee578063cdca175314610101578063fa461e33146101145761007d565b80632f80bb1d146100825780634aa4a4fc146100ae578063bd21704a146100c3575b600080fd5b610095610090366004611b2b565b610129565b6040516100a59493929190611eac565b60405180910390f35b6100b661031f565b6040516100a59190611def565b6100d66100d1366004611c49565b610343565b6040516100a59493929190611f54565b6100b6610575565b6100d66100fc366004611c49565b610599565b61009561010f366004611b2b565b610754565b610127610122366004611b91565b61092c565b005b6000606080600061013986610ae8565b67ffffffffffffffff8111801561014f57600080fd5b50604051908082528060200260200182016040528015610179578160200160208202803683370190505b50925061018586610ae8565b67ffffffffffffffff8111801561019b57600080fd5b506040519080825280602002602001820160405280156101c5578160200160208202803683370190505b50915060005b60008060006101d98a610b17565b92509250925060008060008061025c6040518060a001604052808873ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1681526020018f81526020018762ffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815250610343565b9350935093509350828b898151811061027157fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818a89815181106102b857fe5b63ffffffff90921660209283029190910190910152929b50968201966001909601958b926102e58e610b48565b156102fa576102f38e610b50565b9d5061030a565b8c9b505050505050505050610316565b505050505050506101cb565b92959194509250565b7f000000000000000000000000000000000000000000000000000000000000000081565b60208101518151606083015160009283928392839273ffffffffffffffffffffffffffffffffffffffff808216908416109284926103819290610b8b565b9050866080015173ffffffffffffffffffffffffffffffffffffffff16600014156103af5760408701516000555b60005a90508173ffffffffffffffffffffffffffffffffffffffff1663128acb0830856103df8c60400151610bc9565b6000038c6080015173ffffffffffffffffffffffffffffffffffffffff1660001461040e578c60800151610434565b8761042d5773fffd8963efd1fc6a506488495d951d5263988d25610434565b6401000276a45b8d602001518e606001518f6000015160405160200161045593929190611d89565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401610484959493929190611e10565b6040805180830381600087803b15801561049d57600080fd5b505af19250505080156104eb575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526104e891810190611b6e565b60015b610568573d808015610519576040519150601f19603f3d011682016040523d82523d6000602084013e61051e565b606091505b505a82039450886080015173ffffffffffffffffffffffffffffffffffffffff166000141561054c57600080555b610557818487610bfb565b97509750975097505050505061056e565b50505050505b9193509193565b7f000000000000000000000000000000000000000000000000000000000000000081565b60208101518151606083015160009283928392839273ffffffffffffffffffffffffffffffffffffffff808216908416109284926105d79290610b8b565b905060005a90508173ffffffffffffffffffffffffffffffffffffffff1663128acb0830856106098c60400151610bc9565b60808d015173ffffffffffffffffffffffffffffffffffffffff1615610633578c60800151610659565b876106525773fffd8963efd1fc6a506488495d951d5263988d25610659565b6401000276a45b8d600001518e606001518f6020015160405160200161067a93929190611d89565b6040516020818303038152906040526040518663ffffffff1660e01b81526004016106a9959493929190611e10565b6040805180830381600087803b1580156106c257600080fd5b505af1925050508015610710575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820190925261070d91810190611b6e565b60015b610568573d80801561073e576040519150601f19603f3d011682016040523d82523d6000602084013e610743565b606091505b505a82039450610557818487610bfb565b6000606080600061076486610ae8565b67ffffffffffffffff8111801561077a57600080fd5b506040519080825280602002602001820160405280156107a4578160200160208202803683370190505b5092506107b086610ae8565b67ffffffffffffffff811180156107c657600080fd5b506040519080825280602002602001820160405280156107f0578160200160208202803683370190505b50915060005b60008060006108048a610b17565b9250925092506000806000806108876040518060a001604052808973ffffffffffffffffffffffffffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff1681526020018f81526020018762ffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff16815250610599565b9350935093509350828b898151811061089c57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050818a89815181106108e357fe5b63ffffffff90921660209283029190910190910152929b50968201966001909601958b926109108e610b48565b156102fa5761091e8e610b50565b9d50505050505050506107f6565b600083138061093b5750600082135b61094457600080fd5b600080600061095284610b17565b9250925092506109847f0000000000000000000000000000000000000000000000000000000000000000848484610ccf565b5060008060008089136109ca578573ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1610888a6000036109ff565b8473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161089896000035b9250925092506000610a12878787610b8b565b90506000808273ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610a5d57600080fd5b505afa158015610a71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a959190611c6b565b5050505050915091508515610abb57604051848152826020820152816040820152606081fd5b60005415610ad1576000548414610ad157600080fd5b604051858152826020820152816040820152606081fd5b805160177fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec909101045b919050565b60008080610b258482610cee565b9250610b32846014610dee565b9050610b3f846017610cee565b91509193909250565b516042111590565b8051606090610b859083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe901610ede565b92915050565b6000610bc17f0000000000000000000000000000000000000000000000000000000000000000610bbc8686866110c5565b611142565b949350505050565b60007f80000000000000000000000000000000000000000000000000000000000000008210610bf757600080fd5b5090565b6000806000806000808773ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610c4a57600080fd5b505afa158015610c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c829190611c6b565b50939650610c9794508d935061127892505050565b91975095509050610cbf73ffffffffffffffffffffffffffffffffffffffff89168383611339565b9350869250505093509350935093565b6000610ce585610ce08686866110c5565b611991565b95945050505050565b600081826014011015610d6257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b8160140183511015610dd557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b600081826003011015610e6257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b8160030183511015610ed557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b60608182601f011015610f5257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015610fc357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b8183018451101561103557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b60608215801561105457604051915060008252602082016040526110bc565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561108d578051835260209283019201611075565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b6110cd6119fa565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161115611105579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff161061118457600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b60008060008351606014611318576044845110156112cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c290611e75565b60405180910390fd5b600484019350838060200190518101906112e59190611bdf565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c29190611e62565b8380602001905181019061132c9190611d02565b9250925092509193909250565b60008060008060008060008060088b73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561138d57600080fd5b505afa1580156113a1573d6000803e3d6000fd5b505050506040513d60208110156113b757600080fd5b5051600290810b908c900b816113c957fe5b0560020b901d905060006101008c73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561141c57600080fd5b505afa158015611430573d6000803e3d6000fd5b505050506040513d602081101561144657600080fd5b5051600290810b908d900b8161145857fe5b0560020b8161146357fe5b079050600060088d73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114b057600080fd5b505afa1580156114c4573d6000803e3d6000fd5b505050506040513d60208110156114da57600080fd5b5051600290810b908d900b816114ec57fe5b0560020b901d905060006101008e73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561153f57600080fd5b505afa158015611553573d6000803e3d6000fd5b505050506040513d602081101561156957600080fd5b5051600290810b908e900b8161157b57fe5b0560020b8161158657fe5b07905060008160ff166001901b8f73ffffffffffffffffffffffffffffffffffffffff16635339c296856040518263ffffffff1660e01b8152600401808260010b815260200191505060206040518083038186803b1580156115e757600080fd5b505afa1580156115fb573d6000803e3d6000fd5b505050506040513d602081101561161157600080fd5b5051161180156116a457508d73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561166257600080fd5b505afa158015611676573d6000803e3d6000fd5b505050506040513d602081101561168c57600080fd5b5051600290810b908d900b8161169e57fe5b0760020b155b80156116b557508b60020b8d60020b135b945060008360ff166001901b8f73ffffffffffffffffffffffffffffffffffffffff16635339c296876040518263ffffffff1660e01b8152600401808260010b815260200191505060206040518083038186803b15801561171557600080fd5b505afa158015611729573d6000803e3d6000fd5b505050506040513d602081101561173f57600080fd5b5051161180156117d257508d73ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b815260040160206040518083038186803b15801561179057600080fd5b505afa1580156117a4573d6000803e3d6000fd5b505050506040513d60208110156117ba57600080fd5b5051600290810b908e900b816117cc57fe5b0760020b155b80156117e357508b60020b8d60020b125b95508160010b8460010b128061180f57508160010b8460010b14801561180f57508060ff168360ff1611155b1561182557839950829750819850809650611832565b8199508097508398508296505b50507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60ff87161b9150505b8560010b8760010b13611969578560010b8760010b14156118a3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60ff858103161c165b6000818c73ffffffffffffffffffffffffffffffffffffffff16635339c2968a6040518263ffffffff1660e01b8152600401808260010b815260200191505060206040518083038186803b1580156118fa57600080fd5b505afa15801561190e573d6000803e3d6000fd5b505050506040513d602081101561192457600080fd5b5051169050611932816119c1565b61ffff16989098019750506001909501947fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61185e565b8115611976576001880397505b8215611983576001880397505b505050505050509392505050565b600061199d8383611142565b90503373ffffffffffffffffffffffffffffffffffffffff821614610b8557600080fd5b6000805b8215610b85577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8301909216916001016119c5565b604080516060810182526000808252602082018190529181019190915290565b600082601f830112611a2a578081fd5b8135611a3d611a3882611faf565b611f8b565b818152846020838601011115611a51578283fd5b816020850160208301379081016020019190915292915050565b8051600281900b8114610b1257600080fd5b600060a08284031215611a8e578081fd5b60405160a0810181811067ffffffffffffffff82111715611aab57fe5b6040529050808235611abc8161201f565b81526020830135611acc8161201f565b602082015260408381013590820152606083013562ffffff81168114611af157600080fd5b6060820152611b0260808401611b0e565b60808201525092915050565b8035610b128161201f565b805161ffff81168114610b1257600080fd5b60008060408385031215611b3d578182fd5b823567ffffffffffffffff811115611b53578283fd5b611b5f85828601611a1a565b95602094909401359450505050565b60008060408385031215611b80578182fd5b505080516020909101519092909150565b600080600060608486031215611ba5578081fd5b8335925060208401359150604084013567ffffffffffffffff811115611bc9578182fd5b611bd586828701611a1a565b9150509250925092565b600060208284031215611bf0578081fd5b815167ffffffffffffffff811115611c06578182fd5b8201601f81018413611c16578182fd5b8051611c24611a3882611faf565b818152856020838501011115611c38578384fd5b610ce5826020830160208601611fef565b600060a08284031215611c5a578081fd5b611c648383611a7d565b9392505050565b600080600080600080600060e0888a031215611c85578283fd5b8751611c908161201f565b9650611c9e60208901611a6b565b9550611cac60408901611b19565b9450611cba60608901611b19565b9350611cc860808901611b19565b925060a088015160ff81168114611cdd578283fd5b60c08901519092508015158114611cf2578182fd5b8091505092959891949750929550565b600080600060608486031215611d16578081fd5b835192506020840151611d288161201f565b9150611d3660408501611a6b565b90509250925092565b60008151808452611d57816020860160208601611fef565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a06080830152611e5760a0830184611d3f565b979650505050505050565b600060208252611c646020830184611d3f565b60208082526010908201527f556e6578706563746564206572726f7200000000000000000000000000000000604082015260600190565b600060808201868352602060808185015281875180845260a0860191508289019350845b81811015611f0257845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101611ed0565b505084810360408601528651808252908201925081870190845b81811015611f3e57825163ffffffff1685529383019391830191600101611f1c565b5050505060609290920192909252949350505050565b93845273ffffffffffffffffffffffffffffffffffffffff92909216602084015263ffffffff166040830152606082015260800190565b60405181810167ffffffffffffffff81118282101715611fa757fe5b604052919050565b600067ffffffffffffffff821115611fc357fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b8381101561200a578181015183820152602001611ff2565b83811115612019576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461204157600080fd5b5056fea164736f6c6343000706000a", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/v3-staker/artifacts/contracts/UniswapV3Staker.sol/UniswapV3Staker.json +var require_UniswapV3Staker = __commonJS({ + "node_modules/@uniswap/v3-staker/artifacts/contracts/UniswapV3Staker.sol/UniswapV3Staker.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "UniswapV3Staker", + sourceName: "contracts/UniswapV3Staker.sol", + abi: [ + { + inputs: [ + { + internalType: "contract IUniswapV3Factory", + name: "_factory", + type: "address" + }, + { + internalType: "contract INonfungiblePositionManager", + name: "_nonfungiblePositionManager", + type: "address" + }, + { + internalType: "uint256", + name: "_maxIncentiveStartLeadTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "_maxIncentiveDuration", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: true, + internalType: "address", + name: "oldOwner", + type: "address" + }, + { + indexed: true, + internalType: "address", + name: "newOwner", + type: "address" + } + ], + name: "DepositTransferred", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "contract IERC20Minimal", + name: "rewardToken", + type: "address" + }, + { + indexed: true, + internalType: "contract IUniswapV3Pool", + name: "pool", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + indexed: false, + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + indexed: false, + internalType: "address", + name: "refundee", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "reward", + type: "uint256" + } + ], + name: "IncentiveCreated", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "bytes32", + name: "incentiveId", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint256", + name: "refund", + type: "uint256" + } + ], + name: "IncentiveEnded", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "to", + type: "address" + }, + { + indexed: false, + internalType: "uint256", + name: "reward", + type: "uint256" + } + ], + name: "RewardClaimed", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: true, + internalType: "bytes32", + name: "incentiveId", + type: "bytes32" + }, + { + indexed: false, + internalType: "uint128", + name: "liquidity", + type: "uint128" + } + ], + name: "TokenStaked", + type: "event" + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + indexed: true, + internalType: "bytes32", + name: "incentiveId", + type: "bytes32" + } + ], + name: "TokenUnstaked", + type: "event" + }, + { + inputs: [ + { + internalType: "contract IERC20Minimal", + name: "rewardToken", + type: "address" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "uint256", + name: "amountRequested", + type: "uint256" + } + ], + name: "claimReward", + outputs: [ + { + internalType: "uint256", + name: "reward", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract IERC20Minimal", + name: "rewardToken", + type: "address" + }, + { + internalType: "contract IUniswapV3Pool", + name: "pool", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "address", + name: "refundee", + type: "address" + } + ], + internalType: "struct IUniswapV3Staker.IncentiveKey", + name: "key", + type: "tuple" + }, + { + internalType: "uint256", + name: "reward", + type: "uint256" + } + ], + name: "createIncentive", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + name: "deposits", + outputs: [ + { + internalType: "address", + name: "owner", + type: "address" + }, + { + internalType: "uint48", + name: "numberOfStakes", + type: "uint48" + }, + { + internalType: "int24", + name: "tickLower", + type: "int24" + }, + { + internalType: "int24", + name: "tickUpper", + type: "int24" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract IERC20Minimal", + name: "rewardToken", + type: "address" + }, + { + internalType: "contract IUniswapV3Pool", + name: "pool", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "address", + name: "refundee", + type: "address" + } + ], + internalType: "struct IUniswapV3Staker.IncentiveKey", + name: "key", + type: "tuple" + } + ], + name: "endIncentive", + outputs: [ + { + internalType: "uint256", + name: "refund", + type: "uint256" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "contract IUniswapV3Factory", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract IERC20Minimal", + name: "rewardToken", + type: "address" + }, + { + internalType: "contract IUniswapV3Pool", + name: "pool", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "address", + name: "refundee", + type: "address" + } + ], + internalType: "struct IUniswapV3Staker.IncentiveKey", + name: "key", + type: "tuple" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "getRewardInfo", + outputs: [ + { + internalType: "uint256", + name: "reward", + type: "uint256" + }, + { + internalType: "uint160", + name: "secondsInsideX128", + type: "uint160" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes32", + name: "", + type: "bytes32" + } + ], + name: "incentives", + outputs: [ + { + internalType: "uint256", + name: "totalRewardUnclaimed", + type: "uint256" + }, + { + internalType: "uint160", + name: "totalSecondsClaimedX128", + type: "uint160" + }, + { + internalType: "uint96", + name: "numberOfStakes", + type: "uint96" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxIncentiveDuration", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [], + name: "maxIncentiveStartLeadTime", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "nonfungiblePositionManager", + outputs: [ + { + internalType: "contract INonfungiblePositionManager", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "", + type: "address" + }, + { + internalType: "address", + name: "from", + type: "address" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "onERC721Received", + outputs: [ + { + internalType: "bytes4", + name: "", + type: "bytes4" + } + ], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "contract IERC20Minimal", + name: "", + type: "address" + }, + { + internalType: "address", + name: "", + type: "address" + } + ], + name: "rewards", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract IERC20Minimal", + name: "rewardToken", + type: "address" + }, + { + internalType: "contract IUniswapV3Pool", + name: "pool", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "address", + name: "refundee", + type: "address" + } + ], + internalType: "struct IUniswapV3Staker.IncentiveKey", + name: "key", + type: "tuple" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "stakeToken", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "bytes32", + name: "incentiveId", + type: "bytes32" + } + ], + name: "stakes", + outputs: [ + { + internalType: "uint160", + name: "secondsPerLiquidityInsideInitialX128", + type: "uint160" + }, + { + internalType: "uint128", + name: "liquidity", + type: "uint128" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "to", + type: "address" + } + ], + name: "transferDeposit", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "contract IERC20Minimal", + name: "rewardToken", + type: "address" + }, + { + internalType: "contract IUniswapV3Pool", + name: "pool", + type: "address" + }, + { + internalType: "uint256", + name: "startTime", + type: "uint256" + }, + { + internalType: "uint256", + name: "endTime", + type: "uint256" + }, + { + internalType: "address", + name: "refundee", + type: "address" + } + ], + internalType: "struct IUniswapV3Staker.IncentiveKey", + name: "key", + type: "tuple" + }, + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + } + ], + name: "unstakeToken", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "tokenId", + type: "uint256" + }, + { + internalType: "address", + name: "to", + type: "address" + }, + { + internalType: "bytes", + name: "data", + type: "bytes" + } + ], + name: "withdrawToken", + outputs: [], + stateMutability: "nonpayable", + type: "function" + } + ], + bytecode: "0x6101006040523480156200001257600080fd5b5060405162003ba338038062003ba383398101604081905262000035916200005e565b6001600160601b0319606094851b81166080529290931b90911660a05260c05260e052620000c3565b6000806000806080858703121562000074578384fd5b84516200008181620000aa565b60208601519094506200009481620000aa565b6040860151606090960151949790965092505050565b6001600160a01b0381168114620000c057600080fd5b50565b60805160601c60a05160601c60c05160e051613a816200012260003980610bbd5280610cfa5250806103b15280610c595250806103ed52806104525280610b4852806110555280611ad552508061124c5280611ab45250613a816000f3fe6080604052600436106101295760003560e01c8063b02c43d0116100a5578063c45a015511610074578063e70b9e2711610059578063e70b9e271461034f578063f2d2909b1461036f578063f549ab421461038f57610129565b8063c45a01551461030c578063d953186e1461032157610129565b8063b02c43d01461026c578063b44a27221461029c578063b5ada6e4146102be578063c36c1ea5146102de57610129565b80633c423f0b116100fc5780635cc5e3d9116100e15780635cc5e3d9146101fd578063607777951461021d578063ac9650d81461024c57610129565b80633c423f0b146101c85780633dc0714b146101e857610129565b806301b754401461012e578063150b7a021461015957806326bfee04146101865780632f2d783d146101a8575b600080fd5b34801561013a57600080fd5b506101436103af565b60405161015091906138b9565b60405180910390f35b34801561016557600080fd5b5061017961017436600461273f565b6103d3565b6040516101509190612db4565b34801561019257600080fd5b506101a66101a1366004612a9c565b61071c565b005b3480156101b457600080fd5b506101436101c3366004612946565b61084a565b3480156101d457600080fd5b506101a66101e3366004612ac0565b610928565b3480156101f457600080fd5b50610143610bbb565b34801561020957600080fd5b506101a6610218366004612a72565b610bdf565b34801561022957600080fd5b5061023d6102383660046128f6565b610e10565b604051610150939291906138e6565b61025f61025a3660046127d9565b610e67565b6040516101509190612d36565b34801561027857600080fd5b5061028c6102873660046128f6565b610fc1565b6040516101509493929190612cf5565b3480156102a857600080fd5b506102b1611053565b6040516101509190612de1565b3480156102ca57600080fd5b506101436102d9366004612a57565b611077565b3480156102ea57600080fd5b506102fe6102f9366004612b52565b6111c5565b604051610150929190613881565b34801561031857600080fd5b506102b161124a565b34801561032d57600080fd5b5061034161033c366004612a72565b61126e565b6040516101509291906138c2565b34801561035b57600080fd5b5061014361036a36600461290e565b611493565b34801561037b57600080fd5b506101a661038a366004612a72565b6114b0565b34801561039b57600080fd5b506101a66103aa366004612a72565b61151b565b7f000000000000000000000000000000000000000000000000000000000000000081565b60003373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461044d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449061375a565b60405180910390fd5b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166399fbab88876040518263ffffffff1660e01b81526004016104a991906138b9565b6101806040518083038186803b1580156104c257600080fd5b505afa1580156104d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fa9190612b73565b505050505096509650505050505060405180608001604052808873ffffffffffffffffffffffffffffffffffffffff168152602001600065ffffffffffff1681526020018360020b81526020018260020b8152506001600088815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548165ffffffffffff021916908365ffffffffffff160217905550604082015181600001601a6101000a81548162ffffff021916908360020b62ffffff160217905550606082015181600001601d6101000a81548162ffffff021916908360020b62ffffff1602179055509050508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff16877fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f60405160405180910390a483156106ef5760a08414156106ab576106a66106a085870187612a57565b87611964565b6106ef565b60006106b985870187612848565b905060005b81518110156106ec576106e48282815181106106d657fe5b602002602001015189611964565b6001016106be565b50505b507f150b7a0200000000000000000000000000000000000000000000000000000000979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116610769576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613183565b60008281526001602052604090205473ffffffffffffffffffffffffffffffffffffffff163381146107c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612e86565b60008381526001602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff868116918217909255915191929084169186917fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f91a4505050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360209081526040808320338452909152902054811580159061088957508082105b156108915750805b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602090815260408083203384529091529020805482900390556108d3848483611ed1565b8273ffffffffffffffffffffffffffffffffffffffff167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72418260405161091991906138b9565b60405180910390a29392505050565b73ffffffffffffffffffffffffffffffffffffffff8216301415610978576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906137b7565b6000838152600160209081526040918290208251608081018452905473ffffffffffffffffffffffffffffffffffffffff8116825265ffffffffffff740100000000000000000000000000000000000000008204169282018390527a0100000000000000000000000000000000000000000000000000008104600290810b810b810b948301949094527d0100000000000000000000000000000000000000000000000000000000009004830b830b90920b606083015215610a65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613046565b805173ffffffffffffffffffffffffffffffffffffffff163314610ab5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613481565b6000848152600160205260408082208290558251905173ffffffffffffffffffffffffffffffffffffffff9091169086907fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f908490a46040517fb88d4fde00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b88d4fde90610b83903090879089908890600401612cac565b600060405180830381600087803b158015610b9d57600080fd5b505af1158015610bb1573d6000803e3d6000fd5b5050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008111610c19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906135be565b8160400151421115610c57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906131e0565b7f0000000000000000000000000000000000000000000000000000000000000000428360400151031115610cb7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449061361b565b8160600151826040015110610cf8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906136d7565b7f000000000000000000000000000000000000000000000000000000000000000082604001518360600151031115610d5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613679565b6000610d67836120ad565b60008181526020819052604090208054840190558351909150610d8c903330856120de565b826020015173ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff167fa876344e28d4b5191ad03bc0d43f740e3695827ab0faccac739930b915ef8b0285604001518660600151876080015187604051610e039493929190613920565b60405180910390a3505050565b6000602081905290815260409020805460019091015473ffffffffffffffffffffffffffffffffffffffff8116907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1683565b60608167ffffffffffffffff81118015610e8057600080fd5b50604051908082528060200260200182016040528015610eb457816020015b6060815260200190600190039081610e9f5790505b50905060005b82811015610fba5760008030868685818110610ed257fe5b9050602002810190610ee49190613951565b604051610ef2929190612c9c565b600060405180830381855af49150503d8060008114610f2d576040519150601f19603f3d011682016040523d82523d6000602084013e610f32565b606091505b509150915081610f9857604481511015610f4b57600080fd5b60048101905080806020019051810190610f6591906129df565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449190612e16565b80848481518110610fa557fe5b60209081029190910101525050600101610eba565b5092915050565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff81169065ffffffffffff74010000000000000000000000000000000000000000820416907a0100000000000000000000000000000000000000000000000000008104600290810b917d0100000000000000000000000000000000000000000000000000000000009004900b84565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081606001514210156110b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612f66565b60006110c2836120ad565b6000818152602081905260409020805493509091508261110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612e29565b60018101547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1615611170576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906134de565b6000815583516080850151611186919085611ed1565b817f65124e6175aa9904f40735e87e2a37c76e87a609b855287bb4d1aba8257d9763846040516111b691906138b9565b60405180910390a25050919050565b60008281526002602090815260408083208484529091529020805473ffffffffffffffffffffffffffffffffffffffff8116916bffffffffffffffffffffffff740100000000000000000000000000000000000000009092048216918214156112425760018101546fffffffffffffffffffffffffffffffff1691505b509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080600061127c856120ad565b905060008061128b86846111c5565b915091506000816fffffffffffffffffffffffffffffffff16116112db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612f09565b60008681526001602081815260408084208151608081018352905473ffffffffffffffffffffffffffffffffffffffff80821683527401000000000000000000000000000000000000000080830465ffffffffffff16848701527a0100000000000000000000000000000000000000000000000000008304600290810b810b810b8587019081527d010000000000000000000000000000000000000000000000000000000000909404810b810b900b60608086019182528c8a52898852868a2087519182018852805482529098015480841689890152919091046bffffffffffffffffffffffff1687860152948e01519151945193517fa38807f200000000000000000000000000000000000000000000000000000000815292969491169263a38807f29261140e929190600401612e02565b60606040518083038186803b15801561142657600080fd5b505afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e9190612986565b50915050611482826000015183602001518c604001518d60600151888a87426122c3565b909b909a5098505050505050505050565b600360209081526000928352604080842090915290825290205481565b60008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff16331461150d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613561565b6115178282611964565b5050565b6000818152600160209081526040918290208251608081018452905473ffffffffffffffffffffffffffffffffffffffff8116825265ffffffffffff74010000000000000000000000000000000000000000820416928201929092527a0100000000000000000000000000000000000000000000000000008204600290810b810b810b938201939093527d010000000000000000000000000000000000000000000000000000000000909104820b820b90910b60608083019190915283015142101561163157805173ffffffffffffffffffffffffffffffffffffffff163314611631576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449061331e565b600061163c846120ad565b905060008061164b85846111c5565b91509150806fffffffffffffffffffffffffffffffff166000141561169c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612fe9565b600083815260208181526040808320888452600180845282852080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff65ffffffffffff740100000000000000000000000000000000000000008084048216830190911681027fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff9093169290921790925591830180546bffffffffffffffffffffffff848204811690930190921690920273ffffffffffffffffffffffffffffffffffffffff91821617909155928a01518883015160608a015193517fa38807f2000000000000000000000000000000000000000000000000000000008152929594919091169263a38807f2926117b7929190600401612e02565b60606040518083038186803b1580156117cf57600080fd5b505afa1580156117e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118079190612986565b508354600185015460408c015160608d0151939550600094508493611848939273ffffffffffffffffffffffffffffffffffffffff169190898b89426122c3565b6001860180547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff9182168401821617909155865483900387558c51811660009081526003602090815260408083208e5190941683529281528282208054860190558d8252600281528282208c8352905290812090815591935091506bffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff87161061192a576001810180547fffffffffffffffffffffffffffffffff000000000000000000000000000000001690555b60405188908b907fe1ba67e807ae0efa0a9549f9520ddc15c27f0a4dae2bc045e800ca66a940778f90600090a35050505050505050505050565b81604001514210156119a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906133a1565b816060015142106119df576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613126565b60006119ea836120ad565b600081815260208190526040902054909150611a32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906132c1565b60008281526002602090815260408083208484529091529020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1615611aa9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906130c9565b600080600080611afa7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000088612345565b9350935093509350866020015173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611b6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906133fe565b6000816fffffffffffffffffffffffffffffffff1611611bb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613263565b6000868152600160208181526040808420805465ffffffffffff740100000000000000000000000000000000000000008083048216870190911681027fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff9092169190911790915589855291849052808420830180546bffffffffffffffffffffffff848204811690950190941690920273ffffffffffffffffffffffffffffffffffffffff93841617909155517fa38807f20000000000000000000000000000000000000000000000000000000081529086169063a38807f290611ca19087908790600401612e02565b60606040518083038186803b158015611cb957600080fd5b505afa158015611ccd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf19190612986565b509150506bffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff831610611e0a576040805160608101825273ffffffffffffffffffffffffffffffffffffffff80841682526bffffffffffffffffffffffff60208084018281526fffffffffffffffffffffffffffffffff80891686880190815260008f8152600285528881208f82529094529690922094518554915190931674010000000000000000000000000000000000000000029284167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617909216178255915160019091018054919092167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116179055611e8e565b6000878152600260209081526040808320898452909152902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169190911716740100000000000000000000000000000000000000006bffffffffffffffffffffffff8516021790555b85877f3fe90ccd0a34e28f2b4b7a1e8323415ed9dd595f4eec5dfd461d18c2df336dbd84604051611ebf9190613864565b60405180910390a35050505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b60208310611fa657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611f69565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612008576040519150601f19603f3d011682016040523d82523d6000602084013e61200d565b606091505b509150915081801561203b57508051158061203b575080806020019051602081101561203857600080fd5b50515b6120a657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b5050505050565b6000816040516020016120c09190613814565b6040516020818303038152906040528051906020012090505b919050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b602083106121bb57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161217e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461221d576040519150601f19603f3d011682016040523d82523d6000602084013e612222565b606091505b5091509150818015612250575080511580612250575080806020019051602081101561224d57600080fd5b50515b6122bb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b505050505050565b600080878310156122d057fe5b508383036fffffffffffffffffffffffffffffffff861602600073ffffffffffffffffffffffffffffffffffffffff8a1660808a61230e8b8861244e565b03901b0390506123358b8373ffffffffffffffffffffffffffffffffffffffff1683612467565b9250509850989650505050505050565b60008060008060008060008873ffffffffffffffffffffffffffffffffffffffff166399fbab88896040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b1580156123a257600080fd5b505afa1580156123b6573d6000803e3d6000fd5b505050506040513d6101808110156123cd57600080fd5b50604080820151606080840151608085015160a086015160c087015160e0909701518651948501875273ffffffffffffffffffffffffffffffffffffffff80871686528416602086015262ffffff8316968501969096529b50949950929750909550909350909150612440908b90612534565b965050505093509350935093565b60008183101561245e5781612460565b825b9392505050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709868602925082811090839003039050806124bb57600084116124b057600080fd5b508290049050612460565b8084116124c757600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff161061257657600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b80516120d981613a4f565b8051600281900b81146120d957600080fd5b600060a08284031215612698578081fd5b60405160a0810181811067ffffffffffffffff821117156126b557fe5b60405290508082356126c681613a4f565b815260208301356126d681613a4f565b80602083015250604083013560408201526060830135606082015260808301356126ff81613a4f565b6080919091015292915050565b80516fffffffffffffffffffffffffffffffff811681146120d957600080fd5b805162ffffff811681146120d957600080fd5b600080600080600060808688031215612756578081fd5b853561276181613a4f565b9450602086013561277181613a4f565b935060408601359250606086013567ffffffffffffffff80821115612794578283fd5b818801915088601f8301126127a7578283fd5b8135818111156127b5578384fd5b8960208285010111156127c6578384fd5b9699959850939650602001949392505050565b600080602083850312156127eb578182fd5b823567ffffffffffffffff80821115612802578384fd5b818501915085601f830112612815578384fd5b813581811115612823578485fd5b8660208083028501011115612836578485fd5b60209290920196919550909350505050565b6000602080838503121561285a578182fd5b823567ffffffffffffffff80821115612871578384fd5b818501915085601f830112612884578384fd5b81358181111561289057fe5b61289d84858302016139bb565b818152848101925083850160a0808402860187018a10156128bc578788fd5b8795505b838610156128e8576128d28a83612687565b85526001959095019493860193908101906128c0565b509098975050505050505050565b600060208284031215612907578081fd5b5035919050565b60008060408385031215612920578182fd5b823561292b81613a4f565b9150602083013561293b81613a4f565b809150509250929050565b60008060006060848603121561295a578081fd5b833561296581613a4f565b9250602084013561297581613a4f565b929592945050506040919091013590565b60008060006060848603121561299a578081fd5b83518060060b81146129aa578182fd5b60208501519093506129bb81613a4f565b604085015190925063ffffffff811681146129d4578182fd5b809150509250925092565b6000602082840312156129f0578081fd5b815167ffffffffffffffff811115612a06578182fd5b8201601f81018413612a16578182fd5b8051612a29612a24826139df565b6139bb565b818152856020838501011115612a3d578384fd5b612a4e826020830160208601613a1f565b95945050505050565b600060a08284031215612a68578081fd5b6124608383612687565b60008060c08385031215612a84578182fd5b612a8e8484612687565b9460a0939093013593505050565b60008060408385031215612aae578182fd5b82359150602083013561293b81613a4f565b600080600060608486031215612ad4578081fd5b833592506020840135612ae681613a4f565b9150604084013567ffffffffffffffff811115612b01578182fd5b8401601f81018613612b11578182fd5b8035612b1f612a24826139df565b818152876020838501011115612b33578384fd5b8160208401602083013783602083830101528093505050509250925092565b60008060408385031215612b64578182fd5b50508035926020909101359150565b6000806000806000806000806000806000806101808d8f031215612b9557898afd5b8c516bffffffffffffffffffffffff81168114612bb0578a8bfd5b9b50612bbe60208e0161266a565b9a50612bcc60408e0161266a565b9950612bda60608e0161266a565b9850612be860808e0161272c565b9750612bf660a08e01612675565b9650612c0460c08e01612675565b9550612c1260e08e0161270c565b94506101008d015193506101208d01519250612c316101408e0161270c565b9150612c406101608e0161270c565b90509295989b509295989b509295989b565b60008151808452612c6a816020860160208601613a1f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000828483379101908152919050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152612ceb6080830184612c52565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff94909416845265ffffffffffff929092166020840152600290810b60408401520b606082015260800190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015612da7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612d95858351612c52565b94509285019290850190600101612d5b565b5092979650505050505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600292830b8152910b602082015260400190565b6000602082526124606020830184612c52565b60208082526032908201527f556e697377617056335374616b65723a3a656e64496e63656e746976653a206e60408201527f6f20726566756e6420617661696c61626c650000000000000000000000000000606082015260800190565b60208082526045908201527f556e697377617056335374616b65723a3a7472616e736665724465706f73697460408201527f3a2063616e206f6e6c792062652063616c6c6564206279206465706f7369742060608201527f6f776e6572000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526034908201527f556e697377617056335374616b65723a3a676574526577617264496e666f3a2060408201527f7374616b6520646f6573206e6f74206578697374000000000000000000000000606082015260800190565b60208082526043908201527f556e697377617056335374616b65723a3a656e64496e63656e746976653a206360408201527f616e6e6f7420656e6420696e63656e74697665206265666f726520656e64207460608201527f696d650000000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526033908201527f556e697377617056335374616b65723a3a756e7374616b65546f6b656e3a207360408201527f74616b6520646f6573206e6f7420657869737400000000000000000000000000606082015260800190565b60208082526042908201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060408201527f63616e6e6f7420776974686472617720746f6b656e207768696c65207374616b60608201527f6564000000000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526031908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20746f6b60408201527f656e20616c7265616479207374616b6564000000000000000000000000000000606082015260800190565b6020808252602c908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20696e6360408201527f656e7469766520656e6465640000000000000000000000000000000000000000606082015260800190565b6020808252603c908201527f556e697377617056335374616b65723a3a7472616e736665724465706f73697460408201527f3a20696e76616c6964207472616e7366657220726563697069656e7400000000606082015260800190565b60208082526049908201527f556e697377617056335374616b65723a3a637265617465496e63656e7469766560408201527f3a2073746172742074696d65206d757374206265206e6f77206f7220696e207460608201527f6865206675747572650000000000000000000000000000000000000000000000608082015260a00190565b602080825260409082018190527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a2063616e908201527f6e6f74207374616b6520746f6b656e20776974682030206c6971756964697479606082015260800190565b60208082526033908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a206e6f6e60408201527f2d6578697374656e7420696e63656e7469766500000000000000000000000000606082015260800190565b60208082526056908201527f556e697377617056335374616b65723a3a756e7374616b65546f6b656e3a206f60408201527f6e6c79206f776e65722063616e20776974686472617720746f6b656e2062656660608201527f6f726520696e63656e7469766520656e642074696d6500000000000000000000608082015260a00190565b60208082526032908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20696e6360408201527f656e74697665206e6f7420737461727465640000000000000000000000000000606082015260800190565b60208082526041908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20746f6b60408201527f656e20706f6f6c206973206e6f742074686520696e63656e7469766520706f6f60608201527f6c00000000000000000000000000000000000000000000000000000000000000608082015260a00190565b6020808252603d908201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060408201527f6f6e6c79206f776e65722063616e20776974686472617720746f6b656e000000606082015260800190565b6020808252604d908201527f556e697377617056335374616b65723a3a656e64496e63656e746976653a206360408201527f616e6e6f7420656e6420696e63656e74697665207768696c65206465706f736960608201527f747320617265207374616b656400000000000000000000000000000000000000608082015260a00190565b60208082526037908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a206f6e6c60408201527f79206f776e65722063616e207374616b6520746f6b656e000000000000000000606082015260800190565b60208082526039908201527f556e697377617056335374616b65723a3a637265617465496e63656e7469766560408201527f3a20726577617264206d75737420626520706f73697469766500000000000000606082015260800190565b602080825260409082018190527f556e697377617056335374616b65723a3a637265617465496e63656e74697665908201527f3a2073746172742074696d6520746f6f2066617220696e746f20667574757265606082015260800190565b602080825260409082018190527f556e697377617056335374616b65723a3a637265617465496e63656e74697665908201527f3a20696e63656e74697665206475726174696f6e20697320746f6f206c6f6e67606082015260800190565b60208082526044908201527f556e697377617056335374616b65723a3a637265617465496e63656e7469766560408201527f3a2073746172742074696d65206d757374206265206265666f726520656e642060608201527f74696d6500000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526032908201527f556e697377617056335374616b65723a3a6f6e4552433732315265636569766560408201527f643a206e6f74206120756e697633206e66740000000000000000000000000000606082015260800190565b60208082526039908201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060408201527f63616e6e6f7420776974686472617720746f207374616b657200000000000000606082015260800190565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519083015260608084015190830152608092830151169181019190915260a00190565b6fffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9290921682526fffffffffffffffffffffffffffffffff16602082015260400190565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b92835273ffffffffffffffffffffffffffffffffffffffff9190911660208301526bffffffffffffffffffffffff16604082015260600190565b938452602084019290925273ffffffffffffffffffffffffffffffffffffffff166040830152606082015260800190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613985578283fd5b83018035915067ffffffffffffffff82111561399f578283fd5b6020019150368190038213156139b457600080fd5b9250929050565b60405181810167ffffffffffffffff811182821017156139d757fe5b604052919050565b600067ffffffffffffffff8211156139f357fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015613a3a578181015183820152602001613a22565b83811115613a49576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff81168114613a7157600080fd5b5056fea164736f6c6343000706000a", + deployedBytecode: "0x6080604052600436106101295760003560e01c8063b02c43d0116100a5578063c45a015511610074578063e70b9e2711610059578063e70b9e271461034f578063f2d2909b1461036f578063f549ab421461038f57610129565b8063c45a01551461030c578063d953186e1461032157610129565b8063b02c43d01461026c578063b44a27221461029c578063b5ada6e4146102be578063c36c1ea5146102de57610129565b80633c423f0b116100fc5780635cc5e3d9116100e15780635cc5e3d9146101fd578063607777951461021d578063ac9650d81461024c57610129565b80633c423f0b146101c85780633dc0714b146101e857610129565b806301b754401461012e578063150b7a021461015957806326bfee04146101865780632f2d783d146101a8575b600080fd5b34801561013a57600080fd5b506101436103af565b60405161015091906138b9565b60405180910390f35b34801561016557600080fd5b5061017961017436600461273f565b6103d3565b6040516101509190612db4565b34801561019257600080fd5b506101a66101a1366004612a9c565b61071c565b005b3480156101b457600080fd5b506101436101c3366004612946565b61084a565b3480156101d457600080fd5b506101a66101e3366004612ac0565b610928565b3480156101f457600080fd5b50610143610bbb565b34801561020957600080fd5b506101a6610218366004612a72565b610bdf565b34801561022957600080fd5b5061023d6102383660046128f6565b610e10565b604051610150939291906138e6565b61025f61025a3660046127d9565b610e67565b6040516101509190612d36565b34801561027857600080fd5b5061028c6102873660046128f6565b610fc1565b6040516101509493929190612cf5565b3480156102a857600080fd5b506102b1611053565b6040516101509190612de1565b3480156102ca57600080fd5b506101436102d9366004612a57565b611077565b3480156102ea57600080fd5b506102fe6102f9366004612b52565b6111c5565b604051610150929190613881565b34801561031857600080fd5b506102b161124a565b34801561032d57600080fd5b5061034161033c366004612a72565b61126e565b6040516101509291906138c2565b34801561035b57600080fd5b5061014361036a36600461290e565b611493565b34801561037b57600080fd5b506101a661038a366004612a72565b6114b0565b34801561039b57600080fd5b506101a66103aa366004612a72565b61151b565b7f000000000000000000000000000000000000000000000000000000000000000081565b60003373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000161461044d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449061375a565b60405180910390fd5b6000807f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166399fbab88876040518263ffffffff1660e01b81526004016104a991906138b9565b6101806040518083038186803b1580156104c257600080fd5b505afa1580156104d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104fa9190612b73565b505050505096509650505050505060405180608001604052808873ffffffffffffffffffffffffffffffffffffffff168152602001600065ffffffffffff1681526020018360020b81526020018260020b8152506001600088815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548165ffffffffffff021916908365ffffffffffff160217905550604082015181600001601a6101000a81548162ffffff021916908360020b62ffffff160217905550606082015181600001601d6101000a81548162ffffff021916908360020b62ffffff1602179055509050508673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff16877fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f60405160405180910390a483156106ef5760a08414156106ab576106a66106a085870187612a57565b87611964565b6106ef565b60006106b985870187612848565b905060005b81518110156106ec576106e48282815181106106d657fe5b602002602001015189611964565b6001016106be565b50505b507f150b7a0200000000000000000000000000000000000000000000000000000000979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff8116610769576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613183565b60008281526001602052604090205473ffffffffffffffffffffffffffffffffffffffff163381146107c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612e86565b60008381526001602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff868116918217909255915191929084169186917fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f91a4505050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360209081526040808320338452909152902054811580159061088957508082105b156108915750805b73ffffffffffffffffffffffffffffffffffffffff841660009081526003602090815260408083203384529091529020805482900390556108d3848483611ed1565b8273ffffffffffffffffffffffffffffffffffffffff167f106f923f993c2149d49b4255ff723acafa1f2d94393f561d3eda32ae348f72418260405161091991906138b9565b60405180910390a29392505050565b73ffffffffffffffffffffffffffffffffffffffff8216301415610978576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906137b7565b6000838152600160209081526040918290208251608081018452905473ffffffffffffffffffffffffffffffffffffffff8116825265ffffffffffff740100000000000000000000000000000000000000008204169282018390527a0100000000000000000000000000000000000000000000000000008104600290810b810b810b948301949094527d0100000000000000000000000000000000000000000000000000000000009004830b830b90920b606083015215610a65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613046565b805173ffffffffffffffffffffffffffffffffffffffff163314610ab5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613481565b6000848152600160205260408082208290558251905173ffffffffffffffffffffffffffffffffffffffff9091169086907fcdfc765b85e1048bee3c6a0f9d1c91fc7c4631f5fe5745a55fc6843db5c3260f908490a46040517fb88d4fde00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063b88d4fde90610b83903090879089908890600401612cac565b600060405180830381600087803b158015610b9d57600080fd5b505af1158015610bb1573d6000803e3d6000fd5b5050505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008111610c19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906135be565b8160400151421115610c57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906131e0565b7f0000000000000000000000000000000000000000000000000000000000000000428360400151031115610cb7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449061361b565b8160600151826040015110610cf8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906136d7565b7f000000000000000000000000000000000000000000000000000000000000000082604001518360600151031115610d5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613679565b6000610d67836120ad565b60008181526020819052604090208054840190558351909150610d8c903330856120de565b826020015173ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff167fa876344e28d4b5191ad03bc0d43f740e3695827ab0faccac739930b915ef8b0285604001518660600151876080015187604051610e039493929190613920565b60405180910390a3505050565b6000602081905290815260409020805460019091015473ffffffffffffffffffffffffffffffffffffffff8116907401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1683565b60608167ffffffffffffffff81118015610e8057600080fd5b50604051908082528060200260200182016040528015610eb457816020015b6060815260200190600190039081610e9f5790505b50905060005b82811015610fba5760008030868685818110610ed257fe5b9050602002810190610ee49190613951565b604051610ef2929190612c9c565b600060405180830381855af49150503d8060008114610f2d576040519150601f19603f3d011682016040523d82523d6000602084013e610f32565b606091505b509150915081610f9857604481511015610f4b57600080fd5b60048101905080806020019051810190610f6591906129df565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449190612e16565b80848481518110610fa557fe5b60209081029190910101525050600101610eba565b5092915050565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff81169065ffffffffffff74010000000000000000000000000000000000000000820416907a0100000000000000000000000000000000000000000000000000008104600290810b917d0100000000000000000000000000000000000000000000000000000000009004900b84565b7f000000000000000000000000000000000000000000000000000000000000000081565b600081606001514210156110b7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612f66565b60006110c2836120ad565b6000818152602081905260409020805493509091508261110e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612e29565b60018101547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1615611170576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906134de565b6000815583516080850151611186919085611ed1565b817f65124e6175aa9904f40735e87e2a37c76e87a609b855287bb4d1aba8257d9763846040516111b691906138b9565b60405180910390a25050919050565b60008281526002602090815260408083208484529091529020805473ffffffffffffffffffffffffffffffffffffffff8116916bffffffffffffffffffffffff740100000000000000000000000000000000000000009092048216918214156112425760018101546fffffffffffffffffffffffffffffffff1691505b509250929050565b7f000000000000000000000000000000000000000000000000000000000000000081565b600080600061127c856120ad565b905060008061128b86846111c5565b915091506000816fffffffffffffffffffffffffffffffff16116112db576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612f09565b60008681526001602081815260408084208151608081018352905473ffffffffffffffffffffffffffffffffffffffff80821683527401000000000000000000000000000000000000000080830465ffffffffffff16848701527a0100000000000000000000000000000000000000000000000000008304600290810b810b810b8587019081527d010000000000000000000000000000000000000000000000000000000000909404810b810b900b60608086019182528c8a52898852868a2087519182018852805482529098015480841689890152919091046bffffffffffffffffffffffff1687860152948e01519151945193517fa38807f200000000000000000000000000000000000000000000000000000000815292969491169263a38807f29261140e929190600401612e02565b60606040518083038186803b15801561142657600080fd5b505afa15801561143a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061145e9190612986565b50915050611482826000015183602001518c604001518d60600151888a87426122c3565b909b909a5098505050505050505050565b600360209081526000928352604080842090915290825290205481565b60008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff16331461150d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613561565b6115178282611964565b5050565b6000818152600160209081526040918290208251608081018452905473ffffffffffffffffffffffffffffffffffffffff8116825265ffffffffffff74010000000000000000000000000000000000000000820416928201929092527a0100000000000000000000000000000000000000000000000000008204600290810b810b810b938201939093527d010000000000000000000000000000000000000000000000000000000000909104820b820b90910b60608083019190915283015142101561163157805173ffffffffffffffffffffffffffffffffffffffff163314611631576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104449061331e565b600061163c846120ad565b905060008061164b85846111c5565b91509150806fffffffffffffffffffffffffffffffff166000141561169c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490612fe9565b600083815260208181526040808320888452600180845282852080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff65ffffffffffff740100000000000000000000000000000000000000008084048216830190911681027fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff9093169290921790925591830180546bffffffffffffffffffffffff848204811690930190921690920273ffffffffffffffffffffffffffffffffffffffff91821617909155928a01518883015160608a015193517fa38807f2000000000000000000000000000000000000000000000000000000008152929594919091169263a38807f2926117b7929190600401612e02565b60606040518083038186803b1580156117cf57600080fd5b505afa1580156117e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118079190612986565b508354600185015460408c015160608d0151939550600094508493611848939273ffffffffffffffffffffffffffffffffffffffff169190898b89426122c3565b6001860180547fffffffffffffffffffffffff0000000000000000000000000000000000000000811673ffffffffffffffffffffffffffffffffffffffff9182168401821617909155865483900387558c51811660009081526003602090815260408083208e5190941683529281528282208054860190558d8252600281528282208c8352905290812090815591935091506bffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff87161061192a576001810180547fffffffffffffffffffffffffffffffff000000000000000000000000000000001690555b60405188908b907fe1ba67e807ae0efa0a9549f9520ddc15c27f0a4dae2bc045e800ca66a940778f90600090a35050505050505050505050565b81604001514210156119a2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906133a1565b816060015142106119df576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613126565b60006119ea836120ad565b600081815260208190526040902054909150611a32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906132c1565b60008281526002602090815260408083208484529091529020547401000000000000000000000000000000000000000090046bffffffffffffffffffffffff1615611aa9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906130c9565b600080600080611afa7f00000000000000000000000000000000000000000000000000000000000000007f000000000000000000000000000000000000000000000000000000000000000088612345565b9350935093509350866020015173ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611b6b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610444906133fe565b6000816fffffffffffffffffffffffffffffffff1611611bb7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044490613263565b6000868152600160208181526040808420805465ffffffffffff740100000000000000000000000000000000000000008083048216870190911681027fffffffffffff000000000000ffffffffffffffffffffffffffffffffffffffff9092169190911790915589855291849052808420830180546bffffffffffffffffffffffff848204811690950190941690920273ffffffffffffffffffffffffffffffffffffffff93841617909155517fa38807f20000000000000000000000000000000000000000000000000000000081529086169063a38807f290611ca19087908790600401612e02565b60606040518083038186803b158015611cb957600080fd5b505afa158015611ccd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf19190612986565b509150506bffffffffffffffffffffffff6fffffffffffffffffffffffffffffffff831610611e0a576040805160608101825273ffffffffffffffffffffffffffffffffffffffff80841682526bffffffffffffffffffffffff60208084018281526fffffffffffffffffffffffffffffffff80891686880190815260008f8152600285528881208f82529094529690922094518554915190931674010000000000000000000000000000000000000000029284167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617909216178255915160019091018054919092167fffffffffffffffffffffffffffffffff00000000000000000000000000000000909116179055611e8e565b6000878152600260209081526040808320898452909152902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169190911716740100000000000000000000000000000000000000006bffffffffffffffffffffffff8516021790555b85877f3fe90ccd0a34e28f2b4b7a1e8323415ed9dd595f4eec5dfd461d18c2df336dbd84604051611ebf9190613864565b60405180910390a35050505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b60208310611fa657805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611f69565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612008576040519150601f19603f3d011682016040523d82523d6000602084013e61200d565b606091505b509150915081801561203b57508051158061203b575080806020019051602081101561203857600080fd5b50515b6120a657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b5050505050565b6000816040516020016120c09190613814565b6040516020818303038152906040528051906020012090505b919050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b602083106121bb57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161217e565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461221d576040519150601f19603f3d011682016040523d82523d6000602084013e612222565b606091505b5091509150818015612250575080511580612250575080806020019051602081101561224d57600080fd5b50515b6122bb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b505050505050565b600080878310156122d057fe5b508383036fffffffffffffffffffffffffffffffff861602600073ffffffffffffffffffffffffffffffffffffffff8a1660808a61230e8b8861244e565b03901b0390506123358b8373ffffffffffffffffffffffffffffffffffffffff1683612467565b9250509850989650505050505050565b60008060008060008060008873ffffffffffffffffffffffffffffffffffffffff166399fbab88896040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b1580156123a257600080fd5b505afa1580156123b6573d6000803e3d6000fd5b505050506040513d6101808110156123cd57600080fd5b50604080820151606080840151608085015160a086015160c087015160e0909701518651948501875273ffffffffffffffffffffffffffffffffffffffff80871686528416602086015262ffffff8316968501969096529b50949950929750909550909350909150612440908b90612534565b965050505093509350935093565b60008183101561245e5781612460565b825b9392505050565b600080807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff858709868602925082811090839003039050806124bb57600084116124b057600080fd5b508290049050612460565b8084116124c757600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff161061257657600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b80516120d981613a4f565b8051600281900b81146120d957600080fd5b600060a08284031215612698578081fd5b60405160a0810181811067ffffffffffffffff821117156126b557fe5b60405290508082356126c681613a4f565b815260208301356126d681613a4f565b80602083015250604083013560408201526060830135606082015260808301356126ff81613a4f565b6080919091015292915050565b80516fffffffffffffffffffffffffffffffff811681146120d957600080fd5b805162ffffff811681146120d957600080fd5b600080600080600060808688031215612756578081fd5b853561276181613a4f565b9450602086013561277181613a4f565b935060408601359250606086013567ffffffffffffffff80821115612794578283fd5b818801915088601f8301126127a7578283fd5b8135818111156127b5578384fd5b8960208285010111156127c6578384fd5b9699959850939650602001949392505050565b600080602083850312156127eb578182fd5b823567ffffffffffffffff80821115612802578384fd5b818501915085601f830112612815578384fd5b813581811115612823578485fd5b8660208083028501011115612836578485fd5b60209290920196919550909350505050565b6000602080838503121561285a578182fd5b823567ffffffffffffffff80821115612871578384fd5b818501915085601f830112612884578384fd5b81358181111561289057fe5b61289d84858302016139bb565b818152848101925083850160a0808402860187018a10156128bc578788fd5b8795505b838610156128e8576128d28a83612687565b85526001959095019493860193908101906128c0565b509098975050505050505050565b600060208284031215612907578081fd5b5035919050565b60008060408385031215612920578182fd5b823561292b81613a4f565b9150602083013561293b81613a4f565b809150509250929050565b60008060006060848603121561295a578081fd5b833561296581613a4f565b9250602084013561297581613a4f565b929592945050506040919091013590565b60008060006060848603121561299a578081fd5b83518060060b81146129aa578182fd5b60208501519093506129bb81613a4f565b604085015190925063ffffffff811681146129d4578182fd5b809150509250925092565b6000602082840312156129f0578081fd5b815167ffffffffffffffff811115612a06578182fd5b8201601f81018413612a16578182fd5b8051612a29612a24826139df565b6139bb565b818152856020838501011115612a3d578384fd5b612a4e826020830160208601613a1f565b95945050505050565b600060a08284031215612a68578081fd5b6124608383612687565b60008060c08385031215612a84578182fd5b612a8e8484612687565b9460a0939093013593505050565b60008060408385031215612aae578182fd5b82359150602083013561293b81613a4f565b600080600060608486031215612ad4578081fd5b833592506020840135612ae681613a4f565b9150604084013567ffffffffffffffff811115612b01578182fd5b8401601f81018613612b11578182fd5b8035612b1f612a24826139df565b818152876020838501011115612b33578384fd5b8160208401602083013783602083830101528093505050509250925092565b60008060408385031215612b64578182fd5b50508035926020909101359150565b6000806000806000806000806000806000806101808d8f031215612b9557898afd5b8c516bffffffffffffffffffffffff81168114612bb0578a8bfd5b9b50612bbe60208e0161266a565b9a50612bcc60408e0161266a565b9950612bda60608e0161266a565b9850612be860808e0161272c565b9750612bf660a08e01612675565b9650612c0460c08e01612675565b9550612c1260e08e0161270c565b94506101008d015193506101208d01519250612c316101408e0161270c565b9150612c406101608e0161270c565b90509295989b509295989b509295989b565b60008151808452612c6a816020860160208601613a1f565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000828483379101908152919050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152612ceb6080830184612c52565b9695505050505050565b73ffffffffffffffffffffffffffffffffffffffff94909416845265ffffffffffff929092166020840152600290810b60408401520b606082015260800190565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015612da7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612d95858351612c52565b94509285019290850190600101612d5b565b5092979650505050505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600292830b8152910b602082015260400190565b6000602082526124606020830184612c52565b60208082526032908201527f556e697377617056335374616b65723a3a656e64496e63656e746976653a206e60408201527f6f20726566756e6420617661696c61626c650000000000000000000000000000606082015260800190565b60208082526045908201527f556e697377617056335374616b65723a3a7472616e736665724465706f73697460408201527f3a2063616e206f6e6c792062652063616c6c6564206279206465706f7369742060608201527f6f776e6572000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526034908201527f556e697377617056335374616b65723a3a676574526577617264496e666f3a2060408201527f7374616b6520646f6573206e6f74206578697374000000000000000000000000606082015260800190565b60208082526043908201527f556e697377617056335374616b65723a3a656e64496e63656e746976653a206360408201527f616e6e6f7420656e6420696e63656e74697665206265666f726520656e64207460608201527f696d650000000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526033908201527f556e697377617056335374616b65723a3a756e7374616b65546f6b656e3a207360408201527f74616b6520646f6573206e6f7420657869737400000000000000000000000000606082015260800190565b60208082526042908201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060408201527f63616e6e6f7420776974686472617720746f6b656e207768696c65207374616b60608201527f6564000000000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526031908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20746f6b60408201527f656e20616c7265616479207374616b6564000000000000000000000000000000606082015260800190565b6020808252602c908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20696e6360408201527f656e7469766520656e6465640000000000000000000000000000000000000000606082015260800190565b6020808252603c908201527f556e697377617056335374616b65723a3a7472616e736665724465706f73697460408201527f3a20696e76616c6964207472616e7366657220726563697069656e7400000000606082015260800190565b60208082526049908201527f556e697377617056335374616b65723a3a637265617465496e63656e7469766560408201527f3a2073746172742074696d65206d757374206265206e6f77206f7220696e207460608201527f6865206675747572650000000000000000000000000000000000000000000000608082015260a00190565b602080825260409082018190527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a2063616e908201527f6e6f74207374616b6520746f6b656e20776974682030206c6971756964697479606082015260800190565b60208082526033908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a206e6f6e60408201527f2d6578697374656e7420696e63656e7469766500000000000000000000000000606082015260800190565b60208082526056908201527f556e697377617056335374616b65723a3a756e7374616b65546f6b656e3a206f60408201527f6e6c79206f776e65722063616e20776974686472617720746f6b656e2062656660608201527f6f726520696e63656e7469766520656e642074696d6500000000000000000000608082015260a00190565b60208082526032908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20696e6360408201527f656e74697665206e6f7420737461727465640000000000000000000000000000606082015260800190565b60208082526041908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a20746f6b60408201527f656e20706f6f6c206973206e6f742074686520696e63656e7469766520706f6f60608201527f6c00000000000000000000000000000000000000000000000000000000000000608082015260a00190565b6020808252603d908201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060408201527f6f6e6c79206f776e65722063616e20776974686472617720746f6b656e000000606082015260800190565b6020808252604d908201527f556e697377617056335374616b65723a3a656e64496e63656e746976653a206360408201527f616e6e6f7420656e6420696e63656e74697665207768696c65206465706f736960608201527f747320617265207374616b656400000000000000000000000000000000000000608082015260a00190565b60208082526037908201527f556e697377617056335374616b65723a3a7374616b65546f6b656e3a206f6e6c60408201527f79206f776e65722063616e207374616b6520746f6b656e000000000000000000606082015260800190565b60208082526039908201527f556e697377617056335374616b65723a3a637265617465496e63656e7469766560408201527f3a20726577617264206d75737420626520706f73697469766500000000000000606082015260800190565b602080825260409082018190527f556e697377617056335374616b65723a3a637265617465496e63656e74697665908201527f3a2073746172742074696d6520746f6f2066617220696e746f20667574757265606082015260800190565b602080825260409082018190527f556e697377617056335374616b65723a3a637265617465496e63656e74697665908201527f3a20696e63656e74697665206475726174696f6e20697320746f6f206c6f6e67606082015260800190565b60208082526044908201527f556e697377617056335374616b65723a3a637265617465496e63656e7469766560408201527f3a2073746172742074696d65206d757374206265206265666f726520656e642060608201527f74696d6500000000000000000000000000000000000000000000000000000000608082015260a00190565b60208082526032908201527f556e697377617056335374616b65723a3a6f6e4552433732315265636569766560408201527f643a206e6f74206120756e697633206e66740000000000000000000000000000606082015260800190565b60208082526039908201527f556e697377617056335374616b65723a3a7769746864726177546f6b656e3a2060408201527f63616e6e6f7420776974686472617720746f207374616b657200000000000000606082015260800190565b815173ffffffffffffffffffffffffffffffffffffffff90811682526020808401518216908301526040808401519083015260608084015190830152608092830151169181019190915260a00190565b6fffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9290921682526fffffffffffffffffffffffffffffffff16602082015260400190565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b92835273ffffffffffffffffffffffffffffffffffffffff9190911660208301526bffffffffffffffffffffffff16604082015260600190565b938452602084019290925273ffffffffffffffffffffffffffffffffffffffff166040830152606082015260800190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112613985578283fd5b83018035915067ffffffffffffffff82111561399f578283fd5b6020019150368190038213156139b457600080fd5b9250929050565b60405181810167ffffffffffffffff811182821017156139d757fe5b604052919050565b600067ffffffffffffffff8211156139f357fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015613a3a578181015183820152602001613a22565b83811115613a49576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff81168114613a7157600080fd5b5056fea164736f6c6343000706000a", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/v3-periphery/artifacts/contracts/SwapRouter.sol/SwapRouter.json +var require_SwapRouter = __commonJS({ + "node_modules/@uniswap/v3-periphery/artifacts/contracts/SwapRouter.sol/SwapRouter.json"(exports2, module2) { + module2.exports = { + _format: "hh-sol-artifact-1", + contractName: "SwapRouter", + sourceName: "contracts/SwapRouter.sol", + abi: [ + { + inputs: [ + { + internalType: "address", + name: "_factory", + type: "address" + }, + { + internalType: "address", + name: "_WETH9", + type: "address" + } + ], + stateMutability: "nonpayable", + type: "constructor" + }, + { + inputs: [], + name: "WETH9", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "bytes", + name: "path", + type: "bytes" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountOutMinimum", + type: "uint256" + } + ], + internalType: "struct ISwapRouter.ExactInputParams", + name: "params", + type: "tuple" + } + ], + name: "exactInput", + outputs: [ + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "tokenIn", + type: "address" + }, + { + internalType: "address", + name: "tokenOut", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountOutMinimum", + type: "uint256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + } + ], + internalType: "struct ISwapRouter.ExactInputSingleParams", + name: "params", + type: "tuple" + } + ], + name: "exactInputSingle", + outputs: [ + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "bytes", + name: "path", + type: "bytes" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountInMaximum", + type: "uint256" + } + ], + internalType: "struct ISwapRouter.ExactOutputParams", + name: "params", + type: "tuple" + } + ], + name: "exactOutput", + outputs: [ + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + components: [ + { + internalType: "address", + name: "tokenIn", + type: "address" + }, + { + internalType: "address", + name: "tokenOut", + type: "address" + }, + { + internalType: "uint24", + name: "fee", + type: "uint24" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountOut", + type: "uint256" + }, + { + internalType: "uint256", + name: "amountInMaximum", + type: "uint256" + }, + { + internalType: "uint160", + name: "sqrtPriceLimitX96", + type: "uint160" + } + ], + internalType: "struct ISwapRouter.ExactOutputSingleParams", + name: "params", + type: "tuple" + } + ], + name: "exactOutputSingle", + outputs: [ + { + internalType: "uint256", + name: "amountIn", + type: "uint256" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "factory", + outputs: [ + { + internalType: "address", + name: "", + type: "address" + } + ], + stateMutability: "view", + type: "function" + }, + { + inputs: [ + { + internalType: "bytes[]", + name: "data", + type: "bytes[]" + } + ], + name: "multicall", + outputs: [ + { + internalType: "bytes[]", + name: "results", + type: "bytes[]" + } + ], + stateMutability: "payable", + type: "function" + }, + { + inputs: [], + name: "refundETH", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermit", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitAllowed", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "nonce", + type: "uint256" + }, + { + internalType: "uint256", + name: "expiry", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitAllowedIfNecessary", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "value", + type: "uint256" + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256" + }, + { + internalType: "uint8", + name: "v", + type: "uint8" + }, + { + internalType: "bytes32", + name: "r", + type: "bytes32" + }, + { + internalType: "bytes32", + name: "s", + type: "bytes32" + } + ], + name: "selfPermitIfNecessary", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "sweepToken", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "address", + name: "token", + type: "address" + }, + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "feeBips", + type: "uint256" + }, + { + internalType: "address", + name: "feeRecipient", + type: "address" + } + ], + name: "sweepTokenWithFee", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "int256", + name: "amount0Delta", + type: "int256" + }, + { + internalType: "int256", + name: "amount1Delta", + type: "int256" + }, + { + internalType: "bytes", + name: "_data", + type: "bytes" + } + ], + name: "uniswapV3SwapCallback", + outputs: [], + stateMutability: "nonpayable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + } + ], + name: "unwrapWETH9", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + inputs: [ + { + internalType: "uint256", + name: "amountMinimum", + type: "uint256" + }, + { + internalType: "address", + name: "recipient", + type: "address" + }, + { + internalType: "uint256", + name: "feeBips", + type: "uint256" + }, + { + internalType: "address", + name: "feeRecipient", + type: "address" + } + ], + name: "unwrapWETH9WithFee", + outputs: [], + stateMutability: "payable", + type: "function" + }, + { + stateMutability: "payable", + type: "receive" + } + ], + bytecode: "0x60c06040526000196000553480156200001757600080fd5b506040516200302f3803806200302f8339810160408190526200003a9162000076565b6001600160601b0319606092831b8116608052911b1660a052620000ad565b80516001600160a01b03811681146200007157600080fd5b919050565b6000806040838503121562000089578182fd5b620000948362000059565b9150620000a46020840162000059565b90509250929050565b60805160601c60a05160601c612f26620001096000398061012f528061058352806106ad5280610747528061078752806108b15280611c435280611ca35280611d24525080610dc6528061140c5280611e265250612f266000f3fe6080604052600436106101125760003560e01c8063c04b8d59116100a5578063df2ab5bb11610074578063f28c049811610059578063f28c0498146102f5578063f3995c6714610308578063fa461e331461031b576101bd565b8063df2ab5bb146102cf578063e0e189a0146102e2576101bd565b8063c04b8d5914610281578063c2e3140a14610294578063c45a0155146102a7578063db3e2198146102bc576101bd565b80634aa4a4fc116100e15780634aa4a4fc146102195780639b2c0a371461023b578063a4a78f0c1461024e578063ac9650d814610261576101bd565b806312210e8a146101c2578063414bf389146101ca5780634659a494146101f357806349404b7c14610206576101bd565b366101bd573373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146101bb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e6f742057455448390000000000000000000000000000000000000000000000604482015290519081900360640190fd5b005b600080fd5b6101bb61033b565b6101dd6101d83660046129f8565b61034d565b6040516101ea9190612df1565b60405180910390f35b6101bb610201366004612776565b6104bf565b6101bb610214366004612aff565b61057f565b34801561022557600080fd5b5061022e610745565b6040516101ea9190612c37565b6101bb610249366004612b2e565b610769565b6101bb61025c366004612776565b610981565b61027461026f3660046127d6565b610a56565b6040516101ea9190612caa565b6101dd61028f36600461294d565b610bb0565b6101bb6102a2366004612776565b610d0f565b3480156102b357600080fd5b5061022e610dc4565b6101dd6102ca3660046129f8565b610de8565b6101bb6102dd3660046126d7565b610f78565b6101bb6102f0366004612718565b611095565b6101dd610303366004612a14565b6111fb565b6101bb610316366004612776565b61132f565b34801561032757600080fd5b506101bb610336366004612868565b6113c7565b471561034b5761034b334761150e565b565b600081608001358061035d61165c565b11156103ca57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b61047060a08401356103e260808601606087016126b4565b6103f3610100870160e088016126b4565b604080518082019091528061040b60208a018a6126b4565b61041b60608b0160408c01612adc565b61042b60408c0160208d016126b4565b60405160200161043d93929190612bc1565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff16815250611660565b91508260c001358210156104b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d72565b60405180910390fd5b50919050565b604080517f8fcbaf0c00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052606481018690526001608482015260ff851660a482015260c4810184905260e48101839052905173ffffffffffffffffffffffffffffffffffffffff881691638fcbaf0c9161010480830192600092919082900301818387803b15801561055f57600080fd5b505af1158015610573573d6000803e3d6000fd5b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561060857600080fd5b505afa15801561061c573d6000803e3d6000fd5b505050506040513d602081101561063257600080fd5b50519050828110156106a557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b8015610740577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561071e57600080fd5b505af1158015610732573d6000803e3d6000fd5b50505050610740828261150e565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008211801561077a575060648211155b61078357600080fd5b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561080c57600080fd5b505afa158015610820573d6000803e3d6000fd5b505050506040513d602081101561083657600080fd5b50519050848110156108a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b801561097a577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561092257600080fd5b505af1158015610936573d6000803e3d6000fd5b50505050600061271061095285846117e690919063ffffffff16565b8161095957fe5b049050801561096c5761096c838261150e565b6109788582840361150e565b505b5050505050565b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015290517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610a1657600080fd5b505afa158015610a2a573d6000803e3d6000fd5b505050506040513d6020811015610a4057600080fd5b50511015610978576109788686868686866104bf565b60608167ffffffffffffffff81118015610a6f57600080fd5b50604051908082528060200260200182016040528015610aa357816020015b6060815260200190600190039081610a8e5790505b50905060005b82811015610ba95760008030868685818110610ac157fe5b9050602002810190610ad39190612dfa565b604051610ae1929190612c27565b600060405180830381855af49150503d8060008114610b1c576040519150601f19603f3d011682016040523d82523d6000602084013e610b21565b606091505b509150915081610b8757604481511015610b3a57600080fd5b60048101905080806020019051810190610b5491906128e3565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b09190612d28565b80848481518110610b9457fe5b60209081029190910101525050600101610aa9565b5092915050565b6000816040015180610bc061165c565b1115610c2d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b335b6000610c3e8560000151611810565b9050610c97856060015182610c57578660200151610c59565b305b60006040518060400160405280610c738b6000015161181c565b81526020018773ffffffffffffffffffffffffffffffffffffffff16815250611660565b60608601528015610cb7578451309250610cb09061182b565b8552610cc4565b8460600151935050610cca565b50610c2f565b8360800151831015610d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d72565b5050919050565b604080517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201529051869173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610d8457600080fd5b505afa158015610d98573d6000803e3d6000fd5b505050506040513d6020811015610dae57600080fd5b505110156109785761097886868686868661132f565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000816080013580610df861165c565b1115610e6557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b610f0e60a0840135610e7d60808601606087016126b4565b610e8e610100870160e088016126b4565b6040518060400160405280886020016020810190610eac91906126b4565b610ebc60608b0160408c01612adc565b610ec960208c018c6126b4565b604051602001610edb93929190612bc1565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff16815250611860565b91508260c00135821115610f4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d3b565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600055919050565b60008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610fe157600080fd5b505afa158015610ff5573d6000803e3d6000fd5b505050506040513d602081101561100b57600080fd5b505190508281101561107e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b801561108f5761108f848383611a1c565b50505050565b6000821180156110a6575060648211155b6110af57600080fd5b60008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561111857600080fd5b505afa15801561112c573d6000803e3d6000fd5b505050506040513d602081101561114257600080fd5b50519050848110156111b557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b80156109785760006127106111ca83866117e6565b816111d157fe5b04905080156111e5576111e5878483611a1c565b6111f28786838503611a1c565b50505050505050565b600081604001358061120b61165c565b111561127857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b6112eb606084013561129060408601602087016126b4565b60408051808201909152600090806112a88980612dfa565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602090910152611860565b5060005491508260800135821115610f4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d3b565b604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790526064810186905260ff8516608482015260a4810184905260c48101839052905173ffffffffffffffffffffffffffffffffffffffff88169163d505accf9160e480830192600092919082900301818387803b15801561055f57600080fd5b60008413806113d65750600083135b6113df57600080fd5b60006113ed82840184612a4c565b905060008060006114018460000151611bf1565b9250925092506114337f0000000000000000000000000000000000000000000000000000000000000000848484611c22565b5060008060008a13611474578473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610896114a5565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16108a5b9150915081156114c4576114bf8587602001513384611c41565b610573565b85516114cf90611810565b156114f45785516114df9061182b565b86526114ee8133600089611860565b50610573565b806000819055508394506105738587602001513384611c41565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040518082805190602001908083835b6020831061158557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611548565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146115e7576040519150601f19603f3d011682016040523d82523d6000602084013e6115ec565b606091505b505090508061074057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b4290565b600073ffffffffffffffffffffffffffffffffffffffff8416611681573093505b60008060006116938560000151611bf1565b9194509250905073ffffffffffffffffffffffffffffffffffffffff808316908416106000806116c4868686611e1f565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b856116ea8f611e5d565b73ffffffffffffffffffffffffffffffffffffffff8e161561170c578d611732565b8761172b5773fffd8963efd1fc6a506488495d951d5263988d25611732565b6401000276a45b8d6040516020016117439190612da9565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611772959493929190612c58565b6040805180830381600087803b15801561178b57600080fd5b505af115801561179f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c39190612845565b91509150826117d257816117d4565b805b6000039b9a5050505050505050505050565b6000821580611801575050818102818382816117fe57fe5b04145b61180a57600080fd5b92915050565b8051604211155b919050565b606061180a826000602b611e8f565b805160609061180a9083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe901611e8f565b600073ffffffffffffffffffffffffffffffffffffffff8416611881573093505b60008060006118938560000151611bf1565b9194509250905073ffffffffffffffffffffffffffffffffffffffff808416908316106000806118c4858786611e1f565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b856118ea8f611e5d565b60000373ffffffffffffffffffffffffffffffffffffffff8e161561190f578d611935565b8761192e5773fffd8963efd1fc6a506488495d951d5263988d25611935565b6401000276a45b8d6040516020016119469190612da9565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611975959493929190612c58565b6040805180830381600087803b15801561198e57600080fd5b505af11580156119a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c69190612845565b915091506000836119db5781836000036119e1565b82826000035b909850905073ffffffffffffffffffffffffffffffffffffffff8a16611a0d578b8114611a0d57600080fd5b50505050505050949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b60208310611af157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611ab4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611b53576040519150601f19603f3d011682016040523d82523d6000602084013e611b58565b606091505b5091509150818015611b86575080511580611b865750808060200190516020811015611b8357600080fd5b50515b61097a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008080611bff8482612076565b9250611c0c846014612176565b9050611c19846017612076565b91509193909250565b6000611c3885611c33868686612266565b6122e3565b95945050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c9c5750804710155b15611de5577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d0957600080fd5b505af1158015611d1d573d6000803e3d6000fd5b50505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611db357600080fd5b505af1158015611dc7573d6000803e3d6000fd5b505050506040513d6020811015611ddd57600080fd5b5061108f9050565b73ffffffffffffffffffffffffffffffffffffffff8316301415611e1357611e0e848383611a1c565b61108f565b61108f84848484612313565b6000611e557f0000000000000000000000000000000000000000000000000000000000000000611e50868686612266565b6124f0565b949350505050565b60007f80000000000000000000000000000000000000000000000000000000000000008210611e8b57600080fd5b5090565b60608182601f011015611f0357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015611f7457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b81830184511015611fe657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b606082158015612005576040519150600082526020820160405261206d565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561203e578051835260209283019201612026565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b6000818260140110156120ea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b816014018351101561215d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b6000818260030110156121ea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b816003018351101561225d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b61226e612626565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1611156122a6579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b60006122ef83836124f0565b90503373ffffffffffffffffffffffffffffffffffffffff82161461180a57600080fd5b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b602083106123f057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016123b3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612452576040519150601f19603f3d011682016040523d82523d6000602084013e612457565b606091505b5091509150818015612485575080511580612485575080806020019051602081101561248257600080fd5b50515b61097857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff161061253257600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516060810182526000808252602082018190529181019190915290565b803561181781612ef4565b600082601f830112612661578081fd5b813561267461266f82612e88565b612e64565b818152846020838601011115612688578283fd5b816020850160208301379081016020019190915292915050565b600061010082840312156104b9578081fd5b6000602082840312156126c5578081fd5b81356126d081612ef4565b9392505050565b6000806000606084860312156126eb578182fd5b83356126f681612ef4565b925060208401359150604084013561270d81612ef4565b809150509250925092565b600080600080600060a0868803121561272f578081fd5b853561273a81612ef4565b945060208601359350604086013561275181612ef4565b925060608601359150608086013561276881612ef4565b809150509295509295909350565b60008060008060008060c0878903121561278e578081fd5b863561279981612ef4565b95506020870135945060408701359350606087013560ff811681146127bc578182fd5b9598949750929560808101359460a0909101359350915050565b600080602083850312156127e8578182fd5b823567ffffffffffffffff808211156127ff578384fd5b818501915085601f830112612812578384fd5b813581811115612820578485fd5b8660208083028501011115612833578485fd5b60209290920196919550909350505050565b60008060408385031215612857578182fd5b505080516020909101519092909150565b6000806000806060858703121561287d578182fd5b8435935060208501359250604085013567ffffffffffffffff808211156128a2578384fd5b818701915087601f8301126128b5578384fd5b8135818111156128c3578485fd5b8860208285010111156128d4578485fd5b95989497505060200194505050565b6000602082840312156128f4578081fd5b815167ffffffffffffffff81111561290a578182fd5b8201601f8101841361291a578182fd5b805161292861266f82612e88565b81815285602083850101111561293c578384fd5b611c38826020830160208601612ec8565b60006020828403121561295e578081fd5b813567ffffffffffffffff80821115612975578283fd5b9083019060a08286031215612988578283fd5b60405160a08101818110838211171561299d57fe5b6040528235828111156129ae578485fd5b6129ba87828601612651565b8252506129c960208401612646565b602082015260408301356040820152606083013560608201526080830135608082015280935050505092915050565b60006101008284031215612a0a578081fd5b6126d083836126a2565b600060208284031215612a25578081fd5b813567ffffffffffffffff811115612a3b578182fd5b820160a081850312156126d0578182fd5b600060208284031215612a5d578081fd5b813567ffffffffffffffff80821115612a74578283fd5b9083019060408286031215612a87578283fd5b604051604081018181108382111715612a9c57fe5b604052823582811115612aad578485fd5b612ab987828601612651565b82525060208301359250612acc83612ef4565b6020810192909252509392505050565b600060208284031215612aed578081fd5b813562ffffff811681146126d0578182fd5b60008060408385031215612b11578182fd5b823591506020830135612b2381612ef4565b809150509250929050565b60008060008060808587031215612b43578182fd5b843593506020850135612b5581612ef4565b9250604085013591506060850135612b6c81612ef4565b939692955090935050565b60008151808452612b8f816020860160208601612ec8565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a06080830152612c9f60a0830184612b77565b979650505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015612d1b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612d09858351612b77565b94509285019290850190600101612ccf565b5092979650505050505050565b6000602082526126d06020830184612b77565b60208082526012908201527f546f6f206d756368207265717565737465640000000000000000000000000000604082015260600190565b60208082526013908201527f546f6f206c6974746c6520726563656976656400000000000000000000000000604082015260600190565b600060208252825160406020840152612dc56060840182612b77565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401528091505092915050565b90815260200190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612e2e578283fd5b83018035915067ffffffffffffffff821115612e48578283fd5b602001915036819003821315612e5d57600080fd5b9250929050565b60405181810167ffffffffffffffff81118282101715612e8057fe5b604052919050565b600067ffffffffffffffff821115612e9c57fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015612ee3578181015183820152602001612ecb565b8381111561108f5750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612f1657600080fd5b5056fea164736f6c6343000706000a", + deployedBytecode: "0x6080604052600436106101125760003560e01c8063c04b8d59116100a5578063df2ab5bb11610074578063f28c049811610059578063f28c0498146102f5578063f3995c6714610308578063fa461e331461031b576101bd565b8063df2ab5bb146102cf578063e0e189a0146102e2576101bd565b8063c04b8d5914610281578063c2e3140a14610294578063c45a0155146102a7578063db3e2198146102bc576101bd565b80634aa4a4fc116100e15780634aa4a4fc146102195780639b2c0a371461023b578063a4a78f0c1461024e578063ac9650d814610261576101bd565b806312210e8a146101c2578063414bf389146101ca5780634659a494146101f357806349404b7c14610206576101bd565b366101bd573373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146101bb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f4e6f742057455448390000000000000000000000000000000000000000000000604482015290519081900360640190fd5b005b600080fd5b6101bb61033b565b6101dd6101d83660046129f8565b61034d565b6040516101ea9190612df1565b60405180910390f35b6101bb610201366004612776565b6104bf565b6101bb610214366004612aff565b61057f565b34801561022557600080fd5b5061022e610745565b6040516101ea9190612c37565b6101bb610249366004612b2e565b610769565b6101bb61025c366004612776565b610981565b61027461026f3660046127d6565b610a56565b6040516101ea9190612caa565b6101dd61028f36600461294d565b610bb0565b6101bb6102a2366004612776565b610d0f565b3480156102b357600080fd5b5061022e610dc4565b6101dd6102ca3660046129f8565b610de8565b6101bb6102dd3660046126d7565b610f78565b6101bb6102f0366004612718565b611095565b6101dd610303366004612a14565b6111fb565b6101bb610316366004612776565b61132f565b34801561032757600080fd5b506101bb610336366004612868565b6113c7565b471561034b5761034b334761150e565b565b600081608001358061035d61165c565b11156103ca57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b61047060a08401356103e260808601606087016126b4565b6103f3610100870160e088016126b4565b604080518082019091528061040b60208a018a6126b4565b61041b60608b0160408c01612adc565b61042b60408c0160208d016126b4565b60405160200161043d93929190612bc1565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff16815250611660565b91508260c001358210156104b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d72565b60405180910390fd5b50919050565b604080517f8fcbaf0c00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101879052606481018690526001608482015260ff851660a482015260c4810184905260e48101839052905173ffffffffffffffffffffffffffffffffffffffff881691638fcbaf0c9161010480830192600092919082900301818387803b15801561055f57600080fd5b505af1158015610573573d6000803e3d6000fd5b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561060857600080fd5b505afa15801561061c573d6000803e3d6000fd5b505050506040513d602081101561063257600080fd5b50519050828110156106a557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b8015610740577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561071e57600080fd5b505af1158015610732573d6000803e3d6000fd5b50505050610740828261150e565b505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008211801561077a575060648211155b61078357600080fd5b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561080c57600080fd5b505afa158015610820573d6000803e3d6000fd5b505050506040513d602081101561083657600080fd5b50519050848110156108a957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742057455448390000000000000000000000000000604482015290519081900360640190fd5b801561097a577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561092257600080fd5b505af1158015610936573d6000803e3d6000fd5b50505050600061271061095285846117e690919063ffffffff16565b8161095957fe5b049050801561096c5761096c838261150e565b6109788582840361150e565b505b5050505050565b604080517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015290517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610a1657600080fd5b505afa158015610a2a573d6000803e3d6000fd5b505050506040513d6020811015610a4057600080fd5b50511015610978576109788686868686866104bf565b60608167ffffffffffffffff81118015610a6f57600080fd5b50604051908082528060200260200182016040528015610aa357816020015b6060815260200190600190039081610a8e5790505b50905060005b82811015610ba95760008030868685818110610ac157fe5b9050602002810190610ad39190612dfa565b604051610ae1929190612c27565b600060405180830381855af49150503d8060008114610b1c576040519150601f19603f3d011682016040523d82523d6000602084013e610b21565b606091505b509150915081610b8757604481511015610b3a57600080fd5b60048101905080806020019051810190610b5491906128e3565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b09190612d28565b80848481518110610b9457fe5b60209081029190910101525050600101610aa9565b5092915050565b6000816040015180610bc061165c565b1115610c2d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b335b6000610c3e8560000151611810565b9050610c97856060015182610c57578660200151610c59565b305b60006040518060400160405280610c738b6000015161181c565b81526020018773ffffffffffffffffffffffffffffffffffffffff16815250611660565b60608601528015610cb7578451309250610cb09061182b565b8552610cc4565b8460600151935050610cca565b50610c2f565b8360800151831015610d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d72565b5050919050565b604080517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523360048201523060248201529051869173ffffffffffffffffffffffffffffffffffffffff89169163dd62ed3e91604480820192602092909190829003018186803b158015610d8457600080fd5b505afa158015610d98573d6000803e3d6000fd5b505050506040513d6020811015610dae57600080fd5b505110156109785761097886868686868661132f565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000816080013580610df861165c565b1115610e6557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b610f0e60a0840135610e7d60808601606087016126b4565b610e8e610100870160e088016126b4565b6040518060400160405280886020016020810190610eac91906126b4565b610ebc60608b0160408c01612adc565b610ec960208c018c6126b4565b604051602001610edb93929190612bc1565b60405160208183030381529060405281526020013373ffffffffffffffffffffffffffffffffffffffff16815250611860565b91508260c00135821115610f4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d3b565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600055919050565b60008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610fe157600080fd5b505afa158015610ff5573d6000803e3d6000fd5b505050506040513d602081101561100b57600080fd5b505190508281101561107e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b801561108f5761108f848383611a1c565b50505050565b6000821180156110a6575060648211155b6110af57600080fd5b60008573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561111857600080fd5b505afa15801561112c573d6000803e3d6000fd5b505050506040513d602081101561114257600080fd5b50519050848110156111b557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e7420746f6b656e0000000000000000000000000000604482015290519081900360640190fd5b80156109785760006127106111ca83866117e6565b816111d157fe5b04905080156111e5576111e5878483611a1c565b6111f28786838503611a1c565b50505050505050565b600081604001358061120b61165c565b111561127857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5472616e73616374696f6e20746f6f206f6c6400000000000000000000000000604482015290519081900360640190fd5b6112eb606084013561129060408601602087016126b4565b60408051808201909152600090806112a88980612dfa565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525033602090910152611860565b5060005491508260800135821115610f4e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104b090612d3b565b604080517fd505accf000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018790526064810186905260ff8516608482015260a4810184905260c48101839052905173ffffffffffffffffffffffffffffffffffffffff88169163d505accf9160e480830192600092919082900301818387803b15801561055f57600080fd5b60008413806113d65750600083135b6113df57600080fd5b60006113ed82840184612a4c565b905060008060006114018460000151611bf1565b9250925092506114337f0000000000000000000000000000000000000000000000000000000000000000848484611c22565b5060008060008a13611474578473ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610896114a5565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16108a5b9150915081156114c4576114bf8587602001513384611c41565b610573565b85516114cf90611810565b156114f45785516114df9061182b565b86526114ee8133600089611860565b50610573565b806000819055508394506105738587602001513384611c41565b6040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff84169083906040518082805190602001908083835b6020831061158557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611548565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d80600081146115e7576040519150601f19603f3d011682016040523d82523d6000602084013e6115ec565b606091505b505090508061074057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354450000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b4290565b600073ffffffffffffffffffffffffffffffffffffffff8416611681573093505b60008060006116938560000151611bf1565b9194509250905073ffffffffffffffffffffffffffffffffffffffff808316908416106000806116c4868686611e1f565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b856116ea8f611e5d565b73ffffffffffffffffffffffffffffffffffffffff8e161561170c578d611732565b8761172b5773fffd8963efd1fc6a506488495d951d5263988d25611732565b6401000276a45b8d6040516020016117439190612da9565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611772959493929190612c58565b6040805180830381600087803b15801561178b57600080fd5b505af115801561179f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c39190612845565b91509150826117d257816117d4565b805b6000039b9a5050505050505050505050565b6000821580611801575050818102818382816117fe57fe5b04145b61180a57600080fd5b92915050565b8051604211155b919050565b606061180a826000602b611e8f565b805160609061180a9083906017907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe901611e8f565b600073ffffffffffffffffffffffffffffffffffffffff8416611881573093505b60008060006118938560000151611bf1565b9194509250905073ffffffffffffffffffffffffffffffffffffffff808416908316106000806118c4858786611e1f565b73ffffffffffffffffffffffffffffffffffffffff1663128acb088b856118ea8f611e5d565b60000373ffffffffffffffffffffffffffffffffffffffff8e161561190f578d611935565b8761192e5773fffd8963efd1fc6a506488495d951d5263988d25611935565b6401000276a45b8d6040516020016119469190612da9565b6040516020818303038152906040526040518663ffffffff1660e01b8152600401611975959493929190612c58565b6040805180830381600087803b15801561198e57600080fd5b505af11580156119a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c69190612845565b915091506000836119db5781836000036119e1565b82826000035b909850905073ffffffffffffffffffffffffffffffffffffffff8a16611a0d578b8114611a0d57600080fd5b50505050505050949350505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001781529251825160009485949389169392918291908083835b60208310611af157805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611ab4565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114611b53576040519150601f19603f3d011682016040523d82523d6000602084013e611b58565b606091505b5091509150818015611b86575080511580611b865750808060200190516020811015611b8357600080fd5b50515b61097a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600260248201527f5354000000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b60008080611bff8482612076565b9250611c0c846014612176565b9050611c19846017612076565b91509193909250565b6000611c3885611c33868686612266565b6122e3565b95945050505050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611c9c5750804710155b15611de5577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015611d0957600080fd5b505af1158015611d1d573d6000803e3d6000fd5b50505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611db357600080fd5b505af1158015611dc7573d6000803e3d6000fd5b505050506040513d6020811015611ddd57600080fd5b5061108f9050565b73ffffffffffffffffffffffffffffffffffffffff8316301415611e1357611e0e848383611a1c565b61108f565b61108f84848484612313565b6000611e557f0000000000000000000000000000000000000000000000000000000000000000611e50868686612266565b6124f0565b949350505050565b60007f80000000000000000000000000000000000000000000000000000000000000008210611e8b57600080fd5b5090565b60608182601f011015611f0357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b828284011015611f7457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f77000000000000000000000000000000000000604482015290519081900360640190fd5b81830184511015611fe657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e6473000000000000000000000000000000604482015290519081900360640190fd5b606082158015612005576040519150600082526020820160405261206d565b6040519150601f8416801560200281840101858101878315602002848b0101015b8183101561203e578051835260209283019201612026565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b6000818260140110156120ea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f746f416464726573735f6f766572666c6f770000000000000000000000000000604482015290519081900360640190fd5b816014018351101561215d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f746f416464726573735f6f75744f66426f756e64730000000000000000000000604482015290519081900360640190fd5b5001602001516c01000000000000000000000000900490565b6000818260030110156121ea57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f746f55696e7432345f6f766572666c6f77000000000000000000000000000000604482015290519081900360640190fd5b816003018351101561225d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7432345f6f75744f66426f756e6473000000000000000000000000604482015290519081900360640190fd5b50016003015190565b61226e612626565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1611156122a6579192915b506040805160608101825273ffffffffffffffffffffffffffffffffffffffff948516815292909316602083015262ffffff169181019190915290565b60006122ef83836124f0565b90503373ffffffffffffffffffffffffffffffffffffffff82161461180a57600080fd5b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd00000000000000000000000000000000000000000000000000000000178152925182516000948594938a169392918291908083835b602083106123f057805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016123b3565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612452576040519150601f19603f3d011682016040523d82523d6000602084013e612457565b606091505b5091509150818015612485575080511580612485575080806020019051602081101561248257600080fd5b50515b61097857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600360248201527f5354460000000000000000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff161061253257600080fd5b508051602080830151604093840151845173ffffffffffffffffffffffffffffffffffffffff94851681850152939091168385015262ffffff166060808401919091528351808403820181526080840185528051908301207fff0000000000000000000000000000000000000000000000000000000000000060a085015294901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660a183015260b58201939093527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808301919091528251808303909101815260f5909101909152805191012090565b604080516060810182526000808252602082018190529181019190915290565b803561181781612ef4565b600082601f830112612661578081fd5b813561267461266f82612e88565b612e64565b818152846020838601011115612688578283fd5b816020850160208301379081016020019190915292915050565b600061010082840312156104b9578081fd5b6000602082840312156126c5578081fd5b81356126d081612ef4565b9392505050565b6000806000606084860312156126eb578182fd5b83356126f681612ef4565b925060208401359150604084013561270d81612ef4565b809150509250925092565b600080600080600060a0868803121561272f578081fd5b853561273a81612ef4565b945060208601359350604086013561275181612ef4565b925060608601359150608086013561276881612ef4565b809150509295509295909350565b60008060008060008060c0878903121561278e578081fd5b863561279981612ef4565b95506020870135945060408701359350606087013560ff811681146127bc578182fd5b9598949750929560808101359460a0909101359350915050565b600080602083850312156127e8578182fd5b823567ffffffffffffffff808211156127ff578384fd5b818501915085601f830112612812578384fd5b813581811115612820578485fd5b8660208083028501011115612833578485fd5b60209290920196919550909350505050565b60008060408385031215612857578182fd5b505080516020909101519092909150565b6000806000806060858703121561287d578182fd5b8435935060208501359250604085013567ffffffffffffffff808211156128a2578384fd5b818701915087601f8301126128b5578384fd5b8135818111156128c3578485fd5b8860208285010111156128d4578485fd5b95989497505060200194505050565b6000602082840312156128f4578081fd5b815167ffffffffffffffff81111561290a578182fd5b8201601f8101841361291a578182fd5b805161292861266f82612e88565b81815285602083850101111561293c578384fd5b611c38826020830160208601612ec8565b60006020828403121561295e578081fd5b813567ffffffffffffffff80821115612975578283fd5b9083019060a08286031215612988578283fd5b60405160a08101818110838211171561299d57fe5b6040528235828111156129ae578485fd5b6129ba87828601612651565b8252506129c960208401612646565b602082015260408301356040820152606083013560608201526080830135608082015280935050505092915050565b60006101008284031215612a0a578081fd5b6126d083836126a2565b600060208284031215612a25578081fd5b813567ffffffffffffffff811115612a3b578182fd5b820160a081850312156126d0578182fd5b600060208284031215612a5d578081fd5b813567ffffffffffffffff80821115612a74578283fd5b9083019060408286031215612a87578283fd5b604051604081018181108382111715612a9c57fe5b604052823582811115612aad578485fd5b612ab987828601612651565b82525060208301359250612acc83612ef4565b6020810192909252509392505050565b600060208284031215612aed578081fd5b813562ffffff811681146126d0578182fd5b60008060408385031215612b11578182fd5b823591506020830135612b2381612ef4565b809150509250929050565b60008060008060808587031215612b43578182fd5b843593506020850135612b5581612ef4565b9250604085013591506060850135612b6c81612ef4565b939692955090935050565b60008151808452612b8f816020860160208601612ec8565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b606093841b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116825260e89390931b7fffffff0000000000000000000000000000000000000000000000000000000000166014820152921b166017820152602b0190565b6000828483379101908152919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352861515602084015285604084015280851660608401525060a06080830152612c9f60a0830184612b77565b979650505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015612d1b577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0888603018452612d09858351612b77565b94509285019290850190600101612ccf565b5092979650505050505050565b6000602082526126d06020830184612b77565b60208082526012908201527f546f6f206d756368207265717565737465640000000000000000000000000000604082015260600190565b60208082526013908201527f546f6f206c6974746c6520726563656976656400000000000000000000000000604082015260600190565b600060208252825160406020840152612dc56060840182612b77565b905073ffffffffffffffffffffffffffffffffffffffff60208501511660408401528091505092915050565b90815260200190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612e2e578283fd5b83018035915067ffffffffffffffff821115612e48578283fd5b602001915036819003821315612e5d57600080fd5b9250929050565b60405181810167ffffffffffffffff81118282101715612e8057fe5b604052919050565b600067ffffffffffffffff821115612e9c57fe5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015612ee3578181015183820152602001612ecb565b8381111561108f5750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612f1657600080fd5b5056fea164736f6c6343000706000a", + linkReferences: {}, + deployedLinkReferences: {} + }; + } +}); + +// node_modules/@uniswap/v3-sdk/dist/v3-sdk.cjs.production.min.js +var require_v3_sdk_cjs_production_min = __commonJS({ + "node_modules/@uniswap/v3-sdk/dist/v3-sdk.cjs.production.min.js"(exports2) { + "use strict"; + function t(t2) { + return t2 && "object" == typeof t2 && "default" in t2 ? t2.default : t2; + } + Object.defineProperty(exports2, "__esModule", { value: true }); + var e; + var n = require_dist(); + var r = t(require_jsbi_cjs()); + var i = t(require_tiny_invariant_cjs()); + var o = require_lib11(); + var u = require_lib7(); + var a = require_lib29(); + var c = t(require_IMulticall()); + var s = t(require_NonfungiblePositionManager()); + var p = t(require_ISelfPermit()); + var l = t(require_IPeripheryPaymentsWithFee()); + var d = t(require_Quoter()); + var f = t(require_QuoterV2()); + var h = t(require_UniswapV3Staker()); + var m = t(require_SwapRouter()); + function v() { + v = function() { + return e2; + }; + var t2, e2 = {}, n2 = Object.prototype, r2 = n2.hasOwnProperty, i2 = Object.defineProperty || function(t3, e3, n3) { + t3[e3] = n3.value; + }, o2 = "function" == typeof Symbol ? Symbol : {}, u2 = o2.iterator || "@@iterator", a2 = o2.asyncIterator || "@@asyncIterator", c2 = o2.toStringTag || "@@toStringTag"; + function s2(t3, e3, n3) { + return Object.defineProperty(t3, e3, { value: n3, enumerable: true, configurable: true, writable: true }), t3[e3]; + } + try { + s2({}, ""); + } catch (t3) { + s2 = function(t4, e3, n3) { + return t4[e3] = n3; + }; + } + function p2(t3, e3, n3, r3) { + var o3 = Object.create((e3 && e3.prototype instanceof y2 ? e3 : y2).prototype), u3 = new C2(r3 || []); + return i2(o3, "_invoke", { value: b2(t3, n3, u3) }), o3; + } + function l2(t3, e3, n3) { + try { + return { type: "normal", arg: t3.call(e3, n3) }; + } catch (t4) { + return { type: "throw", arg: t4 }; + } + } + e2.wrap = p2; + var d2 = "suspendedStart", f2 = "executing", h2 = "completed", m2 = {}; + function y2() { + } + function k2() { + } + function g2() { + } + var A2 = {}; + s2(A2, u2, function() { + return this; + }); + var T2 = Object.getPrototypeOf, w2 = T2 && T2(T2(O2([]))); + w2 && w2 !== n2 && r2.call(w2, u2) && (A2 = w2); + var x2 = g2.prototype = y2.prototype = Object.create(A2); + function I2(t3) { + ["next", "throw", "return"].forEach(function(e3) { + s2(t3, e3, function(t4) { + return this._invoke(e3, t4); + }); + }); + } + function q2(t3, e3) { + function n3(i3, o4, u3, a3) { + var c3 = l2(t3[i3], t3, o4); + if ("throw" !== c3.type) { + var s3 = c3.arg, p3 = s3.value; + return p3 && "object" == typeof p3 && r2.call(p3, "__await") ? e3.resolve(p3.__await).then(function(t4) { + n3("next", t4, u3, a3); + }, function(t4) { + n3("throw", t4, u3, a3); + }) : e3.resolve(p3).then(function(t4) { + s3.value = t4, u3(s3); + }, function(t4) { + return n3("throw", t4, u3, a3); + }); + } + a3(c3.arg); + } + var o3; + i2(this, "_invoke", { value: function(t4, r3) { + function i3() { + return new e3(function(e4, i4) { + n3(t4, r3, e4, i4); + }); + } + return o3 = o3 ? o3.then(i3, i3) : i3(); + } }); + } + function b2(e3, n3, r3) { + var i3 = d2; + return function(o3, u3) { + if (i3 === f2) throw new Error("Generator is already running"); + if (i3 === h2) { + if ("throw" === o3) throw u3; + return { value: t2, done: true }; + } + for (r3.method = o3, r3.arg = u3; ; ) { + var a3 = r3.delegate; + if (a3) { + var c3 = R2(a3, r3); + if (c3) { + if (c3 === m2) continue; + return c3; + } + } + if ("next" === r3.method) r3.sent = r3._sent = r3.arg; + else if ("throw" === r3.method) { + if (i3 === d2) throw i3 = h2, r3.arg; + r3.dispatchException(r3.arg); + } else "return" === r3.method && r3.abrupt("return", r3.arg); + i3 = f2; + var s3 = l2(e3, n3, r3); + if ("normal" === s3.type) { + if (i3 = r3.done ? h2 : "suspendedYield", s3.arg === m2) continue; + return { value: s3.arg, done: r3.done }; + } + "throw" === s3.type && (i3 = h2, r3.method = "throw", r3.arg = s3.arg); + } + }; + } + function R2(e3, n3) { + var r3 = n3.method, i3 = e3.iterator[r3]; + if (i3 === t2) return n3.delegate = null, "throw" === r3 && e3.iterator.return && (n3.method = "return", n3.arg = t2, R2(e3, n3), "throw" === n3.method) || "return" !== r3 && (n3.method = "throw", n3.arg = new TypeError("The iterator does not provide a '" + r3 + "' method")), m2; + var o3 = l2(i3, e3.iterator, n3.arg); + if ("throw" === o3.type) return n3.method = "throw", n3.arg = o3.arg, n3.delegate = null, m2; + var u3 = o3.arg; + return u3 ? u3.done ? (n3[e3.resultName] = u3.value, n3.next = e3.nextLoc, "return" !== n3.method && (n3.method = "next", n3.arg = t2), n3.delegate = null, m2) : u3 : (n3.method = "throw", n3.arg = new TypeError("iterator result is not an object"), n3.delegate = null, m2); + } + function E2(t3) { + var e3 = { tryLoc: t3[0] }; + 1 in t3 && (e3.catchLoc = t3[1]), 2 in t3 && (e3.finallyLoc = t3[2], e3.afterLoc = t3[3]), this.tryEntries.push(e3); + } + function P2(t3) { + var e3 = t3.completion || {}; + e3.type = "normal", delete e3.arg, t3.completion = e3; + } + function C2(t3) { + this.tryEntries = [{ tryLoc: "root" }], t3.forEach(E2, this), this.reset(true); + } + function O2(e3) { + if (e3 || "" === e3) { + var n3 = e3[u2]; + if (n3) return n3.call(e3); + if ("function" == typeof e3.next) return e3; + if (!isNaN(e3.length)) { + var i3 = -1, o3 = function n4() { + for (; ++i3 < e3.length; ) if (r2.call(e3, i3)) return n4.value = e3[i3], n4.done = false, n4; + return n4.value = t2, n4.done = true, n4; + }; + return o3.next = o3; + } + } + throw new TypeError(typeof e3 + " is not iterable"); + } + return k2.prototype = g2, i2(x2, "constructor", { value: g2, configurable: true }), i2(g2, "constructor", { value: k2, configurable: true }), k2.displayName = s2(g2, c2, "GeneratorFunction"), e2.isGeneratorFunction = function(t3) { + var e3 = "function" == typeof t3 && t3.constructor; + return !!e3 && (e3 === k2 || "GeneratorFunction" === (e3.displayName || e3.name)); + }, e2.mark = function(t3) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t3, g2) : (t3.__proto__ = g2, s2(t3, c2, "GeneratorFunction")), t3.prototype = Object.create(x2), t3; + }, e2.awrap = function(t3) { + return { __await: t3 }; + }, I2(q2.prototype), s2(q2.prototype, a2, function() { + return this; + }), e2.AsyncIterator = q2, e2.async = function(t3, n3, r3, i3, o3) { + void 0 === o3 && (o3 = Promise); + var u3 = new q2(p2(t3, n3, r3, i3), o3); + return e2.isGeneratorFunction(n3) ? u3 : u3.next().then(function(t4) { + return t4.done ? t4.value : u3.next(); + }); + }, I2(x2), s2(x2, c2, "Generator"), s2(x2, u2, function() { + return this; + }), s2(x2, "toString", function() { + return "[object Generator]"; + }), e2.keys = function(t3) { + var e3 = Object(t3), n3 = []; + for (var r3 in e3) n3.push(r3); + return n3.reverse(), function t4() { + for (; n3.length; ) { + var r4 = n3.pop(); + if (r4 in e3) return t4.value = r4, t4.done = false, t4; + } + return t4.done = true, t4; + }; + }, e2.values = O2, C2.prototype = { constructor: C2, reset: function(e3) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t2, this.done = false, this.delegate = null, this.method = "next", this.arg = t2, this.tryEntries.forEach(P2), !e3) for (var n3 in this) "t" === n3.charAt(0) && r2.call(this, n3) && !isNaN(+n3.slice(1)) && (this[n3] = t2); + }, stop: function() { + this.done = true; + var t3 = this.tryEntries[0].completion; + if ("throw" === t3.type) throw t3.arg; + return this.rval; + }, dispatchException: function(e3) { + if (this.done) throw e3; + var n3 = this; + function i3(r3, i4) { + return a3.type = "throw", a3.arg = e3, n3.next = r3, i4 && (n3.method = "next", n3.arg = t2), !!i4; + } + for (var o3 = this.tryEntries.length - 1; o3 >= 0; --o3) { + var u3 = this.tryEntries[o3], a3 = u3.completion; + if ("root" === u3.tryLoc) return i3("end"); + if (u3.tryLoc <= this.prev) { + var c3 = r2.call(u3, "catchLoc"), s3 = r2.call(u3, "finallyLoc"); + if (c3 && s3) { + if (this.prev < u3.catchLoc) return i3(u3.catchLoc, true); + if (this.prev < u3.finallyLoc) return i3(u3.finallyLoc); + } else if (c3) { + if (this.prev < u3.catchLoc) return i3(u3.catchLoc, true); + } else { + if (!s3) throw new Error("try statement without catch or finally"); + if (this.prev < u3.finallyLoc) return i3(u3.finallyLoc); + } + } + } + }, abrupt: function(t3, e3) { + for (var n3 = this.tryEntries.length - 1; n3 >= 0; --n3) { + var i3 = this.tryEntries[n3]; + if (i3.tryLoc <= this.prev && r2.call(i3, "finallyLoc") && this.prev < i3.finallyLoc) { + var o3 = i3; + break; + } + } + o3 && ("break" === t3 || "continue" === t3) && o3.tryLoc <= e3 && e3 <= o3.finallyLoc && (o3 = null); + var u3 = o3 ? o3.completion : {}; + return u3.type = t3, u3.arg = e3, o3 ? (this.method = "next", this.next = o3.finallyLoc, m2) : this.complete(u3); + }, complete: function(t3, e3) { + if ("throw" === t3.type) throw t3.arg; + return "break" === t3.type || "continue" === t3.type ? this.next = t3.arg : "return" === t3.type ? (this.rval = this.arg = t3.arg, this.method = "return", this.next = "end") : "normal" === t3.type && e3 && (this.next = e3), m2; + }, finish: function(t3) { + for (var e3 = this.tryEntries.length - 1; e3 >= 0; --e3) { + var n3 = this.tryEntries[e3]; + if (n3.finallyLoc === t3) return this.complete(n3.completion, n3.afterLoc), P2(n3), m2; + } + }, catch: function(t3) { + for (var e3 = this.tryEntries.length - 1; e3 >= 0; --e3) { + var n3 = this.tryEntries[e3]; + if (n3.tryLoc === t3) { + var r3 = n3.completion; + if ("throw" === r3.type) { + var i3 = r3.arg; + P2(n3); + } + return i3; + } + } + throw new Error("illegal catch attempt"); + }, delegateYield: function(e3, n3, r3) { + return this.delegate = { iterator: O2(e3), resultName: n3, nextLoc: r3 }, "next" === this.method && (this.arg = t2), m2; + } }, e2; + } + function y(t2) { + var e2 = function(t3, e3) { + if ("object" != typeof t3 || !t3) return t3; + var n2 = t3[Symbol.toPrimitive]; + if (void 0 !== n2) { + var r2 = n2.call(t3, "string"); + if ("object" != typeof r2) return r2; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return String(t3); + }(t2); + return "symbol" == typeof e2 ? e2 : String(e2); + } + function k(t2, e2, n2, r2, i2, o2, u2) { + try { + var a2 = t2[o2](u2), c2 = a2.value; + } catch (t3) { + return void n2(t3); + } + a2.done ? e2(c2) : Promise.resolve(c2).then(r2, i2); + } + function g(t2) { + return function() { + var e2 = this, n2 = arguments; + return new Promise(function(r2, i2) { + var o2 = t2.apply(e2, n2); + function u2(t3) { + k(o2, r2, i2, u2, a2, "next", t3); + } + function a2(t3) { + k(o2, r2, i2, u2, a2, "throw", t3); + } + u2(void 0); + }); + }; + } + function A(t2, e2) { + for (var n2 = 0; n2 < e2.length; n2++) { + var r2 = e2[n2]; + r2.enumerable = r2.enumerable || false, r2.configurable = true, "value" in r2 && (r2.writable = true), Object.defineProperty(t2, y(r2.key), r2); + } + } + function T(t2, e2, n2) { + return e2 && A(t2.prototype, e2), n2 && A(t2, n2), Object.defineProperty(t2, "prototype", { writable: false }), t2; + } + function w() { + return (w = Object.assign ? Object.assign.bind() : function(t2) { + for (var e2 = 1; e2 < arguments.length; e2++) { + var n2 = arguments[e2]; + for (var r2 in n2) Object.prototype.hasOwnProperty.call(n2, r2) && (t2[r2] = n2[r2]); + } + return t2; + }).apply(this, arguments); + } + function x(t2, e2) { + (null == e2 || e2 > t2.length) && (e2 = t2.length); + for (var n2 = 0, r2 = new Array(e2); n2 < e2; n2++) r2[n2] = t2[n2]; + return r2; + } + function I(t2, e2) { + var n2 = "undefined" != typeof Symbol && t2[Symbol.iterator] || t2["@@iterator"]; + if (n2) return (n2 = n2.call(t2)).next.bind(n2); + if (Array.isArray(t2) || (n2 = function(t3, e3) { + if (t3) { + if ("string" == typeof t3) return x(t3, void 0); + var n3 = Object.prototype.toString.call(t3).slice(8, -1); + return "Object" === n3 && t3.constructor && (n3 = t3.constructor.name), "Map" === n3 || "Set" === n3 ? Array.from(t3) : "Arguments" === n3 || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n3) ? x(t3, void 0) : void 0; + } + }(t2)) || e2 && t2 && "number" == typeof t2.length) { + n2 && (t2 = n2); + var r2 = 0; + return function() { + return r2 >= t2.length ? { done: true } : { done: false, value: t2[r2++] }; + }; + } + 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 q; + var b = "0x0000000000000000000000000000000000000000"; + var R = "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54"; + (q = exports2.FeeAmount || (exports2.FeeAmount = {}))[q.LOWEST = 100] = "LOWEST", q[q.LOW = 500] = "LOW", q[q.MEDIUM = 3e3] = "MEDIUM", q[q.HIGH = 1e4] = "HIGH"; + var E = ((e = {})[exports2.FeeAmount.LOWEST] = 1, e[exports2.FeeAmount.LOW] = 10, e[exports2.FeeAmount.MEDIUM] = 60, e[exports2.FeeAmount.HIGH] = 200, e); + var P = r.BigInt(-1); + var C = r.BigInt(0); + var O = r.BigInt(1); + var S = r.exponentiate(r.BigInt(2), r.BigInt(96)); + var N = r.exponentiate(S, r.BigInt(2)); + function _(t2) { + var e2 = t2.factoryAddress, n2 = t2.tokenA, r2 = t2.tokenB, i2 = t2.fee, c2 = t2.initCodeHashManualOverride, s2 = n2.sortsBefore(r2) ? [n2, r2] : [r2, n2]; + return u.getCreate2Address(e2, a.keccak256(["bytes"], [o.defaultAbiCoder.encode(["address", "address", "uint24"], [s2[0].address, s2[1].address, i2])]), null != c2 ? c2 : R); + } + var F = function() { + function t2() { + } + return t2.addDelta = function(t3, e2) { + return r.lessThan(e2, C) ? r.subtract(t3, r.multiply(e2, P)) : r.add(t3, e2); + }, t2; + }(); + var X = function() { + function t2() { + } + return t2.mulDivRoundingUp = function(t3, e2, n2) { + var i2 = r.multiply(t3, e2), o2 = r.divide(i2, n2); + return r.notEqual(r.remainder(i2, n2), C) && (o2 = r.add(o2, O)), o2; + }, t2; + }(); + var L = r.subtract(r.exponentiate(r.BigInt(2), r.BigInt(160)), O); + function U(t2, e2) { + var i2 = r.multiply(t2, e2); + return r.bitwiseAnd(i2, n.MaxUint256); + } + var B = function() { + function t2() { + } + return t2.getAmount0Delta = function(t3, e2, n2, i2) { + if (r.greaterThan(t3, e2)) { + var o2 = [e2, t3]; + t3 = o2[0], e2 = o2[1]; + } + var u2 = r.leftShift(n2, r.BigInt(96)), a2 = r.subtract(e2, t3); + return i2 ? X.mulDivRoundingUp(X.mulDivRoundingUp(u2, a2, e2), O, t3) : r.divide(r.divide(r.multiply(u2, a2), e2), t3); + }, t2.getAmount1Delta = function(t3, e2, n2, i2) { + if (r.greaterThan(t3, e2)) { + var o2 = [e2, t3]; + t3 = o2[0], e2 = o2[1]; + } + return i2 ? X.mulDivRoundingUp(n2, r.subtract(e2, t3), S) : r.divide(r.multiply(n2, r.subtract(e2, t3)), S); + }, t2.getNextSqrtPriceFromInput = function(t3, e2, n2, o2) { + return r.greaterThan(t3, C) || i(false), r.greaterThan(e2, C) || i(false), o2 ? this.getNextSqrtPriceFromAmount0RoundingUp(t3, e2, n2, true) : this.getNextSqrtPriceFromAmount1RoundingDown(t3, e2, n2, true); + }, t2.getNextSqrtPriceFromOutput = function(t3, e2, n2, o2) { + return r.greaterThan(t3, C) || i(false), r.greaterThan(e2, C) || i(false), o2 ? this.getNextSqrtPriceFromAmount1RoundingDown(t3, e2, n2, false) : this.getNextSqrtPriceFromAmount0RoundingUp(t3, e2, n2, false); + }, t2.getNextSqrtPriceFromAmount0RoundingUp = function(t3, e2, o2, u2) { + if (r.equal(o2, C)) return t3; + var a2 = r.leftShift(e2, r.BigInt(96)); + if (u2) { + var c2 = U(o2, t3); + if (r.equal(r.divide(c2, o2), t3)) { + var s2 = (l2 = r.add(a2, c2), r.bitwiseAnd(l2, n.MaxUint256)); + if (r.greaterThanOrEqual(s2, a2)) return X.mulDivRoundingUp(a2, t3, s2); + } + return X.mulDivRoundingUp(a2, O, r.add(r.divide(a2, t3), o2)); + } + var p2 = U(o2, t3); + r.equal(r.divide(p2, o2), t3) || i(false), r.greaterThan(a2, p2) || i(false); + var l2, d2 = r.subtract(a2, p2); + return X.mulDivRoundingUp(a2, t3, d2); + }, t2.getNextSqrtPriceFromAmount1RoundingDown = function(t3, e2, n2, o2) { + if (o2) { + var u2 = r.lessThanOrEqual(n2, L) ? r.divide(r.leftShift(n2, r.BigInt(96)), e2) : r.divide(r.multiply(n2, S), e2); + return r.add(t3, u2); + } + var a2 = X.mulDivRoundingUp(n2, S, e2); + return r.greaterThan(t3, a2) || i(false), r.subtract(t3, a2); + }, t2; + }(); + var M = r.exponentiate(r.BigInt(10), r.BigInt(6)); + var D = function() { + function t2() { + } + return t2.computeSwapStep = function(t3, e2, n2, i2, o2) { + var u2 = {}, a2 = r.greaterThanOrEqual(t3, e2), c2 = r.greaterThanOrEqual(i2, C); + if (c2) { + var s2 = r.divide(r.multiply(i2, r.subtract(M, r.BigInt(o2))), M); + u2.amountIn = a2 ? B.getAmount0Delta(e2, t3, n2, true) : B.getAmount1Delta(t3, e2, n2, true), u2.sqrtRatioNextX96 = r.greaterThanOrEqual(s2, u2.amountIn) ? e2 : B.getNextSqrtPriceFromInput(t3, n2, s2, a2); + } else u2.amountOut = a2 ? B.getAmount1Delta(e2, t3, n2, false) : B.getAmount0Delta(t3, e2, n2, false), u2.sqrtRatioNextX96 = r.greaterThanOrEqual(r.multiply(i2, P), u2.amountOut) ? e2 : B.getNextSqrtPriceFromOutput(t3, n2, r.multiply(i2, P), a2); + var p2 = r.equal(e2, u2.sqrtRatioNextX96); + return a2 ? (u2.amountIn = p2 && c2 ? u2.amountIn : B.getAmount0Delta(u2.sqrtRatioNextX96, t3, n2, true), u2.amountOut = p2 && !c2 ? u2.amountOut : B.getAmount1Delta(u2.sqrtRatioNextX96, t3, n2, false)) : (u2.amountIn = p2 && c2 ? u2.amountIn : B.getAmount1Delta(t3, u2.sqrtRatioNextX96, n2, true), u2.amountOut = p2 && !c2 ? u2.amountOut : B.getAmount0Delta(t3, u2.sqrtRatioNextX96, n2, false)), !c2 && r.greaterThan(u2.amountOut, r.multiply(i2, P)) && (u2.amountOut = r.multiply(i2, P)), u2.feeAmount = c2 && r.notEqual(u2.sqrtRatioNextX96, e2) ? r.subtract(i2, u2.amountIn) : X.mulDivRoundingUp(u2.amountIn, r.BigInt(o2), r.subtract(M, r.BigInt(o2))), [u2.sqrtRatioNextX96, u2.amountIn, u2.amountOut, u2.feeAmount]; + }, t2; + }(); + var j = r.BigInt(2); + var W = [128, 64, 32, 16, 8, 4, 2, 1].map(function(t2) { + return [t2, r.exponentiate(j, r.BigInt(t2))]; + }); + function G(t2) { + r.greaterThan(t2, C) || i(false), r.lessThanOrEqual(t2, n.MaxUint256) || i(false); + for (var e2, o2 = 0, u2 = I(W); !(e2 = u2()).done; ) { + var a2 = e2.value, c2 = a2[0]; + r.greaterThanOrEqual(t2, a2[1]) && (t2 = r.signedRightShift(t2, r.BigInt(c2)), o2 += c2); + } + return o2; + } + function K(t2, e2) { + return r.signedRightShift(r.multiply(t2, r.BigInt(e2)), r.BigInt(128)); + } + var H = r.exponentiate(r.BigInt(2), r.BigInt(32)); + var Q = function() { + function t2() { + } + return t2.getSqrtRatioAtTick = function(e2) { + e2 >= t2.MIN_TICK && e2 <= t2.MAX_TICK && Number.isInteger(e2) || i(false); + var o2 = e2 < 0 ? -1 * e2 : e2, u2 = r.BigInt(0 != (1 & o2) ? "0xfffcb933bd6fad37aa2d162d1a594001" : "0x100000000000000000000000000000000"); + return 0 != (2 & o2) && (u2 = K(u2, "0xfff97272373d413259a46990580e213a")), 0 != (4 & o2) && (u2 = K(u2, "0xfff2e50f5f656932ef12357cf3c7fdcc")), 0 != (8 & o2) && (u2 = K(u2, "0xffe5caca7e10e4e61c3624eaa0941cd0")), 0 != (16 & o2) && (u2 = K(u2, "0xffcb9843d60f6159c9db58835c926644")), 0 != (32 & o2) && (u2 = K(u2, "0xff973b41fa98c081472e6896dfb254c0")), 0 != (64 & o2) && (u2 = K(u2, "0xff2ea16466c96a3843ec78b326b52861")), 0 != (128 & o2) && (u2 = K(u2, "0xfe5dee046a99a2a811c461f1969c3053")), 0 != (256 & o2) && (u2 = K(u2, "0xfcbe86c7900a88aedcffc83b479aa3a4")), 0 != (512 & o2) && (u2 = K(u2, "0xf987a7253ac413176f2b074cf7815e54")), 0 != (1024 & o2) && (u2 = K(u2, "0xf3392b0822b70005940c7a398e4b70f3")), 0 != (2048 & o2) && (u2 = K(u2, "0xe7159475a2c29b7443b29c7fa6e889d9")), 0 != (4096 & o2) && (u2 = K(u2, "0xd097f3bdfd2022b8845ad8f792aa5825")), 0 != (8192 & o2) && (u2 = K(u2, "0xa9f746462d870fdf8a65dc1f90e061e5")), 0 != (16384 & o2) && (u2 = K(u2, "0x70d869a156d2a1b890bb3df62baf32f7")), 0 != (32768 & o2) && (u2 = K(u2, "0x31be135f97d08fd981231505542fcfa6")), 0 != (65536 & o2) && (u2 = K(u2, "0x9aa508b5b7a84e1c677de54f3e99bc9")), 0 != (131072 & o2) && (u2 = K(u2, "0x5d6af8dedb81196699c329225ee604")), 0 != (262144 & o2) && (u2 = K(u2, "0x2216e584f5fa1ea926041bedfe98")), 0 != (524288 & o2) && (u2 = K(u2, "0x48a170391f7dc42444e8fa2")), e2 > 0 && (u2 = r.divide(n.MaxUint256, u2)), r.greaterThan(r.remainder(u2, H), C) ? r.add(r.divide(u2, H), O) : r.divide(u2, H); + }, t2.getTickAtSqrtRatio = function(e2) { + r.greaterThanOrEqual(e2, t2.MIN_SQRT_RATIO) && r.lessThan(e2, t2.MAX_SQRT_RATIO) || i(false); + var n2, o2 = r.leftShift(e2, r.BigInt(32)), u2 = G(o2); + n2 = r.greaterThanOrEqual(r.BigInt(u2), r.BigInt(128)) ? r.signedRightShift(o2, r.BigInt(u2 - 127)) : r.leftShift(o2, r.BigInt(127 - u2)); + for (var a2 = r.leftShift(r.subtract(r.BigInt(u2), r.BigInt(128)), r.BigInt(64)), c2 = 0; c2 < 14; c2++) { + n2 = r.signedRightShift(r.multiply(n2, n2), r.BigInt(127)); + var s2 = r.signedRightShift(n2, r.BigInt(128)); + a2 = r.bitwiseOr(a2, r.leftShift(s2, r.BigInt(63 - c2))), n2 = r.signedRightShift(n2, s2); + } + var p2 = r.multiply(a2, r.BigInt("255738958999603826347141")), l2 = r.toNumber(r.signedRightShift(r.subtract(p2, r.BigInt("3402992956809132418596140100660247210")), r.BigInt(128))), d2 = r.toNumber(r.signedRightShift(r.add(p2, r.BigInt("291339464771989622907027621153398088495")), r.BigInt(128))); + return l2 === d2 ? l2 : r.lessThanOrEqual(t2.getSqrtRatioAtTick(d2), e2) ? d2 : l2; + }, t2; + }(); + Q.MIN_TICK = -887272, Q.MAX_TICK = -Q.MIN_TICK, Q.MIN_SQRT_RATIO = r.BigInt("4295128739"), Q.MAX_SQRT_RATIO = r.BigInt("1461446703485210103287273052203988822378723970342"); + var V = function() { + function t2() { + } + var e2 = t2.prototype; + return e2.getTick = function() { + var e3 = g(v().mark(function e4(n2) { + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + throw new Error(t2.ERROR_MESSAGE); + case 1: + case "end": + return e5.stop(); + } + }, e4); + })); + return function(t3) { + return e3.apply(this, arguments); + }; + }(), e2.nextInitializedTickWithinOneWord = function() { + var e3 = g(v().mark(function e4(n2, r2, i2) { + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + throw new Error(t2.ERROR_MESSAGE); + case 1: + case "end": + return e5.stop(); + } + }, e4); + })); + return function(t3, n2, r2) { + return e3.apply(this, arguments); + }; + }(), t2; + }(); + function z(t2, e2) { + for (var n2 = 0; n2 < t2.length - 1; n2++) if (e2(t2[n2], t2[n2 + 1]) > 0) return false; + return true; + } + function Y(t2, e2) { + return t2.index - e2.index; + } + V.ERROR_MESSAGE = "No tick data provider was given"; + var Z = function() { + function t2() { + } + return t2.validateList = function(t3, e2) { + e2 > 0 || i(false), t3.every(function(t4) { + return t4.index % e2 == 0; + }) || i(false), r.equal(t3.reduce(function(t4, e3) { + return r.add(t4, e3.liquidityNet); + }, C), C) || i(false), z(t3, Y) || i(false); + }, t2.isBelowSmallest = function(t3, e2) { + return t3.length > 0 || i(false), e2 < t3[0].index; + }, t2.isAtOrAboveLargest = function(t3, e2) { + return t3.length > 0 || i(false), e2 >= t3[t3.length - 1].index; + }, t2.getTick = function(t3, e2) { + var n2 = t3[this.binarySearch(t3, e2)]; + return n2.index !== e2 && i(false), n2; + }, t2.binarySearch = function(t3, e2) { + this.isBelowSmallest(t3, e2) && i(false); + for (var n2, r2 = 0, o2 = t3.length - 1; ; ) { + if (t3[n2 = Math.floor((r2 + o2) / 2)].index <= e2 && (n2 === t3.length - 1 || t3[n2 + 1].index > e2)) return n2; + t3[n2].index < e2 ? r2 = n2 + 1 : o2 = n2 - 1; + } + }, t2.nextInitializedTick = function(e2, n2, r2) { + return r2 ? (t2.isBelowSmallest(e2, n2) && i(false), t2.isAtOrAboveLargest(e2, n2) ? e2[e2.length - 1] : e2[this.binarySearch(e2, n2)]) : (this.isAtOrAboveLargest(e2, n2) && i(false), this.isBelowSmallest(e2, n2) ? e2[0] : e2[this.binarySearch(e2, n2) + 1]); + }, t2.nextInitializedTickWithinOneWord = function(e2, n2, r2, i2) { + var o2 = Math.floor(n2 / i2); + if (r2) { + var u2 = (o2 >> 8 << 8) * i2; + if (t2.isBelowSmallest(e2, n2)) return [u2, false]; + var a2 = t2.nextInitializedTick(e2, n2, r2).index, c2 = Math.max(u2, a2); + return [c2, c2 === a2]; + } + var s2 = ((1 + (o2 + 1 >> 8) << 8) - 1) * i2; + if (this.isAtOrAboveLargest(e2, n2)) return [s2, false]; + var p2 = this.nextInitializedTick(e2, n2, r2).index, l2 = Math.min(s2, p2); + return [l2, l2 === p2]; + }, t2; + }(); + function $(t2) { + var e2 = r.BigInt(t2).toString(16); + return e2.length % 2 != 0 && (e2 = "0" + e2), "0x" + e2; + } + function J(t2, e2) { + var n2 = t2.pools.reduce(function(t3, e3, n3) { + var r3 = t3.inputToken, i3 = t3.path, o2 = t3.types, u2 = e3.token0.equals(r3) ? e3.token1 : e3.token0; + return 0 === n3 ? { inputToken: u2, types: ["address", "uint24", "address"], path: [r3.address, e3.fee, u2.address] } : { inputToken: u2, types: [].concat(o2, ["uint24", "address"]), path: [].concat(i3, [e3.fee, u2.address]) }; + }, { inputToken: t2.input.wrapped, path: [], types: [] }), r2 = n2.path, i2 = n2.types; + return e2 ? a.pack(i2.reverse(), r2.reverse()) : a.pack(i2, r2); + } + function tt(t2, e2) { + var i2 = r.leftShift(r.BigInt(t2), r.BigInt(192)), o2 = r.BigInt(e2), u2 = r.divide(i2, o2); + return n.sqrt(u2); + } + function et(t2, e2, n2) { + if (r.greaterThan(t2, e2)) { + var i2 = [e2, t2]; + t2 = i2[0], e2 = i2[1]; + } + var o2 = r.divide(r.multiply(t2, e2), S); + return r.divide(r.multiply(r.BigInt(n2), o2), r.subtract(e2, t2)); + } + function nt(t2, e2, n2) { + if (r.greaterThan(t2, e2)) { + var i2 = [e2, t2]; + t2 = i2[0], e2 = i2[1]; + } + var o2 = r.multiply(r.multiply(r.BigInt(n2), t2), e2), u2 = r.multiply(S, r.subtract(e2, t2)); + return r.divide(o2, u2); + } + function rt(t2, e2, n2) { + if (r.greaterThan(t2, e2)) { + var i2 = [e2, t2]; + t2 = i2[0], e2 = i2[1]; + } + return r.divide(r.multiply(r.BigInt(n2), S), r.subtract(e2, t2)); + } + function it(t2, e2, n2, i2, o2, u2) { + if (r.greaterThan(e2, n2)) { + var a2 = [n2, e2]; + e2 = a2[0], n2 = a2[1]; + } + var c2 = u2 ? nt : et; + if (r.lessThanOrEqual(t2, e2)) return c2(e2, n2, i2); + if (r.lessThan(t2, n2)) { + var s2 = c2(t2, n2, i2), p2 = rt(e2, t2, o2); + return r.lessThan(s2, p2) ? s2 : p2; + } + return rt(e2, n2, o2); + } + var ot = r.exponentiate(r.BigInt(2), r.BigInt(128)); + var ut = function() { + function t2() { + } + return t2.getTokensOwed = function(t3, e2, n2, i2, o2) { + return [r.divide(r.multiply(st(i2, t3), n2), ot), r.divide(r.multiply(st(o2, e2), n2), ot)]; + }, t2; + }(); + function at(t2, e2, i2) { + var o2 = Q.getSqrtRatioAtTick(i2), u2 = r.multiply(o2, o2); + return t2.sortsBefore(e2) ? new n.Price(t2, e2, N, u2) : new n.Price(t2, e2, u2, N); + } + var ct = r.exponentiate(r.BigInt(2), r.BigInt(256)); + function st(t2, e2) { + var n2 = r.subtract(t2, e2); + return r.lessThan(n2, C) ? r.add(ct, n2) : n2; + } + var pt = function() { + function t2() { + } + return t2.getFeeGrowthInside = function(t3, e2, n2, r2, i2, o2, u2) { + var a2, c2, s2, p2; + return i2 >= n2 ? (a2 = t3.feeGrowthOutside0X128, c2 = t3.feeGrowthOutside1X128) : (a2 = st(o2, t3.feeGrowthOutside0X128), c2 = st(u2, t3.feeGrowthOutside1X128)), i2 < r2 ? (s2 = e2.feeGrowthOutside0X128, p2 = e2.feeGrowthOutside1X128) : (s2 = st(o2, e2.feeGrowthOutside0X128), p2 = st(u2, e2.feeGrowthOutside1X128)), [st(st(o2, a2), s2), st(st(u2, c2), p2)]; + }, t2; + }(); + var lt = function(t2) { + var e2 = t2.index, n2 = t2.liquidityGross, o2 = t2.liquidityNet; + e2 >= Q.MIN_TICK && e2 <= Q.MAX_TICK || i(false), this.index = e2, this.liquidityGross = r.BigInt(n2), this.liquidityNet = r.BigInt(o2); + }; + var dt = function() { + function t2(t3, e3) { + var n2 = t3.map(function(t4) { + return t4 instanceof lt ? t4 : new lt(t4); + }); + Z.validateList(n2, e3), this.ticks = n2; + } + var e2 = t2.prototype; + return e2.getTick = function() { + var t3 = g(v().mark(function t4(e3) { + return v().wrap(function(t5) { + for (; ; ) switch (t5.prev = t5.next) { + case 0: + return t5.abrupt("return", Z.getTick(this.ticks, e3)); + case 1: + case "end": + return t5.stop(); + } + }, t4, this); + })); + return function(e3) { + return t3.apply(this, arguments); + }; + }(), e2.nextInitializedTickWithinOneWord = function() { + var t3 = g(v().mark(function t4(e3, n2, r2) { + return v().wrap(function(t5) { + for (; ; ) switch (t5.prev = t5.next) { + case 0: + return t5.abrupt("return", Z.nextInitializedTickWithinOneWord(this.ticks, e3, n2, r2)); + case 1: + case "end": + return t5.stop(); + } + }, t4, this); + })); + return function(e3, n2, r2) { + return t3.apply(this, arguments); + }; + }(), t2; + }(); + var ft = new V(); + var ht = function() { + function t2(t3, e3, n2, o2, u2, a2, c2) { + void 0 === c2 && (c2 = ft), Number.isInteger(n2) && n2 < 1e6 || i(false); + var s2 = Q.getSqrtRatioAtTick(a2), p2 = Q.getSqrtRatioAtTick(a2 + 1); + r.greaterThanOrEqual(r.BigInt(o2), s2) && r.lessThanOrEqual(r.BigInt(o2), p2) || i(false); + var l2 = t3.sortsBefore(e3) ? [t3, e3] : [e3, t3]; + this.token0 = l2[0], this.token1 = l2[1], this.fee = n2, this.sqrtRatioX96 = r.BigInt(o2), this.liquidity = r.BigInt(u2), this.tickCurrent = a2, this.tickDataProvider = Array.isArray(c2) ? new dt(c2, E[n2]) : c2; + } + t2.getAddress = function(t3, e3, n2, r2, i2) { + return _({ factoryAddress: null != i2 ? i2 : "0x1F98431c8aD98523631AE4a59f267346ea31F984", fee: n2, tokenA: t3, tokenB: e3, initCodeHashManualOverride: r2 }); + }; + var e2 = t2.prototype; + return e2.involvesToken = function(t3) { + return t3.equals(this.token0) || t3.equals(this.token1); + }, e2.priceOf = function(t3) { + return this.involvesToken(t3) || i(false), t3.equals(this.token0) ? this.token0Price : this.token1Price; + }, e2.getOutputAmount = function() { + var e3 = g(v().mark(function e4(o2, u2) { + var a2, c2, s2, p2, l2; + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + return this.involvesToken(o2.currency) || i(false), a2 = o2.currency.equals(this.token0), e5.next = 4, this.swap(a2, o2.quotient, u2); + case 4: + return s2 = (c2 = e5.sent).sqrtRatioX96, p2 = c2.liquidity, l2 = c2.tickCurrent, e5.abrupt("return", [n.CurrencyAmount.fromRawAmount(a2 ? this.token1 : this.token0, r.multiply(c2.amountCalculated, P)), new t2(this.token0, this.token1, this.fee, s2, p2, l2, this.tickDataProvider)]); + case 11: + case "end": + return e5.stop(); + } + }, e4, this); + })); + return function(t3, n2) { + return e3.apply(this, arguments); + }; + }(), e2.getInputAmount = function() { + var e3 = g(v().mark(function e4(o2, u2) { + var a2, c2, s2, p2, l2; + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + return o2.currency.isToken && this.involvesToken(o2.currency) || i(false), a2 = o2.currency.equals(this.token1), e5.next = 4, this.swap(a2, r.multiply(o2.quotient, P), u2); + case 4: + return s2 = (c2 = e5.sent).sqrtRatioX96, p2 = c2.liquidity, l2 = c2.tickCurrent, e5.abrupt("return", [n.CurrencyAmount.fromRawAmount(a2 ? this.token0 : this.token1, c2.amountCalculated), new t2(this.token0, this.token1, this.fee, s2, p2, l2, this.tickDataProvider)]); + case 11: + case "end": + return e5.stop(); + } + }, e4, this); + })); + return function(t3, n2) { + return e3.apply(this, arguments); + }; + }(), e2.swap = function() { + var t3 = g(v().mark(function t4(e3, n2, o2) { + var u2, a2, c2, s2, p2, l2; + return v().wrap(function(t5) { + for (; ; ) switch (t5.prev = t5.next) { + case 0: + o2 || (o2 = e3 ? r.add(Q.MIN_SQRT_RATIO, O) : r.subtract(Q.MAX_SQRT_RATIO, O)), e3 ? (r.greaterThan(o2, Q.MIN_SQRT_RATIO) || i(false), r.lessThan(o2, this.sqrtRatioX96) || i(false)) : (r.lessThan(o2, Q.MAX_SQRT_RATIO) || i(false), r.greaterThan(o2, this.sqrtRatioX96) || i(false)), u2 = r.greaterThanOrEqual(n2, C), a2 = { amountSpecifiedRemaining: n2, amountCalculated: C, sqrtPriceX96: this.sqrtRatioX96, tick: this.tickCurrent, liquidity: this.liquidity }; + case 4: + if (!r.notEqual(a2.amountSpecifiedRemaining, C) || a2.sqrtPriceX96 === o2) { + t5.next = 35; + break; + } + return (c2 = {}).sqrtPriceStartX96 = a2.sqrtPriceX96, t5.next = 9, this.tickDataProvider.nextInitializedTickWithinOneWord(a2.tick, e3, this.tickSpacing); + case 9: + if (c2.tickNext = (s2 = t5.sent)[0], c2.initialized = s2[1], c2.tickNext < Q.MIN_TICK ? c2.tickNext = Q.MIN_TICK : c2.tickNext > Q.MAX_TICK && (c2.tickNext = Q.MAX_TICK), c2.sqrtPriceNextX96 = Q.getSqrtRatioAtTick(c2.tickNext), p2 = D.computeSwapStep(a2.sqrtPriceX96, (e3 ? r.lessThan(c2.sqrtPriceNextX96, o2) : r.greaterThan(c2.sqrtPriceNextX96, o2)) ? o2 : c2.sqrtPriceNextX96, a2.liquidity, a2.amountSpecifiedRemaining, this.fee), a2.sqrtPriceX96 = p2[0], c2.amountIn = p2[1], c2.amountOut = p2[2], c2.feeAmount = p2[3], u2 ? (a2.amountSpecifiedRemaining = r.subtract(a2.amountSpecifiedRemaining, r.add(c2.amountIn, c2.feeAmount)), a2.amountCalculated = r.subtract(a2.amountCalculated, c2.amountOut)) : (a2.amountSpecifiedRemaining = r.add(a2.amountSpecifiedRemaining, c2.amountOut), a2.amountCalculated = r.add(a2.amountCalculated, r.add(c2.amountIn, c2.feeAmount))), !r.equal(a2.sqrtPriceX96, c2.sqrtPriceNextX96)) { + t5.next = 32; + break; + } + if (!c2.initialized) { + t5.next = 29; + break; + } + return t5.t0 = r, t5.next = 25, this.tickDataProvider.getTick(c2.tickNext); + case 25: + t5.t1 = t5.sent.liquidityNet, l2 = t5.t0.BigInt.call(t5.t0, t5.t1), e3 && (l2 = r.multiply(l2, P)), a2.liquidity = F.addDelta(a2.liquidity, l2); + case 29: + a2.tick = e3 ? c2.tickNext - 1 : c2.tickNext, t5.next = 33; + break; + case 32: + r.notEqual(a2.sqrtPriceX96, c2.sqrtPriceStartX96) && (a2.tick = Q.getTickAtSqrtRatio(a2.sqrtPriceX96)); + case 33: + t5.next = 4; + break; + case 35: + return t5.abrupt("return", { amountCalculated: a2.amountCalculated, sqrtRatioX96: a2.sqrtPriceX96, liquidity: a2.liquidity, tickCurrent: a2.tick }); + case 36: + case "end": + return t5.stop(); + } + }, t4, this); + })); + return function(e3, n2, r2) { + return t3.apply(this, arguments); + }; + }(), T(t2, [{ key: "token0Price", get: function() { + var t3; + return null != (t3 = this._token0Price) ? t3 : this._token0Price = new n.Price(this.token0, this.token1, N, r.multiply(this.sqrtRatioX96, this.sqrtRatioX96)); + } }, { key: "token1Price", get: function() { + var t3; + return null != (t3 = this._token1Price) ? t3 : this._token1Price = new n.Price(this.token1, this.token0, r.multiply(this.sqrtRatioX96, this.sqrtRatioX96), N); + } }, { key: "chainId", get: function() { + return this.token0.chainId; + } }, { key: "tickSpacing", get: function() { + return E[this.fee]; + } }]), t2; + }(); + var mt = function() { + function t2(t3) { + var e3 = t3.pool, n2 = t3.liquidity, o2 = t3.tickLower, u2 = t3.tickUpper; + this._token0Amount = null, this._token1Amount = null, this._mintAmounts = null, o2 < u2 || i(false), o2 >= Q.MIN_TICK && o2 % e3.tickSpacing == 0 || i(false), u2 <= Q.MAX_TICK && u2 % e3.tickSpacing == 0 || i(false), this.pool = e3, this.tickLower = o2, this.tickUpper = u2, this.liquidity = r.BigInt(n2); + } + var e2 = t2.prototype; + return e2.ratiosAfterSlippage = function(t3) { + var e3 = this.pool.token0Price.asFraction.multiply(new n.Percent(1).subtract(t3)), i2 = this.pool.token0Price.asFraction.multiply(t3.add(1)), o2 = tt(e3.numerator, e3.denominator); + r.lessThanOrEqual(o2, Q.MIN_SQRT_RATIO) && (o2 = r.add(Q.MIN_SQRT_RATIO, r.BigInt(1))); + var u2 = tt(i2.numerator, i2.denominator); + return r.greaterThanOrEqual(u2, Q.MAX_SQRT_RATIO) && (u2 = r.subtract(Q.MAX_SQRT_RATIO, r.BigInt(1))), { sqrtRatioX96Lower: o2, sqrtRatioX96Upper: u2 }; + }, e2.mintAmountsWithSlippage = function(e3) { + var n2 = this.ratiosAfterSlippage(e3), r2 = n2.sqrtRatioX96Upper, i2 = n2.sqrtRatioX96Lower, o2 = new ht(this.pool.token0, this.pool.token1, this.pool.fee, i2, 0, Q.getTickAtSqrtRatio(i2)), u2 = new ht(this.pool.token0, this.pool.token1, this.pool.fee, r2, 0, Q.getTickAtSqrtRatio(r2)), a2 = t2.fromAmounts(w({ pool: this.pool, tickLower: this.tickLower, tickUpper: this.tickUpper }, this.mintAmounts, { useFullPrecision: false })); + return { amount0: new t2({ pool: u2, liquidity: a2.liquidity, tickLower: this.tickLower, tickUpper: this.tickUpper }).mintAmounts.amount0, amount1: new t2({ pool: o2, liquidity: a2.liquidity, tickLower: this.tickLower, tickUpper: this.tickUpper }).mintAmounts.amount1 }; + }, e2.burnAmountsWithSlippage = function(e3) { + var n2 = this.ratiosAfterSlippage(e3), r2 = n2.sqrtRatioX96Upper, i2 = n2.sqrtRatioX96Lower, o2 = new ht(this.pool.token0, this.pool.token1, this.pool.fee, i2, 0, Q.getTickAtSqrtRatio(i2)), u2 = new t2({ pool: new ht(this.pool.token0, this.pool.token1, this.pool.fee, r2, 0, Q.getTickAtSqrtRatio(r2)), liquidity: this.liquidity, tickLower: this.tickLower, tickUpper: this.tickUpper }).amount0, a2 = new t2({ pool: o2, liquidity: this.liquidity, tickLower: this.tickLower, tickUpper: this.tickUpper }).amount1; + return { amount0: u2.quotient, amount1: a2.quotient }; + }, t2.fromAmounts = function(e3) { + var n2 = e3.pool, r2 = e3.tickLower, i2 = e3.tickUpper, o2 = e3.amount0, u2 = e3.amount1, a2 = e3.useFullPrecision, c2 = Q.getSqrtRatioAtTick(r2), s2 = Q.getSqrtRatioAtTick(i2); + return new t2({ pool: n2, tickLower: r2, tickUpper: i2, liquidity: it(n2.sqrtRatioX96, c2, s2, o2, u2, a2) }); + }, t2.fromAmount0 = function(e3) { + return t2.fromAmounts({ pool: e3.pool, tickLower: e3.tickLower, tickUpper: e3.tickUpper, amount0: e3.amount0, amount1: n.MaxUint256, useFullPrecision: e3.useFullPrecision }); + }, t2.fromAmount1 = function(e3) { + return t2.fromAmounts({ pool: e3.pool, tickLower: e3.tickLower, tickUpper: e3.tickUpper, amount0: n.MaxUint256, amount1: e3.amount1, useFullPrecision: true }); + }, T(t2, [{ key: "token0PriceLower", get: function() { + return at(this.pool.token0, this.pool.token1, this.tickLower); + } }, { key: "token0PriceUpper", get: function() { + return at(this.pool.token0, this.pool.token1, this.tickUpper); + } }, { key: "amount0", get: function() { + return null === this._token0Amount && (this._token0Amount = n.CurrencyAmount.fromRawAmount(this.pool.token0, this.pool.tickCurrent < this.tickLower ? B.getAmount0Delta(Q.getSqrtRatioAtTick(this.tickLower), Q.getSqrtRatioAtTick(this.tickUpper), this.liquidity, false) : this.pool.tickCurrent < this.tickUpper ? B.getAmount0Delta(this.pool.sqrtRatioX96, Q.getSqrtRatioAtTick(this.tickUpper), this.liquidity, false) : C)), this._token0Amount; + } }, { key: "amount1", get: function() { + return null === this._token1Amount && (this._token1Amount = n.CurrencyAmount.fromRawAmount(this.pool.token1, this.pool.tickCurrent < this.tickLower ? C : B.getAmount1Delta(Q.getSqrtRatioAtTick(this.tickLower), this.pool.tickCurrent < this.tickUpper ? this.pool.sqrtRatioX96 : Q.getSqrtRatioAtTick(this.tickUpper), this.liquidity, false))), this._token1Amount; + } }, { key: "mintAmounts", get: function() { + return null === this._mintAmounts ? this.pool.tickCurrent < this.tickLower ? { amount0: B.getAmount0Delta(Q.getSqrtRatioAtTick(this.tickLower), Q.getSqrtRatioAtTick(this.tickUpper), this.liquidity, true), amount1: C } : this.pool.tickCurrent < this.tickUpper ? { amount0: B.getAmount0Delta(this.pool.sqrtRatioX96, Q.getSqrtRatioAtTick(this.tickUpper), this.liquidity, true), amount1: B.getAmount1Delta(Q.getSqrtRatioAtTick(this.tickLower), this.pool.sqrtRatioX96, this.liquidity, true) } : { amount0: C, amount1: B.getAmount1Delta(Q.getSqrtRatioAtTick(this.tickLower), Q.getSqrtRatioAtTick(this.tickUpper), this.liquidity, true) } : this._mintAmounts; + } }]), t2; + }(); + var vt = function() { + function t2(t3, e2, n2) { + this._midPrice = null, t3.length > 0 || i(false); + var r2 = t3[0].chainId; + t3.every(function(t4) { + return t4.chainId === r2; + }) || i(false); + var o2 = e2.wrapped; + t3[0].involvesToken(o2) || i(false), t3[t3.length - 1].involvesToken(n2.wrapped) || i(false); + for (var u2, a2 = [o2], c2 = I(t3.entries()); !(u2 = c2()).done; ) { + var s2 = u2.value, p2 = s2[1], l2 = a2[s2[0]]; + l2.equals(p2.token0) || l2.equals(p2.token1) || i(false); + var d2 = l2.equals(p2.token0) ? p2.token1 : p2.token0; + a2.push(d2); + } + this.pools = t3, this.tokenPath = a2, this.input = e2, this.output = null != n2 ? n2 : a2[a2.length - 1]; + } + return T(t2, [{ key: "chainId", get: function() { + return this.pools[0].chainId; + } }, { key: "midPrice", get: function() { + if (null !== this._midPrice) return this._midPrice; + var t3 = this.pools.slice(1).reduce(function(t4, e2) { + var n2 = t4.price; + return t4.nextInput.equals(e2.token0) ? { nextInput: e2.token1, price: n2.multiply(e2.token0Price) } : { nextInput: e2.token0, price: n2.multiply(e2.token1Price) }; + }, this.pools[0].token0.equals(this.input.wrapped) ? { nextInput: this.pools[0].token1, price: this.pools[0].token0Price } : { nextInput: this.pools[0].token0, price: this.pools[0].token1Price }).price; + return this._midPrice = new n.Price(this.input, this.output, t3.denominator, t3.numerator); + } }]), t2; + }(); + function yt(t2, e2) { + return t2.inputAmount.currency.equals(e2.inputAmount.currency) || i(false), t2.outputAmount.currency.equals(e2.outputAmount.currency) || i(false), t2.outputAmount.equalTo(e2.outputAmount) ? t2.inputAmount.equalTo(e2.inputAmount) ? t2.swaps.reduce(function(t3, e3) { + return t3 + e3.route.tokenPath.length; + }, 0) - e2.swaps.reduce(function(t3, e3) { + return t3 + e3.route.tokenPath.length; + }, 0) : t2.inputAmount.lessThan(e2.inputAmount) ? -1 : 1 : t2.outputAmount.lessThan(e2.outputAmount) ? 1 : -1; + } + var kt = function() { + function t2(t3) { + var e3 = t3.routes, n2 = t3.tradeType, r2 = e3[0].inputAmount.currency, o2 = e3[0].outputAmount.currency; + e3.every(function(t4) { + return r2.wrapped.equals(t4.route.input.wrapped); + }) || i(false), e3.every(function(t4) { + return o2.wrapped.equals(t4.route.output.wrapped); + }) || i(false); + for (var u2, a2 = e3.map(function(t4) { + return t4.route.pools.length; + }).reduce(function(t4, e4) { + return t4 + e4; + }, 0), c2 = /* @__PURE__ */ new Set(), s2 = I(e3); !(u2 = s2()).done; ) for (var p2, l2 = I(u2.value.route.pools); !(p2 = l2()).done; ) { + var d2 = p2.value; + c2.add(ht.getAddress(d2.token0, d2.token1, d2.fee)); + } + a2 !== c2.size && i(false), this.swaps = e3, this.tradeType = n2; + } + t2.exactIn = function() { + var e3 = g(v().mark(function e4(r2, i2) { + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + return e5.abrupt("return", t2.fromRoute(r2, i2, n.TradeType.EXACT_INPUT)); + case 1: + case "end": + return e5.stop(); + } + }, e4); + })); + return function(t3, n2) { + return e3.apply(this, arguments); + }; + }(), t2.exactOut = function() { + var e3 = g(v().mark(function e4(r2, i2) { + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + return e5.abrupt("return", t2.fromRoute(r2, i2, n.TradeType.EXACT_OUTPUT)); + case 1: + case "end": + return e5.stop(); + } + }, e4); + })); + return function(t3, n2) { + return e3.apply(this, arguments); + }; + }(), t2.fromRoute = function() { + var e3 = g(v().mark(function e4(r2, o2, u2) { + var a2, c2, s2, p2, l2, d2, f2; + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + if (a2 = new Array(r2.tokenPath.length), u2 !== n.TradeType.EXACT_INPUT) { + e5.next = 19; + break; + } + o2.currency.equals(r2.input) || i(false), a2[0] = o2.wrapped, p2 = 0; + case 5: + if (!(p2 < r2.tokenPath.length - 1)) { + e5.next = 15; + break; + } + return l2 = r2.pools[p2], e5.next = 9, l2.getOutputAmount(a2[p2]); + case 9: + a2[p2 + 1] = e5.sent[0]; + case 12: + p2++, e5.next = 5; + break; + case 15: + c2 = n.CurrencyAmount.fromFractionalAmount(r2.input, o2.numerator, o2.denominator), s2 = n.CurrencyAmount.fromFractionalAmount(r2.output, a2[a2.length - 1].numerator, a2[a2.length - 1].denominator), e5.next = 34; + break; + case 19: + o2.currency.equals(r2.output) || i(false), a2[a2.length - 1] = o2.wrapped, d2 = r2.tokenPath.length - 1; + case 22: + if (!(d2 > 0)) { + e5.next = 32; + break; + } + return f2 = r2.pools[d2 - 1], e5.next = 26, f2.getInputAmount(a2[d2]); + case 26: + a2[d2 - 1] = e5.sent[0]; + case 29: + d2--, e5.next = 22; + break; + case 32: + c2 = n.CurrencyAmount.fromFractionalAmount(r2.input, a2[0].numerator, a2[0].denominator), s2 = n.CurrencyAmount.fromFractionalAmount(r2.output, o2.numerator, o2.denominator); + case 34: + return e5.abrupt("return", new t2({ routes: [{ inputAmount: c2, outputAmount: s2, route: r2 }], tradeType: u2 })); + case 35: + case "end": + return e5.stop(); + } + }, e4); + })); + return function(t3, n2, r2) { + return e3.apply(this, arguments); + }; + }(), t2.fromRoutes = function() { + var e3 = g(v().mark(function e4(r2, o2) { + var u2, a2, c2, s2, p2, l2, d2, f2, h2, m2, y2, k2, g2; + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + u2 = [], a2 = I(r2); + case 2: + if ((c2 = a2()).done) { + e5.next = 43; + break; + } + if (p2 = (s2 = c2.value).route, l2 = s2.amount, d2 = new Array(p2.tokenPath.length), f2 = void 0, h2 = void 0, o2 !== n.TradeType.EXACT_INPUT) { + e5.next = 25; + break; + } + l2.currency.equals(p2.input) || i(false), f2 = n.CurrencyAmount.fromFractionalAmount(p2.input, l2.numerator, l2.denominator), d2[0] = n.CurrencyAmount.fromFractionalAmount(p2.input.wrapped, l2.numerator, l2.denominator), m2 = 0; + case 12: + if (!(m2 < p2.tokenPath.length - 1)) { + e5.next = 22; + break; + } + return y2 = p2.pools[m2], e5.next = 16, y2.getOutputAmount(d2[m2]); + case 16: + d2[m2 + 1] = e5.sent[0]; + case 19: + m2++, e5.next = 12; + break; + case 22: + h2 = n.CurrencyAmount.fromFractionalAmount(p2.output, d2[d2.length - 1].numerator, d2[d2.length - 1].denominator), e5.next = 40; + break; + case 25: + l2.currency.equals(p2.output) || i(false), h2 = n.CurrencyAmount.fromFractionalAmount(p2.output, l2.numerator, l2.denominator), d2[d2.length - 1] = n.CurrencyAmount.fromFractionalAmount(p2.output.wrapped, l2.numerator, l2.denominator), k2 = p2.tokenPath.length - 1; + case 29: + if (!(k2 > 0)) { + e5.next = 39; + break; + } + return g2 = p2.pools[k2 - 1], e5.next = 33, g2.getInputAmount(d2[k2]); + case 33: + d2[k2 - 1] = e5.sent[0]; + case 36: + k2--, e5.next = 29; + break; + case 39: + f2 = n.CurrencyAmount.fromFractionalAmount(p2.input, d2[0].numerator, d2[0].denominator); + case 40: + u2.push({ route: p2, inputAmount: f2, outputAmount: h2 }); + case 41: + e5.next = 2; + break; + case 43: + return e5.abrupt("return", new t2({ routes: u2, tradeType: o2 })); + case 44: + case "end": + return e5.stop(); + } + }, e4); + })); + return function(t3, n2) { + return e3.apply(this, arguments); + }; + }(), t2.createUncheckedTrade = function(e3) { + return new t2(w({}, e3, { routes: [{ inputAmount: e3.inputAmount, outputAmount: e3.outputAmount, route: e3.route }] })); + }, t2.createUncheckedTradeWithMultipleRoutes = function(e3) { + return new t2(e3); + }; + var e2 = t2.prototype; + return e2.minimumAmountOut = function(t3, e3) { + if (void 0 === e3 && (e3 = this.outputAmount), t3.lessThan(C) && i(false), this.tradeType === n.TradeType.EXACT_OUTPUT) return e3; + var r2 = new n.Fraction(O).add(t3).invert().multiply(e3.quotient).quotient; + return n.CurrencyAmount.fromRawAmount(e3.currency, r2); + }, e2.maximumAmountIn = function(t3, e3) { + if (void 0 === e3 && (e3 = this.inputAmount), t3.lessThan(C) && i(false), this.tradeType === n.TradeType.EXACT_INPUT) return e3; + var r2 = new n.Fraction(O).add(t3).multiply(e3.quotient).quotient; + return n.CurrencyAmount.fromRawAmount(e3.currency, r2); + }, e2.worstExecutionPrice = function(t3) { + return new n.Price(this.inputAmount.currency, this.outputAmount.currency, this.maximumAmountIn(t3).quotient, this.minimumAmountOut(t3).quotient); + }, t2.bestTradeExactIn = function() { + var e3 = g(v().mark(function e4(r2, o2, u2, a2, c2, s2, p2) { + var l2, d2, f2, h2, m2, y2, k2, g2, A2, T2, w2; + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + f2 = void 0 === (d2 = (l2 = void 0 === a2 ? {} : a2).maxNumResults) ? 3 : d2, m2 = void 0 === (h2 = l2.maxHops) ? 3 : h2, void 0 === c2 && (c2 = []), void 0 === s2 && (s2 = o2), void 0 === p2 && (p2 = []), r2.length > 0 || i(false), m2 > 0 || i(false), o2 === s2 || c2.length > 0 || i(false), y2 = s2.wrapped, k2 = u2.wrapped, g2 = 0; + case 10: + if (!(g2 < r2.length)) { + e5.next = 46; + break; + } + if ((A2 = r2[g2]).token0.equals(y2.currency) || A2.token1.equals(y2.currency)) { + e5.next = 14; + break; + } + return e5.abrupt("continue", 43); + case 14: + return T2 = void 0, e5.prev = 15, e5.next = 19, A2.getOutputAmount(y2); + case 19: + T2 = e5.sent[0], e5.next = 28; + break; + case 23: + if (e5.prev = 23, e5.t0 = e5.catch(15), !e5.t0.isInsufficientInputAmountError) { + e5.next = 27; + break; + } + return e5.abrupt("continue", 43); + case 27: + throw e5.t0; + case 28: + if (!T2.currency.isToken || !T2.currency.equals(k2)) { + e5.next = 39; + break; + } + return e5.t1 = n.sortedInsert, e5.t2 = p2, e5.next = 33, t2.fromRoute(new vt([].concat(c2, [A2]), o2.currency, u2), o2, n.TradeType.EXACT_INPUT); + case 33: + e5.t3 = e5.sent, e5.t4 = f2, e5.t5 = yt, (0, e5.t1)(e5.t2, e5.t3, e5.t4, e5.t5), e5.next = 43; + break; + case 39: + if (!(m2 > 1 && r2.length > 1)) { + e5.next = 43; + break; + } + return w2 = r2.slice(0, g2).concat(r2.slice(g2 + 1, r2.length)), e5.next = 43, t2.bestTradeExactIn(w2, o2, u2, { maxNumResults: f2, maxHops: m2 - 1 }, [].concat(c2, [A2]), T2, p2); + case 43: + g2++, e5.next = 10; + break; + case 46: + return e5.abrupt("return", p2); + case 47: + case "end": + return e5.stop(); + } + }, e4, null, [[15, 23]]); + })); + return function(t3, n2, r2, i2, o2, u2, a2) { + return e3.apply(this, arguments); + }; + }(), t2.bestTradeExactOut = function() { + var e3 = g(v().mark(function e4(r2, o2, u2, a2, c2, s2, p2) { + var l2, d2, f2, h2, m2, y2, k2, g2, A2, T2, w2; + return v().wrap(function(e5) { + for (; ; ) switch (e5.prev = e5.next) { + case 0: + f2 = void 0 === (d2 = (l2 = void 0 === a2 ? {} : a2).maxNumResults) ? 3 : d2, m2 = void 0 === (h2 = l2.maxHops) ? 3 : h2, void 0 === c2 && (c2 = []), void 0 === s2 && (s2 = u2), void 0 === p2 && (p2 = []), r2.length > 0 || i(false), m2 > 0 || i(false), u2 === s2 || c2.length > 0 || i(false), y2 = s2.wrapped, k2 = o2.wrapped, g2 = 0; + case 10: + if (!(g2 < r2.length)) { + e5.next = 46; + break; + } + if ((A2 = r2[g2]).token0.equals(y2.currency) || A2.token1.equals(y2.currency)) { + e5.next = 14; + break; + } + return e5.abrupt("continue", 43); + case 14: + return T2 = void 0, e5.prev = 15, e5.next = 19, A2.getInputAmount(y2); + case 19: + T2 = e5.sent[0], e5.next = 28; + break; + case 23: + if (e5.prev = 23, e5.t0 = e5.catch(15), !e5.t0.isInsufficientReservesError) { + e5.next = 27; + break; + } + return e5.abrupt("continue", 43); + case 27: + throw e5.t0; + case 28: + if (!T2.currency.equals(k2)) { + e5.next = 39; + break; + } + return e5.t1 = n.sortedInsert, e5.t2 = p2, e5.next = 33, t2.fromRoute(new vt([A2].concat(c2), o2, u2.currency), u2, n.TradeType.EXACT_OUTPUT); + case 33: + e5.t3 = e5.sent, e5.t4 = f2, e5.t5 = yt, (0, e5.t1)(e5.t2, e5.t3, e5.t4, e5.t5), e5.next = 43; + break; + case 39: + if (!(m2 > 1 && r2.length > 1)) { + e5.next = 43; + break; + } + return w2 = r2.slice(0, g2).concat(r2.slice(g2 + 1, r2.length)), e5.next = 43, t2.bestTradeExactOut(w2, o2, u2, { maxNumResults: f2, maxHops: m2 - 1 }, [A2].concat(c2), T2, p2); + case 43: + g2++, e5.next = 10; + break; + case 46: + return e5.abrupt("return", p2); + case 47: + case "end": + return e5.stop(); + } + }, e4, null, [[15, 23]]); + })); + return function(t3, n2, r2, i2, o2, u2, a2) { + return e3.apply(this, arguments); + }; + }(), T(t2, [{ key: "route", get: function() { + return 1 !== this.swaps.length && i(false), this.swaps[0].route; + } }, { key: "inputAmount", get: function() { + if (this._inputAmount) return this._inputAmount; + var t3 = this.swaps[0].inputAmount.currency, e3 = this.swaps.map(function(t4) { + return t4.inputAmount; + }).reduce(function(t4, e4) { + return t4.add(e4); + }, n.CurrencyAmount.fromRawAmount(t3, 0)); + return this._inputAmount = e3, this._inputAmount; + } }, { key: "outputAmount", get: function() { + if (this._outputAmount) return this._outputAmount; + var t3 = this.swaps[0].outputAmount.currency, e3 = this.swaps.map(function(t4) { + return t4.outputAmount; + }).reduce(function(t4, e4) { + return t4.add(e4); + }, n.CurrencyAmount.fromRawAmount(t3, 0)); + return this._outputAmount = e3, this._outputAmount; + } }, { key: "executionPrice", get: function() { + var t3; + return null != (t3 = this._executionPrice) ? t3 : this._executionPrice = new n.Price(this.inputAmount.currency, this.outputAmount.currency, this.inputAmount.quotient, this.outputAmount.quotient); + } }, { key: "priceImpact", get: function() { + if (this._priceImpact) return this._priceImpact; + for (var t3, e3 = n.CurrencyAmount.fromRawAmount(this.outputAmount.currency, 0), r2 = I(this.swaps); !(t3 = r2()).done; ) { + var i2 = t3.value; + e3 = e3.add(i2.route.midPrice.quote(i2.inputAmount)); + } + var o2 = e3.subtract(this.outputAmount).divide(e3); + return this._priceImpact = new n.Percent(o2.numerator, o2.denominator), this._priceImpact; + } }]), t2; + }(); + var gt = function() { + function t2() { + } + return t2.encodeMulticall = function(e2) { + return Array.isArray(e2) || (e2 = [e2]), 1 === e2.length ? e2[0] : t2.INTERFACE.encodeFunctionData("multicall", [e2]); + }, t2; + }(); + gt.INTERFACE = new o.Interface(c.abi); + var At = function() { + function t2() { + } + return t2.encodePermit = function(e2, n2) { + return "nonce" in n2 ? t2.INTERFACE.encodeFunctionData("selfPermitAllowed", [e2.address, $(n2.nonce), $(n2.expiry), n2.v, n2.r, n2.s]) : t2.INTERFACE.encodeFunctionData("selfPermit", [e2.address, $(n2.amount), $(n2.deadline), n2.v, n2.r, n2.s]); + }, t2; + }(); + At.INTERFACE = new o.Interface(p.abi); + var Tt = function() { + function t2() { + } + return t2.encodeFeeBips = function(t3) { + return $(t3.multiply(1e4).quotient); + }, t2.encodeUnwrapWETH9 = function(e2, r2, i2) { + if (r2 = n.validateAndParseAddress(r2), i2) { + var o2 = this.encodeFeeBips(i2.fee), u2 = n.validateAndParseAddress(i2.recipient); + return t2.INTERFACE.encodeFunctionData("unwrapWETH9WithFee", [$(e2), r2, o2, u2]); + } + return t2.INTERFACE.encodeFunctionData("unwrapWETH9", [$(e2), r2]); + }, t2.encodeSweepToken = function(e2, r2, i2, o2) { + if (i2 = n.validateAndParseAddress(i2), o2) { + var u2 = this.encodeFeeBips(o2.fee), a2 = n.validateAndParseAddress(o2.recipient); + return t2.INTERFACE.encodeFunctionData("sweepTokenWithFee", [e2.address, $(r2), i2, u2, a2]); + } + return t2.INTERFACE.encodeFunctionData("sweepToken", [e2.address, $(r2), i2]); + }, t2.encodeRefundETH = function() { + return t2.INTERFACE.encodeFunctionData("refundETH"); + }, t2; + }(); + Tt.INTERFACE = new o.Interface(l.abi); + var wt = ["expectedCurrencyOwed0", "expectedCurrencyOwed1"]; + var xt = $(r.subtract(r.exponentiate(r.BigInt(2), r.BigInt(128)), r.BigInt(1))); + function It(t2) { + return Object.keys(t2).some(function(t3) { + return "recipient" === t3; + }); + } + var qt = function() { + function t2() { + } + return t2.encodeCreate = function(e2) { + return t2.INTERFACE.encodeFunctionData("createAndInitializePoolIfNecessary", [e2.token0.address, e2.token1.address, e2.fee, $(e2.sqrtRatioX96)]); + }, t2.createCallParameters = function(t3) { + return { calldata: this.encodeCreate(t3), value: $(0) }; + }, t2.addCallParameters = function(e2, o2) { + r.greaterThan(e2.liquidity, C) || i(false); + var u2 = [], a2 = e2.mintAmounts, c2 = a2.amount0, s2 = a2.amount1, p2 = e2.mintAmountsWithSlippage(o2.slippageTolerance), l2 = $(p2.amount0), d2 = $(p2.amount1), f2 = $(o2.deadline); + if (It(o2) && o2.createPool && u2.push(this.encodeCreate(e2.pool)), o2.token0Permit && u2.push(At.encodePermit(e2.pool.token0, o2.token0Permit)), o2.token1Permit && u2.push(At.encodePermit(e2.pool.token1, o2.token1Permit)), It(o2)) { + var h2 = n.validateAndParseAddress(o2.recipient); + u2.push(t2.INTERFACE.encodeFunctionData("mint", [{ token0: e2.pool.token0.address, token1: e2.pool.token1.address, fee: e2.pool.fee, tickLower: e2.tickLower, tickUpper: e2.tickUpper, amount0Desired: $(c2), amount1Desired: $(s2), amount0Min: l2, amount1Min: d2, recipient: h2, deadline: f2 }])); + } else u2.push(t2.INTERFACE.encodeFunctionData("increaseLiquidity", [{ tokenId: $(o2.tokenId), amount0Desired: $(c2), amount1Desired: $(s2), amount0Min: l2, amount1Min: d2, deadline: f2 }])); + var m2 = $(0); + if (o2.useNative) { + var v2 = o2.useNative.wrapped; + e2.pool.token0.equals(v2) || e2.pool.token1.equals(v2) || i(false); + var y2 = e2.pool.token0.equals(v2) ? c2 : s2; + r.greaterThan(y2, C) && u2.push(Tt.encodeRefundETH()), m2 = $(y2); + } + return { calldata: gt.encodeMulticall(u2), value: m2 }; + }, t2.encodeCollect = function(e2) { + var r2 = [], i2 = $(e2.tokenId), o2 = e2.expectedCurrencyOwed0.currency.isNative || e2.expectedCurrencyOwed1.currency.isNative, u2 = n.validateAndParseAddress(e2.recipient); + if (r2.push(t2.INTERFACE.encodeFunctionData("collect", [{ tokenId: i2, recipient: o2 ? b : u2, amount0Max: xt, amount1Max: xt }])), o2) { + var a2 = e2.expectedCurrencyOwed0.currency.isNative ? e2.expectedCurrencyOwed1.currency : e2.expectedCurrencyOwed0.currency, c2 = e2.expectedCurrencyOwed0.currency.isNative ? e2.expectedCurrencyOwed1.quotient : e2.expectedCurrencyOwed0.quotient; + r2.push(Tt.encodeUnwrapWETH9(e2.expectedCurrencyOwed0.currency.isNative ? e2.expectedCurrencyOwed0.quotient : e2.expectedCurrencyOwed1.quotient, u2)), r2.push(Tt.encodeSweepToken(a2, c2, u2)); + } + return r2; + }, t2.collectCallParameters = function(e2) { + var n2 = t2.encodeCollect(e2); + return { calldata: gt.encodeMulticall(n2), value: $(0) }; + }, t2.removeCallParameters = function(e2, o2) { + var u2 = [], a2 = $(o2.deadline), c2 = $(o2.tokenId), s2 = new mt({ pool: e2.pool, liquidity: o2.liquidityPercentage.multiply(e2.liquidity).quotient, tickLower: e2.tickLower, tickUpper: e2.tickUpper }); + r.greaterThan(s2.liquidity, C) || i(false); + var p2 = s2.burnAmountsWithSlippage(o2.slippageTolerance), l2 = p2.amount0, d2 = p2.amount1; + o2.permit && u2.push(t2.INTERFACE.encodeFunctionData("permit", [n.validateAndParseAddress(o2.permit.spender), c2, $(o2.permit.deadline), o2.permit.v, o2.permit.r, o2.permit.s])), u2.push(t2.INTERFACE.encodeFunctionData("decreaseLiquidity", [{ tokenId: c2, liquidity: $(s2.liquidity), amount0Min: $(l2), amount1Min: $(d2), deadline: a2 }])); + var f2 = o2.collectOptions, h2 = f2.expectedCurrencyOwed0, m2 = f2.expectedCurrencyOwed1, v2 = function(t3, e3) { + if (null == t3) return {}; + var n2, r2, i2 = {}, o3 = Object.keys(t3); + for (r2 = 0; r2 < o3.length; r2++) e3.indexOf(n2 = o3[r2]) >= 0 || (i2[n2] = t3[n2]); + return i2; + }(f2, wt); + return u2.push.apply(u2, t2.encodeCollect(w({ tokenId: $(o2.tokenId), expectedCurrencyOwed0: h2.add(n.CurrencyAmount.fromRawAmount(h2.currency, l2)), expectedCurrencyOwed1: m2.add(n.CurrencyAmount.fromRawAmount(m2.currency, d2)) }, v2))), o2.liquidityPercentage.equalTo(O) ? o2.burnToken && u2.push(t2.INTERFACE.encodeFunctionData("burn", [c2])) : true === o2.burnToken && i(false), { calldata: gt.encodeMulticall(u2), value: $(0) }; + }, t2.safeTransferFromParameters = function(e2) { + var r2 = n.validateAndParseAddress(e2.recipient), i2 = n.validateAndParseAddress(e2.sender); + return { calldata: e2.data ? t2.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256,bytes)", [i2, r2, $(e2.tokenId), e2.data]) : t2.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256)", [i2, r2, $(e2.tokenId)]), value: $(0) }; + }, t2; + }(); + qt.INTERFACE = new o.Interface(s.abi); + var bt = function() { + function t2() { + } + return t2.quoteCallParameters = function(t3, e2, r2, o2) { + void 0 === o2 && (o2 = {}); + var u2, a2 = 1 === t3.pools.length, c2 = $(e2.quotient), s2 = o2.useQuoterV2 ? this.V2INTERFACE : this.V1INTERFACE; + if (a2) { + var p2, l2, d2 = { tokenIn: t3.tokenPath[0].address, tokenOut: t3.tokenPath[1].address, fee: t3.pools[0].fee, sqrtPriceLimitX96: $(null != (p2 = null == (l2 = o2) ? void 0 : l2.sqrtPriceLimitX96) ? p2 : 0) }, f2 = w({}, d2, r2 === n.TradeType.EXACT_INPUT ? { amountIn: c2 } : { amount: c2 }); + u2 = s2.encodeFunctionData(r2 === n.TradeType.EXACT_INPUT ? "quoteExactInputSingle" : "quoteExactOutputSingle", o2.useQuoterV2 ? [f2] : [d2.tokenIn, d2.tokenOut, d2.fee, c2, d2.sqrtPriceLimitX96]); + } else { + var h2; + void 0 !== (null == (h2 = o2) ? void 0 : h2.sqrtPriceLimitX96) && i(false); + var m2 = J(t3, r2 === n.TradeType.EXACT_OUTPUT); + u2 = s2.encodeFunctionData(r2 === n.TradeType.EXACT_INPUT ? "quoteExactInput" : "quoteExactOutput", [m2, c2]); + } + return { calldata: u2, value: $(0) }; + }, t2; + }(); + bt.V1INTERFACE = new o.Interface(d.abi), bt.V2INTERFACE = new o.Interface(f.abi); + var Rt = function() { + function t2() { + } + return t2.encodeClaim = function(e2, r2) { + var i2, o2 = []; + o2.push(t2.INTERFACE.encodeFunctionData("unstakeToken", [this._encodeIncentiveKey(e2), $(r2.tokenId)])); + var u2 = n.validateAndParseAddress(r2.recipient), a2 = null != (i2 = r2.amount) ? i2 : 0; + return o2.push(t2.INTERFACE.encodeFunctionData("claimReward", [e2.rewardToken.address, u2, $(a2)])), o2; + }, t2.collectRewards = function(e2, n2) { + e2 = Array.isArray(e2) ? e2 : [e2]; + for (var r2 = [], i2 = 0; i2 < e2.length; i2++) { + var o2 = e2[i2]; + (r2 = r2.concat(this.encodeClaim(o2, n2))).push(t2.INTERFACE.encodeFunctionData("stakeToken", [this._encodeIncentiveKey(o2), $(n2.tokenId)])); + } + return { calldata: gt.encodeMulticall(r2), value: $(0) }; + }, t2.withdrawToken = function(e2, r2) { + var i2 = []; + e2 = Array.isArray(e2) ? e2 : [e2]; + for (var o2 = { tokenId: r2.tokenId, recipient: r2.recipient, amount: r2.amount }, u2 = 0; u2 < e2.length; u2++) i2 = i2.concat(this.encodeClaim(e2[u2], o2)); + var a2 = n.validateAndParseAddress(r2.owner); + return i2.push(t2.INTERFACE.encodeFunctionData("withdrawToken", [$(r2.tokenId), a2, r2.data ? r2.data : $(0)])), { calldata: gt.encodeMulticall(i2), value: $(0) }; + }, t2.encodeDeposit = function(e2) { + var n2; + if ((e2 = Array.isArray(e2) ? e2 : [e2]).length > 1) { + for (var r2 = [], i2 = 0; i2 < e2.length; i2++) r2.push(this._encodeIncentiveKey(e2[i2])); + n2 = o.defaultAbiCoder.encode([t2.INCENTIVE_KEY_ABI + "[]"], [r2]); + } else n2 = o.defaultAbiCoder.encode([t2.INCENTIVE_KEY_ABI], [this._encodeIncentiveKey(e2[0])]); + return n2; + }, t2._encodeIncentiveKey = function(t3) { + var e2 = t3.pool, r2 = e2.token0, i2 = e2.token1, o2 = e2.fee, u2 = n.validateAndParseAddress(t3.refundee); + return { rewardToken: t3.rewardToken.address, pool: ht.getAddress(r2, i2, o2), startTime: $(t3.startTime), endTime: $(t3.endTime), refundee: u2 }; + }, t2; + }(); + Rt.INTERFACE = new o.Interface(h.abi), Rt.INCENTIVE_KEY_ABI = "tuple(address rewardToken, address pool, uint256 startTime, uint256 endTime, address refundee)"; + var Et = function() { + function t2() { + } + return t2.swapCallParameters = function(e2, r2) { + Array.isArray(e2) || (e2 = [e2]); + var o2 = e2[0], u2 = o2.inputAmount.currency.wrapped, a2 = o2.outputAmount.currency.wrapped; + e2.every(function(t3) { + return t3.inputAmount.currency.wrapped.equals(u2); + }) || i(false), e2.every(function(t3) { + return t3.outputAmount.currency.wrapped.equals(a2); + }) || i(false); + var c2 = [], s2 = n.CurrencyAmount.fromRawAmount(e2[0].inputAmount.currency, 0), p2 = n.CurrencyAmount.fromRawAmount(e2[0].outputAmount.currency, 0), l2 = e2.reduce(function(t3, e3) { + return t3.add(e3.minimumAmountOut(r2.slippageTolerance)); + }, p2), d2 = o2.inputAmount.currency.isNative && o2.tradeType === n.TradeType.EXACT_OUTPUT, f2 = o2.outputAmount.currency.isNative, h2 = f2 || !!r2.fee, m2 = o2.inputAmount.currency.isNative ? e2.reduce(function(t3, e3) { + return t3.add(e3.maximumAmountIn(r2.slippageTolerance)); + }, s2) : s2; + r2.inputTokenPermit && (o2.inputAmount.currency.isToken || i(false), c2.push(At.encodePermit(o2.inputAmount.currency, r2.inputTokenPermit))); + for (var v2, y2 = n.validateAndParseAddress(r2.recipient), k2 = $(r2.deadline), g2 = I(e2); !(v2 = g2()).done; ) for (var A2, T2 = v2.value, w2 = I(T2.swaps); !(A2 = w2()).done; ) { + var x2 = A2.value, q2 = x2.route, R2 = x2.outputAmount, E2 = $(T2.maximumAmountIn(r2.slippageTolerance, x2.inputAmount).quotient), P2 = $(T2.minimumAmountOut(r2.slippageTolerance, R2).quotient); + if (1 === q2.pools.length) if (T2.tradeType === n.TradeType.EXACT_INPUT) { + var C2, O2 = { tokenIn: q2.tokenPath[0].address, tokenOut: q2.tokenPath[1].address, fee: q2.pools[0].fee, recipient: h2 ? b : y2, deadline: k2, amountIn: E2, amountOutMinimum: P2, sqrtPriceLimitX96: $(null != (C2 = r2.sqrtPriceLimitX96) ? C2 : 0) }; + c2.push(t2.INTERFACE.encodeFunctionData("exactInputSingle", [O2])); + } else { + var S2, N2 = { tokenIn: q2.tokenPath[0].address, tokenOut: q2.tokenPath[1].address, fee: q2.pools[0].fee, recipient: h2 ? b : y2, deadline: k2, amountOut: P2, amountInMaximum: E2, sqrtPriceLimitX96: $(null != (S2 = r2.sqrtPriceLimitX96) ? S2 : 0) }; + c2.push(t2.INTERFACE.encodeFunctionData("exactOutputSingle", [N2])); + } + else { + void 0 !== r2.sqrtPriceLimitX96 && i(false); + var _2 = J(q2, T2.tradeType === n.TradeType.EXACT_OUTPUT); + c2.push(T2.tradeType === n.TradeType.EXACT_INPUT ? t2.INTERFACE.encodeFunctionData("exactInput", [{ path: _2, recipient: h2 ? b : y2, deadline: k2, amountIn: E2, amountOutMinimum: P2 }]) : t2.INTERFACE.encodeFunctionData("exactOutput", [{ path: _2, recipient: h2 ? b : y2, deadline: k2, amountOut: P2, amountInMaximum: E2 }])); + } + } + return h2 && c2.push(r2.fee ? f2 ? Tt.encodeUnwrapWETH9(l2.quotient, y2, r2.fee) : Tt.encodeSweepToken(o2.outputAmount.currency.wrapped, l2.quotient, y2, r2.fee) : Tt.encodeUnwrapWETH9(l2.quotient, y2)), d2 && c2.push(Tt.encodeRefundETH()), { calldata: gt.encodeMulticall(c2), value: $(m2.quotient) }; + }, t2; + }(); + Et.INTERFACE = new o.Interface(m.abi), exports2.ADDRESS_ZERO = b, exports2.FACTORY_ADDRESS = "0x1F98431c8aD98523631AE4a59f267346ea31F984", exports2.FullMath = X, exports2.LiquidityMath = F, exports2.Multicall = gt, exports2.NoTickDataProvider = V, exports2.NonfungiblePositionManager = qt, exports2.POOL_INIT_CODE_HASH = R, exports2.Payments = Tt, exports2.Pool = ht, exports2.Position = mt, exports2.PositionLibrary = ut, exports2.Route = vt, exports2.SelfPermit = At, exports2.SqrtPriceMath = B, exports2.Staker = Rt, exports2.SwapMath = D, exports2.SwapQuoter = bt, exports2.SwapRouter = Et, exports2.TICK_SPACINGS = E, exports2.Tick = lt, exports2.TickLibrary = pt, exports2.TickList = Z, exports2.TickListDataProvider = dt, exports2.TickMath = Q, exports2.Trade = kt, exports2.computePoolAddress = _, exports2.encodeRouteToPath = J, exports2.encodeSqrtRatioX96 = tt, exports2.isSorted = z, exports2.maxLiquidityForAmounts = it, exports2.mostSignificantBit = G, exports2.nearestUsableTick = function(t2, e2) { + Number.isInteger(t2) && Number.isInteger(e2) || i(false), e2 > 0 || i(false), t2 >= Q.MIN_TICK && t2 <= Q.MAX_TICK || i(false); + var n2 = Math.round(t2 / e2) * e2; + return n2 < Q.MIN_TICK ? n2 + e2 : n2 > Q.MAX_TICK ? n2 - e2 : n2; + }, exports2.priceToClosestTick = function(t2) { + var e2 = t2.baseCurrency.sortsBefore(t2.quoteCurrency), n2 = e2 ? tt(t2.numerator, t2.denominator) : tt(t2.denominator, t2.numerator), r2 = Q.getTickAtSqrtRatio(n2), i2 = at(t2.baseCurrency, t2.quoteCurrency, r2 + 1); + return e2 ? t2.lessThan(i2) || r2++ : t2.greaterThan(i2) || r2++, r2; + }, exports2.subIn256 = st, exports2.tickToPrice = at, exports2.toHex = $, exports2.tradeComparator = yt; + } +}); + +// node_modules/@uniswap/v3-sdk/dist/v3-sdk.cjs.development.js +var require_v3_sdk_cjs_development = __commonJS({ + "node_modules/@uniswap/v3-sdk/dist/v3-sdk.cjs.development.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + function _interopDefault(ex) { + return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex; + } + var sdkCore = require_dist(); + var JSBI3 = _interopDefault(require_jsbi_cjs()); + var invariant = _interopDefault(require_tiny_invariant_cjs()); + var abi = require_lib11(); + var address = require_lib7(); + var solidity = require_lib29(); + var IMulticall = _interopDefault(require_IMulticall()); + var INonfungiblePositionManager = _interopDefault(require_NonfungiblePositionManager()); + var ISelfPermit = _interopDefault(require_ISelfPermit()); + var IPeripheryPaymentsWithFee = _interopDefault(require_IPeripheryPaymentsWithFee()); + var IQuoter = _interopDefault(require_Quoter()); + var IQuoterV2 = _interopDefault(require_QuoterV2()); + var IUniswapV3Staker = _interopDefault(require_UniswapV3Staker()); + var ISwapRouter = _interopDefault(require_SwapRouter()); + function _regeneratorRuntime() { + _regeneratorRuntime = function() { + return e; + }; + var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function(t2, e2, r2) { + t2[e2] = r2.value; + }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; + function define2(t2, e2, r2) { + return Object.defineProperty(t2, e2, { + value: r2, + enumerable: true, + configurable: true, + writable: true + }), t2[e2]; + } + try { + define2({}, ""); + } catch (t2) { + define2 = function(t3, e2, r2) { + return t3[e2] = r2; + }; + } + function wrap(t2, e2, r2, n2) { + var i2 = e2 && e2.prototype instanceof Generator ? e2 : Generator, a2 = Object.create(i2.prototype), c2 = new Context(n2 || []); + return o(a2, "_invoke", { + value: makeInvokeMethod(t2, r2, c2) + }), a2; + } + function tryCatch(t2, e2, r2) { + try { + return { + type: "normal", + arg: t2.call(e2, r2) + }; + } catch (t3) { + return { + type: "throw", + arg: t3 + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; + function Generator() { + } + function GeneratorFunction() { + } + function GeneratorFunctionPrototype() { + } + var p = {}; + define2(p, a, function() { + return this; + }); + var d = Object.getPrototypeOf, v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t2) { + ["next", "throw", "return"].forEach(function(e2) { + define2(t2, e2, function(t3) { + return this._invoke(e2, t3); + }); + }); + } + function AsyncIterator(t2, e2) { + function invoke(r3, o2, i2, a2) { + var c2 = tryCatch(t2[r3], t2, o2); + if ("throw" !== c2.type) { + var u2 = c2.arg, h2 = u2.value; + return h2 && "object" == typeof h2 && n.call(h2, "__await") ? e2.resolve(h2.__await).then(function(t3) { + invoke("next", t3, i2, a2); + }, function(t3) { + invoke("throw", t3, i2, a2); + }) : e2.resolve(h2).then(function(t3) { + u2.value = t3, i2(u2); + }, function(t3) { + return invoke("throw", t3, i2, a2); + }); + } + a2(c2.arg); + } + var r2; + o(this, "_invoke", { + value: function(t3, n2) { + function callInvokeWithMethodAndArg() { + return new e2(function(e3, r3) { + invoke(t3, n2, e3, r3); + }); + } + return r2 = r2 ? r2.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e2, r2, n2) { + var o2 = h; + return function(i2, a2) { + if (o2 === f) throw new Error("Generator is already running"); + if (o2 === s) { + if ("throw" === i2) throw a2; + return { + value: t, + done: true + }; + } + for (n2.method = i2, n2.arg = a2; ; ) { + var c2 = n2.delegate; + if (c2) { + var u2 = maybeInvokeDelegate(c2, n2); + if (u2) { + if (u2 === y) continue; + return u2; + } + } + if ("next" === n2.method) n2.sent = n2._sent = n2.arg; + else if ("throw" === n2.method) { + if (o2 === h) throw o2 = s, n2.arg; + n2.dispatchException(n2.arg); + } else "return" === n2.method && n2.abrupt("return", n2.arg); + o2 = f; + var p2 = tryCatch(e2, r2, n2); + if ("normal" === p2.type) { + if (o2 = n2.done ? s : l, p2.arg === y) continue; + return { + value: p2.arg, + done: n2.done + }; + } + "throw" === p2.type && (o2 = s, n2.method = "throw", n2.arg = p2.arg); + } + }; + } + function maybeInvokeDelegate(e2, r2) { + var n2 = r2.method, o2 = e2.iterator[n2]; + if (o2 === t) return r2.delegate = null, "throw" === n2 && e2.iterator.return && (r2.method = "return", r2.arg = t, maybeInvokeDelegate(e2, r2), "throw" === r2.method) || "return" !== n2 && (r2.method = "throw", r2.arg = new TypeError("The iterator does not provide a '" + n2 + "' method")), y; + var i2 = tryCatch(o2, e2.iterator, r2.arg); + if ("throw" === i2.type) return r2.method = "throw", r2.arg = i2.arg, r2.delegate = null, y; + var a2 = i2.arg; + return a2 ? a2.done ? (r2[e2.resultName] = a2.value, r2.next = e2.nextLoc, "return" !== r2.method && (r2.method = "next", r2.arg = t), r2.delegate = null, y) : a2 : (r2.method = "throw", r2.arg = new TypeError("iterator result is not an object"), r2.delegate = null, y); + } + function pushTryEntry(t2) { + var e2 = { + tryLoc: t2[0] + }; + 1 in t2 && (e2.catchLoc = t2[1]), 2 in t2 && (e2.finallyLoc = t2[2], e2.afterLoc = t2[3]), this.tryEntries.push(e2); + } + function resetTryEntry(t2) { + var e2 = t2.completion || {}; + e2.type = "normal", delete e2.arg, t2.completion = e2; + } + function Context(t2) { + this.tryEntries = [{ + tryLoc: "root" + }], t2.forEach(pushTryEntry, this), this.reset(true); + } + function values(e2) { + if (e2 || "" === e2) { + var r2 = e2[a]; + if (r2) return r2.call(e2); + if ("function" == typeof e2.next) return e2; + if (!isNaN(e2.length)) { + var o2 = -1, i2 = function next() { + for (; ++o2 < e2.length; ) if (n.call(e2, o2)) return next.value = e2[o2], next.done = false, next; + return next.value = t, next.done = true, next; + }; + return i2.next = i2; + } + } + throw new TypeError(typeof e2 + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: true + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: true + }), GeneratorFunction.displayName = define2(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function(t2) { + var e2 = "function" == typeof t2 && t2.constructor; + return !!e2 && (e2 === GeneratorFunction || "GeneratorFunction" === (e2.displayName || e2.name)); + }, e.mark = function(t2) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t2, GeneratorFunctionPrototype) : (t2.__proto__ = GeneratorFunctionPrototype, define2(t2, u, "GeneratorFunction")), t2.prototype = Object.create(g), t2; + }, e.awrap = function(t2) { + return { + __await: t2 + }; + }, defineIteratorMethods(AsyncIterator.prototype), define2(AsyncIterator.prototype, c, function() { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function(t2, r2, n2, o2, i2) { + void 0 === i2 && (i2 = Promise); + var a2 = new AsyncIterator(wrap(t2, r2, n2, o2), i2); + return e.isGeneratorFunction(r2) ? a2 : a2.next().then(function(t3) { + return t3.done ? t3.value : a2.next(); + }); + }, defineIteratorMethods(g), define2(g, u, "Generator"), define2(g, a, function() { + return this; + }), define2(g, "toString", function() { + return "[object Generator]"; + }), e.keys = function(t2) { + var e2 = Object(t2), r2 = []; + for (var n2 in e2) r2.push(n2); + return r2.reverse(), function next() { + for (; r2.length; ) { + var t3 = r2.pop(); + if (t3 in e2) return next.value = t3, next.done = false, next; + } + return next.done = true, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function(e2) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e2) for (var r2 in this) "t" === r2.charAt(0) && n.call(this, r2) && !isNaN(+r2.slice(1)) && (this[r2] = t); + }, + stop: function() { + this.done = true; + var t2 = this.tryEntries[0].completion; + if ("throw" === t2.type) throw t2.arg; + return this.rval; + }, + dispatchException: function(e2) { + if (this.done) throw e2; + var r2 = this; + function handle(n2, o3) { + return a2.type = "throw", a2.arg = e2, r2.next = n2, o3 && (r2.method = "next", r2.arg = t), !!o3; + } + for (var o2 = this.tryEntries.length - 1; o2 >= 0; --o2) { + var i2 = this.tryEntries[o2], a2 = i2.completion; + if ("root" === i2.tryLoc) return handle("end"); + if (i2.tryLoc <= this.prev) { + var c2 = n.call(i2, "catchLoc"), u2 = n.call(i2, "finallyLoc"); + if (c2 && u2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } else if (c2) { + if (this.prev < i2.catchLoc) return handle(i2.catchLoc, true); + } else { + if (!u2) throw new Error("try statement without catch or finally"); + if (this.prev < i2.finallyLoc) return handle(i2.finallyLoc); + } + } + } + }, + abrupt: function(t2, e2) { + for (var r2 = this.tryEntries.length - 1; r2 >= 0; --r2) { + var o2 = this.tryEntries[r2]; + if (o2.tryLoc <= this.prev && n.call(o2, "finallyLoc") && this.prev < o2.finallyLoc) { + var i2 = o2; + break; + } + } + i2 && ("break" === t2 || "continue" === t2) && i2.tryLoc <= e2 && e2 <= i2.finallyLoc && (i2 = null); + var a2 = i2 ? i2.completion : {}; + return a2.type = t2, a2.arg = e2, i2 ? (this.method = "next", this.next = i2.finallyLoc, y) : this.complete(a2); + }, + complete: function(t2, e2) { + if ("throw" === t2.type) throw t2.arg; + return "break" === t2.type || "continue" === t2.type ? this.next = t2.arg : "return" === t2.type ? (this.rval = this.arg = t2.arg, this.method = "return", this.next = "end") : "normal" === t2.type && e2 && (this.next = e2), y; + }, + finish: function(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.finallyLoc === t2) return this.complete(r2.completion, r2.afterLoc), resetTryEntry(r2), y; + } + }, + catch: function(t2) { + for (var e2 = this.tryEntries.length - 1; e2 >= 0; --e2) { + var r2 = this.tryEntries[e2]; + if (r2.tryLoc === t2) { + var n2 = r2.completion; + if ("throw" === n2.type) { + var o2 = n2.arg; + resetTryEntry(r2); + } + return o2; + } + } + throw new Error("illegal catch attempt"); + }, + delegateYield: function(e2, r2, n2) { + return this.delegate = { + iterator: values(e2), + resultName: r2, + nextLoc: n2 + }, "next" === this.method && (this.arg = t), y; + } + }, e; + } + function _toPrimitive(t, r) { + if ("object" != typeof t || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != typeof i) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); + } + function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == typeof i ? i : String(i); + } + 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 self2 = this, args = arguments; + return new Promise(function(resolve, reject) { + var gen = fn.apply(self2, args); + function _next(value) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); + } + function _throw(err) { + asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); + } + _next(void 0); + }); + }; + } + 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, _toPropertyKey(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 _extends() { + _extends = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); + } + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; + } + 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 _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 _createForOfIteratorHelperLoose(o, allowArrayLike) { + var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; + if (it) return (it = it.call(o)).next.bind(it); + if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { + if (it) o = it; + var i = 0; + return function() { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + } + 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 _TICK_SPACINGS; + var FACTORY_ADDRESS = "0x1F98431c8aD98523631AE4a59f267346ea31F984"; + var ADDRESS_ZERO = "0x0000000000000000000000000000000000000000"; + var POOL_INIT_CODE_HASH = "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54"; + (function(FeeAmount) { + FeeAmount[FeeAmount["LOWEST"] = 100] = "LOWEST"; + FeeAmount[FeeAmount["LOW"] = 500] = "LOW"; + FeeAmount[FeeAmount["MEDIUM"] = 3e3] = "MEDIUM"; + FeeAmount[FeeAmount["HIGH"] = 1e4] = "HIGH"; + })(exports2.FeeAmount || (exports2.FeeAmount = {})); + var TICK_SPACINGS = (_TICK_SPACINGS = {}, _TICK_SPACINGS[exports2.FeeAmount.LOWEST] = 1, _TICK_SPACINGS[exports2.FeeAmount.LOW] = 10, _TICK_SPACINGS[exports2.FeeAmount.MEDIUM] = 60, _TICK_SPACINGS[exports2.FeeAmount.HIGH] = 200, _TICK_SPACINGS); + var NEGATIVE_ONE = /* @__PURE__ */ JSBI3.BigInt(-1); + var ZERO = /* @__PURE__ */ JSBI3.BigInt(0); + var ONE = /* @__PURE__ */ JSBI3.BigInt(1); + var Q96 = /* @__PURE__ */ JSBI3.exponentiate(/* @__PURE__ */ JSBI3.BigInt(2), /* @__PURE__ */ JSBI3.BigInt(96)); + var Q192 = /* @__PURE__ */ JSBI3.exponentiate(Q96, /* @__PURE__ */ JSBI3.BigInt(2)); + function computePoolAddress(_ref) { + var factoryAddress = _ref.factoryAddress, tokenA = _ref.tokenA, tokenB = _ref.tokenB, fee = _ref.fee, initCodeHashManualOverride = _ref.initCodeHashManualOverride; + var _ref2 = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA], token0 = _ref2[0], token1 = _ref2[1]; + return address.getCreate2Address(factoryAddress, solidity.keccak256(["bytes"], [abi.defaultAbiCoder.encode(["address", "address", "uint24"], [token0.address, token1.address, fee])]), initCodeHashManualOverride != null ? initCodeHashManualOverride : POOL_INIT_CODE_HASH); + } + var LiquidityMath = /* @__PURE__ */ function() { + function LiquidityMath2() { + } + LiquidityMath2.addDelta = function addDelta(x, y) { + if (JSBI3.lessThan(y, ZERO)) { + return JSBI3.subtract(x, JSBI3.multiply(y, NEGATIVE_ONE)); + } else { + return JSBI3.add(x, y); + } + }; + return LiquidityMath2; + }(); + var FullMath = /* @__PURE__ */ function() { + function FullMath2() { + } + FullMath2.mulDivRoundingUp = function mulDivRoundingUp(a, b, denominator) { + var product = JSBI3.multiply(a, b); + var result2 = JSBI3.divide(product, denominator); + if (JSBI3.notEqual(JSBI3.remainder(product, denominator), ZERO)) result2 = JSBI3.add(result2, ONE); + return result2; + }; + return FullMath2; + }(); + var MaxUint160 = /* @__PURE__ */ JSBI3.subtract(/* @__PURE__ */ JSBI3.exponentiate(/* @__PURE__ */ JSBI3.BigInt(2), /* @__PURE__ */ JSBI3.BigInt(160)), ONE); + function multiplyIn256(x, y) { + var product = JSBI3.multiply(x, y); + return JSBI3.bitwiseAnd(product, sdkCore.MaxUint256); + } + function addIn256(x, y) { + var sum = JSBI3.add(x, y); + return JSBI3.bitwiseAnd(sum, sdkCore.MaxUint256); + } + var SqrtPriceMath2 = /* @__PURE__ */ function() { + function SqrtPriceMath3() { + } + SqrtPriceMath3.getAmount0Delta = function getAmount0Delta2(sqrtRatioAX96, sqrtRatioBX96, liquidity2, roundUp) { + if (JSBI3.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) { + var _ref = [sqrtRatioBX96, sqrtRatioAX96]; + sqrtRatioAX96 = _ref[0]; + sqrtRatioBX96 = _ref[1]; + } + var numerator1 = JSBI3.leftShift(liquidity2, JSBI3.BigInt(96)); + var numerator2 = JSBI3.subtract(sqrtRatioBX96, sqrtRatioAX96); + return roundUp ? FullMath.mulDivRoundingUp(FullMath.mulDivRoundingUp(numerator1, numerator2, sqrtRatioBX96), ONE, sqrtRatioAX96) : JSBI3.divide(JSBI3.divide(JSBI3.multiply(numerator1, numerator2), sqrtRatioBX96), sqrtRatioAX96); + }; + SqrtPriceMath3.getAmount1Delta = function getAmount1Delta2(sqrtRatioAX96, sqrtRatioBX96, liquidity2, roundUp) { + if (JSBI3.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) { + var _ref2 = [sqrtRatioBX96, sqrtRatioAX96]; + sqrtRatioAX96 = _ref2[0]; + sqrtRatioBX96 = _ref2[1]; + } + return roundUp ? FullMath.mulDivRoundingUp(liquidity2, JSBI3.subtract(sqrtRatioBX96, sqrtRatioAX96), Q96) : JSBI3.divide(JSBI3.multiply(liquidity2, JSBI3.subtract(sqrtRatioBX96, sqrtRatioAX96)), Q96); + }; + SqrtPriceMath3.getNextSqrtPriceFromInput = function getNextSqrtPriceFromInput(sqrtPX96, liquidity2, amountIn, zeroForOne) { + !JSBI3.greaterThan(sqrtPX96, ZERO) ? invariant(false) : void 0; + !JSBI3.greaterThan(liquidity2, ZERO) ? invariant(false) : void 0; + return zeroForOne ? this.getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity2, amountIn, true) : this.getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity2, amountIn, true); + }; + SqrtPriceMath3.getNextSqrtPriceFromOutput = function getNextSqrtPriceFromOutput(sqrtPX96, liquidity2, amountOut, zeroForOne) { + !JSBI3.greaterThan(sqrtPX96, ZERO) ? invariant(false) : void 0; + !JSBI3.greaterThan(liquidity2, ZERO) ? invariant(false) : void 0; + return zeroForOne ? this.getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity2, amountOut, false) : this.getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity2, amountOut, false); + }; + SqrtPriceMath3.getNextSqrtPriceFromAmount0RoundingUp = function getNextSqrtPriceFromAmount0RoundingUp(sqrtPX96, liquidity2, amount, add) { + if (JSBI3.equal(amount, ZERO)) return sqrtPX96; + var numerator1 = JSBI3.leftShift(liquidity2, JSBI3.BigInt(96)); + if (add) { + var product = multiplyIn256(amount, sqrtPX96); + if (JSBI3.equal(JSBI3.divide(product, amount), sqrtPX96)) { + var denominator = addIn256(numerator1, product); + if (JSBI3.greaterThanOrEqual(denominator, numerator1)) { + return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, denominator); + } + } + return FullMath.mulDivRoundingUp(numerator1, ONE, JSBI3.add(JSBI3.divide(numerator1, sqrtPX96), amount)); + } else { + var _product = multiplyIn256(amount, sqrtPX96); + !JSBI3.equal(JSBI3.divide(_product, amount), sqrtPX96) ? invariant(false) : void 0; + !JSBI3.greaterThan(numerator1, _product) ? invariant(false) : void 0; + var _denominator = JSBI3.subtract(numerator1, _product); + return FullMath.mulDivRoundingUp(numerator1, sqrtPX96, _denominator); + } + }; + SqrtPriceMath3.getNextSqrtPriceFromAmount1RoundingDown = function getNextSqrtPriceFromAmount1RoundingDown(sqrtPX96, liquidity2, amount, add) { + if (add) { + var quotient = JSBI3.lessThanOrEqual(amount, MaxUint160) ? JSBI3.divide(JSBI3.leftShift(amount, JSBI3.BigInt(96)), liquidity2) : JSBI3.divide(JSBI3.multiply(amount, Q96), liquidity2); + return JSBI3.add(sqrtPX96, quotient); + } else { + var _quotient = FullMath.mulDivRoundingUp(amount, Q96, liquidity2); + !JSBI3.greaterThan(sqrtPX96, _quotient) ? invariant(false) : void 0; + return JSBI3.subtract(sqrtPX96, _quotient); + } + }; + return SqrtPriceMath3; + }(); + var MAX_FEE = /* @__PURE__ */ JSBI3.exponentiate(/* @__PURE__ */ JSBI3.BigInt(10), /* @__PURE__ */ JSBI3.BigInt(6)); + var SwapMath = /* @__PURE__ */ function() { + function SwapMath2() { + } + SwapMath2.computeSwapStep = function computeSwapStep(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity2, amountRemaining, feePips) { + var returnValues = {}; + var zeroForOne = JSBI3.greaterThanOrEqual(sqrtRatioCurrentX96, sqrtRatioTargetX96); + var exactIn = JSBI3.greaterThanOrEqual(amountRemaining, ZERO); + if (exactIn) { + var amountRemainingLessFee = JSBI3.divide(JSBI3.multiply(amountRemaining, JSBI3.subtract(MAX_FEE, JSBI3.BigInt(feePips))), MAX_FEE); + returnValues.amountIn = zeroForOne ? SqrtPriceMath2.getAmount0Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity2, true) : SqrtPriceMath2.getAmount1Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity2, true); + if (JSBI3.greaterThanOrEqual(amountRemainingLessFee, returnValues.amountIn)) { + returnValues.sqrtRatioNextX96 = sqrtRatioTargetX96; + } else { + returnValues.sqrtRatioNextX96 = SqrtPriceMath2.getNextSqrtPriceFromInput(sqrtRatioCurrentX96, liquidity2, amountRemainingLessFee, zeroForOne); + } + } else { + returnValues.amountOut = zeroForOne ? SqrtPriceMath2.getAmount1Delta(sqrtRatioTargetX96, sqrtRatioCurrentX96, liquidity2, false) : SqrtPriceMath2.getAmount0Delta(sqrtRatioCurrentX96, sqrtRatioTargetX96, liquidity2, false); + if (JSBI3.greaterThanOrEqual(JSBI3.multiply(amountRemaining, NEGATIVE_ONE), returnValues.amountOut)) { + returnValues.sqrtRatioNextX96 = sqrtRatioTargetX96; + } else { + returnValues.sqrtRatioNextX96 = SqrtPriceMath2.getNextSqrtPriceFromOutput(sqrtRatioCurrentX96, liquidity2, JSBI3.multiply(amountRemaining, NEGATIVE_ONE), zeroForOne); + } + } + var max = JSBI3.equal(sqrtRatioTargetX96, returnValues.sqrtRatioNextX96); + if (zeroForOne) { + returnValues.amountIn = max && exactIn ? returnValues.amountIn : SqrtPriceMath2.getAmount0Delta(returnValues.sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity2, true); + returnValues.amountOut = max && !exactIn ? returnValues.amountOut : SqrtPriceMath2.getAmount1Delta(returnValues.sqrtRatioNextX96, sqrtRatioCurrentX96, liquidity2, false); + } else { + returnValues.amountIn = max && exactIn ? returnValues.amountIn : SqrtPriceMath2.getAmount1Delta(sqrtRatioCurrentX96, returnValues.sqrtRatioNextX96, liquidity2, true); + returnValues.amountOut = max && !exactIn ? returnValues.amountOut : SqrtPriceMath2.getAmount0Delta(sqrtRatioCurrentX96, returnValues.sqrtRatioNextX96, liquidity2, false); + } + if (!exactIn && JSBI3.greaterThan(returnValues.amountOut, JSBI3.multiply(amountRemaining, NEGATIVE_ONE))) { + returnValues.amountOut = JSBI3.multiply(amountRemaining, NEGATIVE_ONE); + } + if (exactIn && JSBI3.notEqual(returnValues.sqrtRatioNextX96, sqrtRatioTargetX96)) { + returnValues.feeAmount = JSBI3.subtract(amountRemaining, returnValues.amountIn); + } else { + returnValues.feeAmount = FullMath.mulDivRoundingUp(returnValues.amountIn, JSBI3.BigInt(feePips), JSBI3.subtract(MAX_FEE, JSBI3.BigInt(feePips))); + } + return [returnValues.sqrtRatioNextX96, returnValues.amountIn, returnValues.amountOut, returnValues.feeAmount]; + }; + return SwapMath2; + }(); + var TWO = /* @__PURE__ */ JSBI3.BigInt(2); + var POWERS_OF_2 = /* @__PURE__ */ [128, 64, 32, 16, 8, 4, 2, 1].map(function(pow) { + return [pow, JSBI3.exponentiate(TWO, JSBI3.BigInt(pow))]; + }); + function mostSignificantBit(x) { + !JSBI3.greaterThan(x, ZERO) ? invariant(false, "ZERO") : void 0; + !JSBI3.lessThanOrEqual(x, sdkCore.MaxUint256) ? invariant(false, "MAX") : void 0; + var msb = 0; + for (var _iterator = _createForOfIteratorHelperLoose(POWERS_OF_2), _step; !(_step = _iterator()).done; ) { + var _step$value = _step.value, power = _step$value[0], min = _step$value[1]; + if (JSBI3.greaterThanOrEqual(x, min)) { + x = JSBI3.signedRightShift(x, JSBI3.BigInt(power)); + msb += power; + } + } + return msb; + } + function mulShift(val, mulBy) { + return JSBI3.signedRightShift(JSBI3.multiply(val, JSBI3.BigInt(mulBy)), JSBI3.BigInt(128)); + } + var Q32 = /* @__PURE__ */ JSBI3.exponentiate(/* @__PURE__ */ JSBI3.BigInt(2), /* @__PURE__ */ JSBI3.BigInt(32)); + var TickMath = /* @__PURE__ */ function() { + function TickMath2() { + } + TickMath2.getSqrtRatioAtTick = function getSqrtRatioAtTick(tick) { + !(tick >= TickMath2.MIN_TICK && tick <= TickMath2.MAX_TICK && Number.isInteger(tick)) ? invariant(false, "TICK") : void 0; + var absTick = tick < 0 ? tick * -1 : tick; + var ratio = (absTick & 1) !== 0 ? JSBI3.BigInt("0xfffcb933bd6fad37aa2d162d1a594001") : JSBI3.BigInt("0x100000000000000000000000000000000"); + if ((absTick & 2) !== 0) ratio = mulShift(ratio, "0xfff97272373d413259a46990580e213a"); + if ((absTick & 4) !== 0) ratio = mulShift(ratio, "0xfff2e50f5f656932ef12357cf3c7fdcc"); + if ((absTick & 8) !== 0) ratio = mulShift(ratio, "0xffe5caca7e10e4e61c3624eaa0941cd0"); + if ((absTick & 16) !== 0) ratio = mulShift(ratio, "0xffcb9843d60f6159c9db58835c926644"); + if ((absTick & 32) !== 0) ratio = mulShift(ratio, "0xff973b41fa98c081472e6896dfb254c0"); + if ((absTick & 64) !== 0) ratio = mulShift(ratio, "0xff2ea16466c96a3843ec78b326b52861"); + if ((absTick & 128) !== 0) ratio = mulShift(ratio, "0xfe5dee046a99a2a811c461f1969c3053"); + if ((absTick & 256) !== 0) ratio = mulShift(ratio, "0xfcbe86c7900a88aedcffc83b479aa3a4"); + if ((absTick & 512) !== 0) ratio = mulShift(ratio, "0xf987a7253ac413176f2b074cf7815e54"); + if ((absTick & 1024) !== 0) ratio = mulShift(ratio, "0xf3392b0822b70005940c7a398e4b70f3"); + if ((absTick & 2048) !== 0) ratio = mulShift(ratio, "0xe7159475a2c29b7443b29c7fa6e889d9"); + if ((absTick & 4096) !== 0) ratio = mulShift(ratio, "0xd097f3bdfd2022b8845ad8f792aa5825"); + if ((absTick & 8192) !== 0) ratio = mulShift(ratio, "0xa9f746462d870fdf8a65dc1f90e061e5"); + if ((absTick & 16384) !== 0) ratio = mulShift(ratio, "0x70d869a156d2a1b890bb3df62baf32f7"); + if ((absTick & 32768) !== 0) ratio = mulShift(ratio, "0x31be135f97d08fd981231505542fcfa6"); + if ((absTick & 65536) !== 0) ratio = mulShift(ratio, "0x9aa508b5b7a84e1c677de54f3e99bc9"); + if ((absTick & 131072) !== 0) ratio = mulShift(ratio, "0x5d6af8dedb81196699c329225ee604"); + if ((absTick & 262144) !== 0) ratio = mulShift(ratio, "0x2216e584f5fa1ea926041bedfe98"); + if ((absTick & 524288) !== 0) ratio = mulShift(ratio, "0x48a170391f7dc42444e8fa2"); + if (tick > 0) ratio = JSBI3.divide(sdkCore.MaxUint256, ratio); + return JSBI3.greaterThan(JSBI3.remainder(ratio, Q32), ZERO) ? JSBI3.add(JSBI3.divide(ratio, Q32), ONE) : JSBI3.divide(ratio, Q32); + }; + TickMath2.getTickAtSqrtRatio = function getTickAtSqrtRatio(sqrtRatioX96) { + !(JSBI3.greaterThanOrEqual(sqrtRatioX96, TickMath2.MIN_SQRT_RATIO) && JSBI3.lessThan(sqrtRatioX96, TickMath2.MAX_SQRT_RATIO)) ? invariant(false, "SQRT_RATIO") : void 0; + var sqrtRatioX128 = JSBI3.leftShift(sqrtRatioX96, JSBI3.BigInt(32)); + var msb = mostSignificantBit(sqrtRatioX128); + var r; + if (JSBI3.greaterThanOrEqual(JSBI3.BigInt(msb), JSBI3.BigInt(128))) { + r = JSBI3.signedRightShift(sqrtRatioX128, JSBI3.BigInt(msb - 127)); + } else { + r = JSBI3.leftShift(sqrtRatioX128, JSBI3.BigInt(127 - msb)); + } + var log_2 = JSBI3.leftShift(JSBI3.subtract(JSBI3.BigInt(msb), JSBI3.BigInt(128)), JSBI3.BigInt(64)); + for (var i = 0; i < 14; i++) { + r = JSBI3.signedRightShift(JSBI3.multiply(r, r), JSBI3.BigInt(127)); + var f = JSBI3.signedRightShift(r, JSBI3.BigInt(128)); + log_2 = JSBI3.bitwiseOr(log_2, JSBI3.leftShift(f, JSBI3.BigInt(63 - i))); + r = JSBI3.signedRightShift(r, f); + } + var log_sqrt10001 = JSBI3.multiply(log_2, JSBI3.BigInt("255738958999603826347141")); + var tickLow = JSBI3.toNumber(JSBI3.signedRightShift(JSBI3.subtract(log_sqrt10001, JSBI3.BigInt("3402992956809132418596140100660247210")), JSBI3.BigInt(128))); + var tickHigh = JSBI3.toNumber(JSBI3.signedRightShift(JSBI3.add(log_sqrt10001, JSBI3.BigInt("291339464771989622907027621153398088495")), JSBI3.BigInt(128))); + return tickLow === tickHigh ? tickLow : JSBI3.lessThanOrEqual(TickMath2.getSqrtRatioAtTick(tickHigh), sqrtRatioX96) ? tickHigh : tickLow; + }; + return TickMath2; + }(); + TickMath.MIN_TICK = -887272; + TickMath.MAX_TICK = -TickMath.MIN_TICK; + TickMath.MIN_SQRT_RATIO = /* @__PURE__ */ JSBI3.BigInt("4295128739"); + TickMath.MAX_SQRT_RATIO = /* @__PURE__ */ JSBI3.BigInt("1461446703485210103287273052203988822378723970342"); + var NoTickDataProvider = /* @__PURE__ */ function() { + function NoTickDataProvider2() { + } + var _proto = NoTickDataProvider2.prototype; + _proto.getTick = /* @__PURE__ */ function() { + var _getTick = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(_tick) { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + throw new Error(NoTickDataProvider2.ERROR_MESSAGE); + case 1: + case "end": + return _context.stop(); + } + }, _callee); + })); + function getTick(_x) { + return _getTick.apply(this, arguments); + } + return getTick; + }(); + _proto.nextInitializedTickWithinOneWord = /* @__PURE__ */ function() { + var _nextInitializedTickWithinOneWord = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(_tick, _lte, _tickSpacing) { + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + throw new Error(NoTickDataProvider2.ERROR_MESSAGE); + case 1: + case "end": + return _context2.stop(); + } + }, _callee2); + })); + function nextInitializedTickWithinOneWord(_x2, _x3, _x4) { + return _nextInitializedTickWithinOneWord.apply(this, arguments); + } + return nextInitializedTickWithinOneWord; + }(); + return NoTickDataProvider2; + }(); + NoTickDataProvider.ERROR_MESSAGE = "No tick data provider was given"; + function isSorted(list, comparator) { + for (var i = 0; i < list.length - 1; i++) { + if (comparator(list[i], list[i + 1]) > 0) { + return false; + } + } + return true; + } + function tickComparator(a, b) { + return a.index - b.index; + } + var TickList = /* @__PURE__ */ function() { + function TickList2() { + } + TickList2.validateList = function validateList(ticks, tickSpacing) { + !(tickSpacing > 0) ? invariant(false, "TICK_SPACING_NONZERO") : void 0; + !ticks.every(function(_ref) { + var index = _ref.index; + return index % tickSpacing === 0; + }) ? invariant(false, "TICK_SPACING") : void 0; + !JSBI3.equal(ticks.reduce(function(accumulator, _ref2) { + var liquidityNet = _ref2.liquidityNet; + return JSBI3.add(accumulator, liquidityNet); + }, ZERO), ZERO) ? invariant(false, "ZERO_NET") : void 0; + !isSorted(ticks, tickComparator) ? invariant(false, "SORTED") : void 0; + }; + TickList2.isBelowSmallest = function isBelowSmallest(ticks, tick) { + !(ticks.length > 0) ? invariant(false, "LENGTH") : void 0; + return tick < ticks[0].index; + }; + TickList2.isAtOrAboveLargest = function isAtOrAboveLargest(ticks, tick) { + !(ticks.length > 0) ? invariant(false, "LENGTH") : void 0; + return tick >= ticks[ticks.length - 1].index; + }; + TickList2.getTick = function getTick(ticks, index) { + var tick = ticks[this.binarySearch(ticks, index)]; + !(tick.index === index) ? invariant(false, "NOT_CONTAINED") : void 0; + return tick; + }; + TickList2.binarySearch = function binarySearch(ticks, tick) { + !!this.isBelowSmallest(ticks, tick) ? invariant(false, "BELOW_SMALLEST") : void 0; + var l = 0; + var r = ticks.length - 1; + var i; + while (true) { + i = Math.floor((l + r) / 2); + if (ticks[i].index <= tick && (i === ticks.length - 1 || ticks[i + 1].index > tick)) { + return i; + } + if (ticks[i].index < tick) { + l = i + 1; + } else { + r = i - 1; + } + } + }; + TickList2.nextInitializedTick = function nextInitializedTick(ticks, tick, lte) { + if (lte) { + !!TickList2.isBelowSmallest(ticks, tick) ? invariant(false, "BELOW_SMALLEST") : void 0; + if (TickList2.isAtOrAboveLargest(ticks, tick)) { + return ticks[ticks.length - 1]; + } + var index = this.binarySearch(ticks, tick); + return ticks[index]; + } else { + !!this.isAtOrAboveLargest(ticks, tick) ? invariant(false, "AT_OR_ABOVE_LARGEST") : void 0; + if (this.isBelowSmallest(ticks, tick)) { + return ticks[0]; + } + var _index = this.binarySearch(ticks, tick); + return ticks[_index + 1]; + } + }; + TickList2.nextInitializedTickWithinOneWord = function nextInitializedTickWithinOneWord(ticks, tick, lte, tickSpacing) { + var compressed = Math.floor(tick / tickSpacing); + if (lte) { + var wordPos = compressed >> 8; + var minimum = (wordPos << 8) * tickSpacing; + if (TickList2.isBelowSmallest(ticks, tick)) { + return [minimum, false]; + } + var index = TickList2.nextInitializedTick(ticks, tick, lte).index; + var nextInitializedTick = Math.max(minimum, index); + return [nextInitializedTick, nextInitializedTick === index]; + } else { + var _wordPos = compressed + 1 >> 8; + var maximum = ((_wordPos + 1 << 8) - 1) * tickSpacing; + if (this.isAtOrAboveLargest(ticks, tick)) { + return [maximum, false]; + } + var _index2 = this.nextInitializedTick(ticks, tick, lte).index; + var _nextInitializedTick = Math.min(maximum, _index2); + return [_nextInitializedTick, _nextInitializedTick === _index2]; + } + }; + return TickList2; + }(); + function toHex(bigintIsh) { + var bigInt = JSBI3.BigInt(bigintIsh); + var hex = bigInt.toString(16); + if (hex.length % 2 !== 0) { + hex = "0" + hex; + } + return "0x" + hex; + } + function encodeRouteToPath(route, exactOutput) { + var firstInputToken = route.input.wrapped; + var _route$pools$reduce = route.pools.reduce(function(_ref, pool, index) { + var inputToken = _ref.inputToken, path2 = _ref.path, types2 = _ref.types; + var outputToken = pool.token0.equals(inputToken) ? pool.token1 : pool.token0; + if (index === 0) { + return { + inputToken: outputToken, + types: ["address", "uint24", "address"], + path: [inputToken.address, pool.fee, outputToken.address] + }; + } else { + return { + inputToken: outputToken, + types: [].concat(types2, ["uint24", "address"]), + path: [].concat(path2, [pool.fee, outputToken.address]) + }; + } + }, { + inputToken: firstInputToken, + path: [], + types: [] + }), path = _route$pools$reduce.path, types = _route$pools$reduce.types; + return exactOutput ? solidity.pack(types.reverse(), path.reverse()) : solidity.pack(types, path); + } + function encodeSqrtRatioX96(amount1, amount0) { + var numerator = JSBI3.leftShift(JSBI3.BigInt(amount1), JSBI3.BigInt(192)); + var denominator = JSBI3.BigInt(amount0); + var ratioX192 = JSBI3.divide(numerator, denominator); + return sdkCore.sqrt(ratioX192); + } + function maxLiquidityForAmount0Imprecise(sqrtRatioAX96, sqrtRatioBX96, amount0) { + if (JSBI3.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) { + var _ref = [sqrtRatioBX96, sqrtRatioAX96]; + sqrtRatioAX96 = _ref[0]; + sqrtRatioBX96 = _ref[1]; + } + var intermediate = JSBI3.divide(JSBI3.multiply(sqrtRatioAX96, sqrtRatioBX96), Q96); + return JSBI3.divide(JSBI3.multiply(JSBI3.BigInt(amount0), intermediate), JSBI3.subtract(sqrtRatioBX96, sqrtRatioAX96)); + } + function maxLiquidityForAmount0Precise(sqrtRatioAX96, sqrtRatioBX96, amount0) { + if (JSBI3.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) { + var _ref2 = [sqrtRatioBX96, sqrtRatioAX96]; + sqrtRatioAX96 = _ref2[0]; + sqrtRatioBX96 = _ref2[1]; + } + var numerator = JSBI3.multiply(JSBI3.multiply(JSBI3.BigInt(amount0), sqrtRatioAX96), sqrtRatioBX96); + var denominator = JSBI3.multiply(Q96, JSBI3.subtract(sqrtRatioBX96, sqrtRatioAX96)); + return JSBI3.divide(numerator, denominator); + } + function maxLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1) { + if (JSBI3.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) { + var _ref3 = [sqrtRatioBX96, sqrtRatioAX96]; + sqrtRatioAX96 = _ref3[0]; + sqrtRatioBX96 = _ref3[1]; + } + return JSBI3.divide(JSBI3.multiply(JSBI3.BigInt(amount1), Q96), JSBI3.subtract(sqrtRatioBX96, sqrtRatioAX96)); + } + function maxLiquidityForAmounts(sqrtRatioCurrentX96, sqrtRatioAX96, sqrtRatioBX96, amount0, amount1, useFullPrecision) { + if (JSBI3.greaterThan(sqrtRatioAX96, sqrtRatioBX96)) { + var _ref4 = [sqrtRatioBX96, sqrtRatioAX96]; + sqrtRatioAX96 = _ref4[0]; + sqrtRatioBX96 = _ref4[1]; + } + var maxLiquidityForAmount0 = useFullPrecision ? maxLiquidityForAmount0Precise : maxLiquidityForAmount0Imprecise; + if (JSBI3.lessThanOrEqual(sqrtRatioCurrentX96, sqrtRatioAX96)) { + return maxLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0); + } else if (JSBI3.lessThan(sqrtRatioCurrentX96, sqrtRatioBX96)) { + var liquidity0 = maxLiquidityForAmount0(sqrtRatioCurrentX96, sqrtRatioBX96, amount0); + var liquidity1 = maxLiquidityForAmount1(sqrtRatioAX96, sqrtRatioCurrentX96, amount1); + return JSBI3.lessThan(liquidity0, liquidity1) ? liquidity0 : liquidity1; + } else { + return maxLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1); + } + } + function nearestUsableTick(tick, tickSpacing) { + !(Number.isInteger(tick) && Number.isInteger(tickSpacing)) ? invariant(false, "INTEGERS") : void 0; + !(tickSpacing > 0) ? invariant(false, "TICK_SPACING") : void 0; + !(tick >= TickMath.MIN_TICK && tick <= TickMath.MAX_TICK) ? invariant(false, "TICK_BOUND") : void 0; + var rounded = Math.round(tick / tickSpacing) * tickSpacing; + if (rounded < TickMath.MIN_TICK) return rounded + tickSpacing; + else if (rounded > TickMath.MAX_TICK) return rounded - tickSpacing; + else return rounded; + } + var Q128 = /* @__PURE__ */ JSBI3.exponentiate(/* @__PURE__ */ JSBI3.BigInt(2), /* @__PURE__ */ JSBI3.BigInt(128)); + var PositionLibrary = /* @__PURE__ */ function() { + function PositionLibrary2() { + } + PositionLibrary2.getTokensOwed = function getTokensOwed(feeGrowthInside0LastX128, feeGrowthInside1LastX128, liquidity2, feeGrowthInside0X128, feeGrowthInside1X128) { + var tokensOwed0 = JSBI3.divide(JSBI3.multiply(subIn256(feeGrowthInside0X128, feeGrowthInside0LastX128), liquidity2), Q128); + var tokensOwed1 = JSBI3.divide(JSBI3.multiply(subIn256(feeGrowthInside1X128, feeGrowthInside1LastX128), liquidity2), Q128); + return [tokensOwed0, tokensOwed1]; + }; + return PositionLibrary2; + }(); + function tickToPrice(baseToken, quoteToken, tick) { + var sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick); + var ratioX192 = JSBI3.multiply(sqrtRatioX96, sqrtRatioX96); + return baseToken.sortsBefore(quoteToken) ? new sdkCore.Price(baseToken, quoteToken, Q192, ratioX192) : new sdkCore.Price(baseToken, quoteToken, ratioX192, Q192); + } + function priceToClosestTick(price) { + var sorted = price.baseCurrency.sortsBefore(price.quoteCurrency); + var sqrtRatioX96 = sorted ? encodeSqrtRatioX96(price.numerator, price.denominator) : encodeSqrtRatioX96(price.denominator, price.numerator); + var tick = TickMath.getTickAtSqrtRatio(sqrtRatioX96); + var nextTickPrice = tickToPrice(price.baseCurrency, price.quoteCurrency, tick + 1); + if (sorted) { + if (!price.lessThan(nextTickPrice)) { + tick++; + } + } else { + if (!price.greaterThan(nextTickPrice)) { + tick++; + } + } + return tick; + } + var Q256 = /* @__PURE__ */ JSBI3.exponentiate(/* @__PURE__ */ JSBI3.BigInt(2), /* @__PURE__ */ JSBI3.BigInt(256)); + function subIn256(x, y) { + var difference = JSBI3.subtract(x, y); + if (JSBI3.lessThan(difference, ZERO)) { + return JSBI3.add(Q256, difference); + } else { + return difference; + } + } + var TickLibrary = /* @__PURE__ */ function() { + function TickLibrary2() { + } + TickLibrary2.getFeeGrowthInside = function getFeeGrowthInside(feeGrowthOutsideLower, feeGrowthOutsideUpper, tickLower2, tickUpper2, tickCurrent, feeGrowthGlobal0X128, feeGrowthGlobal1X128) { + var feeGrowthBelow0X128; + var feeGrowthBelow1X128; + if (tickCurrent >= tickLower2) { + feeGrowthBelow0X128 = feeGrowthOutsideLower.feeGrowthOutside0X128; + feeGrowthBelow1X128 = feeGrowthOutsideLower.feeGrowthOutside1X128; + } else { + feeGrowthBelow0X128 = subIn256(feeGrowthGlobal0X128, feeGrowthOutsideLower.feeGrowthOutside0X128); + feeGrowthBelow1X128 = subIn256(feeGrowthGlobal1X128, feeGrowthOutsideLower.feeGrowthOutside1X128); + } + var feeGrowthAbove0X128; + var feeGrowthAbove1X128; + if (tickCurrent < tickUpper2) { + feeGrowthAbove0X128 = feeGrowthOutsideUpper.feeGrowthOutside0X128; + feeGrowthAbove1X128 = feeGrowthOutsideUpper.feeGrowthOutside1X128; + } else { + feeGrowthAbove0X128 = subIn256(feeGrowthGlobal0X128, feeGrowthOutsideUpper.feeGrowthOutside0X128); + feeGrowthAbove1X128 = subIn256(feeGrowthGlobal1X128, feeGrowthOutsideUpper.feeGrowthOutside1X128); + } + return [subIn256(subIn256(feeGrowthGlobal0X128, feeGrowthBelow0X128), feeGrowthAbove0X128), subIn256(subIn256(feeGrowthGlobal1X128, feeGrowthBelow1X128), feeGrowthAbove1X128)]; + }; + return TickLibrary2; + }(); + var Tick = function Tick2(_ref) { + var index = _ref.index, liquidityGross = _ref.liquidityGross, liquidityNet = _ref.liquidityNet; + !(index >= TickMath.MIN_TICK && index <= TickMath.MAX_TICK) ? invariant(false, "TICK") : void 0; + this.index = index; + this.liquidityGross = JSBI3.BigInt(liquidityGross); + this.liquidityNet = JSBI3.BigInt(liquidityNet); + }; + var TickListDataProvider = /* @__PURE__ */ function() { + function TickListDataProvider2(ticks, tickSpacing) { + var ticksMapped = ticks.map(function(t) { + return t instanceof Tick ? t : new Tick(t); + }); + TickList.validateList(ticksMapped, tickSpacing); + this.ticks = ticksMapped; + } + var _proto = TickListDataProvider2.prototype; + _proto.getTick = /* @__PURE__ */ function() { + var _getTick = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(tick) { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + return _context.abrupt("return", TickList.getTick(this.ticks, tick)); + case 1: + case "end": + return _context.stop(); + } + }, _callee, this); + })); + function getTick(_x) { + return _getTick.apply(this, arguments); + } + return getTick; + }(); + _proto.nextInitializedTickWithinOneWord = /* @__PURE__ */ function() { + var _nextInitializedTickWithinOneWord = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(tick, lte, tickSpacing) { + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + return _context2.abrupt("return", TickList.nextInitializedTickWithinOneWord(this.ticks, tick, lte, tickSpacing)); + case 1: + case "end": + return _context2.stop(); + } + }, _callee2, this); + })); + function nextInitializedTickWithinOneWord(_x2, _x3, _x4) { + return _nextInitializedTickWithinOneWord.apply(this, arguments); + } + return nextInitializedTickWithinOneWord; + }(); + return TickListDataProvider2; + }(); + var NO_TICK_DATA_PROVIDER_DEFAULT = /* @__PURE__ */ new NoTickDataProvider(); + var Pool = /* @__PURE__ */ function() { + function Pool2(tokenA, tokenB, fee, sqrtRatioX96, liquidity2, tickCurrent, ticks) { + if (ticks === void 0) { + ticks = NO_TICK_DATA_PROVIDER_DEFAULT; + } + !(Number.isInteger(fee) && fee < 1e6) ? invariant(false, "FEE") : void 0; + var tickCurrentSqrtRatioX96 = TickMath.getSqrtRatioAtTick(tickCurrent); + var nextTickSqrtRatioX96 = TickMath.getSqrtRatioAtTick(tickCurrent + 1); + !(JSBI3.greaterThanOrEqual(JSBI3.BigInt(sqrtRatioX96), tickCurrentSqrtRatioX96) && JSBI3.lessThanOrEqual(JSBI3.BigInt(sqrtRatioX96), nextTickSqrtRatioX96)) ? invariant(false, "PRICE_BOUNDS") : void 0; + var _ref = tokenA.sortsBefore(tokenB) ? [tokenA, tokenB] : [tokenB, tokenA]; + this.token0 = _ref[0]; + this.token1 = _ref[1]; + this.fee = fee; + this.sqrtRatioX96 = JSBI3.BigInt(sqrtRatioX96); + this.liquidity = JSBI3.BigInt(liquidity2); + this.tickCurrent = tickCurrent; + this.tickDataProvider = Array.isArray(ticks) ? new TickListDataProvider(ticks, TICK_SPACINGS[fee]) : ticks; + } + Pool2.getAddress = function getAddress(tokenA, tokenB, fee, initCodeHashManualOverride, factoryAddressOverride) { + return computePoolAddress({ + factoryAddress: factoryAddressOverride != null ? factoryAddressOverride : FACTORY_ADDRESS, + fee, + tokenA, + tokenB, + initCodeHashManualOverride + }); + }; + var _proto = Pool2.prototype; + _proto.involvesToken = function involvesToken(token) { + return token.equals(this.token0) || token.equals(this.token1); + }; + _proto.priceOf = function priceOf(token) { + !this.involvesToken(token) ? invariant(false, "TOKEN") : void 0; + return token.equals(this.token0) ? this.token0Price : this.token1Price; + }; + _proto.getOutputAmount = /* @__PURE__ */ function() { + var _getOutputAmount = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(inputAmount, sqrtPriceLimitX96) { + var zeroForOne, _yield$this$swap, outputAmount, sqrtRatioX96, liquidity2, tickCurrent, outputToken; + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + !this.involvesToken(inputAmount.currency) ? invariant(false, "TOKEN") : void 0; + zeroForOne = inputAmount.currency.equals(this.token0); + _context.next = 4; + return this.swap(zeroForOne, inputAmount.quotient, sqrtPriceLimitX96); + case 4: + _yield$this$swap = _context.sent; + outputAmount = _yield$this$swap.amountCalculated; + sqrtRatioX96 = _yield$this$swap.sqrtRatioX96; + liquidity2 = _yield$this$swap.liquidity; + tickCurrent = _yield$this$swap.tickCurrent; + outputToken = zeroForOne ? this.token1 : this.token0; + return _context.abrupt("return", [sdkCore.CurrencyAmount.fromRawAmount(outputToken, JSBI3.multiply(outputAmount, NEGATIVE_ONE)), new Pool2(this.token0, this.token1, this.fee, sqrtRatioX96, liquidity2, tickCurrent, this.tickDataProvider)]); + case 11: + case "end": + return _context.stop(); + } + }, _callee, this); + })); + function getOutputAmount(_x, _x2) { + return _getOutputAmount.apply(this, arguments); + } + return getOutputAmount; + }(); + _proto.getInputAmount = /* @__PURE__ */ function() { + var _getInputAmount = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(outputAmount, sqrtPriceLimitX96) { + var zeroForOne, _yield$this$swap2, inputAmount, sqrtRatioX96, liquidity2, tickCurrent, inputToken; + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + !(outputAmount.currency.isToken && this.involvesToken(outputAmount.currency)) ? invariant(false, "TOKEN") : void 0; + zeroForOne = outputAmount.currency.equals(this.token1); + _context2.next = 4; + return this.swap(zeroForOne, JSBI3.multiply(outputAmount.quotient, NEGATIVE_ONE), sqrtPriceLimitX96); + case 4: + _yield$this$swap2 = _context2.sent; + inputAmount = _yield$this$swap2.amountCalculated; + sqrtRatioX96 = _yield$this$swap2.sqrtRatioX96; + liquidity2 = _yield$this$swap2.liquidity; + tickCurrent = _yield$this$swap2.tickCurrent; + inputToken = zeroForOne ? this.token0 : this.token1; + return _context2.abrupt("return", [sdkCore.CurrencyAmount.fromRawAmount(inputToken, inputAmount), new Pool2(this.token0, this.token1, this.fee, sqrtRatioX96, liquidity2, tickCurrent, this.tickDataProvider)]); + case 11: + case "end": + return _context2.stop(); + } + }, _callee2, this); + })); + function getInputAmount(_x3, _x4) { + return _getInputAmount.apply(this, arguments); + } + return getInputAmount; + }(); + _proto.swap = /* @__PURE__ */ function() { + var _swap = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(zeroForOne, amountSpecified, sqrtPriceLimitX96) { + var exactInput, state, step, _yield$this$tickDataP, _SwapMath$computeSwap, liquidityNet; + return _regeneratorRuntime().wrap(function _callee3$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + if (!sqrtPriceLimitX96) sqrtPriceLimitX96 = zeroForOne ? JSBI3.add(TickMath.MIN_SQRT_RATIO, ONE) : JSBI3.subtract(TickMath.MAX_SQRT_RATIO, ONE); + if (zeroForOne) { + !JSBI3.greaterThan(sqrtPriceLimitX96, TickMath.MIN_SQRT_RATIO) ? invariant(false, "RATIO_MIN") : void 0; + !JSBI3.lessThan(sqrtPriceLimitX96, this.sqrtRatioX96) ? invariant(false, "RATIO_CURRENT") : void 0; + } else { + !JSBI3.lessThan(sqrtPriceLimitX96, TickMath.MAX_SQRT_RATIO) ? invariant(false, "RATIO_MAX") : void 0; + !JSBI3.greaterThan(sqrtPriceLimitX96, this.sqrtRatioX96) ? invariant(false, "RATIO_CURRENT") : void 0; + } + exactInput = JSBI3.greaterThanOrEqual(amountSpecified, ZERO); + state = { + amountSpecifiedRemaining: amountSpecified, + amountCalculated: ZERO, + sqrtPriceX96: this.sqrtRatioX96, + tick: this.tickCurrent, + liquidity: this.liquidity + }; + case 4: + if (!(JSBI3.notEqual(state.amountSpecifiedRemaining, ZERO) && state.sqrtPriceX96 !== sqrtPriceLimitX96)) { + _context3.next = 35; + break; + } + step = {}; + step.sqrtPriceStartX96 = state.sqrtPriceX96; + _context3.next = 9; + return this.tickDataProvider.nextInitializedTickWithinOneWord(state.tick, zeroForOne, this.tickSpacing); + case 9: + _yield$this$tickDataP = _context3.sent; + step.tickNext = _yield$this$tickDataP[0]; + step.initialized = _yield$this$tickDataP[1]; + if (step.tickNext < TickMath.MIN_TICK) { + step.tickNext = TickMath.MIN_TICK; + } else if (step.tickNext > TickMath.MAX_TICK) { + step.tickNext = TickMath.MAX_TICK; + } + step.sqrtPriceNextX96 = TickMath.getSqrtRatioAtTick(step.tickNext); + _SwapMath$computeSwap = SwapMath.computeSwapStep(state.sqrtPriceX96, (zeroForOne ? JSBI3.lessThan(step.sqrtPriceNextX96, sqrtPriceLimitX96) : JSBI3.greaterThan(step.sqrtPriceNextX96, sqrtPriceLimitX96)) ? sqrtPriceLimitX96 : step.sqrtPriceNextX96, state.liquidity, state.amountSpecifiedRemaining, this.fee); + state.sqrtPriceX96 = _SwapMath$computeSwap[0]; + step.amountIn = _SwapMath$computeSwap[1]; + step.amountOut = _SwapMath$computeSwap[2]; + step.feeAmount = _SwapMath$computeSwap[3]; + if (exactInput) { + state.amountSpecifiedRemaining = JSBI3.subtract(state.amountSpecifiedRemaining, JSBI3.add(step.amountIn, step.feeAmount)); + state.amountCalculated = JSBI3.subtract(state.amountCalculated, step.amountOut); + } else { + state.amountSpecifiedRemaining = JSBI3.add(state.amountSpecifiedRemaining, step.amountOut); + state.amountCalculated = JSBI3.add(state.amountCalculated, JSBI3.add(step.amountIn, step.feeAmount)); + } + if (!JSBI3.equal(state.sqrtPriceX96, step.sqrtPriceNextX96)) { + _context3.next = 32; + break; + } + if (!step.initialized) { + _context3.next = 29; + break; + } + _context3.t0 = JSBI3; + _context3.next = 25; + return this.tickDataProvider.getTick(step.tickNext); + case 25: + _context3.t1 = _context3.sent.liquidityNet; + liquidityNet = _context3.t0.BigInt.call(_context3.t0, _context3.t1); + if (zeroForOne) liquidityNet = JSBI3.multiply(liquidityNet, NEGATIVE_ONE); + state.liquidity = LiquidityMath.addDelta(state.liquidity, liquidityNet); + case 29: + state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext; + _context3.next = 33; + break; + case 32: + if (JSBI3.notEqual(state.sqrtPriceX96, step.sqrtPriceStartX96)) { + state.tick = TickMath.getTickAtSqrtRatio(state.sqrtPriceX96); + } + case 33: + _context3.next = 4; + break; + case 35: + return _context3.abrupt("return", { + amountCalculated: state.amountCalculated, + sqrtRatioX96: state.sqrtPriceX96, + liquidity: state.liquidity, + tickCurrent: state.tick + }); + case 36: + case "end": + return _context3.stop(); + } + }, _callee3, this); + })); + function swap(_x5, _x6, _x7) { + return _swap.apply(this, arguments); + } + return swap; + }(); + _createClass(Pool2, [{ + key: "token0Price", + get: function get() { + var _this$_token0Price; + return (_this$_token0Price = this._token0Price) != null ? _this$_token0Price : this._token0Price = new sdkCore.Price(this.token0, this.token1, Q192, JSBI3.multiply(this.sqrtRatioX96, this.sqrtRatioX96)); + } + /** + * Returns the current mid price of the pool in terms of token1, i.e. the ratio of token0 over token1 + */ + }, { + key: "token1Price", + get: function get() { + var _this$_token1Price; + return (_this$_token1Price = this._token1Price) != null ? _this$_token1Price : this._token1Price = new sdkCore.Price(this.token1, this.token0, JSBI3.multiply(this.sqrtRatioX96, this.sqrtRatioX96), Q192); + } + }, { + key: "chainId", + get: function get() { + return this.token0.chainId; + } + }, { + key: "tickSpacing", + get: function get() { + return TICK_SPACINGS[this.fee]; + } + }]); + return Pool2; + }(); + var Position = /* @__PURE__ */ function() { + function Position2(_ref) { + var pool = _ref.pool, liquidity2 = _ref.liquidity, tickLower2 = _ref.tickLower, tickUpper2 = _ref.tickUpper; + this._token0Amount = null; + this._token1Amount = null; + this._mintAmounts = null; + !(tickLower2 < tickUpper2) ? invariant(false, "TICK_ORDER") : void 0; + !(tickLower2 >= TickMath.MIN_TICK && tickLower2 % pool.tickSpacing === 0) ? invariant(false, "TICK_LOWER") : void 0; + !(tickUpper2 <= TickMath.MAX_TICK && tickUpper2 % pool.tickSpacing === 0) ? invariant(false, "TICK_UPPER") : void 0; + this.pool = pool; + this.tickLower = tickLower2; + this.tickUpper = tickUpper2; + this.liquidity = JSBI3.BigInt(liquidity2); + } + var _proto = Position2.prototype; + _proto.ratiosAfterSlippage = function ratiosAfterSlippage(slippageTolerance) { + var priceLower = this.pool.token0Price.asFraction.multiply(new sdkCore.Percent(1).subtract(slippageTolerance)); + var priceUpper = this.pool.token0Price.asFraction.multiply(slippageTolerance.add(1)); + var sqrtRatioX96Lower = encodeSqrtRatioX96(priceLower.numerator, priceLower.denominator); + if (JSBI3.lessThanOrEqual(sqrtRatioX96Lower, TickMath.MIN_SQRT_RATIO)) { + sqrtRatioX96Lower = JSBI3.add(TickMath.MIN_SQRT_RATIO, JSBI3.BigInt(1)); + } + var sqrtRatioX96Upper = encodeSqrtRatioX96(priceUpper.numerator, priceUpper.denominator); + if (JSBI3.greaterThanOrEqual(sqrtRatioX96Upper, TickMath.MAX_SQRT_RATIO)) { + sqrtRatioX96Upper = JSBI3.subtract(TickMath.MAX_SQRT_RATIO, JSBI3.BigInt(1)); + } + return { + sqrtRatioX96Lower, + sqrtRatioX96Upper + }; + }; + _proto.mintAmountsWithSlippage = function mintAmountsWithSlippage(slippageTolerance) { + var _this$ratiosAfterSlip = this.ratiosAfterSlippage(slippageTolerance), sqrtRatioX96Upper = _this$ratiosAfterSlip.sqrtRatioX96Upper, sqrtRatioX96Lower = _this$ratiosAfterSlip.sqrtRatioX96Lower; + var poolLower = new Pool(this.pool.token0, this.pool.token1, this.pool.fee, sqrtRatioX96Lower, 0, TickMath.getTickAtSqrtRatio(sqrtRatioX96Lower)); + var poolUpper = new Pool(this.pool.token0, this.pool.token1, this.pool.fee, sqrtRatioX96Upper, 0, TickMath.getTickAtSqrtRatio(sqrtRatioX96Upper)); + var positionThatWillBeCreated = Position2.fromAmounts(_extends({ + pool: this.pool, + tickLower: this.tickLower, + tickUpper: this.tickUpper + }, this.mintAmounts, { + useFullPrecision: false + })); + var amount0 = new Position2({ + pool: poolUpper, + liquidity: positionThatWillBeCreated.liquidity, + tickLower: this.tickLower, + tickUpper: this.tickUpper + }).mintAmounts.amount0; + var amount1 = new Position2({ + pool: poolLower, + liquidity: positionThatWillBeCreated.liquidity, + tickLower: this.tickLower, + tickUpper: this.tickUpper + }).mintAmounts.amount1; + return { + amount0, + amount1 + }; + }; + _proto.burnAmountsWithSlippage = function burnAmountsWithSlippage(slippageTolerance) { + var _this$ratiosAfterSlip2 = this.ratiosAfterSlippage(slippageTolerance), sqrtRatioX96Upper = _this$ratiosAfterSlip2.sqrtRatioX96Upper, sqrtRatioX96Lower = _this$ratiosAfterSlip2.sqrtRatioX96Lower; + var poolLower = new Pool(this.pool.token0, this.pool.token1, this.pool.fee, sqrtRatioX96Lower, 0, TickMath.getTickAtSqrtRatio(sqrtRatioX96Lower)); + var poolUpper = new Pool(this.pool.token0, this.pool.token1, this.pool.fee, sqrtRatioX96Upper, 0, TickMath.getTickAtSqrtRatio(sqrtRatioX96Upper)); + var amount0 = new Position2({ + pool: poolUpper, + liquidity: this.liquidity, + tickLower: this.tickLower, + tickUpper: this.tickUpper + }).amount0; + var amount1 = new Position2({ + pool: poolLower, + liquidity: this.liquidity, + tickLower: this.tickLower, + tickUpper: this.tickUpper + }).amount1; + return { + amount0: amount0.quotient, + amount1: amount1.quotient + }; + }; + Position2.fromAmounts = function fromAmounts(_ref2) { + var pool = _ref2.pool, tickLower2 = _ref2.tickLower, tickUpper2 = _ref2.tickUpper, amount0 = _ref2.amount0, amount1 = _ref2.amount1, useFullPrecision = _ref2.useFullPrecision; + var sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower2); + var sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper2); + return new Position2({ + pool, + tickLower: tickLower2, + tickUpper: tickUpper2, + liquidity: maxLiquidityForAmounts(pool.sqrtRatioX96, sqrtRatioAX96, sqrtRatioBX96, amount0, amount1, useFullPrecision) + }); + }; + Position2.fromAmount0 = function fromAmount0(_ref3) { + var pool = _ref3.pool, tickLower2 = _ref3.tickLower, tickUpper2 = _ref3.tickUpper, amount0 = _ref3.amount0, useFullPrecision = _ref3.useFullPrecision; + return Position2.fromAmounts({ + pool, + tickLower: tickLower2, + tickUpper: tickUpper2, + amount0, + amount1: sdkCore.MaxUint256, + useFullPrecision + }); + }; + Position2.fromAmount1 = function fromAmount1(_ref4) { + var pool = _ref4.pool, tickLower2 = _ref4.tickLower, tickUpper2 = _ref4.tickUpper, amount1 = _ref4.amount1; + return Position2.fromAmounts({ + pool, + tickLower: tickLower2, + tickUpper: tickUpper2, + amount0: sdkCore.MaxUint256, + amount1, + useFullPrecision: true + }); + }; + _createClass(Position2, [{ + key: "token0PriceLower", + get: function get() { + return tickToPrice(this.pool.token0, this.pool.token1, this.tickLower); + } + /** + * Returns the price of token0 at the upper tick + */ + }, { + key: "token0PriceUpper", + get: function get() { + return tickToPrice(this.pool.token0, this.pool.token1, this.tickUpper); + } + /** + * Returns the amount of token0 that this position's liquidity could be burned for at the current pool price + */ + }, { + key: "amount0", + get: function get() { + if (this._token0Amount === null) { + if (this.pool.tickCurrent < this.tickLower) { + this._token0Amount = sdkCore.CurrencyAmount.fromRawAmount(this.pool.token0, SqrtPriceMath2.getAmount0Delta(TickMath.getSqrtRatioAtTick(this.tickLower), TickMath.getSqrtRatioAtTick(this.tickUpper), this.liquidity, false)); + } else if (this.pool.tickCurrent < this.tickUpper) { + this._token0Amount = sdkCore.CurrencyAmount.fromRawAmount(this.pool.token0, SqrtPriceMath2.getAmount0Delta(this.pool.sqrtRatioX96, TickMath.getSqrtRatioAtTick(this.tickUpper), this.liquidity, false)); + } else { + this._token0Amount = sdkCore.CurrencyAmount.fromRawAmount(this.pool.token0, ZERO); + } + } + return this._token0Amount; + } + /** + * Returns the amount of token1 that this position's liquidity could be burned for at the current pool price + */ + }, { + key: "amount1", + get: function get() { + if (this._token1Amount === null) { + if (this.pool.tickCurrent < this.tickLower) { + this._token1Amount = sdkCore.CurrencyAmount.fromRawAmount(this.pool.token1, ZERO); + } else if (this.pool.tickCurrent < this.tickUpper) { + this._token1Amount = sdkCore.CurrencyAmount.fromRawAmount(this.pool.token1, SqrtPriceMath2.getAmount1Delta(TickMath.getSqrtRatioAtTick(this.tickLower), this.pool.sqrtRatioX96, this.liquidity, false)); + } else { + this._token1Amount = sdkCore.CurrencyAmount.fromRawAmount(this.pool.token1, SqrtPriceMath2.getAmount1Delta(TickMath.getSqrtRatioAtTick(this.tickLower), TickMath.getSqrtRatioAtTick(this.tickUpper), this.liquidity, false)); + } + } + return this._token1Amount; + } + }, { + key: "mintAmounts", + get: function get() { + if (this._mintAmounts === null) { + if (this.pool.tickCurrent < this.tickLower) { + return { + amount0: SqrtPriceMath2.getAmount0Delta(TickMath.getSqrtRatioAtTick(this.tickLower), TickMath.getSqrtRatioAtTick(this.tickUpper), this.liquidity, true), + amount1: ZERO + }; + } else if (this.pool.tickCurrent < this.tickUpper) { + return { + amount0: SqrtPriceMath2.getAmount0Delta(this.pool.sqrtRatioX96, TickMath.getSqrtRatioAtTick(this.tickUpper), this.liquidity, true), + amount1: SqrtPriceMath2.getAmount1Delta(TickMath.getSqrtRatioAtTick(this.tickLower), this.pool.sqrtRatioX96, this.liquidity, true) + }; + } else { + return { + amount0: ZERO, + amount1: SqrtPriceMath2.getAmount1Delta(TickMath.getSqrtRatioAtTick(this.tickLower), TickMath.getSqrtRatioAtTick(this.tickUpper), this.liquidity, true) + }; + } + } + return this._mintAmounts; + } + }]); + return Position2; + }(); + var Route = /* @__PURE__ */ function() { + function Route2(pools, input, output) { + this._midPrice = null; + !(pools.length > 0) ? invariant(false, "POOLS") : void 0; + var chainId = pools[0].chainId; + var allOnSameChain = pools.every(function(pool2) { + return pool2.chainId === chainId; + }); + !allOnSameChain ? invariant(false, "CHAIN_IDS") : void 0; + var wrappedInput = input.wrapped; + !pools[0].involvesToken(wrappedInput) ? invariant(false, "INPUT") : void 0; + !pools[pools.length - 1].involvesToken(output.wrapped) ? invariant(false, "OUTPUT") : void 0; + var tokenPath = [wrappedInput]; + for (var _iterator = _createForOfIteratorHelperLoose(pools.entries()), _step; !(_step = _iterator()).done; ) { + var _step$value = _step.value, i = _step$value[0], pool = _step$value[1]; + var currentInputToken = tokenPath[i]; + !(currentInputToken.equals(pool.token0) || currentInputToken.equals(pool.token1)) ? invariant(false, "PATH") : void 0; + var nextToken = currentInputToken.equals(pool.token0) ? pool.token1 : pool.token0; + tokenPath.push(nextToken); + } + this.pools = pools; + this.tokenPath = tokenPath; + this.input = input; + this.output = output != null ? output : tokenPath[tokenPath.length - 1]; + } + _createClass(Route2, [{ + key: "chainId", + get: function get() { + return this.pools[0].chainId; + } + /** + * Returns the mid price of the route + */ + }, { + key: "midPrice", + get: function get() { + if (this._midPrice !== null) return this._midPrice; + var price = this.pools.slice(1).reduce(function(_ref, pool) { + var nextInput = _ref.nextInput, price2 = _ref.price; + return nextInput.equals(pool.token0) ? { + nextInput: pool.token1, + price: price2.multiply(pool.token0Price) + } : { + nextInput: pool.token0, + price: price2.multiply(pool.token1Price) + }; + }, this.pools[0].token0.equals(this.input.wrapped) ? { + nextInput: this.pools[0].token1, + price: this.pools[0].token0Price + } : { + nextInput: this.pools[0].token0, + price: this.pools[0].token1Price + }).price; + return this._midPrice = new sdkCore.Price(this.input, this.output, price.denominator, price.numerator); + } + }]); + return Route2; + }(); + function tradeComparator(a, b) { + !a.inputAmount.currency.equals(b.inputAmount.currency) ? invariant(false, "INPUT_CURRENCY") : void 0; + !a.outputAmount.currency.equals(b.outputAmount.currency) ? invariant(false, "OUTPUT_CURRENCY") : void 0; + if (a.outputAmount.equalTo(b.outputAmount)) { + if (a.inputAmount.equalTo(b.inputAmount)) { + var aHops = a.swaps.reduce(function(total, cur) { + return total + cur.route.tokenPath.length; + }, 0); + var bHops = b.swaps.reduce(function(total, cur) { + return total + cur.route.tokenPath.length; + }, 0); + return aHops - bHops; + } + if (a.inputAmount.lessThan(b.inputAmount)) { + return -1; + } else { + return 1; + } + } else { + if (a.outputAmount.lessThan(b.outputAmount)) { + return 1; + } else { + return -1; + } + } + } + var Trade = /* @__PURE__ */ function() { + function Trade2(_ref) { + var routes = _ref.routes, tradeType = _ref.tradeType; + var inputCurrency = routes[0].inputAmount.currency; + var outputCurrency = routes[0].outputAmount.currency; + !routes.every(function(_ref2) { + var route2 = _ref2.route; + return inputCurrency.wrapped.equals(route2.input.wrapped); + }) ? invariant(false, "INPUT_CURRENCY_MATCH") : void 0; + !routes.every(function(_ref3) { + var route2 = _ref3.route; + return outputCurrency.wrapped.equals(route2.output.wrapped); + }) ? invariant(false, "OUTPUT_CURRENCY_MATCH") : void 0; + var numPools = routes.map(function(_ref4) { + var route2 = _ref4.route; + return route2.pools.length; + }).reduce(function(total, cur) { + return total + cur; + }, 0); + var poolAddressSet = /* @__PURE__ */ new Set(); + for (var _iterator = _createForOfIteratorHelperLoose(routes), _step; !(_step = _iterator()).done; ) { + var route = _step.value.route; + for (var _iterator2 = _createForOfIteratorHelperLoose(route.pools), _step2; !(_step2 = _iterator2()).done; ) { + var pool = _step2.value; + poolAddressSet.add(Pool.getAddress(pool.token0, pool.token1, pool.fee)); + } + } + !(numPools === poolAddressSet.size) ? invariant(false, "POOLS_DUPLICATED") : void 0; + this.swaps = routes; + this.tradeType = tradeType; + } + Trade2.exactIn = /* @__PURE__ */ function() { + var _exactIn = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(route, amountIn) { + return _regeneratorRuntime().wrap(function _callee$(_context) { + while (1) switch (_context.prev = _context.next) { + case 0: + return _context.abrupt("return", Trade2.fromRoute(route, amountIn, sdkCore.TradeType.EXACT_INPUT)); + case 1: + case "end": + return _context.stop(); + } + }, _callee); + })); + function exactIn(_x, _x2) { + return _exactIn.apply(this, arguments); + } + return exactIn; + }(); + Trade2.exactOut = /* @__PURE__ */ function() { + var _exactOut = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee2(route, amountOut) { + return _regeneratorRuntime().wrap(function _callee2$(_context2) { + while (1) switch (_context2.prev = _context2.next) { + case 0: + return _context2.abrupt("return", Trade2.fromRoute(route, amountOut, sdkCore.TradeType.EXACT_OUTPUT)); + case 1: + case "end": + return _context2.stop(); + } + }, _callee2); + })); + function exactOut(_x3, _x4) { + return _exactOut.apply(this, arguments); + } + return exactOut; + }(); + Trade2.fromRoute = /* @__PURE__ */ function() { + var _fromRoute = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3(route, amount, tradeType) { + var amounts, inputAmount, outputAmount, i, pool, _yield$pool$getOutput, _outputAmount, _i, _pool, _yield$_pool$getInput, _inputAmount; + return _regeneratorRuntime().wrap(function _callee3$(_context3) { + while (1) switch (_context3.prev = _context3.next) { + case 0: + amounts = new Array(route.tokenPath.length); + if (!(tradeType === sdkCore.TradeType.EXACT_INPUT)) { + _context3.next = 19; + break; + } + !amount.currency.equals(route.input) ? invariant(false, "INPUT") : void 0; + amounts[0] = amount.wrapped; + i = 0; + case 5: + if (!(i < route.tokenPath.length - 1)) { + _context3.next = 15; + break; + } + pool = route.pools[i]; + _context3.next = 9; + return pool.getOutputAmount(amounts[i]); + case 9: + _yield$pool$getOutput = _context3.sent; + _outputAmount = _yield$pool$getOutput[0]; + amounts[i + 1] = _outputAmount; + case 12: + i++; + _context3.next = 5; + break; + case 15: + inputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.input, amount.numerator, amount.denominator); + outputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.output, amounts[amounts.length - 1].numerator, amounts[amounts.length - 1].denominator); + _context3.next = 34; + break; + case 19: + !amount.currency.equals(route.output) ? invariant(false, "OUTPUT") : void 0; + amounts[amounts.length - 1] = amount.wrapped; + _i = route.tokenPath.length - 1; + case 22: + if (!(_i > 0)) { + _context3.next = 32; + break; + } + _pool = route.pools[_i - 1]; + _context3.next = 26; + return _pool.getInputAmount(amounts[_i]); + case 26: + _yield$_pool$getInput = _context3.sent; + _inputAmount = _yield$_pool$getInput[0]; + amounts[_i - 1] = _inputAmount; + case 29: + _i--; + _context3.next = 22; + break; + case 32: + inputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.input, amounts[0].numerator, amounts[0].denominator); + outputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.output, amount.numerator, amount.denominator); + case 34: + return _context3.abrupt("return", new Trade2({ + routes: [{ + inputAmount, + outputAmount, + route + }], + tradeType + })); + case 35: + case "end": + return _context3.stop(); + } + }, _callee3); + })); + function fromRoute(_x5, _x6, _x7) { + return _fromRoute.apply(this, arguments); + } + return fromRoute; + }(); + Trade2.fromRoutes = /* @__PURE__ */ function() { + var _fromRoutes = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee4(routes, tradeType) { + var populatedRoutes, _iterator3, _step3, _step3$value, route, amount, amounts, inputAmount, outputAmount, i, pool, _yield$pool$getOutput2, _outputAmount2, _i2, _pool2, _yield$_pool2$getInpu, _inputAmount2; + return _regeneratorRuntime().wrap(function _callee4$(_context4) { + while (1) switch (_context4.prev = _context4.next) { + case 0: + populatedRoutes = []; + _iterator3 = _createForOfIteratorHelperLoose(routes); + case 2: + if ((_step3 = _iterator3()).done) { + _context4.next = 43; + break; + } + _step3$value = _step3.value, route = _step3$value.route, amount = _step3$value.amount; + amounts = new Array(route.tokenPath.length); + inputAmount = void 0; + outputAmount = void 0; + if (!(tradeType === sdkCore.TradeType.EXACT_INPUT)) { + _context4.next = 25; + break; + } + !amount.currency.equals(route.input) ? invariant(false, "INPUT") : void 0; + inputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.input, amount.numerator, amount.denominator); + amounts[0] = sdkCore.CurrencyAmount.fromFractionalAmount(route.input.wrapped, amount.numerator, amount.denominator); + i = 0; + case 12: + if (!(i < route.tokenPath.length - 1)) { + _context4.next = 22; + break; + } + pool = route.pools[i]; + _context4.next = 16; + return pool.getOutputAmount(amounts[i]); + case 16: + _yield$pool$getOutput2 = _context4.sent; + _outputAmount2 = _yield$pool$getOutput2[0]; + amounts[i + 1] = _outputAmount2; + case 19: + i++; + _context4.next = 12; + break; + case 22: + outputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.output, amounts[amounts.length - 1].numerator, amounts[amounts.length - 1].denominator); + _context4.next = 40; + break; + case 25: + !amount.currency.equals(route.output) ? invariant(false, "OUTPUT") : void 0; + outputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.output, amount.numerator, amount.denominator); + amounts[amounts.length - 1] = sdkCore.CurrencyAmount.fromFractionalAmount(route.output.wrapped, amount.numerator, amount.denominator); + _i2 = route.tokenPath.length - 1; + case 29: + if (!(_i2 > 0)) { + _context4.next = 39; + break; + } + _pool2 = route.pools[_i2 - 1]; + _context4.next = 33; + return _pool2.getInputAmount(amounts[_i2]); + case 33: + _yield$_pool2$getInpu = _context4.sent; + _inputAmount2 = _yield$_pool2$getInpu[0]; + amounts[_i2 - 1] = _inputAmount2; + case 36: + _i2--; + _context4.next = 29; + break; + case 39: + inputAmount = sdkCore.CurrencyAmount.fromFractionalAmount(route.input, amounts[0].numerator, amounts[0].denominator); + case 40: + populatedRoutes.push({ + route, + inputAmount, + outputAmount + }); + case 41: + _context4.next = 2; + break; + case 43: + return _context4.abrupt("return", new Trade2({ + routes: populatedRoutes, + tradeType + })); + case 44: + case "end": + return _context4.stop(); + } + }, _callee4); + })); + function fromRoutes(_x8, _x9) { + return _fromRoutes.apply(this, arguments); + } + return fromRoutes; + }(); + Trade2.createUncheckedTrade = function createUncheckedTrade(constructorArguments) { + return new Trade2(_extends({}, constructorArguments, { + routes: [{ + inputAmount: constructorArguments.inputAmount, + outputAmount: constructorArguments.outputAmount, + route: constructorArguments.route + }] + })); + }; + Trade2.createUncheckedTradeWithMultipleRoutes = function createUncheckedTradeWithMultipleRoutes(constructorArguments) { + return new Trade2(constructorArguments); + }; + var _proto = Trade2.prototype; + _proto.minimumAmountOut = function minimumAmountOut(slippageTolerance, amountOut) { + if (amountOut === void 0) { + amountOut = this.outputAmount; + } + !!slippageTolerance.lessThan(ZERO) ? invariant(false, "SLIPPAGE_TOLERANCE") : void 0; + if (this.tradeType === sdkCore.TradeType.EXACT_OUTPUT) { + return amountOut; + } else { + var slippageAdjustedAmountOut = new sdkCore.Fraction(ONE).add(slippageTolerance).invert().multiply(amountOut.quotient).quotient; + return sdkCore.CurrencyAmount.fromRawAmount(amountOut.currency, slippageAdjustedAmountOut); + } + }; + _proto.maximumAmountIn = function maximumAmountIn(slippageTolerance, amountIn) { + if (amountIn === void 0) { + amountIn = this.inputAmount; + } + !!slippageTolerance.lessThan(ZERO) ? invariant(false, "SLIPPAGE_TOLERANCE") : void 0; + if (this.tradeType === sdkCore.TradeType.EXACT_INPUT) { + return amountIn; + } else { + var slippageAdjustedAmountIn = new sdkCore.Fraction(ONE).add(slippageTolerance).multiply(amountIn.quotient).quotient; + return sdkCore.CurrencyAmount.fromRawAmount(amountIn.currency, slippageAdjustedAmountIn); + } + }; + _proto.worstExecutionPrice = function worstExecutionPrice(slippageTolerance) { + return new sdkCore.Price(this.inputAmount.currency, this.outputAmount.currency, this.maximumAmountIn(slippageTolerance).quotient, this.minimumAmountOut(slippageTolerance).quotient); + }; + Trade2.bestTradeExactIn = /* @__PURE__ */ function() { + var _bestTradeExactIn = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee5(pools, currencyAmountIn, currencyOut, _temp, currentPools, nextAmountIn, bestTrades) { + var _ref5, _ref5$maxNumResults, maxNumResults, _ref5$maxHops, maxHops, amountIn, tokenOut, i, pool, amountOut, _yield$pool$getOutput3, poolsExcludingThisPool; + return _regeneratorRuntime().wrap(function _callee5$(_context5) { + while (1) switch (_context5.prev = _context5.next) { + case 0: + _ref5 = _temp === void 0 ? {} : _temp, _ref5$maxNumResults = _ref5.maxNumResults, maxNumResults = _ref5$maxNumResults === void 0 ? 3 : _ref5$maxNumResults, _ref5$maxHops = _ref5.maxHops, maxHops = _ref5$maxHops === void 0 ? 3 : _ref5$maxHops; + if (currentPools === void 0) { + currentPools = []; + } + if (nextAmountIn === void 0) { + nextAmountIn = currencyAmountIn; + } + if (bestTrades === void 0) { + bestTrades = []; + } + !(pools.length > 0) ? invariant(false, "POOLS") : void 0; + !(maxHops > 0) ? invariant(false, "MAX_HOPS") : void 0; + !(currencyAmountIn === nextAmountIn || currentPools.length > 0) ? invariant(false, "INVALID_RECURSION") : void 0; + amountIn = nextAmountIn.wrapped; + tokenOut = currencyOut.wrapped; + i = 0; + case 10: + if (!(i < pools.length)) { + _context5.next = 46; + break; + } + pool = pools[i]; + if (!(!pool.token0.equals(amountIn.currency) && !pool.token1.equals(amountIn.currency))) { + _context5.next = 14; + break; + } + return _context5.abrupt("continue", 43); + case 14: + amountOut = void 0; + _context5.prev = 15; + _context5.next = 19; + return pool.getOutputAmount(amountIn); + case 19: + _yield$pool$getOutput3 = _context5.sent; + amountOut = _yield$pool$getOutput3[0]; + _context5.next = 28; + break; + case 23: + _context5.prev = 23; + _context5.t0 = _context5["catch"](15); + if (!_context5.t0.isInsufficientInputAmountError) { + _context5.next = 27; + break; + } + return _context5.abrupt("continue", 43); + case 27: + throw _context5.t0; + case 28: + if (!(amountOut.currency.isToken && amountOut.currency.equals(tokenOut))) { + _context5.next = 39; + break; + } + _context5.t1 = sdkCore.sortedInsert; + _context5.t2 = bestTrades; + _context5.next = 33; + return Trade2.fromRoute(new Route([].concat(currentPools, [pool]), currencyAmountIn.currency, currencyOut), currencyAmountIn, sdkCore.TradeType.EXACT_INPUT); + case 33: + _context5.t3 = _context5.sent; + _context5.t4 = maxNumResults; + _context5.t5 = tradeComparator; + (0, _context5.t1)(_context5.t2, _context5.t3, _context5.t4, _context5.t5); + _context5.next = 43; + break; + case 39: + if (!(maxHops > 1 && pools.length > 1)) { + _context5.next = 43; + break; + } + poolsExcludingThisPool = pools.slice(0, i).concat(pools.slice(i + 1, pools.length)); + _context5.next = 43; + return Trade2.bestTradeExactIn(poolsExcludingThisPool, currencyAmountIn, currencyOut, { + maxNumResults, + maxHops: maxHops - 1 + }, [].concat(currentPools, [pool]), amountOut, bestTrades); + case 43: + i++; + _context5.next = 10; + break; + case 46: + return _context5.abrupt("return", bestTrades); + case 47: + case "end": + return _context5.stop(); + } + }, _callee5, null, [[15, 23]]); + })); + function bestTradeExactIn(_x10, _x11, _x12, _x13, _x14, _x15, _x16) { + return _bestTradeExactIn.apply(this, arguments); + } + return bestTradeExactIn; + }(); + Trade2.bestTradeExactOut = /* @__PURE__ */ function() { + var _bestTradeExactOut = /* @__PURE__ */ _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee6(pools, currencyIn, currencyAmountOut, _temp2, currentPools, nextAmountOut, bestTrades) { + var _ref6, _ref6$maxNumResults, maxNumResults, _ref6$maxHops, maxHops, amountOut, tokenIn, i, pool, amountIn, _yield$pool$getInputA, poolsExcludingThisPool; + return _regeneratorRuntime().wrap(function _callee6$(_context6) { + while (1) switch (_context6.prev = _context6.next) { + case 0: + _ref6 = _temp2 === void 0 ? {} : _temp2, _ref6$maxNumResults = _ref6.maxNumResults, maxNumResults = _ref6$maxNumResults === void 0 ? 3 : _ref6$maxNumResults, _ref6$maxHops = _ref6.maxHops, maxHops = _ref6$maxHops === void 0 ? 3 : _ref6$maxHops; + if (currentPools === void 0) { + currentPools = []; + } + if (nextAmountOut === void 0) { + nextAmountOut = currencyAmountOut; + } + if (bestTrades === void 0) { + bestTrades = []; + } + !(pools.length > 0) ? invariant(false, "POOLS") : void 0; + !(maxHops > 0) ? invariant(false, "MAX_HOPS") : void 0; + !(currencyAmountOut === nextAmountOut || currentPools.length > 0) ? invariant(false, "INVALID_RECURSION") : void 0; + amountOut = nextAmountOut.wrapped; + tokenIn = currencyIn.wrapped; + i = 0; + case 10: + if (!(i < pools.length)) { + _context6.next = 46; + break; + } + pool = pools[i]; + if (!(!pool.token0.equals(amountOut.currency) && !pool.token1.equals(amountOut.currency))) { + _context6.next = 14; + break; + } + return _context6.abrupt("continue", 43); + case 14: + amountIn = void 0; + _context6.prev = 15; + _context6.next = 19; + return pool.getInputAmount(amountOut); + case 19: + _yield$pool$getInputA = _context6.sent; + amountIn = _yield$pool$getInputA[0]; + _context6.next = 28; + break; + case 23: + _context6.prev = 23; + _context6.t0 = _context6["catch"](15); + if (!_context6.t0.isInsufficientReservesError) { + _context6.next = 27; + break; + } + return _context6.abrupt("continue", 43); + case 27: + throw _context6.t0; + case 28: + if (!amountIn.currency.equals(tokenIn)) { + _context6.next = 39; + break; + } + _context6.t1 = sdkCore.sortedInsert; + _context6.t2 = bestTrades; + _context6.next = 33; + return Trade2.fromRoute(new Route([pool].concat(currentPools), currencyIn, currencyAmountOut.currency), currencyAmountOut, sdkCore.TradeType.EXACT_OUTPUT); + case 33: + _context6.t3 = _context6.sent; + _context6.t4 = maxNumResults; + _context6.t5 = tradeComparator; + (0, _context6.t1)(_context6.t2, _context6.t3, _context6.t4, _context6.t5); + _context6.next = 43; + break; + case 39: + if (!(maxHops > 1 && pools.length > 1)) { + _context6.next = 43; + break; + } + poolsExcludingThisPool = pools.slice(0, i).concat(pools.slice(i + 1, pools.length)); + _context6.next = 43; + return Trade2.bestTradeExactOut(poolsExcludingThisPool, currencyIn, currencyAmountOut, { + maxNumResults, + maxHops: maxHops - 1 + }, [pool].concat(currentPools), amountIn, bestTrades); + case 43: + i++; + _context6.next = 10; + break; + case 46: + return _context6.abrupt("return", bestTrades); + case 47: + case "end": + return _context6.stop(); + } + }, _callee6, null, [[15, 23]]); + })); + function bestTradeExactOut(_x17, _x18, _x19, _x20, _x21, _x22, _x23) { + return _bestTradeExactOut.apply(this, arguments); + } + return bestTradeExactOut; + }(); + _createClass(Trade2, [{ + key: "route", + get: function get() { + !(this.swaps.length === 1) ? invariant(false, "MULTIPLE_ROUTES") : void 0; + return this.swaps[0].route; + } + /** + * The input amount for the trade assuming no slippage. + */ + }, { + key: "inputAmount", + get: function get() { + if (this._inputAmount) { + return this._inputAmount; + } + var inputCurrency = this.swaps[0].inputAmount.currency; + var totalInputFromRoutes = this.swaps.map(function(_ref7) { + var inputAmount = _ref7.inputAmount; + return inputAmount; + }).reduce(function(total, cur) { + return total.add(cur); + }, sdkCore.CurrencyAmount.fromRawAmount(inputCurrency, 0)); + this._inputAmount = totalInputFromRoutes; + return this._inputAmount; + } + /** + * The output amount for the trade assuming no slippage. + */ + }, { + key: "outputAmount", + get: function get() { + if (this._outputAmount) { + return this._outputAmount; + } + var outputCurrency = this.swaps[0].outputAmount.currency; + var totalOutputFromRoutes = this.swaps.map(function(_ref8) { + var outputAmount = _ref8.outputAmount; + return outputAmount; + }).reduce(function(total, cur) { + return total.add(cur); + }, sdkCore.CurrencyAmount.fromRawAmount(outputCurrency, 0)); + this._outputAmount = totalOutputFromRoutes; + return this._outputAmount; + } + /** + * The price expressed in terms of output amount/input amount. + */ + }, { + key: "executionPrice", + get: function get() { + var _this$_executionPrice; + return (_this$_executionPrice = this._executionPrice) != null ? _this$_executionPrice : this._executionPrice = new sdkCore.Price(this.inputAmount.currency, this.outputAmount.currency, this.inputAmount.quotient, this.outputAmount.quotient); + } + /** + * Returns the percent difference between the route's mid price and the price impact + */ + }, { + key: "priceImpact", + get: function get() { + if (this._priceImpact) { + return this._priceImpact; + } + var spotOutputAmount = sdkCore.CurrencyAmount.fromRawAmount(this.outputAmount.currency, 0); + for (var _iterator4 = _createForOfIteratorHelperLoose(this.swaps), _step4; !(_step4 = _iterator4()).done; ) { + var _step4$value = _step4.value, route = _step4$value.route, inputAmount = _step4$value.inputAmount; + var midPrice = route.midPrice; + spotOutputAmount = spotOutputAmount.add(midPrice.quote(inputAmount)); + } + var priceImpact = spotOutputAmount.subtract(this.outputAmount).divide(spotOutputAmount); + this._priceImpact = new sdkCore.Percent(priceImpact.numerator, priceImpact.denominator); + return this._priceImpact; + } + }]); + return Trade2; + }(); + var Multicall = /* @__PURE__ */ function() { + function Multicall2() { + } + Multicall2.encodeMulticall = function encodeMulticall(calldatas) { + if (!Array.isArray(calldatas)) { + calldatas = [calldatas]; + } + return calldatas.length === 1 ? calldatas[0] : Multicall2.INTERFACE.encodeFunctionData("multicall", [calldatas]); + }; + return Multicall2; + }(); + Multicall.INTERFACE = /* @__PURE__ */ new abi.Interface(IMulticall.abi); + function isAllowedPermit(permitOptions) { + return "nonce" in permitOptions; + } + var SelfPermit = /* @__PURE__ */ function() { + function SelfPermit2() { + } + SelfPermit2.encodePermit = function encodePermit(token, options) { + return isAllowedPermit(options) ? SelfPermit2.INTERFACE.encodeFunctionData("selfPermitAllowed", [token.address, toHex(options.nonce), toHex(options.expiry), options.v, options.r, options.s]) : SelfPermit2.INTERFACE.encodeFunctionData("selfPermit", [token.address, toHex(options.amount), toHex(options.deadline), options.v, options.r, options.s]); + }; + return SelfPermit2; + }(); + SelfPermit.INTERFACE = /* @__PURE__ */ new abi.Interface(ISelfPermit.abi); + var Payments = /* @__PURE__ */ function() { + function Payments2() { + } + Payments2.encodeFeeBips = function encodeFeeBips(fee) { + return toHex(fee.multiply(1e4).quotient); + }; + Payments2.encodeUnwrapWETH9 = function encodeUnwrapWETH9(amountMinimum, recipient, feeOptions) { + recipient = sdkCore.validateAndParseAddress(recipient); + if (!!feeOptions) { + var feeBips = this.encodeFeeBips(feeOptions.fee); + var feeRecipient = sdkCore.validateAndParseAddress(feeOptions.recipient); + return Payments2.INTERFACE.encodeFunctionData("unwrapWETH9WithFee", [toHex(amountMinimum), recipient, feeBips, feeRecipient]); + } else { + return Payments2.INTERFACE.encodeFunctionData("unwrapWETH9", [toHex(amountMinimum), recipient]); + } + }; + Payments2.encodeSweepToken = function encodeSweepToken(token, amountMinimum, recipient, feeOptions) { + recipient = sdkCore.validateAndParseAddress(recipient); + if (!!feeOptions) { + var feeBips = this.encodeFeeBips(feeOptions.fee); + var feeRecipient = sdkCore.validateAndParseAddress(feeOptions.recipient); + return Payments2.INTERFACE.encodeFunctionData("sweepTokenWithFee", [token.address, toHex(amountMinimum), recipient, feeBips, feeRecipient]); + } else { + return Payments2.INTERFACE.encodeFunctionData("sweepToken", [token.address, toHex(amountMinimum), recipient]); + } + }; + Payments2.encodeRefundETH = function encodeRefundETH() { + return Payments2.INTERFACE.encodeFunctionData("refundETH"); + }; + return Payments2; + }(); + Payments.INTERFACE = /* @__PURE__ */ new abi.Interface(IPeripheryPaymentsWithFee.abi); + var _excluded = ["expectedCurrencyOwed0", "expectedCurrencyOwed1"]; + var MaxUint128 = /* @__PURE__ */ toHex(/* @__PURE__ */ JSBI3.subtract(/* @__PURE__ */ JSBI3.exponentiate(/* @__PURE__ */ JSBI3.BigInt(2), /* @__PURE__ */ JSBI3.BigInt(128)), /* @__PURE__ */ JSBI3.BigInt(1))); + function isMint(options) { + return Object.keys(options).some(function(k) { + return k === "recipient"; + }); + } + var NonfungiblePositionManager = /* @__PURE__ */ function() { + function NonfungiblePositionManager2() { + } + NonfungiblePositionManager2.encodeCreate = function encodeCreate(pool) { + return NonfungiblePositionManager2.INTERFACE.encodeFunctionData("createAndInitializePoolIfNecessary", [pool.token0.address, pool.token1.address, pool.fee, toHex(pool.sqrtRatioX96)]); + }; + NonfungiblePositionManager2.createCallParameters = function createCallParameters(pool) { + return { + calldata: this.encodeCreate(pool), + value: toHex(0) + }; + }; + NonfungiblePositionManager2.addCallParameters = function addCallParameters(position, options) { + !JSBI3.greaterThan(position.liquidity, ZERO) ? invariant(false, "ZERO_LIQUIDITY") : void 0; + var calldatas = []; + var _position$mintAmounts = position.mintAmounts, amount0Desired = _position$mintAmounts.amount0, amount1Desired = _position$mintAmounts.amount1; + var minimumAmounts = position.mintAmountsWithSlippage(options.slippageTolerance); + var amount0Min = toHex(minimumAmounts.amount0); + var amount1Min = toHex(minimumAmounts.amount1); + var deadline = toHex(options.deadline); + if (isMint(options) && options.createPool) { + calldatas.push(this.encodeCreate(position.pool)); + } + if (options.token0Permit) { + calldatas.push(SelfPermit.encodePermit(position.pool.token0, options.token0Permit)); + } + if (options.token1Permit) { + calldatas.push(SelfPermit.encodePermit(position.pool.token1, options.token1Permit)); + } + if (isMint(options)) { + var recipient = sdkCore.validateAndParseAddress(options.recipient); + calldatas.push(NonfungiblePositionManager2.INTERFACE.encodeFunctionData("mint", [{ + token0: position.pool.token0.address, + token1: position.pool.token1.address, + fee: position.pool.fee, + tickLower: position.tickLower, + tickUpper: position.tickUpper, + amount0Desired: toHex(amount0Desired), + amount1Desired: toHex(amount1Desired), + amount0Min, + amount1Min, + recipient, + deadline + }])); + } else { + calldatas.push(NonfungiblePositionManager2.INTERFACE.encodeFunctionData("increaseLiquidity", [{ + tokenId: toHex(options.tokenId), + amount0Desired: toHex(amount0Desired), + amount1Desired: toHex(amount1Desired), + amount0Min, + amount1Min, + deadline + }])); + } + var value = toHex(0); + if (options.useNative) { + var wrapped = options.useNative.wrapped; + !(position.pool.token0.equals(wrapped) || position.pool.token1.equals(wrapped)) ? invariant(false, "NO_WETH") : void 0; + var wrappedValue = position.pool.token0.equals(wrapped) ? amount0Desired : amount1Desired; + if (JSBI3.greaterThan(wrappedValue, ZERO)) { + calldatas.push(Payments.encodeRefundETH()); + } + value = toHex(wrappedValue); + } + return { + calldata: Multicall.encodeMulticall(calldatas), + value + }; + }; + NonfungiblePositionManager2.encodeCollect = function encodeCollect(options) { + var calldatas = []; + var tokenId = toHex(options.tokenId); + var involvesETH = options.expectedCurrencyOwed0.currency.isNative || options.expectedCurrencyOwed1.currency.isNative; + var recipient = sdkCore.validateAndParseAddress(options.recipient); + calldatas.push(NonfungiblePositionManager2.INTERFACE.encodeFunctionData("collect", [{ + tokenId, + recipient: involvesETH ? ADDRESS_ZERO : recipient, + amount0Max: MaxUint128, + amount1Max: MaxUint128 + }])); + if (involvesETH) { + var ethAmount = options.expectedCurrencyOwed0.currency.isNative ? options.expectedCurrencyOwed0.quotient : options.expectedCurrencyOwed1.quotient; + var token = options.expectedCurrencyOwed0.currency.isNative ? options.expectedCurrencyOwed1.currency : options.expectedCurrencyOwed0.currency; + var tokenAmount = options.expectedCurrencyOwed0.currency.isNative ? options.expectedCurrencyOwed1.quotient : options.expectedCurrencyOwed0.quotient; + calldatas.push(Payments.encodeUnwrapWETH9(ethAmount, recipient)); + calldatas.push(Payments.encodeSweepToken(token, tokenAmount, recipient)); + } + return calldatas; + }; + NonfungiblePositionManager2.collectCallParameters = function collectCallParameters(options) { + var calldatas = NonfungiblePositionManager2.encodeCollect(options); + return { + calldata: Multicall.encodeMulticall(calldatas), + value: toHex(0) + }; + }; + NonfungiblePositionManager2.removeCallParameters = function removeCallParameters(position, options) { + var calldatas = []; + var deadline = toHex(options.deadline); + var tokenId = toHex(options.tokenId); + var partialPosition = new Position({ + pool: position.pool, + liquidity: options.liquidityPercentage.multiply(position.liquidity).quotient, + tickLower: position.tickLower, + tickUpper: position.tickUpper + }); + !JSBI3.greaterThan(partialPosition.liquidity, ZERO) ? invariant(false, "ZERO_LIQUIDITY") : void 0; + var _partialPosition$burn = partialPosition.burnAmountsWithSlippage(options.slippageTolerance), amount0Min = _partialPosition$burn.amount0, amount1Min = _partialPosition$burn.amount1; + if (options.permit) { + calldatas.push(NonfungiblePositionManager2.INTERFACE.encodeFunctionData("permit", [sdkCore.validateAndParseAddress(options.permit.spender), tokenId, toHex(options.permit.deadline), options.permit.v, options.permit.r, options.permit.s])); + } + calldatas.push(NonfungiblePositionManager2.INTERFACE.encodeFunctionData("decreaseLiquidity", [{ + tokenId, + liquidity: toHex(partialPosition.liquidity), + amount0Min: toHex(amount0Min), + amount1Min: toHex(amount1Min), + deadline + }])); + var _options$collectOptio = options.collectOptions, expectedCurrencyOwed0 = _options$collectOptio.expectedCurrencyOwed0, expectedCurrencyOwed1 = _options$collectOptio.expectedCurrencyOwed1, rest = _objectWithoutPropertiesLoose(_options$collectOptio, _excluded); + calldatas.push.apply(calldatas, NonfungiblePositionManager2.encodeCollect(_extends({ + tokenId: toHex(options.tokenId), + // add the underlying value to the expected currency already owed + expectedCurrencyOwed0: expectedCurrencyOwed0.add(sdkCore.CurrencyAmount.fromRawAmount(expectedCurrencyOwed0.currency, amount0Min)), + expectedCurrencyOwed1: expectedCurrencyOwed1.add(sdkCore.CurrencyAmount.fromRawAmount(expectedCurrencyOwed1.currency, amount1Min)) + }, rest))); + if (options.liquidityPercentage.equalTo(ONE)) { + if (options.burnToken) { + calldatas.push(NonfungiblePositionManager2.INTERFACE.encodeFunctionData("burn", [tokenId])); + } + } else { + !(options.burnToken !== true) ? invariant(false, "CANNOT_BURN") : void 0; + } + return { + calldata: Multicall.encodeMulticall(calldatas), + value: toHex(0) + }; + }; + NonfungiblePositionManager2.safeTransferFromParameters = function safeTransferFromParameters(options) { + var recipient = sdkCore.validateAndParseAddress(options.recipient); + var sender = sdkCore.validateAndParseAddress(options.sender); + var calldata; + if (options.data) { + calldata = NonfungiblePositionManager2.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256,bytes)", [sender, recipient, toHex(options.tokenId), options.data]); + } else { + calldata = NonfungiblePositionManager2.INTERFACE.encodeFunctionData("safeTransferFrom(address,address,uint256)", [sender, recipient, toHex(options.tokenId)]); + } + return { + calldata, + value: toHex(0) + }; + }; + return NonfungiblePositionManager2; + }(); + NonfungiblePositionManager.INTERFACE = /* @__PURE__ */ new abi.Interface(INonfungiblePositionManager.abi); + var SwapQuoter = /* @__PURE__ */ function() { + function SwapQuoter2() { + } + SwapQuoter2.quoteCallParameters = function quoteCallParameters(route, amount, tradeType, options) { + if (options === void 0) { + options = {}; + } + var singleHop = route.pools.length === 1; + var quoteAmount = toHex(amount.quotient); + var calldata; + var swapInterface = options.useQuoterV2 ? this.V2INTERFACE : this.V1INTERFACE; + if (singleHop) { + var _options$sqrtPriceLim, _options; + var baseQuoteParams = { + tokenIn: route.tokenPath[0].address, + tokenOut: route.tokenPath[1].address, + fee: route.pools[0].fee, + sqrtPriceLimitX96: toHex((_options$sqrtPriceLim = (_options = options) == null ? void 0 : _options.sqrtPriceLimitX96) != null ? _options$sqrtPriceLim : 0) + }; + var v2QuoteParams = _extends({}, baseQuoteParams, tradeType === sdkCore.TradeType.EXACT_INPUT ? { + amountIn: quoteAmount + } : { + amount: quoteAmount + }); + var v1QuoteParams = [baseQuoteParams.tokenIn, baseQuoteParams.tokenOut, baseQuoteParams.fee, quoteAmount, baseQuoteParams.sqrtPriceLimitX96]; + var tradeTypeFunctionName = tradeType === sdkCore.TradeType.EXACT_INPUT ? "quoteExactInputSingle" : "quoteExactOutputSingle"; + calldata = swapInterface.encodeFunctionData(tradeTypeFunctionName, options.useQuoterV2 ? [v2QuoteParams] : v1QuoteParams); + } else { + var _options2; + !(((_options2 = options) == null ? void 0 : _options2.sqrtPriceLimitX96) === void 0) ? invariant(false, "MULTIHOP_PRICE_LIMIT") : void 0; + var path = encodeRouteToPath(route, tradeType === sdkCore.TradeType.EXACT_OUTPUT); + var _tradeTypeFunctionName = tradeType === sdkCore.TradeType.EXACT_INPUT ? "quoteExactInput" : "quoteExactOutput"; + calldata = swapInterface.encodeFunctionData(_tradeTypeFunctionName, [path, quoteAmount]); + } + return { + calldata, + value: toHex(0) + }; + }; + return SwapQuoter2; + }(); + SwapQuoter.V1INTERFACE = /* @__PURE__ */ new abi.Interface(IQuoter.abi); + SwapQuoter.V2INTERFACE = /* @__PURE__ */ new abi.Interface(IQuoterV2.abi); + var Staker = /* @__PURE__ */ function() { + function Staker2() { + } + Staker2.encodeClaim = function encodeClaim(incentiveKey, options) { + var _options$amount; + var calldatas = []; + calldatas.push(Staker2.INTERFACE.encodeFunctionData("unstakeToken", [this._encodeIncentiveKey(incentiveKey), toHex(options.tokenId)])); + var recipient = sdkCore.validateAndParseAddress(options.recipient); + var amount = (_options$amount = options.amount) != null ? _options$amount : 0; + calldatas.push(Staker2.INTERFACE.encodeFunctionData("claimReward", [incentiveKey.rewardToken.address, recipient, toHex(amount)])); + return calldatas; + }; + Staker2.collectRewards = function collectRewards(incentiveKeys, options) { + incentiveKeys = Array.isArray(incentiveKeys) ? incentiveKeys : [incentiveKeys]; + var calldatas = []; + for (var i = 0; i < incentiveKeys.length; i++) { + var incentiveKey = incentiveKeys[i]; + calldatas = calldatas.concat(this.encodeClaim(incentiveKey, options)); + calldatas.push(Staker2.INTERFACE.encodeFunctionData("stakeToken", [this._encodeIncentiveKey(incentiveKey), toHex(options.tokenId)])); + } + return { + calldata: Multicall.encodeMulticall(calldatas), + value: toHex(0) + }; + }; + Staker2.withdrawToken = function withdrawToken(incentiveKeys, withdrawOptions) { + var calldatas = []; + incentiveKeys = Array.isArray(incentiveKeys) ? incentiveKeys : [incentiveKeys]; + var claimOptions = { + tokenId: withdrawOptions.tokenId, + recipient: withdrawOptions.recipient, + amount: withdrawOptions.amount + }; + for (var i = 0; i < incentiveKeys.length; i++) { + var incentiveKey = incentiveKeys[i]; + calldatas = calldatas.concat(this.encodeClaim(incentiveKey, claimOptions)); + } + var owner = sdkCore.validateAndParseAddress(withdrawOptions.owner); + calldatas.push(Staker2.INTERFACE.encodeFunctionData("withdrawToken", [toHex(withdrawOptions.tokenId), owner, withdrawOptions.data ? withdrawOptions.data : toHex(0)])); + return { + calldata: Multicall.encodeMulticall(calldatas), + value: toHex(0) + }; + }; + Staker2.encodeDeposit = function encodeDeposit(incentiveKeys) { + incentiveKeys = Array.isArray(incentiveKeys) ? incentiveKeys : [incentiveKeys]; + var data; + if (incentiveKeys.length > 1) { + var keys = []; + for (var i = 0; i < incentiveKeys.length; i++) { + var incentiveKey = incentiveKeys[i]; + keys.push(this._encodeIncentiveKey(incentiveKey)); + } + data = abi.defaultAbiCoder.encode([Staker2.INCENTIVE_KEY_ABI + "[]"], [keys]); + } else { + data = abi.defaultAbiCoder.encode([Staker2.INCENTIVE_KEY_ABI], [this._encodeIncentiveKey(incentiveKeys[0])]); + } + return data; + }; + Staker2._encodeIncentiveKey = function _encodeIncentiveKey(incentiveKey) { + var _incentiveKey$pool = incentiveKey.pool, token0 = _incentiveKey$pool.token0, token1 = _incentiveKey$pool.token1, fee = _incentiveKey$pool.fee; + var refundee = sdkCore.validateAndParseAddress(incentiveKey.refundee); + return { + rewardToken: incentiveKey.rewardToken.address, + pool: Pool.getAddress(token0, token1, fee), + startTime: toHex(incentiveKey.startTime), + endTime: toHex(incentiveKey.endTime), + refundee + }; + }; + return Staker2; + }(); + Staker.INTERFACE = /* @__PURE__ */ new abi.Interface(IUniswapV3Staker.abi); + Staker.INCENTIVE_KEY_ABI = "tuple(address rewardToken, address pool, uint256 startTime, uint256 endTime, address refundee)"; + var SwapRouter = /* @__PURE__ */ function() { + function SwapRouter2() { + } + SwapRouter2.swapCallParameters = function swapCallParameters(trades, options) { + if (!Array.isArray(trades)) { + trades = [trades]; + } + var sampleTrade = trades[0]; + var tokenIn = sampleTrade.inputAmount.currency.wrapped; + var tokenOut = sampleTrade.outputAmount.currency.wrapped; + !trades.every(function(trade2) { + return trade2.inputAmount.currency.wrapped.equals(tokenIn); + }) ? invariant(false, "TOKEN_IN_DIFF") : void 0; + !trades.every(function(trade2) { + return trade2.outputAmount.currency.wrapped.equals(tokenOut); + }) ? invariant(false, "TOKEN_OUT_DIFF") : void 0; + var calldatas = []; + var ZERO_IN = sdkCore.CurrencyAmount.fromRawAmount(trades[0].inputAmount.currency, 0); + var ZERO_OUT = sdkCore.CurrencyAmount.fromRawAmount(trades[0].outputAmount.currency, 0); + var totalAmountOut = trades.reduce(function(sum, trade2) { + return sum.add(trade2.minimumAmountOut(options.slippageTolerance)); + }, ZERO_OUT); + var mustRefund = sampleTrade.inputAmount.currency.isNative && sampleTrade.tradeType === sdkCore.TradeType.EXACT_OUTPUT; + var inputIsNative = sampleTrade.inputAmount.currency.isNative; + var outputIsNative = sampleTrade.outputAmount.currency.isNative; + var routerMustCustody = outputIsNative || !!options.fee; + var totalValue = inputIsNative ? trades.reduce(function(sum, trade2) { + return sum.add(trade2.maximumAmountIn(options.slippageTolerance)); + }, ZERO_IN) : ZERO_IN; + if (options.inputTokenPermit) { + !sampleTrade.inputAmount.currency.isToken ? invariant(false, "NON_TOKEN_PERMIT") : void 0; + calldatas.push(SelfPermit.encodePermit(sampleTrade.inputAmount.currency, options.inputTokenPermit)); + } + var recipient = sdkCore.validateAndParseAddress(options.recipient); + var deadline = toHex(options.deadline); + for (var _iterator = _createForOfIteratorHelperLoose(trades), _step; !(_step = _iterator()).done; ) { + var trade = _step.value; + for (var _iterator2 = _createForOfIteratorHelperLoose(trade.swaps), _step2; !(_step2 = _iterator2()).done; ) { + var _step2$value = _step2.value, route = _step2$value.route, inputAmount = _step2$value.inputAmount, outputAmount = _step2$value.outputAmount; + var amountIn = toHex(trade.maximumAmountIn(options.slippageTolerance, inputAmount).quotient); + var amountOut = toHex(trade.minimumAmountOut(options.slippageTolerance, outputAmount).quotient); + var singleHop = route.pools.length === 1; + if (singleHop) { + if (trade.tradeType === sdkCore.TradeType.EXACT_INPUT) { + var _options$sqrtPriceLim; + var exactInputSingleParams = { + tokenIn: route.tokenPath[0].address, + tokenOut: route.tokenPath[1].address, + fee: route.pools[0].fee, + recipient: routerMustCustody ? ADDRESS_ZERO : recipient, + deadline, + amountIn, + amountOutMinimum: amountOut, + sqrtPriceLimitX96: toHex((_options$sqrtPriceLim = options.sqrtPriceLimitX96) != null ? _options$sqrtPriceLim : 0) + }; + calldatas.push(SwapRouter2.INTERFACE.encodeFunctionData("exactInputSingle", [exactInputSingleParams])); + } else { + var _options$sqrtPriceLim2; + var exactOutputSingleParams = { + tokenIn: route.tokenPath[0].address, + tokenOut: route.tokenPath[1].address, + fee: route.pools[0].fee, + recipient: routerMustCustody ? ADDRESS_ZERO : recipient, + deadline, + amountOut, + amountInMaximum: amountIn, + sqrtPriceLimitX96: toHex((_options$sqrtPriceLim2 = options.sqrtPriceLimitX96) != null ? _options$sqrtPriceLim2 : 0) + }; + calldatas.push(SwapRouter2.INTERFACE.encodeFunctionData("exactOutputSingle", [exactOutputSingleParams])); + } + } else { + !(options.sqrtPriceLimitX96 === void 0) ? invariant(false, "MULTIHOP_PRICE_LIMIT") : void 0; + var path = encodeRouteToPath(route, trade.tradeType === sdkCore.TradeType.EXACT_OUTPUT); + if (trade.tradeType === sdkCore.TradeType.EXACT_INPUT) { + var exactInputParams = { + path, + recipient: routerMustCustody ? ADDRESS_ZERO : recipient, + deadline, + amountIn, + amountOutMinimum: amountOut + }; + calldatas.push(SwapRouter2.INTERFACE.encodeFunctionData("exactInput", [exactInputParams])); + } else { + var exactOutputParams = { + path, + recipient: routerMustCustody ? ADDRESS_ZERO : recipient, + deadline, + amountOut, + amountInMaximum: amountIn + }; + calldatas.push(SwapRouter2.INTERFACE.encodeFunctionData("exactOutput", [exactOutputParams])); + } + } + } + } + if (routerMustCustody) { + if (!!options.fee) { + if (outputIsNative) { + calldatas.push(Payments.encodeUnwrapWETH9(totalAmountOut.quotient, recipient, options.fee)); + } else { + calldatas.push(Payments.encodeSweepToken(sampleTrade.outputAmount.currency.wrapped, totalAmountOut.quotient, recipient, options.fee)); + } + } else { + calldatas.push(Payments.encodeUnwrapWETH9(totalAmountOut.quotient, recipient)); + } + } + if (mustRefund) { + calldatas.push(Payments.encodeRefundETH()); + } + return { + calldata: Multicall.encodeMulticall(calldatas), + value: toHex(totalValue.quotient) + }; + }; + return SwapRouter2; + }(); + SwapRouter.INTERFACE = /* @__PURE__ */ new abi.Interface(ISwapRouter.abi); + exports2.ADDRESS_ZERO = ADDRESS_ZERO; + exports2.FACTORY_ADDRESS = FACTORY_ADDRESS; + exports2.FullMath = FullMath; + exports2.LiquidityMath = LiquidityMath; + exports2.Multicall = Multicall; + exports2.NoTickDataProvider = NoTickDataProvider; + exports2.NonfungiblePositionManager = NonfungiblePositionManager; + exports2.POOL_INIT_CODE_HASH = POOL_INIT_CODE_HASH; + exports2.Payments = Payments; + exports2.Pool = Pool; + exports2.Position = Position; + exports2.PositionLibrary = PositionLibrary; + exports2.Route = Route; + exports2.SelfPermit = SelfPermit; + exports2.SqrtPriceMath = SqrtPriceMath2; + exports2.Staker = Staker; + exports2.SwapMath = SwapMath; + exports2.SwapQuoter = SwapQuoter; + exports2.SwapRouter = SwapRouter; + exports2.TICK_SPACINGS = TICK_SPACINGS; + exports2.Tick = Tick; + exports2.TickLibrary = TickLibrary; + exports2.TickList = TickList; + exports2.TickListDataProvider = TickListDataProvider; + exports2.TickMath = TickMath; + exports2.Trade = Trade; + exports2.computePoolAddress = computePoolAddress; + exports2.encodeRouteToPath = encodeRouteToPath; + exports2.encodeSqrtRatioX96 = encodeSqrtRatioX96; + exports2.isSorted = isSorted; + exports2.maxLiquidityForAmounts = maxLiquidityForAmounts; + exports2.mostSignificantBit = mostSignificantBit; + exports2.nearestUsableTick = nearestUsableTick; + exports2.priceToClosestTick = priceToClosestTick; + exports2.subIn256 = subIn256; + exports2.tickToPrice = tickToPrice; + exports2.toHex = toHex; + exports2.tradeComparator = tradeComparator; + } +}); + +// node_modules/@uniswap/v3-sdk/dist/index.js +var require_dist2 = __commonJS({ + "node_modules/@uniswap/v3-sdk/dist/index.js"(exports2, module2) { + "use strict"; + if (process.env.NODE_ENV === "production") { + module2.exports = require_v3_sdk_cjs_production_min(); + } else { + module2.exports = require_v3_sdk_cjs_development(); + } + } +}); + +// src/getModifyLiquidityResult.ts +var import_ethers = __toESM(require_lib31()); +var import_jsbi2 = __toESM(require_jsbi_cjs()); + +// src/utils/shared.ts +var import_decimal = __toESM(require_decimal()); +var import_jsbi = __toESM(require_jsbi_cjs()); +var import_v3_sdk = __toESM(require_dist2()); +var JSBI_ZERO = import_jsbi.default.BigInt(0); +function getSqrtPriceAtTick(tick) { + return new import_decimal.default(1.0001).pow(tick).sqrt().mul(new import_decimal.default(2).pow(96)).toFixed(0); +} +function getAmount0Delta(sqrtPriceAX96, sqrtPriceBX96, liquidity2) { + if (import_jsbi.default.lessThan(liquidity2, JSBI_ZERO)) { + return import_v3_sdk.SqrtPriceMath.getAmount0Delta(sqrtPriceAX96, sqrtPriceBX96, import_jsbi.default.unaryMinus(liquidity2), false); + } else { + return import_jsbi.default.unaryMinus(import_v3_sdk.SqrtPriceMath.getAmount0Delta(sqrtPriceAX96, sqrtPriceBX96, liquidity2, true)); + } +} +function getAmount1Delta(sqrtPriceAX96, sqrtPriceBX96, liquidity2) { + if (import_jsbi.default.lessThan(liquidity2, JSBI_ZERO)) { + return import_v3_sdk.SqrtPriceMath.getAmount1Delta(sqrtPriceAX96, sqrtPriceBX96, import_jsbi.default.unaryMinus(liquidity2), false); + } else { + return import_jsbi.default.unaryMinus(import_v3_sdk.SqrtPriceMath.getAmount1Delta(sqrtPriceAX96, sqrtPriceBX96, liquidity2, true)); + } +} + +// src/getModifyLiquidityResult.ts +var params = process.argv[2].split(","); +var tickLower = params[0]; +var tickUpper = params[1]; +var liquidity = params[2]; +var slot0Tick = params[3]; +var slot0Price = params[4]; +var result = modifyLiquidity(tickLower, tickUpper, liquidity, slot0Tick, slot0Price); +process.stdout.write(import_ethers.ethers.utils.defaultAbiCoder.encode(["int128[]"], [result])); +function modifyLiquidity(_tickLower, _tickUpper, _liquidity, slot0Tick2, slot0Price2) { + const liquidity2 = import_jsbi2.default.BigInt(_liquidity); + if (import_jsbi2.default.EQ(liquidity2, 0)) { + return [JSBI_ZERO.toString(), JSBI_ZERO.toString()]; + } + const tick = import_jsbi2.default.BigInt(slot0Tick2); + const sqrtPriceX96 = import_jsbi2.default.BigInt(slot0Price2); + const tickLower2 = import_jsbi2.default.BigInt(_tickLower); + const tickUpper2 = import_jsbi2.default.BigInt(_tickUpper); + let delta = []; + if (import_jsbi2.default.LT(tick, tickLower2)) { + let priceLower = import_jsbi2.default.BigInt(getSqrtPriceAtTick(_tickLower)); + let priceUpper = import_jsbi2.default.BigInt(getSqrtPriceAtTick(_tickUpper)); + let amount0 = getAmount0Delta(priceLower, priceUpper, liquidity2); + delta.push(amount0.toString()); + delta.push(JSBI_ZERO.toString()); + } else if (import_jsbi2.default.LT(tick, tickUpper2)) { + let priceUpper = import_jsbi2.default.BigInt(getSqrtPriceAtTick(_tickUpper)); + let priceLower = import_jsbi2.default.BigInt(getSqrtPriceAtTick(_tickLower)); + if (import_jsbi2.default.EQ(tickLower2, tick)) { + priceLower = sqrtPriceX96; + } + let amount0 = getAmount0Delta(sqrtPriceX96, priceUpper, liquidity2); + let amount1 = getAmount1Delta(priceLower, sqrtPriceX96, liquidity2); + delta.push(amount0.toString()); + delta.push(amount1.toString()); + } else { + let priceLower = import_jsbi2.default.BigInt(getSqrtPriceAtTick(_tickLower)); + let priceUpper = import_jsbi2.default.BigInt(getSqrtPriceAtTick(_tickUpper)); + let amount1 = getAmount1Delta(priceLower, priceUpper, liquidity2); + delta.push(JSBI_ZERO.toString()); + delta.push(amount1.toString()); + } + return delta; +} +/*! Bundled license information: + +js-sha3/src/sha3.js: + (** + * [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 + *) + +decimal.js-light/decimal.js: + (*! decimal.js-light v2.5.1 https://github.com/MikeMcl/decimal.js-light/LICENCE *) +*/ diff --git a/test/js-scripts/dist/getSqrtPriceAtTick.js b/test/js-scripts/dist/getSqrtPriceAtTick.js new file mode 100644 index 000000000..cfb2bbc1a --- /dev/null +++ b/test/js-scripts/dist/getSqrtPriceAtTick.js @@ -0,0 +1,34131 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); + +// node_modules/decimal.js/decimal.js +var require_decimal = __commonJS({ + "node_modules/decimal.js/decimal.js"(exports2, module2) { + (function(globalScope) { + "use strict"; + var EXP_LIMIT = 9e15, MAX_DIGITS = 1e9, NUMERALS = "0123456789abcdef", LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", DEFAULTS = { + // These values must be integers within the stated ranges (inclusive). + // Most of these values can be changed at run-time using the `Decimal.config` method. + // The maximum number of significant digits of the result of a calculation or base conversion. + // E.g. `Decimal.config({ precision: 20 });` + precision: 20, + // 1 to MAX_DIGITS + // The rounding mode used when rounding to `precision`. + // + // ROUND_UP 0 Away from zero. + // ROUND_DOWN 1 Towards zero. + // ROUND_CEIL 2 Towards +Infinity. + // ROUND_FLOOR 3 Towards -Infinity. + // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + // + // E.g. + // `Decimal.rounding = 4;` + // `Decimal.rounding = Decimal.ROUND_HALF_UP;` + rounding: 4, + // 0 to 8 + // The modulo mode used when calculating the modulus: a mod n. + // The quotient (q = a / n) is calculated according to the corresponding rounding mode. + // The remainder (r) is calculated as: r = a - n * q. + // + // UP 0 The remainder is positive if the dividend is negative, else is negative. + // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 The IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. + // + // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian + // division (9) are commonly used for the modulus operation. The other rounding modes can also + // be used, but they may not give useful results. + modulo: 1, + // 0 to 9 + // The exponent value at and beneath which `toString` returns exponential notation. + // JavaScript numbers: -7 + toExpNeg: -7, + // 0 to -EXP_LIMIT + // The exponent value at and above which `toString` returns exponential notation. + // JavaScript numbers: 21 + toExpPos: 21, + // 0 to EXP_LIMIT + // The minimum exponent value, beneath which underflow to zero occurs. + // JavaScript numbers: -324 (5e-324) + minE: -EXP_LIMIT, + // -1 to -EXP_LIMIT + // The maximum exponent value, above which overflow to Infinity occurs. + // JavaScript numbers: 308 (1.7976931348623157e+308) + maxE: EXP_LIMIT, + // 1 to EXP_LIMIT + // Whether to use cryptographically-secure random number generation, if available. + crypto: false + // true/false + }, Decimal2, inexact, noConflict, quadrant, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", precisionLimitExceeded = decimalError + "Precision limit exceeded", cryptoUnavailable = decimalError + "crypto unavailable", tag = "[object Decimal]", mathfloor = Math.floor, mathpow = Math.pow, isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, LN10_PRECISION = LN10.length - 1, PI_PRECISION = PI.length - 1, P = { toStringTag: tag }; + P.absoluteValue = P.abs = function() { + var x = new this.constructor(this); + if (x.s < 0) x.s = 1; + return finalise(x); + }; + P.ceil = function() { + return finalise(new this.constructor(this), this.e + 1, 2); + }; + P.clampedTo = P.clamp = function(min2, max2) { + var k, x = this, Ctor = x.constructor; + min2 = new Ctor(min2); + max2 = new Ctor(max2); + if (!min2.s || !max2.s) return new Ctor(NaN); + if (min2.gt(max2)) throw Error(invalidArgument + max2); + k = x.cmp(min2); + return k < 0 ? min2 : x.cmp(max2) > 0 ? max2 : new Ctor(x); + }; + P.comparedTo = P.cmp = function(y) { + var i, j, xdL, ydL, x = this, xd = x.d, yd = (y = new x.constructor(y)).d, xs = x.s, ys = y.s; + if (!xd || !yd) { + return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; + } + if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; + if (xs !== ys) return xs; + if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; + xdL = xd.length; + ydL = yd.length; + for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { + if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; + } + return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; + }; + P.cosine = P.cos = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.d) return new Ctor(NaN); + if (!x.d[0]) return new Ctor(1); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); + }; + P.cubeRoot = P.cbrt = function() { + var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + external = false; + s = x.s * mathpow(x.s * x, 1 / 3); + if (!s || Math.abs(s) == 1 / 0) { + n = digitsToString(x.d); + e = x.e; + if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? "0" : "00"; + s = mathpow(n, 1 / 3); + e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new Ctor(n); + r.s = x.s; + } else { + r = new Ctor(s.toString()); + } + sd = (e = Ctor.precision) + 3; + for (; ; ) { + t = r; + t3 = t.times(t).times(t); + t3plusx = t3.plus(x); + r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + if (n == "9999" || !rep && n == "4999") { + if (!rep) { + finalise(t, e + 1, 0); + if (t.times(t).times(t).eq(x)) { + r = t; + break; + } + } + sd += 4; + rep = 1; + } else { + if (!+n || !+n.slice(1) && n.charAt(0) == "5") { + finalise(r, e + 1, 1); + m = !r.times(r).times(r).eq(x); + } + break; + } + } + } + external = true; + return finalise(r, e, Ctor.rounding, m); + }; + P.decimalPlaces = P.dp = function() { + var w, d = this.d, n = NaN; + if (d) { + w = d.length - 1; + n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; + w = d[w]; + if (w) for (; w % 10 == 0; w /= 10) n--; + if (n < 0) n = 0; + } + return n; + }; + P.dividedBy = P.div = function(y) { + return divide(this, new this.constructor(y)); + }; + P.dividedToIntegerBy = P.divToInt = function(y) { + var x = this, Ctor = x.constructor; + return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); + }; + P.equals = P.eq = function(y) { + return this.cmp(y) === 0; + }; + P.floor = function() { + return finalise(new this.constructor(this), this.e + 1, 3); + }; + P.greaterThan = P.gt = function(y) { + return this.cmp(y) > 0; + }; + P.greaterThanOrEqualTo = P.gte = function(y) { + var k = this.cmp(y); + return k == 1 || k === 0; + }; + P.hyperbolicCosine = P.cosh = function() { + var k, n, pr, rm, len, x = this, Ctor = x.constructor, one = new Ctor(1); + if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); + if (x.isZero()) return one; + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + n = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + n = "2.3283064365386962890625e-10"; + } + x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); + var cosh2_x, i = k, d8 = new Ctor(8); + for (; i--; ) { + cosh2_x = x.times(x); + x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); + } + return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + P.hyperbolicSine = P.sinh = function() { + var k, pr, rm, len, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + if (len < 3) { + x = taylorSeries(Ctor, 2, x, x, true); + } else { + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x, true); + var sinh2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); + for (; k--; ) { + sinh2_x = x.times(x); + x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); + } + } + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(x, pr, rm, true); + }; + P.hyperbolicTangent = P.tanh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(x.s); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 7; + Ctor.rounding = 1; + return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); + }; + P.inverseCosine = P.acos = function() { + var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding; + if (k !== -1) { + return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN); + } + if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); + Ctor.precision = pr + 6; + Ctor.rounding = 1; + x = x.asin(); + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + Ctor.precision = pr; + Ctor.rounding = rm; + return halfPi.minus(x); + }; + P.inverseHyperbolicCosine = P.acosh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); + if (!x.isFinite()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; + Ctor.rounding = 1; + external = false; + x = x.times(x).minus(1).sqrt().plus(x); + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + return x.ln(); + }; + P.inverseHyperbolicSine = P.asinh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; + Ctor.rounding = 1; + external = false; + x = x.times(x).plus(1).sqrt().plus(x); + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + return x.ln(); + }; + P.inverseHyperbolicTangent = P.atanh = function() { + var pr, rm, wpr, xsd, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); + pr = Ctor.precision; + rm = Ctor.rounding; + xsd = x.sd(); + if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); + Ctor.precision = wpr = xsd - x.e; + x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); + Ctor.precision = pr + 4; + Ctor.rounding = 1; + x = x.ln(); + Ctor.precision = pr; + Ctor.rounding = rm; + return x.times(0.5); + }; + P.inverseSine = P.asin = function() { + var halfPi, k, pr, rm, x = this, Ctor = x.constructor; + if (x.isZero()) return new Ctor(x); + k = x.abs().cmp(1); + pr = Ctor.precision; + rm = Ctor.rounding; + if (k !== -1) { + if (k === 0) { + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + halfPi.s = x.s; + return halfPi; + } + return new Ctor(NaN); + } + Ctor.precision = pr + 6; + Ctor.rounding = 1; + x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); + Ctor.precision = pr; + Ctor.rounding = rm; + return x.times(2); + }; + P.inverseTangent = P.atan = function() { + var i, j, k, n, px, t, r, wpr, x2, x = this, Ctor = x.constructor, pr = Ctor.precision, rm = Ctor.rounding; + if (!x.isFinite()) { + if (!x.s) return new Ctor(NaN); + if (pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.5); + r.s = x.s; + return r; + } + } else if (x.isZero()) { + return new Ctor(x); + } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.25); + r.s = x.s; + return r; + } + Ctor.precision = wpr = pr + 10; + Ctor.rounding = 1; + k = Math.min(28, wpr / LOG_BASE + 2 | 0); + for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); + external = false; + j = Math.ceil(wpr / LOG_BASE); + n = 1; + x2 = x.times(x); + r = new Ctor(x); + px = x; + for (; i !== -1; ) { + px = px.times(x2); + t = r.minus(px.div(n += 2)); + px = px.times(x2); + r = t.plus(px.div(n += 2)); + if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--; ) ; + } + if (k) r = r.times(2 << k - 1); + external = true; + return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + P.isFinite = function() { + return !!this.d; + }; + P.isInteger = P.isInt = function() { + return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; + }; + P.isNaN = function() { + return !this.s; + }; + P.isNegative = P.isNeg = function() { + return this.s < 0; + }; + P.isPositive = P.isPos = function() { + return this.s > 0; + }; + P.isZero = function() { + return !!this.d && this.d[0] === 0; + }; + P.lessThan = P.lt = function(y) { + return this.cmp(y) < 0; + }; + P.lessThanOrEqualTo = P.lte = function(y) { + return this.cmp(y) < 1; + }; + P.logarithm = P.log = function(base) { + var isBase10, d, denominator, k, inf, num, sd, r, arg = this, Ctor = arg.constructor, pr = Ctor.precision, rm = Ctor.rounding, guard = 5; + if (base == null) { + base = new Ctor(10); + isBase10 = true; + } else { + base = new Ctor(base); + d = base.d; + if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); + isBase10 = base.eq(10); + } + d = arg.d; + if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { + return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); + } + if (isBase10) { + if (d.length > 1) { + inf = true; + } else { + for (k = d[0]; k % 10 === 0; ) k /= 10; + inf = k !== 1; + } + } + external = false; + sd = pr + guard; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + if (checkRoundingDigits(r.d, k = pr, rm)) { + do { + sd += 10; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + if (!inf) { + if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + break; + } + } while (checkRoundingDigits(r.d, k += 10, rm)); + } + external = true; + return finalise(r, pr, rm); + }; + P.minus = P.sub = function(y) { + var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.d) { + if (!x.s || !y.s) y = new Ctor(NaN); + else if (x.d) y.s = -y.s; + else y = new Ctor(y.d || x.s !== y.s ? x : NaN); + return y; + } + if (x.s != y.s) { + y.s = -y.s; + return x.plus(y); + } + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + if (!xd[0] || !yd[0]) { + if (yd[0]) y.s = -y.s; + else if (xd[0]) y = new Ctor(x); + else return new Ctor(rm === 3 ? -0 : 0); + return external ? finalise(y, pr, rm) : y; + } + e = mathfloor(y.e / LOG_BASE); + xe = mathfloor(x.e / LOG_BASE); + xd = xd.slice(); + k = xe - e; + if (k) { + xLTy = k < 0; + if (xLTy) { + d = xd; + k = -k; + len = yd.length; + } else { + d = yd; + e = xe; + len = xd.length; + } + i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; + if (k > i) { + k = i; + d.length = 1; + } + d.reverse(); + for (i = k; i--; ) d.push(0); + d.reverse(); + } else { + i = xd.length; + len = yd.length; + xLTy = i < len; + if (xLTy) len = i; + for (i = 0; i < len; i++) { + if (xd[i] != yd[i]) { + xLTy = xd[i] < yd[i]; + break; + } + } + k = 0; + } + if (xLTy) { + d = xd; + xd = yd; + yd = d; + y.s = -y.s; + } + len = xd.length; + for (i = yd.length - len; i > 0; --i) xd[len++] = 0; + for (i = yd.length; i > k; ) { + if (xd[--i] < yd[i]) { + for (j = i; j && xd[--j] === 0; ) xd[j] = BASE - 1; + --xd[j]; + xd[i] += BASE; + } + xd[i] -= yd[i]; + } + for (; xd[--len] === 0; ) xd.pop(); + for (; xd[0] === 0; xd.shift()) --e; + if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); + y.d = xd; + y.e = getBase10Exponent(xd, e); + return external ? finalise(y, pr, rm) : y; + }; + P.modulo = P.mod = function(y) { + var q, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); + if (!y.d || x.d && !x.d[0]) { + return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); + } + external = false; + if (Ctor.modulo == 9) { + q = divide(x, y.abs(), 0, 3, 1); + q.s *= y.s; + } else { + q = divide(x, y, 0, Ctor.modulo, 1); + } + q = q.times(y); + external = true; + return x.minus(q); + }; + P.naturalExponential = P.exp = function() { + return naturalExponential(this); + }; + P.naturalLogarithm = P.ln = function() { + return naturalLogarithm(this); + }; + P.negated = P.neg = function() { + var x = new this.constructor(this); + x.s = -x.s; + return finalise(x); + }; + P.plus = P.add = function(y) { + var carry, d, e, i, k, len, pr, rm, xd, yd, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.d) { + if (!x.s || !y.s) y = new Ctor(NaN); + else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); + return y; + } + if (x.s != y.s) { + y.s = -y.s; + return x.minus(y); + } + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + if (!xd[0] || !yd[0]) { + if (!yd[0]) y = new Ctor(x); + return external ? finalise(y, pr, rm) : y; + } + k = mathfloor(x.e / LOG_BASE); + e = mathfloor(y.e / LOG_BASE); + xd = xd.slice(); + i = k - e; + if (i) { + if (i < 0) { + d = xd; + i = -i; + len = yd.length; + } else { + d = yd; + e = k; + len = xd.length; + } + k = Math.ceil(pr / LOG_BASE); + len = k > len ? k + 1 : len + 1; + if (i > len) { + i = len; + d.length = 1; + } + d.reverse(); + for (; i--; ) d.push(0); + d.reverse(); + } + len = xd.length; + i = yd.length; + if (len - i < 0) { + i = len; + d = yd; + yd = xd; + xd = d; + } + for (carry = 0; i; ) { + carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; + xd[i] %= BASE; + } + if (carry) { + xd.unshift(carry); + ++e; + } + for (len = xd.length; xd[--len] == 0; ) xd.pop(); + y.d = xd; + y.e = getBase10Exponent(xd, e); + return external ? finalise(y, pr, rm) : y; + }; + P.precision = P.sd = function(z) { + var k, x = this; + if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); + if (x.d) { + k = getPrecision(x.d); + if (z && x.e + 1 > k) k = x.e + 1; + } else { + k = NaN; + } + return k; + }; + P.round = function() { + var x = this, Ctor = x.constructor; + return finalise(new Ctor(x), x.e + 1, Ctor.rounding); + }; + P.sine = P.sin = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + x = sine(Ctor, toLessThanHalfPi(Ctor, x)); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); + }; + P.squareRoot = P.sqrt = function() { + var m, n, sd, r, rep, t, x = this, d = x.d, e = x.e, s = x.s, Ctor = x.constructor; + if (s !== 1 || !d || !d[0]) { + return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); + } + external = false; + s = Math.sqrt(+x); + if (s == 0 || s == 1 / 0) { + n = digitsToString(d); + if ((n.length + e) % 2 == 0) n += "0"; + s = Math.sqrt(n); + e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new Ctor(n); + } else { + r = new Ctor(s.toString()); + } + sd = (e = Ctor.precision) + 3; + for (; ; ) { + t = r; + r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + if (n == "9999" || !rep && n == "4999") { + if (!rep) { + finalise(t, e + 1, 0); + if (t.times(t).eq(x)) { + r = t; + break; + } + } + sd += 4; + rep = 1; + } else { + if (!+n || !+n.slice(1) && n.charAt(0) == "5") { + finalise(r, e + 1, 1); + m = !r.times(r).eq(x); + } + break; + } + } + } + external = true; + return finalise(r, e, Ctor.rounding, m); + }; + P.tangent = P.tan = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 10; + Ctor.rounding = 1; + x = x.sin(); + x.s = 1; + x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); + }; + P.times = P.mul = function(y) { + var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d; + y.s *= x.s; + if (!xd || !xd[0] || !yd || !yd[0]) { + return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd ? NaN : !xd || !yd ? y.s / 0 : y.s * 0); + } + e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); + xdL = xd.length; + ydL = yd.length; + if (xdL < ydL) { + r = xd; + xd = yd; + yd = r; + rL = xdL; + xdL = ydL; + ydL = rL; + } + r = []; + rL = xdL + ydL; + for (i = rL; i--; ) r.push(0); + for (i = ydL; --i >= 0; ) { + carry = 0; + for (k = xdL + i; k > i; ) { + t = r[k] + yd[i] * xd[k - i - 1] + carry; + r[k--] = t % BASE | 0; + carry = t / BASE | 0; + } + r[k] = (r[k] + carry) % BASE | 0; + } + for (; !r[--rL]; ) r.pop(); + if (carry) ++e; + else r.shift(); + y.d = r; + y.e = getBase10Exponent(r, e); + return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; + }; + P.toBinary = function(sd, rm) { + return toStringBinary(this, 2, sd, rm); + }; + P.toDecimalPlaces = P.toDP = function(dp, rm) { + var x = this, Ctor = x.constructor; + x = new Ctor(x); + if (dp === void 0) return x; + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + return finalise(x, dp + x.e + 1, rm); + }; + P.toExponential = function(dp, rm) { + var str, x = this, Ctor = x.constructor; + if (dp === void 0) { + str = finiteToString(x, true); + } else { + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = finalise(new Ctor(x), dp + 1, rm); + str = finiteToString(x, true, dp + 1); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toFixed = function(dp, rm) { + var str, y, x = this, Ctor = x.constructor; + if (dp === void 0) { + str = finiteToString(x); + } else { + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + y = finalise(new Ctor(x), dp + x.e + 1, rm); + str = finiteToString(y, false, dp + y.e + 1); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toFraction = function(maxD) { + var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, x = this, xd = x.d, Ctor = x.constructor; + if (!xd) return new Ctor(x); + n1 = d0 = new Ctor(1); + d1 = n0 = new Ctor(0); + d = new Ctor(d1); + e = d.e = getPrecision(xd) - x.e - 1; + k = e % LOG_BASE; + d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); + if (maxD == null) { + maxD = e > 0 ? d : n1; + } else { + n = new Ctor(maxD); + if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); + maxD = n.gt(d) ? e > 0 ? d : n1 : n; + } + external = false; + n = new Ctor(digitsToString(xd)); + pr = Ctor.precision; + Ctor.precision = e = xd.length * LOG_BASE * 2; + for (; ; ) { + q = divide(n, d, 0, 1, 1); + d2 = d0.plus(q.times(d1)); + if (d2.cmp(maxD) == 1) break; + d0 = d1; + d1 = d2; + d2 = n1; + n1 = n0.plus(q.times(d2)); + n0 = d2; + d2 = d; + d = n.minus(q.times(d2)); + n = d2; + } + d2 = divide(maxD.minus(d0), d1, 0, 1, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; + Ctor.precision = pr; + external = true; + return r; + }; + P.toHexadecimal = P.toHex = function(sd, rm) { + return toStringBinary(this, 16, sd, rm); + }; + P.toNearest = function(y, rm) { + var x = this, Ctor = x.constructor; + x = new Ctor(x); + if (y == null) { + if (!x.d) return x; + y = new Ctor(1); + rm = Ctor.rounding; + } else { + y = new Ctor(y); + if (rm === void 0) { + rm = Ctor.rounding; + } else { + checkInt32(rm, 0, 8); + } + if (!x.d) return y.s ? x : y; + if (!y.d) { + if (y.s) y.s = x.s; + return y; + } + } + if (y.d[0]) { + external = false; + x = divide(x, y, 0, rm, 1).times(y); + external = true; + finalise(x); + } else { + y.s = x.s; + x = y; + } + return x; + }; + P.toNumber = function() { + return +this; + }; + P.toOctal = function(sd, rm) { + return toStringBinary(this, 8, sd, rm); + }; + P.toPower = P.pow = function(y) { + var e, k, pr, r, rm, s, x = this, Ctor = x.constructor, yn = +(y = new Ctor(y)); + if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); + x = new Ctor(x); + if (x.eq(1)) return x; + pr = Ctor.precision; + rm = Ctor.rounding; + if (y.eq(1)) return finalise(x, pr, rm); + e = mathfloor(y.e / LOG_BASE); + if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { + r = intPow(Ctor, x, k, pr); + return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); + } + s = x.s; + if (s < 0) { + if (e < y.d.length - 1) return new Ctor(NaN); + if ((y.d[e] & 1) == 0) s = 1; + if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { + x.s = s; + return x; + } + } + k = mathpow(+x, yn); + e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log("0." + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + "").e; + if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); + external = false; + Ctor.rounding = x.s = 1; + k = Math.min(12, (e + "").length); + r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); + if (r.d) { + r = finalise(r, pr + 5, 1); + if (checkRoundingDigits(r.d, pr, rm)) { + e = pr + 10; + r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); + if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + } + } + r.s = s; + external = true; + Ctor.rounding = rm; + return finalise(r, pr, rm); + }; + P.toPrecision = function(sd, rm) { + var str, x = this, Ctor = x.constructor; + if (sd === void 0) { + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = finalise(new Ctor(x), sd, rm); + str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toSignificantDigits = P.toSD = function(sd, rm) { + var x = this, Ctor = x.constructor; + if (sd === void 0) { + sd = Ctor.precision; + rm = Ctor.rounding; + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } + return finalise(new Ctor(x), sd, rm); + }; + P.toString = function() { + var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.truncated = P.trunc = function() { + return finalise(new this.constructor(this), this.e + 1, 1); + }; + P.valueOf = P.toJSON = function() { + var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + return x.isNeg() ? "-" + str : str; + }; + function digitsToString(d) { + var i, k, ws, indexOfLastWord = d.length - 1, str = "", w = d[0]; + if (indexOfLastWord > 0) { + str += w; + for (i = 1; i < indexOfLastWord; i++) { + ws = d[i] + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + str += ws; + } + w = d[i]; + ws = w + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + } else if (w === 0) { + return "0"; + } + for (; w % 10 === 0; ) w /= 10; + return str + w; + } + function checkInt32(i, min2, max2) { + if (i !== ~~i || i < min2 || i > max2) { + throw Error(invalidArgument + i); + } + } + function checkRoundingDigits(d, i, rm, repeating) { + var di, k, r, rd; + for (k = d[0]; k >= 10; k /= 10) --i; + if (--i < 0) { + i += LOG_BASE; + di = 0; + } else { + di = Math.ceil((i + 1) / LOG_BASE); + i %= LOG_BASE; + } + k = mathpow(10, LOG_BASE - i); + rd = d[di] % k | 0; + if (repeating == null) { + if (i < 3) { + if (i == 0) rd = rd / 100 | 0; + else if (i == 1) rd = rd / 10 | 0; + r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 5e4 || rd == 0; + } else { + r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; + } + } else { + if (i < 4) { + if (i == 0) rd = rd / 1e3 | 0; + else if (i == 1) rd = rd / 100 | 0; + else if (i == 2) rd = rd / 10 | 0; + r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; + } else { + r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1e3 | 0) == mathpow(10, i - 3) - 1; + } + } + return r; + } + function convertBase(str, baseIn, baseOut) { + var j, arr = [0], arrL, i = 0, strL = str.length; + for (; i < strL; ) { + for (arrL = arr.length; arrL--; ) arr[arrL] *= baseIn; + arr[0] += NUMERALS.indexOf(str.charAt(i++)); + for (j = 0; j < arr.length; j++) { + if (arr[j] > baseOut - 1) { + if (arr[j + 1] === void 0) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + return arr.reverse(); + } + function cosine(Ctor, x) { + var k, len, y; + if (x.isZero()) return x; + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + y = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + y = "2.3283064365386962890625e-10"; + } + Ctor.precision += k; + x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); + for (var i = k; i--; ) { + var cos2x = x.times(x); + x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); + } + Ctor.precision -= k; + return x; + } + var divide = /* @__PURE__ */ function() { + function multiplyInteger(x, k, base) { + var temp, carry = 0, i = x.length; + for (x = x.slice(); i--; ) { + temp = x[i] * k + carry; + x[i] = temp % base | 0; + carry = temp / base | 0; + } + if (carry) x.unshift(carry); + return x; + } + function compare(a, b, aL, bL) { + var i, r; + if (aL != bL) { + r = aL > bL ? 1 : -1; + } else { + for (i = r = 0; i < aL; i++) { + if (a[i] != b[i]) { + r = a[i] > b[i] ? 1 : -1; + break; + } + } + } + return r; + } + function subtract(a, b, aL, base) { + var i = 0; + for (; aL--; ) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + for (; !a[0] && a.length > 1; ) a.shift(); + } + return function(x, y, pr, rm, dp, base) { + var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign2 = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d; + if (!xd || !xd[0] || !yd || !yd[0]) { + return new Ctor( + // Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : ( + // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. + xd && xd[0] == 0 || !yd ? sign2 * 0 : sign2 / 0 + ) + ); + } + if (base) { + logBase = 1; + e = x.e - y.e; + } else { + base = BASE; + logBase = LOG_BASE; + e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); + } + yL = yd.length; + xL = xd.length; + q = new Ctor(sign2); + qd = q.d = []; + for (i = 0; yd[i] == (xd[i] || 0); i++) ; + if (yd[i] > (xd[i] || 0)) e--; + if (pr == null) { + sd = pr = Ctor.precision; + rm = Ctor.rounding; + } else if (dp) { + sd = pr + (x.e - y.e) + 1; + } else { + sd = pr; + } + if (sd < 0) { + qd.push(1); + more = true; + } else { + sd = sd / logBase + 2 | 0; + i = 0; + if (yL == 1) { + k = 0; + yd = yd[0]; + sd++; + for (; (i < xL || k) && sd--; i++) { + t = k * base + (xd[i] || 0); + qd[i] = t / yd | 0; + k = t % yd | 0; + } + more = k || i < xL; + } else { + k = base / (yd[0] + 1) | 0; + if (k > 1) { + yd = multiplyInteger(yd, k, base); + xd = multiplyInteger(xd, k, base); + yL = yd.length; + xL = xd.length; + } + xi = yL; + rem = xd.slice(0, yL); + remL = rem.length; + for (; remL < yL; ) rem[remL++] = 0; + yz = yd.slice(); + yz.unshift(0); + yd0 = yd[0]; + if (yd[1] >= base / 2) ++yd0; + do { + k = 0; + cmp = compare(yd, rem, yL, remL); + if (cmp < 0) { + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + k = rem0 / yd0 | 0; + if (k > 1) { + if (k >= base) k = base - 1; + prod = multiplyInteger(yd, k, base); + prodL = prod.length; + remL = rem.length; + cmp = compare(prod, rem, prodL, remL); + if (cmp == 1) { + k--; + subtract(prod, yL < prodL ? yz : yd, prodL, base); + } + } else { + if (k == 0) cmp = k = 1; + prod = yd.slice(); + } + prodL = prod.length; + if (prodL < remL) prod.unshift(0); + subtract(rem, prod, remL, base); + if (cmp == -1) { + remL = rem.length; + cmp = compare(yd, rem, yL, remL); + if (cmp < 1) { + k++; + subtract(rem, yL < remL ? yz : yd, remL, base); + } + } + remL = rem.length; + } else if (cmp === 0) { + k++; + rem = [0]; + } + qd[i++] = k; + if (cmp && rem[0]) { + rem[remL++] = xd[xi] || 0; + } else { + rem = [xd[xi]]; + remL = 1; + } + } while ((xi++ < xL || rem[0] !== void 0) && sd--); + more = rem[0] !== void 0; + } + if (!qd[0]) qd.shift(); + } + if (logBase == 1) { + q.e = e; + inexact = more; + } else { + for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; + q.e = i + e * logBase - 1; + finalise(q, dp ? pr + q.e + 1 : pr, rm, more); + } + return q; + }; + }(); + function finalise(x, sd, rm, isTruncated) { + var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor; + out: if (sd != null) { + xd = x.d; + if (!xd) return x; + for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; + i = sd - digits; + if (i < 0) { + i += LOG_BASE; + j = sd; + w = xd[xdi = 0]; + rd = w / mathpow(10, digits - j - 1) % 10 | 0; + } else { + xdi = Math.ceil((i + 1) / LOG_BASE); + k = xd.length; + if (xdi >= k) { + if (isTruncated) { + for (; k++ <= xdi; ) xd.push(0); + w = rd = 0; + digits = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + w = k = xd[xdi]; + for (digits = 1; k >= 10; k /= 10) digits++; + i %= LOG_BASE; + j = i - LOG_BASE + digits; + rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; + } + } + isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); + roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. + (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7)); + if (sd < 1 || !xd[0]) { + xd.length = 0; + if (roundUp) { + sd -= x.e + 1; + xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); + x.e = -sd || 0; + } else { + xd[0] = x.e = 0; + } + return x; + } + if (i == 0) { + xd.length = xdi; + k = 1; + xdi--; + } else { + xd.length = xdi + 1; + k = mathpow(10, LOG_BASE - i); + xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; + } + if (roundUp) { + for (; ; ) { + if (xdi == 0) { + for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; + j = xd[0] += k; + for (k = 1; j >= 10; j /= 10) k++; + if (i != k) { + x.e++; + if (xd[0] == BASE) xd[0] = 1; + } + break; + } else { + xd[xdi] += k; + if (xd[xdi] != BASE) break; + xd[xdi--] = 0; + k = 1; + } + } + } + for (i = xd.length; xd[--i] === 0; ) xd.pop(); + } + if (external) { + if (x.e > Ctor.maxE) { + x.d = null; + x.e = NaN; + } else if (x.e < Ctor.minE) { + x.e = 0; + x.d = [0]; + } + } + return x; + } + function finiteToString(x, isExp, sd) { + if (!x.isFinite()) return nonFiniteToString(x); + var k, e = x.e, str = digitsToString(x.d), len = str.length; + if (isExp) { + if (sd && (k = sd - len) > 0) { + str = str.charAt(0) + "." + str.slice(1) + getZeroString(k); + } else if (len > 1) { + str = str.charAt(0) + "." + str.slice(1); + } + str = str + (x.e < 0 ? "e" : "e+") + x.e; + } else if (e < 0) { + str = "0." + getZeroString(-e - 1) + str; + if (sd && (k = sd - len) > 0) str += getZeroString(k); + } else if (e >= len) { + str += getZeroString(e + 1 - len); + if (sd && (k = sd - e - 1) > 0) str = str + "." + getZeroString(k); + } else { + if ((k = e + 1) < len) str = str.slice(0, k) + "." + str.slice(k); + if (sd && (k = sd - len) > 0) { + if (e + 1 === len) str += "."; + str += getZeroString(k); + } + } + return str; + } + function getBase10Exponent(digits, e) { + var w = digits[0]; + for (e *= LOG_BASE; w >= 10; w /= 10) e++; + return e; + } + function getLn10(Ctor, sd, pr) { + if (sd > LN10_PRECISION) { + external = true; + if (pr) Ctor.precision = pr; + throw Error(precisionLimitExceeded); + } + return finalise(new Ctor(LN10), sd, 1, true); + } + function getPi(Ctor, sd, rm) { + if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); + return finalise(new Ctor(PI), sd, rm, true); + } + function getPrecision(digits) { + var w = digits.length - 1, len = w * LOG_BASE + 1; + w = digits[w]; + if (w) { + for (; w % 10 == 0; w /= 10) len--; + for (w = digits[0]; w >= 10; w /= 10) len++; + } + return len; + } + function getZeroString(k) { + var zs = ""; + for (; k--; ) zs += "0"; + return zs; + } + function intPow(Ctor, x, n, pr) { + var isTruncated, r = new Ctor(1), k = Math.ceil(pr / LOG_BASE + 4); + external = false; + for (; ; ) { + if (n % 2) { + r = r.times(x); + if (truncate(r.d, k)) isTruncated = true; + } + n = mathfloor(n / 2); + if (n === 0) { + n = r.d.length - 1; + if (isTruncated && r.d[n] === 0) ++r.d[n]; + break; + } + x = x.times(x); + truncate(x.d, k); + } + external = true; + return r; + } + function isOdd(n) { + return n.d[n.d.length - 1] & 1; + } + function maxOrMin(Ctor, args, ltgt) { + var y, x = new Ctor(args[0]), i = 0; + for (; ++i < args.length; ) { + y = new Ctor(args[i]); + if (!y.s) { + x = y; + break; + } else if (x[ltgt](y)) { + x = y; + } + } + return x; + } + function naturalExponential(x, sd) { + var denominator, guard, j, pow2, sum2, t, wpr, rep = 0, i = 0, k = 0, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; + if (!x.d || !x.d[0] || x.e > 17) { + return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0); + } + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + t = new Ctor(0.03125); + while (x.e > -2) { + x = x.times(t); + k += 5; + } + guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; + wpr += guard; + denominator = pow2 = sum2 = new Ctor(1); + Ctor.precision = wpr; + for (; ; ) { + pow2 = finalise(pow2.times(x), wpr, 1); + denominator = denominator.times(++i); + t = sum2.plus(divide(pow2, denominator, wpr, 1)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { + j = k; + while (j--) sum2 = finalise(sum2.times(sum2), wpr, 1); + if (sd == null) { + if (rep < 3 && checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += 10; + denominator = pow2 = t = new Ctor(1); + i = 0; + rep++; + } else { + return finalise(sum2, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum2; + } + } + sum2 = t; + } + } + function naturalLogarithm(y, sd) { + var c, c0, denominator, e, numerator, rep, sum2, t, wpr, x1, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; + if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { + return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); + } + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + Ctor.precision = wpr += guard; + c = digitsToString(xd); + c0 = c.charAt(0); + if (Math.abs(e = x.e) < 15e14) { + while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { + x = x.times(y); + c = digitsToString(x.d); + c0 = c.charAt(0); + n++; + } + e = x.e; + if (c0 > 1) { + x = new Ctor("0." + c); + e++; + } else { + x = new Ctor(c0 + "." + c.slice(1)); + } + } else { + t = getLn10(Ctor, wpr + 2, pr).times(e + ""); + x = naturalLogarithm(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t); + Ctor.precision = pr; + return sd == null ? finalise(x, pr, rm, external = true) : x; + } + x1 = x; + sum2 = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = 3; + for (; ; ) { + numerator = finalise(numerator.times(x2), wpr, 1); + t = sum2.plus(divide(numerator, new Ctor(denominator), wpr, 1)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { + sum2 = sum2.times(2); + if (e !== 0) sum2 = sum2.plus(getLn10(Ctor, wpr + 2, pr).times(e + "")); + sum2 = divide(sum2, new Ctor(n), wpr, 1); + if (sd == null) { + if (checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += guard; + t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = rep = 1; + } else { + return finalise(sum2, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum2; + } + } + sum2 = t; + denominator += 2; + } + } + function nonFiniteToString(x) { + return String(x.s * x.s / 0); + } + function parseDecimal(x, str) { + var e, i, len; + if ((e = str.indexOf(".")) > -1) str = str.replace(".", ""); + if ((i = str.search(/e/i)) > 0) { + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + e = str.length; + } + for (i = 0; str.charCodeAt(i) === 48; i++) ; + for (len = str.length; str.charCodeAt(len - 1) === 48; --len) ; + str = str.slice(i, len); + if (str) { + len -= i; + x.e = e = e - i - 1; + x.d = []; + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; + if (i < len) { + if (i) x.d.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len; ) x.d.push(+str.slice(i, i += LOG_BASE)); + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + for (; i--; ) str += "0"; + x.d.push(+str); + if (external) { + if (x.e > x.constructor.maxE) { + x.d = null; + x.e = NaN; + } else if (x.e < x.constructor.minE) { + x.e = 0; + x.d = [0]; + } + } + } else { + x.e = 0; + x.d = [0]; + } + return x; + } + function parseOther(x, str) { + var base, Ctor, divisor, i, isFloat, len, p, xd, xe; + if (str.indexOf("_") > -1) { + str = str.replace(/(\d)_(?=\d)/g, "$1"); + if (isDecimal.test(str)) return parseDecimal(x, str); + } else if (str === "Infinity" || str === "NaN") { + if (!+str) x.s = NaN; + x.e = NaN; + x.d = null; + return x; + } + if (isHex.test(str)) { + base = 16; + str = str.toLowerCase(); + } else if (isBinary.test(str)) { + base = 2; + } else if (isOctal.test(str)) { + base = 8; + } else { + throw Error(invalidArgument + str); + } + i = str.search(/p/i); + if (i > 0) { + p = +str.slice(i + 1); + str = str.substring(2, i); + } else { + str = str.slice(2); + } + i = str.indexOf("."); + isFloat = i >= 0; + Ctor = x.constructor; + if (isFloat) { + str = str.replace(".", ""); + len = str.length; + i = len - i; + divisor = intPow(Ctor, new Ctor(base), i, i * 2); + } + xd = convertBase(str, base, BASE); + xe = xd.length - 1; + for (i = xe; xd[i] === 0; --i) xd.pop(); + if (i < 0) return new Ctor(x.s * 0); + x.e = getBase10Exponent(xd, xe); + x.d = xd; + external = false; + if (isFloat) x = divide(x, divisor, len * 4); + if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal2.pow(2, p)); + external = true; + return x; + } + function sine(Ctor, x) { + var k, len = x.d.length; + if (len < 3) { + return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); + } + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x); + var sin2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); + for (; k--; ) { + sin2_x = x.times(x); + x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); + } + return x; + } + function taylorSeries(Ctor, n, x, y, isHyperbolic) { + var j, t, u, x2, i = 1, pr = Ctor.precision, k = Math.ceil(pr / LOG_BASE); + external = false; + x2 = x.times(x); + u = new Ctor(y); + for (; ; ) { + t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); + u = isHyperbolic ? y.plus(t) : y.minus(t); + y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); + t = u.plus(y); + if (t.d[k] !== void 0) { + for (j = k; t.d[j] === u.d[j] && j--; ) ; + if (j == -1) break; + } + j = u; + u = y; + y = t; + t = j; + i++; + } + external = true; + t.d.length = k + 1; + return t; + } + function tinyPow(b, e) { + var n = b; + while (--e) n *= b; + return n; + } + function toLessThanHalfPi(Ctor, x) { + var t, isNeg = x.s < 0, pi = getPi(Ctor, Ctor.precision, 1), halfPi = pi.times(0.5); + x = x.abs(); + if (x.lte(halfPi)) { + quadrant = isNeg ? 4 : 1; + return x; + } + t = x.divToInt(pi); + if (t.isZero()) { + quadrant = isNeg ? 3 : 2; + } else { + x = x.minus(t.times(pi)); + if (x.lte(halfPi)) { + quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1; + return x; + } + quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2; + } + return x.minus(pi).abs(); + } + function toStringBinary(x, baseOut, sd, rm) { + var base, e, i, k, len, roundUp, str, xd, y, Ctor = x.constructor, isExp = sd !== void 0; + if (isExp) { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } else { + sd = Ctor.precision; + rm = Ctor.rounding; + } + if (!x.isFinite()) { + str = nonFiniteToString(x); + } else { + str = finiteToString(x); + i = str.indexOf("."); + if (isExp) { + base = 2; + if (baseOut == 16) { + sd = sd * 4 - 3; + } else if (baseOut == 8) { + sd = sd * 3 - 2; + } + } else { + base = baseOut; + } + if (i >= 0) { + str = str.replace(".", ""); + y = new Ctor(1); + y.e = str.length - i; + y.d = convertBase(finiteToString(y), 10, base); + y.e = y.d.length; + } + xd = convertBase(str, 10, base); + e = len = xd.length; + for (; xd[--len] == 0; ) xd.pop(); + if (!xd[0]) { + str = isExp ? "0p+0" : "0"; + } else { + if (i < 0) { + e--; + } else { + x = new Ctor(x); + x.d = xd; + x.e = e; + x = divide(x, y, sd, rm, 0, base); + xd = x.d; + e = x.e; + roundUp = inexact; + } + i = xd[sd]; + k = base / 2; + roundUp = roundUp || xd[sd + 1] !== void 0; + roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7)); + xd.length = sd; + if (roundUp) { + for (; ++xd[--sd] > base - 1; ) { + xd[sd] = 0; + if (!sd) { + ++e; + xd.unshift(1); + } + } + } + for (len = xd.length; !xd[len - 1]; --len) ; + for (i = 0, str = ""; i < len; i++) str += NUMERALS.charAt(xd[i]); + if (isExp) { + if (len > 1) { + if (baseOut == 16 || baseOut == 8) { + i = baseOut == 16 ? 4 : 3; + for (--len; len % i; len++) str += "0"; + xd = convertBase(str, base, baseOut); + for (len = xd.length; !xd[len - 1]; --len) ; + for (i = 1, str = "1."; i < len; i++) str += NUMERALS.charAt(xd[i]); + } else { + str = str.charAt(0) + "." + str.slice(1); + } + } + str = str + (e < 0 ? "p" : "p+") + e; + } else if (e < 0) { + for (; ++e; ) str = "0" + str; + str = "0." + str; + } else { + if (++e > len) for (e -= len; e--; ) str += "0"; + else if (e < len) str = str.slice(0, e) + "." + str.slice(e); + } + } + str = (baseOut == 16 ? "0x" : baseOut == 2 ? "0b" : baseOut == 8 ? "0o" : "") + str; + } + return x.s < 0 ? "-" + str : str; + } + function truncate(arr, len) { + if (arr.length > len) { + arr.length = len; + return true; + } + } + function abs(x) { + return new this(x).abs(); + } + function acos(x) { + return new this(x).acos(); + } + function acosh(x) { + return new this(x).acosh(); + } + function add(x, y) { + return new this(x).plus(y); + } + function asin(x) { + return new this(x).asin(); + } + function asinh(x) { + return new this(x).asinh(); + } + function atan(x) { + return new this(x).atan(); + } + function atanh(x) { + return new this(x).atanh(); + } + function atan2(y, x) { + y = new this(y); + x = new this(x); + var r, pr = this.precision, rm = this.rounding, wpr = pr + 4; + if (!y.s || !x.s) { + r = new this(NaN); + } else if (!y.d && !x.d) { + r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); + r.s = y.s; + } else if (!x.d || y.isZero()) { + r = x.s < 0 ? getPi(this, pr, rm) : new this(0); + r.s = y.s; + } else if (!y.d || x.isZero()) { + r = getPi(this, wpr, 1).times(0.5); + r.s = y.s; + } else if (x.s < 0) { + this.precision = wpr; + this.rounding = 1; + r = this.atan(divide(y, x, wpr, 1)); + x = getPi(this, wpr, 1); + this.precision = pr; + this.rounding = rm; + r = y.s < 0 ? r.minus(x) : r.plus(x); + } else { + r = this.atan(divide(y, x, wpr, 1)); + } + return r; + } + function cbrt(x) { + return new this(x).cbrt(); + } + function ceil(x) { + return finalise(x = new this(x), x.e + 1, 2); + } + function clamp(x, min2, max2) { + return new this(x).clamp(min2, max2); + } + function config(obj) { + if (!obj || typeof obj !== "object") throw Error(decimalError + "Object expected"); + var i, p, v, useDefaults = obj.defaults === true, ps = [ + "precision", + 1, + MAX_DIGITS, + "rounding", + 0, + 8, + "toExpNeg", + -EXP_LIMIT, + 0, + "toExpPos", + 0, + EXP_LIMIT, + "maxE", + 0, + EXP_LIMIT, + "minE", + -EXP_LIMIT, + 0, + "modulo", + 0, + 9 + ]; + for (i = 0; i < ps.length; i += 3) { + if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; + else throw Error(invalidArgument + p + ": " + v); + } + } + if (p = "crypto", useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (v === true || v === false || v === 0 || v === 1) { + if (v) { + if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) { + this[p] = true; + } else { + throw Error(cryptoUnavailable); + } + } else { + this[p] = false; + } + } else { + throw Error(invalidArgument + p + ": " + v); + } + } + return this; + } + function cos(x) { + return new this(x).cos(); + } + function cosh(x) { + return new this(x).cosh(); + } + function clone(obj) { + var i, p, ps; + function Decimal3(v) { + var e, i2, t, x = this; + if (!(x instanceof Decimal3)) return new Decimal3(v); + x.constructor = Decimal3; + if (isDecimalInstance(v)) { + x.s = v.s; + if (external) { + if (!v.d || v.e > Decimal3.maxE) { + x.e = NaN; + x.d = null; + } else if (v.e < Decimal3.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + return; + } + t = typeof v; + if (t === "number") { + if (v === 0) { + x.s = 1 / v < 0 ? -1 : 1; + x.e = 0; + x.d = [0]; + return; + } + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + if (v === ~~v && v < 1e7) { + for (e = 0, i2 = v; i2 >= 10; i2 /= 10) e++; + if (external) { + if (e > Decimal3.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal3.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + return; + } else if (v * 0 !== 0) { + if (!v) x.s = NaN; + x.e = NaN; + x.d = null; + return; + } + return parseDecimal(x, v.toString()); + } else if (t !== "string") { + throw Error(invalidArgument + v); + } + if ((i2 = v.charCodeAt(0)) === 45) { + v = v.slice(1); + x.s = -1; + } else { + if (i2 === 43) v = v.slice(1); + x.s = 1; + } + return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); + } + Decimal3.prototype = P; + Decimal3.ROUND_UP = 0; + Decimal3.ROUND_DOWN = 1; + Decimal3.ROUND_CEIL = 2; + Decimal3.ROUND_FLOOR = 3; + Decimal3.ROUND_HALF_UP = 4; + Decimal3.ROUND_HALF_DOWN = 5; + Decimal3.ROUND_HALF_EVEN = 6; + Decimal3.ROUND_HALF_CEIL = 7; + Decimal3.ROUND_HALF_FLOOR = 8; + Decimal3.EUCLID = 9; + Decimal3.config = Decimal3.set = config; + Decimal3.clone = clone; + Decimal3.isDecimal = isDecimalInstance; + Decimal3.abs = abs; + Decimal3.acos = acos; + Decimal3.acosh = acosh; + Decimal3.add = add; + Decimal3.asin = asin; + Decimal3.asinh = asinh; + Decimal3.atan = atan; + Decimal3.atanh = atanh; + Decimal3.atan2 = atan2; + Decimal3.cbrt = cbrt; + Decimal3.ceil = ceil; + Decimal3.clamp = clamp; + Decimal3.cos = cos; + Decimal3.cosh = cosh; + Decimal3.div = div; + Decimal3.exp = exp; + Decimal3.floor = floor; + Decimal3.hypot = hypot; + Decimal3.ln = ln; + Decimal3.log = log; + Decimal3.log10 = log10; + Decimal3.log2 = log2; + Decimal3.max = max; + Decimal3.min = min; + Decimal3.mod = mod; + Decimal3.mul = mul; + Decimal3.pow = pow; + Decimal3.random = random; + Decimal3.round = round; + Decimal3.sign = sign; + Decimal3.sin = sin; + Decimal3.sinh = sinh; + Decimal3.sqrt = sqrt; + Decimal3.sub = sub; + Decimal3.sum = sum; + Decimal3.tan = tan; + Decimal3.tanh = tanh; + Decimal3.trunc = trunc; + if (obj === void 0) obj = {}; + if (obj) { + if (obj.defaults !== true) { + ps = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"]; + for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; + } + } + Decimal3.config(obj); + return Decimal3; + } + function div(x, y) { + return new this(x).div(y); + } + function exp(x) { + return new this(x).exp(); + } + function floor(x) { + return finalise(x = new this(x), x.e + 1, 3); + } + function hypot() { + var i, n, t = new this(0); + external = false; + for (i = 0; i < arguments.length; ) { + n = new this(arguments[i++]); + if (!n.d) { + if (n.s) { + external = true; + return new this(1 / 0); + } + t = n; + } else if (t.d) { + t = t.plus(n.times(n)); + } + } + external = true; + return t.sqrt(); + } + function isDecimalInstance(obj) { + return obj instanceof Decimal2 || obj && obj.toStringTag === tag || false; + } + function ln(x) { + return new this(x).ln(); + } + function log(x, y) { + return new this(x).log(y); + } + function log2(x) { + return new this(x).log(2); + } + function log10(x) { + return new this(x).log(10); + } + function max() { + return maxOrMin(this, arguments, "lt"); + } + function min() { + return maxOrMin(this, arguments, "gt"); + } + function mod(x, y) { + return new this(x).mod(y); + } + function mul(x, y) { + return new this(x).mul(y); + } + function pow(x, y) { + return new this(x).pow(y); + } + function random(sd) { + var d, e, k, n, i = 0, r = new this(1), rd = []; + if (sd === void 0) sd = this.precision; + else checkInt32(sd, 1, MAX_DIGITS); + k = Math.ceil(sd / LOG_BASE); + if (!this.crypto) { + for (; i < k; ) rd[i++] = Math.random() * 1e7 | 0; + } else if (crypto.getRandomValues) { + d = crypto.getRandomValues(new Uint32Array(k)); + for (; i < k; ) { + n = d[i]; + if (n >= 429e7) { + d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; + } else { + rd[i++] = n % 1e7; + } + } + } else if (crypto.randomBytes) { + d = crypto.randomBytes(k *= 4); + for (; i < k; ) { + n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 127) << 24); + if (n >= 214e7) { + crypto.randomBytes(4).copy(d, i); + } else { + rd.push(n % 1e7); + i += 4; + } + } + i = k / 4; + } else { + throw Error(cryptoUnavailable); + } + k = rd[--i]; + sd %= LOG_BASE; + if (k && sd) { + n = mathpow(10, LOG_BASE - sd); + rd[i] = (k / n | 0) * n; + } + for (; rd[i] === 0; i--) rd.pop(); + if (i < 0) { + e = 0; + rd = [0]; + } else { + e = -1; + for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); + for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; + if (k < LOG_BASE) e -= LOG_BASE - k; + } + r.e = e; + r.d = rd; + return r; + } + function round(x) { + return finalise(x = new this(x), x.e + 1, this.rounding); + } + function sign(x) { + x = new this(x); + return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN; + } + function sin(x) { + return new this(x).sin(); + } + function sinh(x) { + return new this(x).sinh(); + } + function sqrt(x) { + return new this(x).sqrt(); + } + function sub(x, y) { + return new this(x).sub(y); + } + function sum() { + var i = 0, args = arguments, x = new this(args[i]); + external = false; + for (; x.s && ++i < args.length; ) x = x.plus(args[i]); + external = true; + return finalise(x, this.precision, this.rounding); + } + function tan(x) { + return new this(x).tan(); + } + function tanh(x) { + return new this(x).tanh(); + } + function trunc(x) { + return finalise(x = new this(x), x.e + 1, 1); + } + Decimal2 = clone(DEFAULTS); + Decimal2.prototype.constructor = Decimal2; + Decimal2["default"] = Decimal2.Decimal = Decimal2; + LN10 = new Decimal2(LN10); + PI = new Decimal2(PI); + if (typeof define == "function" && define.amd) { + define(function() { + return Decimal2; + }); + } else if (typeof module2 != "undefined" && module2.exports) { + if (typeof Symbol == "function" && typeof Symbol.iterator == "symbol") { + P[Symbol["for"]("nodejs.util.inspect.custom")] = P.toString; + P[Symbol.toStringTag] = "Decimal"; + } + module2.exports = Decimal2; + } else { + if (!globalScope) { + globalScope = typeof self != "undefined" && self && self.self == self ? self : window; + } + noConflict = globalScope.Decimal; + Decimal2.noConflict = function() { + globalScope.Decimal = noConflict; + return Decimal2; + }; + globalScope.Decimal = Decimal2; + } + })(exports2); + } +}); + +// node_modules/bn.js/lib/bn.js +var require_bn = __commonJS({ + "node_modules/bn.js/lib/bn.js"(exports2, module2) { + (function(module3, exports3) { + "use strict"; + function assert(val, msg) { + if (!val) throw new Error(msg || "Assertion failed"); + } + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + function BN(number, base, endian) { + if (BN.isBN(number)) { + return number; + } + this.negative = 0; + this.words = null; + this.length = 0; + 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 module3 === "object") { + module3.exports = BN; + } else { + exports3.BN = BN; + } + BN.BN = BN; + BN.wordSize = 26; + var Buffer2; + try { + if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") { + Buffer2 = window.Buffer; + } else { + Buffer2 = require("buffer").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 < 67108864) { + this.words = [number & 67108863]; + this.length = 1; + } else if (number < 4503599627370496) { + this.words = [ + number & 67108863, + number / 67108864 & 67108863 + ]; + this.length = 2; + } else { + assert(number < 9007199254740992); + this.words = [ + number & 67108863, + number / 67108864 & 67108863, + 1 + ]; + this.length = 3; + } + if (endian !== "le") return; + this._initArray(this.toArray(), base, endian); + }; + BN.prototype._initArray = function _initArray(number, base, endian) { + 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 & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + 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 & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + function parseHex4Bits(string, index) { + var c = string.charCodeAt(index); + if (c >= 65 && c <= 70) { + return c - 55; + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + return c - 48 & 15; + } + } + 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) { + 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 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 & 67108863; + 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 & 67108863; + 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; + if (c >= 49) { + r += c - 49 + 10; + } else if (c >= 17) { + r += c - 17 + 10; + } else { + r += c; + } + } + return r; + } + BN.prototype._parseBase = function _parseBase(number, base, start) { + this.words = [0]; + this.length = 1; + for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; 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 < 67108864) { + 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 < 67108864) { + 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; + }; + 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() { + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + BN.prototype.inspect = function inspect() { + return (this.red ? ""; + }; + 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, + 1e7, + 19487171, + 35831808, + 62748517, + 7529536, + 11390625, + 16777216, + 24137569, + 34012224, + 47045881, + 64e6, + 4084101, + 5153632, + 6436343, + 7962624, + 9765625, + 11881376, + 14348907, + 17210368, + 20511149, + 243e5, + 28629151, + 33554432, + 39135393, + 45435424, + 52521875, + 60466176 + ]; + 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) & 16777215).toString(16); + carry = w >>> 24 - off & 16777215; + 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 = groupSizes[base]; + 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] * 67108864; + } else if (this.length === 3 && this.words[2] === 1) { + ret += 4503599627370496 + this.words[1] * 67108864; + } 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 Buffer2 !== "undefined"); + return this.toArrayLike(Buffer2, 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) { + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + for (i = 0; !q.isZero(); i++) { + b = q.andln(255); + q.iushrn(8); + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(255); + 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 >= 4096) { + r += 13; + t >>>= 13; + } + if (t >= 64) { + r += 7; + t >>>= 7; + } + if (t >= 8) { + r += 4; + t >>>= 4; + } + if (t >= 2) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + BN.prototype._zeroBits = function _zeroBits(w) { + if (w === 0) return 26; + var t = w; + var r = 0; + if ((t & 8191) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 127) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 15) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 1) === 0) { + r++; + } + return r; + }; + 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; + } + 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; + }; + BN.prototype.neg = function neg() { + return this.clone().ineg(); + }; + BN.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + return this; + }; + 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); + }; + 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); + }; + BN.prototype.iuand = function iuand(num) { + 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); + }; + 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); + }; + BN.prototype.iuxor = function iuxor(num) { + 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); + }; + 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); + }; + BN.prototype.inotn = function inotn(width) { + assert(typeof width === "number" && width >= 0); + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + this._expand(bytesNeeded); + if (bitsLeft > 0) { + bytesNeeded--; + } + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 67108863; + } + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft; + } + return this.strip(); + }; + BN.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; + 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(); + }; + BN.prototype.iadd = function iadd(num) { + var r; + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + 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 & 67108863; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 67108863; + carry = r >>> 26; + } + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + return 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); + }; + BN.prototype.isub = function isub(num) { + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + var cmp = this.cmp(num); + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + 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 & 67108863; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 67108863; + } + 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(); + }; + BN.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + function smallMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + var len = self2.length + num.length | 0; + out.length = len; + len = len - 1 | 0; + var a = self2.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + var lo = r & 67108863; + var carry = r / 67108864 | 0; + out.words[0] = lo; + for (var k = 1; k < len; k++) { + var ncarry = carry >>> 26; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i = k - j | 0; + a = self2.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += r / 67108864 | 0; + rword = r & 67108863; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + return out.strip(); + } + var comb10MulTo = function comb10MulTo2(self2, num, out) { + var a = self2.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 & 8191; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 8191; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 8191; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 8191; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 8191; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 8191; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 8191; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 8191; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 8191; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 8191; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 8191; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 8191; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 8191; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 8191; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 8191; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 8191; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 8191; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 8191; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 8191; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 8191; + var bh9 = b9 >>> 13; + out.negative = self2.negative ^ num.negative; + out.length = 19; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 67108863; + 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; + }; + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + function bigMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + out.length = self2.length + num.length; + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self2.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + var lo = r & 67108863; + ncarry = ncarry + (r / 67108864 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 67108863; + ncarry = ncarry + (lo >>> 26) | 0; + hncarry += ncarry >>> 26; + ncarry &= 67108863; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + return out.strip(); + } + function jumboMulTo(self2, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self2, 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; + }; + 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; + }; + 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; + }; + 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; + 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) * 8192 + Math.round(ws[2 * i] / N) + carry; + ws[i] = w & 67108863; + if (w < 67108864) { + carry = 0; + } else { + carry = w / 67108864 | 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 & 8191; + carry = carry >>> 13; + rws[2 * i + 1] = carry & 8191; + carry = carry >>> 13; + } + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + assert(carry === 0); + assert((carry & ~8191) === 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(); + }; + BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + BN.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + BN.prototype.imuln = function imuln(num) { + assert(typeof num === "number"); + assert(num < 67108864); + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 67108863) + (carry & 67108863); + carry >>= 26; + carry += w / 67108864 | 0; + carry += lo >>> 26; + this.words[i] = lo & 67108863; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + BN.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; + BN.prototype.sqr = function sqr() { + return this.mul(this); + }; + BN.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; + BN.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + 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; + }; + BN.prototype.iushln = function iushln(bits) { + assert(typeof bits === "number" && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = 67108863 >>> 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) { + assert(this.negative === 0); + return this.iushln(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 = 67108863 ^ 67108863 >>> r << r; + var maskedWords = extended; + h -= s; + h = Math.max(0, h); + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + if (s === 0) { + } 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; + } + 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) { + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + BN.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; + BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + BN.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; + 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; + if (this.length <= s) return false; + var w = this.words[s]; + return !!(w & q); + }; + 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 = 67108863 ^ 67108863 >>> r << r; + this.words[this.length - 1] &= mask; + } + return this.strip(); + }; + BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; + BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === "number"); + assert(num < 67108864); + if (num < 0) return this.isubn(-num); + 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; + } + return this._iaddn(num); + }; + BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) { + this.words[i] -= 67108864; + 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; + }; + BN.prototype.isubn = function isubn(num) { + assert(typeof num === "number"); + assert(num < 67108864); + 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 { + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 67108864; + 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 & 67108863; + carry = (w >> 26) - (right / 67108864 | 0); + this.words[i + shift] = w & 67108863; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 67108863; + } + if (carry === 0) return this.strip(); + 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 & 67108863; + } + 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; + 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; + } + 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) * 67108864 + (a.words[b.length + j - 1] | 0); + qj = Math.min(qj / bhi | 0, 67108863); + 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(); + if (mode !== "div" && shift !== 0) { + a.iushrn(shift); + } + return { + div: q || null, + mod: a + }; + }; + 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, + mod + }; + } + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + if (mode !== "mod") { + div = res.div.neg(); + } + return { + 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 + }; + } + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + 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); + }; + BN.prototype.div = function div(num) { + return this.divmod(num, "div", false).div; + }; + 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; + }; + BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + 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); + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + BN.prototype.modn = function modn(num) { + assert(num <= 67108863); + 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; + }; + BN.prototype.idivn = function idivn(num) { + assert(num <= 67108863); + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 67108864; + 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(); + } + var A = new BN(1); + var B = new BN(0); + 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) + }; + }; + 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; + 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) { + 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); + }; + 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; + }; + BN.prototype.andln = function andln(num) { + return this.words[0] & num; + }; + BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === "number"); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + 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 &= 67108863; + 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 <= 67108863, "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; + }; + 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; + }; + BN.prototype.ucmp = function ucmp(num) { + 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; + }; + 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); + }; + 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); + }; + 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); + }; + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + function MPrime(name2, p) { + this.name = name2; + 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) { + 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 !== void 0) { + r.strip(); + } 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) { + var mask = 4194303; + 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; + } + 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) { + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 977; + num.words[i] = lo & 67108863; + lo = w * 64 + (lo / 67108864 | 0); + } + 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() { + MPrime.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + inherits(P25519, MPrime); + P25519.prototype.imulK = function imulK(num) { + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 19 + carry; + var lo = hi & 67108863; + hi >>>= 26; + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + BN._prime = function prime(name2) { + if (primes[name2]) return primes[name2]; + var prime2; + if (name2 === "k256") { + prime2 = new K256(); + } else if (name2 === "p224") { + prime2 = new P224(); + } else if (name2 === "p192") { + prime2 = new P192(); + } else if (name2 === "p25519") { + prime2 = new P25519(); + } else { + throw new Error("Unknown prime " + name2); + } + primes[name2] = prime2; + return prime2; + }; + 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); + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + 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(); + 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; + }; + 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) { + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; + })(typeof module2 === "undefined" || module2, exports2); + } +}); + +// node_modules/@ethersproject/logger/lib/_version.js +var require_version = __commonJS({ + "node_modules/@ethersproject/logger/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "logger/5.5.0"; + } +}); + +// node_modules/@ethersproject/logger/lib/index.js +var require_lib = __commonJS({ + "node_modules/@ethersproject/logger/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Logger = exports2.ErrorCode = exports2.LogLevel = void 0; + 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 _version_1 = require_version(); + var _globalLogger = null; + function _checkNormalize() { + try { + var missing_1 = []; + ["NFD", "NFC", "NFKD", "NFKC"].forEach(function(form) { + try { + if ("test".normalize(form) !== "test") { + throw new Error("bad normalize"); + } + ; + } catch (error) { + missing_1.push(form); + } + }); + if (missing_1.length) { + throw new Error("missing " + missing_1.join(", ")); + } + if (String.fromCharCode(233).normalize("NFD") !== String.fromCharCode(101, 769)) { + throw new Error("broken implementation"); + } + } catch (error) { + return error.message; + } + return null; + } + var _normalizeError = _checkNormalize(); + var LogLevel; + (function(LogLevel2) { + LogLevel2["DEBUG"] = "DEBUG"; + LogLevel2["INFO"] = "INFO"; + LogLevel2["WARNING"] = "WARNING"; + LogLevel2["ERROR"] = "ERROR"; + LogLevel2["OFF"] = "OFF"; + })(LogLevel = exports2.LogLevel || (exports2.LogLevel = {})); + var ErrorCode; + (function(ErrorCode2) { + ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; + ErrorCode2["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; + ErrorCode2["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; + ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR"; + ErrorCode2["SERVER_ERROR"] = "SERVER_ERROR"; + ErrorCode2["TIMEOUT"] = "TIMEOUT"; + ErrorCode2["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; + ErrorCode2["NUMERIC_FAULT"] = "NUMERIC_FAULT"; + ErrorCode2["MISSING_NEW"] = "MISSING_NEW"; + ErrorCode2["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; + ErrorCode2["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; + ErrorCode2["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; + ErrorCode2["CALL_EXCEPTION"] = "CALL_EXCEPTION"; + ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; + ErrorCode2["NONCE_EXPIRED"] = "NONCE_EXPIRED"; + ErrorCode2["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; + ErrorCode2["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; + ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; + })(ErrorCode = exports2.ErrorCode || (exports2.ErrorCode = {})); + var HEX = "0123456789abcdef"; + var Logger = ( + /** @class */ + function() { + function Logger2(version) { + Object.defineProperty(this, "version", { + enumerable: true, + value: version, + writable: false + }); + } + Logger2.prototype._log = function(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); + }; + Logger2.prototype.debug = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.DEBUG, args); + }; + Logger2.prototype.info = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.INFO, args); + }; + Logger2.prototype.warn = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.WARNING, args); + }; + Logger2.prototype.makeError = function(message, code, params) { + if (_censorErrors) { + return this.makeError("censored error", code, {}); + } + if (!code) { + code = Logger2.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] & 15]; + } + messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); + } else { + messageDetails.push(key + "=" + JSON.stringify(value)); + } + } catch (error2) { + messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); + } + }); + messageDetails.push("code=" + code); + messageDetails.push("version=" + this.version); + var reason = message; + if (messageDetails.length) { + message += " (" + messageDetails.join(", ") + ")"; + } + var error = new Error(message); + error.reason = reason; + error.code = code; + Object.keys(params).forEach(function(key) { + error[key] = params[key]; + }); + return error; + }; + Logger2.prototype.throwError = function(message, code, params) { + throw this.makeError(message, code, params); + }; + Logger2.prototype.throwArgumentError = function(message, name2, value) { + return this.throwError(message, Logger2.errors.INVALID_ARGUMENT, { + argument: name2, + value + }); + }; + Logger2.prototype.assert = function(condition, message, code, params) { + if (!!condition) { + return; + } + this.throwError(message, code, params); + }; + Logger2.prototype.assertArgument = function(condition, message, name2, value) { + if (!!condition) { + return; + } + this.throwArgumentError(message, name2, value); + }; + Logger2.prototype.checkNormalize = function(message) { + if (message == null) { + message = "platform missing String.prototype.normalize"; + } + if (_normalizeError) { + this.throwError("platform missing String.prototype.normalize", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "String.prototype.normalize", + form: _normalizeError + }); + } + }; + Logger2.prototype.checkSafeUint53 = function(value, message) { + if (typeof value !== "number") { + return; + } + if (message == null) { + message = "value not safe"; + } + if (value < 0 || value >= 9007199254740991) { + this.throwError(message, Logger2.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value + }); + } + if (value % 1) { + this.throwError(message, Logger2.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value + }); + } + }; + Logger2.prototype.checkArgumentCount = function(count, expectedCount, message) { + if (message) { + message = ": " + message; + } else { + message = ""; + } + if (count < expectedCount) { + this.throwError("missing argument" + message, Logger2.errors.MISSING_ARGUMENT, { + count, + expectedCount + }); + } + if (count > expectedCount) { + this.throwError("too many arguments" + message, Logger2.errors.UNEXPECTED_ARGUMENT, { + count, + expectedCount + }); + } + }; + Logger2.prototype.checkNew = function(target, kind) { + if (target === Object || target == null) { + this.throwError("missing new", Logger2.errors.MISSING_NEW, { name: kind.name }); + } + }; + Logger2.prototype.checkAbstract = function(target, kind) { + if (target === kind) { + this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger2.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); + } else if (target === Object || target == null) { + this.throwError("missing new", Logger2.errors.MISSING_NEW, { name: kind.name }); + } + }; + Logger2.globalLogger = function() { + if (!_globalLogger) { + _globalLogger = new Logger2(_version_1.version); + } + return _globalLogger; + }; + Logger2.setCensorship = function(censorship, permanent) { + if (!censorship && permanent) { + this.globalLogger().throwError("cannot permanently disable censorship", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + if (_permanentCensorErrors) { + if (!censorship) { + return; + } + this.globalLogger().throwError("error censorship permanent", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + _censorErrors = !!censorship; + _permanentCensorErrors = !!permanent; + }; + Logger2.setLogLevel = function(logLevel) { + var level = LogLevels[logLevel.toLowerCase()]; + if (level == null) { + Logger2.globalLogger().warn("invalid log level - " + logLevel); + return; + } + _logLevel = level; + }; + Logger2.from = function(version) { + return new Logger2(version); + }; + Logger2.errors = ErrorCode; + Logger2.levels = LogLevel; + return Logger2; + }() + ); + exports2.Logger = Logger; + } +}); + +// node_modules/@ethersproject/bytes/lib/_version.js +var require_version2 = __commonJS({ + "node_modules/@ethersproject/bytes/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "bytes/5.5.0"; + } +}); + +// node_modules/@ethersproject/bytes/lib/index.js +var require_lib2 = __commonJS({ + "node_modules/@ethersproject/bytes/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.joinSignature = exports2.splitSignature = exports2.hexZeroPad = exports2.hexStripZeros = exports2.hexValue = exports2.hexConcat = exports2.hexDataSlice = exports2.hexDataLength = exports2.hexlify = exports2.isHexString = exports2.zeroPad = exports2.stripZeros = exports2.concat = exports2.arrayify = exports2.isBytes = exports2.isBytesLike = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version2(); + var logger = new logger_1.Logger(_version_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); + } + exports2.isBytesLike = isBytesLike; + 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; + } + exports2.isBytes = isBytes; + function arrayify(value, options) { + if (!options) { + options = {}; + } + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid arrayify value"); + var result = []; + while (value) { + result.unshift(value & 255); + 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); + } + exports2.arrayify = arrayify; + 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); + } + exports2.concat = concat; + function stripZeros(value) { + var result = arrayify(value); + if (result.length === 0) { + return result; + } + var start = 0; + while (start < result.length && result[start] === 0) { + start++; + } + if (start) { + result = result.slice(start); + } + return result; + } + exports2.stripZeros = stripZeros; + 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); + } + exports2.zeroPad = zeroPad; + 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; + } + exports2.isHexString = isHexString; + 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 & 15] + 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 & 240) >> 4] + HexCharacters[v & 15]; + } + return result; + } + return logger.throwArgumentError("invalid hexlify value", "value", value); + } + exports2.hexlify = hexlify; + function hexDataLength(data) { + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + return null; + } + return (data.length - 2) / 2; + } + exports2.hexDataLength = hexDataLength; + 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); + } + exports2.hexDataSlice = hexDataSlice; + function hexConcat(items) { + var result = "0x"; + items.forEach(function(item) { + result += hexlify(item).substring(2); + }); + return result; + } + exports2.hexConcat = hexConcat; + function hexValue(value) { + var trimmed = hexStripZeros(hexlify(value, { hexPad: "left" })); + if (trimmed === "0x") { + return "0x0"; + } + return trimmed; + } + exports2.hexValue = hexValue; + 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); + } + exports2.hexStripZeros = hexStripZeros; + 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; + } + exports2.hexZeroPad = hexZeroPad; + 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); + } + result.r = hexlify(bytes.slice(0, 32)); + result.s = hexlify(bytes.slice(32, 64)); + result.v = bytes[64]; + if (result.v < 27) { + if (result.v === 0 || result.v === 1) { + result.v += 27; + } else { + logger.throwArgumentError("signature invalid v byte", "signature", signature); + } + } + result.recoveryParam = 1 - result.v % 2; + if (result.recoveryParam) { + bytes[32] |= 128; + } + 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 (result._vs != null) { + var vs_1 = zeroPad(arrayify(result._vs), 32); + result._vs = hexlify(vs_1); + var recoveryParam = vs_1[0] >= 128 ? 1 : 0; + if (result.recoveryParam == null) { + result.recoveryParam = recoveryParam; + } else if (result.recoveryParam !== recoveryParam) { + logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); + } + vs_1[0] &= 127; + var s = hexlify(vs_1); + if (result.s == null) { + result.s = s; + } else if (result.s !== s) { + logger.throwArgumentError("signature v mismatch _vs", "signature", signature); + } + } + 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] |= 128; + } + var _vs = hexlify(vs); + if (result._vs) { + if (!isHexString(result._vs)) { + logger.throwArgumentError("signature invalid _vs", "signature", signature); + } + result._vs = hexZeroPad(result._vs, 32); + } + if (result._vs == null) { + result._vs = _vs; + } else if (result._vs !== _vs) { + logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature); + } + } + return result; + } + exports2.splitSignature = splitSignature; + function joinSignature(signature) { + signature = splitSignature(signature); + return hexlify(concat([ + signature.r, + signature.s, + signature.recoveryParam ? "0x1c" : "0x1b" + ])); + } + exports2.joinSignature = joinSignature; + } +}); + +// node_modules/@ethersproject/bignumber/lib/_version.js +var require_version3 = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "bignumber/5.5.0"; + } +}); + +// node_modules/@ethersproject/bignumber/lib/bignumber.js +var require_bignumber = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/bignumber.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._base16To36 = exports2._base36To16 = exports2.BigNumber = exports2.isBigNumberish = void 0; + var bn_js_1 = __importDefault(require_bn()); + var BN = bn_js_1.default.BN; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version3(); + var logger = new logger_1.Logger(_version_1.version); + var _constructorGuard = {}; + var MAX_SAFE = 9007199254740991; + function isBigNumberish(value) { + return value != null && (BigNumber.isBigNumber(value) || typeof value === "number" && value % 1 === 0 || typeof value === "string" && !!value.match(/^-?[0-9]+$/) || (0, bytes_1.isHexString)(value) || typeof value === "bigint" || (0, bytes_1.isBytes)(value)); + } + exports2.isBigNumberish = isBigNumberish; + var _warnedToStringRadix = false; + var BigNumber = ( + /** @class */ + function() { + function BigNumber2(constructorGuard, hex) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, BigNumber2); + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot call constructor directly; use BigNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new (BigNumber)" + }); + } + this._hex = hex; + this._isBigNumber = true; + Object.freeze(this); + } + BigNumber2.prototype.fromTwos = function(value) { + return toBigNumber(toBN(this).fromTwos(value)); + }; + BigNumber2.prototype.toTwos = function(value) { + return toBigNumber(toBN(this).toTwos(value)); + }; + BigNumber2.prototype.abs = function() { + if (this._hex[0] === "-") { + return BigNumber2.from(this._hex.substring(1)); + } + return this; + }; + BigNumber2.prototype.add = function(other) { + return toBigNumber(toBN(this).add(toBN(other))); + }; + BigNumber2.prototype.sub = function(other) { + return toBigNumber(toBN(this).sub(toBN(other))); + }; + BigNumber2.prototype.div = function(other) { + var o = BigNumber2.from(other); + if (o.isZero()) { + throwFault("division by zero", "div"); + } + return toBigNumber(toBN(this).div(toBN(other))); + }; + BigNumber2.prototype.mul = function(other) { + return toBigNumber(toBN(this).mul(toBN(other))); + }; + BigNumber2.prototype.mod = function(other) { + var value = toBN(other); + if (value.isNeg()) { + throwFault("cannot modulo negative values", "mod"); + } + return toBigNumber(toBN(this).umod(value)); + }; + BigNumber2.prototype.pow = function(other) { + var value = toBN(other); + if (value.isNeg()) { + throwFault("cannot raise to negative values", "pow"); + } + return toBigNumber(toBN(this).pow(value)); + }; + BigNumber2.prototype.and = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'and' negative values", "and"); + } + return toBigNumber(toBN(this).and(value)); + }; + BigNumber2.prototype.or = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'or' negative values", "or"); + } + return toBigNumber(toBN(this).or(value)); + }; + BigNumber2.prototype.xor = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'xor' negative values", "xor"); + } + return toBigNumber(toBN(this).xor(value)); + }; + BigNumber2.prototype.mask = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot mask negative values", "mask"); + } + return toBigNumber(toBN(this).maskn(value)); + }; + BigNumber2.prototype.shl = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shl"); + } + return toBigNumber(toBN(this).shln(value)); + }; + BigNumber2.prototype.shr = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shr"); + } + return toBigNumber(toBN(this).shrn(value)); + }; + BigNumber2.prototype.eq = function(other) { + return toBN(this).eq(toBN(other)); + }; + BigNumber2.prototype.lt = function(other) { + return toBN(this).lt(toBN(other)); + }; + BigNumber2.prototype.lte = function(other) { + return toBN(this).lte(toBN(other)); + }; + BigNumber2.prototype.gt = function(other) { + return toBN(this).gt(toBN(other)); + }; + BigNumber2.prototype.gte = function(other) { + return toBN(this).gte(toBN(other)); + }; + BigNumber2.prototype.isNegative = function() { + return this._hex[0] === "-"; + }; + BigNumber2.prototype.isZero = function() { + return toBN(this).isZero(); + }; + BigNumber2.prototype.toNumber = function() { + try { + return toBN(this).toNumber(); + } catch (error) { + throwFault("overflow", "toNumber", this.toString()); + } + return null; + }; + BigNumber2.prototype.toBigInt = function() { + try { + return BigInt(this.toString()); + } catch (e) { + } + return logger.throwError("this platform does not support BigInt", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + value: this.toString() + }); + }; + BigNumber2.prototype.toString = function() { + 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()", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); + } else { + logger.throwError("BigNumber.toString does not accept parameters", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); + } + } + return toBN(this).toString(10); + }; + BigNumber2.prototype.toHexString = function() { + return this._hex; + }; + BigNumber2.prototype.toJSON = function(key) { + return { type: "BigNumber", hex: this.toHexString() }; + }; + BigNumber2.from = function(value) { + if (value instanceof BigNumber2) { + return value; + } + if (typeof value === "string") { + if (value.match(/^-?0x[0-9a-f]+$/i)) { + return new BigNumber2(_constructorGuard, toHex(value)); + } + if (value.match(/^-?[0-9]+$/)) { + return new BigNumber2(_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 BigNumber2.from(String(value)); + } + var anyValue = value; + if (typeof anyValue === "bigint") { + return BigNumber2.from(anyValue.toString()); + } + if ((0, bytes_1.isBytes)(anyValue)) { + return BigNumber2.from((0, bytes_1.hexlify)(anyValue)); + } + if (anyValue) { + if (anyValue.toHexString) { + var hex = anyValue.toHexString(); + if (typeof hex === "string") { + return BigNumber2.from(hex); + } + } else { + var hex = anyValue._hex; + if (hex == null && anyValue.type === "BigNumber") { + hex = anyValue.hex; + } + if (typeof hex === "string") { + if ((0, bytes_1.isHexString)(hex) || hex[0] === "-" && (0, bytes_1.isHexString)(hex.substring(1))) { + return BigNumber2.from(hex); + } + } + } + } + return logger.throwArgumentError("invalid BigNumber value", "value", value); + }; + BigNumber2.isBigNumber = function(value) { + return !!(value && value._isBigNumber); + }; + return BigNumber2; + }() + ); + exports2.BigNumber = BigNumber; + function toHex(value) { + if (typeof value !== "string") { + return toHex(value.toString(16)); + } + if (value[0] === "-") { + value = value.substring(1); + if (value[0] === "-") { + logger.throwArgumentError("invalid hex", "value", value); + } + value = toHex(value); + if (value === "0x00") { + return value; + } + return "-" + value; + } + if (value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (value === "0x") { + return "0x00"; + } + if (value.length % 2) { + value = "0x0" + value.substring(2); + } + 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, operation }; + if (value != null) { + params.value = value; + } + return logger.throwError(fault, logger_1.Logger.errors.NUMERIC_FAULT, params); + } + function _base36To16(value) { + return new BN(value, 36).toString(16); + } + exports2._base36To16 = _base36To16; + function _base16To36(value) { + return new BN(value, 16).toString(36); + } + exports2._base16To36 = _base16To36; + } +}); + +// node_modules/@ethersproject/bignumber/lib/fixednumber.js +var require_fixednumber = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/fixednumber.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FixedNumber = exports2.FixedFormat = exports2.parseFixed = exports2.formatFixed = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version3(); + var logger = new logger_1.Logger(_version_1.version); + var bignumber_1 = require_bignumber(); + var _constructorGuard = {}; + var Zero = bignumber_1.BigNumber.from(0); + var NegativeOne = bignumber_1.BigNumber.from(-1); + function throwFault(message, fault, operation, value) { + var params = { fault, operation }; + if (value !== void 0) { + params.value = value; + } + return logger.throwError(message, logger_1.Logger.errors.NUMERIC_FAULT, params); + } + var zeros = "0"; + while (zeros.length < 256) { + zeros += zeros; + } + function getMultiplier(decimals) { + if (typeof decimals !== "number") { + try { + decimals = bignumber_1.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); + value = bignumber_1.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; + } + 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; + } + exports2.formatFixed = formatFixed; + 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); + } + var negative = value.substring(0, 1) === "-"; + if (negative) { + value = value.substring(1); + } + if (value === ".") { + logger.throwArgumentError("missing value", "value", value); + } + 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"; + } + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + if (fraction.length > multiplier.length - 1) { + throwFault("fractional component exceeds decimals", "underflow", "parseFixed"); + } + if (fraction === "") { + fraction = "0"; + } + while (fraction.length < multiplier.length - 1) { + fraction += "0"; + } + var wholeValue = bignumber_1.BigNumber.from(whole); + var fractionValue = bignumber_1.BigNumber.from(fraction); + var wei = wholeValue.mul(multiplier).add(fractionValue); + if (negative) { + wei = wei.mul(NegativeOne); + } + return wei; + } + exports2.parseFixed = parseFixed; + var FixedFormat = ( + /** @class */ + function() { + function FixedFormat2(constructorGuard, signed, width, decimals) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", logger_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); + } + FixedFormat2.from = function(value) { + if (value instanceof FixedFormat2) { + return value; + } + if (typeof value === "number") { + value = "fixed128x" + value; + } + var signed = true; + var width = 128; + var decimals = 18; + if (typeof value === "string") { + if (value === "fixed") { + } 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(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 FixedFormat2(_constructorGuard, signed, width, decimals); + }; + return FixedFormat2; + }() + ); + exports2.FixedFormat = FixedFormat; + var FixedNumber = ( + /** @class */ + function() { + function FixedNumber2(constructorGuard, hex, value, format) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, FixedNumber2); + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new FixedFormat" + }); + } + this.format = format; + this._hex = hex; + this._value = value; + this._isFixedNumber = true; + Object.freeze(this); + } + FixedNumber2.prototype._checkFormat = function(other) { + if (this.format.name !== other.format.name) { + logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); + } + }; + FixedNumber2.prototype.addUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.add(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.subUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.sub(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.mulUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format); + }; + FixedNumber2.prototype.divUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.floor = function() { + var comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + var result = FixedNumber2.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + if (this.isNegative() && hasFraction) { + result = result.subUnsafe(ONE.toFormat(result.format)); + } + return result; + }; + FixedNumber2.prototype.ceiling = function() { + var comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + var result = FixedNumber2.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + if (!this.isNegative() && hasFraction) { + result = result.addUnsafe(ONE.toFormat(result.format)); + } + return result; + }; + FixedNumber2.prototype.round = function(decimals) { + if (decimals == null) { + decimals = 0; + } + 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 = FixedNumber2.from("1" + zeros.substring(0, decimals), this.format); + var bump = BUMP.toFormat(this.format); + return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); + }; + FixedNumber2.prototype.isZero = function() { + return this._value === "0.0" || this._value === "0"; + }; + FixedNumber2.prototype.isNegative = function() { + return this._value[0] === "-"; + }; + FixedNumber2.prototype.toString = function() { + return this._value; + }; + FixedNumber2.prototype.toHexString = function(width) { + if (width == null) { + return this._hex; + } + if (width % 8) { + logger.throwArgumentError("invalid byte width", "width", width); + } + var hex = bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + return (0, bytes_1.hexZeroPad)(hex, width / 8); + }; + FixedNumber2.prototype.toUnsafeFloat = function() { + return parseFloat(this.toString()); + }; + FixedNumber2.prototype.toFormat = function(format) { + return FixedNumber2.fromString(this._value, format); + }; + FixedNumber2.fromValue = function(value, decimals, format) { + if (format == null && decimals != null && !(0, bignumber_1.isBigNumberish)(decimals)) { + format = decimals; + decimals = null; + } + if (decimals == null) { + decimals = 0; + } + if (format == null) { + format = "fixed"; + } + return FixedNumber2.fromString(formatFixed(value, decimals), FixedFormat.from(format)); + }; + FixedNumber2.fromString = function(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 = (0, bytes_1.hexZeroPad)(hex, fixedFormat.width / 8); + } + var decimal = formatFixed(numeric, fixedFormat.decimals); + return new FixedNumber2(_constructorGuard, hex, decimal, fixedFormat); + }; + FixedNumber2.fromBytes = function(value, format) { + if (format == null) { + format = "fixed"; + } + var fixedFormat = FixedFormat.from(format); + if ((0, bytes_1.arrayify)(value).length > fixedFormat.width / 8) { + throw new Error("overflow"); + } + var numeric = bignumber_1.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 FixedNumber2(_constructorGuard, hex, decimal, fixedFormat); + }; + FixedNumber2.from = function(value, format) { + if (typeof value === "string") { + return FixedNumber2.fromString(value, format); + } + if ((0, bytes_1.isBytes)(value)) { + return FixedNumber2.fromBytes(value, format); + } + try { + return FixedNumber2.fromValue(value, 0, format); + } catch (error) { + if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT) { + throw error; + } + } + return logger.throwArgumentError("invalid FixedNumber value", "value", value); + }; + FixedNumber2.isFixedNumber = function(value) { + return !!(value && value._isFixedNumber); + }; + return FixedNumber2; + }() + ); + exports2.FixedNumber = FixedNumber; + var ONE = FixedNumber.from(1); + var BUMP = FixedNumber.from("0.5"); + } +}); + +// node_modules/@ethersproject/bignumber/lib/index.js +var require_lib3 = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._base36To16 = exports2._base16To36 = exports2.parseFixed = exports2.FixedNumber = exports2.FixedFormat = exports2.formatFixed = exports2.BigNumber = void 0; + var bignumber_1 = require_bignumber(); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return bignumber_1.BigNumber; + } }); + var fixednumber_1 = require_fixednumber(); + Object.defineProperty(exports2, "formatFixed", { enumerable: true, get: function() { + return fixednumber_1.formatFixed; + } }); + Object.defineProperty(exports2, "FixedFormat", { enumerable: true, get: function() { + return fixednumber_1.FixedFormat; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return fixednumber_1.FixedNumber; + } }); + Object.defineProperty(exports2, "parseFixed", { enumerable: true, get: function() { + return fixednumber_1.parseFixed; + } }); + var bignumber_2 = require_bignumber(); + Object.defineProperty(exports2, "_base16To36", { enumerable: true, get: function() { + return bignumber_2._base16To36; + } }); + Object.defineProperty(exports2, "_base36To16", { enumerable: true, get: function() { + return bignumber_2._base36To16; + } }); + } +}); + +// node_modules/@ethersproject/properties/lib/_version.js +var require_version4 = __commonJS({ + "node_modules/@ethersproject/properties/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "properties/5.5.0"; + } +}); + +// node_modules/@ethersproject/properties/lib/index.js +var require_lib4 = __commonJS({ + "node_modules/@ethersproject/properties/lib/index.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Description = exports2.deepCopy = exports2.shallowCopy = exports2.checkProperties = exports2.resolveProperties = exports2.getStatic = exports2.defineReadOnly = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version4(); + var logger = new logger_1.Logger(_version_1.version); + function defineReadOnly(object, name2, value) { + Object.defineProperty(object, name2, { + enumerable: true, + value, + writable: false + }); + } + exports2.defineReadOnly = defineReadOnly; + 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; + } + exports2.getStatic = getStatic; + function resolveProperties(object) { + return __awaiter(this, void 0, void 0, function() { + var promises, results; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + promises = Object.keys(object).map(function(key) { + var value = object[key]; + return Promise.resolve(value).then(function(v) { + return { key, value: v }; + }); + }); + return [4, Promise.all(promises)]; + case 1: + results = _a.sent(); + return [2, results.reduce(function(accum, result) { + accum[result.key] = result.value; + return accum; + }, {})]; + } + }); + }); + } + exports2.resolveProperties = resolveProperties; + 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); + } + }); + } + exports2.checkProperties = checkProperties; + function shallowCopy(object) { + var result = {}; + for (var key in object) { + result[key] = object[key]; + } + return result; + } + exports2.shallowCopy = shallowCopy; + var opaque = { bigint: true, boolean: true, "function": true, number: true, string: true }; + function _isFrozen(object) { + if (object === void 0 || 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) { + continue; + } + if (!_isFrozen(value)) { + return false; + } + } + return true; + } + return logger.throwArgumentError("Cannot deepCopy " + typeof object, "object", object); + } + function _deepCopy(object) { + if (_isFrozen(object)) { + return object; + } + 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 === void 0) { + continue; + } + defineReadOnly(result, key, deepCopy(value)); + } + return result; + } + return logger.throwArgumentError("Cannot deepCopy " + typeof object, "object", object); + } + function deepCopy(object) { + return _deepCopy(object); + } + exports2.deepCopy = deepCopy; + var Description = ( + /** @class */ + /* @__PURE__ */ function() { + function Description2(info) { + for (var key in info) { + this[key] = deepCopy(info[key]); + } + } + return Description2; + }() + ); + exports2.Description = Description; + } +}); + +// node_modules/@ethersproject/abi/lib/_version.js +var require_version5 = __commonJS({ + "node_modules/@ethersproject/abi/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abi/5.5.0"; + } +}); + +// node_modules/@ethersproject/abi/lib/fragments.js +var require_fragments = __commonJS({ + "node_modules/@ethersproject/abi/lib/fragments.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ErrorFragment = exports2.FunctionFragment = exports2.ConstructorFragment = exports2.EventFragment = exports2.Fragment = exports2.ParamType = exports2.FormatTypes = void 0; + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var _constructorGuard = {}; + var ModifiersBytes = { calldata: true, memory: true, storage: true }; + var ModifiersNest = { calldata: true, memory: true }; + function checkModifier(type, name2) { + if (type === "bytes" || type === "string") { + if (ModifiersBytes[name2]) { + return true; + } + } else if (type === "address") { + if (name2 === "payable") { + return true; + } + } else if (type.indexOf("[") >= 0 || type === "tuple") { + if (ModifiersNest[name2]) { + return true; + } + } + if (ModifiersBytes[name2] || name2 === "payable") { + logger.throwArgumentError("invalid modifier", "name", name2); + } + return false; + } + function parseParamType(param, allowIndexed) { + var originalParam = param; + function throwError(i2) { + logger.throwArgumentError("unexpected character at position " + i2, "param", param); + } + param = param.replace(/\s/g, " "); + function newNode(parent2) { + var node2 = { type: "", name: "", parent: parent2, state: { allowType: true } }; + if (allowIndexed) { + node2.indexed = false; + } + return node2; + } + 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); + node.parent.components.push(sibling); + delete node.parent; + node = sibling; + break; + case " ": + 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 (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) { + (0, properties_1.defineReadOnly)(object, key, params[key]); + } + } + exports2.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 = ( + /** @class */ + function() { + function ParamType2(constructorGuard, params) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("use fromString", logger_1.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: ParamType2.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); + } + ParamType2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + var result_1 = { + type: this.baseType === "tuple" ? "tuple" : this.type, + name: this.name || void 0 + }; + if (typeof this.indexed === "boolean") { + result_1.indexed = this.indexed; + } + if (this.components) { + result_1.components = this.components.map(function(comp) { + return JSON.parse(comp.format(format)); + }); + } + return JSON.stringify(result_1); + } + var result = ""; + if (this.baseType === "array") { + result += this.arrayChildren.format(format); + result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]"; + } else { + if (this.baseType === "tuple") { + if (format !== exports2.FormatTypes.sighash) { + result += this.type; + } + result += "(" + this.components.map(function(comp) { + return comp.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ")"; + } else { + result += this.type; + } + } + if (format !== exports2.FormatTypes.sighash) { + if (this.indexed === true) { + result += " indexed"; + } + if (format === exports2.FormatTypes.full && this.name) { + result += " " + this.name; + } + } + return result; + }; + ParamType2.from = function(value, allowIndexed) { + if (typeof value === "string") { + return ParamType2.fromString(value, allowIndexed); + } + return ParamType2.fromObject(value); + }; + ParamType2.fromObject = function(value) { + if (ParamType2.isParamType(value)) { + return value; + } + return new ParamType2(_constructorGuard, { + name: value.name || null, + type: verifyType(value.type), + indexed: value.indexed == null ? null : !!value.indexed, + components: value.components ? value.components.map(ParamType2.fromObject) : null + }); + }; + ParamType2.fromString = function(value, allowIndexed) { + function ParamTypify(node) { + return ParamType2.fromObject({ + name: node.name, + type: node.type, + indexed: node.indexed, + components: node.components + }); + } + return ParamTypify(parseParamType(value, !!allowIndexed)); + }; + ParamType2.isParamType = function(value) { + return !!(value != null && value._isParamType); + }; + return ParamType2; + }() + ); + exports2.ParamType = ParamType; + function parseParams(value, allowIndex) { + return splitNesting(value).map(function(param) { + return ParamType.fromString(param, allowIndex); + }); + } + var Fragment = ( + /** @class */ + function() { + function Fragment2(constructorGuard, params) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("use a static from method", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Fragment()" + }); + } + populate(this, params); + this._isFragment = true; + Object.freeze(this); + } + Fragment2.from = function(value) { + if (Fragment2.isFragment(value)) { + return value; + } + if (typeof value === "string") { + return Fragment2.fromString(value); + } + return Fragment2.fromObject(value); + }; + Fragment2.fromObject = function(value) { + if (Fragment2.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": + return null; + } + return logger.throwArgumentError("invalid fragment object", "value", value); + }; + Fragment2.fromString = function(value) { + 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); + }; + Fragment2.isFragment = function(value) { + return !!(value && value._isFragment); + }; + return Fragment2; + }() + ); + exports2.Fragment = Fragment; + var EventFragment = ( + /** @class */ + function(_super) { + __extends(EventFragment2, _super); + function EventFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + EventFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + var result = ""; + if (format !== exports2.FormatTypes.sighash) { + result += "event "; + } + result += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (format !== exports2.FormatTypes.sighash) { + if (this.anonymous) { + result += "anonymous "; + } + } + return result.trim(); + }; + EventFragment2.from = function(value) { + if (typeof value === "string") { + return EventFragment2.fromString(value); + } + return EventFragment2.fromObject(value); + }; + EventFragment2.fromObject = function(value) { + if (EventFragment2.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 EventFragment2(_constructorGuard, params); + }; + EventFragment2.fromString = function(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 EventFragment2.fromObject({ + name: match[1].trim(), + anonymous, + inputs: parseParams(match[2], true), + type: "event" + }); + }; + EventFragment2.isEventFragment = function(value) { + return value && value._isFragment && value.type === "event"; + }; + return EventFragment2; + }(Fragment) + ); + exports2.EventFragment = EventFragment; + 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 = bignumber_1.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; + 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); + } + } + 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 (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 = ( + /** @class */ + function(_super) { + __extends(ConstructorFragment2, _super); + function ConstructorFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ConstructorFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "constructor", + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + if (format === exports2.FormatTypes.sighash) { + logger.throwError("cannot format a constructor for sighash", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "format(sighash)" + }); + } + var result = "constructor(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (this.stateMutability && this.stateMutability !== "nonpayable") { + result += this.stateMutability + " "; + } + return result.trim(); + }; + ConstructorFragment2.from = function(value) { + if (typeof value === "string") { + return ConstructorFragment2.fromString(value); + } + return ConstructorFragment2.fromObject(value); + }; + ConstructorFragment2.fromObject = function(value) { + if (ConstructorFragment2.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 ? bignumber_1.BigNumber.from(value.gas) : null + }; + return new ConstructorFragment2(_constructorGuard, params); + }; + ConstructorFragment2.fromString = function(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 ConstructorFragment2.fromObject(params); + }; + ConstructorFragment2.isConstructorFragment = function(value) { + return value && value._isFragment && value.type === "constructor"; + }; + return ConstructorFragment2; + }(Fragment) + ); + exports2.ConstructorFragment = ConstructorFragment; + var FunctionFragment = ( + /** @class */ + function(_super) { + __extends(FunctionFragment2, _super); + function FunctionFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + FunctionFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }), + outputs: this.outputs.map(function(output) { + return JSON.parse(output.format(format)); + }) + }); + } + var result = ""; + if (format !== exports2.FormatTypes.sighash) { + result += "function "; + } + result += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (format !== exports2.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(format); + }).join(", ") + ") "; + } + if (this.gas != null) { + result += "@" + this.gas.toString() + " "; + } + } + return result.trim(); + }; + FunctionFragment2.from = function(value) { + if (typeof value === "string") { + return FunctionFragment2.fromString(value); + } + return FunctionFragment2.fromObject(value); + }; + FunctionFragment2.fromObject = function(value) { + if (FunctionFragment2.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 ? bignumber_1.BigNumber.from(value.gas) : null + }; + return new FunctionFragment2(_constructorGuard, params); + }; + FunctionFragment2.fromString = function(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); + 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 FunctionFragment2.fromObject(params); + }; + FunctionFragment2.isFunctionFragment = function(value) { + return value && value._isFragment && value.type === "function"; + }; + return FunctionFragment2; + }(ConstructorFragment) + ); + exports2.FunctionFragment = FunctionFragment; + function checkForbidden(fragment) { + var sig = fragment.format(); + if (sig === "Error(string)" || sig === "Panic(uint256)") { + logger.throwArgumentError("cannot specify user defined " + sig + " error", "fragment", fragment); + } + return fragment; + } + var ErrorFragment = ( + /** @class */ + function(_super) { + __extends(ErrorFragment2, _super); + function ErrorFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ErrorFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + var result = ""; + if (format !== exports2.FormatTypes.sighash) { + result += "error "; + } + result += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + return result.trim(); + }; + ErrorFragment2.from = function(value) { + if (typeof value === "string") { + return ErrorFragment2.fromString(value); + } + return ErrorFragment2.fromObject(value); + }; + ErrorFragment2.fromObject = function(value) { + if (ErrorFragment2.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 ErrorFragment2(_constructorGuard, params)); + }; + ErrorFragment2.fromString = function(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(ErrorFragment2.fromObject(params)); + }; + ErrorFragment2.isErrorFragment = function(value) { + return value && value._isFragment && value.type === "error"; + }; + return ErrorFragment2; + }(Fragment) + ); + exports2.ErrorFragment = ErrorFragment; + function verifyType(type) { + if (type.match(/^uint($|[^1-9])/)) { + type = "uint256" + type.substring(4); + } else if (type.match(/^int($|[^1-9])/)) { + type = "int256" + type.substring(3); + } + return type; + } + var regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); + function verifyIdentifier(value) { + if (!value || !value.match(regexIdentifier)) { + logger.throwArgumentError('invalid identifier "' + 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/coders/abstract-coder.js +var require_abstract_coder = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/abstract-coder.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Reader = exports2.Writer = exports2.Coder = exports2.checkResultErrors = void 0; + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + function checkResultErrors(result) { + var errors = []; + var checkErrors = function(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 }); + } + } + }; + checkErrors([], result); + return errors; + } + exports2.checkResultErrors = checkResultErrors; + var Coder = ( + /** @class */ + function() { + function Coder2(name2, type, localName, dynamic) { + this.name = name2; + this.type = type; + this.localName = localName; + this.dynamic = dynamic; + } + Coder2.prototype._throwError = function(message, value) { + logger.throwArgumentError(message, this.localName, value); + }; + return Coder2; + }() + ); + exports2.Coder = Coder; + var Writer = ( + /** @class */ + function() { + function Writer2(wordSize) { + (0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32); + this._data = []; + this._dataLength = 0; + this._padding = new Uint8Array(wordSize); + } + Object.defineProperty(Writer2.prototype, "data", { + get: function() { + return (0, bytes_1.hexConcat)(this._data); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Writer2.prototype, "length", { + get: function() { + return this._dataLength; + }, + enumerable: false, + configurable: true + }); + Writer2.prototype._writeData = function(data) { + this._data.push(data); + this._dataLength += data.length; + return data.length; + }; + Writer2.prototype.appendWriter = function(writer) { + return this._writeData((0, bytes_1.concat)(writer._data)); + }; + Writer2.prototype.writeBytes = function(value) { + var bytes = (0, bytes_1.arrayify)(value); + var paddingOffset = bytes.length % this.wordSize; + if (paddingOffset) { + bytes = (0, bytes_1.concat)([bytes, this._padding.slice(paddingOffset)]); + } + return this._writeData(bytes); + }; + Writer2.prototype._getValue = function(value) { + var bytes = (0, bytes_1.arrayify)(bignumber_1.BigNumber.from(value)); + if (bytes.length > this.wordSize) { + logger.throwError("value out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: this.wordSize, + offset: bytes.length + }); + } + if (bytes.length % this.wordSize) { + bytes = (0, bytes_1.concat)([this._padding.slice(bytes.length % this.wordSize), bytes]); + } + return bytes; + }; + Writer2.prototype.writeValue = function(value) { + return this._writeData(this._getValue(value)); + }; + Writer2.prototype.writeUpdatableValue = function() { + 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 Writer2; + }() + ); + exports2.Writer = Writer; + var Reader = ( + /** @class */ + function() { + function Reader2(data, wordSize, coerceFunc, allowLoose) { + (0, properties_1.defineReadOnly)(this, "_data", (0, bytes_1.arrayify)(data)); + (0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32); + (0, properties_1.defineReadOnly)(this, "_coerceFunc", coerceFunc); + (0, properties_1.defineReadOnly)(this, "allowLoose", allowLoose); + this._offset = 0; + } + Object.defineProperty(Reader2.prototype, "data", { + get: function() { + return (0, bytes_1.hexlify)(this._data); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Reader2.prototype, "consumed", { + get: function() { + return this._offset; + }, + enumerable: false, + configurable: true + }); + Reader2.coerce = function(name2, value) { + var match = name2.match("^u?int([0-9]+)$"); + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + return value; + }; + Reader2.prototype.coerce = function(name2, value) { + if (this._coerceFunc) { + return this._coerceFunc(name2, value); + } + return Reader2.coerce(name2, value); + }; + Reader2.prototype._peekBytes = function(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", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + return this._data.slice(this._offset, this._offset + alignedLength); + }; + Reader2.prototype.subReader = function(offset) { + return new Reader2(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + }; + Reader2.prototype.readBytes = function(length, loose) { + var bytes = this._peekBytes(0, length, !!loose); + this._offset += bytes.length; + return bytes.slice(0, length); + }; + Reader2.prototype.readValue = function() { + return bignumber_1.BigNumber.from(this.readBytes(this.wordSize)); + }; + return Reader2; + }() + ); + exports2.Reader = Reader; + } +}); + +// node_modules/js-sha3/src/sha3.js +var require_sha3 = __commonJS({ + "node_modules/js-sha3/src/sha3.js"(exports2, module2) { + (function() { + "use strict"; + var INPUT_ERROR = "input is invalid type"; + var FINALIZE_ERROR = "finalize already called"; + var WINDOW = typeof window === "object"; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === "object"; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && 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 && typeof module2 === "object" && module2.exports; + var AMD = typeof define === "function" && define.amd; + 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(bits2, padding, outputType) { + return function(message) { + return new Keccak(bits2, padding, bits2).update(message)[outputType](); + }; + }; + var createShakeOutputMethod = function(bits2, padding, outputType) { + return function(message, outputBits) { + return new Keccak(bits2, padding, outputBits).update(message)[outputType](); + }; + }; + var createCshakeOutputMethod = function(bits2, padding, outputType) { + return function(message, outputBits, n, s) { + return methods["cshake" + bits2].update(message, outputBits, n, s)[outputType](); + }; + }; + var createKmacOutputMethod = function(bits2, padding, outputType) { + return function(key, message, outputBits, s) { + return methods["kmac" + bits2].update(key, message, outputBits, s)[outputType](); + }; + }; + var createOutputMethods = function(method, createMethod2, bits2, padding) { + for (var i2 = 0; i2 < OUTPUT_TYPES.length; ++i2) { + var type = OUTPUT_TYPES[i2]; + method[type] = createMethod2(bits2, padding, type); + } + return method; + }; + var createMethod = function(bits2, padding) { + var method = createOutputMethod(bits2, padding, "hex"); + method.create = function() { + return new Keccak(bits2, padding, bits2); + }; + method.update = function(message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits2, padding); + }; + var createShakeMethod = function(bits2, padding) { + var method = createShakeOutputMethod(bits2, padding, "hex"); + method.create = function(outputBits) { + return new Keccak(bits2, padding, outputBits); + }; + method.update = function(message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits2, padding); + }; + var createCshakeMethod = function(bits2, padding) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createCshakeOutputMethod(bits2, padding, "hex"); + method.create = function(outputBits, n, s) { + if (!n && !s) { + return methods["shake" + bits2].create(outputBits); + } else { + return new Keccak(bits2, 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, bits2, padding); + }; + var createKmacMethod = function(bits2, padding) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createKmacOutputMethod(bits2, padding, "hex"); + method.create = function(key, outputBits, s) { + return new Kmac(bits2, 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, bits2, padding); + }; + var algorithms = [ + { name: "keccak", padding: KECCAK_PADDING, bits: BITS, createMethod }, + { name: "sha3", padding: PADDING, bits: BITS, 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(bits2, 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 - (bits2 << 1) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + for (var i2 = 0; i2 < 50; ++i2) { + this.s[i2] = 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, i2, code; + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; + } + } + if (notString) { + for (i2 = this.start; index < length && i2 < byteCount; ++index) { + blocks[i2 >> 2] |= message[index] << SHIFT[i2++ & 3]; + } + } else { + for (i2 = this.start; index < length && i2 < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 128) { + blocks[i2 >> 2] |= code << SHIFT[i2++ & 3]; + } else if (code < 2048) { + blocks[i2 >> 2] |= (192 | code >> 6) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } else if (code < 55296 || code >= 57344) { + blocks[i2 >> 2] |= (224 | code >> 12) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } else { + code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023); + blocks[i2 >> 2] |= (240 | code >> 18) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 12 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } + } + } + this.lastByteIndex = i2; + if (i2 >= byteCount) { + this.start = i2 - byteCount; + this.block = blocks[blockCount]; + for (i2 = 0; i2 < blockCount; ++i2) { + s[i2] ^= blocks[i2]; + } + f(s); + this.reset = true; + } else { + this.start = i2; + } + } + 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 i2 = 0; i2 < str.length; ++i2) { + var code = str.charCodeAt(i2); + if (code < 128) { + bytes += 1; + } else if (code < 2048) { + bytes += 2; + } else if (code < 55296 || code >= 57344) { + bytes += 3; + } else { + code = 65536 + ((code & 1023) << 10 | str.charCodeAt(++i2) & 1023); + 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 i2 = 0; i2 < strs.length; ++i2) { + bytes += this.encodeString(strs[i2]); + } + 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, i2 = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i2 >> 2] |= this.padding[i2 & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; + } + } + blocks[blockCount - 1] |= 2147483648; + for (i2 = 0; i2 < blockCount; ++i2) { + s[i2] ^= blocks[i2]; + } + f(s); + }; + Keccak.prototype.toString = Keccak.prototype.hex = function() { + this.finalize(); + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 0; + var hex = "", block; + while (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + block = s[i2]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15] + HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15] + HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15] + HEX_CHARS[block >> 28 & 15] + HEX_CHARS[block >> 24 & 15]; + } + if (j2 % blockCount === 0) { + f(s); + i2 = 0; + } + } + if (extraBytes) { + block = s[i2]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15]; + if (extraBytes > 1) { + hex += HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15]; + } + } + return hex; + }; + Keccak.prototype.arrayBuffer = function() { + this.finalize(); + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 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 (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + array[j2] = s[i2]; + } + if (j2 % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i2] = s[i2]; + 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, i2 = 0, j2 = 0; + var array = [], offset, block; + while (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + offset = j2 << 2; + block = s[i2]; + array[offset] = block & 255; + array[offset + 1] = block >> 8 & 255; + array[offset + 2] = block >> 16 & 255; + array[offset + 3] = block >> 24 & 255; + } + if (j2 % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j2 << 2; + block = s[i2]; + array[offset] = block & 255; + if (extraBytes > 1) { + array[offset + 1] = block >> 8 & 255; + } + if (extraBytes > 2) { + array[offset + 2] = block >> 16 & 255; + } + } + return array; + }; + function Kmac(bits2, padding, outputBits) { + Keccak.call(this, bits2, padding, outputBits); + } + Kmac.prototype = new Keccak(); + Kmac.prototype.finalize = function() { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + var f = function(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) { + module2.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + if (AMD) { + define(function() { + return methods; + }); + } + } + })(); + } +}); + +// node_modules/@ethersproject/keccak256/lib/index.js +var require_lib5 = __commonJS({ + "node_modules/@ethersproject/keccak256/lib/index.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.keccak256 = void 0; + var js_sha3_1 = __importDefault(require_sha3()); + var bytes_1 = require_lib2(); + function keccak256(data) { + return "0x" + js_sha3_1.default.keccak_256((0, bytes_1.arrayify)(data)); + } + exports2.keccak256 = keccak256; + } +}); + +// node_modules/@ethersproject/rlp/lib/_version.js +var require_version6 = __commonJS({ + "node_modules/@ethersproject/rlp/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "rlp/5.5.0"; + } +}); + +// node_modules/@ethersproject/rlp/lib/index.js +var require_lib6 = __commonJS({ + "node_modules/@ethersproject/rlp/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decode = exports2.encode = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version6(); + var logger = new logger_1.Logger(_version_1.version); + function arrayifyInteger(value) { + var result = []; + while (value) { + result.unshift(value & 255); + 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_1 = []; + object.forEach(function(child) { + payload_1 = payload_1.concat(_encode(child)); + }); + if (payload_1.length <= 55) { + payload_1.unshift(192 + payload_1.length); + return payload_1; + } + var length_1 = arrayifyInteger(payload_1.length); + length_1.unshift(247 + length_1.length); + return length_1.concat(payload_1); + } + if (!(0, bytes_1.isBytesLike)(object)) { + logger.throwArgumentError("RLP object must be BytesLike", "object", object); + } + var data = Array.prototype.slice.call((0, bytes_1.arrayify)(object)); + if (data.length === 1 && data[0] <= 127) { + return data; + } else if (data.length <= 55) { + data.unshift(128 + data.length); + return data; + } + var length = arrayifyInteger(data.length); + length.unshift(183 + length.length); + return length.concat(data); + } + function encode(object) { + return (0, bytes_1.hexlify)(_encode(object)); + } + exports2.encode = encode; + 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", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + } + return { consumed: 1 + length, result }; + } + function _decode(data, offset) { + if (data.length === 0) { + logger.throwError("data too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + if (data[offset] >= 248) { + var lengthLength = data[offset] - 247; + if (offset + 1 + lengthLength > data.length) { + logger.throwError("data short segment too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var length_2 = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length_2 > data.length) { + logger.throwError("data long segment too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length_2); + } else if (data[offset] >= 192) { + var length_3 = data[offset] - 192; + if (offset + 1 + length_3 > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1, length_3); + } else if (data[offset] >= 184) { + var lengthLength = data[offset] - 183; + if (offset + 1 + lengthLength > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var length_4 = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length_4 > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var result = (0, bytes_1.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length_4)); + return { consumed: 1 + lengthLength + length_4, result }; + } else if (data[offset] >= 128) { + var length_5 = data[offset] - 128; + if (offset + 1 + length_5 > data.length) { + logger.throwError("data too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var result = (0, bytes_1.hexlify)(data.slice(offset + 1, offset + 1 + length_5)); + return { consumed: 1 + length_5, result }; + } + return { consumed: 1, result: (0, bytes_1.hexlify)(data[offset]) }; + } + function decode(data) { + var bytes = (0, bytes_1.arrayify)(data); + var decoded = _decode(bytes, 0); + if (decoded.consumed !== bytes.length) { + logger.throwArgumentError("invalid rlp data", "data", data); + } + return decoded.result; + } + exports2.decode = decode; + } +}); + +// node_modules/@ethersproject/address/lib/_version.js +var require_version7 = __commonJS({ + "node_modules/@ethersproject/address/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "address/5.5.0"; + } +}); + +// node_modules/@ethersproject/address/lib/index.js +var require_lib7 = __commonJS({ + "node_modules/@ethersproject/address/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getCreate2Address = exports2.getContractAddress = exports2.getIcapAddress = exports2.isAddress = exports2.getAddress = void 0; + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var keccak256_1 = require_lib5(); + var rlp_1 = require_lib6(); + var logger_1 = require_lib(); + var _version_1 = require_version7(); + var logger = new logger_1.Logger(_version_1.version); + function getChecksumAddress(address) { + if (!(0, bytes_1.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 i2 = 0; i2 < 40; i2++) { + expanded[i2] = chars[i2].charCodeAt(0); + } + var hashed = (0, bytes_1.arrayify)((0, keccak256_1.keccak256)(expanded)); + for (var i2 = 0; i2 < 40; i2 += 2) { + if (hashed[i2 >> 1] >> 4 >= 8) { + chars[i2] = chars[i2].toUpperCase(); + } + if ((hashed[i2 >> 1] & 15) >= 8) { + chars[i2 + 1] = chars[i2 + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); + } + var MAX_SAFE_INTEGER = 9007199254740991; + function log10(x) { + if (Math.log10) { + return Math.log10(x); + } + return Math.log(x) / Math.LN10; + } + var ibanLookup = {}; + for (i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); + } + var i; + for (i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); + } + var i; + 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(""); + 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}$/)) { + if (address.substring(0, 2) !== "0x") { + address = "0x" + address; + } + result = getChecksumAddress(address); + if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { + logger.throwArgumentError("bad address checksum", "address", address); + } + } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + if (address.substring(2, 4) !== ibanChecksum(address)) { + logger.throwArgumentError("bad icap checksum", "address", address); + } + result = (0, bignumber_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; + } + exports2.getAddress = getAddress; + function isAddress(address) { + try { + getAddress(address); + return true; + } catch (error) { + } + return false; + } + exports2.isAddress = isAddress; + function getIcapAddress(address) { + var base36 = (0, bignumber_1._base16To36)(getAddress(address).substring(2)).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; + } + exports2.getIcapAddress = getIcapAddress; + function getContractAddress(transaction) { + var from = null; + try { + from = getAddress(transaction.from); + } catch (error) { + logger.throwArgumentError("missing from address", "transaction", transaction); + } + var nonce = (0, bytes_1.stripZeros)((0, bytes_1.arrayify)(bignumber_1.BigNumber.from(transaction.nonce).toHexString())); + return getAddress((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, rlp_1.encode)([from, nonce])), 12)); + } + exports2.getContractAddress = getContractAddress; + function getCreate2Address(from, salt, initCodeHash) { + if ((0, bytes_1.hexDataLength)(salt) !== 32) { + logger.throwArgumentError("salt must be 32 bytes", "salt", salt); + } + if ((0, bytes_1.hexDataLength)(initCodeHash) !== 32) { + logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); + } + return getAddress((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.concat)(["0xff", getAddress(from), salt, initCodeHash])), 12)); + } + exports2.getCreate2Address = getCreate2Address; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/address.js +var require_address = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/address.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AddressCoder = void 0; + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var AddressCoder = ( + /** @class */ + function(_super) { + __extends(AddressCoder2, _super); + function AddressCoder2(localName) { + return _super.call(this, "address", "address", localName, false) || this; + } + AddressCoder2.prototype.defaultValue = function() { + return "0x0000000000000000000000000000000000000000"; + }; + AddressCoder2.prototype.encode = function(writer, value) { + try { + value = (0, address_1.getAddress)(value); + } catch (error) { + this._throwError(error.message, value); + } + return writer.writeValue(value); + }; + AddressCoder2.prototype.decode = function(reader) { + return (0, address_1.getAddress)((0, bytes_1.hexZeroPad)(reader.readValue().toHexString(), 20)); + }; + return AddressCoder2; + }(abstract_coder_1.Coder) + ); + exports2.AddressCoder = AddressCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/anonymous.js +var require_anonymous = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/anonymous.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AnonymousCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var AnonymousCoder = ( + /** @class */ + function(_super) { + __extends(AnonymousCoder2, _super); + function AnonymousCoder2(coder) { + var _this = _super.call(this, coder.name, coder.type, void 0, coder.dynamic) || this; + _this.coder = coder; + return _this; + } + AnonymousCoder2.prototype.defaultValue = function() { + return this.coder.defaultValue(); + }; + AnonymousCoder2.prototype.encode = function(writer, value) { + return this.coder.encode(writer, value); + }; + AnonymousCoder2.prototype.decode = function(reader) { + return this.coder.decode(reader); + }; + return AnonymousCoder2; + }(abstract_coder_1.Coder) + ); + exports2.AnonymousCoder = AnonymousCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/array.js +var require_array = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/array.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ArrayCoder = exports2.unpack = exports2.pack = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var abstract_coder_1 = require_abstract_coder(); + var anonymous_1 = require_anonymous(); + function pack(writer, coders, values) { + var arrayValues = null; + if (Array.isArray(values)) { + arrayValues = values; + } else if (values && typeof values === "object") { + var unique_1 = {}; + arrayValues = coders.map(function(coder) { + var name2 = coder.localName; + if (!name2) { + logger.throwError("cannot encode object for signature with missing names", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + if (unique_1[name2]) { + logger.throwError("cannot encode object for signature with duplicate names", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + unique_1[name2] = true; + return values[name2]; + }); + } 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_1.Writer(writer.wordSize); + var dynamicWriter = new abstract_coder_1.Writer(writer.wordSize); + var updateFuncs = []; + coders.forEach(function(coder, index) { + var value = arrayValues[index]; + if (coder.dynamic) { + var dynamicOffset_1 = dynamicWriter.length; + coder.encode(dynamicWriter, value); + var updateFunc_1 = staticWriter.writeUpdatableValue(); + updateFuncs.push(function(baseOffset) { + updateFunc_1(baseOffset + dynamicOffset_1); + }); + } else { + coder.encode(staticWriter, value); + } + }); + updateFuncs.forEach(function(func) { + func(staticWriter.length); + }); + var length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; + } + exports2.pack = pack; + function unpack(reader, coders) { + var values = []; + 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) { + if (error.code === logger_1.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) { + if (error.code === logger_1.Logger.errors.BUFFER_OVERRUN) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value != void 0) { + values.push(value); + } + }); + var uniqueNames = coders.reduce(function(accum, coder) { + var name2 = coder.localName; + if (name2) { + if (!accum[name2]) { + accum[name2] = 0; + } + accum[name2]++; + } + return accum; + }, {}); + coders.forEach(function(coder, index) { + var name2 = coder.localName; + if (!name2 || uniqueNames[name2] !== 1) { + return; + } + if (name2 === "length") { + name2 = "_length"; + } + if (values[name2] != null) { + return; + } + var value = values[index]; + if (value instanceof Error) { + Object.defineProperty(values, name2, { + enumerable: true, + get: function() { + throw value; + } + }); + } else { + values[name2] = value; + } + }); + var _loop_1 = function(i2) { + var value = values[i2]; + if (value instanceof Error) { + Object.defineProperty(values, i2, { + enumerable: true, + get: function() { + throw value; + } + }); + } + }; + for (var i = 0; i < values.length; i++) { + _loop_1(i); + } + return Object.freeze(values); + } + exports2.unpack = unpack; + var ArrayCoder = ( + /** @class */ + function(_super) { + __extends(ArrayCoder2, _super); + function ArrayCoder2(coder, length, localName) { + var _this = this; + var type = coder.type + "[" + (length >= 0 ? length : "") + "]"; + var dynamic = length === -1 || coder.dynamic; + _this = _super.call(this, "array", type, localName, dynamic) || this; + _this.coder = coder; + _this.length = length; + return _this; + } + ArrayCoder2.prototype.defaultValue = function() { + var defaultChild = this.coder.defaultValue(); + var result = []; + for (var i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + }; + ArrayCoder2.prototype.encode = function(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); + }; + ArrayCoder2.prototype.decode = function(reader) { + var count = this.length; + if (count === -1) { + count = reader.readValue().toNumber(); + if (count * 32 > reader._data.length) { + logger.throwError("insufficient data length", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: reader._data.length, + count + }); + } + } + var coders = []; + for (var i = 0; i < count; i++) { + coders.push(new anonymous_1.AnonymousCoder(this.coder)); + } + return reader.coerce(this.name, unpack(reader, coders)); + }; + return ArrayCoder2; + }(abstract_coder_1.Coder) + ); + exports2.ArrayCoder = ArrayCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/boolean.js +var require_boolean = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/boolean.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BooleanCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var BooleanCoder = ( + /** @class */ + function(_super) { + __extends(BooleanCoder2, _super); + function BooleanCoder2(localName) { + return _super.call(this, "bool", "bool", localName, false) || this; + } + BooleanCoder2.prototype.defaultValue = function() { + return false; + }; + BooleanCoder2.prototype.encode = function(writer, value) { + return writer.writeValue(value ? 1 : 0); + }; + BooleanCoder2.prototype.decode = function(reader) { + return reader.coerce(this.type, !reader.readValue().isZero()); + }; + return BooleanCoder2; + }(abstract_coder_1.Coder) + ); + exports2.BooleanCoder = BooleanCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/bytes.js +var require_bytes = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/bytes.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BytesCoder = exports2.DynamicBytesCoder = void 0; + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var DynamicBytesCoder = ( + /** @class */ + function(_super) { + __extends(DynamicBytesCoder2, _super); + function DynamicBytesCoder2(type, localName) { + return _super.call(this, type, type, localName, true) || this; + } + DynamicBytesCoder2.prototype.defaultValue = function() { + return "0x"; + }; + DynamicBytesCoder2.prototype.encode = function(writer, value) { + value = (0, bytes_1.arrayify)(value); + var length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + }; + DynamicBytesCoder2.prototype.decode = function(reader) { + return reader.readBytes(reader.readValue().toNumber(), true); + }; + return DynamicBytesCoder2; + }(abstract_coder_1.Coder) + ); + exports2.DynamicBytesCoder = DynamicBytesCoder; + var BytesCoder = ( + /** @class */ + function(_super) { + __extends(BytesCoder2, _super); + function BytesCoder2(localName) { + return _super.call(this, "bytes", localName) || this; + } + BytesCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, bytes_1.hexlify)(_super.prototype.decode.call(this, reader))); + }; + return BytesCoder2; + }(DynamicBytesCoder) + ); + exports2.BytesCoder = BytesCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/fixed-bytes.js +var require_fixed_bytes = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/fixed-bytes.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FixedBytesCoder = void 0; + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var FixedBytesCoder = ( + /** @class */ + function(_super) { + __extends(FixedBytesCoder2, _super); + function FixedBytesCoder2(size, localName) { + var _this = this; + var name2 = "bytes" + String(size); + _this = _super.call(this, name2, name2, localName, false) || this; + _this.size = size; + return _this; + } + FixedBytesCoder2.prototype.defaultValue = function() { + return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); + }; + FixedBytesCoder2.prototype.encode = function(writer, value) { + var data = (0, bytes_1.arrayify)(value); + if (data.length !== this.size) { + this._throwError("incorrect data length", value); + } + return writer.writeBytes(data); + }; + FixedBytesCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, bytes_1.hexlify)(reader.readBytes(this.size))); + }; + return FixedBytesCoder2; + }(abstract_coder_1.Coder) + ); + exports2.FixedBytesCoder = FixedBytesCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/null.js +var require_null = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/null.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NullCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var NullCoder = ( + /** @class */ + function(_super) { + __extends(NullCoder2, _super); + function NullCoder2(localName) { + return _super.call(this, "null", "", localName, false) || this; + } + NullCoder2.prototype.defaultValue = function() { + return null; + }; + NullCoder2.prototype.encode = function(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes([]); + }; + NullCoder2.prototype.decode = function(reader) { + reader.readBytes(0); + return reader.coerce(this.name, null); + }; + return NullCoder2; + }(abstract_coder_1.Coder) + ); + exports2.NullCoder = NullCoder; + } +}); + +// node_modules/@ethersproject/constants/lib/addresses.js +var require_addresses = __commonJS({ + "node_modules/@ethersproject/constants/lib/addresses.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AddressZero = void 0; + exports2.AddressZero = "0x0000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib/bignumbers.js +var require_bignumbers = __commonJS({ + "node_modules/@ethersproject/constants/lib/bignumbers.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MaxInt256 = exports2.MinInt256 = exports2.MaxUint256 = exports2.WeiPerEther = exports2.Two = exports2.One = exports2.Zero = exports2.NegativeOne = void 0; + var bignumber_1 = require_lib3(); + var NegativeOne = /* @__PURE__ */ bignumber_1.BigNumber.from(-1); + exports2.NegativeOne = NegativeOne; + var Zero = /* @__PURE__ */ bignumber_1.BigNumber.from(0); + exports2.Zero = Zero; + var One = /* @__PURE__ */ bignumber_1.BigNumber.from(1); + exports2.One = One; + var Two = /* @__PURE__ */ bignumber_1.BigNumber.from(2); + exports2.Two = Two; + var WeiPerEther = /* @__PURE__ */ bignumber_1.BigNumber.from("1000000000000000000"); + exports2.WeiPerEther = WeiPerEther; + var MaxUint256 = /* @__PURE__ */ bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + exports2.MaxUint256 = MaxUint256; + var MinInt256 = /* @__PURE__ */ bignumber_1.BigNumber.from("-0x8000000000000000000000000000000000000000000000000000000000000000"); + exports2.MinInt256 = MinInt256; + var MaxInt256 = /* @__PURE__ */ bignumber_1.BigNumber.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + exports2.MaxInt256 = MaxInt256; + } +}); + +// node_modules/@ethersproject/constants/lib/hashes.js +var require_hashes = __commonJS({ + "node_modules/@ethersproject/constants/lib/hashes.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.HashZero = void 0; + exports2.HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib/strings.js +var require_strings = __commonJS({ + "node_modules/@ethersproject/constants/lib/strings.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherSymbol = void 0; + exports2.EtherSymbol = "\u039E"; + } +}); + +// node_modules/@ethersproject/constants/lib/index.js +var require_lib8 = __commonJS({ + "node_modules/@ethersproject/constants/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherSymbol = exports2.HashZero = exports2.MaxInt256 = exports2.MinInt256 = exports2.MaxUint256 = exports2.WeiPerEther = exports2.Two = exports2.One = exports2.Zero = exports2.NegativeOne = exports2.AddressZero = void 0; + var addresses_1 = require_addresses(); + Object.defineProperty(exports2, "AddressZero", { enumerable: true, get: function() { + return addresses_1.AddressZero; + } }); + var bignumbers_1 = require_bignumbers(); + Object.defineProperty(exports2, "NegativeOne", { enumerable: true, get: function() { + return bignumbers_1.NegativeOne; + } }); + Object.defineProperty(exports2, "Zero", { enumerable: true, get: function() { + return bignumbers_1.Zero; + } }); + Object.defineProperty(exports2, "One", { enumerable: true, get: function() { + return bignumbers_1.One; + } }); + Object.defineProperty(exports2, "Two", { enumerable: true, get: function() { + return bignumbers_1.Two; + } }); + Object.defineProperty(exports2, "WeiPerEther", { enumerable: true, get: function() { + return bignumbers_1.WeiPerEther; + } }); + Object.defineProperty(exports2, "MaxUint256", { enumerable: true, get: function() { + return bignumbers_1.MaxUint256; + } }); + Object.defineProperty(exports2, "MinInt256", { enumerable: true, get: function() { + return bignumbers_1.MinInt256; + } }); + Object.defineProperty(exports2, "MaxInt256", { enumerable: true, get: function() { + return bignumbers_1.MaxInt256; + } }); + var hashes_1 = require_hashes(); + Object.defineProperty(exports2, "HashZero", { enumerable: true, get: function() { + return hashes_1.HashZero; + } }); + var strings_1 = require_strings(); + Object.defineProperty(exports2, "EtherSymbol", { enumerable: true, get: function() { + return strings_1.EtherSymbol; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/coders/number.js +var require_number = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/number.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NumberCoder = void 0; + var bignumber_1 = require_lib3(); + var constants_1 = require_lib8(); + var abstract_coder_1 = require_abstract_coder(); + var NumberCoder = ( + /** @class */ + function(_super) { + __extends(NumberCoder2, _super); + function NumberCoder2(size, signed, localName) { + var _this = this; + var name2 = (signed ? "int" : "uint") + size * 8; + _this = _super.call(this, name2, name2, localName, false) || this; + _this.size = size; + _this.signed = signed; + return _this; + } + NumberCoder2.prototype.defaultValue = function() { + return 0; + }; + NumberCoder2.prototype.encode = function(writer, value) { + var v = bignumber_1.BigNumber.from(value); + var maxUintValue = constants_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(constants_1.One).mul(constants_1.NegativeOne))) { + this._throwError("value out-of-bounds", value); + } + } else if (v.lt(constants_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); + }; + NumberCoder2.prototype.decode = function(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 NumberCoder2; + }(abstract_coder_1.Coder) + ); + exports2.NumberCoder = NumberCoder; + } +}); + +// node_modules/@ethersproject/strings/lib/_version.js +var require_version8 = __commonJS({ + "node_modules/@ethersproject/strings/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "strings/5.5.0"; + } +}); + +// node_modules/@ethersproject/strings/lib/utf8.js +var require_utf8 = __commonJS({ + "node_modules/@ethersproject/strings/lib/utf8.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.toUtf8CodePoints = exports2.toUtf8String = exports2._toUtf8String = exports2._toEscapedUtf8String = exports2.toUtf8Bytes = exports2.Utf8ErrorFuncs = exports2.Utf8ErrorReason = exports2.UnicodeNormalizationForm = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version8(); + var logger = new logger_1.Logger(_version_1.version); + var UnicodeNormalizationForm; + (function(UnicodeNormalizationForm2) { + UnicodeNormalizationForm2["current"] = ""; + UnicodeNormalizationForm2["NFC"] = "NFC"; + UnicodeNormalizationForm2["NFD"] = "NFD"; + UnicodeNormalizationForm2["NFKC"] = "NFKC"; + UnicodeNormalizationForm2["NFKD"] = "NFKD"; + })(UnicodeNormalizationForm = exports2.UnicodeNormalizationForm || (exports2.UnicodeNormalizationForm = {})); + var Utf8ErrorReason; + (function(Utf8ErrorReason2) { + Utf8ErrorReason2["UNEXPECTED_CONTINUE"] = "unexpected continuation byte"; + Utf8ErrorReason2["BAD_PREFIX"] = "bad codepoint prefix"; + Utf8ErrorReason2["OVERRUN"] = "string overrun"; + Utf8ErrorReason2["MISSING_CONTINUE"] = "missing continuation byte"; + Utf8ErrorReason2["OUT_OF_RANGE"] = "out of UTF-8 range"; + Utf8ErrorReason2["UTF16_SURROGATE"] = "UTF-16 surrogate"; + Utf8ErrorReason2["OVERLONG"] = "overlong representation"; + })(Utf8ErrorReason = exports2.Utf8ErrorReason || (exports2.Utf8ErrorReason = {})); + function errorFunc(reason, offset, bytes, output, badCodepoint) { + return logger.throwArgumentError("invalid codepoint at offset " + offset + "; " + reason, "bytes", bytes); + } + function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + 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 !== 2) { + break; + } + i++; + } + return i; + } + if (reason === Utf8ErrorReason.OVERRUN) { + return bytes.length - offset - 1; + } + return 0; + } + function replaceFunc(reason, offset, bytes, output, badCodepoint) { + if (reason === Utf8ErrorReason.OVERLONG) { + output.push(badCodepoint); + return 0; + } + output.push(65533); + return ignoreFunc(reason, offset, bytes, output, badCodepoint); + } + exports2.Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc + }); + function getUtf8CodePoints(bytes, onError) { + if (onError == null) { + onError = exports2.Utf8ErrorFuncs.error; + } + bytes = (0, bytes_1.arrayify)(bytes); + var result = []; + var i = 0; + while (i < bytes.length) { + var c = bytes[i++]; + if (c >> 7 === 0) { + result.push(c); + continue; + } + var extraLength = null; + var overlongMask = null; + if ((c & 224) === 192) { + extraLength = 1; + overlongMask = 127; + } else if ((c & 240) === 224) { + extraLength = 2; + overlongMask = 2047; + } else if ((c & 248) === 240) { + extraLength = 3; + overlongMask = 65535; + } else { + if ((c & 192) === 128) { + i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result); + } else { + i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result); + } + continue; + } + if (i - 1 + extraLength >= bytes.length) { + i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result); + continue; + } + var res = c & (1 << 8 - extraLength - 1) - 1; + for (var j = 0; j < extraLength; j++) { + var nextChar = bytes[i]; + if ((nextChar & 192) != 128) { + i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result); + res = null; + break; + } + ; + res = res << 6 | nextChar & 63; + i++; + } + if (res === null) { + continue; + } + if (res > 1114111) { + i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res); + continue; + } + if (res >= 55296 && res <= 57343) { + i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res); + continue; + } + if (res <= overlongMask) { + i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; + } + function toUtf8Bytes(str, form) { + if (form === void 0) { + form = 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 < 128) { + result.push(c); + } else if (c < 2048) { + result.push(c >> 6 | 192); + result.push(c & 63 | 128); + } else if ((c & 64512) == 55296) { + i++; + var c2 = str.charCodeAt(i); + if (i >= str.length || (c2 & 64512) !== 56320) { + throw new Error("invalid utf-8 string"); + } + var pair = 65536 + ((c & 1023) << 10) + (c2 & 1023); + result.push(pair >> 18 | 240); + result.push(pair >> 12 & 63 | 128); + result.push(pair >> 6 & 63 | 128); + result.push(pair & 63 | 128); + } else { + result.push(c >> 12 | 224); + result.push(c >> 6 & 63 | 128); + result.push(c & 63 | 128); + } + } + return (0, bytes_1.arrayify)(result); + } + exports2.toUtf8Bytes = toUtf8Bytes; + 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 <= 65535) { + return escapeChar(codePoint); + } + codePoint -= 65536; + return escapeChar((codePoint >> 10 & 1023) + 55296) + escapeChar((codePoint & 1023) + 56320); + }).join("") + '"'; + } + exports2._toEscapedUtf8String = _toEscapedUtf8String; + function _toUtf8String(codePoints) { + return codePoints.map(function(codePoint) { + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); + } + codePoint -= 65536; + return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320); + }).join(""); + } + exports2._toUtf8String = _toUtf8String; + function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); + } + exports2.toUtf8String = toUtf8String; + function toUtf8CodePoints(str, form) { + if (form === void 0) { + form = UnicodeNormalizationForm.current; + } + return getUtf8CodePoints(toUtf8Bytes(str, form)); + } + exports2.toUtf8CodePoints = toUtf8CodePoints; + } +}); + +// node_modules/@ethersproject/strings/lib/bytes32.js +var require_bytes32 = __commonJS({ + "node_modules/@ethersproject/strings/lib/bytes32.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.parseBytes32String = exports2.formatBytes32String = void 0; + var constants_1 = require_lib8(); + var bytes_1 = require_lib2(); + var utf8_1 = require_utf8(); + function formatBytes32String(text) { + var bytes = (0, utf8_1.toUtf8Bytes)(text); + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([bytes, constants_1.HashZero]).slice(0, 32)); + } + exports2.formatBytes32String = formatBytes32String; + function parseBytes32String(bytes) { + var data = (0, bytes_1.arrayify)(bytes); + 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"); + } + var length = 31; + while (data[length - 1] === 0) { + length--; + } + return (0, utf8_1.toUtf8String)(data.slice(0, length)); + } + exports2.parseBytes32String = parseBytes32String; + } +}); + +// node_modules/@ethersproject/strings/lib/idna.js +var require_idna = __commonJS({ + "node_modules/@ethersproject/strings/lib/idna.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.nameprep = exports2._nameprepTableC = exports2._nameprepTableB2 = exports2._nameprepTableA1 = void 0; + var utf8_1 = require_utf8(); + 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(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"); + 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(value2) { + accum.push(value2); + }); + return accum; + }, []); + } + function _nameprepTableA1(codepoint) { + return !!matchMap(codepoint, Table_A_1_ranges); + } + exports2._nameprepTableA1 = _nameprepTableA1; + 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; + } + exports2._nameprepTableB2 = _nameprepTableB2; + function _nameprepTableC(codepoint) { + return !!matchMap(codepoint, Table_C_ranges); + } + exports2._nameprepTableC = _nameprepTableC; + function nameprep(value) { + if (value.match(/^[a-z0-9-]*$/i) && value.length <= 59) { + return value.toLowerCase(); + } + var codes = (0, utf8_1.toUtf8CodePoints)(value); + codes = flatten(codes.map(function(code) { + if (Table_B_1_flags.indexOf(code) >= 0) { + return []; + } + if (code >= 65024 && code <= 65039) { + return []; + } + var codesTableB2 = _nameprepTableB2(code); + if (codesTableB2) { + return codesTableB2; + } + return [code]; + })); + codes = (0, utf8_1.toUtf8CodePoints)((0, utf8_1._toUtf8String)(codes), utf8_1.UnicodeNormalizationForm.NFKC); + codes.forEach(function(code) { + if (_nameprepTableC(code)) { + throw new Error("STRINGPREP_CONTAINS_PROHIBITED"); + } + }); + codes.forEach(function(code) { + if (_nameprepTableA1(code)) { + throw new Error("STRINGPREP_CONTAINS_UNASSIGNED"); + } + }); + var name2 = (0, utf8_1._toUtf8String)(codes); + if (name2.substring(0, 1) === "-" || name2.substring(2, 4) === "--" || name2.substring(name2.length - 1) === "-") { + throw new Error("invalid hyphen"); + } + if (name2.length > 63) { + throw new Error("too long"); + } + return name2; + } + exports2.nameprep = nameprep; + } +}); + +// node_modules/@ethersproject/strings/lib/index.js +var require_lib9 = __commonJS({ + "node_modules/@ethersproject/strings/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.nameprep = exports2.parseBytes32String = exports2.formatBytes32String = exports2.UnicodeNormalizationForm = exports2.Utf8ErrorReason = exports2.Utf8ErrorFuncs = exports2.toUtf8String = exports2.toUtf8CodePoints = exports2.toUtf8Bytes = exports2._toEscapedUtf8String = void 0; + var bytes32_1 = require_bytes32(); + Object.defineProperty(exports2, "formatBytes32String", { enumerable: true, get: function() { + return bytes32_1.formatBytes32String; + } }); + Object.defineProperty(exports2, "parseBytes32String", { enumerable: true, get: function() { + return bytes32_1.parseBytes32String; + } }); + var idna_1 = require_idna(); + Object.defineProperty(exports2, "nameprep", { enumerable: true, get: function() { + return idna_1.nameprep; + } }); + var utf8_1 = require_utf8(); + Object.defineProperty(exports2, "_toEscapedUtf8String", { enumerable: true, get: function() { + return utf8_1._toEscapedUtf8String; + } }); + Object.defineProperty(exports2, "toUtf8Bytes", { enumerable: true, get: function() { + return utf8_1.toUtf8Bytes; + } }); + Object.defineProperty(exports2, "toUtf8CodePoints", { enumerable: true, get: function() { + return utf8_1.toUtf8CodePoints; + } }); + Object.defineProperty(exports2, "toUtf8String", { enumerable: true, get: function() { + return utf8_1.toUtf8String; + } }); + Object.defineProperty(exports2, "UnicodeNormalizationForm", { enumerable: true, get: function() { + return utf8_1.UnicodeNormalizationForm; + } }); + Object.defineProperty(exports2, "Utf8ErrorFuncs", { enumerable: true, get: function() { + return utf8_1.Utf8ErrorFuncs; + } }); + Object.defineProperty(exports2, "Utf8ErrorReason", { enumerable: true, get: function() { + return utf8_1.Utf8ErrorReason; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/coders/string.js +var require_string = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/string.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.StringCoder = void 0; + var strings_1 = require_lib9(); + var bytes_1 = require_bytes(); + var StringCoder = ( + /** @class */ + function(_super) { + __extends(StringCoder2, _super); + function StringCoder2(localName) { + return _super.call(this, "string", localName) || this; + } + StringCoder2.prototype.defaultValue = function() { + return ""; + }; + StringCoder2.prototype.encode = function(writer, value) { + return _super.prototype.encode.call(this, writer, (0, strings_1.toUtf8Bytes)(value)); + }; + StringCoder2.prototype.decode = function(reader) { + return (0, strings_1.toUtf8String)(_super.prototype.decode.call(this, reader)); + }; + return StringCoder2; + }(bytes_1.DynamicBytesCoder) + ); + exports2.StringCoder = StringCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/tuple.js +var require_tuple = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/tuple.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TupleCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var array_1 = require_array(); + var TupleCoder = ( + /** @class */ + function(_super) { + __extends(TupleCoder2, _super); + function TupleCoder2(coders, localName) { + var _this = this; + 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; + _this.coders = coders; + return _this; + } + TupleCoder2.prototype.defaultValue = function() { + var values = []; + this.coders.forEach(function(coder) { + values.push(coder.defaultValue()); + }); + var uniqueNames = this.coders.reduce(function(accum, coder) { + var name2 = coder.localName; + if (name2) { + if (!accum[name2]) { + accum[name2] = 0; + } + accum[name2]++; + } + return accum; + }, {}); + this.coders.forEach(function(coder, index) { + var name2 = coder.localName; + if (!name2 || uniqueNames[name2] !== 1) { + return; + } + if (name2 === "length") { + name2 = "_length"; + } + if (values[name2] != null) { + return; + } + values[name2] = values[index]; + }); + return Object.freeze(values); + }; + TupleCoder2.prototype.encode = function(writer, value) { + return (0, array_1.pack)(writer, this.coders, value); + }; + TupleCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, array_1.unpack)(reader, this.coders)); + }; + return TupleCoder2; + }(abstract_coder_1.Coder) + ); + exports2.TupleCoder = TupleCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/abi-coder.js +var require_abi_coder = __commonJS({ + "node_modules/@ethersproject/abi/lib/abi-coder.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultAbiCoder = exports2.AbiCoder = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var abstract_coder_1 = require_abstract_coder(); + var address_1 = require_address(); + var array_1 = require_array(); + var boolean_1 = require_boolean(); + var bytes_2 = require_bytes(); + var fixed_bytes_1 = require_fixed_bytes(); + var null_1 = require_null(); + var number_1 = require_number(); + var string_1 = require_string(); + var tuple_1 = require_tuple(); + var fragments_1 = require_fragments(); + var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); + var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); + var AbiCoder = ( + /** @class */ + function() { + function AbiCoder2(coerceFunc) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, AbiCoder2); + (0, properties_1.defineReadOnly)(this, "coerceFunc", coerceFunc || null); + } + AbiCoder2.prototype._getCoder = function(param) { + var _this = this; + switch (param.baseType) { + case "address": + return new address_1.AddressCoder(param.name); + case "bool": + return new boolean_1.BooleanCoder(param.name); + case "string": + return new string_1.StringCoder(param.name); + case "bytes": + return new bytes_2.BytesCoder(param.name); + case "array": + return new array_1.ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name); + case "tuple": + return new tuple_1.TupleCoder((param.components || []).map(function(component) { + return _this._getCoder(component); + }), param.name); + case "": + return new null_1.NullCoder(param.name); + } + 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 number_1.NumberCoder(size / 8, match[1] === "int", param.name); + } + 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 fixed_bytes_1.FixedBytesCoder(size, param.name); + } + return logger.throwArgumentError("invalid type", "type", param.type); + }; + AbiCoder2.prototype._getWordSize = function() { + return 32; + }; + AbiCoder2.prototype._getReader = function(data, allowLoose) { + return new abstract_coder_1.Reader(data, this._getWordSize(), this.coerceFunc, allowLoose); + }; + AbiCoder2.prototype._getWriter = function() { + return new abstract_coder_1.Writer(this._getWordSize()); + }; + AbiCoder2.prototype.getDefaultValue = function(types) { + var _this = this; + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + return coder.defaultValue(); + }; + AbiCoder2.prototype.encode = function(types, values) { + var _this = this; + if (types.length !== values.length) { + logger.throwError("types/values length mismatch", logger_1.Logger.errors.INVALID_ARGUMENT, { + count: { types: types.length, values: values.length }, + value: { types, values } + }); + } + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + var writer = this._getWriter(); + coder.encode(writer, values); + return writer.data; + }; + AbiCoder2.prototype.decode = function(types, data, loose) { + var _this = this; + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + return coder.decode(this._getReader((0, bytes_1.arrayify)(data), loose)); + }; + return AbiCoder2; + }() + ); + exports2.AbiCoder = AbiCoder; + exports2.defaultAbiCoder = new AbiCoder(); + } +}); + +// node_modules/@ethersproject/hash/lib/id.js +var require_id = __commonJS({ + "node_modules/@ethersproject/hash/lib/id.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.id = void 0; + var keccak256_1 = require_lib5(); + var strings_1 = require_lib9(); + function id(text) { + return (0, keccak256_1.keccak256)((0, strings_1.toUtf8Bytes)(text)); + } + exports2.id = id; + } +}); + +// node_modules/@ethersproject/hash/lib/_version.js +var require_version9 = __commonJS({ + "node_modules/@ethersproject/hash/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "hash/5.5.0"; + } +}); + +// node_modules/@ethersproject/hash/lib/namehash.js +var require_namehash = __commonJS({ + "node_modules/@ethersproject/hash/lib/namehash.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.namehash = exports2.isValidName = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + var keccak256_1 = require_lib5(); + var logger_1 = require_lib(); + var _version_1 = require_version9(); + var logger = new logger_1.Logger(_version_1.version); + var Zeros = new Uint8Array(32); + Zeros.fill(0); + var Partition = new RegExp("^((.*)\\.)?([^.]+)$"); + function isValidName(name2) { + try { + var comps = name2.split("."); + for (var i = 0; i < comps.length; i++) { + if ((0, strings_1.nameprep)(comps[i]).length === 0) { + throw new Error("empty"); + } + } + return true; + } catch (error) { + } + return false; + } + exports2.isValidName = isValidName; + function namehash(name2) { + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid ENS name; not a string", "name", name2); + } + var current = name2; + var result = Zeros; + while (current.length) { + var partition = current.match(Partition); + if (partition == null || partition[2] === "") { + logger.throwArgumentError("invalid ENS address; missing component", "name", name2); + } + var label = (0, strings_1.toUtf8Bytes)((0, strings_1.nameprep)(partition[3])); + result = (0, keccak256_1.keccak256)((0, bytes_1.concat)([result, (0, keccak256_1.keccak256)(label)])); + current = partition[2] || ""; + } + return (0, bytes_1.hexlify)(result); + } + exports2.namehash = namehash; + } +}); + +// node_modules/@ethersproject/hash/lib/message.js +var require_message = __commonJS({ + "node_modules/@ethersproject/hash/lib/message.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.hashMessage = exports2.messagePrefix = void 0; + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var strings_1 = require_lib9(); + exports2.messagePrefix = "Ethereum Signed Message:\n"; + function hashMessage(message) { + if (typeof message === "string") { + message = (0, strings_1.toUtf8Bytes)(message); + } + return (0, keccak256_1.keccak256)((0, bytes_1.concat)([ + (0, strings_1.toUtf8Bytes)(exports2.messagePrefix), + (0, strings_1.toUtf8Bytes)(String(message.length)), + message + ])); + } + exports2.hashMessage = hashMessage; + } +}); + +// node_modules/@ethersproject/hash/lib/typed-data.js +var require_typed_data = __commonJS({ + "node_modules/@ethersproject/hash/lib/typed-data.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypedDataEncoder = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version9(); + var logger = new logger_1.Logger(_version_1.version); + var id_1 = require_id(); + var padding = new Uint8Array(32); + padding.fill(0); + var NegativeOne = bignumber_1.BigNumber.from(-1); + var Zero = bignumber_1.BigNumber.from(0); + var One = bignumber_1.BigNumber.from(1); + var MaxUint256 = bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + function hexPadRight(value) { + var bytes = (0, bytes_1.arrayify)(value); + var padOffset = bytes.length % 32; + if (padOffset) { + return (0, bytes_1.hexConcat)([bytes, padding.slice(padOffset)]); + } + return (0, bytes_1.hexlify)(bytes); + } + var hexTrue = (0, bytes_1.hexZeroPad)(One.toHexString(), 32); + var hexFalse = (0, bytes_1.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 " + JSON.stringify(key), "domain." + key, value); + } + return value; + }; + } + var domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function(value) { + try { + return bignumber_1.BigNumber.from(value).toString(); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value for "chainId"', "domain.chainId", value); + }, + verifyingContract: function(value) { + try { + return (0, address_1.getAddress)(value).toLowerCase(); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value "verifyingContract"', "domain.verifyingContract", value); + }, + salt: function(value) { + try { + var bytes = (0, bytes_1.arrayify)(value); + if (bytes.length !== 32) { + throw new Error("bad length"); + } + return (0, bytes_1.hexlify)(bytes); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value "salt"', "domain.salt", value); + } + }; + function getBaseEncoder(type) { + { + 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_1 = MaxUint256.mask(signed ? width - 1 : width); + var boundsLower_1 = signed ? boundsUpper_1.add(One).mul(NegativeOne) : Zero; + return function(value) { + var v = bignumber_1.BigNumber.from(value); + if (v.lt(boundsLower_1) || v.gt(boundsUpper_1)) { + logger.throwArgumentError("value out-of-bounds for " + type, "value", value); + } + return (0, bytes_1.hexZeroPad)(v.toTwos(256).toHexString(), 32); + }; + } + } + { + var match = type.match(/^bytes(\d+)$/); + if (match) { + var width_1 = parseInt(match[1]); + if (width_1 === 0 || width_1 > 32 || match[1] !== String(width_1)) { + logger.throwArgumentError("invalid bytes width", "type", type); + } + return function(value) { + var bytes = (0, bytes_1.arrayify)(value); + if (bytes.length !== width_1) { + logger.throwArgumentError("invalid length for " + type, "value", value); + } + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": + return function(value) { + return (0, bytes_1.hexZeroPad)((0, address_1.getAddress)(value), 32); + }; + case "bool": + return function(value) { + return !value ? hexFalse : hexTrue; + }; + case "bytes": + return function(value) { + return (0, keccak256_1.keccak256)(value); + }; + case "string": + return function(value) { + return (0, id_1.id)(value); + }; + } + return null; + } + function encodeType(name2, fields) { + return name2 + "(" + fields.map(function(_a) { + var name3 = _a.name, type = _a.type; + return type + " " + name3; + }).join(",") + ")"; + } + var TypedDataEncoder = ( + /** @class */ + function() { + function TypedDataEncoder2(types) { + (0, properties_1.defineReadOnly)(this, "types", Object.freeze((0, properties_1.deepCopy)(types))); + (0, properties_1.defineReadOnly)(this, "_encoderCache", {}); + (0, properties_1.defineReadOnly)(this, "_types", {}); + var links = {}; + var parents = {}; + var subtypes = {}; + Object.keys(types).forEach(function(type) { + links[type] = {}; + parents[type] = []; + subtypes[type] = {}; + }); + var _loop_1 = function(name_12) { + var uniqueNames = {}; + types[name_12].forEach(function(field) { + if (uniqueNames[field.name]) { + logger.throwArgumentError("duplicate variable name " + JSON.stringify(field.name) + " in " + JSON.stringify(name_12), "types", types); + } + uniqueNames[field.name] = true; + var baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; + if (baseType === name_12) { + logger.throwArgumentError("circular type reference to " + JSON.stringify(baseType), "types", types); + } + var encoder = getBaseEncoder(baseType); + if (encoder) { + return; + } + if (!parents[baseType]) { + logger.throwArgumentError("unknown type " + JSON.stringify(baseType), "types", types); + } + parents[baseType].push(name_12); + links[name_12][baseType] = true; + }); + }; + for (var name_1 in types) { + _loop_1(name_1); + } + 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: " + primaryTypes.map(function(t) { + return JSON.stringify(t); + }).join(", "), "types", types); + } + (0, properties_1.defineReadOnly)(this, "primaryType", primaryTypes[0]); + function checkCircular(type, found) { + if (found[type]) { + logger.throwArgumentError("circular type reference to " + JSON.stringify(type), "types", types); + } + found[type] = true; + Object.keys(links[type]).forEach(function(child) { + if (!parents[child]) { + return; + } + checkCircular(child, found); + Object.keys(found).forEach(function(subtype) { + subtypes[subtype][child] = true; + }); + }); + delete found[type]; + } + checkCircular(this.primaryType, {}); + for (var name_2 in subtypes) { + var st = Object.keys(subtypes[name_2]); + st.sort(); + this._types[name_2] = encodeType(name_2, types[name_2]) + st.map(function(t) { + return encodeType(t, types[t]); + }).join(""); + } + } + TypedDataEncoder2.prototype.getEncoder = function(type) { + var encoder = this._encoderCache[type]; + if (!encoder) { + encoder = this._encoderCache[type] = this._getEncoder(type); + } + return encoder; + }; + TypedDataEncoder2.prototype._getEncoder = function(type) { + var _this = this; + { + var encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + var subtype_1 = match[1]; + var subEncoder_1 = this.getEncoder(subtype_1); + var length_1 = parseInt(match[3]); + return function(value) { + if (length_1 >= 0 && value.length !== length_1) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + var result = value.map(subEncoder_1); + if (_this._types[subtype_1]) { + result = result.map(keccak256_1.keccak256); + } + return (0, keccak256_1.keccak256)((0, bytes_1.hexConcat)(result)); + }; + } + var fields = this.types[type]; + if (fields) { + var encodedType_1 = (0, id_1.id)(this._types[type]); + return function(value) { + var values = fields.map(function(_a) { + var name2 = _a.name, type2 = _a.type; + var result = _this.getEncoder(type2)(value[name2]); + if (_this._types[type2]) { + return (0, keccak256_1.keccak256)(result); + } + return result; + }); + values.unshift(encodedType_1); + return (0, bytes_1.hexConcat)(values); + }; + } + return logger.throwArgumentError("unknown type: " + type, "type", type); + }; + TypedDataEncoder2.prototype.encodeType = function(name2) { + var result = this._types[name2]; + if (!result) { + logger.throwArgumentError("unknown type: " + JSON.stringify(name2), "name", name2); + } + return result; + }; + TypedDataEncoder2.prototype.encodeData = function(type, value) { + return this.getEncoder(type)(value); + }; + TypedDataEncoder2.prototype.hashStruct = function(name2, value) { + return (0, keccak256_1.keccak256)(this.encodeData(name2, value)); + }; + TypedDataEncoder2.prototype.encode = function(value) { + return this.encodeData(this.primaryType, value); + }; + TypedDataEncoder2.prototype.hash = function(value) { + return this.hashStruct(this.primaryType, value); + }; + TypedDataEncoder2.prototype._visit = function(type, value, callback) { + var _this = this; + { + var encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + var subtype_2 = match[1]; + var length_2 = parseInt(match[3]); + if (length_2 >= 0 && value.length !== length_2) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + return value.map(function(v) { + return _this._visit(subtype_2, v, callback); + }); + } + var fields = this.types[type]; + if (fields) { + return fields.reduce(function(accum, _a) { + var name2 = _a.name, type2 = _a.type; + accum[name2] = _this._visit(type2, value[name2], callback); + return accum; + }, {}); + } + return logger.throwArgumentError("unknown type: " + type, "type", type); + }; + TypedDataEncoder2.prototype.visit = function(value, callback) { + return this._visit(this.primaryType, value, callback); + }; + TypedDataEncoder2.from = function(types) { + return new TypedDataEncoder2(types); + }; + TypedDataEncoder2.getPrimaryType = function(types) { + return TypedDataEncoder2.from(types).primaryType; + }; + TypedDataEncoder2.hashStruct = function(name2, types, value) { + return TypedDataEncoder2.from(types).hashStruct(name2, value); + }; + TypedDataEncoder2.hashDomain = function(domain) { + var domainFields = []; + for (var name_3 in domain) { + var type = domainFieldTypes[name_3]; + if (!type) { + logger.throwArgumentError("invalid typed-data domain key: " + JSON.stringify(name_3), "domain", domain); + } + domainFields.push({ name: name_3, type }); + } + domainFields.sort(function(a, b) { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder2.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + }; + TypedDataEncoder2.encode = function(domain, types, value) { + return (0, bytes_1.hexConcat)([ + "0x1901", + TypedDataEncoder2.hashDomain(domain), + TypedDataEncoder2.from(types).hash(value) + ]); + }; + TypedDataEncoder2.hash = function(domain, types, value) { + return (0, keccak256_1.keccak256)(TypedDataEncoder2.encode(domain, types, value)); + }; + TypedDataEncoder2.resolveNames = function(domain, types, value, resolveName) { + return __awaiter(this, void 0, void 0, function() { + var ensCache, encoder, _a, _b, _i, name_4, _c, _d; + return __generator(this, function(_e) { + switch (_e.label) { + case 0: + domain = (0, properties_1.shallowCopy)(domain); + ensCache = {}; + if (domain.verifyingContract && !(0, bytes_1.isHexString)(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + encoder = TypedDataEncoder2.from(types); + encoder.visit(value, function(type, value2) { + if (type === "address" && !(0, bytes_1.isHexString)(value2, 20)) { + ensCache[value2] = "0x"; + } + return value2; + }); + _a = []; + for (_b in ensCache) + _a.push(_b); + _i = 0; + _e.label = 1; + case 1: + if (!(_i < _a.length)) return [3, 4]; + name_4 = _a[_i]; + _c = ensCache; + _d = name_4; + return [4, resolveName(name_4)]; + case 2: + _c[_d] = _e.sent(); + _e.label = 3; + case 3: + _i++; + return [3, 1]; + case 4: + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + value = encoder.visit(value, function(type, value2) { + if (type === "address" && ensCache[value2]) { + return ensCache[value2]; + } + return value2; + }); + return [2, { domain, value }]; + } + }); + }); + }; + TypedDataEncoder2.getPayload = function(domain, types, value) { + TypedDataEncoder2.hashDomain(domain); + var domainValues = {}; + var domainTypes = []; + domainFieldNames.forEach(function(name2) { + var value2 = domain[name2]; + if (value2 == null) { + return; + } + domainValues[name2] = domainChecks[name2](value2); + domainTypes.push({ name: name2, type: domainFieldTypes[name2] }); + }); + var encoder = TypedDataEncoder2.from(types); + var typesWithDomain = (0, properties_1.shallowCopy)(types); + if (typesWithDomain.EIP712Domain) { + logger.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + } else { + typesWithDomain.EIP712Domain = domainTypes; + } + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, function(type, value2) { + if (type.match(/^bytes(\d*)/)) { + return (0, bytes_1.hexlify)((0, bytes_1.arrayify)(value2)); + } + if (type.match(/^u?int/)) { + return bignumber_1.BigNumber.from(value2).toString(); + } + switch (type) { + case "address": + return value2.toLowerCase(); + case "bool": + return !!value2; + case "string": + if (typeof value2 !== "string") { + logger.throwArgumentError("invalid string", "value", value2); + } + return value2; + } + return logger.throwArgumentError("unsupported type", "type", type); + }) + }; + }; + return TypedDataEncoder2; + }() + ); + exports2.TypedDataEncoder = TypedDataEncoder; + } +}); + +// node_modules/@ethersproject/hash/lib/index.js +var require_lib10 = __commonJS({ + "node_modules/@ethersproject/hash/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._TypedDataEncoder = exports2.hashMessage = exports2.messagePrefix = exports2.isValidName = exports2.namehash = exports2.id = void 0; + var id_1 = require_id(); + Object.defineProperty(exports2, "id", { enumerable: true, get: function() { + return id_1.id; + } }); + var namehash_1 = require_namehash(); + Object.defineProperty(exports2, "isValidName", { enumerable: true, get: function() { + return namehash_1.isValidName; + } }); + Object.defineProperty(exports2, "namehash", { enumerable: true, get: function() { + return namehash_1.namehash; + } }); + var message_1 = require_message(); + Object.defineProperty(exports2, "hashMessage", { enumerable: true, get: function() { + return message_1.hashMessage; + } }); + Object.defineProperty(exports2, "messagePrefix", { enumerable: true, get: function() { + return message_1.messagePrefix; + } }); + var typed_data_1 = require_typed_data(); + Object.defineProperty(exports2, "_TypedDataEncoder", { enumerable: true, get: function() { + return typed_data_1.TypedDataEncoder; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/interface.js +var require_interface = __commonJS({ + "node_modules/@ethersproject/abi/lib/interface.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Interface = exports2.Indexed = exports2.ErrorDescription = exports2.TransactionDescription = exports2.LogDescription = exports2.checkResultErrors = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var abi_coder_1 = require_abi_coder(); + var abstract_coder_1 = require_abstract_coder(); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return abstract_coder_1.checkResultErrors; + } }); + var fragments_1 = require_fragments(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var LogDescription = ( + /** @class */ + function(_super) { + __extends(LogDescription2, _super); + function LogDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return LogDescription2; + }(properties_1.Description) + ); + exports2.LogDescription = LogDescription; + var TransactionDescription = ( + /** @class */ + function(_super) { + __extends(TransactionDescription2, _super); + function TransactionDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return TransactionDescription2; + }(properties_1.Description) + ); + exports2.TransactionDescription = TransactionDescription; + var ErrorDescription = ( + /** @class */ + function(_super) { + __extends(ErrorDescription2, _super); + function ErrorDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return ErrorDescription2; + }(properties_1.Description) + ); + exports2.ErrorDescription = ErrorDescription; + var Indexed = ( + /** @class */ + function(_super) { + __extends(Indexed2, _super); + function Indexed2() { + return _super !== null && _super.apply(this, arguments) || this; + } + Indexed2.isIndexed = function(value) { + return !!(value && value._isIndexed); + }; + return Indexed2; + }(properties_1.Description) + ); + exports2.Indexed = Indexed; + 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 " + property); + wrap.error = error; + return wrap; + } + var Interface = ( + /** @class */ + function() { + function Interface2(fragments) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Interface2); + var abi = []; + if (typeof fragments === "string") { + abi = JSON.parse(fragments); + } else { + abi = fragments; + } + (0, properties_1.defineReadOnly)(this, "fragments", abi.map(function(fragment) { + return fragments_1.Fragment.from(fragment); + }).filter(function(fragment) { + return fragment != null; + })); + (0, properties_1.defineReadOnly)(this, "_abiCoder", (0, properties_1.getStatic)(_newTarget, "getAbiCoder")()); + (0, properties_1.defineReadOnly)(this, "functions", {}); + (0, properties_1.defineReadOnly)(this, "errors", {}); + (0, properties_1.defineReadOnly)(this, "events", {}); + (0, properties_1.defineReadOnly)(this, "structs", {}); + this.fragments.forEach(function(fragment) { + var bucket = null; + switch (fragment.type) { + case "constructor": + if (_this.deploy) { + logger.warn("duplicate definition - constructor"); + return; + } + (0, properties_1.defineReadOnly)(_this, "deploy", fragment); + return; + case "function": + bucket = _this.functions; + break; + case "event": + 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 (!this.deploy) { + (0, properties_1.defineReadOnly)(this, "deploy", fragments_1.ConstructorFragment.from({ + payable: false, + type: "constructor" + })); + } + (0, properties_1.defineReadOnly)(this, "_isInterface", true); + } + Interface2.prototype.format = function(format) { + if (!format) { + format = fragments_1.FormatTypes.full; + } + if (format === fragments_1.FormatTypes.sighash) { + logger.throwArgumentError("interface does not support formatting sighash", "format", format); + } + var abi = this.fragments.map(function(fragment) { + return fragment.format(format); + }); + if (format === fragments_1.FormatTypes.json) { + return JSON.stringify(abi.map(function(j) { + return JSON.parse(j); + })); + } + return abi; + }; + Interface2.getAbiCoder = function() { + return abi_coder_1.defaultAbiCoder; + }; + Interface2.getAddress = function(address) { + return (0, address_1.getAddress)(address); + }; + Interface2.getSighash = function(fragment) { + return (0, bytes_1.hexDataSlice)((0, hash_1.id)(fragment.format()), 0, 4); + }; + Interface2.getEventTopic = function(eventFragment) { + return (0, hash_1.id)(eventFragment.format()); + }; + Interface2.prototype.getFunction = function(nameOrSignatureOrSighash) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrSighash)) { + for (var name_1 in this.functions) { + if (nameOrSignatureOrSighash === this.getSighash(name_1)) { + return this.functions[name_1]; + } + } + logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var name_2 = nameOrSignatureOrSighash.trim(); + var matching = Object.keys(this.functions).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_2; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching function", "name", name_2); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching functions", "name", name_2); + } + return this.functions[matching[0]]; + } + var result = this.functions[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + } + return result; + }; + Interface2.prototype.getEvent = function(nameOrSignatureOrTopic) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrTopic)) { + var topichash = nameOrSignatureOrTopic.toLowerCase(); + for (var name_3 in this.events) { + if (topichash === this.getEventTopic(name_3)) { + return this.events[name_3]; + } + } + logger.throwArgumentError("no matching event", "topichash", topichash); + } + if (nameOrSignatureOrTopic.indexOf("(") === -1) { + var name_4 = nameOrSignatureOrTopic.trim(); + var matching = Object.keys(this.events).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_4; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching event", "name", name_4); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching events", "name", name_4); + } + return this.events[matching[0]]; + } + var result = this.events[fragments_1.EventFragment.fromString(nameOrSignatureOrTopic).format()]; + if (!result) { + logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + } + return result; + }; + Interface2.prototype.getError = function(nameOrSignatureOrSighash) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrSighash)) { + var getSighash = (0, properties_1.getStatic)(this.constructor, "getSighash"); + for (var name_5 in this.errors) { + var error = this.errors[name_5]; + if (nameOrSignatureOrSighash === getSighash(error)) { + return this.errors[name_5]; + } + } + logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var name_6 = nameOrSignatureOrSighash.trim(); + var matching = Object.keys(this.errors).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_6; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching error", "name", name_6); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching errors", "name", name_6); + } + return this.errors[matching[0]]; + } + var result = this.errors[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + } + return result; + }; + Interface2.prototype.getSighash = function(fragment) { + if (typeof fragment === "string") { + try { + fragment = this.getFunction(fragment); + } catch (error) { + try { + fragment = this.getError(fragment); + } catch (_) { + throw error; + } + } + } + return (0, properties_1.getStatic)(this.constructor, "getSighash")(fragment); + }; + Interface2.prototype.getEventTopic = function(eventFragment) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + return (0, properties_1.getStatic)(this.constructor, "getEventTopic")(eventFragment); + }; + Interface2.prototype._decodeParams = function(params, data) { + return this._abiCoder.decode(params, data); + }; + Interface2.prototype._encodeParams = function(params, values) { + return this._abiCoder.encode(params, values); + }; + Interface2.prototype.encodeDeploy = function(values) { + return this._encodeParams(this.deploy.inputs, values || []); + }; + Interface2.prototype.decodeErrorResult = function(fragment, data) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + var bytes = (0, bytes_1.arrayify)(data); + if ((0, bytes_1.hexlify)(bytes.slice(0, 4)) !== this.getSighash(fragment)) { + logger.throwArgumentError("data signature does not match error " + fragment.name + ".", "data", (0, bytes_1.hexlify)(bytes)); + } + return this._decodeParams(fragment.inputs, bytes.slice(4)); + }; + Interface2.prototype.encodeErrorResult = function(fragment, values) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.getSighash(fragment), + this._encodeParams(fragment.inputs, values || []) + ])); + }; + Interface2.prototype.decodeFunctionData = function(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + var bytes = (0, bytes_1.arrayify)(data); + if ((0, bytes_1.hexlify)(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { + logger.throwArgumentError("data signature does not match function " + functionFragment.name + ".", "data", (0, bytes_1.hexlify)(bytes)); + } + return this._decodeParams(functionFragment.inputs, bytes.slice(4)); + }; + Interface2.prototype.encodeFunctionData = function(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.getSighash(functionFragment), + this._encodeParams(functionFragment.inputs, values || []) + ])); + }; + Interface2.prototype.decodeFunctionResult = function(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + var bytes = (0, bytes_1.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 (error2) { + } + break; + case 4: { + var selector = (0, bytes_1.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 (error2) { + console.log(error2); + } + } + break; + } + } + return logger.throwError("call revert exception", logger_1.Logger.errors.CALL_EXCEPTION, { + method: functionFragment.format(), + errorArgs, + errorName, + errorSignature, + reason + }); + }; + Interface2.prototype.encodeFunctionResult = function(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return (0, bytes_1.hexlify)(this._abiCoder.encode(functionFragment.outputs, values || [])); + }; + Interface2.prototype.encodeFilterTopics = function(eventFragment, values) { + var _this = this; + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (values.length > eventFragment.inputs.length) { + logger.throwError("too many arguments for " + eventFragment.format(), logger_1.Logger.errors.UNEXPECTED_ARGUMENT, { + argument: "values", + value: values + }); + } + var topics = []; + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + var encodeTopic = function(param, value) { + if (param.type === "string") { + return (0, hash_1.id)(value); + } else if (param.type === "bytes") { + return (0, keccak256_1.keccak256)((0, bytes_1.hexlify)(value)); + } + if (param.type === "address") { + _this._abiCoder.encode(["address"], [value]); + } + return (0, bytes_1.hexZeroPad)((0, bytes_1.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(value2) { + return encodeTopic(param, value2); + })); + } else { + topics.push(encodeTopic(param, value)); + } + }); + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + }; + Interface2.prototype.encodeEventLog = function(eventFragment, values) { + var _this = 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((0, hash_1.id)(value)); + } else if (param.type === "bytes") { + topics.push((0, keccak256_1.keccak256)(value)); + } else if (param.baseType === "tuple" || param.baseType === "array") { + throw new Error("not implemented"); + } else { + topics.push(_this._abiCoder.encode([param.type], [value])); + } + } else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this._abiCoder.encode(dataTypes, dataValues), + topics + }; + }; + Interface2.prototype.decodeEventLog = function(eventFragment, data, topics) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (topics != null && !eventFragment.anonymous) { + var topicHash = this.getEventTopic(eventFragment); + if (!(0, bytes_1.isHexString)(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { + logger.throwError("fragment/topic mismatch", logger_1.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_1.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, (0, bytes_1.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; + } + } + if (param.name && result[param.name] == null) { + var value_1 = result[index]; + if (value_1 instanceof Error) { + Object.defineProperty(result, param.name, { + enumerable: true, + get: function() { + throw wrapAccessError("property " + JSON.stringify(param.name), value_1); + } + }); + } else { + result[param.name] = value_1; + } + } + }); + var _loop_1 = function(i2) { + var value = result[i2]; + if (value instanceof Error) { + Object.defineProperty(result, i2, { + enumerable: true, + get: function() { + throw wrapAccessError("index " + i2, value); + } + }); + } + }; + for (var i = 0; i < result.length; i++) { + _loop_1(i); + } + return Object.freeze(result); + }; + Interface2.prototype.parseTransaction = function(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: bignumber_1.BigNumber.from(tx.value || "0") + }); + }; + Interface2.prototype.parseLog = function(log) { + var fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + return new LogDescription({ + eventFragment: fragment, + name: fragment.name, + signature: fragment.format(), + topic: this.getEventTopic(fragment), + args: this.decodeEventLog(fragment, log.data, log.topics) + }); + }; + Interface2.prototype.parseError = function(data) { + var hexData = (0, bytes_1.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) + }); + }; + Interface2.isInterface = function(value) { + return !!(value && value._isInterface); + }; + return Interface2; + }() + ); + exports2.Interface = Interface; + } +}); + +// node_modules/@ethersproject/abi/lib/index.js +var require_lib11 = __commonJS({ + "node_modules/@ethersproject/abi/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TransactionDescription = exports2.LogDescription = exports2.checkResultErrors = exports2.Indexed = exports2.Interface = exports2.defaultAbiCoder = exports2.AbiCoder = exports2.FormatTypes = exports2.ParamType = exports2.FunctionFragment = exports2.Fragment = exports2.EventFragment = exports2.ErrorFragment = exports2.ConstructorFragment = void 0; + var fragments_1 = require_fragments(); + Object.defineProperty(exports2, "ConstructorFragment", { enumerable: true, get: function() { + return fragments_1.ConstructorFragment; + } }); + Object.defineProperty(exports2, "ErrorFragment", { enumerable: true, get: function() { + return fragments_1.ErrorFragment; + } }); + Object.defineProperty(exports2, "EventFragment", { enumerable: true, get: function() { + return fragments_1.EventFragment; + } }); + Object.defineProperty(exports2, "FormatTypes", { enumerable: true, get: function() { + return fragments_1.FormatTypes; + } }); + Object.defineProperty(exports2, "Fragment", { enumerable: true, get: function() { + return fragments_1.Fragment; + } }); + Object.defineProperty(exports2, "FunctionFragment", { enumerable: true, get: function() { + return fragments_1.FunctionFragment; + } }); + Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() { + return fragments_1.ParamType; + } }); + var abi_coder_1 = require_abi_coder(); + Object.defineProperty(exports2, "AbiCoder", { enumerable: true, get: function() { + return abi_coder_1.AbiCoder; + } }); + Object.defineProperty(exports2, "defaultAbiCoder", { enumerable: true, get: function() { + return abi_coder_1.defaultAbiCoder; + } }); + var interface_1 = require_interface(); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return interface_1.checkResultErrors; + } }); + Object.defineProperty(exports2, "Indexed", { enumerable: true, get: function() { + return interface_1.Indexed; + } }); + Object.defineProperty(exports2, "Interface", { enumerable: true, get: function() { + return interface_1.Interface; + } }); + Object.defineProperty(exports2, "LogDescription", { enumerable: true, get: function() { + return interface_1.LogDescription; + } }); + Object.defineProperty(exports2, "TransactionDescription", { enumerable: true, get: function() { + return interface_1.TransactionDescription; + } }); + } +}); + +// node_modules/@ethersproject/abstract-provider/lib/_version.js +var require_version10 = __commonJS({ + "node_modules/@ethersproject/abstract-provider/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abstract-provider/5.5.1"; + } +}); + +// node_modules/@ethersproject/abstract-provider/lib/index.js +var require_lib12 = __commonJS({ + "node_modules/@ethersproject/abstract-provider/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Provider = exports2.TransactionOrderForkEvent = exports2.TransactionForkEvent = exports2.BlockForkEvent = exports2.ForkEvent = void 0; + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version10(); + var logger = new logger_1.Logger(_version_1.version); + var ForkEvent = ( + /** @class */ + function(_super) { + __extends(ForkEvent2, _super); + function ForkEvent2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ForkEvent2.isForkEvent = function(value) { + return !!(value && value._isForkEvent); + }; + return ForkEvent2; + }(properties_1.Description) + ); + exports2.ForkEvent = ForkEvent; + var BlockForkEvent = ( + /** @class */ + function(_super) { + __extends(BlockForkEvent2, _super); + function BlockForkEvent2(blockHash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(blockHash, 32)) { + logger.throwArgumentError("invalid blockHash", "blockHash", blockHash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isBlockForkEvent: true, + expiry: expiry || 0, + blockHash + }) || this; + return _this; + } + return BlockForkEvent2; + }(ForkEvent) + ); + exports2.BlockForkEvent = BlockForkEvent; + var TransactionForkEvent = ( + /** @class */ + function(_super) { + __extends(TransactionForkEvent2, _super); + function TransactionForkEvent2(hash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(hash, 32)) { + logger.throwArgumentError("invalid transaction hash", "hash", hash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isTransactionForkEvent: true, + expiry: expiry || 0, + hash + }) || this; + return _this; + } + return TransactionForkEvent2; + }(ForkEvent) + ); + exports2.TransactionForkEvent = TransactionForkEvent; + var TransactionOrderForkEvent = ( + /** @class */ + function(_super) { + __extends(TransactionOrderForkEvent2, _super); + function TransactionOrderForkEvent2(beforeHash, afterHash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(beforeHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash); + } + if (!(0, bytes_1.isHexString)(afterHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isTransactionOrderForkEvent: true, + expiry: expiry || 0, + beforeHash, + afterHash + }) || this; + return _this; + } + return TransactionOrderForkEvent2; + }(ForkEvent) + ); + exports2.TransactionOrderForkEvent = TransactionOrderForkEvent; + var Provider = ( + /** @class */ + function() { + function Provider2() { + var _newTarget = this.constructor; + logger.checkAbstract(_newTarget, Provider2); + (0, properties_1.defineReadOnly)(this, "_isProvider", true); + } + Provider2.prototype.getFeeData = function() { + return __awaiter(this, void 0, void 0, function() { + var _a, block, gasPrice, maxFeePerGas, maxPriorityFeePerGas; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, (0, properties_1.resolveProperties)({ + block: this.getBlock("latest"), + gasPrice: this.getGasPrice().catch(function(error) { + return null; + }) + })]; + case 1: + _a = _b.sent(), block = _a.block, gasPrice = _a.gasPrice; + maxFeePerGas = null, maxPriorityFeePerGas = null; + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = bignumber_1.BigNumber.from("2500000000"); + maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); + } + return [2, { maxFeePerGas, maxPriorityFeePerGas, gasPrice }]; + } + }); + }); + }; + Provider2.prototype.addListener = function(eventName, listener) { + return this.on(eventName, listener); + }; + Provider2.prototype.removeListener = function(eventName, listener) { + return this.off(eventName, listener); + }; + Provider2.isProvider = function(value) { + return !!(value && value._isProvider); + }; + return Provider2; + }() + ); + exports2.Provider = Provider; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib/_version.js +var require_version11 = __commonJS({ + "node_modules/@ethersproject/abstract-signer/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abstract-signer/5.5.0"; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib/index.js +var require_lib13 = __commonJS({ + "node_modules/@ethersproject/abstract-signer/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.VoidSigner = exports2.Signer = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version11(); + var logger = new logger_1.Logger(_version_1.version); + var allowedTransactionKeys = [ + "accessList", + "chainId", + "customData", + "data", + "from", + "gasLimit", + "gasPrice", + "maxFeePerGas", + "maxPriorityFeePerGas", + "nonce", + "to", + "type", + "value" + ]; + var forwardErrors = [ + logger_1.Logger.errors.INSUFFICIENT_FUNDS, + logger_1.Logger.errors.NONCE_EXPIRED, + logger_1.Logger.errors.REPLACEMENT_UNDERPRICED + ]; + var Signer = ( + /** @class */ + function() { + function Signer2() { + var _newTarget = this.constructor; + logger.checkAbstract(_newTarget, Signer2); + (0, properties_1.defineReadOnly)(this, "_isSigner", true); + } + Signer2.prototype.getBalance = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getBalance"); + return [4, this.provider.getBalance(this.getAddress(), blockTag)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getTransactionCount = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getTransactionCount"); + return [4, this.provider.getTransactionCount(this.getAddress(), blockTag)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.estimateGas = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("estimateGas"); + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + return [4, this.provider.estimateGas(tx)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.call = function(transaction, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("call"); + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + return [4, this.provider.call(tx, blockTag)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.sendTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx, signedTx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("sendTransaction"); + return [4, this.populateTransaction(transaction)]; + case 1: + tx = _a.sent(); + return [4, this.signTransaction(tx)]; + case 2: + signedTx = _a.sent(); + return [4, this.provider.sendTransaction(signedTx)]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getChainId = function() { + return __awaiter(this, void 0, void 0, function() { + var network; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getChainId"); + return [4, this.provider.getNetwork()]; + case 1: + network = _a.sent(); + return [2, network.chainId]; + } + }); + }); + }; + Signer2.prototype.getGasPrice = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getGasPrice"); + return [4, this.provider.getGasPrice()]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getFeeData = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getFeeData"); + return [4, this.provider.getFeeData()]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.resolveName = function(name2) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("resolveName"); + return [4, this.provider.resolveName(name2)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.checkTransaction = function(transaction) { + for (var key in transaction) { + if (allowedTransactionKeys.indexOf(key) === -1) { + logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); + } + } + var tx = (0, properties_1.shallowCopy)(transaction); + if (tx.from == null) { + tx.from = this.getAddress(); + } else { + 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; + }; + Signer2.prototype.populateTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx, hasEip1559, feeData, gasPrice; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + if (tx.to != null) { + tx.to = Promise.resolve(tx.to).then(function(to) { + return __awaiter(_this, void 0, void 0, function() { + var address; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + if (to == null) { + return [2, null]; + } + return [4, this.resolveName(to)]; + case 1: + address = _a2.sent(); + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return [2, address]; + } + }); + }); + }); + tx.to.catch(function(error) { + }); + } + 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))) return [3, 2]; + tx.type = 2; + return [3, 5]; + case 2: + if (!(tx.type === 0 || tx.type === 1)) return [3, 3]; + if (tx.gasPrice == null) { + tx.gasPrice = this.getGasPrice(); + } + return [3, 5]; + case 3: + return [4, this.getFeeData()]; + case 4: + feeData = _a.sent(); + if (tx.type == null) { + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + tx.type = 2; + if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + delete tx.gasPrice; + tx.maxFeePerGas = gasPrice; + tx.maxPriorityFeePerGas = gasPrice; + } else { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } else if (feeData.gasPrice != null) { + if (hasEip1559) { + logger.throwError("network does not support EIP-1559", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "populateTransaction" + }); + } + if (tx.gasPrice == null) { + tx.gasPrice = feeData.gasPrice; + } + tx.type = 0; + } else { + logger.throwError("failed to get consistent fee data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signer.getFeeData" + }); + } + } else if (tx.type === 2) { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + _a.label = 5; + case 5: + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + 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]; + }); + } + return [4, (0, properties_1.resolveProperties)(tx)]; + case 6: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype._checkProvider = function(operation) { + if (!this.provider) { + logger.throwError("missing provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: operation || "_checkProvider" + }); + } + }; + Signer2.isSigner = function(value) { + return !!(value && value._isSigner); + }; + return Signer2; + }() + ); + exports2.Signer = Signer; + var VoidSigner = ( + /** @class */ + function(_super) { + __extends(VoidSigner2, _super); + function VoidSigner2(address, provider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, VoidSigner2); + _this = _super.call(this) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "provider", provider || null); + return _this; + } + VoidSigner2.prototype.getAddress = function() { + return Promise.resolve(this.address); + }; + VoidSigner2.prototype._fail = function(message, operation) { + return Promise.resolve().then(function() { + logger.throwError(message, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation }); + }); + }; + VoidSigner2.prototype.signMessage = function(message) { + return this._fail("VoidSigner cannot sign messages", "signMessage"); + }; + VoidSigner2.prototype.signTransaction = function(transaction) { + return this._fail("VoidSigner cannot sign transactions", "signTransaction"); + }; + VoidSigner2.prototype._signTypedData = function(domain, types, value) { + return this._fail("VoidSigner cannot sign typed data", "signTypedData"); + }; + VoidSigner2.prototype.connect = function(provider) { + return new VoidSigner2(this.address, provider); + }; + return VoidSigner2; + }(Signer) + ); + exports2.VoidSigner = VoidSigner; + } +}); + +// node_modules/elliptic/package.json +var require_package = __commonJS({ + "node_modules/elliptic/package.json"(exports2, module2) { + module2.exports = { + name: "elliptic", + version: "6.5.4", + description: "EC cryptography", + main: "lib/elliptic.js", + files: [ + "lib" + ], + scripts: { + lint: "eslint lib test", + "lint:fix": "npm run lint -- --fix", + unit: "istanbul test _mocha --reporter=spec test/index.js", + test: "npm run lint && npm run unit", + version: "grunt dist && git add dist/" + }, + repository: { + type: "git", + url: "git@github.com:indutny/elliptic" + }, + keywords: [ + "EC", + "Elliptic", + "curve", + "Cryptography" + ], + author: "Fedor Indutny ", + license: "MIT", + bugs: { + url: "https://github.com/indutny/elliptic/issues" + }, + homepage: "https://github.com/indutny/elliptic", + devDependencies: { + brfs: "^2.0.2", + coveralls: "^3.1.0", + eslint: "^7.6.0", + grunt: "^1.2.1", + "grunt-browserify": "^5.3.0", + "grunt-cli": "^1.3.2", + "grunt-contrib-connect": "^3.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^5.0.0", + "grunt-mocha-istanbul": "^5.0.2", + "grunt-saucelabs": "^9.0.1", + istanbul: "^0.4.5", + mocha: "^8.0.1" + }, + dependencies: { + "bn.js": "^4.11.9", + brorand: "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + inherits: "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }; + } +}); + +// node_modules/minimalistic-assert/index.js +var require_minimalistic_assert = __commonJS({ + "node_modules/minimalistic-assert/index.js"(exports2, module2) { + module2.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/minimalistic-crypto-utils/lib/utils.js +var require_utils = __commonJS({ + "node_modules/minimalistic-crypto-utils/lib/utils.js"(exports2) { + "use strict"; + var utils = exports2; + 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 & 255; + 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; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/utils.js +var require_utils2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/utils.js"(exports2) { + "use strict"; + var utils = exports2; + var BN = require_bn(); + var minAssert = require_minimalistic_assert(); + var minUtils = require_utils(); + utils.assert = minAssert; + utils.toArray = minUtils.toArray; + utils.zero2 = minUtils.zero2; + utils.toHex = minUtils.toHex; + utils.encode = minUtils.encode; + 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; + 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) { + 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); + 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, name2, computer) { + var key = "_" + name2; + obj.prototype[name2] = function cachedProperty2() { + return this[key] !== void 0 ? 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(bytes, "hex", "le"); + } + utils.intFromLE = intFromLE; + } +}); + +// node_modules/brorand/index.js +var require_brorand = __commonJS({ + "node_modules/brorand/index.js"(exports2, module2) { + var r; + module2.exports = function rand(len) { + if (!r) + r = new Rand(null); + return r.generate(len); + }; + function Rand(rand) { + this.rand = rand; + } + module2.exports.Rand = Rand; + Rand.prototype.generate = function generate(len) { + return this._rand(len); + }; + Rand.prototype._rand = function _rand(n) { + if (this.rand.getBytes) + return this.rand.getBytes(n); + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; + }; + if (typeof self === "object") { + if (self.crypto && self.crypto.getRandomValues) { + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.crypto.getRandomValues(arr); + return arr; + }; + } else if (self.msCrypto && self.msCrypto.getRandomValues) { + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.msCrypto.getRandomValues(arr); + return arr; + }; + } else if (typeof window === "object") { + Rand.prototype._rand = function() { + throw new Error("Not implemented yet"); + }; + } + } else { + try { + crypto2 = require("crypto"); + if (typeof crypto2.randomBytes !== "function") + throw new Error("Not supported"); + Rand.prototype._rand = function _rand(n) { + return crypto2.randomBytes(n); + }; + } catch (e) { + } + } + var crypto2; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/base.js +var require_base = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/base.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var getNAF = utils.getNAF; + var getJSF = utils.getJSF; + var assert = utils.assert; + function BaseCurve(type, conf) { + this.type = type; + this.p = new BN(conf.p, 16); + this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); + this.zero = new BN(0).toRed(this.red); + this.one = new BN(1).toRed(this.red); + this.two = new BN(2).toRed(this.red); + this.n = conf.n && new BN(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + 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; + 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); + } + } + module2.exports = 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(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; + 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; + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + var naf = getNAF(k, w, this._bitLength); + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + 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(z !== 0); + if (p.type === "affine") { + if (z > 0) + acc = acc.mixedAdd(wnd[z - 1 >> 1]); + else + acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()); + } else { + 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; + 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; + } + 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 */ + ]; + 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); + } + } + 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 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.toArray(bytes, enc); + var len = this.p.byteLength(); + if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) { + if (bytes[0] === 6) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 7) + assert(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] === 2 || bytes[0] === 3) && bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3); + } + 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() ? 2 : 3].concat(x); + return [4].concat(x, this.getY().toArray("be", len)); + }; + BasePoint.prototype.encode = function encode(enc, compact) { + return utils.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, + 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, + 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; + }; + } +}); + +// node_modules/inherits/inherits_browser.js +var require_inherits_browser = __commonJS({ + "node_modules/inherits/inherits_browser.js"(exports2, module2) { + if (typeof Object.create === "function") { + module2.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 { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } + } +}); + +// node_modules/inherits/inherits.js +var require_inherits = __commonJS({ + "node_modules/inherits/inherits.js"(exports2, module2) { + try { + util = require("util"); + if (typeof util.inherits !== "function") throw ""; + module2.exports = util.inherits; + } catch (e) { + module2.exports = require_inherits_browser(); + } + var util; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/short.js +var require_short = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/short.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var assert = utils.assert; + function ShortCurve(conf) { + Base.call(this, "short", conf); + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(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; + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); + } + inherits(ShortCurve, Base); + module2.exports = ShortCurve; + ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + var beta; + var lambda; + if (conf.beta) { + beta = new BN(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new BN(conf.lambda, 16); + } else { + 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(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new BN(vec.a, 16), + b: new BN(vec.b, 16) + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + return { + beta, + lambda, + basis + }; + }; + ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + var red = num === this.p ? this.red : BN.mont(num); + var tinv = new BN(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + var s = new BN(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) { + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + var u = lambda; + var v = this.n.clone(); + var x1 = new BN(1); + var y1 = new BN(0); + var x2 = new BN(0); + var y2 = new BN(1); + var a0; + var b0; + var a1; + var b1; + 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; + } + 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); + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1, k2 }; + }; + ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(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"); + 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); + 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(x, 16); + this.y = new BN(y, 16); + 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(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(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(obj2) { + return curve.point(obj2[0], obj2[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) { + if (this.inf) + return p; + if (p.inf) + return this; + if (this.eq(p)) + return this.dbl(); + if (this.neg().eq(p)) + return this.curve.point(null, null); + 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; + 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(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(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(0); + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = new BN(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(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) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + 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) { + if (this.isInfinity()) + return p.toJ(); + if (p.isInfinity()) + return this; + 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; + } + 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(); + 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; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + var m = xx.redAdd(xx).redIAdd(xx); + var t = m.redSqr().redISub(s).redISub(s); + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + nx = t; + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var a = this.x.redSqr(); + var b = this.y.redSqr(); + var c = b.redSqr(); + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + var e = a.redAdd(a).redIAdd(a); + var f = e.redSqr(); + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + nx = f.redISub(d).redISub(d); + ny = e.redMul(d.redISub(nx)).redISub(c8); + 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; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + var t = m.redSqr().redISub(s).redISub(s); + nx = t; + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var delta = this.z.redSqr(); + var gamma = this.y.redSqr(); + var beta = this.x.redMul(gamma); + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + 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; + 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); + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var zz = this.z.redSqr(); + var yyyy = yy.redSqr(); + var m = xx.redAdd(xx).redIAdd(xx); + var mm = m.redSqr(); + 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); + var ee = e.redSqr(); + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + 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); + 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); + 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(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; + 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; + 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() { + return this.z.cmpn(0) === 0; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/mont.js +var require_mont = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/mont.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var utils = require_utils2(); + function MontCurve(conf) { + Base.call(this, "mont", conf); + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.i4 = new BN(4).toRed(this.red).redInvm(); + this.two = new BN(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); + } + inherits(MontCurve, Base); + module2.exports = MontCurve; + MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + return y.redSqr().cmp(rhs) === 0; + }; + function Point(curve, x, z) { + Base.BasePoint.call(this, curve, "projective"); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new BN(x, 16); + this.z = new BN(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } + } + inherits(Point, Base.BasePoint); + MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + return this.point(utils.toArray(bytes, enc), 1); + }; + MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); + }; + MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); + }; + Point.prototype.precompute = function precompute() { + }; + Point.prototype._encode = function _encode() { + return this.getX().toArray("be", this.curve.p.byteLength()); + }; + Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); + }; + Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ""; + return ""; + }; + Point.prototype.isInfinity = function isInfinity() { + return this.z.cmpn(0) === 0; + }; + Point.prototype.dbl = function dbl() { + var a = this.x.redAdd(this.z); + var aa = a.redSqr(); + var b = this.x.redSub(this.z); + var bb = b.redSqr(); + var c = aa.redSub(bb); + var nx = aa.redMul(bb); + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); + }; + Point.prototype.add = function add() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.diffAdd = function diffAdd(p, diff) { + var a = this.x.redAdd(this.z); + var b = this.x.redSub(this.z); + var c = p.x.redAdd(p.z); + var d = p.x.redSub(p.z); + var da = d.redMul(a); + var cb = c.redMul(b); + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); + }; + Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; + var b = this.curve.point(null, null); + var c = this; + for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) + bits.push(t.andln(1)); + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + a = a.diffAdd(b, c); + b = b.dbl(); + } else { + b = a.diffAdd(b, c); + a = a.dbl(); + } + } + return b; + }; + Point.prototype.mulAdd = function mulAdd() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.jumlAdd = function jumlAdd() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.eq = function eq(other) { + return this.getX().cmp(other.getX()) === 0; + }; + Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; + }; + Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/edwards.js +var require_edwards = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/edwards.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var assert = utils.assert; + function EdwardsCurve(conf) { + this.twisted = (conf.a | 0) !== 1; + this.mOneA = this.twisted && (conf.a | 0) === -1; + this.extended = this.mOneA; + Base.call(this, "edwards", conf); + this.a = new BN(conf.a, 16).umod(this.red.m); + this.a = this.a.toRed(this.red); + this.c = new BN(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new BN(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = (conf.c | 0) === 1; + } + inherits(EdwardsCurve, Base); + module2.exports = EdwardsCurve; + EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); + }; + EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); + }; + EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); + }; + EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + var y2 = rhs.redMul(lhs.redInvm()); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error("invalid point"); + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + return this.point(x, y); + }; + EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { + y = new BN(y, 16); + if (!y.red) + y = y.toRed(this.red); + var y2 = y.redSqr(); + var lhs = y2.redSub(this.c2); + var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a); + var x2 = lhs.redMul(rhs.redInvm()); + if (x2.cmp(this.zero) === 0) { + if (odd) + throw new Error("invalid point"); + else + return this.point(this.zero, y); + } + var x = x2.redSqrt(); + if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) + throw new Error("invalid point"); + if (x.fromRed().isOdd() !== odd) + x = x.redNeg(); + return this.point(x, y); + }; + EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + point.normalize(); + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + return lhs.cmp(rhs) === 0; + }; + function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, "projective"); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = z ? new BN(z, 16) : this.curve.one; + this.t = t && new BN(t, 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); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } + } + inherits(Point, Base.BasePoint); + EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); + }; + EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); + }; + Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); + }; + Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ""; + return ""; + }; + Point.prototype.isInfinity = function isInfinity() { + return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0); + }; + Point.prototype._extDbl = function _extDbl() { + var a = this.x.redSqr(); + var b = this.y.redSqr(); + var c = this.z.redSqr(); + c = c.redIAdd(c); + var d = this.curve._mulA(a); + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + var g = d.redAdd(b); + var f = g.redSub(c); + var h = d.redSub(b); + var nx = e.redMul(f); + var ny = g.redMul(h); + var nt = e.redMul(h); + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); + }; + Point.prototype._projDbl = function _projDbl() { + var b = this.x.redAdd(this.y).redSqr(); + var c = this.x.redSqr(); + var d = this.y.redSqr(); + var nx; + var ny; + var nz; + var e; + var h; + var j; + if (this.curve.twisted) { + e = this.curve._mulA(c); + var f = e.redAdd(d); + if (this.zOne) { + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + ny = f.redMul(e.redSub(d)); + nz = f.redSqr().redSub(f).redSub(f); + } else { + h = this.z.redSqr(); + j = f.redSub(h).redISub(h); + nx = b.redSub(c).redISub(d).redMul(j); + ny = f.redMul(e.redSub(d)); + nz = f.redMul(j); + } + } else { + e = c.redAdd(d); + h = this.curve._mulC(this.z).redSqr(); + j = e.redSub(h).redSub(h); + nx = this.curve._mulC(b.redISub(e)).redMul(j); + ny = this.curve._mulC(e).redMul(c.redISub(d)); + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); + }; + Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); + }; + Point.prototype._extAdd = function _extAdd(p) { + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + var c = this.t.redMul(this.curve.dd).redMul(p.t); + var d = this.z.redMul(p.z.redAdd(p.z)); + var e = b.redSub(a); + var f = d.redSub(c); + var g = d.redAdd(c); + var h = b.redAdd(a); + var nx = e.redMul(f); + var ny = g.redMul(h); + var nt = e.redMul(h); + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); + }; + Point.prototype._projAdd = function _projAdd(p) { + var a = this.z.redMul(p.z); + var b = a.redSqr(); + var c = this.x.redMul(p.x); + var d = this.y.redMul(p.y); + var e = this.curve.d.redMul(c).redMul(d); + var f = b.redSub(e); + var g = b.redAdd(e); + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + var ny; + var nz; + if (this.curve.twisted) { + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + nz = f.redMul(g); + } else { + ny = a.redMul(g).redMul(d.redSub(c)); + nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); + }; + Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); + }; + Point.prototype.mul = function mul(k) { + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); + }; + Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, false); + }; + Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, true); + }; + Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; + }; + Point.prototype.neg = function neg() { + return this.curve.point( + this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg() + ); + }; + Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); + }; + Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); + }; + Point.prototype.eq = function eq(other) { + return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0; + }; + Point.prototype.eqXToP = function eqXToP(x) { + var rx = x.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(rx) === 0) + return true; + var xc = x.clone(); + var t = this.curve.redN.redMul(this.z); + 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; + } + }; + Point.prototype.toP = Point.prototype.normalize; + Point.prototype.mixedAdd = Point.prototype.add; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/index.js +var require_curve = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/index.js"(exports2) { + "use strict"; + var curve = exports2; + curve.base = require_base(); + curve.short = require_short(); + curve.mont = require_mont(); + curve.edwards = require_edwards(); + } +}); + +// node_modules/hash.js/lib/hash/utils.js +var require_utils3 = __commonJS({ + "node_modules/hash.js/lib/hash/utils.js"(exports2) { + "use strict"; + var assert = require_minimalistic_assert(); + var inherits = require_inherits(); + exports2.inherits = inherits; + function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 64512) !== 55296) { + return false; + } + if (i < 0 || i + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i + 1) & 64512) === 56320; + } + function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === "string") { + if (!enc) { + 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 = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023); + 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; + } + exports2.toArray = toArray; + function toHex(msg) { + var res = ""; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; + } + exports2.toHex = toHex; + function htonl(w) { + var res = w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (w & 255) << 24; + return res >>> 0; + } + exports2.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; + } + exports2.toHex32 = toHex32; + function zero2(word) { + if (word.length === 1) + return "0" + word; + else + return word; + } + exports2.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; + } + exports2.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; + } + exports2.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 & 255; + res[k + 2] = m >>> 8 & 255; + res[k + 3] = m & 255; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = m >>> 16 & 255; + res[k + 1] = m >>> 8 & 255; + res[k] = m & 255; + } + } + return res; + } + exports2.split32 = split32; + function rotr32(w, b) { + return w >>> b | w << 32 - b; + } + exports2.rotr32 = rotr32; + function rotl32(w, b) { + return w << b | w >>> 32 - b; + } + exports2.rotl32 = rotl32; + function sum32(a, b) { + return a + b >>> 0; + } + exports2.sum32 = sum32; + function sum32_3(a, b, c) { + return a + b + c >>> 0; + } + exports2.sum32_3 = sum32_3; + function sum32_4(a, b, c, d) { + return a + b + c + d >>> 0; + } + exports2.sum32_4 = sum32_4; + function sum32_5(a, b, c, d, e) { + return a + b + c + d + e >>> 0; + } + exports2.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; + } + exports2.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; + } + exports2.sum64_hi = sum64_hi; + function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; + } + exports2.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; + } + exports2.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; + } + exports2.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; + } + exports2.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; + } + exports2.sum64_5_lo = sum64_5_lo; + function rotr64_hi(ah, al, num) { + var r = al << 32 - num | ah >>> num; + return r >>> 0; + } + exports2.rotr64_hi = rotr64_hi; + function rotr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; + } + exports2.rotr64_lo = rotr64_lo; + function shr64_hi(ah, al, num) { + return ah >>> num; + } + exports2.shr64_hi = shr64_hi; + function shr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; + } + exports2.shr64_lo = shr64_lo; + } +}); + +// node_modules/hash.js/lib/hash/common.js +var require_common = __commonJS({ + "node_modules/hash.js/lib/hash/common.js"(exports2) { + "use strict"; + var utils = require_utils3(); + var assert = require_minimalistic_assert(); + 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; + } + exports2.BlockHash = BlockHash; + BlockHash.prototype.update = function update(msg, enc) { + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + if (this.pending.length >= this._delta8) { + msg = this.pending; + 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] = 128; + for (var i = 1; i < k; i++) + res[i] = 0; + 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 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len & 255; + } else { + res[i++] = len & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 24 & 255; + 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/sha/common.js +var require_common2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/common.js"(exports2) { + "use strict"; + var utils = require_utils3(); + 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); + } + exports2.ft_1 = ft_1; + function ch32(x, y, z) { + return x & y ^ ~x & z; + } + exports2.ch32 = ch32; + function maj32(x, y, z) { + return x & y ^ x & z ^ y & z; + } + exports2.maj32 = maj32; + function p32(x, y, z) { + return x ^ y ^ z; + } + exports2.p32 = p32; + function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); + } + exports2.s0_256 = s0_256; + function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); + } + exports2.s1_256 = s1_256; + function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3; + } + exports2.g0_256 = g0_256; + function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10; + } + exports2.g1_256 = g1_256; + } +}); + +// node_modules/hash.js/lib/hash/sha/1.js +var require__ = __commonJS({ + "node_modules/hash.js/lib/hash/sha/1.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var shaCommon = require_common2(); + 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 = [ + 1518500249, + 1859775393, + 2400959708, + 3395469782 + ]; + function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + BlockHash.call(this); + this.h = [ + 1732584193, + 4023233417, + 2562383102, + 271733878, + 3285377520 + ]; + this.W = new Array(80); + } + utils.inherits(SHA1, BlockHash); + module2.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/256.js +var require__2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/256.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var shaCommon = require_common2(); + var assert = require_minimalistic_assert(); + 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 = [ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]; + function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + BlockHash.call(this); + this.h = [ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ]; + this.k = sha256_K; + this.W = new Array(64); + } + utils.inherits(SHA256, BlockHash); + module2.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/224.js +var require__3 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/224.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var SHA256 = require__2(); + function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + SHA256.call(this); + this.h = [ + 3238371032, + 914150663, + 812702999, + 4144912697, + 4290775857, + 1750603025, + 1694076839, + 3204075428 + ]; + } + utils.inherits(SHA224, SHA256); + module2.exports = SHA224; + SHA224.blockSize = 512; + SHA224.outSize = 224; + SHA224.hmacStrength = 192; + SHA224.padLength = 64; + SHA224.prototype._digest = function digest(enc) { + 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/512.js +var require__4 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/512.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var assert = require_minimalistic_assert(); + 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 = [ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]; + function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + BlockHash.call(this); + this.h = [ + 1779033703, + 4089235720, + 3144134277, + 2227873595, + 1013904242, + 4271175723, + 2773480762, + 1595750129, + 1359893119, + 2917565137, + 2600822924, + 725511199, + 528734635, + 4215389547, + 1541459225, + 327033209 + ]; + this.k = sha512_K; + this.W = new Array(160); + } + utils.inherits(SHA512, BlockHash); + module2.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; + 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]); + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; + 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 += 4294967296; + return r; + } + function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ ~xl & zl; + if (r < 0) + r += 4294967296; + return r; + } + function maj64_hi(xh, xl, yh, yl, zh) { + var r = xh & yh ^ xh & zh ^ yh & zh; + if (r < 0) + r += 4294967296; + return r; + } + function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ xl & zl ^ yl & zl; + if (r < 0) + r += 4294967296; + return r; + } + function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); + var c2_hi = rotr64_hi(xl, xh, 7); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + return r; + } + function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); + var c2_lo = rotr64_lo(xl, xh, 7); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + 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); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + 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); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + 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 += 4294967296; + 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 += 4294967296; + return r; + } + function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); + var c2_hi = shr64_hi(xh, xl, 6); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + return r; + } + function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); + var c2_lo = shr64_lo(xh, xl, 6); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + return r; + } + } +}); + +// node_modules/hash.js/lib/hash/sha/384.js +var require__5 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/384.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var SHA512 = require__4(); + function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + SHA512.call(this); + this.h = [ + 3418070365, + 3238371032, + 1654270250, + 914150663, + 2438529370, + 812702999, + 355462360, + 4144912697, + 1731405415, + 4290775857, + 2394180231, + 1750603025, + 3675008525, + 1694076839, + 1203062813, + 3204075428 + ]; + } + utils.inherits(SHA384, SHA512); + module2.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.js +var require_sha = __commonJS({ + "node_modules/hash.js/lib/hash/sha.js"(exports2) { + "use strict"; + exports2.sha1 = require__(); + exports2.sha224 = require__3(); + exports2.sha256 = require__2(); + exports2.sha384 = require__5(); + exports2.sha512 = require__4(); + } +}); + +// node_modules/hash.js/lib/hash/ripemd.js +var require_ripemd = __commonJS({ + "node_modules/hash.js/lib/hash/ripemd.js"(exports2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + 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 = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]; + this.endian = "little"; + } + utils.inherits(RIPEMD160, BlockHash); + exports2.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 0; + else if (j <= 31) + return 1518500249; + else if (j <= 47) + return 1859775393; + else if (j <= 63) + return 2400959708; + else + return 2840853838; + } + function Kh(j) { + if (j <= 15) + return 1352829926; + else if (j <= 31) + return 1548603684; + else if (j <= 47) + return 1836072691; + else if (j <= 63) + return 2053994217; + else + return 0; + } + 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/hmac.js +var require_hmac = __commonJS({ + "node_modules/hash.js/lib/hash/hmac.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var assert = require_minimalistic_assert(); + 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)); + } + module2.exports = Hmac; + Hmac.prototype._init = function init(key) { + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + for (i = 0; i < key.length; i++) + key[i] ^= 54; + this.inner = new this.Hash().update(key); + for (i = 0; i < key.length; i++) + key[i] ^= 106; + 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.js +var require_hash = __commonJS({ + "node_modules/hash.js/lib/hash.js"(exports2) { + var hash = exports2; + hash.utils = require_utils3(); + hash.common = require_common(); + hash.sha = require_sha(); + hash.ripemd = require_ripemd(); + hash.hmac = require_hmac(); + 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/elliptic/lib/elliptic/precomputed/secp256k1.js +var require_secp256k1 = __commonJS({ + "node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js"(exports2, module2) { + module2.exports = { + doubles: { + step: 4, + points: [ + [ + "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", + "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821" + ], + [ + "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", + "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf" + ], + [ + "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", + "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695" + ], + [ + "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", + "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9" + ], + [ + "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", + "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36" + ], + [ + "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", + "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f" + ], + [ + "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", + "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999" + ], + [ + "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", + "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09" + ], + [ + "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", + "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d" + ], + [ + "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", + "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088" + ], + [ + "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", + "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d" + ], + [ + "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", + "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8" + ], + [ + "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", + "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a" + ], + [ + "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", + "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453" + ], + [ + "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", + "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160" + ], + [ + "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", + "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0" + ], + [ + "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", + "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6" + ], + [ + "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", + "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589" + ], + [ + "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", + "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17" + ], + [ + "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", + "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda" + ], + [ + "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", + "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd" + ], + [ + "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", + "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2" + ], + [ + "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", + "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6" + ], + [ + "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", + "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f" + ], + [ + "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", + "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01" + ], + [ + "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", + "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3" + ], + [ + "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", + "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f" + ], + [ + "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", + "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7" + ], + [ + "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", + "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78" + ], + [ + "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", + "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1" + ], + [ + "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", + "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150" + ], + [ + "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", + "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82" + ], + [ + "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", + "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc" + ], + [ + "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", + "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b" + ], + [ + "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", + "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51" + ], + [ + "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", + "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45" + ], + [ + "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", + "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120" + ], + [ + "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", + "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84" + ], + [ + "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", + "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d" + ], + [ + "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", + "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d" + ], + [ + "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", + "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8" + ], + [ + "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", + "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8" + ], + [ + "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", + "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac" + ], + [ + "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", + "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f" + ], + [ + "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", + "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962" + ], + [ + "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", + "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907" + ], + [ + "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", + "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec" + ], + [ + "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", + "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d" + ], + [ + "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", + "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414" + ], + [ + "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", + "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd" + ], + [ + "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", + "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0" + ], + [ + "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", + "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811" + ], + [ + "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", + "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1" + ], + [ + "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", + "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c" + ], + [ + "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", + "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73" + ], + [ + "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", + "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd" + ], + [ + "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", + "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405" + ], + [ + "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", + "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589" + ], + [ + "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", + "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e" + ], + [ + "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", + "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27" + ], + [ + "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", + "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1" + ], + [ + "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", + "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482" + ], + [ + "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", + "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945" + ], + [ + "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", + "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573" + ], + [ + "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", + "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82" + ] + ] + }, + naf: { + wnd: 7, + points: [ + [ + "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", + "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672" + ], + [ + "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", + "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6" + ], + [ + "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", + "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da" + ], + [ + "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", + "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37" + ], + [ + "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", + "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b" + ], + [ + "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", + "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81" + ], + [ + "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", + "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58" + ], + [ + "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", + "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77" + ], + [ + "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", + "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a" + ], + [ + "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", + "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c" + ], + [ + "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", + "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67" + ], + [ + "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", + "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402" + ], + [ + "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", + "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55" + ], + [ + "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", + "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482" + ], + [ + "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", + "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82" + ], + [ + "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", + "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396" + ], + [ + "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", + "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49" + ], + [ + "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", + "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf" + ], + [ + "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", + "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a" + ], + [ + "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", + "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7" + ], + [ + "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", + "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933" + ], + [ + "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", + "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a" + ], + [ + "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", + "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6" + ], + [ + "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", + "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37" + ], + [ + "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", + "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e" + ], + [ + "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", + "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6" + ], + [ + "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", + "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476" + ], + [ + "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", + "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40" + ], + [ + "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", + "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61" + ], + [ + "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", + "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683" + ], + [ + "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", + "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5" + ], + [ + "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", + "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b" + ], + [ + "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", + "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417" + ], + [ + "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", + "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868" + ], + [ + "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", + "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a" + ], + [ + "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", + "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6" + ], + [ + "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", + "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996" + ], + [ + "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", + "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e" + ], + [ + "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", + "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d" + ], + [ + "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", + "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2" + ], + [ + "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", + "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e" + ], + [ + "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", + "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437" + ], + [ + "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", + "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311" + ], + [ + "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", + "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4" + ], + [ + "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", + "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575" + ], + [ + "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", + "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d" + ], + [ + "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", + "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d" + ], + [ + "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", + "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629" + ], + [ + "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", + "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06" + ], + [ + "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", + "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374" + ], + [ + "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", + "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee" + ], + [ + "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", + "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1" + ], + [ + "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", + "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b" + ], + [ + "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", + "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661" + ], + [ + "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", + "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6" + ], + [ + "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", + "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e" + ], + [ + "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", + "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d" + ], + [ + "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", + "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc" + ], + [ + "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", + "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4" + ], + [ + "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", + "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c" + ], + [ + "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", + "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b" + ], + [ + "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", + "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913" + ], + [ + "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", + "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154" + ], + [ + "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", + "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865" + ], + [ + "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", + "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc" + ], + [ + "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", + "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224" + ], + [ + "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", + "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e" + ], + [ + "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", + "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6" + ], + [ + "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", + "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511" + ], + [ + "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", + "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b" + ], + [ + "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", + "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2" + ], + [ + "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", + "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c" + ], + [ + "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", + "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3" + ], + [ + "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", + "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d" + ], + [ + "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", + "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700" + ], + [ + "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", + "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4" + ], + [ + "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", + "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196" + ], + [ + "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", + "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4" + ], + [ + "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", + "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257" + ], + [ + "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", + "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13" + ], + [ + "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", + "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096" + ], + [ + "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", + "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38" + ], + [ + "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", + "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f" + ], + [ + "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", + "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448" + ], + [ + "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", + "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a" + ], + [ + "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", + "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4" + ], + [ + "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", + "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437" + ], + [ + "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", + "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7" + ], + [ + "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", + "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d" + ], + [ + "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", + "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a" + ], + [ + "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", + "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54" + ], + [ + "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", + "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77" + ], + [ + "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", + "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517" + ], + [ + "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", + "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10" + ], + [ + "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", + "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125" + ], + [ + "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", + "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e" + ], + [ + "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", + "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1" + ], + [ + "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", + "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2" + ], + [ + "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", + "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423" + ], + [ + "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", + "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8" + ], + [ + "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", + "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758" + ], + [ + "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", + "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375" + ], + [ + "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", + "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d" + ], + [ + "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", + "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec" + ], + [ + "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", + "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0" + ], + [ + "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", + "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c" + ], + [ + "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", + "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4" + ], + [ + "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", + "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f" + ], + [ + "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", + "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649" + ], + [ + "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", + "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826" + ], + [ + "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", + "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5" + ], + [ + "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", + "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87" + ], + [ + "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", + "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b" + ], + [ + "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", + "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc" + ], + [ + "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", + "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c" + ], + [ + "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", + "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f" + ], + [ + "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", + "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a" + ], + [ + "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", + "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46" + ], + [ + "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", + "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f" + ], + [ + "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", + "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03" + ], + [ + "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", + "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08" + ], + [ + "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", + "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8" + ], + [ + "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", + "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373" + ], + [ + "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", + "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3" + ], + [ + "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", + "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8" + ], + [ + "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", + "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1" + ], + [ + "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", + "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9" + ] + ] + } + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curves.js +var require_curves = __commonJS({ + "node_modules/elliptic/lib/elliptic/curves.js"(exports2) { + "use strict"; + var curves = exports2; + var hash = require_hash(); + var curve = require_curve(); + var utils = require_utils2(); + var assert = utils.assert; + function PresetCurve(options) { + if (options.type === "short") + this.curve = new curve.short(options); + else if (options.type === "edwards") + this.curve = new curve.edwards(options); + else + this.curve = new curve.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(name2, options) { + Object.defineProperty(curves, name2, { + configurable: true, + enumerable: true, + get: function() { + var curve2 = new PresetCurve(options); + Object.defineProperty(curves, name2, { + configurable: true, + enumerable: true, + value: curve2 + }); + return curve2; + } + }); + } + 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.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.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.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.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.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.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.sha256, + gRed: false, + g: [ + "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", + // 4/5 + "6666666666666666666666666666666666666666666666666666666666666658" + ] + }); + var pre; + try { + pre = require_secp256k1(); + } catch (e) { + pre = void 0; + } + 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.sha256, + // Precomputed endomorphism + beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", + lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", + basis: [ + { + a: "3086d221a7d46bcde86c90e49284eb15", + b: "-e4437ed6010e88286f547fa90abfe4c3" + }, + { + a: "114ca50f7a8e2f3f657c1108d9d44cfd8", + b: "3086d221a7d46bcde86c90e49284eb15" + } + ], + gRed: false, + g: [ + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + pre + ] + }); + } +}); + +// node_modules/hmac-drbg/lib/hmac-drbg.js +var require_hmac_drbg = __commonJS({ + "node_modules/hmac-drbg/lib/hmac-drbg.js"(exports2, module2) { + "use strict"; + var hash = require_hash(); + var utils = require_utils(); + var assert = require_minimalistic_assert(); + 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.toArray(options.entropy, options.entropyEnc || "hex"); + var nonce = utils.toArray(options.nonce, options.nonceEnc || "hex"); + var pers = utils.toArray(options.pers, options.persEnc || "hex"); + assert( + entropy.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ); + this._init(entropy, nonce, pers); + } + module2.exports = 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] = 0; + this.V[i] = 1; + } + this._update(seed); + this._reseed = 1; + this.reseedInterval = 281474976710656; + }; + HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); + }; + HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac().update(this.V).update([0]); + 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([1]).update(seed).digest(); + this.V = this._hmac().update(this.V).digest(); + }; + HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + if (typeof entropyEnc !== "string") { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + entropy = utils.toArray(entropy, entropyEnc); + add = utils.toArray(add, addEnc); + assert( + 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"); + if (typeof enc !== "string") { + addEnc = add; + add = enc; + enc = null; + } + if (add) { + add = utils.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.encode(res, enc); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/key.js +var require_key = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/key.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); + } + module2.exports = KeyPair; + KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(ec, { + pub, + pubEnc: enc + }); + }; + KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + return new KeyPair(ec, { + 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) { + 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(key, enc || 16); + this.priv = this.priv.umod(this.ec.curve.n); + }; + KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + if (this.ec.curve.type === "mont") { + assert(key.x, "Need x coordinate"); + } else if (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") { + assert(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); + }; + KeyPair.prototype.derive = function derive(pub) { + if (!pub.validate()) { + assert(pub.validate(), "public point not validated"); + } + return pub.mul(this.priv).getX(); + }; + 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 ""; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/signature.js +var require_signature = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/signature.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + function Signature(options, enc) { + if (options instanceof Signature) + return options; + if (this._importDER(options, enc)) + return; + assert(options.r && options.s, "Signature without r or s"); + this.r = new BN(options.r, 16); + this.s = new BN(options.s, 16); + if (options.recoveryParam === void 0) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; + } + module2.exports = Signature; + function Position() { + this.place = 0; + } + function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 128)) { + return initial; + } + var octetLen = initial & 15; + 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; + } + if (val <= 127) { + return false; + } + p.place = off; + return val; + } + function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 128) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); + } + Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 48) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if (len + p.place !== data.length) { + return false; + } + if (data[p.place++] !== 2) { + 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++] !== 2) { + 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] & 128) { + r = r.slice(1); + } else { + return false; + } + } + if (s[0] === 0) { + if (s[1] & 128) { + s = s.slice(1); + } else { + return false; + } + } + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + return true; + }; + function constructLength(arr, len) { + if (len < 128) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 128); + while (--octets) { + arr.push(len >>> (octets << 3) & 255); + } + arr.push(len); + } + Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + if (r[0] & 128) + r = [0].concat(r); + if (s[0] & 128) + s = [0].concat(s); + r = rmPadding(r); + s = rmPadding(s); + while (!s[0] && !(s[1] & 128)) { + s = s.slice(1); + } + var arr = [2]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(2); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [48]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/index.js +var require_ec = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/index.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var HmacDRBG = require_hmac_drbg(); + var utils = require_utils2(); + var curves = require_curves(); + var rand = require_brorand(); + var assert = utils.assert; + var KeyPair = require_key(); + var Signature = require_signature(); + function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + if (typeof options === "string") { + assert( + Object.prototype.hasOwnProperty.call(curves, options), + "Unknown curve " + options + ); + options = curves[options]; + } + if (options instanceof curves.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; + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + this.hash = options.hash || options.curve.hash; + } + module2.exports = EC; + EC.prototype.keyPair = function keyPair(options) { + return new KeyPair(this, options); + }; + EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return KeyPair.fromPrivate(this, priv, enc); + }; + EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return KeyPair.fromPublic(this, pub, enc); + }; + EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + 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(2)); + for (; ; ) { + var priv = new BN(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(msg, 16)); + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray("be", bytes); + var nonce = msg.toArray("be", bytes); + var drbg = new HmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce, + pers: options.pers, + persEnc: options.persEnc || "utf8" + }); + var ns1 = this.n.sub(new BN(1)); + for (var iter = 0; ; iter++) { + var k = options.k ? options.k(iter) : new BN(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); + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + return new Signature({ r, s, recoveryParam }); + } + }; + EC.prototype.verify = function verify(msg, signature, key, enc) { + msg = this._truncateToN(new BN(msg, 16)); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, "hex"); + var r = signature.r; + var s = signature.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; + 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; + } + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + return p.eqXToP(r); + }; + EC.prototype.recoverPubKey = function(msg, signature, j, enc) { + assert((3 & j) === j, "The recovery param is more than two bits"); + signature = new Signature(signature, enc); + var n = this.n; + var e = new BN(msg); + var r = signature.r; + var s = signature.s; + 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"); + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + return this.g.mulAdd(s1, r, s2); + }; + EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { + signature = new Signature(signature, enc); + if (signature.recoveryParam !== null) + return signature.recoveryParam; + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature, i); + } catch (e2) { + continue; + } + if (Qprime.eq(Q)) + return i; + } + throw new Error("Unable to find valid recovery factor"); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/key.js +var require_key2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/key.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var assert = utils.assert; + var parseBytes = utils.parseBytes; + var cachedProperty = utils.cachedProperty; + function KeyPair(eddsa, params) { + this.eddsa = eddsa; + this._secret = parseBytes(params.secret); + if (eddsa.isPoint(params.pub)) + this._pub = params.pub; + else + this._pubBytes = parseBytes(params.pub); + } + KeyPair.fromPublic = function fromPublic(eddsa, pub) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(eddsa, { pub }); + }; + KeyPair.fromSecret = function fromSecret(eddsa, secret) { + if (secret instanceof KeyPair) + return secret; + return new KeyPair(eddsa, { secret }); + }; + KeyPair.prototype.secret = function secret() { + return this._secret; + }; + cachedProperty(KeyPair, "pubBytes", function pubBytes() { + return this.eddsa.encodePoint(this.pub()); + }); + cachedProperty(KeyPair, "pub", function pub() { + if (this._pubBytes) + return this.eddsa.decodePoint(this._pubBytes); + return this.eddsa.g.mul(this.priv()); + }); + cachedProperty(KeyPair, "privBytes", function privBytes() { + var eddsa = this.eddsa; + var hash = this.hash(); + var lastIx = eddsa.encodingLength - 1; + var a = hash.slice(0, eddsa.encodingLength); + a[0] &= 248; + a[lastIx] &= 127; + a[lastIx] |= 64; + return a; + }); + cachedProperty(KeyPair, "priv", function priv() { + return this.eddsa.decodeInt(this.privBytes()); + }); + cachedProperty(KeyPair, "hash", function hash() { + return this.eddsa.hash().update(this.secret()).digest(); + }); + cachedProperty(KeyPair, "messagePrefix", function messagePrefix() { + return this.hash().slice(this.eddsa.encodingLength); + }); + KeyPair.prototype.sign = function sign(message) { + assert(this._secret, "KeyPair can only verify"); + return this.eddsa.sign(message, this); + }; + KeyPair.prototype.verify = function verify(message, sig) { + return this.eddsa.verify(message, sig, this); + }; + KeyPair.prototype.getSecret = function getSecret(enc) { + assert(this._secret, "KeyPair is public only"); + return utils.encode(this.secret(), enc); + }; + KeyPair.prototype.getPublic = function getPublic(enc) { + return utils.encode(this.pubBytes(), enc); + }; + module2.exports = KeyPair; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/signature.js +var require_signature2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/signature.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + var cachedProperty = utils.cachedProperty; + var parseBytes = utils.parseBytes; + function Signature(eddsa, sig) { + this.eddsa = eddsa; + if (typeof sig !== "object") + sig = parseBytes(sig); + if (Array.isArray(sig)) { + sig = { + R: sig.slice(0, eddsa.encodingLength), + S: sig.slice(eddsa.encodingLength) + }; + } + assert(sig.R && sig.S, "Signature without R or S"); + if (eddsa.isPoint(sig.R)) + this._R = sig.R; + if (sig.S instanceof BN) + this._S = sig.S; + this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded; + this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded; + } + cachedProperty(Signature, "S", function S() { + return this.eddsa.decodeInt(this.Sencoded()); + }); + cachedProperty(Signature, "R", function R() { + return this.eddsa.decodePoint(this.Rencoded()); + }); + cachedProperty(Signature, "Rencoded", function Rencoded() { + return this.eddsa.encodePoint(this.R()); + }); + cachedProperty(Signature, "Sencoded", function Sencoded() { + return this.eddsa.encodeInt(this.S()); + }); + Signature.prototype.toBytes = function toBytes() { + return this.Rencoded().concat(this.Sencoded()); + }; + Signature.prototype.toHex = function toHex() { + return utils.encode(this.toBytes(), "hex").toUpperCase(); + }; + module2.exports = Signature; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/index.js +var require_eddsa = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/index.js"(exports2, module2) { + "use strict"; + var hash = require_hash(); + var curves = require_curves(); + var utils = require_utils2(); + var assert = utils.assert; + var parseBytes = utils.parseBytes; + var KeyPair = require_key2(); + var Signature = require_signature2(); + function EDDSA(curve) { + assert(curve === "ed25519", "only tested with ed25519 so far"); + if (!(this instanceof EDDSA)) + return new EDDSA(curve); + curve = curves[curve].curve; + this.curve = curve; + this.g = curve.g; + this.g.precompute(curve.n.bitLength() + 1); + this.pointClass = curve.point().constructor; + this.encodingLength = Math.ceil(curve.n.bitLength() / 8); + this.hash = hash.sha512; + } + module2.exports = EDDSA; + EDDSA.prototype.sign = function sign(message, secret) { + message = parseBytes(message); + var key = this.keyFromSecret(secret); + var r = this.hashInt(key.messagePrefix(), message); + var R = this.g.mul(r); + var Rencoded = this.encodePoint(R); + var s_ = this.hashInt(Rencoded, key.pubBytes(), message).mul(key.priv()); + var S = r.add(s_).umod(this.curve.n); + return this.makeSignature({ R, S, Rencoded }); + }; + EDDSA.prototype.verify = function verify(message, sig, pub) { + message = parseBytes(message); + sig = this.makeSignature(sig); + var key = this.keyFromPublic(pub); + var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); + var SG = this.g.mul(sig.S()); + var RplusAh = sig.R().add(key.pub().mul(h)); + return RplusAh.eq(SG); + }; + EDDSA.prototype.hashInt = function hashInt() { + var hash2 = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash2.update(arguments[i]); + return utils.intFromLE(hash2.digest()).umod(this.curve.n); + }; + EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { + return KeyPair.fromPublic(this, pub); + }; + EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { + return KeyPair.fromSecret(this, secret); + }; + EDDSA.prototype.makeSignature = function makeSignature(sig) { + if (sig instanceof Signature) + return sig; + return new Signature(this, sig); + }; + EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray("le", this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 128 : 0; + return enc; + }; + EDDSA.prototype.decodePoint = function decodePoint(bytes) { + bytes = utils.parseBytes(bytes); + var lastIx = bytes.length - 1; + var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~128); + var xIsOdd = (bytes[lastIx] & 128) !== 0; + var y = utils.intFromLE(normed); + return this.curve.pointFromY(y, xIsOdd); + }; + EDDSA.prototype.encodeInt = function encodeInt(num) { + return num.toArray("le", this.encodingLength); + }; + EDDSA.prototype.decodeInt = function decodeInt(bytes) { + return utils.intFromLE(bytes); + }; + EDDSA.prototype.isPoint = function isPoint(val) { + return val instanceof this.pointClass; + }; + } +}); + +// node_modules/elliptic/lib/elliptic.js +var require_elliptic = __commonJS({ + "node_modules/elliptic/lib/elliptic.js"(exports2) { + "use strict"; + var elliptic = exports2; + elliptic.version = require_package().version; + elliptic.utils = require_utils2(); + elliptic.rand = require_brorand(); + elliptic.curve = require_curve(); + elliptic.curves = require_curves(); + elliptic.ec = require_ec(); + elliptic.eddsa = require_eddsa(); + } +}); + +// node_modules/@ethersproject/signing-key/lib/elliptic.js +var require_elliptic2 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/elliptic.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EC = void 0; + var elliptic_1 = __importDefault(require_elliptic()); + var EC = elliptic_1.default.ec; + exports2.EC = EC; + } +}); + +// node_modules/@ethersproject/signing-key/lib/_version.js +var require_version12 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "signing-key/5.5.0"; + } +}); + +// node_modules/@ethersproject/signing-key/lib/index.js +var require_lib14 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.computePublicKey = exports2.recoverPublicKey = exports2.SigningKey = void 0; + var elliptic_1 = require_elliptic2(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version12(); + var logger = new logger_1.Logger(_version_1.version); + var _curve = null; + function getCurve() { + if (!_curve) { + _curve = new elliptic_1.EC("secp256k1"); + } + return _curve; + } + var SigningKey = ( + /** @class */ + function() { + function SigningKey2(privateKey) { + (0, properties_1.defineReadOnly)(this, "curve", "secp256k1"); + (0, properties_1.defineReadOnly)(this, "privateKey", (0, bytes_1.hexlify)(privateKey)); + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + (0, properties_1.defineReadOnly)(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); + (0, properties_1.defineReadOnly)(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); + (0, properties_1.defineReadOnly)(this, "_isSigningKey", true); + } + SigningKey2.prototype._addPoint = function(other) { + var p0 = getCurve().keyFromPublic((0, bytes_1.arrayify)(this.publicKey)); + var p1 = getCurve().keyFromPublic((0, bytes_1.arrayify)(other)); + return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex"); + }; + SigningKey2.prototype.signDigest = function(digest) { + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + var digestBytes = (0, bytes_1.arrayify)(digest); + if (digestBytes.length !== 32) { + logger.throwArgumentError("bad digest length", "digest", digest); + } + var signature = keyPair.sign(digestBytes, { canonical: true }); + return (0, bytes_1.splitSignature)({ + recoveryParam: signature.recoveryParam, + r: (0, bytes_1.hexZeroPad)("0x" + signature.r.toString(16), 32), + s: (0, bytes_1.hexZeroPad)("0x" + signature.s.toString(16), 32) + }); + }; + SigningKey2.prototype.computeSharedSecret = function(otherKey) { + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + var otherKeyPair = getCurve().keyFromPublic((0, bytes_1.arrayify)(computePublicKey(otherKey))); + return (0, bytes_1.hexZeroPad)("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32); + }; + SigningKey2.isSigningKey = function(value) { + return !!(value && value._isSigningKey); + }; + return SigningKey2; + }() + ); + exports2.SigningKey = SigningKey; + function recoverPublicKey(digest, signature) { + var sig = (0, bytes_1.splitSignature)(signature); + var rs = { r: (0, bytes_1.arrayify)(sig.r), s: (0, bytes_1.arrayify)(sig.s) }; + return "0x" + getCurve().recoverPubKey((0, bytes_1.arrayify)(digest), rs, sig.recoveryParam).encode("hex", false); + } + exports2.recoverPublicKey = recoverPublicKey; + function computePublicKey(key, compressed) { + var bytes = (0, bytes_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 (0, bytes_1.hexlify)(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(false, "hex"); + } else if (bytes.length === 65) { + if (!compressed) { + return (0, bytes_1.hexlify)(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(true, "hex"); + } + return logger.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + } + exports2.computePublicKey = computePublicKey; + } +}); + +// node_modules/@ethersproject/transactions/lib/_version.js +var require_version13 = __commonJS({ + "node_modules/@ethersproject/transactions/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "transactions/5.5.0"; + } +}); + +// node_modules/@ethersproject/transactions/lib/index.js +var require_lib15 = __commonJS({ + "node_modules/@ethersproject/transactions/lib/index.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.parse = exports2.serialize = exports2.accessListify = exports2.recoverAddress = exports2.computeAddress = exports2.TransactionTypes = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var RLP = __importStar(require_lib6()); + var signing_key_1 = require_lib14(); + var logger_1 = require_lib(); + var _version_1 = require_version13(); + var logger = new logger_1.Logger(_version_1.version); + var TransactionTypes; + (function(TransactionTypes2) { + TransactionTypes2[TransactionTypes2["legacy"] = 0] = "legacy"; + TransactionTypes2[TransactionTypes2["eip2930"] = 1] = "eip2930"; + TransactionTypes2[TransactionTypes2["eip1559"] = 2] = "eip1559"; + })(TransactionTypes = exports2.TransactionTypes || (exports2.TransactionTypes = {})); + function handleAddress(value) { + if (value === "0x") { + return null; + } + return (0, address_1.getAddress)(value); + } + function handleNumber(value) { + if (value === "0x") { + return constants_1.Zero; + } + return bignumber_1.BigNumber.from(value); + } + 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 = (0, signing_key_1.computePublicKey)(key); + return (0, address_1.getAddress)((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.hexDataSlice)(publicKey, 1)), 12)); + } + exports2.computeAddress = computeAddress; + function recoverAddress(digest, signature) { + return computeAddress((0, signing_key_1.recoverPublicKey)((0, bytes_1.arrayify)(digest), signature)); + } + exports2.recoverAddress = recoverAddress; + function formatNumber(value, name2) { + var result = (0, bytes_1.stripZeros)(bignumber_1.BigNumber.from(value).toHexString()); + if (result.length > 32) { + logger.throwArgumentError("invalid length for " + name2, "transaction:" + name2, value); + } + return result; + } + function accessSetify(addr, storageKeys) { + return { + address: (0, address_1.getAddress)(addr), + storageKeys: (storageKeys || []).map(function(storageKey, index) { + if ((0, bytes_1.hexDataLength)(storageKey) !== 32) { + logger.throwArgumentError("invalid access list storageKey", "accessList[" + addr + ":" + 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[" + 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; + } + exports2.accessListify = accessListify; + function formatAccessList(value) { + return accessListify(value).map(function(set) { + return [set.address, set.storageKeys]; + }); + } + function _serializeEip1559(transaction, signature) { + if (transaction.gasPrice != null) { + var gasPrice = bignumber_1.BigNumber.from(transaction.gasPrice); + var maxFeePerGas = bignumber_1.BigNumber.from(transaction.maxFeePerGas || 0); + if (!gasPrice.eq(maxFeePerGas)) { + logger.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + gasPrice, + 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 ? (0, address_1.getAddress)(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature) { + var sig = (0, bytes_1.splitSignature)(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push((0, bytes_1.stripZeros)(sig.r)); + fields.push((0, bytes_1.stripZeros)(sig.s)); + } + return (0, bytes_1.hexConcat)(["0x02", RLP.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 ? (0, address_1.getAddress)(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature) { + var sig = (0, bytes_1.splitSignature)(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push((0, bytes_1.stripZeros)(sig.r)); + fields.push((0, bytes_1.stripZeros)(sig.s)); + } + return (0, bytes_1.hexConcat)(["0x01", RLP.encode(fields)]); + } + function _serialize(transaction, signature) { + (0, properties_1.checkProperties)(transaction, allowedTransactionKeys); + var raw = []; + transactionFields.forEach(function(fieldInfo) { + var value = transaction[fieldInfo.name] || []; + var options = {}; + if (fieldInfo.numeric) { + options.hexPad = "left"; + } + value = (0, bytes_1.arrayify)((0, bytes_1.hexlify)(value, options)); + if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + if (fieldInfo.maxLength) { + value = (0, bytes_1.stripZeros)(value); + if (value.length > fieldInfo.maxLength) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + } + raw.push((0, bytes_1.hexlify)(value)); + }); + var chainId = 0; + if (transaction.chainId != null) { + chainId = transaction.chainId; + if (typeof chainId !== "number") { + logger.throwArgumentError("invalid transaction.chainId", "transaction", transaction); + } + } else if (signature && !(0, bytes_1.isBytesLike)(signature) && signature.v > 28) { + chainId = Math.floor((signature.v - 35) / 2); + } + if (chainId !== 0) { + raw.push((0, bytes_1.hexlify)(chainId)); + raw.push("0x"); + raw.push("0x"); + } + if (!signature) { + return RLP.encode(raw); + } + var sig = (0, bytes_1.splitSignature)(signature); + var v = 27 + sig.recoveryParam; + if (chainId !== 0) { + raw.pop(); + raw.pop(); + raw.pop(); + v += chainId * 2 + 8; + 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((0, bytes_1.hexlify)(v)); + raw.push((0, bytes_1.stripZeros)((0, bytes_1.arrayify)(sig.r))); + raw.push((0, bytes_1.stripZeros)((0, bytes_1.arrayify)(sig.s))); + return RLP.encode(raw); + } + function serialize(transaction, signature) { + 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); + } + switch (transaction.type) { + case 1: + return _serializeEip2930(transaction, signature); + case 2: + return _serializeEip1559(transaction, signature); + default: + break; + } + return logger.throwError("unsupported transaction type: " + transaction.type, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "serializeTransaction", + transactionType: transaction.type + }); + } + exports2.serialize = serialize; + function _parseEipSignature(tx, fields, serialize2) { + 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 = (0, bytes_1.hexZeroPad)(fields[1], 32); + tx.s = (0, bytes_1.hexZeroPad)(fields[2], 32); + try { + var digest = (0, keccak256_1.keccak256)(serialize2(tx)); + tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v }); + } catch (error) { + console.log(error); + } + } + function _parseEip1559(payload) { + var transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 9 && transaction.length !== 12) { + logger.throwArgumentError("invalid component count for transaction type: 2", "payload", (0, bytes_1.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, + maxFeePerGas, + gasPrice: null, + gasLimit: handleNumber(transaction[4]), + to: handleAddress(transaction[5]), + value: handleNumber(transaction[6]), + data: transaction[7], + accessList: accessListify(transaction[8]) + }; + if (transaction.length === 9) { + return tx; + } + tx.hash = (0, keccak256_1.keccak256)(payload); + _parseEipSignature(tx, transaction.slice(9), _serializeEip1559); + return tx; + } + function _parseEip2930(payload) { + var transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 8 && transaction.length !== 11) { + logger.throwArgumentError("invalid component count for transaction type: 1", "payload", (0, bytes_1.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]) + }; + if (transaction.length === 8) { + return tx; + } + tx.hash = (0, keccak256_1.keccak256)(payload); + _parseEipSignature(tx, transaction.slice(8), _serializeEip2930); + return tx; + } + function _parse(rawTransaction) { + var transaction = RLP.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 + }; + if (transaction.length === 6) { + return tx; + } + try { + tx.v = bignumber_1.BigNumber.from(transaction[6]).toNumber(); + } catch (error) { + console.log(error); + return tx; + } + tx.r = (0, bytes_1.hexZeroPad)(transaction[7], 32); + tx.s = (0, bytes_1.hexZeroPad)(transaction[8], 32); + if (bignumber_1.BigNumber.from(tx.r).isZero() && bignumber_1.BigNumber.from(tx.s).isZero()) { + tx.chainId = tx.v; + tx.v = 0; + } else { + 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((0, bytes_1.hexlify)(tx.chainId)); + raw.push("0x"); + raw.push("0x"); + recoveryParam -= tx.chainId * 2 + 8; + } + var digest = (0, keccak256_1.keccak256)(RLP.encode(raw)); + try { + tx.from = recoverAddress(digest, { r: (0, bytes_1.hexlify)(tx.r), s: (0, bytes_1.hexlify)(tx.s), recoveryParam }); + } catch (error) { + console.log(error); + } + tx.hash = (0, keccak256_1.keccak256)(rawTransaction); + } + tx.type = null; + return tx; + } + function parse(rawTransaction) { + var payload = (0, bytes_1.arrayify)(rawTransaction); + if (payload[0] > 127) { + return _parse(payload); + } + switch (payload[0]) { + case 1: + return _parseEip2930(payload); + case 2: + return _parseEip1559(payload); + default: + break; + } + return logger.throwError("unsupported transaction type: " + payload[0], logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "parseTransaction", + transactionType: payload[0] + }); + } + exports2.parse = parse; + } +}); + +// node_modules/@ethersproject/contracts/lib/_version.js +var require_version14 = __commonJS({ + "node_modules/@ethersproject/contracts/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "contracts/5.5.0"; + } +}); + +// node_modules/@ethersproject/contracts/lib/index.js +var require_lib16 = __commonJS({ + "node_modules/@ethersproject/contracts/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ContractFactory = exports2.Contract = exports2.BaseContract = void 0; + var abi_1 = require_lib11(); + var abstract_provider_1 = require_lib12(); + var abstract_signer_1 = require_lib13(); + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version14(); + var logger = new logger_1.Logger(_version_1.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, function() { + var name2, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, nameOrPromise]; + case 1: + name2 = _a.sent(); + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", name2); + } + try { + return [2, (0, address_1.getAddress)(name2)]; + } catch (error) { + } + if (!resolver) { + logger.throwError("a provider or signer is needed to resolve ENS names", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName" + }); + } + return [4, resolver.resolveName(name2)]; + case 2: + address = _a.sent(); + if (address == null) { + logger.throwArgumentError("resolver or addr is not configured for ENS name", "name", name2); + } + return [2, address]; + } + }); + }); + } + function resolveAddresses(resolver, value, paramType) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!Array.isArray(paramType)) return [3, 2]; + return [4, Promise.all(paramType.map(function(paramType2, index) { + return resolveAddresses(resolver, Array.isArray(value) ? value[index] : value[paramType2.name], paramType2); + }))]; + case 1: + return [2, _a.sent()]; + case 2: + if (!(paramType.type === "address")) return [3, 4]; + return [4, resolveName(resolver, value)]; + case 3: + return [2, _a.sent()]; + case 4: + if (!(paramType.type === "tuple")) return [3, 6]; + return [4, resolveAddresses(resolver, value, paramType.components)]; + case 5: + return [2, _a.sent()]; + case 6: + if (!(paramType.baseType === "array")) return [3, 8]; + if (!Array.isArray(value)) { + return [2, Promise.reject(logger.makeError("invalid value for array", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "value", + value + }))]; + } + return [4, Promise.all(value.map(function(v) { + return resolveAddresses(resolver, v, paramType.arrayChildren); + }))]; + case 7: + return [2, _a.sent()]; + case 8: + return [2, value]; + } + }); + }); + } + function populateTransaction(contract, fragment, args) { + return __awaiter(this, void 0, void 0, function() { + var overrides, resolved, data, tx, ro, intrinsic, bytes, i, roValue, leftovers; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + overrides = {}; + if (args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object") { + overrides = (0, properties_1.shallowCopy)(args.pop()); + } + logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); + if (contract.signer) { + if (overrides.from) { + overrides.from = (0, properties_1.resolveProperties)({ + override: resolveName(contract.signer, overrides.from), + signer: contract.signer.getAddress() + }).then(function(check) { + return __awaiter(_this, void 0, void 0, function() { + return __generator(this, function(_a2) { + if ((0, address_1.getAddress)(check.signer) !== check.override) { + logger.throwError("Contract with a Signer cannot override from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.from" + }); + } + return [2, check.override]; + }); + }); + }); + } else { + overrides.from = contract.signer.getAddress(); + } + } else if (overrides.from) { + overrides.from = resolveName(contract.provider, overrides.from); + } + return [4, (0, properties_1.resolveProperties)({ + args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), + address: contract.resolvedAddress, + overrides: (0, properties_1.resolveProperties)(overrides) || {} + })]; + case 1: + resolved = _a.sent(); + data = contract.interface.encodeFunctionData(fragment, resolved.args); + tx = { + data, + to: resolved.address + }; + ro = resolved.overrides; + if (ro.nonce != null) { + tx.nonce = bignumber_1.BigNumber.from(ro.nonce).toNumber(); + } + if (ro.gasLimit != null) { + tx.gasLimit = bignumber_1.BigNumber.from(ro.gasLimit); + } + if (ro.gasPrice != null) { + tx.gasPrice = bignumber_1.BigNumber.from(ro.gasPrice); + } + if (ro.maxFeePerGas != null) { + tx.maxFeePerGas = bignumber_1.BigNumber.from(ro.maxFeePerGas); + } + if (ro.maxPriorityFeePerGas != null) { + tx.maxPriorityFeePerGas = bignumber_1.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 = (0, transactions_1.accessListify)(ro.accessList); + } + if (tx.gasLimit == null && fragment.gas != null) { + intrinsic = 21e3; + bytes = (0, bytes_1.arrayify)(data); + for (i = 0; i < bytes.length; i++) { + intrinsic += 4; + if (bytes[i]) { + intrinsic += 64; + } + } + tx.gasLimit = bignumber_1.BigNumber.from(fragment.gas).add(intrinsic); + } + if (ro.value) { + roValue = bignumber_1.BigNumber.from(ro.value); + if (!roValue.isZero() && !fragment.payable) { + logger.throwError("non-payable method cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: overrides.value + }); + } + tx.value = roValue; + } + if (ro.customData) { + tx.customData = (0, properties_1.shallowCopy)(ro.customData); + } + 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; + leftovers = Object.keys(overrides).filter(function(key) { + return overrides[key] != null; + }); + if (leftovers.length) { + logger.throwError("cannot override " + leftovers.map(function(l) { + return JSON.stringify(l); + }).join(","), logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides", + overrides: leftovers + }); + } + return [2, tx]; + } + }); + }); + } + function buildPopulate(contract, fragment) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return populateTransaction(contract, fragment, args); + }; + } + function buildEstimate(contract, fragment) { + var signerOrProvider = contract.signer || contract.provider; + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!signerOrProvider) { + logger.throwError("estimate require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "estimateGas" + }); + } + return [4, populateTransaction(contract, fragment, args)]; + case 1: + tx = _a.sent(); + return [4, signerOrProvider.estimateGas(tx)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + } + 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 = (0, properties_1.deepCopy)(log); + var parsed = null; + try { + parsed = contract.interface.parseLog(log); + } catch (e) { + } + 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; + } + 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() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var blockTag, overrides, tx, result, value; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + blockTag = void 0; + if (!(args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object")) return [3, 3]; + overrides = (0, properties_1.shallowCopy)(args.pop()); + if (!(overrides.blockTag != null)) return [3, 2]; + return [4, overrides.blockTag]; + case 1: + blockTag = _a.sent(); + _a.label = 2; + case 2: + delete overrides.blockTag; + args.push(overrides); + _a.label = 3; + case 3: + if (!(contract.deployTransaction != null)) return [3, 5]; + return [4, contract._deployed(blockTag)]; + case 4: + _a.sent(); + _a.label = 5; + case 5: + return [4, populateTransaction(contract, fragment, args)]; + case 6: + tx = _a.sent(); + return [4, signerOrProvider.call(tx, blockTag)]; + case 7: + result = _a.sent(); + try { + value = contract.interface.decodeFunctionResult(fragment, result); + if (collapseSimple && fragment.outputs.length === 1) { + value = value[0]; + } + return [2, value]; + } catch (error) { + if (error.code === logger_1.Logger.errors.CALL_EXCEPTION) { + error.address = contract.address; + error.args = args; + error.transaction = tx; + } + throw error; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + } + function buildSend(contract, fragment) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var txRequest, tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!contract.signer) { + logger.throwError("sending a transaction requires a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "sendTransaction" + }); + } + if (!(contract.deployTransaction != null)) return [3, 2]; + return [4, contract._deployed()]; + case 1: + _a.sent(); + _a.label = 2; + case 2: + return [4, populateTransaction(contract, fragment, args)]; + case 3: + txRequest = _a.sent(); + return [4, contract.signer.sendTransaction(txRequest)]; + case 4: + tx = _a.sent(); + addContractWait(contract, tx); + return [2, tx]; + } + }); + }); + }; + } + 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 = ( + /** @class */ + function() { + function RunningEvent2(tag, filter) { + (0, properties_1.defineReadOnly)(this, "tag", tag); + (0, properties_1.defineReadOnly)(this, "filter", filter); + this._listeners = []; + } + RunningEvent2.prototype.addListener = function(listener, once) { + this._listeners.push({ listener, once }); + }; + RunningEvent2.prototype.removeListener = function(listener) { + var done = false; + this._listeners = this._listeners.filter(function(item) { + if (done || item.listener !== listener) { + return true; + } + done = true; + return false; + }); + }; + RunningEvent2.prototype.removeAllListeners = function() { + this._listeners = []; + }; + RunningEvent2.prototype.listeners = function() { + return this._listeners.map(function(i) { + return i.listener; + }); + }; + RunningEvent2.prototype.listenerCount = function() { + return this._listeners.length; + }; + RunningEvent2.prototype.run = function(args) { + var _this = this; + var listenerCount = this.listenerCount(); + this._listeners = this._listeners.filter(function(item) { + var argsCopy = args.slice(); + setTimeout(function() { + item.listener.apply(_this, argsCopy); + }, 0); + return !item.once; + }); + return listenerCount; + }; + RunningEvent2.prototype.prepareEvent = function(event) { + }; + RunningEvent2.prototype.getEmit = function(event) { + return [event]; + }; + return RunningEvent2; + }() + ); + var ErrorRunningEvent = ( + /** @class */ + function(_super) { + __extends(ErrorRunningEvent2, _super); + function ErrorRunningEvent2() { + return _super.call(this, "error", null) || this; + } + return ErrorRunningEvent2; + }(RunningEvent) + ); + var FragmentRunningEvent = ( + /** @class */ + function(_super) { + __extends(FragmentRunningEvent2, _super); + function FragmentRunningEvent2(address, contractInterface, fragment, topics) { + var _this = this; + var filter = { + 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]; + } + _this = _super.call(this, getEventTag(filter), filter) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "interface", contractInterface); + (0, properties_1.defineReadOnly)(_this, "fragment", fragment); + return _this; + } + FragmentRunningEvent2.prototype.prepareEvent = function(event) { + var _this = this; + _super.prototype.prepareEvent.call(this, event); + event.event = this.fragment.name; + event.eventSignature = this.fragment.format(); + event.decode = function(data, topics) { + return _this.interface.decodeEventLog(_this.fragment, data, topics); + }; + try { + event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics); + } catch (error) { + event.args = null; + event.decodeError = error; + } + }; + FragmentRunningEvent2.prototype.getEmit = function(event) { + var errors = (0, abi_1.checkResultErrors)(event.args); + if (errors.length) { + throw errors[0].error; + } + var args = (event.args || []).slice(); + args.push(event); + return args; + }; + return FragmentRunningEvent2; + }(RunningEvent) + ); + var WildcardRunningEvent = ( + /** @class */ + function(_super) { + __extends(WildcardRunningEvent2, _super); + function WildcardRunningEvent2(address, contractInterface) { + var _this = _super.call(this, "*", { address }) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "interface", contractInterface); + return _this; + } + WildcardRunningEvent2.prototype.prepareEvent = function(event) { + var _this = this; + _super.prototype.prepareEvent.call(this, event); + try { + var parsed_1 = this.interface.parseLog(event); + event.event = parsed_1.name; + event.eventSignature = parsed_1.signature; + event.decode = function(data, topics) { + return _this.interface.decodeEventLog(parsed_1.eventFragment, data, topics); + }; + event.args = parsed_1.args; + } catch (error) { + } + }; + return WildcardRunningEvent2; + }(RunningEvent) + ); + var BaseContract = ( + /** @class */ + function() { + function BaseContract2(addressOrName, contractInterface, signerOrProvider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Contract); + (0, properties_1.defineReadOnly)(this, "interface", (0, properties_1.getStatic)(_newTarget, "getInterface")(contractInterface)); + if (signerOrProvider == null) { + (0, properties_1.defineReadOnly)(this, "provider", null); + (0, properties_1.defineReadOnly)(this, "signer", null); + } else if (abstract_signer_1.Signer.isSigner(signerOrProvider)) { + (0, properties_1.defineReadOnly)(this, "provider", signerOrProvider.provider || null); + (0, properties_1.defineReadOnly)(this, "signer", signerOrProvider); + } else if (abstract_provider_1.Provider.isProvider(signerOrProvider)) { + (0, properties_1.defineReadOnly)(this, "provider", signerOrProvider); + (0, properties_1.defineReadOnly)(this, "signer", null); + } else { + logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); + } + (0, properties_1.defineReadOnly)(this, "callStatic", {}); + (0, properties_1.defineReadOnly)(this, "estimateGas", {}); + (0, properties_1.defineReadOnly)(this, "functions", {}); + (0, properties_1.defineReadOnly)(this, "populateTransaction", {}); + (0, properties_1.defineReadOnly)(this, "filters", {}); + { + var uniqueFilters_1 = {}; + Object.keys(this.interface.events).forEach(function(eventSignature) { + var event = _this.interface.events[eventSignature]; + (0, properties_1.defineReadOnly)(_this.filters, eventSignature, function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return { + address: _this.address, + topics: _this.interface.encodeFilterTopics(event, args) + }; + }); + if (!uniqueFilters_1[event.name]) { + uniqueFilters_1[event.name] = []; + } + uniqueFilters_1[event.name].push(eventSignature); + }); + Object.keys(uniqueFilters_1).forEach(function(name2) { + var filters = uniqueFilters_1[name2]; + if (filters.length === 1) { + (0, properties_1.defineReadOnly)(_this.filters, name2, _this.filters[filters[0]]); + } else { + logger.warn("Duplicate definition of " + name2 + " (" + filters.join(", ") + ")"); + } + }); + } + (0, properties_1.defineReadOnly)(this, "_runningEvents", {}); + (0, properties_1.defineReadOnly)(this, "_wrappedEmits", {}); + if (addressOrName == null) { + logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); + } + (0, properties_1.defineReadOnly)(this, "address", addressOrName); + if (this.provider) { + (0, properties_1.defineReadOnly)(this, "resolvedAddress", resolveName(this.provider, addressOrName)); + } else { + try { + (0, properties_1.defineReadOnly)(this, "resolvedAddress", Promise.resolve((0, address_1.getAddress)(addressOrName))); + } catch (error) { + logger.throwError("provider is required to use ENS name as contract address", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Contract" + }); + } + } + var uniqueNames = {}; + var uniqueSignatures = {}; + Object.keys(this.interface.functions).forEach(function(signature) { + var fragment = _this.interface.functions[signature]; + if (uniqueSignatures[signature]) { + logger.warn("Duplicate ABI entry for " + JSON.stringify(signature)); + return; + } + uniqueSignatures[signature] = true; + { + var name_1 = fragment.name; + if (!uniqueNames["%" + name_1]) { + uniqueNames["%" + name_1] = []; + } + uniqueNames["%" + name_1].push(signature); + } + if (_this[signature] == null) { + (0, properties_1.defineReadOnly)(_this, signature, buildDefault(_this, fragment, true)); + } + if (_this.functions[signature] == null) { + (0, properties_1.defineReadOnly)(_this.functions, signature, buildDefault(_this, fragment, false)); + } + if (_this.callStatic[signature] == null) { + (0, properties_1.defineReadOnly)(_this.callStatic, signature, buildCall(_this, fragment, true)); + } + if (_this.populateTransaction[signature] == null) { + (0, properties_1.defineReadOnly)(_this.populateTransaction, signature, buildPopulate(_this, fragment)); + } + if (_this.estimateGas[signature] == null) { + (0, properties_1.defineReadOnly)(_this.estimateGas, signature, buildEstimate(_this, fragment)); + } + }); + Object.keys(uniqueNames).forEach(function(name2) { + var signatures = uniqueNames[name2]; + if (signatures.length > 1) { + return; + } + name2 = name2.substring(1); + var signature = signatures[0]; + try { + if (_this[name2] == null) { + (0, properties_1.defineReadOnly)(_this, name2, _this[signature]); + } + } catch (e) { + } + if (_this.functions[name2] == null) { + (0, properties_1.defineReadOnly)(_this.functions, name2, _this.functions[signature]); + } + if (_this.callStatic[name2] == null) { + (0, properties_1.defineReadOnly)(_this.callStatic, name2, _this.callStatic[signature]); + } + if (_this.populateTransaction[name2] == null) { + (0, properties_1.defineReadOnly)(_this.populateTransaction, name2, _this.populateTransaction[signature]); + } + if (_this.estimateGas[name2] == null) { + (0, properties_1.defineReadOnly)(_this.estimateGas, name2, _this.estimateGas[signature]); + } + }); + } + BaseContract2.getContractAddress = function(transaction) { + return (0, address_1.getContractAddress)(transaction); + }; + BaseContract2.getInterface = function(contractInterface) { + if (abi_1.Interface.isInterface(contractInterface)) { + return contractInterface; + } + return new abi_1.Interface(contractInterface); + }; + BaseContract2.prototype.deployed = function() { + return this._deployed(); + }; + BaseContract2.prototype._deployed = function(blockTag) { + var _this = this; + if (!this._deployedPromise) { + if (this.deployTransaction) { + this._deployedPromise = this.deployTransaction.wait().then(function() { + return _this; + }); + } else { + this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function(code) { + if (code === "0x") { + logger.throwError("contract not deployed", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + contractAddress: _this.address, + operation: "getDeployed" + }); + } + return _this; + }); + } + } + return this._deployedPromise; + }; + BaseContract2.prototype.fallback = function(overrides) { + var _this = this; + if (!this.signer) { + logger.throwError("sending a transactions require a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); + } + var tx = (0, properties_1.shallowCopy)(overrides || {}); + ["from", "to"].forEach(function(key) { + if (tx[key] == null) { + return; + } + logger.throwError("cannot override " + key, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key }); + }); + tx.to = this.resolvedAddress; + return this.deployed().then(function() { + return _this.signer.sendTransaction(tx); + }); + }; + BaseContract2.prototype.connect = function(signerOrProvider) { + if (typeof signerOrProvider === "string") { + signerOrProvider = new abstract_signer_1.VoidSigner(signerOrProvider, this.provider); + } + var contract = new this.constructor(this.address, this.interface, signerOrProvider); + if (this.deployTransaction) { + (0, properties_1.defineReadOnly)(contract, "deployTransaction", this.deployTransaction); + } + return contract; + }; + BaseContract2.prototype.attach = function(addressOrName) { + return new this.constructor(addressOrName, this.interface, this.signer || this.provider); + }; + BaseContract2.isIndexed = function(value) { + return abi_1.Indexed.isIndexed(value); + }; + BaseContract2.prototype._normalizeRunningEvent = function(runningEvent) { + if (this._runningEvents[runningEvent.tag]) { + return this._runningEvents[runningEvent.tag]; + } + return runningEvent; + }; + BaseContract2.prototype._getRunningEvent = function(eventName) { + if (typeof eventName === "string") { + if (eventName === "error") { + return this._normalizeRunningEvent(new ErrorRunningEvent()); + } + if (eventName === "event") { + return this._normalizeRunningEvent(new RunningEvent("event", null)); + } + if (eventName === "*") { + return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface)); + } + var fragment = this.interface.getEvent(eventName); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment)); + } + if (eventName.topics && eventName.topics.length > 0) { + try { + var topic = eventName.topics[0]; + if (typeof topic !== "string") { + throw new Error("invalid topic"); + } + var fragment = this.interface.getEvent(topic); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics)); + } catch (error) { + } + 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)); + }; + BaseContract2.prototype._checkRunningEvents = function(runningEvent) { + if (runningEvent.listenerCount() === 0) { + delete this._runningEvents[runningEvent.tag]; + var emit = this._wrappedEmits[runningEvent.tag]; + if (emit && runningEvent.filter) { + this.provider.off(runningEvent.filter, emit); + delete this._wrappedEmits[runningEvent.tag]; + } + } + }; + BaseContract2.prototype._wrapEvent = function(runningEvent, log, listener) { + var _this = this; + var event = (0, properties_1.deepCopy)(log); + event.removeListener = function() { + if (!listener) { + return; + } + runningEvent.removeListener(listener); + _this._checkRunningEvents(runningEvent); + }; + event.getBlock = function() { + return _this.provider.getBlock(log.blockHash); + }; + event.getTransaction = function() { + return _this.provider.getTransaction(log.transactionHash); + }; + event.getTransactionReceipt = function() { + return _this.provider.getTransactionReceipt(log.transactionHash); + }; + runningEvent.prepareEvent(event); + return event; + }; + BaseContract2.prototype._addEventListener = function(runningEvent, listener, once) { + var _this = this; + if (!this.provider) { + logger.throwError("events require a provider or a signer with a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" }); + } + runningEvent.addListener(listener, once); + this._runningEvents[runningEvent.tag] = runningEvent; + if (!this._wrappedEmits[runningEvent.tag]) { + var wrappedEmit = function(log) { + var event = _this._wrapEvent(runningEvent, log, listener); + if (event.decodeError == null) { + try { + var args = runningEvent.getEmit(event); + _this.emit.apply(_this, __spreadArray([runningEvent.filter], args, false)); + } catch (error) { + event.decodeError = error.error; + } + } + if (runningEvent.filter != null) { + _this.emit("event", event); + } + if (event.decodeError != null) { + _this.emit("error", event.decodeError, event); + } + }; + this._wrappedEmits[runningEvent.tag] = wrappedEmit; + if (runningEvent.filter != null) { + this.provider.on(runningEvent.filter, wrappedEmit); + } + } + }; + BaseContract2.prototype.queryFilter = function(event, fromBlockOrBlockhash, toBlock) { + var _this = this; + var runningEvent = this._getRunningEvent(event); + var filter = (0, properties_1.shallowCopy)(runningEvent.filter); + if (typeof fromBlockOrBlockhash === "string" && (0, bytes_1.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 _this._wrapEvent(runningEvent, log, null); + }); + }); + }; + BaseContract2.prototype.on = function(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, false); + return this; + }; + BaseContract2.prototype.once = function(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, true); + return this; + }; + BaseContract2.prototype.emit = function(eventName) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!this.provider) { + return false; + } + var runningEvent = this._getRunningEvent(eventName); + var result = runningEvent.run(args) > 0; + this._checkRunningEvents(runningEvent); + return result; + }; + BaseContract2.prototype.listenerCount = function(eventName) { + var _this = this; + if (!this.provider) { + return 0; + } + if (eventName == null) { + return Object.keys(this._runningEvents).reduce(function(accum, key) { + return accum + _this._runningEvents[key].listenerCount(); + }, 0); + } + return this._getRunningEvent(eventName).listenerCount(); + }; + BaseContract2.prototype.listeners = function(eventName) { + if (!this.provider) { + return []; + } + if (eventName == null) { + var result_1 = []; + for (var tag in this._runningEvents) { + this._runningEvents[tag].listeners().forEach(function(listener) { + result_1.push(listener); + }); + } + return result_1; + } + return this._getRunningEvent(eventName).listeners(); + }; + BaseContract2.prototype.removeAllListeners = function(eventName) { + if (!this.provider) { + return this; + } + if (eventName == null) { + for (var tag in this._runningEvents) { + var runningEvent_1 = this._runningEvents[tag]; + runningEvent_1.removeAllListeners(); + this._checkRunningEvents(runningEvent_1); + } + return this; + } + var runningEvent = this._getRunningEvent(eventName); + runningEvent.removeAllListeners(); + this._checkRunningEvents(runningEvent); + return this; + }; + BaseContract2.prototype.off = function(eventName, listener) { + if (!this.provider) { + return this; + } + var runningEvent = this._getRunningEvent(eventName); + runningEvent.removeListener(listener); + this._checkRunningEvents(runningEvent); + return this; + }; + BaseContract2.prototype.removeListener = function(eventName, listener) { + return this.off(eventName, listener); + }; + return BaseContract2; + }() + ); + exports2.BaseContract = BaseContract; + var Contract = ( + /** @class */ + function(_super) { + __extends(Contract2, _super); + function Contract2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Contract2; + }(BaseContract) + ); + exports2.Contract = Contract; + var ContractFactory = ( + /** @class */ + function() { + function ContractFactory2(contractInterface, bytecode, signer) { + var _newTarget = this.constructor; + var bytecodeHex = null; + if (typeof bytecode === "string") { + bytecodeHex = bytecode; + } else if ((0, bytes_1.isBytes)(bytecode)) { + bytecodeHex = (0, bytes_1.hexlify)(bytecode); + } else if (bytecode && typeof bytecode.object === "string") { + bytecodeHex = bytecode.object; + } else { + bytecodeHex = "!"; + } + if (bytecodeHex.substring(0, 2) !== "0x") { + bytecodeHex = "0x" + bytecodeHex; + } + if (!(0, bytes_1.isHexString)(bytecodeHex) || bytecodeHex.length % 2) { + logger.throwArgumentError("invalid bytecode", "bytecode", bytecode); + } + if (signer && !abstract_signer_1.Signer.isSigner(signer)) { + logger.throwArgumentError("invalid signer", "signer", signer); + } + (0, properties_1.defineReadOnly)(this, "bytecode", bytecodeHex); + (0, properties_1.defineReadOnly)(this, "interface", (0, properties_1.getStatic)(_newTarget, "getInterface")(contractInterface)); + (0, properties_1.defineReadOnly)(this, "signer", signer || null); + } + ContractFactory2.prototype.getDeployTransaction = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var tx = {}; + if (args.length === this.interface.deploy.inputs.length + 1 && typeof args[args.length - 1] === "object") { + tx = (0, properties_1.shallowCopy)(args.pop()); + for (var key in tx) { + if (!allowedTransactionKeys[key]) { + throw new Error("unknown transaction override " + key); + } + } + } + ["data", "from", "to"].forEach(function(key2) { + if (tx[key2] == null) { + return; + } + logger.throwError("cannot override " + key2, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key2 }); + }); + if (tx.value) { + var value = bignumber_1.BigNumber.from(tx.value); + if (!value.isZero() && !this.interface.deploy.payable) { + logger.throwError("non-payable constructor cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: tx.value + }); + } + } + logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + tx.data = (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.bytecode, + this.interface.encodeDeploy(args) + ])); + return tx; + }; + ContractFactory2.prototype.deploy = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var overrides, params, unsignedTx, tx, address, contract; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + overrides = {}; + if (args.length === this.interface.deploy.inputs.length + 1) { + overrides = args.pop(); + } + logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + return [4, resolveAddresses(this.signer, args, this.interface.deploy.inputs)]; + case 1: + params = _a.sent(); + params.push(overrides); + unsignedTx = this.getDeployTransaction.apply(this, params); + return [4, this.signer.sendTransaction(unsignedTx)]; + case 2: + tx = _a.sent(); + address = (0, properties_1.getStatic)(this.constructor, "getContractAddress")(tx); + contract = (0, properties_1.getStatic)(this.constructor, "getContract")(address, this.interface, this.signer); + addContractWait(contract, tx); + (0, properties_1.defineReadOnly)(contract, "deployTransaction", tx); + return [2, contract]; + } + }); + }); + }; + ContractFactory2.prototype.attach = function(address) { + return this.constructor.getContract(address, this.interface, this.signer); + }; + ContractFactory2.prototype.connect = function(signer) { + return new this.constructor(this.interface, this.bytecode, signer); + }; + ContractFactory2.fromSolidity = function(compilerOutput, signer) { + if (compilerOutput == null) { + logger.throwError("missing compiler output", logger_1.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); + }; + ContractFactory2.getInterface = function(contractInterface) { + return Contract.getInterface(contractInterface); + }; + ContractFactory2.getContractAddress = function(tx) { + return (0, address_1.getContractAddress)(tx); + }; + ContractFactory2.getContract = function(address, contractInterface, signer) { + return new Contract(address, contractInterface, signer); + }; + return ContractFactory2; + }() + ); + exports2.ContractFactory = ContractFactory; + } +}); + +// node_modules/@ethersproject/basex/lib/index.js +var require_lib17 = __commonJS({ + "node_modules/@ethersproject/basex/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Base58 = exports2.Base32 = exports2.BaseX = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var BaseX = ( + /** @class */ + function() { + function BaseX2(alphabet) { + (0, properties_1.defineReadOnly)(this, "alphabet", alphabet); + (0, properties_1.defineReadOnly)(this, "base", alphabet.length); + (0, properties_1.defineReadOnly)(this, "_alphabetMap", {}); + (0, properties_1.defineReadOnly)(this, "_leader", alphabet.charAt(0)); + for (var i = 0; i < alphabet.length; i++) { + this._alphabetMap[alphabet.charAt(i)] = i; + } + } + BaseX2.prototype.encode = function(value) { + var source = (0, bytes_1.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 = ""; + for (var k = 0; source[k] === 0 && k < source.length - 1; ++k) { + string += this._leader; + } + for (var q = digits.length - 1; q >= 0; --q) { + string += this.alphabet[digits[q]]; + } + return string; + }; + BaseX2.prototype.decode = function(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 === void 0) { + 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 & 255; + carry >>= 8; + } + while (carry > 0) { + bytes.push(carry & 255); + carry >>= 8; + } + } + for (var k = 0; value[k] === this._leader && k < value.length - 1; ++k) { + bytes.push(0); + } + return (0, bytes_1.arrayify)(new Uint8Array(bytes.reverse())); + }; + return BaseX2; + }() + ); + exports2.BaseX = BaseX; + var Base32 = new BaseX("abcdefghijklmnopqrstuvwxyz234567"); + exports2.Base32 = Base32; + var Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); + exports2.Base58 = Base58; + } +}); + +// node_modules/@ethersproject/pbkdf2/lib/pbkdf2.js +var require_pbkdf2 = __commonJS({ + "node_modules/@ethersproject/pbkdf2/lib/pbkdf2.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.pbkdf2 = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + function bufferify(value) { + return Buffer.from((0, bytes_1.arrayify)(value)); + } + function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { + return (0, bytes_1.hexlify)((0, crypto_1.pbkdf2Sync)(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm)); + } + exports2.pbkdf2 = pbkdf2; + } +}); + +// node_modules/@ethersproject/pbkdf2/lib/index.js +var require_lib18 = __commonJS({ + "node_modules/@ethersproject/pbkdf2/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.pbkdf2 = void 0; + var pbkdf2_1 = require_pbkdf2(); + Object.defineProperty(exports2, "pbkdf2", { enumerable: true, get: function() { + return pbkdf2_1.pbkdf2; + } }); + } +}); + +// node_modules/@ethersproject/sha2/lib/types.js +var require_types = __commonJS({ + "node_modules/@ethersproject/sha2/lib/types.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SupportedAlgorithm = void 0; + var SupportedAlgorithm; + (function(SupportedAlgorithm2) { + SupportedAlgorithm2["sha256"] = "sha256"; + SupportedAlgorithm2["sha512"] = "sha512"; + })(SupportedAlgorithm = exports2.SupportedAlgorithm || (exports2.SupportedAlgorithm = {})); + } +}); + +// node_modules/@ethersproject/sha2/lib/_version.js +var require_version15 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "sha2/5.5.0"; + } +}); + +// node_modules/@ethersproject/sha2/lib/sha2.js +var require_sha2 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/sha2.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.computeHmac = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + var types_1 = require_types(); + var logger_1 = require_lib(); + var _version_1 = require_version15(); + var logger = new logger_1.Logger(_version_1.version); + function ripemd160(data) { + return "0x" + (0, crypto_1.createHash)("ripemd160").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.ripemd160 = ripemd160; + function sha256(data) { + return "0x" + (0, crypto_1.createHash)("sha256").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.sha256 = sha256; + function sha512(data) { + return "0x" + (0, crypto_1.createHash)("sha512").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.sha512 = sha512; + function computeHmac(algorithm, key, data) { + if (!types_1.SupportedAlgorithm[algorithm]) { + logger.throwError("unsupported algorithm - " + algorithm, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "computeHmac", + algorithm + }); + } + return "0x" + (0, crypto_1.createHmac)(algorithm, Buffer.from((0, bytes_1.arrayify)(key))).update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.computeHmac = computeHmac; + } +}); + +// node_modules/@ethersproject/sha2/lib/index.js +var require_lib19 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SupportedAlgorithm = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = exports2.computeHmac = void 0; + var sha2_1 = require_sha2(); + Object.defineProperty(exports2, "computeHmac", { enumerable: true, get: function() { + return sha2_1.computeHmac; + } }); + Object.defineProperty(exports2, "ripemd160", { enumerable: true, get: function() { + return sha2_1.ripemd160; + } }); + Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() { + return sha2_1.sha256; + } }); + Object.defineProperty(exports2, "sha512", { enumerable: true, get: function() { + return sha2_1.sha512; + } }); + var types_1 = require_types(); + Object.defineProperty(exports2, "SupportedAlgorithm", { enumerable: true, get: function() { + return types_1.SupportedAlgorithm; + } }); + } +}); + +// node_modules/@ethersproject/wordlists/lib/_version.js +var require_version16 = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "wordlists/5.5.0"; + } +}); + +// node_modules/@ethersproject/wordlists/lib/wordlist.js +var require_wordlist = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/wordlist.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.logger = void 0; + var exportWordlist = false; + var hash_1 = require_lib10(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version16(); + exports2.logger = new logger_1.Logger(_version_1.version); + var Wordlist = ( + /** @class */ + function() { + function Wordlist2(locale) { + var _newTarget = this.constructor; + exports2.logger.checkAbstract(_newTarget, Wordlist2); + (0, properties_1.defineReadOnly)(this, "locale", locale); + } + Wordlist2.prototype.split = function(mnemonic) { + return mnemonic.toLowerCase().split(/ +/g); + }; + Wordlist2.prototype.join = function(words) { + return words.join(" "); + }; + Wordlist2.check = function(wordlist) { + var words = []; + for (var i = 0; i < 2048; i++) { + var word = wordlist.getWord(i); + if (i !== wordlist.getWordIndex(word)) { + return "0x"; + } + words.push(word); + } + return (0, hash_1.id)(words.join("\n") + "\n"); + }; + Wordlist2.register = function(lang, name2) { + if (!name2) { + name2 = lang.locale; + } + if (exportWordlist) { + try { + var anyGlobal = window; + if (anyGlobal._ethers && anyGlobal._ethers.wordlists) { + if (!anyGlobal._ethers.wordlists[name2]) { + (0, properties_1.defineReadOnly)(anyGlobal._ethers.wordlists, name2, lang); + } + } + } catch (error) { + } + } + }; + return Wordlist2; + }() + ); + exports2.Wordlist = Wordlist; + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-cz.js +var require_lang_cz = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-cz.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langCz = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbdikaceAbecedaAdresaAgreseAkceAktovkaAlejAlkoholAmputaceAnanasAndulkaAnekdotaAnketaAntikaAnulovatArchaAroganceAsfaltAsistentAspiraceAstmaAstronomAtlasAtletikaAtolAutobusAzylBabkaBachorBacilBaculkaBadatelBagetaBagrBahnoBakterieBaladaBaletkaBalkonBalonekBalvanBalzaBambusBankomatBarbarBaretBarmanBarokoBarvaBaterkaBatohBavlnaBazalkaBazilikaBazukaBednaBeranBesedaBestieBetonBezinkaBezmocBeztakBicyklBidloBiftekBikinyBilanceBiografBiologBitvaBizonBlahobytBlatouchBlechaBleduleBleskBlikatBliznaBlokovatBlouditBludBobekBobrBodlinaBodnoutBohatostBojkotBojovatBokorysBolestBorecBoroviceBotaBoubelBouchatBoudaBouleBouratBoxerBradavkaBramboraBrankaBratrBreptaBriketaBrkoBrlohBronzBroskevBrunetkaBrusinkaBrzdaBrzyBublinaBubnovatBuchtaBuditelBudkaBudovaBufetBujarostBukviceBuldokBulvaBundaBunkrBurzaButikBuvolBuzolaBydletBylinaBytovkaBzukotCapartCarevnaCedrCeduleCejchCejnCelaCelerCelkemCelniceCeninaCennostCenovkaCentrumCenzorCestopisCetkaChalupaChapadloCharitaChataChechtatChemieChichotChirurgChladChlebaChlubitChmelChmuraChobotChocholChodbaCholeraChomoutChopitChorobaChovChrapotChrlitChrtChrupChtivostChudinaChutnatChvatChvilkaChvostChybaChystatChytitCibuleCigaretaCihelnaCihlaCinkotCirkusCisternaCitaceCitrusCizinecCizostClonaCokolivCouvatCtitelCtnostCudnostCuketaCukrCupotCvaknoutCvalCvikCvrkotCyklistaDalekoDarebaDatelDatumDceraDebataDechovkaDecibelDeficitDeflaceDeklDekretDemokratDepreseDerbyDeskaDetektivDikobrazDiktovatDiodaDiplomDiskDisplejDivadloDivochDlahaDlouhoDluhopisDnesDobroDobytekDocentDochutitDodnesDohledDohodaDohraDojemDojniceDokladDokolaDoktorDokumentDolarDolevaDolinaDomaDominantDomluvitDomovDonutitDopadDopisDoplnitDoposudDoprovodDopustitDorazitDorostDortDosahDoslovDostatekDosudDosytaDotazDotekDotknoutDoufatDoutnatDovozceDozaduDoznatDozorceDrahotaDrakDramatikDravecDrazeDrdolDrobnostDrogerieDrozdDrsnostDrtitDrzostDubenDuchovnoDudekDuhaDuhovkaDusitDusnoDutostDvojiceDvorecDynamitEkologEkonomieElektronElipsaEmailEmiseEmoceEmpatieEpizodaEpochaEpopejEposEsejEsenceEskortaEskymoEtiketaEuforieEvoluceExekuceExkurzeExpediceExplozeExportExtraktFackaFajfkaFakultaFanatikFantazieFarmacieFavoritFazoleFederaceFejetonFenkaFialkaFigurantFilozofFiltrFinanceFintaFixaceFjordFlanelFlirtFlotilaFondFosforFotbalFotkaFotonFrakceFreskaFrontaFukarFunkceFyzikaGalejeGarantGenetikaGeologGilotinaGlazuraGlejtGolemGolfistaGotikaGrafGramofonGranuleGrepGrilGrogGroteskaGumaHadiceHadrHalaHalenkaHanbaHanopisHarfaHarpunaHavranHebkostHejkalHejnoHejtmanHektarHelmaHematomHerecHernaHesloHezkyHistorikHladovkaHlasivkyHlavaHledatHlenHlodavecHlohHloupostHltatHlubinaHluchotaHmatHmotaHmyzHnisHnojivoHnoutHoblinaHobojHochHodinyHodlatHodnotaHodovatHojnostHokejHolinkaHolkaHolubHomoleHonitbaHonoraceHoralHordaHorizontHorkoHorlivecHormonHorninaHoroskopHorstvoHospodaHostinaHotovostHoubaHoufHoupatHouskaHovorHradbaHraniceHravostHrazdaHrbolekHrdinaHrdloHrdostHrnekHrobkaHromadaHrotHroudaHrozenHrstkaHrubostHryzatHubenostHubnoutHudbaHukotHumrHusitaHustotaHvozdHybnostHydrantHygienaHymnaHysterikIdylkaIhnedIkonaIluzeImunitaInfekceInflaceInkasoInovaceInspekceInternetInvalidaInvestorInzerceIronieJablkoJachtaJahodaJakmileJakostJalovecJantarJarmarkJaroJasanJasnoJatkaJavorJazykJedinecJedleJednatelJehlanJekotJelenJelitoJemnostJenomJepiceJeseterJevitJezdecJezeroJinakJindyJinochJiskraJistotaJitrniceJizvaJmenovatJogurtJurtaKabaretKabelKabinetKachnaKadetKadidloKahanKajakKajutaKakaoKaktusKalamitaKalhotyKalibrKalnostKameraKamkolivKamnaKanibalKanoeKantorKapalinaKapelaKapitolaKapkaKapleKapotaKaprKapustaKapybaraKaramelKarotkaKartonKasaKatalogKatedraKauceKauzaKavalecKazajkaKazetaKazivostKdekolivKdesiKedlubenKempKeramikaKinoKlacekKladivoKlamKlapotKlasikaKlaunKlecKlenbaKlepatKlesnoutKlidKlimaKlisnaKloboukKlokanKlopaKloubKlubovnaKlusatKluzkostKmenKmitatKmotrKnihaKnotKoaliceKoberecKobkaKoblihaKobylaKocourKohoutKojenecKokosKoktejlKolapsKoledaKolizeKoloKomandoKometaKomikKomnataKomoraKompasKomunitaKonatKonceptKondiceKonecKonfeseKongresKoninaKonkursKontaktKonzervaKopanecKopieKopnoutKoprovkaKorbelKorektorKormidloKoroptevKorpusKorunaKorytoKorzetKosatecKostkaKotelKotletaKotoulKoukatKoupelnaKousekKouzloKovbojKozaKozorohKrabiceKrachKrajinaKralovatKrasopisKravataKreditKrejcarKresbaKrevetaKriketKritikKrizeKrkavecKrmelecKrmivoKrocanKrokKronikaKropitKroupaKrovkaKrtekKruhadloKrupiceKrutostKrvinkaKrychleKryptaKrystalKrytKudlankaKufrKujnostKuklaKulajdaKulichKulkaKulometKulturaKunaKupodivuKurtKurzorKutilKvalitaKvasinkaKvestorKynologKyselinaKytaraKyticeKytkaKytovecKyvadloLabradorLachtanLadnostLaikLakomecLamelaLampaLanovkaLasiceLasoLasturaLatinkaLavinaLebkaLeckdyLedenLedniceLedovkaLedvinaLegendaLegieLegraceLehceLehkostLehnoutLektvarLenochodLentilkaLepenkaLepidloLetadloLetecLetmoLetokruhLevhartLevitaceLevobokLibraLichotkaLidojedLidskostLihovinaLijavecLilekLimetkaLinieLinkaLinoleumListopadLitinaLitovatLobistaLodivodLogikaLogopedLokalitaLoketLomcovatLopataLopuchLordLososLotrLoudalLouhLoukaLouskatLovecLstivostLucernaLuciferLumpLuskLustraceLviceLyraLyrikaLysinaMadamMadloMagistrMahagonMajetekMajitelMajoritaMakakMakoviceMakrelaMalbaMalinaMalovatMalviceMaminkaMandleMankoMarnostMasakrMaskotMasopustMaticeMatrikaMaturitaMazanecMazivoMazlitMazurkaMdlobaMechanikMeditaceMedovinaMelasaMelounMentolkaMetlaMetodaMetrMezeraMigraceMihnoutMihuleMikinaMikrofonMilenecMilimetrMilostMimikaMincovnaMinibarMinometMinulostMiskaMistrMixovatMladostMlhaMlhovinaMlokMlsatMluvitMnichMnohemMobilMocnostModelkaModlitbaMohylaMokroMolekulaMomentkaMonarchaMonoklMonstrumMontovatMonzunMosazMoskytMostMotivaceMotorkaMotykaMouchaMoudrostMozaikaMozekMozolMramorMravenecMrkevMrtvolaMrzetMrzutostMstitelMudrcMuflonMulatMumieMuniceMusetMutaceMuzeumMuzikantMyslivecMzdaNabouratNachytatNadaceNadbytekNadhozNadobroNadpisNahlasNahnatNahodileNahraditNaivitaNajednouNajistoNajmoutNaklonitNakonecNakrmitNalevoNamazatNamluvitNanometrNaokoNaopakNaostroNapadatNapevnoNaplnitNapnoutNaposledNaprostoNaroditNarubyNarychloNasaditNasekatNaslepoNastatNatolikNavenekNavrchNavzdoryNazvatNebeNechatNeckyNedalekoNedbatNeduhNegaceNehetNehodaNejenNejprveNeklidNelibostNemilostNemocNeochotaNeonkaNepokojNerostNervNesmyslNesouladNetvorNeuronNevinaNezvykleNicotaNijakNikamNikdyNiklNikterakNitroNoclehNohaviceNominaceNoraNorekNositelNosnostNouzeNovinyNovotaNozdraNudaNudleNugetNutitNutnostNutrieNymfaObalObarvitObavaObdivObecObehnatObejmoutObezitaObhajobaObilniceObjasnitObjektObklopitOblastOblekOblibaOblohaObludaObnosObohatitObojekOboutObrazecObrnaObrubaObrysObsahObsluhaObstaratObuvObvazObvinitObvodObvykleObyvatelObzorOcasOcelOcenitOchladitOchotaOchranaOcitnoutOdbojOdbytOdchodOdcizitOdebratOdeslatOdevzdatOdezvaOdhadceOdhoditOdjetOdjinudOdkazOdkoupitOdlivOdlukaOdmlkaOdolnostOdpadOdpisOdploutOdporOdpustitOdpykatOdrazkaOdsouditOdstupOdsunOdtokOdtudOdvahaOdvetaOdvolatOdvracetOdznakOfinaOfsajdOhlasOhniskoOhradaOhrozitOhryzekOkapOkeniceOklikaOknoOkouzlitOkovyOkrasaOkresOkrsekOkruhOkupantOkurkaOkusitOlejninaOlizovatOmakOmeletaOmezitOmladinaOmlouvatOmluvaOmylOnehdyOpakovatOpasekOperaceOpiceOpilostOpisovatOporaOpoziceOpravduOprotiOrbitalOrchestrOrgieOrliceOrlojOrtelOsadaOschnoutOsikaOsivoOslavaOslepitOslnitOslovitOsnovaOsobaOsolitOspalecOstenOstrahaOstudaOstychOsvojitOteplitOtiskOtopOtrhatOtrlostOtrokOtrubyOtvorOvanoutOvarOvesOvlivnitOvoceOxidOzdobaPachatelPacientPadouchPahorekPaktPalandaPalecPalivoPalubaPamfletPamlsekPanenkaPanikaPannaPanovatPanstvoPantoflePaprikaParketaParodiePartaParukaParybaPasekaPasivitaPastelkaPatentPatronaPavoukPaznehtPazourekPeckaPedagogPejsekPekloPelotonPenaltaPendrekPenzePeriskopPeroPestrostPetardaPeticePetrolejPevninaPexesoPianistaPihaPijavicePiklePiknikPilinaPilnostPilulkaPinzetaPipetaPisatelPistolePitevnaPivnicePivovarPlacentaPlakatPlamenPlanetaPlastikaPlatitPlavidloPlazPlechPlemenoPlentaPlesPletivoPlevelPlivatPlnitPlnoPlochaPlodinaPlombaPloutPlukPlynPobavitPobytPochodPocitPoctivecPodatPodcenitPodepsatPodhledPodivitPodkladPodmanitPodnikPodobaPodporaPodrazPodstataPodvodPodzimPoeziePohankaPohnutkaPohovorPohromaPohybPointaPojistkaPojmoutPokazitPoklesPokojPokrokPokutaPokynPolednePolibekPolknoutPolohaPolynomPomaluPominoutPomlkaPomocPomstaPomysletPonechatPonorkaPonurostPopadatPopelPopisekPoplachPoprositPopsatPopudPoradcePorcePorodPoruchaPoryvPosaditPosedPosilaPoskokPoslanecPosouditPospoluPostavaPosudekPosypPotahPotkanPotleskPotomekPotravaPotupaPotvoraPoukazPoutoPouzdroPovahaPovidlaPovlakPovozPovrchPovstatPovykPovzdechPozdravPozemekPoznatekPozorPozvatPracovatPrahoryPraktikaPralesPraotecPraporekPrasePravdaPrincipPrknoProbuditProcentoProdejProfeseProhraProjektProlomitPromilePronikatPropadProrokProsbaProtonProutekProvazPrskavkaPrstenPrudkostPrutPrvekPrvohoryPsanecPsovodPstruhPtactvoPubertaPuchPudlPukavecPuklinaPukrlePultPumpaPuncPupenPusaPusinkaPustinaPutovatPutykaPyramidaPyskPytelRacekRachotRadiaceRadniceRadonRaftRagbyRaketaRakovinaRamenoRampouchRandeRarachRaritaRasovnaRastrRatolestRazanceRazidloReagovatReakceReceptRedaktorReferentReflexRejnokReklamaRekordRekrutRektorReputaceRevizeRevmaRevolverRezervaRiskovatRizikoRobotikaRodokmenRohovkaRokleRokokoRomanetoRopovodRopuchaRorejsRosolRostlinaRotmistrRotopedRotundaRoubenkaRouchoRoupRouraRovinaRovniceRozborRozchodRozdatRozeznatRozhodceRozinkaRozjezdRozkazRozlohaRozmarRozpadRozruchRozsahRoztokRozumRozvodRubrikaRuchadloRukaviceRukopisRybaRybolovRychlostRydloRypadloRytinaRyzostSadistaSahatSakoSamecSamizdatSamotaSanitkaSardinkaSasankaSatelitSazbaSazeniceSborSchovatSebrankaSeceseSedadloSedimentSedloSehnatSejmoutSekeraSektaSekundaSekvojeSemenoSenoServisSesaditSeshoraSeskokSeslatSestraSesuvSesypatSetbaSetinaSetkatSetnoutSetrvatSeverSeznamShodaShrnoutSifonSilniceSirkaSirotekSirupSituaceSkafandrSkaliskoSkanzenSkautSkeptikSkicaSkladbaSkleniceSkloSkluzSkobaSkokanSkoroSkriptaSkrzSkupinaSkvostSkvrnaSlabikaSladidloSlaninaSlastSlavnostSledovatSlepecSlevaSlezinaSlibSlinaSlizniceSlonSloupekSlovoSluchSluhaSlunceSlupkaSlzaSmaragdSmetanaSmilstvoSmlouvaSmogSmradSmrkSmrtkaSmutekSmyslSnadSnahaSnobSobotaSochaSodovkaSokolSopkaSotvaSoubojSoucitSoudceSouhlasSouladSoumrakSoupravaSousedSoutokSouvisetSpalovnaSpasitelSpisSplavSpodekSpojenecSpoluSponzorSpornostSpoustaSprchaSpustitSrandaSrazSrdceSrnaSrnecSrovnatSrpenSrstSrubStaniceStarostaStatikaStavbaStehnoStezkaStodolaStolekStopaStornoStoupatStrachStresStrhnoutStromStrunaStudnaStupniceStvolStykSubjektSubtropySucharSudostSuknoSundatSunoutSurikataSurovinaSvahSvalstvoSvetrSvatbaSvazekSvisleSvitekSvobodaSvodidloSvorkaSvrabSykavkaSykotSynekSynovecSypatSypkostSyrovostSyselSytostTabletkaTabuleTahounTajemnoTajfunTajgaTajitTajnostTaktikaTamhleTamponTancovatTanecTankerTapetaTaveninaTazatelTechnikaTehdyTekutinaTelefonTemnotaTendenceTenistaTenorTeplotaTepnaTeprveTerapieTermoskaTextilTichoTiskopisTitulekTkadlecTkaninaTlapkaTleskatTlukotTlupaTmelToaletaTopinkaTopolTorzoTouhaToulecTradiceTraktorTrampTrasaTraverzaTrefitTrestTrezorTrhavinaTrhlinaTrochuTrojiceTroskaTroubaTrpceTrpitelTrpkostTrubecTruchlitTruhliceTrusTrvatTudyTuhnoutTuhostTundraTuristaTurnajTuzemskoTvarohTvorbaTvrdostTvrzTygrTykevUbohostUbozeUbratUbrousekUbrusUbytovnaUchoUctivostUdivitUhraditUjednatUjistitUjmoutUkazatelUklidnitUklonitUkotvitUkrojitUliceUlitaUlovitUmyvadloUnavitUniformaUniknoutUpadnoutUplatnitUplynoutUpoutatUpravitUranUrazitUsednoutUsilovatUsmrtitUsnadnitUsnoutUsouditUstlatUstrnoutUtahovatUtkatUtlumitUtonoutUtopenecUtrousitUvalitUvolnitUvozovkaUzdravitUzelUzeninaUzlinaUznatVagonValchaValounVanaVandalVanilkaVaranVarhanyVarovatVcelkuVchodVdovaVedroVegetaceVejceVelbloudVeletrhVelitelVelmocVelrybaVenkovVerandaVerzeVeselkaVeskrzeVesniceVespoduVestaVeterinaVeverkaVibraceVichrVideohraVidinaVidleVilaViniceVisetVitalitaVizeVizitkaVjezdVkladVkusVlajkaVlakVlasecVlevoVlhkostVlivVlnovkaVloupatVnucovatVnukVodaVodivostVodoznakVodstvoVojenskyVojnaVojskoVolantVolbaVolitVolnoVoskovkaVozidloVozovnaVpravoVrabecVracetVrahVrataVrbaVrcholekVrhatVrstvaVrtuleVsaditVstoupitVstupVtipVybavitVybratVychovatVydatVydraVyfotitVyhledatVyhnoutVyhoditVyhraditVyhubitVyjasnitVyjetVyjmoutVyklopitVykonatVylekatVymazatVymezitVymizetVymysletVynechatVynikatVynutitVypadatVyplatitVypravitVypustitVyrazitVyrovnatVyrvatVyslovitVysokoVystavitVysunoutVysypatVytasitVytesatVytratitVyvinoutVyvolatVyvrhelVyzdobitVyznatVzaduVzbuditVzchopitVzdorVzduchVzdychatVzestupVzhledemVzkazVzlykatVznikVzorekVzpouraVztahVztekXylofonZabratZabydletZachovatZadarmoZadusitZafoukatZahltitZahoditZahradaZahynoutZajatecZajetZajistitZaklepatZakoupitZalepitZamezitZamotatZamysletZanechatZanikatZaplatitZapojitZapsatZarazitZastavitZasunoutZatajitZatemnitZatknoutZaujmoutZavalitZaveletZavinitZavolatZavrtatZazvonitZbavitZbrusuZbudovatZbytekZdalekaZdarmaZdatnostZdivoZdobitZdrojZdvihZdymadloZeleninaZemanZeminaZeptatZezaduZezdolaZhatitZhltnoutZhlubokaZhotovitZhrubaZimaZimniceZjemnitZklamatZkoumatZkratkaZkumavkaZlatoZlehkaZlobaZlomZlostZlozvykZmapovatZmarZmatekZmijeZmizetZmocnitZmodratZmrzlinaZmutovatZnakZnalostZnamenatZnovuZobrazitZotavitZoubekZoufaleZploditZpomalitZpravaZprostitZprudkaZprvuZradaZranitZrcadloZrnitostZrnoZrovnaZrychlitZrzavostZtichaZtratitZubovinaZubrZvednoutZvenkuZveselaZvonZvratZvukovodZvyk"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } + } + var LangCz = ( + /** @class */ + function(_super) { + __extends(LangCz2, _super); + function LangCz2() { + return _super.call(this, "cz") || this; + } + LangCz2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangCz2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangCz2; + }(wordlist_1.Wordlist) + ); + var langCz = new LangCz(); + exports2.langCz = langCz; + wordlist_1.Wordlist.register(langCz); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-en.js +var require_lang_en = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-en.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langEn = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } + } + var LangEn = ( + /** @class */ + function(_super) { + __extends(LangEn2, _super); + function LangEn2() { + return _super.call(this, "en") || this; + } + LangEn2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangEn2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangEn2; + }(wordlist_1.Wordlist) + ); + var langEn = new LangEn(); + exports2.langEn = langEn; + wordlist_1.Wordlist.register(langEn); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-es.js +var require_lang_es = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-es.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langEs = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var words = "A/bacoAbdomenAbejaAbiertoAbogadoAbonoAbortoAbrazoAbrirAbueloAbusoAcabarAcademiaAccesoAccio/nAceiteAcelgaAcentoAceptarA/cidoAclararAcne/AcogerAcosoActivoActoActrizActuarAcudirAcuerdoAcusarAdictoAdmitirAdoptarAdornoAduanaAdultoAe/reoAfectarAficio/nAfinarAfirmarA/gilAgitarAgoni/aAgostoAgotarAgregarAgrioAguaAgudoA/guilaAgujaAhogoAhorroAireAislarAjedrezAjenoAjusteAlacra/nAlambreAlarmaAlbaA/lbumAlcaldeAldeaAlegreAlejarAlertaAletaAlfilerAlgaAlgodo/nAliadoAlientoAlivioAlmaAlmejaAlmi/barAltarAltezaAltivoAltoAlturaAlumnoAlzarAmableAmanteAmapolaAmargoAmasarA/mbarA/mbitoAmenoAmigoAmistadAmorAmparoAmplioAnchoAncianoAnclaAndarAnde/nAnemiaA/nguloAnilloA/nimoAni/sAnotarAntenaAntiguoAntojoAnualAnularAnuncioA~adirA~ejoA~oApagarAparatoApetitoApioAplicarApodoAporteApoyoAprenderAprobarApuestaApuroAradoAra~aArarA/rbitroA/rbolArbustoArchivoArcoArderArdillaArduoA/reaA/ridoAriesArmoni/aArne/sAromaArpaArpo/nArregloArrozArrugaArteArtistaAsaAsadoAsaltoAscensoAsegurarAseoAsesorAsientoAsiloAsistirAsnoAsombroA/speroAstillaAstroAstutoAsumirAsuntoAtajoAtaqueAtarAtentoAteoA/ticoAtletaA/tomoAtraerAtrozAtu/nAudazAudioAugeAulaAumentoAusenteAutorAvalAvanceAvaroAveAvellanaAvenaAvestruzAvio/nAvisoAyerAyudaAyunoAzafra/nAzarAzoteAzu/carAzufreAzulBabaBaborBacheBahi/aBaileBajarBalanzaBalco/nBaldeBambu/BancoBandaBa~oBarbaBarcoBarnizBarroBa/sculaBasto/nBasuraBatallaBateri/aBatirBatutaBau/lBazarBebe/BebidaBelloBesarBesoBestiaBichoBienBingoBlancoBloqueBlusaBoaBobinaBoboBocaBocinaBodaBodegaBoinaBolaBoleroBolsaBombaBondadBonitoBonoBonsa/iBordeBorrarBosqueBoteBoti/nBo/vedaBozalBravoBrazoBrechaBreveBrilloBrincoBrisaBrocaBromaBronceBroteBrujaBruscoBrutoBuceoBucleBuenoBueyBufandaBufo/nBu/hoBuitreBultoBurbujaBurlaBurroBuscarButacaBuzo/nCaballoCabezaCabinaCabraCacaoCada/verCadenaCaerCafe/Cai/daCaima/nCajaCajo/nCalCalamarCalcioCaldoCalidadCalleCalmaCalorCalvoCamaCambioCamelloCaminoCampoCa/ncerCandilCanelaCanguroCanicaCantoCa~aCa~o/nCaobaCaosCapazCapita/nCapoteCaptarCapuchaCaraCarbo/nCa/rcelCaretaCargaCari~oCarneCarpetaCarroCartaCasaCascoCaseroCaspaCastorCatorceCatreCaudalCausaCazoCebollaCederCedroCeldaCe/lebreCelosoCe/lulaCementoCenizaCentroCercaCerdoCerezaCeroCerrarCertezaCe/spedCetroChacalChalecoChampu/ChanclaChapaCharlaChicoChisteChivoChoqueChozaChuletaChuparCiclo/nCiegoCieloCienCiertoCifraCigarroCimaCincoCineCintaCipre/sCircoCiruelaCisneCitaCiudadClamorClanClaroClaseClaveClienteClimaCli/nicaCobreCoccio/nCochinoCocinaCocoCo/digoCodoCofreCogerCoheteCoji/nCojoColaColchaColegioColgarColinaCollarColmoColumnaCombateComerComidaCo/modoCompraCondeConejoCongaConocerConsejoContarCopaCopiaCorazo/nCorbataCorchoCordo/nCoronaCorrerCoserCosmosCostaCra/neoCra/terCrearCrecerCrei/doCremaCri/aCrimenCriptaCrisisCromoCro/nicaCroquetaCrudoCruzCuadroCuartoCuatroCuboCubrirCucharaCuelloCuentoCuerdaCuestaCuevaCuidarCulebraCulpaCultoCumbreCumplirCunaCunetaCuotaCupo/nCu/pulaCurarCuriosoCursoCurvaCutisDamaDanzaDarDardoDa/tilDeberDe/bilDe/cadaDecirDedoDefensaDefinirDejarDelfi/nDelgadoDelitoDemoraDensoDentalDeporteDerechoDerrotaDesayunoDeseoDesfileDesnudoDestinoDesvi/oDetalleDetenerDeudaDi/aDiabloDiademaDiamanteDianaDiarioDibujoDictarDienteDietaDiezDifi/cilDignoDilemaDiluirDineroDirectoDirigirDiscoDise~oDisfrazDivaDivinoDobleDoceDolorDomingoDonDonarDoradoDormirDorsoDosDosisDrago/nDrogaDuchaDudaDueloDue~oDulceDu/oDuqueDurarDurezaDuroE/banoEbrioEcharEcoEcuadorEdadEdicio/nEdificioEditorEducarEfectoEficazEjeEjemploElefanteElegirElementoElevarElipseE/liteElixirElogioEludirEmbudoEmitirEmocio/nEmpateEmpe~oEmpleoEmpresaEnanoEncargoEnchufeEnci/aEnemigoEneroEnfadoEnfermoEnga~oEnigmaEnlaceEnormeEnredoEnsayoEnse~arEnteroEntrarEnvaseEnvi/oE/pocaEquipoErizoEscalaEscenaEscolarEscribirEscudoEsenciaEsferaEsfuerzoEspadaEspejoEspi/aEsposaEspumaEsqui/EstarEsteEstiloEstufaEtapaEternoE/ticaEtniaEvadirEvaluarEventoEvitarExactoExamenExcesoExcusaExentoExigirExilioExistirE/xitoExpertoExplicarExponerExtremoFa/bricaFa/bulaFachadaFa/cilFactorFaenaFajaFaldaFalloFalsoFaltarFamaFamiliaFamosoFarao/nFarmaciaFarolFarsaFaseFatigaFaunaFavorFaxFebreroFechaFelizFeoFeriaFerozFe/rtilFervorFesti/nFiableFianzaFiarFibraFiccio/nFichaFideoFiebreFielFieraFiestaFiguraFijarFijoFilaFileteFilialFiltroFinFincaFingirFinitoFirmaFlacoFlautaFlechaFlorFlotaFluirFlujoFlu/orFobiaFocaFogataFogo/nFolioFolletoFondoFormaForroFortunaForzarFosaFotoFracasoFra/gilFranjaFraseFraudeFrei/rFrenoFresaFri/oFritoFrutaFuegoFuenteFuerzaFugaFumarFuncio/nFundaFurgo/nFuriaFusilFu/tbolFuturoGacelaGafasGaitaGajoGalaGaleri/aGalloGambaGanarGanchoGangaGansoGarajeGarzaGasolinaGastarGatoGavila/nGemeloGemirGenGe/neroGenioGenteGeranioGerenteGermenGestoGiganteGimnasioGirarGiroGlaciarGloboGloriaGolGolfoGolosoGolpeGomaGordoGorilaGorraGotaGoteoGozarGradaGra/ficoGranoGrasaGratisGraveGrietaGrilloGripeGrisGritoGrosorGru/aGruesoGrumoGrupoGuanteGuapoGuardiaGuerraGui/aGui~oGuionGuisoGuitarraGusanoGustarHaberHa/bilHablarHacerHachaHadaHallarHamacaHarinaHazHaza~aHebillaHebraHechoHeladoHelioHembraHerirHermanoHe/roeHervirHieloHierroHi/gadoHigieneHijoHimnoHistoriaHocicoHogarHogueraHojaHombreHongoHonorHonraHoraHormigaHornoHostilHoyoHuecoHuelgaHuertaHuesoHuevoHuidaHuirHumanoHu/medoHumildeHumoHundirHuraca/nHurtoIconoIdealIdiomaI/doloIglesiaIglu/IgualIlegalIlusio/nImagenIma/nImitarImparImperioImponerImpulsoIncapazI/ndiceInerteInfielInformeIngenioInicioInmensoInmuneInnatoInsectoInstanteIntere/sI/ntimoIntuirInu/tilInviernoIraIrisIroni/aIslaIsloteJabali/Jabo/nJamo/nJarabeJardi/nJarraJaulaJazmi/nJefeJeringaJineteJornadaJorobaJovenJoyaJuergaJuevesJuezJugadorJugoJugueteJuicioJuncoJunglaJunioJuntarJu/piterJurarJustoJuvenilJuzgarKiloKoalaLabioLacioLacraLadoLadro/nLagartoLa/grimaLagunaLaicoLamerLa/minaLa/mparaLanaLanchaLangostaLanzaLa/pizLargoLarvaLa/stimaLataLa/texLatirLaurelLavarLazoLealLeccio/nLecheLectorLeerLegio/nLegumbreLejanoLenguaLentoLe~aLeo/nLeopardoLesio/nLetalLetraLeveLeyendaLibertadLibroLicorLi/derLidiarLienzoLigaLigeroLimaLi/miteLimo/nLimpioLinceLindoLi/neaLingoteLinoLinternaLi/quidoLisoListaLiteraLitioLitroLlagaLlamaLlantoLlaveLlegarLlenarLlevarLlorarLloverLluviaLoboLocio/nLocoLocuraLo/gicaLogroLombrizLomoLonjaLoteLuchaLucirLugarLujoLunaLunesLupaLustroLutoLuzMacetaMachoMaderaMadreMaduroMaestroMafiaMagiaMagoMai/zMaldadMaletaMallaMaloMama/MamboMamutMancoMandoManejarMangaManiqui/ManjarManoMansoMantaMa~anaMapaMa/quinaMarMarcoMareaMarfilMargenMaridoMa/rmolMarro/nMartesMarzoMasaMa/scaraMasivoMatarMateriaMatizMatrizMa/ximoMayorMazorcaMechaMedallaMedioMe/dulaMejillaMejorMelenaMelo/nMemoriaMenorMensajeMenteMenu/MercadoMerengueMe/ritoMesMeso/nMetaMeterMe/todoMetroMezclaMiedoMielMiembroMigaMilMilagroMilitarMillo/nMimoMinaMineroMi/nimoMinutoMiopeMirarMisaMiseriaMisilMismoMitadMitoMochilaMocio/nModaModeloMohoMojarMoldeMolerMolinoMomentoMomiaMonarcaMonedaMonjaMontoMo~oMoradaMorderMorenoMorirMorroMorsaMortalMoscaMostrarMotivoMoverMo/vilMozoMuchoMudarMuebleMuelaMuerteMuestraMugreMujerMulaMuletaMultaMundoMu~ecaMuralMuroMu/sculoMuseoMusgoMu/sicaMusloNa/carNacio/nNadarNaipeNaranjaNarizNarrarNasalNatalNativoNaturalNa/useaNavalNaveNavidadNecioNe/ctarNegarNegocioNegroNeo/nNervioNetoNeutroNevarNeveraNichoNidoNieblaNietoNi~ezNi~oNi/tidoNivelNoblezaNocheNo/minaNoriaNormaNorteNotaNoticiaNovatoNovelaNovioNubeNucaNu/cleoNudilloNudoNueraNueveNuezNuloNu/meroNutriaOasisObesoObispoObjetoObraObreroObservarObtenerObvioOcaOcasoOce/anoOchentaOchoOcioOcreOctavoOctubreOcultoOcuparOcurrirOdiarOdioOdiseaOesteOfensaOfertaOficioOfrecerOgroOi/doOi/rOjoOlaOleadaOlfatoOlivoOllaOlmoOlorOlvidoOmbligoOndaOnzaOpacoOpcio/nO/peraOpinarOponerOptarO/pticaOpuestoOracio/nOradorOralO/rbitaOrcaOrdenOrejaO/rganoOrgi/aOrgulloOrienteOrigenOrillaOroOrquestaOrugaOsadi/aOscuroOseznoOsoOstraOto~oOtroOvejaO/vuloO/xidoOxi/genoOyenteOzonoPactoPadrePaellaPa/ginaPagoPai/sPa/jaroPalabraPalcoPaletaPa/lidoPalmaPalomaPalparPanPanalPa/nicoPanteraPa~ueloPapa/PapelPapillaPaquetePararParcelaParedParirParoPa/rpadoParquePa/rrafoPartePasarPaseoPasio/nPasoPastaPataPatioPatriaPausaPautaPavoPayasoPeato/nPecadoPeceraPechoPedalPedirPegarPeinePelarPelda~oPeleaPeligroPellejoPeloPelucaPenaPensarPe~o/nPeo/nPeorPepinoPeque~oPeraPerchaPerderPerezaPerfilPericoPerlaPermisoPerroPersonaPesaPescaPe/simoPesta~aPe/taloPetro/leoPezPezu~aPicarPicho/nPiePiedraPiernaPiezaPijamaPilarPilotoPimientaPinoPintorPinzaPi~aPiojoPipaPirataPisarPiscinaPisoPistaPito/nPizcaPlacaPlanPlataPlayaPlazaPleitoPlenoPlomoPlumaPluralPobrePocoPoderPodioPoemaPoesi/aPoetaPolenPolici/aPolloPolvoPomadaPomeloPomoPompaPonerPorcio/nPortalPosadaPoseerPosiblePostePotenciaPotroPozoPradoPrecozPreguntaPremioPrensaPresoPrevioPrimoPri/ncipePrisio/nPrivarProaProbarProcesoProductoProezaProfesorProgramaProlePromesaProntoPropioPro/ximoPruebaPu/blicoPucheroPudorPuebloPuertaPuestoPulgaPulirPulmo/nPulpoPulsoPumaPuntoPu~alPu~oPupaPupilaPure/QuedarQuejaQuemarQuererQuesoQuietoQui/micaQuinceQuitarRa/banoRabiaRaboRacio/nRadicalRai/zRamaRampaRanchoRangoRapazRa/pidoRaptoRasgoRaspaRatoRayoRazaRazo/nReaccio/nRealidadReba~oReboteRecaerRecetaRechazoRecogerRecreoRectoRecursoRedRedondoReducirReflejoReformaRefra/nRefugioRegaloRegirReglaRegresoRehe/nReinoRei/rRejaRelatoRelevoRelieveRellenoRelojRemarRemedioRemoRencorRendirRentaRepartoRepetirReposoReptilResRescateResinaRespetoRestoResumenRetiroRetornoRetratoReunirReve/sRevistaReyRezarRicoRiegoRiendaRiesgoRifaRi/gidoRigorRinco/nRi~o/nRi/oRiquezaRisaRitmoRitoRizoRobleRoceRociarRodarRodeoRodillaRoerRojizoRojoRomeroRomperRonRoncoRondaRopaRoperoRosaRoscaRostroRotarRubi/RuborRudoRuedaRugirRuidoRuinaRuletaRuloRumboRumorRupturaRutaRutinaSa/badoSaberSabioSableSacarSagazSagradoSalaSaldoSaleroSalirSalmo/nSalo/nSalsaSaltoSaludSalvarSambaSancio/nSandi/aSanearSangreSanidadSanoSantoSapoSaqueSardinaSarte/nSastreSata/nSaunaSaxofo/nSeccio/nSecoSecretoSectaSedSeguirSeisSelloSelvaSemanaSemillaSendaSensorSe~alSe~orSepararSepiaSequi/aSerSerieSermo/nServirSesentaSesio/nSetaSetentaSeveroSexoSextoSidraSiestaSieteSigloSignoSi/labaSilbarSilencioSillaSi/mboloSimioSirenaSistemaSitioSituarSobreSocioSodioSolSolapaSoldadoSoledadSo/lidoSoltarSolucio/nSombraSondeoSonidoSonoroSonrisaSopaSoplarSoporteSordoSorpresaSorteoSoste/nSo/tanoSuaveSubirSucesoSudorSuegraSueloSue~oSuerteSufrirSujetoSulta/nSumarSuperarSuplirSuponerSupremoSurSurcoSure~oSurgirSustoSutilTabacoTabiqueTablaTabu/TacoTactoTajoTalarTalcoTalentoTallaTalo/nTama~oTamborTangoTanqueTapaTapeteTapiaTapo/nTaquillaTardeTareaTarifaTarjetaTarotTarroTartaTatuajeTauroTazaTazo/nTeatroTechoTeclaTe/cnicaTejadoTejerTejidoTelaTele/fonoTemaTemorTemploTenazTenderTenerTenisTensoTeori/aTerapiaTercoTe/rminoTernuraTerrorTesisTesoroTestigoTeteraTextoTezTibioTiburo/nTiempoTiendaTierraTiesoTigreTijeraTildeTimbreTi/midoTimoTintaTi/oTi/picoTipoTiraTiro/nTita/nTi/tereTi/tuloTizaToallaTobilloTocarTocinoTodoTogaToldoTomarTonoTontoToparTopeToqueTo/raxToreroTormentaTorneoToroTorpedoTorreTorsoTortugaTosToscoToserTo/xicoTrabajoTractorTraerTra/ficoTragoTrajeTramoTranceTratoTraumaTrazarTre/bolTreguaTreintaTrenTreparTresTribuTrigoTripaTristeTriunfoTrofeoTrompaTroncoTropaTroteTrozoTrucoTruenoTrufaTuberi/aTuboTuertoTumbaTumorTu/nelTu/nicaTurbinaTurismoTurnoTutorUbicarU/lceraUmbralUnidadUnirUniversoUnoUntarU~aUrbanoUrbeUrgenteUrnaUsarUsuarioU/tilUtopi/aUvaVacaVaci/oVacunaVagarVagoVainaVajillaValeVa/lidoValleValorVa/lvulaVampiroVaraVariarVaro/nVasoVecinoVectorVehi/culoVeinteVejezVelaVeleroVelozVenaVencerVendaVenenoVengarVenirVentaVenusVerVeranoVerboVerdeVeredaVerjaVersoVerterVi/aViajeVibrarVicioVi/ctimaVidaVi/deoVidrioViejoViernesVigorVilVillaVinagreVinoVi~edoVioli/nViralVirgoVirtudVisorVi/speraVistaVitaminaViudoVivazViveroVivirVivoVolca/nVolumenVolverVorazVotarVotoVozVueloVulgarYacerYateYeguaYemaYernoYesoYodoYogaYogurZafiroZanjaZapatoZarzaZonaZorroZumoZurdo"; + var lookup = {}; + var wordlist = null; + function dropDiacritic(word) { + wordlist_1.logger.checkNormalize(); + return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word.normalize("NFD").toLowerCase()), function(c) { + return c >= 65 && c <= 90 || c >= 97 && c <= 123; + })); + } + function expand(word) { + var output = []; + Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word), function(c) { + if (c === 47) { + output.push(204); + output.push(129); + } else if (c === 126) { + output.push(110); + output.push(204); + output.push(131); + } else { + output.push(c); + } + }); + return (0, strings_1.toUtf8String)(output); + } + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) { + return expand(w); + }); + wordlist.forEach(function(word, index) { + lookup[dropDiacritic(word)] = index; + }); + if (wordlist_1.Wordlist.check(lang) !== "0xf74fb7092aeacdfbf8959557de22098da512207fb9f109cb526994938cf40300") { + wordlist = null; + throw new Error("BIP39 Wordlist for es (Spanish) FAILED"); + } + } + var LangEs = ( + /** @class */ + function(_super) { + __extends(LangEs2, _super); + function LangEs2() { + return _super.call(this, "es") || this; + } + LangEs2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangEs2.prototype.getWordIndex = function(word) { + loadWords(this); + return lookup[dropDiacritic(word)]; + }; + return LangEs2; + }(wordlist_1.Wordlist) + ); + var langEs = new LangEs(); + exports2.langEs = langEs; + wordlist_1.Wordlist.register(langEs); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-fr.js +var require_lang_fr = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-fr.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langFr = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var words = "AbaisserAbandonAbdiquerAbeilleAbolirAborderAboutirAboyerAbrasifAbreuverAbriterAbrogerAbruptAbsenceAbsoluAbsurdeAbusifAbyssalAcade/mieAcajouAcarienAccablerAccepterAcclamerAccoladeAccrocheAccuserAcerbeAchatAcheterAcidulerAcierAcompteAcque/rirAcronymeActeurActifActuelAdepteAde/quatAdhe/sifAdjectifAdjugerAdmettreAdmirerAdopterAdorerAdoucirAdresseAdroitAdulteAdverbeAe/rerAe/ronefAffaireAffecterAfficheAffreuxAffublerAgacerAgencerAgileAgiterAgraferAgre/ableAgrumeAiderAiguilleAilierAimableAisanceAjouterAjusterAlarmerAlchimieAlerteAlge-breAlgueAlie/nerAlimentAlle/gerAlliageAllouerAllumerAlourdirAlpagaAltesseAlve/oleAmateurAmbiguAmbreAme/nagerAmertumeAmidonAmiralAmorcerAmourAmovibleAmphibieAmpleurAmusantAnalyseAnaphoreAnarchieAnatomieAncienAne/antirAngleAngoisseAnguleuxAnimalAnnexerAnnonceAnnuelAnodinAnomalieAnonymeAnormalAntenneAntidoteAnxieuxApaiserApe/ritifAplanirApologieAppareilAppelerApporterAppuyerAquariumAqueducArbitreArbusteArdeurArdoiseArgentArlequinArmatureArmementArmoireArmureArpenterArracherArriverArroserArsenicArte/rielArticleAspectAsphalteAspirerAssautAsservirAssietteAssocierAssurerAsticotAstreAstuceAtelierAtomeAtriumAtroceAttaqueAttentifAttirerAttraperAubaineAubergeAudaceAudibleAugurerAuroreAutomneAutrucheAvalerAvancerAvariceAvenirAverseAveugleAviateurAvideAvionAviserAvoineAvouerAvrilAxialAxiomeBadgeBafouerBagageBaguetteBaignadeBalancerBalconBaleineBalisageBambinBancaireBandageBanlieueBannie-reBanquierBarbierBarilBaronBarqueBarrageBassinBastionBatailleBateauBatterieBaudrierBavarderBeletteBe/lierBeloteBe/ne/ficeBerceauBergerBerlineBermudaBesaceBesogneBe/tailBeurreBiberonBicycleBiduleBijouBilanBilingueBillardBinaireBiologieBiopsieBiotypeBiscuitBisonBistouriBitumeBizarreBlafardBlagueBlanchirBlessantBlinderBlondBloquerBlousonBobardBobineBoireBoiserBolideBonbonBondirBonheurBonifierBonusBordureBorneBotteBoucleBoueuxBougieBoulonBouquinBourseBoussoleBoutiqueBoxeurBrancheBrasierBraveBrebisBre-cheBreuvageBricolerBrigadeBrillantBriocheBriqueBrochureBroderBronzerBrousseBroyeurBrumeBrusqueBrutalBruyantBuffleBuissonBulletinBureauBurinBustierButinerButoirBuvableBuvetteCabanonCabineCachetteCadeauCadreCafe/ineCaillouCaissonCalculerCalepinCalibreCalmerCalomnieCalvaireCamaradeCame/raCamionCampagneCanalCanetonCanonCantineCanularCapableCaporalCapriceCapsuleCapterCapucheCarabineCarboneCaresserCaribouCarnageCarotteCarreauCartonCascadeCasierCasqueCassureCauserCautionCavalierCaverneCaviarCe/dilleCeintureCe/lesteCelluleCendrierCensurerCentralCercleCe/re/bralCeriseCernerCerveauCesserChagrinChaiseChaleurChambreChanceChapitreCharbonChasseurChatonChaussonChavirerChemiseChenilleChe/quierChercherChevalChienChiffreChignonChime-reChiotChlorureChocolatChoisirChoseChouetteChromeChuteCigareCigogneCimenterCine/maCintrerCirculerCirerCirqueCiterneCitoyenCitronCivilClaironClameurClaquerClasseClavierClientClignerClimatClivageClocheClonageCloporteCobaltCobraCocasseCocotierCoderCodifierCoffreCognerCohe/sionCoifferCoincerCole-reColibriCollineColmaterColonelCombatCome/dieCommandeCompactConcertConduireConfierCongelerConnoterConsonneContactConvexeCopainCopieCorailCorbeauCordageCornicheCorpusCorrectCorte-geCosmiqueCostumeCotonCoudeCoupureCourageCouteauCouvrirCoyoteCrabeCrainteCravateCrayonCre/atureCre/diterCre/meuxCreuserCrevetteCriblerCrierCristalCrite-reCroireCroquerCrotaleCrucialCruelCrypterCubiqueCueillirCuille-reCuisineCuivreCulminerCultiverCumulerCupideCuratifCurseurCyanureCycleCylindreCyniqueDaignerDamierDangerDanseurDauphinDe/battreDe/biterDe/borderDe/briderDe/butantDe/calerDe/cembreDe/chirerDe/ciderDe/clarerDe/corerDe/crireDe/cuplerDe/daleDe/ductifDe/esseDe/fensifDe/filerDe/frayerDe/gagerDe/givrerDe/glutirDe/graferDe/jeunerDe/liceDe/logerDemanderDemeurerDe/molirDe/nicherDe/nouerDentelleDe/nuderDe/partDe/penserDe/phaserDe/placerDe/poserDe/rangerDe/roberDe/sastreDescenteDe/sertDe/signerDe/sobe/irDessinerDestrierDe/tacherDe/testerDe/tourerDe/tresseDevancerDevenirDevinerDevoirDiableDialogueDiamantDicterDiffe/rerDige/rerDigitalDigneDiluerDimancheDiminuerDioxydeDirectifDirigerDiscuterDisposerDissiperDistanceDivertirDiviserDocileDocteurDogmeDoigtDomaineDomicileDompterDonateurDonjonDonnerDopamineDortoirDorureDosageDoseurDossierDotationDouanierDoubleDouceurDouterDoyenDragonDraperDresserDribblerDroitureDuperieDuplexeDurableDurcirDynastieE/blouirE/carterE/charpeE/chelleE/clairerE/clipseE/cloreE/cluseE/coleE/conomieE/corceE/couterE/craserE/cre/merE/crivainE/crouE/cumeE/cureuilE/difierE/duquerEffacerEffectifEffigieEffortEffrayerEffusionE/galiserE/garerE/jecterE/laborerE/largirE/lectronE/le/gantE/le/phantE/le-veE/ligibleE/litismeE/logeE/luciderE/luderEmballerEmbellirEmbryonE/meraudeE/missionEmmenerE/motionE/mouvoirEmpereurEmployerEmporterEmpriseE/mulsionEncadrerEnche-reEnclaveEncocheEndiguerEndosserEndroitEnduireE/nergieEnfanceEnfermerEnfouirEngagerEnginEngloberE/nigmeEnjamberEnjeuEnleverEnnemiEnnuyeuxEnrichirEnrobageEnseigneEntasserEntendreEntierEntourerEntraverE/nume/rerEnvahirEnviableEnvoyerEnzymeE/olienE/paissirE/pargneE/patantE/pauleE/picerieE/pide/mieE/pierE/pilogueE/pineE/pisodeE/pitapheE/poqueE/preuveE/prouverE/puisantE/querreE/quipeE/rigerE/rosionErreurE/ruptionEscalierEspadonEspe-ceEspie-gleEspoirEspritEsquiverEssayerEssenceEssieuEssorerEstimeEstomacEstradeE/tage-reE/talerE/tancheE/tatiqueE/teindreE/tendoirE/ternelE/thanolE/thiqueEthnieE/tirerE/tofferE/toileE/tonnantE/tourdirE/trangeE/troitE/tudeEuphorieE/valuerE/vasionE/ventailE/videnceE/viterE/volutifE/voquerExactExage/rerExaucerExcellerExcitantExclusifExcuseExe/cuterExempleExercerExhalerExhorterExigenceExilerExisterExotiqueExpe/dierExplorerExposerExprimerExquisExtensifExtraireExulterFableFabuleuxFacetteFacileFactureFaiblirFalaiseFameuxFamilleFarceurFarfeluFarineFaroucheFascinerFatalFatigueFauconFautifFaveurFavoriFe/brileFe/conderFe/de/rerFe/linFemmeFe/murFendoirFe/odalFermerFe/roceFerveurFestivalFeuilleFeutreFe/vrierFiascoFicelerFictifFide-leFigureFilatureFiletageFilie-reFilleulFilmerFilouFiltrerFinancerFinirFioleFirmeFissureFixerFlairerFlammeFlasqueFlatteurFle/auFle-cheFleurFlexionFloconFloreFluctuerFluideFluvialFolieFonderieFongibleFontaineForcerForgeronFormulerFortuneFossileFoudreFouge-reFouillerFoulureFourmiFragileFraiseFranchirFrapperFrayeurFre/gateFreinerFrelonFre/mirFre/ne/sieFre-reFriableFrictionFrissonFrivoleFroidFromageFrontalFrotterFruitFugitifFuiteFureurFurieuxFurtifFusionFuturGagnerGalaxieGalerieGambaderGarantirGardienGarnirGarrigueGazelleGazonGe/antGe/latineGe/luleGendarmeGe/ne/ralGe/nieGenouGentilGe/ologieGe/ome-treGe/raniumGermeGestuelGeyserGibierGiclerGirafeGivreGlaceGlaiveGlisserGlobeGloireGlorieuxGolfeurGommeGonflerGorgeGorilleGoudronGouffreGoulotGoupilleGourmandGoutteGraduelGraffitiGraineGrandGrappinGratuitGravirGrenatGriffureGrillerGrimperGrognerGronderGrotteGroupeGrugerGrutierGruye-reGue/pardGuerrierGuideGuimauveGuitareGustatifGymnasteGyrostatHabitudeHachoirHalteHameauHangarHannetonHaricotHarmonieHarponHasardHe/liumHe/matomeHerbeHe/rissonHermineHe/ronHe/siterHeureuxHibernerHibouHilarantHistoireHiverHomardHommageHomoge-neHonneurHonorerHonteuxHordeHorizonHorlogeHormoneHorribleHouleuxHousseHublotHuileuxHumainHumbleHumideHumourHurlerHydromelHygie-neHymneHypnoseIdylleIgnorerIguaneIlliciteIllusionImageImbiberImiterImmenseImmobileImmuableImpactImpe/rialImplorerImposerImprimerImputerIncarnerIncendieIncidentInclinerIncoloreIndexerIndiceInductifIne/ditIneptieInexactInfiniInfligerInformerInfusionInge/rerInhalerInhiberInjecterInjureInnocentInoculerInonderInscrireInsecteInsigneInsoliteInspirerInstinctInsulterIntactIntenseIntimeIntrigueIntuitifInutileInvasionInventerInviterInvoquerIroniqueIrradierIrre/elIrriterIsolerIvoireIvresseJaguarJaillirJambeJanvierJardinJaugerJauneJavelotJetableJetonJeudiJeunesseJoindreJoncherJonglerJoueurJouissifJournalJovialJoyauJoyeuxJubilerJugementJuniorJuponJuristeJusticeJuteuxJuve/nileKayakKimonoKiosqueLabelLabialLabourerLace/rerLactoseLaguneLaineLaisserLaitierLambeauLamelleLampeLanceurLangageLanterneLapinLargeurLarmeLaurierLavaboLavoirLectureLe/galLe/gerLe/gumeLessiveLettreLevierLexiqueLe/zardLiasseLibe/rerLibreLicenceLicorneLie-geLie-vreLigatureLigoterLigueLimerLimiteLimonadeLimpideLine/aireLingotLionceauLiquideLisie-reListerLithiumLitigeLittoralLivreurLogiqueLointainLoisirLombricLoterieLouerLourdLoutreLouveLoyalLubieLucideLucratifLueurLugubreLuisantLumie-reLunaireLundiLuronLutterLuxueuxMachineMagasinMagentaMagiqueMaigreMaillonMaintienMairieMaisonMajorerMalaxerMale/ficeMalheurMaliceMalletteMammouthMandaterManiableManquantManteauManuelMarathonMarbreMarchandMardiMaritimeMarqueurMarronMartelerMascotteMassifMate/rielMatie-reMatraqueMaudireMaussadeMauveMaximalMe/chantMe/connuMe/dailleMe/decinMe/diterMe/duseMeilleurMe/langeMe/lodieMembreMe/moireMenacerMenerMenhirMensongeMentorMercrediMe/riteMerleMessagerMesureMe/talMe/te/oreMe/thodeMe/tierMeubleMiaulerMicrobeMietteMignonMigrerMilieuMillionMimiqueMinceMine/ralMinimalMinorerMinuteMiracleMiroiterMissileMixteMobileModerneMoelleuxMondialMoniteurMonnaieMonotoneMonstreMontagneMonumentMoqueurMorceauMorsureMortierMoteurMotifMoucheMoufleMoulinMoussonMoutonMouvantMultipleMunitionMurailleMure-neMurmureMuscleMuse/umMusicienMutationMuterMutuelMyriadeMyrtilleMyste-reMythiqueNageurNappeNarquoisNarrerNatationNationNatureNaufrageNautiqueNavireNe/buleuxNectarNe/fasteNe/gationNe/gligerNe/gocierNeigeNerveuxNettoyerNeuroneNeutronNeveuNicheNickelNitrateNiveauNobleNocifNocturneNoirceurNoisetteNomadeNombreuxNommerNormatifNotableNotifierNotoireNourrirNouveauNovateurNovembreNoviceNuageNuancerNuireNuisibleNume/roNuptialNuqueNutritifObe/irObjectifObligerObscurObserverObstacleObtenirObturerOccasionOccuperOce/anOctobreOctroyerOctuplerOculaireOdeurOdorantOffenserOfficierOffrirOgiveOiseauOisillonOlfactifOlivierOmbrageOmettreOnctueuxOndulerOne/reuxOniriqueOpaleOpaqueOpe/rerOpinionOpportunOpprimerOpterOptiqueOrageuxOrangeOrbiteOrdonnerOreilleOrganeOrgueilOrificeOrnementOrqueOrtieOscillerOsmoseOssatureOtarieOuraganOursonOutilOutragerOuvrageOvationOxydeOxyge-neOzonePaisiblePalacePalmare-sPalourdePalperPanachePandaPangolinPaniquerPanneauPanoramaPantalonPapayePapierPapoterPapyrusParadoxeParcelleParesseParfumerParlerParoleParrainParsemerPartagerParureParvenirPassionPaste-quePaternelPatiencePatronPavillonPavoiserPayerPaysagePeignePeintrePelagePe/licanPellePelousePeluchePendulePe/ne/trerPe/niblePensifPe/nuriePe/pitePe/plumPerdrixPerforerPe/riodePermuterPerplexePersilPertePeserPe/talePetitPe/trirPeuplePharaonPhobiePhoquePhotonPhrasePhysiquePianoPicturalPie-cePierrePieuvrePilotePinceauPipettePiquerPiroguePiscinePistonPivoterPixelPizzaPlacardPlafondPlaisirPlanerPlaquePlastronPlateauPleurerPlexusPliagePlombPlongerPluiePlumagePochettePoe/siePoe-tePointePoirierPoissonPoivrePolairePolicierPollenPolygonePommadePompierPonctuelPonde/rerPoneyPortiquePositionPosse/derPosturePotagerPoteauPotionPoucePoulainPoumonPourprePoussinPouvoirPrairiePratiquePre/cieuxPre/direPre/fixePre/ludePre/nomPre/sencePre/textePre/voirPrimitifPrincePrisonPriverProble-meProce/derProdigeProfondProgre-sProieProjeterProloguePromenerPropreProspe-reProte/gerProuesseProverbePrudencePruneauPsychosePublicPuceronPuiserPulpePulsarPunaisePunitifPupitrePurifierPuzzlePyramideQuasarQuerelleQuestionQuie/tudeQuitterQuotientRacineRaconterRadieuxRagondinRaideurRaisinRalentirRallongeRamasserRapideRasageRatisserRavagerRavinRayonnerRe/actifRe/agirRe/aliserRe/animerRecevoirRe/citerRe/clamerRe/colterRecruterReculerRecyclerRe/digerRedouterRefaireRe/flexeRe/formerRefrainRefugeRe/galienRe/gionRe/glageRe/gulierRe/ite/rerRejeterRejouerRelatifReleverReliefRemarqueReme-deRemiseRemonterRemplirRemuerRenardRenfortReniflerRenoncerRentrerRenvoiReplierReporterRepriseReptileRequinRe/serveRe/sineuxRe/soudreRespectResterRe/sultatRe/tablirRetenirRe/ticuleRetomberRetracerRe/unionRe/ussirRevancheRevivreRe/volteRe/vulsifRichesseRideauRieurRigideRigolerRincerRiposterRisibleRisqueRituelRivalRivie-reRocheuxRomanceRompreRonceRondinRoseauRosierRotatifRotorRotuleRougeRouilleRouleauRoutineRoyaumeRubanRubisRucheRuelleRugueuxRuinerRuisseauRuserRustiqueRythmeSablerSaboterSabreSacocheSafariSagesseSaisirSaladeSaliveSalonSaluerSamediSanctionSanglierSarcasmeSardineSaturerSaugrenuSaumonSauterSauvageSavantSavonnerScalpelScandaleSce/le/ratSce/narioSceptreSche/maScienceScinderScoreScrutinSculpterSe/anceSe/cableSe/cherSecouerSe/cre/terSe/datifSe/duireSeigneurSe/jourSe/lectifSemaineSemblerSemenceSe/minalSe/nateurSensibleSentenceSe/parerSe/quenceSereinSergentSe/rieuxSerrureSe/rumServiceSe/sameSe/virSevrageSextupleSide/ralSie-cleSie/gerSifflerSigleSignalSilenceSiliciumSimpleSince-reSinistreSiphonSiropSismiqueSituerSkierSocialSocleSodiumSoigneuxSoldatSoleilSolitudeSolubleSombreSommeilSomnolerSondeSongeurSonnetteSonoreSorcierSortirSosieSottiseSoucieuxSoudureSouffleSouleverSoupapeSourceSoutirerSouvenirSpacieuxSpatialSpe/cialSphe-reSpiralStableStationSternumStimulusStipulerStrictStudieuxStupeurStylisteSublimeSubstratSubtilSubvenirSucce-sSucreSuffixeSugge/rerSuiveurSulfateSuperbeSupplierSurfaceSuricateSurmenerSurpriseSursautSurvieSuspectSyllabeSymboleSyme/trieSynapseSyntaxeSyste-meTabacTablierTactileTaillerTalentTalismanTalonnerTambourTamiserTangibleTapisTaquinerTarderTarifTartineTasseTatamiTatouageTaupeTaureauTaxerTe/moinTemporelTenailleTendreTeneurTenirTensionTerminerTerneTerribleTe/tineTexteThe-meThe/orieThe/rapieThoraxTibiaTie-deTimideTirelireTiroirTissuTitaneTitreTituberTobogganTole/rantTomateToniqueTonneauToponymeTorcheTordreTornadeTorpilleTorrentTorseTortueTotemToucherTournageTousserToxineTractionTraficTragiqueTrahirTrainTrancherTravailTre-fleTremperTre/sorTreuilTriageTribunalTricoterTrilogieTriompheTriplerTriturerTrivialTromboneTroncTropicalTroupeauTuileTulipeTumulteTunnelTurbineTuteurTutoyerTuyauTympanTyphonTypiqueTyranUbuesqueUltimeUltrasonUnanimeUnifierUnionUniqueUnitaireUniversUraniumUrbainUrticantUsageUsineUsuelUsureUtileUtopieVacarmeVaccinVagabondVagueVaillantVaincreVaisseauValableValiseVallonValveVampireVanilleVapeurVarierVaseuxVassalVasteVecteurVedetteVe/ge/talVe/hiculeVeinardVe/loceVendrediVe/ne/rerVengerVenimeuxVentouseVerdureVe/rinVernirVerrouVerserVertuVestonVe/te/ranVe/tusteVexantVexerViaducViandeVictoireVidangeVide/oVignetteVigueurVilainVillageVinaigreViolonVipe-reVirementVirtuoseVirusVisageViseurVisionVisqueuxVisuelVitalVitesseViticoleVitrineVivaceVivipareVocationVoguerVoileVoisinVoitureVolailleVolcanVoltigerVolumeVoraceVortexVoterVouloirVoyageVoyelleWagonXe/nonYachtZe-breZe/nithZesteZoologie"; + var wordlist = null; + var lookup = {}; + function dropDiacritic(word) { + wordlist_1.logger.checkNormalize(); + return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word.normalize("NFD").toLowerCase()), function(c) { + return c >= 65 && c <= 90 || c >= 97 && c <= 123; + })); + } + function expand(word) { + var output = []; + Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word), function(c) { + if (c === 47) { + output.push(204); + output.push(129); + } else if (c === 45) { + output.push(204); + output.push(128); + } else { + output.push(c); + } + }); + return (0, strings_1.toUtf8String)(output); + } + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) { + return expand(w); + }); + wordlist.forEach(function(word, index) { + lookup[dropDiacritic(word)] = index; + }); + if (wordlist_1.Wordlist.check(lang) !== "0x51deb7ae009149dc61a6bd18a918eb7ac78d2775726c68e598b92d002519b045") { + wordlist = null; + throw new Error("BIP39 Wordlist for fr (French) FAILED"); + } + } + var LangFr = ( + /** @class */ + function(_super) { + __extends(LangFr2, _super); + function LangFr2() { + return _super.call(this, "fr") || this; + } + LangFr2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangFr2.prototype.getWordIndex = function(word) { + loadWords(this); + return lookup[dropDiacritic(word)]; + }; + return LangFr2; + }(wordlist_1.Wordlist) + ); + var langFr = new LangFr(); + exports2.langFr = langFr; + wordlist_1.Wordlist.register(langFr); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-ja.js +var require_lang_ja = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-ja.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langJa = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = [ + // 4-kana words + "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgBQhBQhCQuFQmXQiDQUFQZDQsFQdRQkHQbRQlOQlmQPDQjDQwXQMBQMDQcFQTBQTHQrDDXQDNFDGBDGQDGRDpFDhFDmXDZXDbRDMYDRdDTRDrXSAhSBCSBrSGQSEQSHBSVRShYShkSyQSuFSiBSdcSoESocSlmSMBSFBSFKSFNSFdSFcCByCaRCKcCSBCSRCCrCGbCEHCYXCpBCpQCIBCIHCeNCgBCgFCVECVcCmkCmwCZXCZFCdRClOClmClFCjDCjdCnXCwBCwXCcRCFQCFjGXhGNhGDEGDMGCDGCHGIFGgBGVXGVEGVRGmXGsXGdYGoSGbRGnXGwXGwDGWRGFNGFLGFOGFdGFkEABEBDEBFEXOEaBEKSENBENDEYXEIgEIkEgBEgQEgHEhFEudEuFEiBEiHEiFEZDEvBEsXEsFEdXEdREkFEbBEbRElFEPCEfkEFNYAEYAhYBNYQdYDXYSRYCEYYoYgQYgRYuRYmCYZTYdBYbEYlXYjQYRbYWRpKXpQopQnpSFpCXpIBpISphNpdBpdRpbRpcZpFBpFNpFDpFopFrLADLBuLXQLXcLaFLCXLEhLpBLpFLHXLeVLhILdHLdRLoDLbRLrXIABIBQIBCIBsIBoIBMIBRIXaIaRIKYIKRINBINuICDIGBIIDIIkIgRIxFIyQIiHIdRIbYIbRIlHIwRIMYIcRIRVITRIFBIFNIFQOABOAFOBQOaFONBONMOQFOSFOCDOGBOEQOpBOLXOIBOIFOgQOgFOyQOycOmXOsXOdIOkHOMEOMkOWWHBNHXNHXWHNXHDuHDRHSuHSRHHoHhkHmRHdRHkQHlcHlRHwBHWcgAEgAggAkgBNgBQgBEgXOgYcgLXgHjgyQgiBgsFgdagMYgWSgFQgFEVBTVXEVKBVKNVKDVKYVKRVNBVNYVDBVDxVSBVSRVCjVGNVLXVIFVhBVhcVsXVdRVbRVlRhBYhKYhDYhGShxWhmNhdahdkhbRhjohMXhTRxAXxXSxKBxNBxEQxeNxeQxhXxsFxdbxlHxjcxFBxFNxFQxFOxFoyNYyYoybcyMYuBQuBRuBruDMuCouHBudQukkuoBulVuMXuFEmCYmCRmpRmeDmiMmjdmTFmFQiADiBOiaRiKRiNBiNRiSFiGkiGFiERipRiLFiIFihYibHijBijEiMXiWBiFBiFCUBQUXFUaRUNDUNcUNRUNFUDBUSHUCDUGBUGFUEqULNULoUIRUeEUeYUgBUhFUuRUiFUsXUdFUkHUbBUjSUjYUwXUMDUcHURdUTBUrBUrXUrQZAFZXZZaRZKFZNBZQFZCXZGBZYdZpBZLDZIFZHXZHNZeQZVRZVFZmXZiBZvFZdFZkFZbHZbFZwXZcCZcRZRBvBQvBGvBLvBWvCovMYsAFsBDsaRsKFsNFsDrsSHsSFsCXsCRsEBsEHsEfspBsLBsLDsIgsIRseGsbRsFBsFQsFSdNBdSRdCVdGHdYDdHcdVbdySduDdsXdlRdwXdWYdWcdWRkBMkXOkaRkNIkNFkSFkCFkYBkpRkeNkgBkhVkmXksFklVkMBkWDkFNoBNoaQoaFoNBoNXoNaoNEoSRoEroYXoYCoYbopRopFomXojkowXorFbBEbEIbdBbjYlaRlDElMXlFDjKjjSRjGBjYBjYkjpRjLXjIBjOFjeVjbRjwBnXQnSHnpFnLXnINnMBnTRwXBwXNwXYwNFwQFwSBwGFwLXwLDweNwgBwuHwjDwnXMBXMpFMIBMeNMTHcaQcNBcDHcSFcCXcpBcLXcLDcgFcuFcnXcwXccDcTQcrFTQErXNrCHrpFrgFrbFrTHrFcWNYWNbWEHWMXWTR", + // 5-kana words + "ABGHABIJAEAVAYJQALZJAIaRAHNXAHdcAHbRAZJMAZJRAZTRAdVJAklmAbcNAjdRAMnRAMWYAWpRAWgRAFgBAFhBAFdcBNJBBNJDBQKBBQhcBQlmBDEJBYJkBYJTBpNBBpJFBIJBBIJDBIcABOKXBOEJBOVJBOiJBOZJBepBBeLXBeIFBegBBgGJBVJXBuocBiJRBUJQBlXVBlITBwNFBMYVBcqXBTlmBWNFBWiJBWnRBFGHBFwXXKGJXNJBXNZJXDTTXSHSXSVRXSlHXCJDXGQJXEhXXYQJXYbRXOfXXeNcXVJFXhQJXhEJXdTRXjdXXMhBXcQTXRGBXTEBXTnQXFCXXFOFXFgFaBaFaBNJaBCJaBpBaBwXaNJKaNJDaQIBaDpRaEPDaHMFamDJalEJaMZJaFaFaFNBaFQJaFLDaFVHKBCYKBEBKBHDKXaFKXGdKXEJKXpHKXIBKXZDKXwXKKwLKNacKNYJKNJoKNWcKDGdKDTRKChXKGaRKGhBKGbRKEBTKEaRKEPTKLMDKLWRKOHDKVJcKdBcKlIBKlOPKFSBKFEPKFpFNBNJNJBQNBGHNBEPNBHXNBgFNBVXNBZDNBsXNBwXNNaRNNJDNNJENNJkNDCJNDVDNGJRNJiDNZJNNsCJNJFNNFSBNFCXNFEPNFLXNFIFQJBFQCaRQJEQQLJDQLJFQIaRQOqXQHaFQHHQQVJXQVJDQhNJQmEIQZJFQsJXQJrFQWbRDJABDBYJDXNFDXCXDXLXDXZDDXsJDQqXDSJFDJCXDEPkDEqXDYmQDpSJDOCkDOGQDHEIDVJDDuDuDWEBDJFgSBNDSBSFSBGHSBIBSBTQSKVYSJQNSJQiSJCXSEqXSJYVSIiJSOMYSHAHSHaQSeCFSepQSegBSHdHSHrFShSJSJuHSJUFSkNRSrSrSWEBSFaHSJFQSFCXSFGDSFYXSFODSFgBSFVXSFhBSFxFSFkFSFbBSFMFCADdCJXBCXaFCXKFCXNFCXCXCXGBCXEJCXYBCXLDCXIBCXOPCXHXCXgBCXhBCXiBCXlDCXcHCJNBCJNFCDCJCDGBCDVXCDhBCDiDCDJdCCmNCpJFCIaRCOqXCHCHCHZJCViJCuCuCmddCJiFCdNBCdHhClEJCnUJCreSCWlgCWTRCFBFCFNBCFYBCFVFCFhFCFdSCFTBCFWDGBNBGBQFGJBCGBEqGBpBGBgQGNBEGNJYGNkOGNJRGDUFGJpQGHaBGJeNGJeEGVBlGVKjGiJDGvJHGsVJGkEBGMIJGWjNGFBFGFCXGFGBGFYXGFpBGFMFEASJEAWpEJNFECJVEIXSEIQJEOqXEOcFEeNcEHEJEHlFEJgFEhlmEmDJEmZJEiMBEUqXEoSREPBFEPXFEPKFEPSFEPEFEPpFEPLXEPIBEJPdEPcFEPTBEJnXEqlHEMpREFCXEFODEFcFYASJYJAFYBaBYBVXYXpFYDhBYCJBYJGFYYbRYeNcYJeVYiIJYZJcYvJgYvJRYJsXYsJFYMYMYreVpBNHpBEJpBwXpQxFpYEJpeNDpJeDpeSFpeCHpHUJpHbBpHcHpmUJpiiJpUJrpsJuplITpFaBpFQqpFGBpFEfpFYBpFpBpFLJpFIDpFgBpFVXpFyQpFuFpFlFpFjDpFnXpFwXpJFMpFTBLXCJLXEFLXhFLXUJLXbFLalmLNJBLSJQLCLCLGJBLLDJLHaFLeNFLeSHLeCXLepFLhaRLZsJLsJDLsJrLocaLlLlLMdbLFNBLFSBLFEHLFkFIBBFIBXFIBaQIBKXIBSFIBpHIBLXIBgBIBhBIBuHIBmXIBiFIBZXIBvFIBbFIBjQIBwXIBWFIKTRIQUJIDGFICjQIYSRIINXIJeCIVaRImEkIZJFIvJRIsJXIdCJIJoRIbBQIjYBIcqXITFVIreVIFKFIFSFIFCJIFGFIFLDIFIBIJFOIFgBIFVXIJFhIFxFIFmXIFdHIFbBIJFrIJFWOBGBOQfXOOKjOUqXOfXBOqXEOcqXORVJOFIBOFlDHBIOHXiFHNTRHCJXHIaRHHJDHHEJHVbRHZJYHbIBHRsJHRkDHWlmgBKFgBSBgBCDgBGHgBpBgBIBgBVJgBuBgBvFgKDTgQVXgDUJgGSJgOqXgmUMgZIJgTUJgWIEgFBFgFNBgFDJgFSFgFGBgFYXgJFOgFgQgFVXgFhBgFbHgJFWVJABVQKcVDgFVOfXVeDFVhaRVmGdViJYVMaRVFNHhBNDhBCXhBEqhBpFhBLXhNJBhSJRheVXhhKEhxlmhZIJhdBQhkIJhbMNhMUJhMZJxNJgxQUJxDEkxDdFxSJRxplmxeSBxeCXxeGFxeYXxepQxegBxWVcxFEQxFLXxFIBxFgBxFxDxFZtxFdcxFbBxFwXyDJXyDlcuASJuDJpuDIBuCpJuGSJuIJFueEFuZIJusJXudWEuoIBuWGJuFBcuFKEuFNFuFQFuFDJuFGJuFVJuFUtuFdHuFTBmBYJmNJYmQhkmLJDmLJomIdXmiJYmvJRmsJRmklmmMBymMuCmclmmcnQiJABiJBNiJBDiBSFiBCJiBEFiBYBiBpFiBLXiBTHiJNciDEfiCZJiECJiJEqiOkHiHKFieNDiHJQieQcieDHieSFieCXieGFieEFieIHiegFihUJixNoioNXiFaBiFKFiFNDiFEPiFYXitFOitFHiFgBiFVEiFmXiFitiFbBiFMFiFrFUCXQUIoQUIJcUHQJUeCEUHwXUUJDUUqXUdWcUcqXUrnQUFNDUFSHUFCFUFEfUFLXUtFOZBXOZXSBZXpFZXVXZEQJZEJkZpDJZOqXZeNHZeCDZUqXZFBQZFEHZFLXvBAFvBKFvBCXvBEPvBpHvBIDvBgFvBuHvQNJvFNFvFGBvFIBvJFcsXCDsXLXsXsXsXlFsXcHsQqXsJQFsEqXseIFsFEHsFjDdBxOdNpRdNJRdEJbdpJRdhZJdnSJdrjNdFNJdFQHdFhNkNJDkYaRkHNRkHSRkVbRkuMRkjSJkcqDoSJFoEiJoYZJoOfXohEBoMGQocqXbBAFbBXFbBaFbBNDbBGBbBLXbBTBbBWDbGJYbIJHbFQqbFpQlDgQlOrFlVJRjGEBjZJRnXvJnXbBnEfHnOPDngJRnxfXnUJWwXEJwNpJwDpBwEfXwrEBMDCJMDGHMDIJMLJDcQGDcQpHcqXccqNFcqCXcFCJRBSBRBGBRBEJRBpQTBNFTBQJTBpBTBVXTFABTFSBTFCFTFGBTFMDrXCJrXLDrDNJrEfHrFQJrFitWNjdWNTR", + // 6-kana words + "AKLJMANOPFASNJIAEJWXAYJNRAIIbRAIcdaAeEfDAgidRAdjNYAMYEJAMIbRAFNJBAFpJFBBIJYBDZJFBSiJhBGdEBBEJfXBEJqXBEJWRBpaUJBLXrXBIYJMBOcfXBeEfFBestXBjNJRBcDJOBFEqXXNvJRXDMBhXCJNYXOAWpXONJWXHDEBXeIaRXhYJDXZJSJXMDJOXcASJXFVJXaBQqXaBZJFasXdQaFSJQaFEfXaFpJHaFOqXKBNSRKXvJBKQJhXKEJQJKEJGFKINJBKIJjNKgJNSKVElmKVhEBKiJGFKlBgJKjnUJKwsJYKMFIJKFNJDKFIJFKFOfXNJBSFNJBCXNBpJFNJBvQNJBMBNJLJXNJOqXNJeCXNJeGFNdsJCNbTKFNwXUJQNFEPQDiJcQDMSJQSFpBQGMQJQJeOcQyCJEQUJEBQJFBrQFEJqDXDJFDJXpBDJXIMDGiJhDIJGRDJeYcDHrDJDVXgFDkAWpDkIgRDjDEqDMvJRDJFNFDJFIBSKclmSJQOFSJQVHSJQjDSJGJBSJGJFSECJoSHEJqSJHTBSJVJDSViJYSZJNBSJsJDSFSJFSFEfXSJFLXCBUJVCJXSBCJXpBCXVJXCJXsXCJXdFCJNJHCLIJgCHiJFCVNJMChCJhCUHEJCsJTRCJdYcCoQJCCFEfXCFIJgCFUJxCFstFGJBaQGJBIDGQJqXGYJNRGJHKFGeQqDGHEJFGJeLXGHIiJGHdBlGUJEBGkIJTGFQPDGJFEqEAGegEJIJBEJVJXEhQJTEiJNcEJZJFEJoEqEjDEqEPDsXEPGJBEPOqXEPeQFEfDiDEJfEFEfepQEfMiJEqXNBEqDIDEqeSFEqVJXEMvJRYXNJDYXEJHYKVJcYYJEBYJeEcYJUqXYFpJFYFstXpAZJMpBSJFpNBNFpeQPDpHLJDpHIJFpHgJFpeitFpHZJFpJFADpFSJFpJFCJpFOqXpFitBpJFZJLXIJFLIJgRLVNJWLVHJMLwNpJLFGJBLFLJDLFOqXLJFUJIBDJXIBGJBIJBYQIJBIBIBOqXIBcqDIEGJFILNJTIIJEBIOiJhIJeNBIJeIBIhiJIIWoTRIJFAHIJFpBIJFuHIFUtFIJFTHOSBYJOEcqXOHEJqOvBpFOkVJrObBVJOncqDOcNJkHhNJRHuHJuHdMhBgBUqXgBsJXgONJBgHNJDgHHJQgJeitgHsJXgJyNagyDJBgZJDrgsVJQgkEJNgkjSJgJFAHgFCJDgFZtMVJXNFVXQfXVJXDJVXoQJVQVJQVDEfXVDvJHVEqNFVeQfXVHpJFVHxfXVVJSRVVmaRVlIJOhCXVJhHjYkhxCJVhWVUJhWiJcxBNJIxeEqDxfXBFxcFEPxFSJFxFYJXyBDQJydaUJyFOPDuYCJYuLvJRuHLJXuZJLDuFOPDuFZJHuFcqXmKHJdmCQJcmOsVJiJAGFitLCFieOfXiestXiZJMEikNJQirXzFiFQqXiFIJFiFZJFiFvtFUHpJFUteIcUteOcUVCJkUhdHcUbEJEUJqXQUMNJhURjYkUFitFZDGJHZJIxDZJVJXZJFDJZJFpQvBNJBvBSJFvJxBrseQqDsVFVJdFLJDkEJNBkmNJYkFLJDoQJOPoGsJRoEAHBoEJfFbBQqDbBZJHbFVJXlFIJBjYIrXjeitcjjCEBjWMNBwXQfXwXOaFwDsJXwCJTRwrCZJMDNJQcDDJFcqDOPRYiJFTBsJXTQIJBTFEfXTFLJDrXEJFrEJXMrFZJFWEJdEWYTlm", + // 7-kana words + "ABCDEFACNJTRAMBDJdAcNJVXBLNJEBXSIdWRXErNJkXYDJMBXZJCJaXMNJaYKKVJKcKDEJqXKDcNJhKVJrNYKbgJVXKFVJSBNBYBwDNJeQfXNJeEqXNhGJWENJFiJRQlIJbEQJfXxDQqXcfXQFNDEJQFwXUJDYcnUJDJIBgQDIUJTRDJFEqDSJQSJFSJQIJFSOPeZtSJFZJHCJXQfXCTDEqFGJBSJFGJBOfXGJBcqXGJHNJDGJRLiJEJfXEqEJFEJPEFpBEJYJBZJFYBwXUJYiJMEBYJZJyTYTONJXpQMFXFpeGIDdpJFstXpJFcPDLBVSJRLHQJqXLJFZJFIJBNJDIJBUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", + // 8-kana words + "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", + // 9-kana words + "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", + // 10-kana words + "IJBEJqXZJ" + ]; + var mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; + var wordlist = null; + function hex(word) { + return (0, bytes_1.hexlify)((0, strings_1.toUtf8Bytes)(word)); + } + var KiYoKu = "0xe3818de38284e3818f"; + var KyoKu = "0xe3818de38283e3818f"; + function loadWords(lang) { + if (wordlist !== null) { + return; + } + wordlist = []; + var transform = {}; + transform[(0, strings_1.toUtf8String)([227, 130, 154])] = false; + transform[(0, strings_1.toUtf8String)([227, 130, 153])] = false; + transform[(0, strings_1.toUtf8String)([227, 130, 133])] = (0, strings_1.toUtf8String)([227, 130, 134]); + transform[(0, strings_1.toUtf8String)([227, 129, 163])] = (0, strings_1.toUtf8String)([227, 129, 164]); + transform[(0, strings_1.toUtf8String)([227, 130, 131])] = (0, strings_1.toUtf8String)([227, 130, 132]); + transform[(0, strings_1.toUtf8String)([227, 130, 135])] = (0, strings_1.toUtf8String)([227, 130, 136]); + function normalize(word2) { + var result = ""; + for (var i2 = 0; i2 < word2.length; i2++) { + var kana = word2[i2]; + var target = transform[kana]; + if (target === false) { + continue; + } + if (target) { + kana = target; + } + result += kana; + } + return result; + } + function sortJapanese(a, b) { + a = normalize(a); + b = normalize(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + for (var length_1 = 3; length_1 <= 9; length_1++) { + var d = data[length_1 - 3]; + for (var offset = 0; offset < d.length; offset += length_1) { + var word = []; + for (var i = 0; i < length_1; i++) { + var k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push(k & 64 ? 130 : 129); + word.push((k & 63) + 128); + } + wordlist.push((0, strings_1.toUtf8String)(word)); + } + } + wordlist.sort(sortJapanese); + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + var tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + if (wordlist_1.Wordlist.check(lang) !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + wordlist = null; + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + } + var LangJa = ( + /** @class */ + function(_super) { + __extends(LangJa2, _super); + function LangJa2() { + return _super.call(this, "ja") || this; + } + LangJa2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangJa2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + LangJa2.prototype.split = function(mnemonic) { + wordlist_1.logger.checkNormalize(); + return mnemonic.split(/(?:\u3000| )+/g); + }; + LangJa2.prototype.join = function(words) { + return words.join("\u3000"); + }; + return LangJa2; + }(wordlist_1.Wordlist) + ); + var langJa = new LangJa(); + exports2.langJa = langJa; + wordlist_1.Wordlist.register(langJa); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-ko.js +var require_lang_ko = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-ko.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langKo = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeAgrDUAgrJTAhrFnAhrLjAhrQgAjAgoAjJnrAkMX8AkOnoAlCTvAlCV8AlClvAlFg4AlFl6AlFn3AloSnAlrAXAlrAfAlrFUAlrFbAlrGgAlrOXAlvKnAlvMTAl3AbAl3MnAnATrAnAcrAnCZ3AnCl8AnDg8AnFboAnFl3AnHX4AnHbrAnHgrAnIl3AnJgvAnLXoAnLX4AnLbrAnLgrAnLhrAnMXoAnMgrAnOn3AnSbrAnSeoAnvLnAn3OnCTGgvCTSlvCTvAUCTvKnCTvNTCT3CZCT3GUCT3MTCT8HnCUCZrCULf8CULnvCU3HnCU3JUCY6NUCbDb8CbFZoCbLnrCboOTCboScCbrFnCbvLnCb8AgCb8HgCb$LnCkLfoClBn3CloDUDTHT8DTLl3DTSU8DTrAaDTrLXDTrLjDTrOYDTrOgDTvFXDTvFnDT3HUDT3LfDUCT9DUDT4DUFVoDUFV8DUFkoDUGgrDUJnrDULl8DUMT8DUMXrDUMX4DUMg8DUOUoDUOgvDUOg8DUSToDUSZ8DbDXoDbDgoDbGT8DbJn3DbLg3DbLn4DbMXrDbMg8DbOToDboJXGTClvGTDT8GTFZrGTLVoGTLlvGTLl3GTMg8GTOTvGTSlrGToCUGTrDgGTrJYGTrScGTtLnGTvAnGTvQgGUCZrGUDTvGUFZoGUHXrGULnvGUMT8GUoMgGXoLnGXrMXGXrMnGXvFnGYLnvGZOnvGZvOnGZ8LaGZ8LmGbAl3GbDYvGbDlrGbHX3GbJl4GbLV8GbLn3GbMn4GboJTGboRfGbvFUGb3GUGb4JnGgDX3GgFl$GgJlrGgLX6GgLZoGgLf8GgOXoGgrAgGgrJXGgrMYGgrScGgvATGgvOYGnAgoGnJgvGnLZoGnLg3GnLnrGnQn8GnSbrGnrMgHTClvHTDToHTFT3HTQT8HToJTHToJgHTrDUHTrMnHTvFYHTvRfHT8MnHT8SUHUAZ8HUBb4HUDTvHUoMYHXFl6HXJX6HXQlrHXrAUHXrMnHXrSbHXvFYHXvKXHX3LjHX3MeHYvQlHZrScHZvDbHbAcrHbFT3HbFl3HbJT8HbLTrHbMT8HbMXrHbMbrHbQb8HbSX3HboDbHboJTHbrFUHbrHgHbrJTHb8JTHb8MnHb8QgHgAlrHgDT3HgGgrHgHgrHgJTrHgJT8HgLX@HgLnrHgMT8HgMX8HgMboHgOnrHgQToHgRg3HgoHgHgrCbHgrFnHgrLVHgvAcHgvAfHnAloHnCTrHnCnvHnGTrHnGZ8HnGnvHnJT8HnLf8HnLkvHnMg8HnRTrITvFUITvFnJTAXrJTCV8JTFT3JTFT8JTFn4JTGgvJTHT8JTJT8JTJXvJTJl3JTJnvJTLX4JTLf8JTLhvJTMT8JTMXrJTMnrJTObrJTQT8JTSlvJT8DUJT8FkJT8MTJT8OXJT8OgJT8QUJT8RfJUHZoJXFT4JXFlrJXGZ8JXGnrJXLV8JXLgvJXMXoJXMX3JXNboJXPlvJXoJTJXoLkJXrAXJXrHUJXrJgJXvJTJXvOnJX4KnJYAl3JYJT8JYLhvJYQToJYrQXJY6NUJbAl3JbCZrJbDloJbGT8JbGgrJbJXvJbJboJbLf8JbLhrJbLl3JbMnvJbRg8JbSZ8JboDbJbrCZJbrSUJb3KnJb8LnJfRn8JgAXrJgCZrJgDTrJgGZrJgGZ8JgHToJgJT8JgJXoJgJgvJgLX4JgLZ3JgLZ8JgLn4JgMgrJgMn4JgOgvJgPX6JgRnvJgSToJgoCZJgoJbJgoMYJgrJXJgrJgJgrLjJg6MTJlCn3JlGgvJlJl8Jl4AnJl8FnJl8HgJnAToJnATrJnAbvJnDUoJnGnrJnJXrJnJXvJnLhvJnLnrJnLnvJnMToJnMT8JnMXvJnMX3JnMg8JnMlrJnMn4JnOX8JnST4JnSX3JnoAgJnoAnJnoJTJnoObJnrAbJnrAkJnrHnJnrJTJnrJYJnrOYJnrScJnvCUJnvFaJnvJgJnvJnJnvOYJnvQUJnvRUJn3FnJn3JTKnFl3KnLT6LTDlvLTMnoLTOn3LTRl3LTSb4LTSlrLToAnLToJgLTrAULTrAcLTrCULTrHgLTrMgLT3JnLULnrLUMX8LUoJgLVATrLVDTrLVLb8LVoJgLV8MgLV8RTLXDg3LXFlrLXrCnLXrLXLX3GTLX4GgLX4OYLZAXrLZAcrLZAgrLZAhrLZDXyLZDlrLZFbrLZFl3LZJX6LZJX8LZLc8LZLnrLZSU8LZoJTLZoJnLZrAgLZrAnLZrJYLZrLULZrMgLZrSkLZvAnLZvGULZvJeLZvOTLZ3FZLZ4JXLZ8STLZ8ScLaAT3LaAl3LaHT8LaJTrLaJT8LaJXrLaJgvLaJl4LaLVoLaMXrLaMXvLaMX8LbClvLbFToLbHlrLbJn4LbLZ3LbLhvLbMXrLbMnoLbvSULcLnrLc8HnLc8MTLdrMnLeAgoLeOgvLeOn3LfAl3LfLnvLfMl3LfOX8Lf8AnLf8JXLf8LXLgJTrLgJXrLgJl8LgMX8LgRZrLhCToLhrAbLhrFULhrJXLhvJYLjHTrLjHX4LjJX8LjLhrLjSX3LjSZ4LkFX4LkGZ8LkGgvLkJTrLkMXoLkSToLkSU8LkSZ8LkoOYLl3FfLl3MgLmAZrLmCbrLmGgrLmHboLmJnoLmJn3LmLfoLmLhrLmSToLnAX6LnAb6LnCZ3LnCb3LnDTvLnDb8LnFl3LnGnrLnHZvLnHgvLnITvLnJT8LnJX8LnJlvLnLf8LnLg6LnLhvLnLnoLnMXrLnMg8LnQlvLnSbrLnrAgLnrAnLnrDbLnrFkLnrJdLnrMULnrOYLnrSTLnvAnLnvDULnvHgLnvOYLnvOnLn3GgLn4DULn4JTLn4JnMTAZoMTAloMTDb8MTFT8MTJnoMTJnrMTLZrMTLhrMTLkvMTMX8MTRTrMToATMTrDnMTrOnMT3JnMT4MnMT8FUMT8FaMT8FlMT8GTMT8GbMT8GnMT8HnMT8JTMT8JbMT8OTMUCl8MUJTrMUJU8MUMX8MURTrMUSToMXAX6MXAb6MXCZoMXFXrMXHXrMXLgvMXOgoMXrAUMXrAnMXrHgMXrJYMXrJnMXrMTMXrMgMXrOYMXrSZMXrSgMXvDUMXvOTMX3JgMX3OTMX4JnMX8DbMX8FnMX8HbMX8HgMX8HnMX8LbMX8MnMX8OnMYAb8MYGboMYHTvMYHX4MYLTrMYLnvMYMToMYOgvMYRg3MYSTrMbAToMbAXrMbAl3MbAn8MbGZ8MbJT8MbJXrMbMXvMbMX8MbMnoMbrMUMb8AfMb8FbMb8FkMcJXoMeLnrMgFl3MgGTvMgGXoMgGgrMgGnrMgHT8MgHZrMgJnoMgLnrMgLnvMgMT8MgQUoMgrHnMgvAnMg8HgMg8JYMg8LfMloJnMl8ATMl8AXMl8JYMnAToMnAT4MnAZ8MnAl3MnAl4MnCl8MnHT8MnHg8MnJnoMnLZoMnLhrMnMXoMnMX3MnMnrMnOgvMnrFbMnrFfMnrFnMnrNTMnvJXNTMl8OTCT3OTFV8OTFn3OTHZvOTJXrOTOl3OT3ATOT3JUOT3LZOT3LeOT3MbOT8ATOT8AbOT8AgOT8MbOUCXvOUMX3OXHXvOXLl3OXrMUOXvDbOX6NUOX8JbOYFZoOYLbrOYLkoOYMg8OYSX3ObHTrObHT4ObJgrObLhrObMX3ObOX8Ob8FnOeAlrOeJT8OeJXrOeJnrOeLToOeMb8OgJXoOgLXoOgMnrOgOXrOgOloOgoAgOgoJbOgoMYOgoSTOg8AbOjLX4OjMnoOjSV8OnLVoOnrAgOn3DUPXQlrPXvFXPbvFTPdAT3PlFn3PnvFbQTLn4QToAgQToMTQULV8QURg8QUoJnQXCXvQbFbrQb8AaQb8AcQb8FbQb8MYQb8ScQeAlrQeLhrQjAn3QlFXoQloJgQloSnRTLnvRTrGURTrJTRUJZrRUoJlRUrQnRZrLmRZrMnRZrSnRZ8ATRZ8JbRZ8ScRbMT8RbST3RfGZrRfMX8RfMgrRfSZrRnAbrRnGT8RnvJgRnvLfRnvMTRn8AaSTClvSTJgrSTOXrSTRg3STRnvSToAcSToAfSToAnSToHnSToLjSToMTSTrAaSTrEUST3BYST8AgST8LmSUAZvSUAgrSUDT4SUDT8SUGgvSUJXoSUJXvSULTrSU8JTSU8LjSV8AnSV8JgSXFToSXLf8SYvAnSZrDUSZrMUSZrMnSZ8HgSZ8JTSZ8JgSZ8MYSZ8QUSaQUoSbCT3SbHToSbQYvSbSl4SboJnSbvFbSb8HbSb8JgSb8OTScGZrScHgrScJTvScMT8ScSToScoHbScrMTScvAnSeAZrSeAcrSeHboSeJUoSeLhrSeMT8SeMXrSe6JgSgHTrSkJnoSkLnvSk8CUSlFl3SlrSnSl8GnSmAboSmGT8SmJU8", + "ATLnDlATrAZoATrJX4ATrMT8ATrMX4ATrRTrATvDl8ATvJUoATvMl8AT3AToAT3MX8AT8CT3AT8DT8AT8HZrAT8HgoAUAgFnAUCTFnAXoMX8AXrAT8AXrGgvAXrJXvAXrOgoAXvLl3AZvAgoAZvFbrAZvJXoAZvJl8AZvJn3AZvMX8AZvSbrAZ8FZoAZ8LZ8AZ8MU8AZ8OTvAZ8SV8AZ8SX3AbAgFZAboJnoAbvGboAb8ATrAb8AZoAb8AgrAb8Al4Ab8Db8Ab8JnoAb8LX4Ab8LZrAb8LhrAb8MT8Ab8OUoAb8Qb8Ab8ST8AcrAUoAcrAc8AcrCZ3AcrFT3AcrFZrAcrJl4AcrJn3AcrMX3AcrOTvAc8AZ8Ac8MT8AfAcJXAgoFn4AgoGgvAgoGnrAgoLc8AgoMXoAgrLnrAkrSZ8AlFXCTAloHboAlrHbrAlrLhrAlrLkoAl3CZrAl3LUoAl3LZrAnrAl4AnrMT8An3HT4BT3IToBX4MnvBb!Ln$CTGXMnCToLZ4CTrHT8CT3JTrCT3RZrCT#GTvCU6GgvCU8Db8CU8GZrCU8HT8CboLl3CbrGgrCbrMU8Cb8DT3Cb8GnrCb8LX4Cb8MT8Cb8ObrCgrGgvCgrKX4Cl8FZoDTrAbvDTrDboDTrGT6DTrJgrDTrMX3DTrRZrDTrRg8DTvAVvDTvFZoDT3DT8DT3Ln3DT4HZrDT4MT8DT8AlrDT8MT8DUAkGbDUDbJnDYLnQlDbDUOYDbMTAnDbMXSnDboAT3DboFn4DboLnvDj6JTrGTCgFTGTGgFnGTJTMnGTLnPlGToJT8GTrCT3GTrLVoGTrLnvGTrMX3GTrMboGTvKl3GZClFnGZrDT3GZ8DTrGZ8FZ8GZ8MXvGZ8On8GZ8ST3GbCnQXGbMbFnGboFboGboJg3GboMXoGb3JTvGb3JboGb3Mn6Gb3Qb8GgDXLjGgMnAUGgrDloGgrHX4GgrSToGgvAXrGgvAZvGgvFbrGgvLl3GgvMnvGnDnLXGnrATrGnrMboGnuLl3HTATMnHTAgCnHTCTCTHTrGTvHTrHTvHTrJX8HTrLl8HTrMT8HTrMgoHTrOTrHTuOn3HTvAZrHTvDTvHTvGboHTvJU8HTvLl3HTvMXrHTvQb4HT4GT6HT4JT8HT4Jb#HT8Al3HT8GZrHT8GgrHT8HX4HT8Jb8HT8JnoHT8LTrHT8LgvHT8SToHT8SV8HUoJUoHUoJX8HUoLnrHXrLZoHXvAl3HX3LnrHX4FkvHX4LhrHX4MXoHX4OnoHZrAZ8HZrDb8HZrGZ8HZrJnrHZvGZ8HZvLnvHZ8JnvHZ8LhrHbCXJlHbMTAnHboJl4HbpLl3HbrJX8HbrLnrHbrMnvHbvRYrHgoSTrHgrFV8HgrGZ8HgrJXoHgrRnvHgvBb!HgvGTrHgvHX4HgvHn!HgvLTrHgvSU8HnDnLbHnFbJbHnvDn8Hn6GgvHn!BTvJTCTLnJTQgFnJTrAnvJTrLX4JTrOUoJTvFn3JTvLnrJTvNToJT3AgoJT3Jn4JT3LhvJT3ObrJT8AcrJT8Al3JT8JT8JT8JnoJT8LX4JT8LnrJT8MX3JT8Rg3JT8Sc8JUoBTvJU8AToJU8GZ8JU8GgvJU8JTrJU8JXrJU8JnrJU8LnvJU8ScvJXHnJlJXrGgvJXrJU8JXrLhrJXrMT8JXrMXrJXrQUoJXvCTvJXvGZ8JXvGgrJXvQT8JX8Ab8JX8DT8JX8GZ8JX8HZvJX8LnrJX8MT8JX8MXoJX8MnvJX8ST3JYGnCTJbAkGbJbCTAnJbLTAcJboDT3JboLb6JbrAnvJbrCn3JbrDl8JbrGboJbrIZoJbrJnvJbrMnvJbrQb4Jb8RZrJeAbAnJgJnFbJgScAnJgrATrJgvHZ8JgvMn4JlJlFbJlLiQXJlLjOnJlRbOlJlvNXoJlvRl3Jl4AcrJl8AUoJl8MnrJnFnMlJnHgGbJnoDT8JnoFV8JnoGgvJnoIT8JnoQToJnoRg3JnrCZ3JnrGgrJnrHTvJnrLf8JnrOX8JnvAT3JnvFZoJnvGT8JnvJl4JnvMT8JnvMX8JnvOXrJnvPX6JnvSX3JnvSZrJn3MT8Jn3MX8Jn3RTrLTATKnLTJnLTLTMXKnLTRTQlLToGb8LTrAZ8LTrCZ8LTrDb8LTrHT8LT3PX6LT4FZoLT$CTvLT$GgrLUvHX3LVoATrLVoAgoLVoJboLVoMX3LVoRg3LV8CZ3LV8FZoLV8GTvLXrDXoLXrFbrLXvAgvLXvFlrLXvLl3LXvRn6LX4Mb8LX8GT8LYCXMnLYrMnrLZoSTvLZrAZvLZrAloLZrFToLZrJXvLZrJboLZrJl4LZrLnrLZrMT8LZrOgvLZrRnvLZrST4LZvMX8LZvSlvLZ8AgoLZ8CT3LZ8JT8LZ8LV8LZ8LZoLZ8Lg8LZ8SV8LZ8SbrLZ$HT8LZ$Mn4La6CTvLbFbMnLbRYFTLbSnFZLboJT8LbrAT9LbrGb3LbrQb8LcrJX8LcrMXrLerHTvLerJbrLerNboLgrDb8LgrGZ8LgrHTrLgrMXrLgrSU8LgvJTrLgvLl3Lg6Ll3LhrLnrLhrMT8LhvAl4LiLnQXLkoAgrLkoJT8LkoJn4LlrSU8Ll3FZoLl3HTrLl3JX8Ll3JnoLl3LToLmLeFbLnDUFbLnLVAnLnrATrLnrAZoLnrAb8LnrAlrLnrGgvLnrJU8LnrLZrLnrLhrLnrMb8LnrOXrLnrSZ8LnvAb4LnvDTrLnvDl8LnvHTrLnvHbrLnvJT8LnvJU8LnvJbrLnvLhvLnvMX8LnvMb8LnvNnoLnvSU8Ln3Al3Ln4FZoLn4GT6Ln4JgvLn4LhrLn4MT8Ln4SToMToCZrMToJX8MToLX4MToLf8MToRg3MTrEloMTvGb6MT3BTrMT3Lb6MT8AcrMT8AgrMT8GZrMT8JnoMT8LnrMT8MX3MUOUAnMXAbFnMXoAloMXoJX8MXoLf8MXoLl8MXrAb8MXrDTvMXrGT8MXrGgrMXrHTrMXrLf8MXrMU8MXrOXvMXrQb8MXvGT8MXvHTrMXvLVoMX3AX3MX3Jn3MX3LhrMX3MX3MX4AlrMX4OboMX8GTvMX8GZrMX8GgrMX8JT8MX8JX8MX8LhrMX8MT8MYDUFbMYMgDbMbGnFfMbvLX4MbvLl3Mb8Mb8Mb8ST4MgGXCnMg8ATrMg8AgoMg8CZrMg8DTrMg8DboMg8HTrMg8JgrMg8LT8MloJXoMl8AhrMl8JT8MnLgAUMnoJXrMnoLX4MnoLhrMnoMT8MnrAl4MnrDb8MnrOTvMnrOgvMnrQb8MnrSU8MnvGgrMnvHZ8Mn3MToMn4DTrMn4LTrMn4Mg8NnBXAnOTFTFnOToAToOTrGgvOTrJX8OT3JXoOT6MTrOT8GgrOT8HTpOT8MToOUoHT8OUoJT8OUoLn3OXrAgoOXrDg8OXrMT8OXvSToOX6CTvOX8CZrOX8OgrOb6HgvOb8AToOb8MT8OcvLZ8OgvAlrOgvHTvOgvJTrOgvJnrOgvLZrOgvLn4OgvMT8OgvRTrOg8AZoOg8DbvOnrOXoOnvJn4OnvLhvOnvRTrOn3GgoOn3JnvOn6JbvOn8OTrPTGYFTPbBnFnPbGnDnPgDYQTPlrAnvPlrETvPlrLnvPlrMXvPlvFX4QTMTAnQTrJU8QYCnJlQYJlQlQbGTQbQb8JnrQb8LZoQb8LnvQb8MT8Qb8Ml8Qb8ST4QloAl4QloHZvQloJX8QloMn8QnJZOlRTrAZvRTrDTrRTvJn4RTvLhvRT4Jb8RZrAZrRZ8AkrRZ8JU8RZ8LV8RZ8LnvRbJlQXRg3GboRg3MnvRg8AZ8Rg8JboRg8Jl4RnLTCbRnvFl3RnvQb8SToAl4SToCZrSToFZoSToHXrSToJU8SToJgvSToJl4SToLhrSToMX3STrAlvSTrCT9STrCgrSTrGgrSTrHXrSTrHboSTrJnoSTrNboSTvLnrST4AZoST8Ab8ST8JT8SUoJn3SU6HZ#SU6JTvSU8Db8SU8HboSU8LgrSV8JT8SZrAcrSZrAl3SZrJT8SZrJnvSZrMT8SZvLUoSZ4FZoSZ8JnoSZ8RZrScoLnrScoMT8ScoMX8ScrAT4ScrAZ8ScrLZ8ScrLkvScvDb8ScvLf8ScvNToSgrFZrShvKnrSloHUoSloLnrSlrMXoSl8HgrSmrJUoSn3BX6", + "ATFlOn3ATLgrDYAT4MTAnAT8LTMnAYJnRTrAbGgJnrAbLV8LnAbvNTAnAeFbLg3AgOYMXoAlQbFboAnDboAfAnJgoJTBToDgAnBUJbAl3BboDUAnCTDlvLnCTFTrSnCYoQTLnDTwAbAnDUDTrSnDUHgHgrDX8LXFnDbJXAcrETvLTLnGTFTQbrGTMnGToGT3DUFbGUJlPX3GbQg8LnGboJbFnGb3GgAYGgAg8ScGgMbAXrGgvAbAnGnJTLnvGnvATFgHTDT6ATHTrDlJnHYLnMn8HZrSbJTHZ8LTFnHbFTJUoHgSeMT8HgrLjAnHgvAbAnHlFUrDlHnDgvAnHnHTFT3HnQTGnrJTAaMXvJTGbCn3JTOgrAnJXvAXMnJbMg8SnJbMnRg3Jb8LTMnJnAl3OnJnGYrQlJnJlQY3LTDlCn3LTJjLg3LTLgvFXLTMg3GTLV8HUOgLXFZLg3LXNXrMnLX8QXFnLX9AlMYLYLXPXrLZAbJU8LZDUJU8LZMXrSnLZ$AgFnLaPXrDULbFYrMnLbMn8LXLboJgJgLeFbLg3LgLZrSnLgOYAgoLhrRnJlLkCTrSnLkOnLhrLnFX%AYLnFZoJXLnHTvJbLnLloAbMTATLf8MTHgJn3MTMXrAXMT3MTFnMUITvFnMXFX%AYMXMXvFbMXrFTDbMYAcMX3MbLf8SnMb8JbFnMgMXrMTMgvAXFnMgvGgCmMnAloSnMnFnJTrOXvMXSnOX8HTMnObJT8ScObLZFl3ObMXCZoPTLgrQXPUFnoQXPU3RXJlPX3RkQXPbrJXQlPlrJbFnQUAhrDbQXGnCXvQYLnHlvQbLfLnvRTOgvJbRXJYrQlRYLnrQlRbLnrQlRlFT8JlRlFnrQXSTClCn3STHTrAnSTLZQlrSTMnGTrSToHgGbSTrGTDnSTvGXCnST3HgFbSU3HXAXSbAnJn3SbFT8LnScLfLnv", + "AT3JgJX8AT8FZoSnAT8JgFV8AT8LhrDbAZ8JT8DbAb8GgLhrAb8SkLnvAe8MT8SnAlMYJXLVAl3GYDTvAl3LfLnvBUDTvLl3CTOn3HTrCT3DUGgrCU8MT8AbCbFTrJUoCgrDb8MTDTLV8JX8DTLnLXQlDT8LZrSnDUQb8FZ8DUST4JnvDb8ScOUoDj6GbJl4GTLfCYMlGToAXvFnGboAXvLnGgAcrJn3GgvFnSToGnLf8JnvGn#HTDToHTLnFXJlHTvATFToHTvHTDToHTvMTAgoHT3STClvHT4AlFl6HT8HTDToHUoDgJTrHUoScMX3HbRZrMXoHboJg8LTHgDb8JTrHgMToLf8HgvLnLnoHnHn3HT4Hn6MgvAnJTJU8ScvJT3AaQT8JT8HTrAnJXrRg8AnJbAloMXoJbrATFToJbvMnoSnJgDb6GgvJgDb8MXoJgSX3JU8JguATFToJlPYLnQlJlQkDnLbJlQlFYJlJl8Lf8OTJnCTFnLbJnLTHXMnJnLXGXCnJnoFfRg3JnrMYRg3Jn3HgFl3KT8Dg8LnLTRlFnPTLTvPbLbvLVoSbrCZLXMY6HT3LXNU7DlrLXNXDTATLX8DX8LnLZDb8JU8LZMnoLhrLZSToJU8LZrLaLnrLZvJn3SnLZ8LhrSnLaJnoMT8LbFlrHTvLbrFTLnrLbvATLlvLb6OTFn3LcLnJZOlLeAT6Mn4LeJT3ObrLg6LXFlrLhrJg8LnLhvDlPX4LhvLfLnvLj6JTFT3LnFbrMXoLnQluCTvLnrQXCY6LnvLfLnvLnvMgLnvLnvSeLf8MTMbrJn3MT3JgST3MT8AnATrMT8LULnrMUMToCZrMUScvLf8MXoDT8SnMX6ATFToMX8AXMT8MX8FkMT8MX8HTrDUMX8ScoSnMYJT6CTvMgAcrMXoMg8SToAfMlvAXLg3MnFl3AnvOT3AnFl3OUoATHT8OU3RnLXrOXrOXrSnObPbvFn6Og8HgrSnOg8OX8DbPTvAgoJgPU3RYLnrPXrDnJZrPb8CTGgvPlrLTDlvPlvFUJnoQUvFXrQlQeMnoAl3QlrQlrSnRTFTrJUoSTDlLiLXSTFg6HT3STJgoMn4STrFTJTrSTrLZFl3ST4FnMXoSUrDlHUoScvHTvSnSfLkvMXo", + "AUoAcrMXoAZ8HboAg8AbOg6ATFgAg8AloMXoAl3AT8JTrAl8MX8MXoCT3SToJU8Cl8Db8MXoDT8HgrATrDboOT8MXoGTOTrATMnGT8LhrAZ8GnvFnGnQXHToGgvAcrHTvAXvLl3HbrAZoMXoHgBlFXLg3HgMnFXrSnHgrSb8JUoHn6HT8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg", + "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl" + ]; + var codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; + function getHangul(code) { + if (code >= 40) { + code = code + 168 - 40; + } else if (code >= 19) { + code = code + 97 - 19; + } + return (0, strings_1.toUtf8String)([225, (code >> 6) + 132, (code & 63) + 128]); + } + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = []; + data.forEach(function(data2, length) { + length += 4; + for (var i = 0; i < data2.length; i += length) { + var word = ""; + for (var j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data2[i + j])); + } + wordlist.push(word); + } + }); + wordlist.sort(); + if (wordlist_1.Wordlist.check(lang) !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + wordlist = null; + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + } + var LangKo = ( + /** @class */ + function(_super) { + __extends(LangKo2, _super); + function LangKo2() { + return _super.call(this, "ko") || this; + } + LangKo2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangKo2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangKo2; + }(wordlist_1.Wordlist) + ); + var langKo = new LangKo(); + exports2.langKo = langKo; + wordlist_1.Wordlist.register(langKo); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-it.js +var require_lang_it = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-it.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langIt = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbacoAbbaglioAbbinatoAbeteAbissoAbolireAbrasivoAbrogatoAccadereAccennoAccusatoAcetoneAchilleAcidoAcquaAcreAcrilicoAcrobataAcutoAdagioAddebitoAddomeAdeguatoAderireAdipeAdottareAdulareAffabileAffettoAffissoAffrantoAforismaAfosoAfricanoAgaveAgenteAgevoleAggancioAgireAgitareAgonismoAgricoloAgrumetoAguzzoAlabardaAlatoAlbatroAlberatoAlboAlbumeAlceAlcolicoAlettoneAlfaAlgebraAlianteAlibiAlimentoAllagatoAllegroAllievoAllodolaAllusivoAlmenoAlogenoAlpacaAlpestreAltalenaAlternoAlticcioAltroveAlunnoAlveoloAlzareAmalgamaAmanitaAmarenaAmbitoAmbratoAmebaAmericaAmetistaAmicoAmmassoAmmendaAmmirareAmmonitoAmoreAmpioAmpliareAmuletoAnacardoAnagrafeAnalistaAnarchiaAnatraAncaAncellaAncoraAndareAndreaAnelloAngeloAngolareAngustoAnimaAnnegareAnnidatoAnnoAnnuncioAnonimoAnticipoAnziApaticoAperturaApodeApparireAppetitoAppoggioApprodoAppuntoAprileArabicaArachideAragostaAraldicaArancioAraturaArazzoArbitroArchivioArditoArenileArgentoArgineArgutoAriaArmoniaArneseArredatoArringaArrostoArsenicoArsoArteficeArzilloAsciuttoAscoltoAsepsiAsetticoAsfaltoAsinoAsolaAspiratoAsproAssaggioAsseAssolutoAssurdoAstaAstenutoAsticeAstrattoAtavicoAteismoAtomicoAtonoAttesaAttivareAttornoAttritoAttualeAusilioAustriaAutistaAutonomoAutunnoAvanzatoAvereAvvenireAvvisoAvvolgereAzioneAzotoAzzimoAzzurroBabeleBaccanoBacinoBacoBadessaBadilataBagnatoBaitaBalconeBaldoBalenaBallataBalzanoBambinoBandireBaraondaBarbaroBarcaBaritonoBarlumeBaroccoBasilicoBassoBatostaBattutoBauleBavaBavosaBeccoBeffaBelgioBelvaBendaBenevoleBenignoBenzinaBereBerlinaBetaBibitaBiciBidoneBifidoBigaBilanciaBimboBinocoloBiologoBipedeBipolareBirbanteBirraBiscottoBisestoBisnonnoBisonteBisturiBizzarroBlandoBlattaBollitoBonificoBordoBoscoBotanicoBottinoBozzoloBraccioBradipoBramaBrancaBravuraBretellaBrevettoBrezzaBrigliaBrillanteBrindareBroccoloBrodoBronzinaBrulloBrunoBubboneBucaBudinoBuffoneBuioBulboBuonoBurloneBurrascaBussolaBustaCadettoCaducoCalamaroCalcoloCalesseCalibroCalmoCaloriaCambusaCamerataCamiciaCamminoCamolaCampaleCanapaCandelaCaneCaninoCanottoCantinaCapaceCapelloCapitoloCapogiroCapperoCapraCapsulaCarapaceCarcassaCardoCarismaCarovanaCarrettoCartolinaCasaccioCascataCasermaCasoCassoneCastelloCasualeCatastaCatenaCatrameCautoCavilloCedibileCedrataCefaloCelebreCellulareCenaCenoneCentesimoCeramicaCercareCertoCerumeCervelloCesoiaCespoCetoChelaChiaroChiccaChiedereChimeraChinaChirurgoChitarraCiaoCiclismoCifrareCignoCilindroCiottoloCircaCirrosiCitricoCittadinoCiuffoCivettaCivileClassicoClinicaCloroCoccoCodardoCodiceCoerenteCognomeCollareColmatoColoreColposoColtivatoColzaComaCometaCommandoComodoComputerComuneConcisoCondurreConfermaCongelareConiugeConnessoConoscereConsumoContinuoConvegnoCopertoCopioneCoppiaCopricapoCorazzaCordataCoricatoCorniceCorollaCorpoCorredoCorsiaCorteseCosmicoCostanteCotturaCovatoCratereCravattaCreatoCredereCremosoCrescitaCretaCricetoCrinaleCrisiCriticoCroceCronacaCrostataCrucialeCruscaCucireCuculoCuginoCullatoCupolaCuratoreCursoreCurvoCuscinoCustodeDadoDainoDalmataDamerinoDanielaDannosoDanzareDatatoDavantiDavveroDebuttoDecennioDecisoDeclinoDecolloDecretoDedicatoDefinitoDeformeDegnoDelegareDelfinoDelirioDeltaDemenzaDenotatoDentroDepositoDerapataDerivareDerogaDescrittoDesertoDesiderioDesumereDetersivoDevotoDiametroDicembreDiedroDifesoDiffusoDigerireDigitaleDiluvioDinamicoDinnanziDipintoDiplomaDipoloDiradareDireDirottoDirupoDisagioDiscretoDisfareDisgeloDispostoDistanzaDisumanoDitoDivanoDiveltoDividereDivoratoDobloneDocenteDoganaleDogmaDolceDomatoDomenicaDominareDondoloDonoDormireDoteDottoreDovutoDozzinaDragoDruidoDubbioDubitareDucaleDunaDuomoDupliceDuraturoEbanoEccessoEccoEclissiEconomiaEderaEdicolaEdileEditoriaEducareEgemoniaEgliEgoismoEgregioElaboratoElargireEleganteElencatoElettoElevareElficoElicaElmoElsaElusoEmanatoEmblemaEmessoEmiroEmotivoEmozioneEmpiricoEmuloEndemicoEnduroEnergiaEnfasiEnotecaEntrareEnzimaEpatiteEpilogoEpisodioEpocaleEppureEquatoreErarioErbaErbosoEredeEremitaErigereErmeticoEroeErosivoErranteEsagonoEsameEsanimeEsaudireEscaEsempioEsercitoEsibitoEsigenteEsistereEsitoEsofagoEsortatoEsosoEspansoEspressoEssenzaEssoEstesoEstimareEstoniaEstrosoEsultareEtilicoEtnicoEtruscoEttoEuclideoEuropaEvasoEvidenzaEvitatoEvolutoEvvivaFabbricaFaccendaFachiroFalcoFamigliaFanaleFanfaraFangoFantasmaFareFarfallaFarinosoFarmacoFasciaFastosoFasulloFaticareFatoFavolosoFebbreFecolaFedeFegatoFelpaFeltroFemminaFendereFenomenoFermentoFerroFertileFessuraFestivoFettaFeudoFiabaFiduciaFifaFiguratoFiloFinanzaFinestraFinireFioreFiscaleFisicoFiumeFlaconeFlamencoFleboFlemmaFloridoFluenteFluoroFobicoFocacciaFocosoFoderatoFoglioFolataFolcloreFolgoreFondenteFoneticoFoniaFontanaForbitoForchettaForestaFormicaFornaioForoFortezzaForzareFosfatoFossoFracassoFranaFrassinoFratelloFreccettaFrenataFrescoFrigoFrollinoFrondeFrugaleFruttaFucilataFucsiaFuggenteFulmineFulvoFumanteFumettoFumosoFuneFunzioneFuocoFurboFurgoneFuroreFusoFutileGabbianoGaffeGalateoGallinaGaloppoGamberoGammaGaranziaGarboGarofanoGarzoneGasdottoGasolioGastricoGattoGaudioGazeboGazzellaGecoGelatinaGelsoGemelloGemmatoGeneGenitoreGennaioGenotipoGergoGhepardoGhiaccioGhisaGialloGildaGineproGiocareGioielloGiornoGioveGiratoGironeGittataGiudizioGiuratoGiustoGlobuloGlutineGnomoGobbaGolfGomitoGommoneGonfioGonnaGovernoGracileGradoGraficoGrammoGrandeGrattareGravosoGraziaGrecaGreggeGrifoneGrigioGrinzaGrottaGruppoGuadagnoGuaioGuantoGuardareGufoGuidareIbernatoIconaIdenticoIdillioIdoloIdraIdricoIdrogenoIgieneIgnaroIgnoratoIlareIllesoIllogicoIlludereImballoImbevutoImboccoImbutoImmaneImmersoImmolatoImpaccoImpetoImpiegoImportoImprontaInalareInarcareInattivoIncantoIncendioInchinoIncisivoInclusoIncontroIncrocioIncuboIndagineIndiaIndoleIneditoInfattiInfilareInflittoIngaggioIngegnoIngleseIngordoIngrossoInnescoInodoreInoltrareInondatoInsanoInsettoInsiemeInsonniaInsulinaIntasatoInteroIntonacoIntuitoInumidireInvalidoInveceInvitoIperboleIpnoticoIpotesiIppicaIrideIrlandaIronicoIrrigatoIrrorareIsolatoIsotopoIstericoIstitutoIstriceItaliaIterareLabbroLabirintoLaccaLaceratoLacrimaLacunaLaddoveLagoLampoLancettaLanternaLardosoLargaLaringeLastraLatenzaLatinoLattugaLavagnaLavoroLegaleLeggeroLemboLentezzaLenzaLeoneLepreLesivoLessatoLestoLetteraleLevaLevigatoLiberoLidoLievitoLillaLimaturaLimitareLimpidoLineareLinguaLiquidoLiraLiricaLiscaLiteLitigioLivreaLocandaLodeLogicaLombareLondraLongevoLoquaceLorenzoLotoLotteriaLuceLucidatoLumacaLuminosoLungoLupoLuppoloLusingaLussoLuttoMacabroMacchinaMaceroMacinatoMadamaMagicoMagliaMagneteMagroMaiolicaMalafedeMalgradoMalintesoMalsanoMaltoMalumoreManaManciaMandorlaMangiareManifestoMannaroManovraMansardaMantideManubrioMappaMaratonaMarcireMarettaMarmoMarsupioMascheraMassaiaMastinoMaterassoMatricolaMattoneMaturoMazurcaMeandroMeccanicoMecenateMedesimoMeditareMegaMelassaMelisMelodiaMeningeMenoMensolaMercurioMerendaMerloMeschinoMeseMessereMestoloMetalloMetodoMettereMiagolareMicaMicelioMicheleMicroboMidolloMieleMiglioreMilanoMiliteMimosaMineraleMiniMinoreMirinoMirtilloMiscelaMissivaMistoMisurareMitezzaMitigareMitraMittenteMnemonicoModelloModificaModuloMoganoMogioMoleMolossoMonasteroMoncoMondinaMonetarioMonileMonotonoMonsoneMontatoMonvisoMoraMordereMorsicatoMostroMotivatoMotosegaMottoMovenzaMovimentoMozzoMuccaMucosaMuffaMughettoMugnaioMulattoMulinelloMultiploMummiaMuntoMuovereMuraleMusaMuscoloMusicaMutevoleMutoNababboNaftaNanometroNarcisoNariceNarratoNascereNastrareNaturaleNauticaNaviglioNebulosaNecrosiNegativoNegozioNemmenoNeofitaNerettoNervoNessunoNettunoNeutraleNeveNevroticoNicchiaNinfaNitidoNobileNocivoNodoNomeNominaNordicoNormaleNorvegeseNostranoNotareNotiziaNotturnoNovellaNucleoNullaNumeroNuovoNutrireNuvolaNuzialeOasiObbedireObbligoObeliscoOblioOboloObsoletoOccasioneOcchioOccidenteOccorrereOccultareOcraOculatoOdiernoOdorareOffertaOffrireOffuscatoOggettoOggiOgnunoOlandeseOlfattoOliatoOlivaOlogrammaOltreOmaggioOmbelicoOmbraOmegaOmissioneOndosoOnereOniceOnnivoroOnorevoleOntaOperatoOpinioneOppostoOracoloOrafoOrdineOrecchinoOreficeOrfanoOrganicoOrigineOrizzonteOrmaOrmeggioOrnativoOrologioOrrendoOrribileOrtensiaOrticaOrzataOrzoOsareOscurareOsmosiOspedaleOspiteOssaOssidareOstacoloOsteOtiteOtreOttagonoOttimoOttobreOvaleOvestOvinoOviparoOvocitoOvunqueOvviareOzioPacchettoPacePacificoPadellaPadronePaesePagaPaginaPalazzinaPalesarePallidoPaloPaludePandoroPannelloPaoloPaonazzoPapricaParabolaParcellaParerePargoloPariParlatoParolaPartireParvenzaParzialePassivoPasticcaPataccaPatologiaPattumePavonePeccatoPedalarePedonalePeggioPelosoPenarePendicePenisolaPennutoPenombraPensarePentolaPepePepitaPerbenePercorsoPerdonatoPerforarePergamenaPeriodoPermessoPernoPerplessoPersuasoPertugioPervasoPesatorePesistaPesoPestiferoPetaloPettinePetulantePezzoPiacerePiantaPiattinoPiccinoPicozzaPiegaPietraPifferoPigiamaPigolioPigroPilaPiliferoPillolaPilotaPimpantePinetaPinnaPinoloPioggiaPiomboPiramidePireticoPiritePirolisiPitonePizzicoPlaceboPlanarePlasmaPlatanoPlenarioPochezzaPoderosoPodismoPoesiaPoggiarePolentaPoligonoPollicePolmonitePolpettaPolsoPoltronaPolverePomicePomodoroPontePopolosoPorfidoPorosoPorporaPorrePortataPosaPositivoPossessoPostulatoPotassioPoterePranzoPrassiPraticaPreclusoPredicaPrefissoPregiatoPrelievoPremerePrenotarePreparatoPresenzaPretestoPrevalsoPrimaPrincipePrivatoProblemaProcuraProdurreProfumoProgettoProlungaPromessaPronomePropostaProrogaProtesoProvaPrudentePrugnaPruritoPsichePubblicoPudicaPugilatoPugnoPulcePulitoPulsantePuntarePupazzoPupillaPuroQuadroQualcosaQuasiQuerelaQuotaRaccoltoRaddoppioRadicaleRadunatoRafficaRagazzoRagioneRagnoRamarroRamingoRamoRandagioRantolareRapatoRapinaRappresoRasaturaRaschiatoRasenteRassegnaRastrelloRataRavvedutoRealeRecepireRecintoReclutaReconditoRecuperoRedditoRedimereRegalatoRegistroRegolaRegressoRelazioneRemareRemotoRennaReplicaReprimereReputareResaResidenteResponsoRestauroReteRetinaRetoricaRettificaRevocatoRiassuntoRibadireRibelleRibrezzoRicaricaRiccoRicevereRiciclatoRicordoRicredutoRidicoloRidurreRifasareRiflessoRiformaRifugioRigareRigettatoRighelloRilassatoRilevatoRimanereRimbalzoRimedioRimorchioRinascitaRincaroRinforzoRinnovoRinomatoRinsavitoRintoccoRinunciaRinvenireRiparatoRipetutoRipienoRiportareRipresaRipulireRisataRischioRiservaRisibileRisoRispettoRistoroRisultatoRisvoltoRitardoRitegnoRitmicoRitrovoRiunioneRivaRiversoRivincitaRivoltoRizomaRobaRoboticoRobustoRocciaRocoRodaggioRodereRoditoreRogitoRollioRomanticoRompereRonzioRosolareRospoRotanteRotondoRotulaRovescioRubizzoRubricaRugaRullinoRumineRumorosoRuoloRupeRussareRusticoSabatoSabbiareSabotatoSagomaSalassoSaldaturaSalgemmaSalivareSalmoneSaloneSaltareSalutoSalvoSapereSapidoSaporitoSaracenoSarcasmoSartoSassosoSatelliteSatiraSatolloSaturnoSavanaSavioSaziatoSbadiglioSbalzoSbancatoSbarraSbattereSbavareSbendareSbirciareSbloccatoSbocciatoSbrinareSbruffoneSbuffareScabrosoScadenzaScalaScambiareScandaloScapolaScarsoScatenareScavatoSceltoScenicoScettroSchedaSchienaSciarpaScienzaScindereScippoSciroppoScivoloSclerareScodellaScolpitoScompartoSconfortoScoprireScortaScossoneScozzeseScribaScrollareScrutinioScuderiaScultoreScuolaScuroScusareSdebitareSdoganareSeccaturaSecondoSedanoSeggiolaSegnalatoSegregatoSeguitoSelciatoSelettivoSellaSelvaggioSemaforoSembrareSemeSeminatoSempreSensoSentireSepoltoSequenzaSerataSerbatoSerenoSerioSerpenteSerraglioServireSestinaSetolaSettimanaSfaceloSfaldareSfamatoSfarzosoSfaticatoSferaSfidaSfilatoSfingeSfocatoSfoderareSfogoSfoltireSforzatoSfrattoSfruttatoSfuggitoSfumareSfusoSgabelloSgarbatoSgonfiareSgorbioSgrassatoSguardoSibiloSiccomeSierraSiglaSignoreSilenzioSillabaSimboloSimpaticoSimulatoSinfoniaSingoloSinistroSinoSintesiSinusoideSiparioSismaSistoleSituatoSlittaSlogaturaSlovenoSmarritoSmemoratoSmentitoSmeraldoSmilzoSmontareSmottatoSmussatoSnellireSnervatoSnodoSobbalzoSobrioSoccorsoSocialeSodaleSoffittoSognoSoldatoSolenneSolidoSollazzoSoloSolubileSolventeSomaticoSommaSondaSonettoSonniferoSopireSoppesoSopraSorgereSorpassoSorrisoSorsoSorteggioSorvolatoSospiroSostaSottileSpadaSpallaSpargereSpatolaSpaventoSpazzolaSpecieSpedireSpegnereSpelaturaSperanzaSpessoreSpettraleSpezzatoSpiaSpigolosoSpillatoSpinosoSpiraleSplendidoSportivoSposoSprangaSprecareSpronatoSpruzzoSpuntinoSquilloSradicareSrotolatoStabileStaccoStaffaStagnareStampatoStantioStarnutoStaseraStatutoSteloSteppaSterzoStilettoStimaStirpeStivaleStizzosoStonatoStoricoStrappoStregatoStriduloStrozzareStruttoStuccareStufoStupendoSubentroSuccosoSudoreSuggeritoSugoSultanoSuonareSuperboSupportoSurgelatoSurrogatoSussurroSuturaSvagareSvedeseSveglioSvelareSvenutoSveziaSviluppoSvistaSvizzeraSvoltaSvuotareTabaccoTabulatoTacciareTaciturnoTaleTalismanoTamponeTanninoTaraTardivoTargatoTariffaTarpareTartarugaTastoTatticoTavernaTavolataTazzaTecaTecnicoTelefonoTemerarioTempoTemutoTendoneTeneroTensioneTentacoloTeoremaTermeTerrazzoTerzettoTesiTesseratoTestatoTetroTettoiaTifareTigellaTimbroTintoTipicoTipografoTiraggioTiroTitanioTitoloTitubanteTizioTizzoneToccareTollerareToltoTombolaTomoTonfoTonsillaTopazioTopologiaToppaTorbaTornareTorroneTortoraToscanoTossireTostaturaTotanoTraboccoTracheaTrafilaTragediaTralcioTramontoTransitoTrapanoTrarreTraslocoTrattatoTraveTrecciaTremolioTrespoloTributoTrichecoTrifoglioTrilloTrinceaTrioTristezzaTrituratoTrivellaTrombaTronoTroppoTrottolaTrovareTruccatoTubaturaTuffatoTulipanoTumultoTunisiaTurbareTurchinoTutaTutelaUbicatoUccelloUccisoreUdireUditivoUffaUfficioUgualeUlisseUltimatoUmanoUmileUmorismoUncinettoUngereUnghereseUnicornoUnificatoUnisonoUnitarioUnteUovoUpupaUraganoUrgenzaUrloUsanzaUsatoUscitoUsignoloUsuraioUtensileUtilizzoUtopiaVacanteVaccinatoVagabondoVagliatoValangaValgoValicoVallettaValorosoValutareValvolaVampataVangareVanitosoVanoVantaggioVanveraVaporeVaranoVarcatoVarianteVascaVedettaVedovaVedutoVegetaleVeicoloVelcroVelinaVellutoVeloceVenatoVendemmiaVentoVeraceVerbaleVergognaVerificaVeroVerrucaVerticaleVescicaVessilloVestaleVeteranoVetrinaVetustoViandanteVibranteVicendaVichingoVicinanzaVidimareVigiliaVignetoVigoreVileVillanoViminiVincitoreViolaViperaVirgolaVirologoVirulentoViscosoVisioneVispoVissutoVisuraVitaVitelloVittimaVivandaVividoViziareVoceVogaVolatileVolereVolpeVoragineVulcanoZampognaZannaZappatoZatteraZavorraZefiroZelanteZeloZenzeroZerbinoZibettoZincoZirconeZittoZollaZoticoZuccheroZufoloZuluZuppa"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620") { + wordlist = null; + throw new Error("BIP39 Wordlist for it (Italian) FAILED"); + } + } + var LangIt = ( + /** @class */ + function(_super) { + __extends(LangIt2, _super); + function LangIt2() { + return _super.call(this, "it") || this; + } + LangIt2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangIt2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangIt2; + }(wordlist_1.Wordlist) + ); + var langIt = new LangIt(); + exports2.langIt = langIt; + wordlist_1.Wordlist.register(langIt); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-zh.js +var require_lang_zh = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-zh.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langZhTw = exports2.langZhCn = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]) + ]; + if (lang.locale === "zh_tw") { + var common = s % 4; + for (var i_1 = common; i_1 < 3; i_1++) { + bytes[i_1] = codes.indexOf(deltaData[deltaOffset++]) + (i_1 == 0 ? 228 : 128); + } + } + wordlist[lang.locale].push((0, strings_1.toUtf8String)(bytes)); + } + if (wordlist_1.Wordlist.check(lang) !== Checks[lang.locale]) { + wordlist[lang.locale] = null; + throw new Error("BIP39 Wordlist for " + lang.locale + " (Chinese) FAILED"); + } + } + var LangZh = ( + /** @class */ + function(_super) { + __extends(LangZh2, _super); + function LangZh2(country) { + return _super.call(this, "zh_" + country) || this; + } + LangZh2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[this.locale][index]; + }; + LangZh2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist[this.locale].indexOf(word); + }; + LangZh2.prototype.split = function(mnemonic) { + mnemonic = mnemonic.replace(/(?:\u3000| )+/g, ""); + return mnemonic.split(""); + }; + return LangZh2; + }(wordlist_1.Wordlist) + ); + var langZhCn = new LangZh("cn"); + exports2.langZhCn = langZhCn; + wordlist_1.Wordlist.register(langZhCn); + wordlist_1.Wordlist.register(langZhCn, "zh"); + var langZhTw = new LangZh("tw"); + exports2.langZhTw = langZhTw; + wordlist_1.Wordlist.register(langZhTw); + } +}); + +// node_modules/@ethersproject/wordlists/lib/wordlists.js +var require_wordlists = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/wordlists.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.wordlists = void 0; + var lang_cz_1 = require_lang_cz(); + var lang_en_1 = require_lang_en(); + var lang_es_1 = require_lang_es(); + var lang_fr_1 = require_lang_fr(); + var lang_ja_1 = require_lang_ja(); + var lang_ko_1 = require_lang_ko(); + var lang_it_1 = require_lang_it(); + var lang_zh_1 = require_lang_zh(); + exports2.wordlists = { + cz: lang_cz_1.langCz, + en: lang_en_1.langEn, + es: lang_es_1.langEs, + fr: lang_fr_1.langFr, + it: lang_it_1.langIt, + ja: lang_ja_1.langJa, + ko: lang_ko_1.langKo, + zh: lang_zh_1.langZhCn, + zh_cn: lang_zh_1.langZhCn, + zh_tw: lang_zh_1.langZhTw + }; + } +}); + +// node_modules/@ethersproject/wordlists/lib/index.js +var require_lib20 = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.wordlists = exports2.Wordlist = exports2.logger = void 0; + var wordlist_1 = require_wordlist(); + Object.defineProperty(exports2, "logger", { enumerable: true, get: function() { + return wordlist_1.logger; + } }); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return wordlist_1.Wordlist; + } }); + var wordlists_1 = require_wordlists(); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return wordlists_1.wordlists; + } }); + } +}); + +// node_modules/@ethersproject/hdnode/lib/_version.js +var require_version17 = __commonJS({ + "node_modules/@ethersproject/hdnode/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "hdnode/5.5.0"; + } +}); + +// node_modules/@ethersproject/hdnode/lib/index.js +var require_lib21 = __commonJS({ + "node_modules/@ethersproject/hdnode/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getAccountPath = exports2.isValidMnemonic = exports2.entropyToMnemonic = exports2.mnemonicToEntropy = exports2.mnemonicToSeed = exports2.HDNode = exports2.defaultPath = void 0; + var basex_1 = require_lib17(); + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var strings_1 = require_lib9(); + var pbkdf2_1 = require_lib18(); + var properties_1 = require_lib4(); + var signing_key_1 = require_lib14(); + var sha2_1 = require_lib19(); + var transactions_1 = require_lib15(); + var wordlists_1 = require_lib20(); + var logger_1 = require_lib(); + var _version_1 = require_version17(); + var logger = new logger_1.Logger(_version_1.version); + var N = bignumber_1.BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + var MasterSecret = (0, strings_1.toUtf8Bytes)("Bitcoin seed"); + var HardenedBit = 2147483648; + function getUpperMask(bits) { + return (1 << bits) - 1 << 8 - bits; + } + function getLowerMask(bits) { + return (1 << bits) - 1; + } + function bytes32(value) { + return (0, bytes_1.hexZeroPad)((0, bytes_1.hexlify)(value), 32); + } + function base58check(data) { + return basex_1.Base58.encode((0, bytes_1.concat)([data, (0, bytes_1.hexDataSlice)((0, sha2_1.sha256)((0, sha2_1.sha256)(data)), 0, 4)])); + } + function getWordlist(wordlist) { + if (wordlist == null) { + return wordlists_1.wordlists["en"]; + } + if (typeof wordlist === "string") { + var words = wordlists_1.wordlists[wordlist]; + if (words == null) { + logger.throwArgumentError("unknown locale", "wordlist", wordlist); + } + return words; + } + return wordlist; + } + var _constructorGuard = {}; + exports2.defaultPath = "m/44'/60'/0'/0/0"; + var HDNode = ( + /** @class */ + function() { + function HDNode2(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, HDNode2); + if (constructorGuard !== _constructorGuard) { + throw new Error("HDNode constructor cannot be called directly"); + } + if (privateKey) { + var signingKey = new signing_key_1.SigningKey(privateKey); + (0, properties_1.defineReadOnly)(this, "privateKey", signingKey.privateKey); + (0, properties_1.defineReadOnly)(this, "publicKey", signingKey.compressedPublicKey); + } else { + (0, properties_1.defineReadOnly)(this, "privateKey", null); + (0, properties_1.defineReadOnly)(this, "publicKey", (0, bytes_1.hexlify)(publicKey)); + } + (0, properties_1.defineReadOnly)(this, "parentFingerprint", parentFingerprint); + (0, properties_1.defineReadOnly)(this, "fingerprint", (0, bytes_1.hexDataSlice)((0, sha2_1.ripemd160)((0, sha2_1.sha256)(this.publicKey)), 0, 4)); + (0, properties_1.defineReadOnly)(this, "address", (0, transactions_1.computeAddress)(this.publicKey)); + (0, properties_1.defineReadOnly)(this, "chainCode", chainCode); + (0, properties_1.defineReadOnly)(this, "index", index); + (0, properties_1.defineReadOnly)(this, "depth", depth); + if (mnemonicOrPath == null) { + (0, properties_1.defineReadOnly)(this, "mnemonic", null); + (0, properties_1.defineReadOnly)(this, "path", null); + } else if (typeof mnemonicOrPath === "string") { + (0, properties_1.defineReadOnly)(this, "mnemonic", null); + (0, properties_1.defineReadOnly)(this, "path", mnemonicOrPath); + } else { + (0, properties_1.defineReadOnly)(this, "mnemonic", mnemonicOrPath); + (0, properties_1.defineReadOnly)(this, "path", mnemonicOrPath.path); + } + } + Object.defineProperty(HDNode2.prototype, "extendedKey", { + get: function() { + if (this.depth >= 256) { + throw new Error("Depth too large!"); + } + return base58check((0, bytes_1.concat)([ + this.privateKey != null ? "0x0488ADE4" : "0x0488B21E", + (0, bytes_1.hexlify)(this.depth), + this.parentFingerprint, + (0, bytes_1.hexZeroPad)((0, bytes_1.hexlify)(this.index), 4), + this.chainCode, + this.privateKey != null ? (0, bytes_1.concat)(["0x00", this.privateKey]) : this.publicKey + ])); + }, + enumerable: false, + configurable: true + }); + HDNode2.prototype.neuter = function() { + return new HDNode2(_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path); + }; + HDNode2.prototype._derive = function(index) { + if (index > 4294967295) { + throw new Error("invalid index - " + String(index)); + } + 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.set((0, bytes_1.arrayify)(this.privateKey), 1); + if (path) { + path += "'"; + } + } else { + data.set((0, bytes_1.arrayify)(this.publicKey)); + } + for (var i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = index >> 24 - i & 255; + } + var I = (0, bytes_1.arrayify)((0, sha2_1.computeHmac)(sha2_1.SupportedAlgorithm.sha512, this.chainCode, data)); + var IL = I.slice(0, 32); + var IR = I.slice(32); + var ki = null; + var Ki = null; + if (this.privateKey) { + ki = bytes32(bignumber_1.BigNumber.from(IL).add(this.privateKey).mod(N)); + } else { + var ek = new signing_key_1.SigningKey((0, bytes_1.hexlify)(IL)); + Ki = ek._addPoint(this.publicKey); + } + var mnemonicOrPath = path; + var srcMnemonic = this.mnemonic; + if (srcMnemonic) { + mnemonicOrPath = Object.freeze({ + phrase: srcMnemonic.phrase, + path, + locale: srcMnemonic.locale || "en" + }); + } + return new HDNode2(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath); + }; + HDNode2.prototype.derivePath = function(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; + }; + HDNode2._fromSeed = function(seed, mnemonic) { + var seedArray = (0, bytes_1.arrayify)(seed); + if (seedArray.length < 16 || seedArray.length > 64) { + throw new Error("invalid seed"); + } + var I = (0, bytes_1.arrayify)((0, sha2_1.computeHmac)(sha2_1.SupportedAlgorithm.sha512, MasterSecret, seedArray)); + return new HDNode2(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic); + }; + HDNode2.fromMnemonic = function(mnemonic, password, wordlist) { + wordlist = getWordlist(wordlist); + mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist); + return HDNode2._fromSeed(mnemonicToSeed(mnemonic, password), { + phrase: mnemonic, + path: "m", + locale: wordlist.locale + }); + }; + HDNode2.fromSeed = function(seed) { + return HDNode2._fromSeed(seed, null); + }; + HDNode2.fromExtendedKey = function(extendedKey) { + var bytes = basex_1.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 = (0, bytes_1.hexlify)(bytes.slice(5, 9)); + var index = parseInt((0, bytes_1.hexlify)(bytes.slice(9, 13)).substring(2), 16); + var chainCode = (0, bytes_1.hexlify)(bytes.slice(13, 45)); + var key = bytes.slice(45, 78); + switch ((0, bytes_1.hexlify)(bytes.slice(0, 4))) { + case "0x0488b21e": + case "0x043587cf": + return new HDNode2(_constructorGuard, null, (0, bytes_1.hexlify)(key), parentFingerprint, chainCode, index, depth, null); + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNode2(_constructorGuard, (0, bytes_1.hexlify)(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null); + } + return logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + }; + return HDNode2; + }() + ); + exports2.HDNode = HDNode; + function mnemonicToSeed(mnemonic, password) { + if (!password) { + password = ""; + } + var salt = (0, strings_1.toUtf8Bytes)("mnemonic" + password, strings_1.UnicodeNormalizationForm.NFKD); + return (0, pbkdf2_1.pbkdf2)((0, strings_1.toUtf8Bytes)(mnemonic, strings_1.UnicodeNormalizationForm.NFKD), salt, 2048, 64, "sha512"); + } + exports2.mnemonicToSeed = mnemonicToSeed; + 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 = (0, bytes_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 = (0, bytes_1.arrayify)((0, sha2_1.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { + throw new Error("invalid checksum"); + } + return (0, bytes_1.hexlify)(entropy.slice(0, entropyBits / 8)); + } + exports2.mnemonicToEntropy = mnemonicToEntropy; + function entropyToMnemonic(entropy, wordlist) { + wordlist = getWordlist(wordlist); + entropy = (0, bytes_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++) { + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + } else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> 8 - remainingBits; + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + var checksumBits = entropy.length / 4; + var checksum = (0, bytes_1.arrayify)((0, sha2_1.sha256)(entropy))[0] & getUpperMask(checksumBits); + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= checksum >> 8 - checksumBits; + return wordlist.join(indices.map(function(index) { + return wordlist.getWord(index); + })); + } + exports2.entropyToMnemonic = entropyToMnemonic; + function isValidMnemonic(mnemonic, wordlist) { + try { + mnemonicToEntropy(mnemonic, wordlist); + return true; + } catch (error) { + } + return false; + } + exports2.isValidMnemonic = isValidMnemonic; + function getAccountPath(index) { + if (typeof index !== "number" || index < 0 || index >= HardenedBit || index % 1) { + logger.throwArgumentError("invalid account index", "index", index); + } + return "m/44'/60'/" + index + "'/0/0"; + } + exports2.getAccountPath = getAccountPath; + } +}); + +// node_modules/@ethersproject/random/lib/random.js +var require_random = __commonJS({ + "node_modules/@ethersproject/random/lib/random.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.randomBytes = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + function randomBytes(length) { + return (0, bytes_1.arrayify)((0, crypto_1.randomBytes)(length)); + } + exports2.randomBytes = randomBytes; + } +}); + +// node_modules/@ethersproject/random/lib/shuffle.js +var require_shuffle = __commonJS({ + "node_modules/@ethersproject/random/lib/shuffle.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.shuffled = void 0; + 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; + } + exports2.shuffled = shuffled; + } +}); + +// node_modules/@ethersproject/random/lib/index.js +var require_lib22 = __commonJS({ + "node_modules/@ethersproject/random/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.shuffled = exports2.randomBytes = void 0; + var random_1 = require_random(); + Object.defineProperty(exports2, "randomBytes", { enumerable: true, get: function() { + return random_1.randomBytes; + } }); + var shuffle_1 = require_shuffle(); + Object.defineProperty(exports2, "shuffled", { enumerable: true, get: function() { + return shuffle_1.shuffled; + } }); + } +}); + +// node_modules/aes-js/index.js +var require_aes_js = __commonJS({ + "node_modules/aes-js/index.js"(exports2, module2) { + "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) { + 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; + } + if (Array.isArray(arg)) { + if (!checkInts(arg)) { + throw new Error("Array contains invalid value: " + arg); + } + return new Uint8Array(arg); + } + 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 = /* @__PURE__ */ function() { + function toBytes(text) { + var result = [], i = 0; + text = encodeURI(text); + while (i < text.length) { + var c = text.charCodeAt(i++); + if (c === 37) { + result.push(parseInt(text.substr(i, 2), 16)); + i += 2; + } 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 & 31) << 6 | bytes[i + 1] & 63)); + i += 2; + } else { + result.push(String.fromCharCode((c & 15) << 12 | (bytes[i + 1] & 63) << 6 | bytes[i + 2] & 63)); + i += 3; + } + } + return result.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var convertHex = /* @__PURE__ */ 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; + } + var Hex = "0123456789abcdef"; + function fromBytes(bytes) { + var result = []; + for (var i = 0; i < bytes.length; i++) { + var v = bytes[i]; + result.push(Hex[(v & 240) >> 4] + Hex[v & 15]); + } + return result.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var numberOfRounds = { 16: 10, 24: 12, 32: 14 }; + var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145]; + var S = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22]; + var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125]; + var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986]; + var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766]; + var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126]; + var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436]; + var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890]; + var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935]; + var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600]; + var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480]; + var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795]; + var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855]; + var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150]; + var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925]; + 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(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)"); + } + this._Ke = []; + 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; + var tk = convertToInt32(this.key); + 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]; + } + var rconpointer = 0; + var t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24; + rconpointer += 1; + if (KC != 8) { + for (var i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } else { + for (var i = 1; i < KC / 2; i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[KC / 2 - 1]; + tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24; + for (var i = KC / 2 + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + 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++; + } + } + 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 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255]; + } + } + }; + 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]; + var t = convertToInt32(plaintext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Ke[0][i]; + } + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T1[t[i] >> 24 & 255] ^ T2[t[(i + 1) % 4] >> 16 & 255] ^ T3[t[(i + 2) % 4] >> 8 & 255] ^ T4[t[(i + 3) % 4] & 255] ^ this._Ke[r][i]; + } + t = a.slice(); + } + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Ke[rounds][i]; + result[4 * i] = (S[t[i] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i + 1] = (S[t[(i + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i + 2] = (S[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i + 3] = (S[t[(i + 3) % 4] & 255] ^ tt) & 255; + } + 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]; + var t = convertToInt32(ciphertext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Kd[0][i]; + } + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T5[t[i] >> 24 & 255] ^ T6[t[(i + 3) % 4] >> 16 & 255] ^ T7[t[(i + 2) % 4] >> 8 & 255] ^ T8[t[(i + 1) % 4] & 255] ^ this._Kd[r][i]; + } + t = a.slice(); + } + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Kd[rounds][i]; + result[4 * i] = (Si[t[i] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i + 1] = (Si[t[(i + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i + 2] = (Si[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i + 3] = (Si[t[(i + 1) % 4] & 255] ^ tt) & 255; + } + return result; + }; + var ModeOfOperationECB = function(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; + }; + var ModeOfOperationCBC = function(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; + }; + var ModeOfOperationCFB = function(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]; + } + 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]; + } + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } + return plaintext; + }; + var ModeOfOperationOFB = function(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; + }; + ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; + var Counter = function(initialValue) { + if (!(this instanceof Counter)) { + throw Error("Counter must be instanitated with `new`"); + } + 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; + } + } + }; + var ModeOfOperationCTR = function(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; + }; + ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; + 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; + } + var aesjs = { + AES, + 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, + createArray, + copyArray + } + }; + if (typeof exports2 !== "undefined") { + module2.exports = aesjs; + } else if (typeof define === "function" && define.amd) { + define(aesjs); + } else { + if (root.aesjs) { + aesjs._aesjs = root.aesjs; + } + root.aesjs = aesjs; + } + })(exports2); + } +}); + +// node_modules/@ethersproject/json-wallets/lib/_version.js +var require_version18 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "json-wallets/5.5.0"; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/utils.js +var require_utils4 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/utils.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.uuidV4 = exports2.searchPath = exports2.getPassword = exports2.zpad = exports2.looseArrayify = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + function looseArrayify(hexString) { + if (typeof hexString === "string" && hexString.substring(0, 2) !== "0x") { + hexString = "0x" + hexString; + } + return (0, bytes_1.arrayify)(hexString); + } + exports2.looseArrayify = looseArrayify; + function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = "0" + value; + } + return value; + } + exports2.zpad = zpad; + function getPassword(password) { + if (typeof password === "string") { + return (0, strings_1.toUtf8Bytes)(password, strings_1.UnicodeNormalizationForm.NFKC); + } + return (0, bytes_1.arrayify)(password); + } + exports2.getPassword = getPassword; + function searchPath(object, path) { + var currentChild = object; + var comps = path.toLowerCase().split("/"); + for (var i = 0; i < comps.length; i++) { + var matchingChild = null; + for (var key in currentChild) { + if (key.toLowerCase() === comps[i]) { + matchingChild = currentChild[key]; + break; + } + } + if (matchingChild === null) { + return null; + } + currentChild = matchingChild; + } + return currentChild; + } + exports2.searchPath = searchPath; + function uuidV4(randomBytes) { + var bytes = (0, bytes_1.arrayify)(randomBytes); + bytes[6] = bytes[6] & 15 | 64; + bytes[8] = bytes[8] & 63 | 128; + var value = (0, bytes_1.hexlify)(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34) + ].join("-"); + } + exports2.uuidV4 = uuidV4; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/crowdsale.js +var require_crowdsale = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/crowdsale.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decrypt = exports2.CrowdsaleAccount = void 0; + var aes_js_1 = __importDefault(require_aes_js()); + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var pbkdf2_1 = require_lib18(); + var strings_1 = require_lib9(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version18(); + var logger = new logger_1.Logger(_version_1.version); + var utils_1 = require_utils4(); + var CrowdsaleAccount = ( + /** @class */ + function(_super) { + __extends(CrowdsaleAccount2, _super); + function CrowdsaleAccount2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CrowdsaleAccount2.prototype.isCrowdsaleAccount = function(value) { + return !!(value && value._isCrowdsaleAccount); + }; + return CrowdsaleAccount2; + }(properties_1.Description) + ); + exports2.CrowdsaleAccount = CrowdsaleAccount; + function decrypt(json, password) { + var data = JSON.parse(json); + password = (0, utils_1.getPassword)(password); + var ethaddr = (0, address_1.getAddress)((0, utils_1.searchPath)(data, "ethaddr")); + var encseed = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "encseed")); + if (!encseed || encseed.length % 16 !== 0) { + logger.throwArgumentError("invalid encseed", "json", json); + } + var key = (0, bytes_1.arrayify)((0, pbkdf2_1.pbkdf2)(password, password, 2e3, 32, "sha256")).slice(0, 16); + var iv = encseed.slice(0, 16); + var encryptedSeed = encseed.slice(16); + var aesCbc = new aes_js_1.default.ModeOfOperation.cbc(key, iv); + var seed = aes_js_1.default.padding.pkcs7.strip((0, bytes_1.arrayify)(aesCbc.decrypt(encryptedSeed))); + var seedHex = ""; + for (var i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + var seedHexBytes = (0, strings_1.toUtf8Bytes)(seedHex); + var privateKey = (0, keccak256_1.keccak256)(seedHexBytes); + return new CrowdsaleAccount({ + _isCrowdsaleAccount: true, + address: ethaddr, + privateKey + }); + } + exports2.decrypt = decrypt; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/inspect.js +var require_inspect = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/inspect.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getJsonWalletAddress = exports2.isKeystoreWallet = exports2.isCrowdsaleWallet = void 0; + var address_1 = require_lib7(); + function isCrowdsaleWallet(json) { + var data = null; + try { + data = JSON.parse(json); + } catch (error) { + return false; + } + return data.encseed && data.ethaddr; + } + exports2.isCrowdsaleWallet = isCrowdsaleWallet; + 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; + } + return true; + } + exports2.isKeystoreWallet = isKeystoreWallet; + function getJsonWalletAddress(json) { + if (isCrowdsaleWallet(json)) { + try { + return (0, address_1.getAddress)(JSON.parse(json).ethaddr); + } catch (error) { + return null; + } + } + if (isKeystoreWallet(json)) { + try { + return (0, address_1.getAddress)(JSON.parse(json).address); + } catch (error) { + return null; + } + } + return null; + } + exports2.getJsonWalletAddress = getJsonWalletAddress; + } +}); + +// node_modules/scrypt-js/scrypt.js +var require_scrypt = __commonJS({ + "node_modules/scrypt-js/scrypt.js"(exports2, module2) { + "use strict"; + (function(root) { + const MAX_VALUE = 2147483647; + function SHA256(m) { + const K = new Uint32Array([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]); + let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762; + let h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225; + const w = new Uint32Array(64); + function blocks(p2) { + let off = 0, len = p2.length; + while (len >= 64) { + let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i2, j, t1, t2; + for (i2 = 0; i2 < 16; i2++) { + j = off + i2 * 4; + w[i2] = (p2[j] & 255) << 24 | (p2[j + 1] & 255) << 16 | (p2[j + 2] & 255) << 8 | p2[j + 3] & 255; + } + for (i2 = 16; i2 < 64; i2++) { + u = w[i2 - 2]; + t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10; + u = w[i2 - 15]; + t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3; + w[i2] = (t1 + w[i2 - 7] | 0) + (t2 + w[i2 - 16] | 0) | 0; + } + for (i2 = 0; i2 < 64; i2++) { + t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i2] + w[i2] | 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); + let i, bytesLeft = m.length % 64, bitLenHi = m.length / 536870912 | 0, bitLenLo = m.length << 3, numZeros = bytesLeft < 56 ? 56 : 120, p = m.slice(m.length - bytesLeft, m.length); + p.push(128); + for (i = bytesLeft + 1; i < numZeros; i++) { + p.push(0); + } + p.push(bitLenHi >>> 24 & 255); + p.push(bitLenHi >>> 16 & 255); + p.push(bitLenHi >>> 8 & 255); + p.push(bitLenHi >>> 0 & 255); + p.push(bitLenLo >>> 24 & 255); + p.push(bitLenLo >>> 16 & 255); + p.push(bitLenLo >>> 8 & 255); + p.push(bitLenLo >>> 0 & 255); + blocks(p); + return [ + h0 >>> 24 & 255, + h0 >>> 16 & 255, + h0 >>> 8 & 255, + h0 >>> 0 & 255, + h1 >>> 24 & 255, + h1 >>> 16 & 255, + h1 >>> 8 & 255, + h1 >>> 0 & 255, + h2 >>> 24 & 255, + h2 >>> 16 & 255, + h2 >>> 8 & 255, + h2 >>> 0 & 255, + h3 >>> 24 & 255, + h3 >>> 16 & 255, + h3 >>> 8 & 255, + h3 >>> 0 & 255, + h4 >>> 24 & 255, + h4 >>> 16 & 255, + h4 >>> 8 & 255, + h4 >>> 0 & 255, + h5 >>> 24 & 255, + h5 >>> 16 & 255, + h5 >>> 8 & 255, + h5 >>> 0 & 255, + h6 >>> 24 & 255, + h6 >>> 16 & 255, + h6 >>> 8 & 255, + h6 >>> 0 & 255, + h7 >>> 24 & 255, + h7 >>> 16 & 255, + h7 >>> 8 & 255, + h7 >>> 0 & 255 + ]; + } + function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) { + password = password.length <= 64 ? password : SHA256(password); + const innerLen = 64 + salt.length + 4; + const inner = new Array(innerLen); + const outerKey = new Array(64); + let i; + let dk = []; + for (i = 0; i < 64; i++) { + inner[i] = 54; + } + 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; + } + for (i = 0; i < 64; i++) outerKey[i] = 92; + for (i = 0; i < password.length; i++) outerKey[i] ^= password[i]; + function incrementCounter() { + for (let i2 = innerLen - 1; i2 >= innerLen - 4; i2--) { + inner[i2]++; + if (inner[i2] <= 255) return; + inner[i2] = 0; + } + } + 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; + } + function blockmix_salsa8(BY, Yi, r, x, _X) { + let 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 (let 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 (let i = 0; i < 16; ++i) { + B[i] += x[i]; + } + } + function blockxor(S, Si, D, len) { + for (let 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 (let i = 0; i < o.length; i++) { + const v = o[i]; + if (typeof v !== "number" || v % 1 || v < 0 || v >= 256) { + return false; + } + } + return true; + } + function ensureInteger(value, name2) { + if (typeof value !== "number" || value % 1) { + throw new Error("invalid " + name2); + } + return value; + } + 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); + let b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r); + const B = new Uint32Array(p * 32 * r); + for (let i = 0; i < B.length; i++) { + const j = i * 4; + B[i] = (b[j + 3] & 255) << 24 | (b[j + 2] & 255) << 16 | (b[j + 1] & 255) << 8 | (b[j + 0] & 255) << 0; + } + const XY = new Uint32Array(64 * r); + const V = new Uint32Array(32 * r * N); + const Yi = 32 * r; + const x = new Uint32Array(16); + const _X = new Uint32Array(16); + const totalOps = p * N * 2; + let currentOp = 0; + let lastPercent10 = null; + let stop = false; + let state = 0; + let i0 = 0, i1; + let Bi; + const limit = callback ? parseInt(1e3 / r) : 4294967295; + const nextTick = typeof setImmediate !== "undefined" ? setImmediate : setTimeout; + const incrementalSMix = function() { + if (stop) { + return callback(new Error("cancelled"), currentOp / totalOps); + } + let steps; + switch (state) { + case 0: + Bi = i0 * 32 * r; + arraycopy(B, Bi, XY, 0, Yi); + state = 1; + i1 = 0; + case 1: + steps = N - i1; + if (steps > limit) { + steps = limit; + } + for (let i = 0; i < steps; i++) { + arraycopy(XY, 0, V, (i1 + i) * Yi, Yi); + blockmix_salsa8(XY, Yi, r, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N) { + break; + } + i1 = 0; + state = 2; + case 2: + steps = N - i1; + if (steps > limit) { + steps = limit; + } + for (let i = 0; i < steps; i++) { + const offset = (2 * r - 1) * 16; + const j = XY[offset] & N - 1; + blockxor(V, j * Yi, XY, Yi); + blockmix_salsa8(XY, Yi, r, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N) { + break; + } + arraycopy(XY, 0, B, Bi, Yi); + i0++; + if (i0 < p) { + state = 0; + break; + } + b = []; + for (let i = 0; i < B.length; i++) { + b.push(B[i] >> 0 & 255); + b.push(B[i] >> 8 & 255); + b.push(B[i] >> 16 & 255); + b.push(B[i] >> 24 & 255); + } + const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen); + if (callback) { + callback(null, 1, derivedKey); + } + return derivedKey; + } + if (callback) { + nextTick(incrementalSMix); + } + }; + if (!callback) { + while (true) { + const derivedKey = incrementalSMix(); + if (derivedKey != void 0) { + return derivedKey; + } + } + } + incrementalSMix(); + } + const lib = { + scrypt: function(password, salt, N, r, p, dkLen, progressCallback) { + return new Promise(function(resolve, reject) { + let 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(password, salt, N, r, p, dkLen) { + return new Uint8Array(_scrypt(password, salt, N, r, p, dkLen)); + } + }; + if (typeof exports2 !== "undefined") { + module2.exports = lib; + } else if (typeof define === "function" && define.amd) { + define(lib); + } else if (root) { + if (root.scrypt) { + root._scrypt = root.scrypt; + } + root.scrypt = lib; + } + })(exports2); + } +}); + +// node_modules/@ethersproject/json-wallets/lib/keystore.js +var require_keystore = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/keystore.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encrypt = exports2.decrypt = exports2.decryptSync = exports2.KeystoreAccount = void 0; + var aes_js_1 = __importDefault(require_aes_js()); + var scrypt_js_1 = __importDefault(require_scrypt()); + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var hdnode_1 = require_lib21(); + var keccak256_1 = require_lib5(); + var pbkdf2_1 = require_lib18(); + var random_1 = require_lib22(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var utils_1 = require_utils4(); + var logger_1 = require_lib(); + var _version_1 = require_version18(); + var logger = new logger_1.Logger(_version_1.version); + function hasMnemonic(value) { + return value != null && value.mnemonic && value.mnemonic.phrase; + } + var KeystoreAccount = ( + /** @class */ + function(_super) { + __extends(KeystoreAccount2, _super); + function KeystoreAccount2() { + return _super !== null && _super.apply(this, arguments) || this; + } + KeystoreAccount2.prototype.isKeystoreAccount = function(value) { + return !!(value && value._isKeystoreAccount); + }; + return KeystoreAccount2; + }(properties_1.Description) + ); + exports2.KeystoreAccount = KeystoreAccount; + function _decrypt(data, key, ciphertext) { + var cipher = (0, utils_1.searchPath)(data, "crypto/cipher"); + if (cipher === "aes-128-ctr") { + var iv = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/cipherparams/iv")); + var counter = new aes_js_1.default.Counter(iv); + var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(key, counter); + return (0, bytes_1.arrayify)(aesCtr.decrypt(ciphertext)); + } + return null; + } + function _getAccount(data, key) { + var ciphertext = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/ciphertext")); + var computedMAC = (0, bytes_1.hexlify)((0, keccak256_1.keccak256)((0, bytes_1.concat)([key.slice(16, 32), ciphertext]))).substring(2); + if (computedMAC !== (0, utils_1.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", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "decrypt" + }); + } + var mnemonicKey = key.slice(32, 64); + var address = (0, transactions_1.computeAddress)(privateKey); + if (data.address) { + var check = data.address.toLowerCase(); + if (check.substring(0, 2) !== "0x") { + check = "0x" + check; + } + if ((0, address_1.getAddress)(check) !== address) { + throw new Error("address mismatch"); + } + } + var account = { + _isKeystoreAccount: true, + address, + privateKey: (0, bytes_1.hexlify)(privateKey) + }; + if ((0, utils_1.searchPath)(data, "x-ethers/version") === "0.1") { + var mnemonicCiphertext = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "x-ethers/mnemonicCiphertext")); + var mnemonicIv = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "x-ethers/mnemonicCounter")); + var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var path = (0, utils_1.searchPath)(data, "x-ethers/path") || hdnode_1.defaultPath; + var locale = (0, utils_1.searchPath)(data, "x-ethers/locale") || "en"; + var entropy = (0, bytes_1.arrayify)(mnemonicAesCtr.decrypt(mnemonicCiphertext)); + try { + var mnemonic = (0, hdnode_1.entropyToMnemonic)(entropy, locale); + var node = hdnode_1.HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + account.mnemonic = node.mnemonic; + } catch (error) { + if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { + throw error; + } + } + } + return new KeystoreAccount(account); + } + function pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) { + return (0, bytes_1.arrayify)((0, pbkdf2_1.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 = (0, utils_1.getPassword)(password); + var kdf = (0, utils_1.searchPath)(data, "crypto/kdf"); + if (kdf && typeof kdf === "string") { + var throwError = function(name2, value) { + return logger.throwArgumentError("invalid key-derivation function parameters", name2, value); + }; + if (kdf.toLowerCase() === "scrypt") { + var salt = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/kdfparams/salt")); + var N = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/n")); + var r = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/r")); + var p = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/p")); + if (!N || !r || !p) { + throwError("kdf", kdf); + } + if ((N & N - 1) !== 0) { + throwError("N", N); + } + var dkLen = parseInt((0, utils_1.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 = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/kdfparams/salt")); + var prfFunc = null; + var prf = (0, utils_1.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((0, utils_1.searchPath)(data, "crypto/kdfparams/c")); + var dkLen = parseInt((0, utils_1.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_1.default.syncScrypt); + return _getAccount(data, key); + } + exports2.decryptSync = decryptSync; + function decrypt(json, password, progressCallback) { + return __awaiter(this, void 0, void 0, function() { + var data, key; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = JSON.parse(json); + return [4, _computeKdfKey(data, password, pbkdf2, scrypt_js_1.default.scrypt, progressCallback)]; + case 1: + key = _a.sent(); + return [2, _getAccount(data, key)]; + } + }); + }); + } + exports2.decrypt = decrypt; + function encrypt(account, password, options, progressCallback) { + try { + if ((0, address_1.getAddress)(account.address) !== (0, transactions_1.computeAddress)(account.privateKey)) { + throw new Error("address/privateKey mismatch"); + } + if (hasMnemonic(account)) { + var mnemonic = account.mnemonic; + var node = hdnode_1.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || hdnode_1.defaultPath); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + } + } catch (e) { + return Promise.reject(e); + } + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (!options) { + options = {}; + } + var privateKey = (0, bytes_1.arrayify)(account.privateKey); + var passwordBytes = (0, utils_1.getPassword)(password); + var entropy = null; + var path = null; + var locale = null; + if (hasMnemonic(account)) { + var srcMnemonic = account.mnemonic; + entropy = (0, bytes_1.arrayify)((0, hdnode_1.mnemonicToEntropy)(srcMnemonic.phrase, srcMnemonic.locale || "en")); + path = srcMnemonic.path || hdnode_1.defaultPath; + locale = srcMnemonic.locale || "en"; + } + var client = options.client; + if (!client) { + client = "ethers.js"; + } + var salt = null; + if (options.salt) { + salt = (0, bytes_1.arrayify)(options.salt); + } else { + salt = (0, random_1.randomBytes)(32); + ; + } + var iv = null; + if (options.iv) { + iv = (0, bytes_1.arrayify)(options.iv); + if (iv.length !== 16) { + throw new Error("invalid iv"); + } + } else { + iv = (0, random_1.randomBytes)(16); + } + var uuidRandom = null; + if (options.uuid) { + uuidRandom = (0, bytes_1.arrayify)(options.uuid); + if (uuidRandom.length !== 16) { + throw new Error("invalid uuid"); + } + } else { + uuidRandom = (0, random_1.randomBytes)(16); + } + 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; + } + } + return scrypt_js_1.default.scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then(function(key) { + key = (0, bytes_1.arrayify)(key); + var derivedKey = key.slice(0, 16); + var macPrefix = key.slice(16, 32); + var mnemonicKey = key.slice(32, 64); + var counter = new aes_js_1.default.Counter(iv); + var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(derivedKey, counter); + var ciphertext = (0, bytes_1.arrayify)(aesCtr.encrypt(privateKey)); + var mac = (0, keccak256_1.keccak256)((0, bytes_1.concat)([macPrefix, ciphertext])); + var data = { + address: account.address.substring(2).toLowerCase(), + id: (0, utils_1.uuidV4)(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: (0, bytes_1.hexlify)(iv).substring(2) + }, + ciphertext: (0, bytes_1.hexlify)(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: (0, bytes_1.hexlify)(salt).substring(2), + n: N, + dklen: 32, + p, + r + }, + mac: mac.substring(2) + } + }; + if (entropy) { + var mnemonicIv = (0, random_1.randomBytes)(16); + var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var mnemonicCiphertext = (0, bytes_1.arrayify)(mnemonicAesCtr.encrypt(entropy)); + var now = /* @__PURE__ */ new Date(); + var timestamp = now.getUTCFullYear() + "-" + (0, utils_1.zpad)(now.getUTCMonth() + 1, 2) + "-" + (0, utils_1.zpad)(now.getUTCDate(), 2) + "T" + (0, utils_1.zpad)(now.getUTCHours(), 2) + "-" + (0, utils_1.zpad)(now.getUTCMinutes(), 2) + "-" + (0, utils_1.zpad)(now.getUTCSeconds(), 2) + ".0Z"; + data["x-ethers"] = { + client, + gethFilename: "UTC--" + timestamp + "--" + data.address, + mnemonicCounter: (0, bytes_1.hexlify)(mnemonicIv).substring(2), + mnemonicCiphertext: (0, bytes_1.hexlify)(mnemonicCiphertext).substring(2), + path, + locale, + version: "0.1" + }; + } + return JSON.stringify(data); + }); + } + exports2.encrypt = encrypt; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/index.js +var require_lib23 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decryptJsonWalletSync = exports2.decryptJsonWallet = exports2.getJsonWalletAddress = exports2.isKeystoreWallet = exports2.isCrowdsaleWallet = exports2.encryptKeystore = exports2.decryptKeystoreSync = exports2.decryptKeystore = exports2.decryptCrowdsale = void 0; + var crowdsale_1 = require_crowdsale(); + Object.defineProperty(exports2, "decryptCrowdsale", { enumerable: true, get: function() { + return crowdsale_1.decrypt; + } }); + var inspect_1 = require_inspect(); + Object.defineProperty(exports2, "getJsonWalletAddress", { enumerable: true, get: function() { + return inspect_1.getJsonWalletAddress; + } }); + Object.defineProperty(exports2, "isCrowdsaleWallet", { enumerable: true, get: function() { + return inspect_1.isCrowdsaleWallet; + } }); + Object.defineProperty(exports2, "isKeystoreWallet", { enumerable: true, get: function() { + return inspect_1.isKeystoreWallet; + } }); + var keystore_1 = require_keystore(); + Object.defineProperty(exports2, "decryptKeystore", { enumerable: true, get: function() { + return keystore_1.decrypt; + } }); + Object.defineProperty(exports2, "decryptKeystoreSync", { enumerable: true, get: function() { + return keystore_1.decryptSync; + } }); + Object.defineProperty(exports2, "encryptKeystore", { enumerable: true, get: function() { + return keystore_1.encrypt; + } }); + function decryptJsonWallet(json, password, progressCallback) { + if ((0, inspect_1.isCrowdsaleWallet)(json)) { + if (progressCallback) { + progressCallback(0); + } + var account = (0, crowdsale_1.decrypt)(json, password); + if (progressCallback) { + progressCallback(1); + } + return Promise.resolve(account); + } + if ((0, inspect_1.isKeystoreWallet)(json)) { + return (0, keystore_1.decrypt)(json, password, progressCallback); + } + return Promise.reject(new Error("invalid JSON wallet")); + } + exports2.decryptJsonWallet = decryptJsonWallet; + function decryptJsonWalletSync(json, password) { + if ((0, inspect_1.isCrowdsaleWallet)(json)) { + return (0, crowdsale_1.decrypt)(json, password); + } + if ((0, inspect_1.isKeystoreWallet)(json)) { + return (0, keystore_1.decryptSync)(json, password); + } + throw new Error("invalid JSON wallet"); + } + exports2.decryptJsonWalletSync = decryptJsonWalletSync; + } +}); + +// node_modules/@ethersproject/wallet/lib/_version.js +var require_version19 = __commonJS({ + "node_modules/@ethersproject/wallet/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "wallet/5.5.0"; + } +}); + +// node_modules/@ethersproject/wallet/lib/index.js +var require_lib24 = __commonJS({ + "node_modules/@ethersproject/wallet/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.verifyTypedData = exports2.verifyMessage = exports2.Wallet = void 0; + var address_1 = require_lib7(); + var abstract_provider_1 = require_lib12(); + var abstract_signer_1 = require_lib13(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var hdnode_1 = require_lib21(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var random_1 = require_lib22(); + var signing_key_1 = require_lib14(); + var json_wallets_1 = require_lib23(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version19(); + var logger = new logger_1.Logger(_version_1.version); + function isAccount(value) { + return value != null && (0, bytes_1.isHexString)(value.privateKey, 32) && value.address != null; + } + function hasMnemonic(value) { + var mnemonic = value.mnemonic; + return mnemonic && mnemonic.phrase; + } + var Wallet = ( + /** @class */ + function(_super) { + __extends(Wallet2, _super); + function Wallet2(privateKey, provider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Wallet2); + _this = _super.call(this) || this; + if (isAccount(privateKey)) { + var signingKey_1 = new signing_key_1.SigningKey(privateKey.privateKey); + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return signingKey_1; + }); + (0, properties_1.defineReadOnly)(_this, "address", (0, transactions_1.computeAddress)(_this.publicKey)); + if (_this.address !== (0, address_1.getAddress)(privateKey.address)) { + logger.throwArgumentError("privateKey/address mismatch", "privateKey", "[REDACTED]"); + } + if (hasMnemonic(privateKey)) { + var srcMnemonic_1 = privateKey.mnemonic; + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return { + phrase: srcMnemonic_1.phrase, + path: srcMnemonic_1.path || hdnode_1.defaultPath, + locale: srcMnemonic_1.locale || "en" + }; + }); + var mnemonic = _this.mnemonic; + var node = hdnode_1.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path); + if ((0, transactions_1.computeAddress)(node.privateKey) !== _this.address) { + logger.throwArgumentError("mnemonic/address mismatch", "privateKey", "[REDACTED]"); + } + } else { + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return null; + }); + } + } else { + if (signing_key_1.SigningKey.isSigningKey(privateKey)) { + if (privateKey.curve !== "secp256k1") { + logger.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]"); + } + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return privateKey; + }); + } else { + if (typeof privateKey === "string") { + if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { + privateKey = "0x" + privateKey; + } + } + var signingKey_2 = new signing_key_1.SigningKey(privateKey); + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return signingKey_2; + }); + } + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return null; + }); + (0, properties_1.defineReadOnly)(_this, "address", (0, transactions_1.computeAddress)(_this.publicKey)); + } + if (provider && !abstract_provider_1.Provider.isProvider(provider)) { + logger.throwArgumentError("invalid provider", "provider", provider); + } + (0, properties_1.defineReadOnly)(_this, "provider", provider || null); + return _this; + } + Object.defineProperty(Wallet2.prototype, "mnemonic", { + get: function() { + return this._mnemonic(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Wallet2.prototype, "privateKey", { + get: function() { + return this._signingKey().privateKey; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Wallet2.prototype, "publicKey", { + get: function() { + return this._signingKey().publicKey; + }, + enumerable: false, + configurable: true + }); + Wallet2.prototype.getAddress = function() { + return Promise.resolve(this.address); + }; + Wallet2.prototype.connect = function(provider) { + return new Wallet2(this, provider); + }; + Wallet2.prototype.signTransaction = function(transaction) { + var _this = this; + return (0, properties_1.resolveProperties)(transaction).then(function(tx) { + if (tx.from != null) { + if ((0, address_1.getAddress)(tx.from) !== _this.address) { + logger.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from); + } + delete tx.from; + } + var signature = _this._signingKey().signDigest((0, keccak256_1.keccak256)((0, transactions_1.serialize)(tx))); + return (0, transactions_1.serialize)(tx, signature); + }); + }; + Wallet2.prototype.signMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, (0, bytes_1.joinSignature)(this._signingKey().signDigest((0, hash_1.hashMessage)(message)))]; + }); + }); + }; + Wallet2.prototype._signTypedData = function(domain, types, value) { + return __awaiter(this, void 0, void 0, function() { + var populated; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, hash_1._TypedDataEncoder.resolveNames(domain, types, value, function(name2) { + if (_this.provider == null) { + logger.throwError("cannot resolve ENS names without a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName", + value: name2 + }); + } + return _this.provider.resolveName(name2); + })]; + case 1: + populated = _a.sent(); + return [2, (0, bytes_1.joinSignature)(this._signingKey().signDigest(hash_1._TypedDataEncoder.hash(populated.domain, types, populated.value)))]; + } + }); + }); + }; + Wallet2.prototype.encrypt = function(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 (0, json_wallets_1.encryptKeystore)(this, password, options, progressCallback); + }; + Wallet2.createRandom = function(options) { + var entropy = (0, random_1.randomBytes)(16); + if (!options) { + options = {}; + } + if (options.extraEntropy) { + entropy = (0, bytes_1.arrayify)((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.concat)([entropy, options.extraEntropy])), 0, 16)); + } + var mnemonic = (0, hdnode_1.entropyToMnemonic)(entropy, options.locale); + return Wallet2.fromMnemonic(mnemonic, options.path, options.locale); + }; + Wallet2.fromEncryptedJson = function(json, password, progressCallback) { + return (0, json_wallets_1.decryptJsonWallet)(json, password, progressCallback).then(function(account) { + return new Wallet2(account); + }); + }; + Wallet2.fromEncryptedJsonSync = function(json, password) { + return new Wallet2((0, json_wallets_1.decryptJsonWalletSync)(json, password)); + }; + Wallet2.fromMnemonic = function(mnemonic, path, wordlist) { + if (!path) { + path = hdnode_1.defaultPath; + } + return new Wallet2(hdnode_1.HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(path)); + }; + return Wallet2; + }(abstract_signer_1.Signer) + ); + exports2.Wallet = Wallet; + function verifyMessage(message, signature) { + return (0, transactions_1.recoverAddress)((0, hash_1.hashMessage)(message), signature); + } + exports2.verifyMessage = verifyMessage; + function verifyTypedData(domain, types, value, signature) { + return (0, transactions_1.recoverAddress)(hash_1._TypedDataEncoder.hash(domain, types, value), signature); + } + exports2.verifyTypedData = verifyTypedData; + } +}); + +// node_modules/@ethersproject/networks/lib/_version.js +var require_version20 = __commonJS({ + "node_modules/@ethersproject/networks/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "networks/5.5.1"; + } +}); + +// node_modules/@ethersproject/networks/lib/index.js +var require_lib25 = __commonJS({ + "node_modules/@ethersproject/networks/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getNetwork = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version20(); + var logger = new logger_1.Logger(_version_1.version); + function isRenetworkable(value) { + return value && typeof value.renetwork === "function"; + } + function ethDefaultProvider(network) { + var func = function(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) { + 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(network2) { + return ethDefaultProvider(network2); + }; + return func; + } + function etcDefaultProvider(url, network) { + var func = function(providers, options) { + if (providers.JsonRpcProvider) { + return new providers.JsonRpcProvider(url, network); + } + return null; + }; + func.renetwork = function(network2) { + return etcDefaultProvider(url, network2); + }; + 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") + }; + var networks = { + unspecified: { chainId: 0, name: "unspecified" }, + homestead, + mainnet: homestead, + morden: { chainId: 2, name: "morden" }, + 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") + }, + // ETC (See: #351) + classic: { + chainId: 61, + name: "classic", + _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/etc", "classic") + }, + classicMorden: { chainId: 62, name: "classicMorden" }, + 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" } + }; + function getNetwork(network) { + if (network == null) { + return null; + } + if (typeof network === "number") { + for (var name_1 in networks) { + var standard_1 = networks[name_1]; + if (standard_1.chainId === network) { + return { + name: standard_1.name, + chainId: standard_1.chainId, + ensAddress: standard_1.ensAddress || null, + _defaultProvider: standard_1._defaultProvider || null + }; + } + } + return { + chainId: network, + name: "unknown" + }; + } + if (typeof network === "string") { + var standard_2 = networks[network]; + if (standard_2 == null) { + return null; + } + return { + name: standard_2.name, + chainId: standard_2.chainId, + ensAddress: standard_2.ensAddress, + _defaultProvider: standard_2._defaultProvider || null + }; + } + var standard = networks[network.name]; + if (!standard) { + if (typeof network.chainId !== "number") { + logger.throwArgumentError("invalid network chainId", "network", network); + } + return network; + } + if (network.chainId !== 0 && network.chainId !== standard.chainId) { + logger.throwArgumentError("network chainId mismatch", "network", network); + } + var defaultProvider = network._defaultProvider || null; + if (defaultProvider == null && standard._defaultProvider) { + if (isRenetworkable(standard._defaultProvider)) { + defaultProvider = standard._defaultProvider.renetwork(network); + } else { + defaultProvider = standard._defaultProvider; + } + } + return { + name: network.name, + chainId: standard.chainId, + ensAddress: network.ensAddress || standard.ensAddress || null, + _defaultProvider: defaultProvider + }; + } + exports2.getNetwork = getNetwork; + } +}); + +// node_modules/@ethersproject/base64/lib/base64.js +var require_base64 = __commonJS({ + "node_modules/@ethersproject/base64/lib/base64.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encode = exports2.decode = void 0; + var bytes_1 = require_lib2(); + function decode(textData) { + return (0, bytes_1.arrayify)(new Uint8Array(Buffer.from(textData, "base64"))); + } + exports2.decode = decode; + function encode(data) { + return Buffer.from((0, bytes_1.arrayify)(data)).toString("base64"); + } + exports2.encode = encode; + } +}); + +// node_modules/@ethersproject/base64/lib/index.js +var require_lib26 = __commonJS({ + "node_modules/@ethersproject/base64/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encode = exports2.decode = void 0; + var base64_1 = require_base64(); + Object.defineProperty(exports2, "decode", { enumerable: true, get: function() { + return base64_1.decode; + } }); + Object.defineProperty(exports2, "encode", { enumerable: true, get: function() { + return base64_1.encode; + } }); + } +}); + +// node_modules/@ethersproject/web/lib/_version.js +var require_version21 = __commonJS({ + "node_modules/@ethersproject/web/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "web/5.5.1"; + } +}); + +// node_modules/@ethersproject/web/lib/geturl.js +var require_geturl = __commonJS({ + "node_modules/@ethersproject/web/lib/geturl.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getUrl = void 0; + var http_1 = __importDefault(require("http")); + var https_1 = __importDefault(require("https")); + var zlib_1 = require("zlib"); + var url_1 = require("url"); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version21(); + var logger = new logger_1.Logger(_version_1.version); + function getResponse(request) { + return new Promise(function(resolve, reject) { + request.once("response", function(resp) { + var response = { + statusCode: resp.statusCode, + statusMessage: resp.statusMessage, + headers: Object.keys(resp.headers).reduce(function(accum, name2) { + var value = resp.headers[name2]; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name2] = value; + return accum; + }, {}), + body: null + }; + resp.on("data", function(chunk) { + if (response.body == null) { + response.body = new Uint8Array(0); + } + response.body = (0, bytes_1.concat)([response.body, chunk]); + }); + resp.on("end", function() { + if (response.headers["content-encoding"] === "gzip") { + response.body = (0, bytes_1.arrayify)((0, zlib_1.gunzipSync)(response.body)); + } + resolve(response); + }); + resp.on("error", function(error) { + error.response = response; + reject(error); + }); + }); + request.on("error", function(error) { + reject(error); + }); + }); + } + function nonnull(value) { + if (value == null) { + return ""; + } + return value; + } + function getUrl(href, options) { + return __awaiter(this, void 0, void 0, function() { + var url, request, req, response; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (options == null) { + options = {}; + } + url = (0, url_1.parse)(href); + request = { + protocol: nonnull(url.protocol), + hostname: nonnull(url.hostname), + port: nonnull(url.port), + path: nonnull(url.pathname) + nonnull(url.search), + method: options.method || "GET", + headers: (0, properties_1.shallowCopy)(options.headers || {}) + }; + if (options.allowGzip) { + request.headers["accept-encoding"] = "gzip"; + } + req = null; + switch (nonnull(url.protocol)) { + case "http:": + req = http_1.default.request(request); + break; + case "https:": + req = https_1.default.request(request); + break; + default: + logger.throwError("unsupported protocol " + url.protocol, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + protocol: url.protocol, + operation: "request" + }); + } + if (options.body) { + req.write(Buffer.from(options.body)); + } + req.end(); + return [4, getResponse(req)]; + case 1: + response = _a.sent(); + return [2, response]; + } + }); + }); + } + exports2.getUrl = getUrl; + } +}); + +// node_modules/@ethersproject/web/lib/index.js +var require_lib27 = __commonJS({ + "node_modules/@ethersproject/web/lib/index.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.poll = exports2.fetchJson = exports2._fetchData = void 0; + var base64_1 = require_lib26(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var strings_1 = require_lib9(); + var logger_1 = require_lib(); + var _version_1 = require_version21(); + var logger = new logger_1.Logger(_version_1.version); + var geturl_1 = require_geturl(); + 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 ((0, bytes_1.isBytesLike)(value)) { + if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) { + try { + return (0, strings_1.toUtf8String)(value); + } catch (error) { + } + ; + } + return (0, bytes_1.hexlify)(value); + } + return value; + } + function _fetchData(connection, body, processFunc) { + 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; + var options = { + method: "GET" + }; + var allow304 = false; + var timeout = 2 * 60 * 1e3; + 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, 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", logger_1.Logger.errors.INVALID_ARGUMENT, { argument: "url", url, user: connection.user, password: "[REDACTED]" }); + } + var authorization = connection.user + ":" + connection.password; + headers["authorization"] = { + key: "Authorization", + value: "Basic " + (0, base64_1.encode)((0, strings_1.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: (0, base64_1.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", logger_1.Logger.errors.SERVER_ERROR, { + body: bodyify(dataMatch[1], dataMatch[2]), + error, + requestBody: null, + requestMethod: "GET", + 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(key2) { + var header = headers[key2]; + 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", logger_1.Logger.errors.TIMEOUT, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + timeout, + url + })); + }, timeout); + } + }); + var cancel = function() { + if (timer == null) { + return; + } + clearTimeout(timer); + timer = null; + }; + return { promise, cancel }; + }(); + var runningFetch = function() { + return __awaiter(this, void 0, void 0, function() { + var attempt, response2, location_1, tryAgain, stall, retryAfter, error_1, body_1, result2, error_2, tryAgain, timeout_1; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + attempt = 0; + _a.label = 1; + case 1: + if (!(attempt < attemptLimit)) return [3, 20]; + response2 = null; + _a.label = 2; + case 2: + _a.trys.push([2, 9, , 10]); + return [4, (0, geturl_1.getUrl)(url, options)]; + case 3: + response2 = _a.sent(); + if (!(attempt < attemptLimit)) return [3, 8]; + if (!(response2.statusCode === 301 || response2.statusCode === 302)) return [3, 4]; + location_1 = response2.headers.location || ""; + if (options.method === "GET" && location_1.match(/^https:/)) { + url = response2.headers.location; + return [3, 19]; + } + return [3, 8]; + case 4: + if (!(response2.statusCode === 429)) return [3, 8]; + tryAgain = true; + if (!throttleCallback) return [3, 6]; + return [4, throttleCallback(attempt, url)]; + case 5: + tryAgain = _a.sent(); + _a.label = 6; + case 6: + if (!tryAgain) return [3, 8]; + stall = 0; + retryAfter = response2.headers["retry-after"]; + if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1e3; + } else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + return [4, staller(stall)]; + case 7: + _a.sent(); + return [3, 19]; + case 8: + return [3, 10]; + case 9: + error_1 = _a.sent(); + response2 = error_1.response; + if (response2 == null) { + runningTimeout.cancel(); + logger.throwError("missing response", logger_1.Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + serverError: error_1, + url + }); + } + return [3, 10]; + case 10: + body_1 = response2.body; + if (allow304 && response2.statusCode === 304) { + body_1 = null; + } else if (response2.statusCode < 200 || response2.statusCode >= 300) { + runningTimeout.cancel(); + logger.throwError("bad response", logger_1.Logger.errors.SERVER_ERROR, { + status: response2.statusCode, + headers: response2.headers, + body: bodyify(body_1, response2.headers ? response2.headers["content-type"] : null), + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + } + if (!processFunc) return [3, 18]; + _a.label = 11; + case 11: + _a.trys.push([11, 13, , 18]); + return [4, processFunc(body_1, response2)]; + case 12: + result2 = _a.sent(); + runningTimeout.cancel(); + return [2, result2]; + case 13: + error_2 = _a.sent(); + if (!(error_2.throttleRetry && attempt < attemptLimit)) return [3, 17]; + tryAgain = true; + if (!throttleCallback) return [3, 15]; + return [4, throttleCallback(attempt, url)]; + case 14: + tryAgain = _a.sent(); + _a.label = 15; + case 15: + if (!tryAgain) return [3, 17]; + timeout_1 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + return [4, staller(timeout_1)]; + case 16: + _a.sent(); + return [3, 19]; + case 17: + runningTimeout.cancel(); + logger.throwError("processing response error", logger_1.Logger.errors.SERVER_ERROR, { + body: bodyify(body_1, response2.headers ? response2.headers["content-type"] : null), + error: error_2, + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + return [3, 18]; + case 18: + runningTimeout.cancel(); + return [2, body_1]; + case 19: + attempt++; + return [3, 1]; + case 20: + return [2, logger.throwError("failed response", logger_1.Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + })]; + } + }); + }); + }(); + return Promise.race([runningTimeout.promise, runningFetch]); + } + exports2._fetchData = _fetchData; + function fetchJson(connection, json, processFunc) { + var processJsonFunc = function(value, response) { + var result = null; + if (value != null) { + try { + result = JSON.parse((0, strings_1.toUtf8String)(value)); + } catch (error) { + logger.throwError("invalid JSON", logger_1.Logger.errors.SERVER_ERROR, { + body: value, + error + }); + } + } + if (processFunc) { + result = processFunc(result, response); + } + return result; + }; + var body = null; + if (json != null) { + body = (0, strings_1.toUtf8Bytes)(json); + var updated = typeof connection === "string" ? { url: connection } : (0, properties_1.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 = (0, properties_1.shallowCopy)(updated.headers); + updated.headers["content-type"] = "application/json"; + } + } else { + updated.headers = { "content-type": "application/json" }; + } + connection = updated; + } + return _fetchData(connection, body, processJsonFunc); + } + exports2.fetchJson = fetchJson; + function poll(func, options) { + if (!options) { + options = {}; + } + options = (0, properties_1.shallowCopy)(options); + if (options.floor == null) { + options.floor = 0; + } + if (options.ceiling == null) { + options.ceiling = 1e4; + } + if (options.interval == null) { + options.interval = 250; + } + return new Promise(function(resolve, reject) { + var timer = null; + var done = false; + var cancel = function() { + 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 (result !== void 0) { + if (cancel()) { + resolve(result); + } + } else if (options.oncePoll) { + options.oncePoll.once("poll", check); + } else if (options.onceBlock) { + options.onceBlock.once("block", check); + } 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(); + }); + } + exports2.poll = poll; + } +}); + +// node_modules/bech32/index.js +var require_bech32 = __commonJS({ + "node_modules/bech32/index.js"(exports2, module2) { + "use strict"; + var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; + var ALPHABET_MAP = {}; + for (z = 0; z < ALPHABET.length; z++) { + x = ALPHABET.charAt(z); + if (ALPHABET_MAP[x] !== void 0) throw new TypeError(x + " is ambiguous"); + ALPHABET_MAP[x] = z; + } + var x; + var z; + function polymodStep(pre) { + var b = pre >> 25; + return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059; + } + 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 & 31; + } + 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(); + 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 x2 = words[i]; + if (x2 >> 5 !== 0) throw new Error("Non 5-bit word"); + chk = polymodStep(chk) ^ x2; + result += ALPHABET.charAt(x2); + } + for (i = 0; i < 6; ++i) { + chk = polymodStep(chk); + } + chk ^= 1; + for (i = 0; i < 6; ++i) { + var v = chk >> (5 - i) * 5 & 31; + 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"; + 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 === void 0) return "Unknown character " + c; + chk = polymodStep(chk) ^ v; + if (i + 6 >= wordChars.length) continue; + words.push(v); + } + if (chk !== 1) return "Invalid checksum for " + str; + return { prefix, 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); + } + module2.exports = { + decodeUnsafe, + decode, + encode, + toWordsUnsafe, + toWords, + fromWordsUnsafe, + fromWords + }; + } +}); + +// node_modules/@ethersproject/providers/lib/_version.js +var require_version22 = __commonJS({ + "node_modules/@ethersproject/providers/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "providers/5.5.1"; + } +}); + +// node_modules/@ethersproject/providers/lib/formatter.js +var require_formatter = __commonJS({ + "node_modules/@ethersproject/providers/lib/formatter.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.showThrottleMessage = exports2.isCommunityResource = exports2.isCommunityResourcable = exports2.Formatter = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var Formatter = ( + /** @class */ + function() { + function Formatter2() { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, Formatter2); + this.formats = this.getDefaultFormats(); + } + Formatter2.prototype.getDefaultFormats = function() { + 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(v) { + return _this.data(v, true); + }; + formats.transaction = { + hash, + type, + accessList: Formatter2.allowNull(this.accessList.bind(this), null), + blockHash: Formatter2.allowNull(hash, null), + blockNumber: Formatter2.allowNull(number, null), + transactionIndex: Formatter2.allowNull(number, null), + confirmations: Formatter2.allowNull(number, null), + from: address, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) + // must be set + gasPrice: Formatter2.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter2.allowNull(bigNumber), + maxFeePerGas: Formatter2.allowNull(bigNumber), + gasLimit: bigNumber, + to: Formatter2.allowNull(address, null), + value: bigNumber, + nonce: number, + data, + r: Formatter2.allowNull(this.uint256), + s: Formatter2.allowNull(this.uint256), + v: Formatter2.allowNull(number), + creates: Formatter2.allowNull(address, null), + raw: Formatter2.allowNull(data) + }; + formats.transactionRequest = { + from: Formatter2.allowNull(address), + nonce: Formatter2.allowNull(number), + gasLimit: Formatter2.allowNull(bigNumber), + gasPrice: Formatter2.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter2.allowNull(bigNumber), + maxFeePerGas: Formatter2.allowNull(bigNumber), + to: Formatter2.allowNull(address), + value: Formatter2.allowNull(bigNumber), + data: Formatter2.allowNull(strictData), + type: Formatter2.allowNull(number), + accessList: Formatter2.allowNull(this.accessList.bind(this), null) + }; + formats.receiptLog = { + transactionIndex: number, + blockNumber: number, + transactionHash: hash, + address, + topics: Formatter2.arrayOf(hash), + data, + logIndex: number, + blockHash: hash + }; + formats.receipt = { + to: Formatter2.allowNull(this.address, null), + from: Formatter2.allowNull(this.address, null), + contractAddress: Formatter2.allowNull(address, null), + transactionIndex: number, + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + root: Formatter2.allowNull(hex), + gasUsed: bigNumber, + logsBloom: Formatter2.allowNull(data), + blockHash: hash, + transactionHash: hash, + logs: Formatter2.arrayOf(this.receiptLog.bind(this)), + blockNumber: number, + confirmations: Formatter2.allowNull(number, null), + cumulativeGasUsed: bigNumber, + effectiveGasPrice: Formatter2.allowNull(bigNumber), + status: Formatter2.allowNull(number), + type + }; + formats.block = { + hash, + parentHash: hash, + number, + timestamp: number, + nonce: Formatter2.allowNull(hex), + difficulty: this.difficulty.bind(this), + gasLimit: bigNumber, + gasUsed: bigNumber, + miner: address, + extraData: data, + transactions: Formatter2.allowNull(Formatter2.arrayOf(hash)), + baseFeePerGas: Formatter2.allowNull(bigNumber) + }; + formats.blockWithTransactions = (0, properties_1.shallowCopy)(formats.block); + formats.blockWithTransactions.transactions = Formatter2.allowNull(Formatter2.arrayOf(this.transactionResponse.bind(this))); + formats.filter = { + fromBlock: Formatter2.allowNull(blockTag, void 0), + toBlock: Formatter2.allowNull(blockTag, void 0), + blockHash: Formatter2.allowNull(hash, void 0), + address: Formatter2.allowNull(address, void 0), + topics: Formatter2.allowNull(this.topics.bind(this), void 0) + }; + formats.filterLog = { + blockNumber: Formatter2.allowNull(number), + blockHash: Formatter2.allowNull(hash), + transactionIndex: number, + removed: Formatter2.allowNull(this.boolean.bind(this)), + address, + data: Formatter2.allowFalsish(data, "0x"), + topics: Formatter2.arrayOf(hash), + transactionHash: hash, + logIndex: number + }; + return formats; + }; + Formatter2.prototype.accessList = function(accessList) { + return (0, transactions_1.accessListify)(accessList || []); + }; + Formatter2.prototype.number = function(number) { + if (number === "0x") { + return 0; + } + return bignumber_1.BigNumber.from(number).toNumber(); + }; + Formatter2.prototype.type = function(number) { + if (number === "0x" || number == null) { + return 0; + } + return bignumber_1.BigNumber.from(number).toNumber(); + }; + Formatter2.prototype.bigNumber = function(value) { + return bignumber_1.BigNumber.from(value); + }; + Formatter2.prototype.boolean = function(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); + }; + Formatter2.prototype.hex = function(value, strict) { + if (typeof value === "string") { + if (!strict && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if ((0, bytes_1.isHexString)(value)) { + return value.toLowerCase(); + } + } + return logger.throwArgumentError("invalid hash", "value", value); + }; + Formatter2.prototype.data = function(value, strict) { + var result = this.hex(value, strict); + if (result.length % 2 !== 0) { + throw new Error("invalid data; odd-length - " + value); + } + return result; + }; + Formatter2.prototype.address = function(value) { + return (0, address_1.getAddress)(value); + }; + Formatter2.prototype.callAddress = function(value) { + if (!(0, bytes_1.isHexString)(value, 32)) { + return null; + } + var address = (0, address_1.getAddress)((0, bytes_1.hexDataSlice)(value, 12)); + return address === constants_1.AddressZero ? null : address; + }; + Formatter2.prototype.contractAddress = function(value) { + return (0, address_1.getContractAddress)(value); + }; + Formatter2.prototype.blockTag = function(blockTag) { + if (blockTag == null) { + return "latest"; + } + if (blockTag === "earliest") { + return "0x0"; + } + if (blockTag === "latest" || blockTag === "pending") { + return blockTag; + } + if (typeof blockTag === "number" || (0, bytes_1.isHexString)(blockTag)) { + return (0, bytes_1.hexValue)(blockTag); + } + throw new Error("invalid blockTag"); + }; + Formatter2.prototype.hash = function(value, strict) { + var result = this.hex(value, strict); + if ((0, bytes_1.hexDataLength)(result) !== 32) { + return logger.throwArgumentError("invalid hash", "value", value); + } + return result; + }; + Formatter2.prototype.difficulty = function(value) { + if (value == null) { + return null; + } + var v = bignumber_1.BigNumber.from(value); + try { + return v.toNumber(); + } catch (error) { + } + return null; + }; + Formatter2.prototype.uint256 = function(value) { + if (!(0, bytes_1.isHexString)(value)) { + throw new Error("invalid uint256"); + } + return (0, bytes_1.hexZeroPad)(value, 32); + }; + Formatter2.prototype._block = function(value, format) { + if (value.author != null && value.miner == null) { + value.miner = value.author; + } + var difficulty = value._difficulty != null ? value._difficulty : value.difficulty; + var result = Formatter2.check(format, value); + result._difficulty = difficulty == null ? null : bignumber_1.BigNumber.from(difficulty); + return result; + }; + Formatter2.prototype.block = function(value) { + return this._block(value, this.formats.block); + }; + Formatter2.prototype.blockWithTransactions = function(value) { + return this._block(value, this.formats.blockWithTransactions); + }; + Formatter2.prototype.transactionRequest = function(value) { + return Formatter2.check(this.formats.transactionRequest, value); + }; + Formatter2.prototype.transactionResponse = function(transaction) { + if (transaction.gas != null && transaction.gasLimit == null) { + transaction.gasLimit = transaction.gas; + } + if (transaction.to && bignumber_1.BigNumber.from(transaction.to).isZero()) { + transaction.to = "0x0000000000000000000000000000000000000000"; + } + if (transaction.input != null && transaction.data == null) { + transaction.data = transaction.input; + } + 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 = Formatter2.check(this.formats.transaction, transaction); + if (transaction.chainId != null) { + var chainId = transaction.chainId; + if ((0, bytes_1.isHexString)(chainId)) { + chainId = bignumber_1.BigNumber.from(chainId).toNumber(); + } + result.chainId = chainId; + } else { + var chainId = transaction.networkId; + if (chainId == null && result.v == null) { + chainId = transaction.chainId; + } + if ((0, bytes_1.isHexString)(chainId)) { + chainId = bignumber_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; + } + if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") { + result.blockHash = null; + } + return result; + }; + Formatter2.prototype.transaction = function(value) { + return (0, transactions_1.parse)(value); + }; + Formatter2.prototype.receiptLog = function(value) { + return Formatter2.check(this.formats.receiptLog, value); + }; + Formatter2.prototype.receipt = function(value) { + var result = Formatter2.check(this.formats.receipt, value); + if (result.root != null) { + if (result.root.length <= 4) { + var value_1 = bignumber_1.BigNumber.from(result.root).toNumber(); + if (value_1 === 0 || value_1 === 1) { + if (result.status != null && result.status !== value_1) { + logger.throwArgumentError("alt-root-status/status mismatch", "value", { root: result.root, status: result.status }); + } + result.status = value_1; + delete result.root; + } else { + logger.throwArgumentError("invalid alt-root-status", "value.root", result.root); + } + } else if (result.root.length !== 66) { + logger.throwArgumentError("invalid root hash", "value.root", result.root); + } + } + if (result.status != null) { + result.byzantium = true; + } + return result; + }; + Formatter2.prototype.topics = function(value) { + var _this = this; + if (Array.isArray(value)) { + return value.map(function(v) { + return _this.topics(v); + }); + } else if (value != null) { + return this.hash(value, true); + } + return null; + }; + Formatter2.prototype.filter = function(value) { + return Formatter2.check(this.formats.filter, value); + }; + Formatter2.prototype.filterLog = function(value) { + return Formatter2.check(this.formats.filterLog, value); + }; + Formatter2.check = function(format, object) { + var result = {}; + for (var key in format) { + try { + var value = format[key](object[key]); + if (value !== void 0) { + result[key] = value; + } + } catch (error) { + error.checkKey = key; + error.checkValue = object[key]; + throw error; + } + } + return result; + }; + Formatter2.allowNull = function(format, nullValue) { + return function(value) { + if (value == null) { + return nullValue; + } + return format(value); + }; + }; + Formatter2.allowFalsish = function(format, replaceValue) { + return function(value) { + if (!value) { + return replaceValue; + } + return format(value); + }; + }; + Formatter2.arrayOf = function(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 Formatter2; + }() + ); + exports2.Formatter = Formatter; + function isCommunityResourcable(value) { + return value && typeof value.isCommunityResource === "function"; + } + exports2.isCommunityResourcable = isCommunityResourcable; + function isCommunityResource(value) { + return isCommunityResourcable(value) && value.isCommunityResource(); + } + exports2.isCommunityResource = isCommunityResource; + 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("=========================="); + } + exports2.showThrottleMessage = showThrottleMessage; + } +}); + +// node_modules/@ethersproject/providers/lib/base-provider.js +var require_base_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/base-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BaseProvider = exports2.Resolver = exports2.Event = void 0; + var abstract_provider_1 = require_lib12(); + var basex_1 = require_lib17(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var hash_1 = require_lib10(); + var networks_1 = require_lib25(); + var properties_1 = require_lib4(); + var sha2_1 = require_lib19(); + var strings_1 = require_lib9(); + var web_1 = require_lib27(); + var bech32_1 = __importDefault(require_bech32()); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var formatter_1 = require_formatter(); + function checkTopic(topic) { + if (topic == null) { + return "null"; + } + if ((0, bytes_1.hexDataLength)(topic) !== 32) { + logger.throwArgumentError("invalid topic", "topic", topic); + } + return topic.toLowerCase(); + } + function serializeTopics(topics) { + topics = topics.slice(); + while (topics.length > 0 && topics[topics.length - 1] == null) { + topics.pop(); + } + return topics.map(function(topic) { + if (Array.isArray(topic)) { + var unique_1 = {}; + topic.forEach(function(topic2) { + unique_1[checkTopic(topic2)] = true; + }); + var sorted = Object.keys(unique_1); + 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(topic2) { + return topic2 === "null" ? null : topic2; + }); + return comps.length === 1 ? comps[0] : comps; + }); + } + function getEventTag(eventName) { + if (typeof eventName === "string") { + eventName = eventName.toLowerCase(); + if ((0, bytes_1.hexDataLength)(eventName) === 32) { + return "tx:" + eventName; + } + if (eventName.indexOf(":") === -1) { + return eventName; + } + } else if (Array.isArray(eventName)) { + return "filter:*:" + serializeTopics(eventName); + } else if (abstract_provider_1.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); + } + function getTime() { + return (/* @__PURE__ */ new Date()).getTime(); + } + function stall(duration) { + return new Promise(function(resolve) { + setTimeout(resolve, duration); + }); + } + var PollableEvents = ["block", "network", "pending", "poll"]; + var Event = ( + /** @class */ + function() { + function Event2(tag, listener, once) { + (0, properties_1.defineReadOnly)(this, "tag", tag); + (0, properties_1.defineReadOnly)(this, "listener", listener); + (0, properties_1.defineReadOnly)(this, "once", once); + } + Object.defineProperty(Event2.prototype, "event", { + get: function() { + switch (this.type) { + case "tx": + return this.hash; + case "filter": + return this.filter; + } + return this.tag; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "type", { + get: function() { + return this.tag.split(":")[0]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "hash", { + get: function() { + var comps = this.tag.split(":"); + if (comps[0] !== "tx") { + return null; + } + return comps[1]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "filter", { + get: function() { + 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; + }, + enumerable: false, + configurable: true + }); + Event2.prototype.pollable = function() { + return this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0; + }; + return Event2; + }() + ); + exports2.Event = Event; + var coinInfos = { + "0": { symbol: "btc", p2pkh: 0, p2sh: 5, prefix: "bc" }, + "2": { symbol: "ltc", p2pkh: 48, p2sh: 50, prefix: "ltc" }, + "3": { symbol: "doge", p2pkh: 30, p2sh: 22 }, + "60": { symbol: "eth", ilk: "eth" }, + "61": { symbol: "etc", ilk: "eth" }, + "700": { symbol: "xdai", ilk: "eth" } + }; + function bytes32ify(value) { + return (0, bytes_1.hexZeroPad)(bignumber_1.BigNumber.from(value).toHexString(), 32); + } + function base58Encode(data) { + return basex_1.Base58.encode((0, bytes_1.concat)([data, (0, bytes_1.hexDataSlice)((0, sha2_1.sha256)((0, sha2_1.sha256)(data)), 0, 4)])); + } + var matchers = [ + new RegExp("^(https)://(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + new RegExp("^(ipfs)://(.*)$", "i"), + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i") + ]; + function _parseString(result) { + try { + return (0, strings_1.toUtf8String)(_parseBytes(result)); + } catch (error) { + } + return null; + } + function _parseBytes(result) { + if (result === "0x") { + return null; + } + var offset = bignumber_1.BigNumber.from((0, bytes_1.hexDataSlice)(result, 0, 32)).toNumber(); + var length = bignumber_1.BigNumber.from((0, bytes_1.hexDataSlice)(result, offset, offset + 32)).toNumber(); + return (0, bytes_1.hexDataSlice)(result, offset + 32, offset + 32 + length); + } + var Resolver = ( + /** @class */ + function() { + function Resolver2(provider, address, name2, resolvedAddress) { + (0, properties_1.defineReadOnly)(this, "provider", provider); + (0, properties_1.defineReadOnly)(this, "name", name2); + (0, properties_1.defineReadOnly)(this, "address", provider.formatter.address(address)); + (0, properties_1.defineReadOnly)(this, "_resolvedAddress", resolvedAddress); + } + Resolver2.prototype._fetchBytes = function(selector, parameters) { + return __awaiter(this, void 0, void 0, function() { + var tx, _a, error_1; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + tx = { + to: this.address, + data: (0, bytes_1.hexConcat)([selector, (0, hash_1.namehash)(this.name), parameters || "0x"]) + }; + _b.label = 1; + case 1: + _b.trys.push([1, 3, , 4]); + _a = _parseBytes; + return [4, this.provider.call(tx)]; + case 2: + return [2, _a.apply(void 0, [_b.sent()])]; + case 3: + error_1 = _b.sent(); + if (error_1.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + return [2, null]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + Resolver2.prototype._getAddress = function(coinType, hexBytes) { + var coinInfo = coinInfos[String(coinType)]; + if (coinInfo == null) { + logger.throwError("unsupported coin type: " + coinType, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(" + coinType + ")" + }); + } + if (coinInfo.ilk === "eth") { + return this.provider.formatter.address(hexBytes); + } + var bytes = (0, bytes_1.arrayify)(hexBytes); + if (coinInfo.p2pkh != null) { + var p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/); + if (p2pkh) { + var length_1 = parseInt(p2pkh[1], 16); + if (p2pkh[2].length === length_1 * 2 && length_1 >= 1 && length_1 <= 75) { + return base58Encode((0, bytes_1.concat)([[coinInfo.p2pkh], "0x" + p2pkh[2]])); + } + } + } + if (coinInfo.p2sh != null) { + var p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/); + if (p2sh) { + var length_2 = parseInt(p2sh[1], 16); + if (p2sh[2].length === length_2 * 2 && length_2 >= 1 && length_2 <= 75) { + return base58Encode((0, bytes_1.concat)([[coinInfo.p2sh], "0x" + p2sh[2]])); + } + } + } + if (coinInfo.prefix != null) { + var length_3 = bytes[1]; + var version_1 = bytes[0]; + if (version_1 === 0) { + if (length_3 !== 20 && length_3 !== 32) { + version_1 = -1; + } + } else { + version_1 = -1; + } + if (version_1 >= 0 && bytes.length === 2 + length_3 && length_3 >= 1 && length_3 <= 75) { + var words = bech32_1.default.toWords(bytes.slice(2)); + words.unshift(version_1); + return bech32_1.default.encode(coinInfo.prefix, words); + } + } + return null; + }; + Resolver2.prototype.getAddress = function(coinType) { + return __awaiter(this, void 0, void 0, function() { + var transaction, hexBytes_1, error_2, hexBytes, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (coinType == null) { + coinType = 60; + } + if (!(coinType === 60)) return [3, 4]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + transaction = { + to: this.address, + data: "0x3b3b57de" + (0, hash_1.namehash)(this.name).substring(2) + }; + return [4, this.provider.call(transaction)]; + case 2: + hexBytes_1 = _a.sent(); + if (hexBytes_1 === "0x" || hexBytes_1 === constants_1.HashZero) { + return [2, null]; + } + return [2, this.provider.formatter.callAddress(hexBytes_1)]; + case 3: + error_2 = _a.sent(); + if (error_2.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + throw error_2; + case 4: + return [4, this._fetchBytes("0xf1cb7e06", bytes32ify(coinType))]; + case 5: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + address = this._getAddress(coinType, hexBytes); + if (address == null) { + logger.throwError("invalid or unsupported coin data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(" + coinType + ")", + coinType, + data: hexBytes + }); + } + return [2, address]; + } + }); + }); + }; + Resolver2.prototype.getAvatar = function() { + return __awaiter(this, void 0, void 0, function() { + var linkage, avatar, i, match, _a, selector, owner, _b, comps, addr, tokenId, tokenOwner, _c, _d, balance, _e, _f, tx, metadataUrl, _g, metadata, error_3; + return __generator(this, function(_h) { + switch (_h.label) { + case 0: + linkage = []; + _h.label = 1; + case 1: + _h.trys.push([1, 19, , 20]); + return [4, this.getText("avatar")]; + case 2: + avatar = _h.sent(); + if (avatar == null) { + return [2, null]; + } + i = 0; + _h.label = 3; + case 3: + if (!(i < matchers.length)) return [3, 18]; + match = avatar.match(matchers[i]); + if (match == null) { + return [3, 17]; + } + _a = match[1]; + switch (_a) { + case "https": + return [3, 4]; + case "data": + return [3, 5]; + case "ipfs": + return [3, 6]; + case "erc721": + return [3, 7]; + case "erc1155": + return [3, 7]; + } + return [3, 17]; + case 4: + linkage.push({ type: "url", content: avatar }); + return [2, { linkage, url: avatar }]; + case 5: + linkage.push({ type: "data", content: avatar }); + return [2, { linkage, url: avatar }]; + case 6: + linkage.push({ type: "ipfs", content: avatar }); + return [2, { linkage, url: "https://gateway.ipfs.io/ipfs/" + avatar.substring(7) }]; + case 7: + selector = match[1] === "erc721" ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: match[1], content: avatar }); + _b = this._resolvedAddress; + if (_b) return [3, 9]; + return [4, this.getAddress()]; + case 8: + _b = _h.sent(); + _h.label = 9; + case 9: + owner = _b; + comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return [2, null]; + } + return [4, this.provider.formatter.address(comps[0])]; + case 10: + addr = _h.sent(); + tokenId = (0, bytes_1.hexZeroPad)(bignumber_1.BigNumber.from(comps[1]).toHexString(), 32); + if (!(match[1] === "erc721")) return [3, 12]; + _d = (_c = this.provider.formatter).callAddress; + return [4, this.provider.call({ + to: addr, + data: (0, bytes_1.hexConcat)(["0x6352211e", tokenId]) + })]; + case 11: + tokenOwner = _d.apply(_c, [_h.sent()]); + if (owner !== tokenOwner) { + return [2, null]; + } + linkage.push({ type: "owner", content: tokenOwner }); + return [3, 14]; + case 12: + if (!(match[1] === "erc1155")) return [3, 14]; + _f = (_e = bignumber_1.BigNumber).from; + return [4, this.provider.call({ + to: addr, + data: (0, bytes_1.hexConcat)(["0x00fdd58e", (0, bytes_1.hexZeroPad)(owner, 32), tokenId]) + })]; + case 13: + balance = _f.apply(_e, [_h.sent()]); + if (balance.isZero()) { + return [2, null]; + } + linkage.push({ type: "balance", content: balance.toString() }); + _h.label = 14; + case 14: + tx = { + to: this.provider.formatter.address(comps[0]), + data: (0, bytes_1.hexConcat)([selector, tokenId]) + }; + _g = _parseString; + return [4, this.provider.call(tx)]; + case 15: + metadataUrl = _g.apply(void 0, [_h.sent()]); + if (metadataUrl == null) { + return [2, null]; + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + if (match[1] === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + } + return [4, (0, web_1.fetchJson)(metadataUrl)]; + case 16: + metadata = _h.sent(); + if (!metadata || typeof metadata.image !== "string" || !metadata.image.match(/^(https:\/\/|data:)/i)) { + return [2, null]; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + linkage.push({ type: "url", content: metadata.image }); + return [2, { linkage, url: metadata.image }]; + case 17: + i++; + return [3, 3]; + case 18: + return [3, 20]; + case 19: + error_3 = _h.sent(); + return [3, 20]; + case 20: + return [2, null]; + } + }); + }); + }; + Resolver2.prototype.getContentHash = function() { + return __awaiter(this, void 0, void 0, function() { + var hexBytes, ipfs, length_4, swarm; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._fetchBytes("0xbc1c58d1")]; + case 1: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + length_4 = parseInt(ipfs[3], 16); + if (ipfs[4].length === length_4 * 2) { + return [2, "ipfs://" + basex_1.Base58.encode("0x" + ipfs[1])]; + } + } + swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm) { + if (swarm[1].length === 32 * 2) { + return [2, "bzz://" + swarm[1]]; + } + } + return [2, logger.throwError("invalid or unsupported content hash data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getContentHash()", + data: hexBytes + })]; + } + }); + }); + }; + Resolver2.prototype.getText = function(key) { + return __awaiter(this, void 0, void 0, function() { + var keyBytes, hexBytes; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + keyBytes = (0, strings_1.toUtf8Bytes)(key); + keyBytes = (0, bytes_1.concat)([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]); + if (keyBytes.length % 32 !== 0) { + keyBytes = (0, bytes_1.concat)([keyBytes, (0, bytes_1.hexZeroPad)("0x", 32 - key.length % 32)]); + } + return [4, this._fetchBytes("0x59d1d43c", (0, bytes_1.hexlify)(keyBytes))]; + case 1: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + return [2, (0, strings_1.toUtf8String)(hexBytes)]; + } + }); + }); + }; + return Resolver2; + }() + ); + exports2.Resolver = Resolver; + var defaultFormatter = null; + var nextPollId = 1; + var BaseProvider = ( + /** @class */ + function(_super) { + __extends(BaseProvider2, _super); + function BaseProvider2(network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, abstract_provider_1.Provider); + _this = _super.call(this) || this; + _this._events = []; + _this._emitted = { block: -2 }; + _this.formatter = _newTarget.getFormatter(); + (0, properties_1.defineReadOnly)(_this, "anyNetwork", network === "any"); + if (_this.anyNetwork) { + network = _this.detectNetwork(); + } + if (network instanceof Promise) { + _this._networkPromise = network; + network.catch(function(error) { + }); + _this._ready().catch(function(error) { + }); + } else { + var knownNetwork = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + if (knownNetwork) { + (0, properties_1.defineReadOnly)(_this, "_network", knownNetwork); + _this.emit("network", knownNetwork, null); + } else { + logger.throwArgumentError("invalid network", "network", network); + } + } + _this._maxInternalBlockNumber = -1024; + _this._lastBlockNumber = -2; + _this._pollingInterval = 4e3; + _this._fastQueryDate = 0; + return _this; + } + BaseProvider2.prototype._ready = function() { + return __awaiter(this, void 0, void 0, function() { + var network, error_4; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(this._network == null)) return [3, 7]; + network = null; + if (!this._networkPromise) return [3, 4]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, this._networkPromise]; + case 2: + network = _a.sent(); + return [3, 4]; + case 3: + error_4 = _a.sent(); + return [3, 4]; + case 4: + if (!(network == null)) return [3, 6]; + return [4, this.detectNetwork()]; + case 5: + network = _a.sent(); + _a.label = 6; + case 6: + if (!network) { + logger.throwError("no network detected", logger_1.Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + if (this.anyNetwork) { + this._network = network; + } else { + (0, properties_1.defineReadOnly)(this, "_network", network); + } + this.emit("network", network, null); + } + _a.label = 7; + case 7: + return [2, this._network]; + } + }); + }); + }; + Object.defineProperty(BaseProvider2.prototype, "ready", { + // 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 + get: function() { + var _this = this; + return (0, web_1.poll)(function() { + return _this._ready().then(function(network) { + return network; + }, function(error) { + if (error.code === logger_1.Logger.errors.NETWORK_ERROR && error.event === "noNetwork") { + return void 0; + } + throw error; + }); + }); + }, + enumerable: false, + configurable: true + }); + BaseProvider2.getFormatter = function() { + if (defaultFormatter == null) { + defaultFormatter = new formatter_1.Formatter(); + } + return defaultFormatter; + }; + BaseProvider2.getNetwork = function(network) { + return (0, networks_1.getNetwork)(network == null ? "homestead" : network); + }; + BaseProvider2.prototype._getInternalBlockNumber = function(maxAge) { + return __awaiter(this, void 0, void 0, function() { + var internalBlockNumber, result, error_5, reqTime, checkInternalBlockNumber; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._ready()]; + case 1: + _a.sent(); + if (!(maxAge > 0)) return [3, 7]; + _a.label = 2; + case 2: + if (!this._internalBlockNumber) return [3, 7]; + internalBlockNumber = this._internalBlockNumber; + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, internalBlockNumber]; + case 4: + result = _a.sent(); + if (getTime() - result.respTime <= maxAge) { + return [2, result.blockNumber]; + } + return [3, 7]; + case 5: + error_5 = _a.sent(); + if (this._internalBlockNumber === internalBlockNumber) { + return [3, 7]; + } + return [3, 6]; + case 6: + return [3, 2]; + case 7: + reqTime = getTime(); + checkInternalBlockNumber = (0, properties_1.resolveProperties)({ + blockNumber: this.perform("getBlockNumber", {}), + networkError: this.getNetwork().then(function(network) { + return null; + }, function(error) { + return error; + }) + }).then(function(_a2) { + var blockNumber = _a2.blockNumber, networkError = _a2.networkError; + if (networkError) { + if (_this._internalBlockNumber === checkInternalBlockNumber) { + _this._internalBlockNumber = null; + } + throw networkError; + } + var respTime = getTime(); + blockNumber = bignumber_1.BigNumber.from(blockNumber).toNumber(); + if (blockNumber < _this._maxInternalBlockNumber) { + blockNumber = _this._maxInternalBlockNumber; + } + _this._maxInternalBlockNumber = blockNumber; + _this._setFastBlockNumber(blockNumber); + return { blockNumber, reqTime, respTime }; + }); + this._internalBlockNumber = checkInternalBlockNumber; + checkInternalBlockNumber.catch(function(error) { + if (_this._internalBlockNumber === checkInternalBlockNumber) { + _this._internalBlockNumber = null; + } + }); + return [4, checkInternalBlockNumber]; + case 8: + return [2, _a.sent().blockNumber]; + } + }); + }); + }; + BaseProvider2.prototype.poll = function() { + return __awaiter(this, void 0, void 0, function() { + var pollId, runners, blockNumber, error_6, i; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + pollId = nextPollId++; + runners = []; + blockNumber = null; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, this._getInternalBlockNumber(100 + this.pollingInterval / 2)]; + case 2: + blockNumber = _a.sent(); + return [3, 4]; + case 3: + error_6 = _a.sent(); + this.emit("error", error_6); + return [ + 2 + /*return*/ + ]; + case 4: + this._setFastBlockNumber(blockNumber); + this.emit("poll", pollId, blockNumber); + if (blockNumber === this._lastBlockNumber) { + this.emit("didPoll", pollId); + return [ + 2 + /*return*/ + ]; + } + if (this._emitted.block === -2) { + this._emitted.block = blockNumber - 1; + } + if (Math.abs(this._emitted.block - blockNumber) > 1e3) { + logger.warn("network block skew detected; skipping block events (emitted=" + this._emitted.block + " blockNumber" + blockNumber + ")"); + this.emit("error", logger.makeError("network block skew detected", logger_1.Logger.errors.NETWORK_ERROR, { + blockNumber, + event: "blockSkew", + previousBlockNumber: this._emitted.block + })); + this.emit("block", blockNumber); + } else { + for (i = this._emitted.block + 1; i <= blockNumber; i++) { + this.emit("block", i); + } + } + if (this._emitted.block !== blockNumber) { + this._emitted.block = blockNumber; + Object.keys(this._emitted).forEach(function(key) { + if (key === "block") { + return; + } + var eventBlockNumber = _this._emitted[key]; + if (eventBlockNumber === "pending") { + return; + } + if (blockNumber - eventBlockNumber > 12) { + delete _this._emitted[key]; + } + }); + } + if (this._lastBlockNumber === -2) { + this._lastBlockNumber = blockNumber - 1; + } + this._events.forEach(function(event) { + switch (event.type) { + case "tx": { + var hash_2 = event.hash; + var runner = _this.getTransactionReceipt(hash_2).then(function(receipt) { + if (!receipt || receipt.blockNumber == null) { + return null; + } + _this._emitted["t:" + hash_2] = receipt.blockNumber; + _this.emit(hash_2, receipt); + return null; + }).catch(function(error) { + _this.emit("error", error); + }); + runners.push(runner); + break; + } + case "filter": { + var filter_1 = event.filter; + filter_1.fromBlock = _this._lastBlockNumber + 1; + filter_1.toBlock = blockNumber; + var runner = _this.getLogs(filter_1).then(function(logs) { + if (logs.length === 0) { + return; + } + logs.forEach(function(log) { + _this._emitted["b:" + log.blockHash] = log.blockNumber; + _this._emitted["t:" + log.transactionHash] = log.blockNumber; + _this.emit(filter_1, log); + }); + }).catch(function(error) { + _this.emit("error", error); + }); + runners.push(runner); + break; + } + } + }); + this._lastBlockNumber = blockNumber; + Promise.all(runners).then(function() { + _this.emit("didPoll", pollId); + }).catch(function(error) { + _this.emit("error", error); + }); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.resetEventsBlock = function(blockNumber) { + this._lastBlockNumber = blockNumber - 1; + if (this.polling) { + this.poll(); + } + }; + Object.defineProperty(BaseProvider2.prototype, "network", { + get: function() { + return this._network; + }, + enumerable: false, + configurable: true + }); + BaseProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, logger.throwError("provider does not support network detection", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "provider.detectNetwork" + })]; + }); + }); + }; + BaseProvider2.prototype.getNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var network, currentNetwork, error; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._ready()]; + case 1: + network = _a.sent(); + return [4, this.detectNetwork()]; + case 2: + currentNetwork = _a.sent(); + if (!(network.chainId !== currentNetwork.chainId)) return [3, 5]; + if (!this.anyNetwork) return [3, 4]; + this._network = currentNetwork; + this._lastBlockNumber = -2; + this._fastBlockNumber = null; + this._fastBlockNumberPromise = null; + this._fastQueryDate = 0; + this._emitted.block = -2; + this._maxInternalBlockNumber = -1024; + this._internalBlockNumber = null; + this.emit("network", currentNetwork, network); + return [4, stall(0)]; + case 3: + _a.sent(); + return [2, this._network]; + case 4: + error = logger.makeError("underlying network changed", logger_1.Logger.errors.NETWORK_ERROR, { + event: "changed", + network, + detectedNetwork: currentNetwork + }); + this.emit("error", error); + throw error; + case 5: + return [2, network]; + } + }); + }); + }; + Object.defineProperty(BaseProvider2.prototype, "blockNumber", { + get: function() { + var _this = this; + this._getInternalBlockNumber(100 + this.pollingInterval / 2).then(function(blockNumber) { + _this._setFastBlockNumber(blockNumber); + }, function(error) { + }); + return this._fastBlockNumber != null ? this._fastBlockNumber : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseProvider2.prototype, "polling", { + get: function() { + return this._poller != null; + }, + set: function(value) { + var _this = this; + if (value && !this._poller) { + this._poller = setInterval(function() { + _this.poll(); + }, this.pollingInterval); + if (!this._bootstrapPoll) { + this._bootstrapPoll = setTimeout(function() { + _this.poll(); + _this._bootstrapPoll = setTimeout(function() { + if (!_this._poller) { + _this.poll(); + } + _this._bootstrapPoll = null; + }, _this.pollingInterval); + }, 0); + } + } else if (!value && this._poller) { + clearInterval(this._poller); + this._poller = null; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseProvider2.prototype, "pollingInterval", { + get: function() { + return this._pollingInterval; + }, + set: function(value) { + var _this = 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() { + _this.poll(); + }, this._pollingInterval); + } + }, + enumerable: false, + configurable: true + }); + BaseProvider2.prototype._getFastBlockNumber = function() { + var _this = this; + var now = getTime(); + if (now - this._fastQueryDate > 2 * this._pollingInterval) { + this._fastQueryDate = now; + this._fastBlockNumberPromise = this.getBlockNumber().then(function(blockNumber) { + if (_this._fastBlockNumber == null || blockNumber > _this._fastBlockNumber) { + _this._fastBlockNumber = blockNumber; + } + return _this._fastBlockNumber; + }); + } + return this._fastBlockNumberPromise; + }; + BaseProvider2.prototype._setFastBlockNumber = function(blockNumber) { + if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { + return; + } + this._fastQueryDate = getTime(); + if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { + this._fastBlockNumber = blockNumber; + this._fastBlockNumberPromise = Promise.resolve(blockNumber); + } + }; + BaseProvider2.prototype.waitForTransaction = function(transactionHash, confirmations, timeout) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this._waitForTransaction(transactionHash, confirmations == null ? 1 : confirmations, timeout || 0, null)]; + }); + }); + }; + BaseProvider2.prototype._waitForTransaction = function(transactionHash, confirmations, timeout, replaceable) { + return __awaiter(this, void 0, void 0, function() { + var receipt; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getTransactionReceipt(transactionHash)]; + case 1: + receipt = _a.sent(); + if ((receipt ? receipt.confirmations : 0) >= confirmations) { + return [2, receipt]; + } + return [2, new Promise(function(resolve, reject) { + var cancelFuncs = []; + var done = false; + var alreadyDone = function() { + if (done) { + return true; + } + done = true; + cancelFuncs.forEach(function(func) { + func(); + }); + return false; + }; + var minedHandler = function(receipt2) { + if (receipt2.confirmations < confirmations) { + return; + } + if (alreadyDone()) { + return; + } + resolve(receipt2); + }; + _this.on(transactionHash, minedHandler); + cancelFuncs.push(function() { + _this.removeListener(transactionHash, minedHandler); + }); + if (replaceable) { + var lastBlockNumber_1 = replaceable.startBlock; + var scannedBlock_1 = null; + var replaceHandler_1 = function(blockNumber) { + return __awaiter(_this, void 0, void 0, function() { + var _this2 = this; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, stall(1e3)]; + case 1: + _a2.sent(); + this.getTransactionCount(replaceable.from).then(function(nonce) { + return __awaiter(_this2, void 0, void 0, function() { + var mined, block, ti, tx, receipt_1, reason; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + if (done) { + return [ + 2 + /*return*/ + ]; + } + if (!(nonce <= replaceable.nonce)) return [3, 1]; + lastBlockNumber_1 = blockNumber; + return [3, 9]; + case 1: + return [4, this.getTransaction(transactionHash)]; + case 2: + mined = _a3.sent(); + if (mined && mined.blockNumber != null) { + return [ + 2 + /*return*/ + ]; + } + if (scannedBlock_1 == null) { + scannedBlock_1 = lastBlockNumber_1 - 3; + if (scannedBlock_1 < replaceable.startBlock) { + scannedBlock_1 = replaceable.startBlock; + } + } + _a3.label = 3; + case 3: + if (!(scannedBlock_1 <= blockNumber)) return [3, 9]; + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, this.getBlockWithTransactions(scannedBlock_1)]; + case 4: + block = _a3.sent(); + ti = 0; + _a3.label = 5; + case 5: + if (!(ti < block.transactions.length)) return [3, 8]; + tx = block.transactions[ti]; + if (tx.hash === transactionHash) { + return [ + 2 + /*return*/ + ]; + } + if (!(tx.from === replaceable.from && tx.nonce === replaceable.nonce)) return [3, 7]; + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, this.waitForTransaction(tx.hash, confirmations)]; + case 6: + receipt_1 = _a3.sent(); + if (alreadyDone()) { + return [ + 2 + /*return*/ + ]; + } + 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"; + } + reject(logger.makeError("transaction was replaced", logger_1.Logger.errors.TRANSACTION_REPLACED, { + cancelled: reason === "replaced" || reason === "cancelled", + reason, + replacement: this._wrapTransaction(tx), + hash: transactionHash, + receipt: receipt_1 + })); + return [ + 2 + /*return*/ + ]; + case 7: + ti++; + return [3, 5]; + case 8: + scannedBlock_1++; + return [3, 3]; + case 9: + if (done) { + return [ + 2 + /*return*/ + ]; + } + this.once("block", replaceHandler_1); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }, function(error) { + if (done) { + return; + } + _this2.once("block", replaceHandler_1); + }); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + if (done) { + return; + } + _this.once("block", replaceHandler_1); + cancelFuncs.push(function() { + _this.removeListener("block", replaceHandler_1); + }); + } + if (typeof timeout === "number" && timeout > 0) { + var timer_1 = setTimeout(function() { + if (alreadyDone()) { + return; + } + reject(logger.makeError("timeout exceeded", logger_1.Logger.errors.TIMEOUT, { timeout })); + }, timeout); + if (timer_1.unref) { + timer_1.unref(); + } + cancelFuncs.push(function() { + clearTimeout(timer_1); + }); + } + })]; + } + }); + }); + }; + BaseProvider2.prototype.getBlockNumber = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this._getInternalBlockNumber(0)]; + }); + }); + }; + BaseProvider2.prototype.getGasPrice = function() { + return __awaiter(this, void 0, void 0, function() { + var result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, this.perform("getGasPrice", {})]; + case 2: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getGasPrice", + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getBalance = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getBalance", params)]; + case 3: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getBalance", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getTransactionCount = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getTransactionCount", params)]; + case 3: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result).toNumber()]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getTransactionCount", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getCode = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getCode", params)]; + case 3: + result = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getCode", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getStorageAt = function(addressOrName, position, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag), + position: Promise.resolve(position).then(function(p) { + return (0, bytes_1.hexValue)(p); + }) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getStorageAt", params)]; + case 3: + result = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getStorageAt", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._wrapTransaction = function(tx, hash, startBlock) { + var _this = this; + if (hash != null && (0, bytes_1.hexDataLength)(hash) !== 32) { + throw new Error("invalid response - sendTransaction"); + } + var result = tx; + if (hash != null && tx.hash !== hash) { + logger.throwError("Transaction hash mismatch from Provider.sendTransaction.", logger_1.Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash }); + } + result.wait = function(confirms, timeout) { + return __awaiter(_this, void 0, void 0, function() { + var replacement, receipt; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (confirms == null) { + confirms = 1; + } + if (timeout == null) { + timeout = 0; + } + replacement = void 0; + if (confirms !== 0 && startBlock != null) { + replacement = { + data: tx.data, + from: tx.from, + nonce: tx.nonce, + to: tx.to, + value: tx.value, + startBlock + }; + } + return [4, this._waitForTransaction(tx.hash, confirms, timeout, replacement)]; + case 1: + receipt = _a.sent(); + if (receipt == null && confirms === 0) { + return [2, null]; + } + this._emitted["t:" + tx.hash] = receipt.blockNumber; + if (receipt.status === 0) { + logger.throwError("transaction failed", logger_1.Logger.errors.CALL_EXCEPTION, { + transactionHash: tx.hash, + transaction: tx, + receipt + }); + } + return [2, receipt]; + } + }); + }); + }; + return result; + }; + BaseProvider2.prototype.sendTransaction = function(signedTransaction) { + return __awaiter(this, void 0, void 0, function() { + var hexTx, tx, blockNumber, hash, error_7; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, Promise.resolve(signedTransaction).then(function(t) { + return (0, bytes_1.hexlify)(t); + })]; + case 2: + hexTx = _a.sent(); + tx = this.formatter.transaction(signedTransaction); + if (tx.confirmations == null) { + tx.confirmations = 0; + } + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a.sent(); + _a.label = 4; + case 4: + _a.trys.push([4, 6, , 7]); + return [4, this.perform("sendTransaction", { signedTransaction: hexTx })]; + case 5: + hash = _a.sent(); + return [2, this._wrapTransaction(tx, hash, blockNumber)]; + case 6: + error_7 = _a.sent(); + error_7.transaction = tx; + error_7.transactionHash = tx.hash; + throw error_7; + case 7: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getTransactionRequest = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var values, tx, _a, _b; + var _this = this; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, transaction]; + case 1: + values = _c.sent(); + tx = {}; + ["from", "to"].forEach(function(key) { + if (values[key] == null) { + return; + } + tx[key] = Promise.resolve(values[key]).then(function(v) { + return v ? _this._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 ? bignumber_1.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 ? (0, bytes_1.hexlify)(v) : null; + }); + }); + _b = (_a = this.formatter).transactionRequest; + return [4, (0, properties_1.resolveProperties)(tx)]; + case 2: + return [2, _b.apply(_a, [_c.sent()])]; + } + }); + }); + }; + BaseProvider2.prototype._getFilter = function(filter) { + return __awaiter(this, void 0, void 0, function() { + var result, _a, _b; + var _this = this; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, filter]; + case 1: + filter = _c.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] = _this._getBlockTag(filter[key]); + }); + _b = (_a = this.formatter).filter; + return [4, (0, properties_1.resolveProperties)(result)]; + case 2: + return [2, _b.apply(_a, [_c.sent()])]; + } + }); + }); + }; + BaseProvider2.prototype.call = function(transaction, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("call", params)]; + case 3: + result = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "call", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.estimateGas = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + transaction: this._getTransactionRequest(transaction) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("estimateGas", params)]; + case 3: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "estimateGas", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getAddress = function(addressOrName) { + return __awaiter(this, void 0, void 0, function() { + var address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, addressOrName]; + case 1: + addressOrName = _a.sent(); + if (typeof addressOrName !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } + return [4, this.resolveName(addressOrName)]; + case 2: + address = _a.sent(); + if (address == null) { + logger.throwError("ENS name not configured", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName(" + JSON.stringify(addressOrName) + ")" + }); + } + return [2, address]; + } + }); + }); + }; + BaseProvider2.prototype._getBlock = function(blockHashOrBlockTag, includeTransactions) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber, params, _a, error_8; + var _this = this; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _b.sent(); + return [4, blockHashOrBlockTag]; + case 2: + blockHashOrBlockTag = _b.sent(); + blockNumber = -128; + params = { + includeTransactions: !!includeTransactions + }; + if (!(0, bytes_1.isHexString)(blockHashOrBlockTag, 32)) return [3, 3]; + params.blockHash = blockHashOrBlockTag; + return [3, 6]; + case 3: + _b.trys.push([3, 5, , 6]); + _a = params; + return [4, this._getBlockTag(blockHashOrBlockTag)]; + case 4: + _a.blockTag = _b.sent(); + if ((0, bytes_1.isHexString)(params.blockTag)) { + blockNumber = parseInt(params.blockTag.substring(2), 16); + } + return [3, 6]; + case 5: + error_8 = _b.sent(); + logger.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag); + return [3, 6]; + case 6: + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var block, blockNumber_1, i, tx, confirmations, blockWithTxs; + var _this2 = this; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getBlock", params)]; + case 1: + block = _a2.sent(); + if (block == null) { + if (params.blockHash != null) { + if (this._emitted["b:" + params.blockHash] == null) { + return [2, null]; + } + } + if (params.blockTag != null) { + if (blockNumber > this._emitted.block) { + return [2, null]; + } + } + return [2, void 0]; + } + if (!includeTransactions) return [3, 8]; + blockNumber_1 = null; + i = 0; + _a2.label = 2; + case 2: + if (!(i < block.transactions.length)) return [3, 7]; + tx = block.transactions[i]; + if (!(tx.blockNumber == null)) return [3, 3]; + tx.confirmations = 0; + return [3, 6]; + case 3: + if (!(tx.confirmations == null)) return [3, 6]; + if (!(blockNumber_1 == null)) return [3, 5]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 4: + blockNumber_1 = _a2.sent(); + _a2.label = 5; + case 5: + confirmations = blockNumber_1 - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + _a2.label = 6; + case 6: + i++; + return [3, 2]; + case 7: + blockWithTxs = this.formatter.blockWithTransactions(block); + blockWithTxs.transactions = blockWithTxs.transactions.map(function(tx2) { + return _this2._wrapTransaction(tx2); + }); + return [2, blockWithTxs]; + case 8: + return [2, this.formatter.block(block)]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getBlock = function(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, false); + }; + BaseProvider2.prototype.getBlockWithTransactions = function(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, true); + }; + BaseProvider2.prototype.getTransaction = function(transactionHash) { + return __awaiter(this, void 0, void 0, function() { + var params; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, transactionHash]; + case 2: + transactionHash = _a.sent(); + params = { transactionHash: this.formatter.hash(transactionHash, true) }; + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var result, tx, blockNumber, confirmations; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getTransaction", params)]; + case 1: + result = _a2.sent(); + if (result == null) { + if (this._emitted["t:" + transactionHash] == null) { + return [2, null]; + } + return [2, void 0]; + } + tx = this.formatter.transactionResponse(result); + if (!(tx.blockNumber == null)) return [3, 2]; + tx.confirmations = 0; + return [3, 4]; + case 2: + if (!(tx.confirmations == null)) return [3, 4]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a2.sent(); + confirmations = blockNumber - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + _a2.label = 4; + case 4: + return [2, this._wrapTransaction(tx)]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getTransactionReceipt = function(transactionHash) { + return __awaiter(this, void 0, void 0, function() { + var params; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, transactionHash]; + case 2: + transactionHash = _a.sent(); + params = { transactionHash: this.formatter.hash(transactionHash, true) }; + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var result, receipt, blockNumber, confirmations; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getTransactionReceipt", params)]; + case 1: + result = _a2.sent(); + if (result == null) { + if (this._emitted["t:" + transactionHash] == null) { + return [2, null]; + } + return [2, void 0]; + } + if (result.blockHash == null) { + return [2, void 0]; + } + receipt = this.formatter.receipt(result); + if (!(receipt.blockNumber == null)) return [3, 2]; + receipt.confirmations = 0; + return [3, 4]; + case 2: + if (!(receipt.confirmations == null)) return [3, 4]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a2.sent(); + confirmations = blockNumber - receipt.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + receipt.confirmations = confirmations; + _a2.label = 4; + case 4: + return [2, receipt]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getLogs = function(filter) { + return __awaiter(this, void 0, void 0, function() { + var params, logs; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ filter: this._getFilter(filter) })]; + case 2: + params = _a.sent(); + return [4, this.perform("getLogs", params)]; + case 3: + logs = _a.sent(); + logs.forEach(function(log) { + if (log.removed == null) { + log.removed = false; + } + }); + return [2, formatter_1.Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs)]; + } + }); + }); + }; + BaseProvider2.prototype.getEtherPrice = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [2, this.perform("getEtherPrice", {})]; + } + }); + }); + }; + BaseProvider2.prototype._getBlockTag = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, blockTag]; + case 1: + blockTag = _a.sent(); + if (!(typeof blockTag === "number" && blockTag < 0)) return [3, 3]; + if (blockTag % 1) { + logger.throwArgumentError("invalid BlockTag", "blockTag", blockTag); + } + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 2: + blockNumber = _a.sent(); + blockNumber += blockTag; + if (blockNumber < 0) { + blockNumber = 0; + } + return [2, this.formatter.blockTag(blockNumber)]; + case 3: + return [2, this.formatter.blockTag(blockTag)]; + } + }); + }); + }; + BaseProvider2.prototype.getResolver = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var address, error_9; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4, this._getResolver(name2)]; + case 1: + address = _a.sent(); + if (address == null) { + return [2, null]; + } + return [2, new Resolver(this, address, name2)]; + case 2: + error_9 = _a.sent(); + if (error_9.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + return [2, null]; + case 3: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getResolver = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var network, transaction, _a, _b, error_10; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + network = _c.sent(); + if (!network.ensAddress) { + logger.throwError("network does not support ENS", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name }); + } + transaction = { + to: network.ensAddress, + data: "0x0178b8bf" + (0, hash_1.namehash)(name2).substring(2) + }; + _c.label = 2; + case 2: + _c.trys.push([2, 4, , 5]); + _b = (_a = this.formatter).callAddress; + return [4, this.call(transaction)]; + case 3: + return [2, _b.apply(_a, [_c.sent()])]; + case 4: + error_10 = _c.sent(); + if (error_10.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + throw error_10; + case 5: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.resolveName = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var resolver; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, name2]; + case 1: + name2 = _a.sent(); + try { + return [2, Promise.resolve(this.formatter.address(name2))]; + } catch (error) { + if ((0, bytes_1.isHexString)(name2)) { + throw error; + } + } + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid ENS name", "name", name2); + } + return [4, this.getResolver(name2)]; + case 2: + resolver = _a.sent(); + if (!resolver) { + return [2, null]; + } + return [4, resolver.getAddress()]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + BaseProvider2.prototype.lookupAddress = function(address) { + return __awaiter(this, void 0, void 0, function() { + var reverseName, resolverAddress, bytes, _a, length, name2, addr; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, address]; + case 1: + address = _b.sent(); + address = this.formatter.address(address); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + return [4, this._getResolver(reverseName)]; + case 2: + resolverAddress = _b.sent(); + if (!resolverAddress) { + return [2, null]; + } + _a = bytes_1.arrayify; + return [4, this.call({ + to: resolverAddress, + data: "0x691f3431" + (0, hash_1.namehash)(reverseName).substring(2) + })]; + case 3: + bytes = _a.apply(void 0, [_b.sent()]); + if (bytes.length < 32 || !bignumber_1.BigNumber.from(bytes.slice(0, 32)).eq(32)) { + return [2, null]; + } + bytes = bytes.slice(32); + if (bytes.length < 32) { + return [2, null]; + } + length = bignumber_1.BigNumber.from(bytes.slice(0, 32)).toNumber(); + bytes = bytes.slice(32); + if (length > bytes.length) { + return [2, null]; + } + name2 = (0, strings_1.toUtf8String)(bytes.slice(0, length)); + return [4, this.resolveName(name2)]; + case 4: + addr = _b.sent(); + if (addr != address) { + return [2, null]; + } + return [2, name2]; + } + }); + }); + }; + BaseProvider2.prototype.getAvatar = function(nameOrAddress) { + return __awaiter(this, void 0, void 0, function() { + var resolver, address, reverseName, resolverAddress, avatar; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + resolver = null; + if (!(0, bytes_1.isHexString)(nameOrAddress)) return [3, 2]; + address = this.formatter.address(nameOrAddress); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + return [4, this._getResolver(reverseName)]; + case 1: + resolverAddress = _a.sent(); + if (!resolverAddress) { + return [2, null]; + } + resolver = new Resolver(this, resolverAddress, "_", address); + return [3, 4]; + case 2: + return [4, this.getResolver(nameOrAddress)]; + case 3: + resolver = _a.sent(); + if (!resolver) { + return [2, null]; + } + _a.label = 4; + case 4: + return [4, resolver.getAvatar()]; + case 5: + avatar = _a.sent(); + if (avatar == null) { + return [2, null]; + } + return [2, avatar.url]; + } + }); + }); + }; + BaseProvider2.prototype.perform = function(method, params) { + return logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method }); + }; + BaseProvider2.prototype._startEvent = function(event) { + this.polling = this._events.filter(function(e) { + return e.pollable(); + }).length > 0; + }; + BaseProvider2.prototype._stopEvent = function(event) { + this.polling = this._events.filter(function(e) { + return e.pollable(); + }).length > 0; + }; + BaseProvider2.prototype._addEventListener = function(eventName, listener, once) { + var event = new Event(getEventTag(eventName), listener, once); + this._events.push(event); + this._startEvent(event); + return this; + }; + BaseProvider2.prototype.on = function(eventName, listener) { + return this._addEventListener(eventName, listener, false); + }; + BaseProvider2.prototype.once = function(eventName, listener) { + return this._addEventListener(eventName, listener, true); + }; + BaseProvider2.prototype.emit = function(eventName) { + var _this = this; + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + 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(_this, args); + }, 0); + result = true; + if (event.once) { + stopped.push(event); + return false; + } + return true; + }); + stopped.forEach(function(event) { + _this._stopEvent(event); + }); + return result; + }; + BaseProvider2.prototype.listenerCount = function(eventName) { + if (!eventName) { + return this._events.length; + } + var eventTag = getEventTag(eventName); + return this._events.filter(function(event) { + return event.tag === eventTag; + }).length; + }; + BaseProvider2.prototype.listeners = function(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; + }); + }; + BaseProvider2.prototype.off = function(eventName, listener) { + var _this = 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) { + _this._stopEvent(event); + }); + return this; + }; + BaseProvider2.prototype.removeAllListeners = function(eventName) { + var _this = this; + var stopped = []; + if (eventName == null) { + stopped = this._events; + this._events = []; + } else { + var eventTag_1 = getEventTag(eventName); + this._events = this._events.filter(function(event) { + if (event.tag !== eventTag_1) { + return true; + } + stopped.push(event); + return false; + }); + } + stopped.forEach(function(event) { + _this._stopEvent(event); + }); + return this; + }; + return BaseProvider2; + }(abstract_provider_1.Provider) + ); + exports2.BaseProvider = BaseProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/json-rpc-provider.js +var require_json_rpc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/json-rpc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.JsonRpcProvider = exports2.JsonRpcSigner = void 0; + var abstract_signer_1 = require_lib13(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var properties_1 = require_lib4(); + var strings_1 = require_lib9(); + var transactions_1 = require_lib15(); + var web_1 = require_lib27(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var base_provider_1 = require_base_provider(); + var errorGas = ["call", "estimateGas"]; + function checkError(method, error, params) { + if (method === "call" && error.code === logger_1.Logger.errors.SERVER_ERROR) { + var e = error.error; + if (e && e.message.match("reverted") && (0, bytes_1.isHexString)(e.data)) { + return e.data; + } + logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { + error, + data: "0x" + }); + } + var message = error.message; + if (error.code === logger_1.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; + if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/nonce too low/)) { + logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/replacement transaction underpriced/)) { + logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + transaction + }); + } + if (message.match(/only replay-protected/)) { + logger.throwError("legacy pre-eip-155 transactions not supported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + error, + method, + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; + } + function timer(timeout) { + return new Promise(function(resolve) { + setTimeout(resolve, timeout); + }); + } + function getResult(payload) { + if (payload.error) { + 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 = ( + /** @class */ + function(_super) { + __extends(JsonRpcSigner2, _super); + function JsonRpcSigner2(constructorGuard, provider, addressOrIndex) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, JsonRpcSigner2); + _this = _super.call(this) || this; + if (constructorGuard !== _constructorGuard) { + throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); + } + (0, properties_1.defineReadOnly)(_this, "provider", provider); + if (addressOrIndex == null) { + addressOrIndex = 0; + } + if (typeof addressOrIndex === "string") { + (0, properties_1.defineReadOnly)(_this, "_address", _this.provider.formatter.address(addressOrIndex)); + (0, properties_1.defineReadOnly)(_this, "_index", null); + } else if (typeof addressOrIndex === "number") { + (0, properties_1.defineReadOnly)(_this, "_index", addressOrIndex); + (0, properties_1.defineReadOnly)(_this, "_address", null); + } else { + logger.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex); + } + return _this; + } + JsonRpcSigner2.prototype.connect = function(provider) { + return logger.throwError("cannot alter JSON-RPC Signer connection", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "connect" + }); + }; + JsonRpcSigner2.prototype.connectUnchecked = function() { + return new UncheckedJsonRpcSigner(_constructorGuard, this.provider, this._address || this._index); + }; + JsonRpcSigner2.prototype.getAddress = function() { + var _this = this; + if (this._address) { + return Promise.resolve(this._address); + } + return this.provider.send("eth_accounts", []).then(function(accounts) { + if (accounts.length <= _this._index) { + logger.throwError("unknown account #" + _this._index, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress" + }); + } + return _this.provider.formatter.address(accounts[_this._index]); + }); + }; + JsonRpcSigner2.prototype.sendUncheckedTransaction = function(transaction) { + var _this = this; + transaction = (0, properties_1.shallowCopy)(transaction); + var fromAddress = this.getAddress().then(function(address) { + if (address) { + address = address.toLowerCase(); + } + return address; + }); + if (transaction.gasLimit == null) { + var estimate = (0, properties_1.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(_this, void 0, void 0, function() { + var address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (to == null) { + return [2, null]; + } + return [4, this.provider.resolveName(to)]; + case 1: + address = _a.sent(); + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return [2, address]; + } + }); + }); + }); + } + return (0, properties_1.resolveProperties)({ + tx: (0, properties_1.resolveProperties)(transaction), + sender: fromAddress + }).then(function(_a) { + var tx = _a.tx, sender = _a.sender; + if (tx.from != null) { + if (tx.from.toLowerCase() !== sender) { + logger.throwArgumentError("from address mismatch", "transaction", transaction); + } + } else { + tx.from = sender; + } + var hexTx = _this.provider.constructor.hexlifyTransaction(tx, { from: true }); + return _this.provider.send("eth_sendTransaction", [hexTx]).then(function(hash) { + return hash; + }, function(error) { + return checkError("sendTransaction", error, hexTx); + }); + }); + }; + JsonRpcSigner2.prototype.signTransaction = function(transaction) { + return logger.throwError("signing transactions is unsupported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signTransaction" + }); + }; + JsonRpcSigner2.prototype.sendTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber, hash, error_1; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval)]; + case 1: + blockNumber = _a.sent(); + return [4, this.sendUncheckedTransaction(transaction)]; + case 2: + hash = _a.sent(); + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.provider.getTransaction(hash)]; + case 1: + tx = _a2.sent(); + if (tx === null) { + return [2, void 0]; + } + return [2, this.provider._wrapTransaction(tx, hash, blockNumber)]; + } + }); + }); + }, { oncePoll: this.provider })]; + case 4: + return [2, _a.sent()]; + case 5: + error_1 = _a.sent(); + error_1.transactionHash = hash; + throw error_1; + case 6: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + JsonRpcSigner2.prototype.signMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + var data, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = typeof message === "string" ? (0, strings_1.toUtf8Bytes)(message) : message; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [4, this.provider.send("personal_sign", [(0, bytes_1.hexlify)(data), address.toLowerCase()])]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype._legacySignMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + var data, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = typeof message === "string" ? (0, strings_1.toUtf8Bytes)(message) : message; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [4, this.provider.send("eth_sign", [address.toLowerCase(), (0, bytes_1.hexlify)(data)])]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype._signTypedData = function(domain, types, value) { + return __awaiter(this, void 0, void 0, function() { + var populated, address; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, hash_1._TypedDataEncoder.resolveNames(domain, types, value, function(name2) { + return _this.provider.resolveName(name2); + })]; + case 1: + populated = _a.sent(); + return [4, this.getAddress()]; + case 2: + address = _a.sent(); + return [4, this.provider.send("eth_signTypedData_v4", [ + address.toLowerCase(), + JSON.stringify(hash_1._TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ])]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype.unlock = function(password) { + return __awaiter(this, void 0, void 0, function() { + var provider, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + provider = this.provider; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [2, provider.send("personal_unlockAccount", [address.toLowerCase(), password, null])]; + } + }); + }); + }; + return JsonRpcSigner2; + }(abstract_signer_1.Signer) + ); + exports2.JsonRpcSigner = JsonRpcSigner; + var UncheckedJsonRpcSigner = ( + /** @class */ + function(_super) { + __extends(UncheckedJsonRpcSigner2, _super); + function UncheckedJsonRpcSigner2() { + return _super !== null && _super.apply(this, arguments) || this; + } + UncheckedJsonRpcSigner2.prototype.sendTransaction = function(transaction) { + var _this = this; + return this.sendUncheckedTransaction(transaction).then(function(hash) { + return { + hash, + nonce: null, + gasLimit: null, + gasPrice: null, + data: null, + value: null, + chainId: null, + confirmations: 0, + from: null, + wait: function(confirmations) { + return _this.provider.waitForTransaction(hash, confirmations); + } + }; + }); + }; + return UncheckedJsonRpcSigner2; + }(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 = ( + /** @class */ + function(_super) { + __extends(JsonRpcProvider2, _super); + function JsonRpcProvider2(url, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, JsonRpcProvider2); + var networkOrReady = network; + if (networkOrReady == null) { + networkOrReady = new Promise(function(resolve, reject) { + setTimeout(function() { + _this.detectNetwork().then(function(network2) { + resolve(network2); + }, function(error) { + reject(error); + }); + }, 0); + }); + } + _this = _super.call(this, networkOrReady) || this; + if (!url) { + url = (0, properties_1.getStatic)(_this.constructor, "defaultUrl")(); + } + if (typeof url === "string") { + (0, properties_1.defineReadOnly)(_this, "connection", Object.freeze({ + url + })); + } else { + (0, properties_1.defineReadOnly)(_this, "connection", Object.freeze((0, properties_1.shallowCopy)(url))); + } + _this._nextId = 42; + return _this; + } + Object.defineProperty(JsonRpcProvider2.prototype, "_cache", { + get: function() { + if (this._eventLoopCache == null) { + this._eventLoopCache = {}; + } + return this._eventLoopCache; + }, + enumerable: false, + configurable: true + }); + JsonRpcProvider2.defaultUrl = function() { + return "http://localhost:8545"; + }; + JsonRpcProvider2.prototype.detectNetwork = function() { + var _this = this; + if (!this._cache["detectNetwork"]) { + this._cache["detectNetwork"] = this._uncachedDetectNetwork(); + setTimeout(function() { + _this._cache["detectNetwork"] = null; + }, 0); + } + return this._cache["detectNetwork"]; + }; + JsonRpcProvider2.prototype._uncachedDetectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var chainId, error_2, error_3, getNetwork; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, timer(0)]; + case 1: + _a.sent(); + chainId = null; + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 9]); + return [4, this.send("eth_chainId", [])]; + case 3: + chainId = _a.sent(); + return [3, 9]; + case 4: + error_2 = _a.sent(); + _a.label = 5; + case 5: + _a.trys.push([5, 7, , 8]); + return [4, this.send("net_version", [])]; + case 6: + chainId = _a.sent(); + return [3, 8]; + case 7: + error_3 = _a.sent(); + return [3, 8]; + case 8: + return [3, 9]; + case 9: + if (chainId != null) { + getNetwork = (0, properties_1.getStatic)(this.constructor, "getNetwork"); + try { + return [2, getNetwork(bignumber_1.BigNumber.from(chainId).toNumber())]; + } catch (error) { + return [2, logger.throwError("could not detect network", logger_1.Logger.errors.NETWORK_ERROR, { + chainId, + event: "invalidNetwork", + serverError: error + })]; + } + } + return [2, logger.throwError("could not detect network", logger_1.Logger.errors.NETWORK_ERROR, { + event: "noNetwork" + })]; + } + }); + }); + }; + JsonRpcProvider2.prototype.getSigner = function(addressOrIndex) { + return new JsonRpcSigner(_constructorGuard, this, addressOrIndex); + }; + JsonRpcProvider2.prototype.getUncheckedSigner = function(addressOrIndex) { + return this.getSigner(addressOrIndex).connectUnchecked(); + }; + JsonRpcProvider2.prototype.listAccounts = function() { + var _this = this; + return this.send("eth_accounts", []).then(function(accounts) { + return accounts.map(function(a) { + return _this.formatter.address(a); + }); + }); + }; + JsonRpcProvider2.prototype.send = function(method, params) { + var _this = this; + var request = { + method, + params, + id: this._nextId++, + jsonrpc: "2.0" + }; + this.emit("debug", { + action: "request", + request: (0, properties_1.deepCopy)(request), + provider: this + }); + var cache = ["eth_chainId", "eth_blockNumber"].indexOf(method) >= 0; + if (cache && this._cache[method]) { + return this._cache[method]; + } + var result = (0, web_1.fetchJson)(this.connection, JSON.stringify(request), getResult).then(function(result2) { + _this.emit("debug", { + action: "response", + request, + response: result2, + provider: _this + }); + return result2; + }, function(error) { + _this.emit("debug", { + action: "response", + error, + request, + provider: _this + }); + throw error; + }); + if (cache) { + this._cache[method] = result; + setTimeout(function() { + _this._cache[method] = null; + }, 0); + } + return result; + }; + JsonRpcProvider2.prototype.prepareRequest = function(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 = (0, properties_1.getStatic)(this.constructor, "hexlifyTransaction"); + return ["eth_call", [hexlifyTransaction(params.transaction, { from: true }), params.blockTag]]; + } + case "estimateGas": { + var hexlifyTransaction = (0, properties_1.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; + }; + JsonRpcProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var tx, feeData, args, error_4; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "call" || method === "estimateGas")) return [3, 2]; + tx = params.transaction; + if (!(tx && tx.type != null && bignumber_1.BigNumber.from(tx.type).isZero())) return [3, 2]; + if (!(tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null)) return [3, 2]; + return [4, this.getFeeData()]; + case 1: + feeData = _a.sent(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + params = (0, properties_1.shallowCopy)(params); + params.transaction = (0, properties_1.shallowCopy)(tx); + delete params.transaction.type; + } + _a.label = 2; + case 2: + args = this.prepareRequest(method, params); + if (args == null) { + logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method }); + } + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, this.send(args[0], args[1])]; + case 4: + return [2, _a.sent()]; + case 5: + error_4 = _a.sent(); + return [2, checkError(method, error_4, params)]; + case 6: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + JsonRpcProvider2.prototype._startEvent = function(event) { + if (event.tag === "pending") { + this._startPending(); + } + _super.prototype._startEvent.call(this, event); + }; + JsonRpcProvider2.prototype._startPending = function() { + if (this._pendingFilter != null) { + return; + } + var self2 = this; + var pendingFilter = this.send("eth_newPendingTransactionFilter", []); + this._pendingFilter = pendingFilter; + pendingFilter.then(function(filterId) { + function poll() { + self2.send("eth_getFilterChanges", [filterId]).then(function(hashes) { + if (self2._pendingFilter != pendingFilter) { + return null; + } + var seq = Promise.resolve(); + hashes.forEach(function(hash) { + self2._emitted["t:" + hash.toLowerCase()] = "pending"; + seq = seq.then(function() { + return self2.getTransaction(hash).then(function(tx) { + self2.emit("pending", tx); + return null; + }); + }); + }); + return seq.then(function() { + return timer(1e3); + }); + }).then(function() { + if (self2._pendingFilter != pendingFilter) { + self2.send("eth_uninstallFilter", [filterId]); + return; + } + setTimeout(function() { + poll(); + }, 0); + return null; + }).catch(function(error) { + }); + } + poll(); + return filterId; + }).catch(function(error) { + }); + }; + JsonRpcProvider2.prototype._stopEvent = function(event) { + if (event.tag === "pending" && this.listenerCount("pending") === 0) { + this._pendingFilter = null; + } + _super.prototype._stopEvent.call(this, event); + }; + JsonRpcProvider2.hexlifyTransaction = function(transaction, allowExtra) { + var allowed = (0, properties_1.shallowCopy)(allowedTransactionKeys); + if (allowExtra) { + for (var key in allowExtra) { + if (allowExtra[key]) { + allowed[key] = true; + } + } + } + (0, properties_1.checkProperties)(transaction, allowed); + var result = {}; + ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + var value = (0, bytes_1.hexValue)(transaction[key2]); + if (key2 === "gasLimit") { + key2 = "gas"; + } + result[key2] = value; + }); + ["from", "to", "data"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + result[key2] = (0, bytes_1.hexlify)(transaction[key2]); + }); + if (transaction.accessList) { + result["accessList"] = (0, transactions_1.accessListify)(transaction.accessList); + } + return result; + }; + return JsonRpcProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.JsonRpcProvider = JsonRpcProvider; + } +}); + +// node_modules/ws/lib/constants.js +var require_constants = __commonJS({ + "node_modules/ws/lib/constants.js"(exports2, module2) { + "use strict"; + module2.exports = { + BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"], + GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", + kStatusCode: Symbol("status-code"), + kWebSocket: Symbol("websocket"), + EMPTY_BUFFER: Buffer.alloc(0), + NOOP: () => { + } + }; + } +}); + +// node_modules/ws/lib/buffer-util.js +var require_buffer_util = __commonJS({ + "node_modules/ws/lib/buffer-util.js"(exports2, module2) { + "use strict"; + var { EMPTY_BUFFER } = require_constants(); + function concat(list, totalLength) { + if (list.length === 0) return EMPTY_BUFFER; + if (list.length === 1) return list[0]; + const target = Buffer.allocUnsafe(totalLength); + let offset = 0; + for (let i = 0; i < list.length; i++) { + const buf = list[i]; + target.set(buf, offset); + offset += buf.length; + } + if (offset < totalLength) return target.slice(0, offset); + return target; + } + function _mask(source, mask, output, offset, length) { + for (let i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } + } + function _unmask(buffer, mask) { + const length = buffer.length; + for (let i = 0; i < length; i++) { + buffer[i] ^= mask[i & 3]; + } + } + function toArrayBuffer(buf) { + if (buf.byteLength === buf.buffer.byteLength) { + return buf.buffer; + } + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + } + function toBuffer(data) { + toBuffer.readOnly = true; + if (Buffer.isBuffer(data)) return data; + let buf; + if (data instanceof ArrayBuffer) { + buf = Buffer.from(data); + } else if (ArrayBuffer.isView(data)) { + buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength); + } else { + buf = Buffer.from(data); + toBuffer.readOnly = false; + } + return buf; + } + try { + const bufferUtil = require("bufferutil"); + const bu = bufferUtil.BufferUtil || bufferUtil; + module2.exports = { + concat, + mask(source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bu.mask(source, mask, output, offset, length); + }, + toArrayBuffer, + toBuffer, + unmask(buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bu.unmask(buffer, mask); + } + }; + } catch (e) { + module2.exports = { + concat, + mask: _mask, + toArrayBuffer, + toBuffer, + unmask: _unmask + }; + } + } +}); + +// node_modules/ws/lib/limiter.js +var require_limiter = __commonJS({ + "node_modules/ws/lib/limiter.js"(exports2, module2) { + "use strict"; + var kDone = Symbol("kDone"); + var kRun = Symbol("kRun"); + var Limiter = class { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(concurrency) { + this[kDone] = () => { + this.pending--; + this[kRun](); + }; + this.concurrency = concurrency || Infinity; + this.jobs = []; + this.pending = 0; + } + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(job) { + this.jobs.push(job); + this[kRun](); + } + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [kRun]() { + if (this.pending === this.concurrency) return; + if (this.jobs.length) { + const job = this.jobs.shift(); + this.pending++; + job(this[kDone]); + } + } + }; + module2.exports = Limiter; + } +}); + +// node_modules/ws/lib/permessage-deflate.js +var require_permessage_deflate = __commonJS({ + "node_modules/ws/lib/permessage-deflate.js"(exports2, module2) { + "use strict"; + var zlib = require("zlib"); + var bufferUtil = require_buffer_util(); + var Limiter = require_limiter(); + var { kStatusCode, NOOP } = require_constants(); + var TRAILER = Buffer.from([0, 0, 255, 255]); + var kPerMessageDeflate = Symbol("permessage-deflate"); + var kTotalLength = Symbol("total-length"); + var kCallback = Symbol("callback"); + var kBuffers = Symbol("buffers"); + var kError = Symbol("error"); + var zlibLimiter; + var PerMessageDeflate = class { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + this.params = null; + if (!zlibLimiter) { + const concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10; + zlibLimiter = new Limiter(concurrency); + } + } + /** + * @type {String} + */ + static get extensionName() { + return "permessage-deflate"; + } + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params = {}; + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + return params; + } + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations); + return this.params; + } + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + if (this._deflate) { + const callback = this._deflate[kCallback]; + this._deflate.close(); + this._deflate = null; + if (callback) { + callback( + new Error( + "The deflate stream was closed while data was being processed" + ) + ); + } + } + } + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params) => { + if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) { + return false; + } + return true; + }); + if (!accepted) { + throw new Error("None of the extension offers can be accepted"); + } + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === "number") { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === "number") { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) { + delete accepted.client_max_window_bits; + } + return accepted; + } + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params = response[0]; + if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + if (!params.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === "number") { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params.client_max_window_bits > this._options.clientMaxWindowBits) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + return params; + } + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params) => { + Object.keys(params).forEach((key) => { + let value = params[key]; + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + value = value[0]; + if (key === "client_max_window_bits") { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === "server_max_window_bits") { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + params[key] = value; + }); + }); + return configurations; + } + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.add((done) => { + this._decompress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + /** + * Compress data. Concurrency limited. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.add((done) => { + this._compress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? "client" : "server"; + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key]; + this._inflate = zlib.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits + }); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on("error", inflateOnError); + this._inflate.on("data", inflateOnData); + } + this._inflate[kCallback] = callback; + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + this._inflate.flush(() => { + const err = this._inflate[kError]; + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + const data2 = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + if (this._inflate._readableState.endEmitted) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.reset(); + } + } + callback(null, data2); + }); + } + /** + * Compress data. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + const endpoint = this._isServer ? "server" : "client"; + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key]; + this._deflate = zlib.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits + }); + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + this._deflate.on("error", NOOP); + this._deflate.on("data", deflateOnData); + } + this._deflate[kCallback] = callback; + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + return; + } + let data2 = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + if (fin) data2 = data2.slice(0, data2.length - 4); + this._deflate[kCallback] = null; + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.reset(); + } + callback(null, data2); + }); + } + }; + module2.exports = PerMessageDeflate; + function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; + } + function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) { + this[kBuffers].push(chunk); + return; + } + this[kError] = new RangeError("Max payload size exceeded"); + this[kError][kStatusCode] = 1009; + this.removeListener("data", inflateOnData); + this.reset(); + } + function inflateOnError(err) { + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); + } + } +}); + +// node_modules/ws/lib/validation.js +var require_validation = __commonJS({ + "node_modules/ws/lib/validation.js"(exports2, module2) { + "use strict"; + function isValidStatusCode(code) { + return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999; + } + function _isValidUTF8(buf) { + const len = buf.length; + let i = 0; + while (i < len) { + if ((buf[i] & 128) === 0) { + i++; + } else if ((buf[i] & 224) === 192) { + if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) { + return false; + } + i += 2; + } else if ((buf[i] & 240) === 224) { + if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || // Overlong + buf[i] === 237 && (buf[i + 1] & 224) === 160) { + return false; + } + i += 3; + } else if ((buf[i] & 248) === 240) { + if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || // Overlong + buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) { + return false; + } + i += 4; + } else { + return false; + } + } + return true; + } + try { + let isValidUTF8 = require("utf-8-validate"); + if (typeof isValidUTF8 === "object") { + isValidUTF8 = isValidUTF8.Validation.isValidUTF8; + } + module2.exports = { + isValidStatusCode, + isValidUTF8(buf) { + return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf); + } + }; + } catch (e) { + module2.exports = { + isValidStatusCode, + isValidUTF8: _isValidUTF8 + }; + } + } +}); + +// node_modules/ws/lib/receiver.js +var require_receiver = __commonJS({ + "node_modules/ws/lib/receiver.js"(exports2, module2) { + "use strict"; + var { Writable } = require("stream"); + var PerMessageDeflate = require_permessage_deflate(); + var { + BINARY_TYPES, + EMPTY_BUFFER, + kStatusCode, + kWebSocket + } = require_constants(); + var { concat, toArrayBuffer, unmask } = require_buffer_util(); + var { isValidStatusCode, isValidUTF8 } = require_validation(); + var GET_INFO = 0; + var GET_PAYLOAD_LENGTH_16 = 1; + var GET_PAYLOAD_LENGTH_64 = 2; + var GET_MASK = 3; + var GET_DATA = 4; + var INFLATING = 5; + var Receiver = class extends Writable { + /** + * Creates a Receiver instance. + * + * @param {String} [binaryType=nodebuffer] The type for binary data + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Boolean} [isServer=false] Specifies whether to operate in client or + * server mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(binaryType, extensions, isServer, maxPayload) { + super(); + this._binaryType = binaryType || BINARY_TYPES[0]; + this[kWebSocket] = void 0; + this._extensions = extensions || {}; + this._isServer = !!isServer; + this._maxPayload = maxPayload | 0; + this._bufferedBytes = 0; + this._buffers = []; + this._compressed = false; + this._payloadLength = 0; + this._mask = void 0; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + this._state = GET_INFO; + this._loop = false; + } + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(chunk, encoding, cb) { + if (this._opcode === 8 && this._state == GET_INFO) return cb(); + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + if (n === this._buffers[0].length) return this._buffers.shift(); + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = buf.slice(n); + return buf.slice(0, n); + } + const dst = Buffer.allocUnsafe(n); + do { + const buf = this._buffers[0]; + const offset = dst.length - n; + if (n >= buf.length) { + dst.set(this._buffers.shift(), offset); + } else { + dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); + this._buffers[0] = buf.slice(n); + } + n -= buf.length; + } while (n > 0); + return dst; + } + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + let err; + this._loop = true; + do { + switch (this._state) { + case GET_INFO: + err = this.getInfo(); + break; + case GET_PAYLOAD_LENGTH_16: + err = this.getPayloadLength16(); + break; + case GET_PAYLOAD_LENGTH_64: + err = this.getPayloadLength64(); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + err = this.getData(cb); + break; + default: + this._loop = false; + return; + } + } while (this._loop); + cb(err); + } + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + const buf = this.consume(2); + if ((buf[0] & 48) !== 0) { + this._loop = false; + return error(RangeError, "RSV2 and RSV3 must be clear", true, 1002); + } + const compressed = (buf[0] & 64) === 64; + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + this._fin = (buf[0] & 128) === 128; + this._opcode = buf[0] & 15; + this._payloadLength = buf[1] & 127; + if (this._opcode === 0) { + if (compressed) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + if (!this._fragmented) { + this._loop = false; + return error(RangeError, "invalid opcode 0", true, 1002); + } + this._opcode = this._fragmented; + } else if (this._opcode === 1 || this._opcode === 2) { + if (this._fragmented) { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + this._compressed = compressed; + } else if (this._opcode > 7 && this._opcode < 11) { + if (!this._fin) { + this._loop = false; + return error(RangeError, "FIN must be set", true, 1002); + } + if (compressed) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + if (this._payloadLength > 125) { + this._loop = false; + return error( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002 + ); + } + } else { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 128) === 128; + if (this._isServer) { + if (!this._masked) { + this._loop = false; + return error(RangeError, "MASK must be set", true, 1002); + } + } else if (this._masked) { + this._loop = false; + return error(RangeError, "MASK must be clear", true, 1002); + } + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else return this.haveLength(); + } + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + this._payloadLength = this.consume(2).readUInt16BE(0); + return this.haveLength(); + } + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + if (num > Math.pow(2, 53 - 32) - 1) { + this._loop = false; + return error( + RangeError, + "Unsupported WebSocket frame: payload length > 2^53 - 1", + false, + 1009 + ); + } + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + return this.haveLength(); + } + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 8) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + this._loop = false; + return error(RangeError, "Max payload size exceeded", false, 1009); + } + } + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + this._mask = this.consume(4); + this._state = GET_DATA; + } + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(cb) { + let data = EMPTY_BUFFER; + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + data = this.consume(this._payloadLength); + if (this._masked) unmask(data, this._mask); + } + if (this._opcode > 7) return this.controlMessage(data); + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + if (data.length) { + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + return this.dataMessage(); + } + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + return cb( + error(RangeError, "Max payload size exceeded", false, 1009) + ); + } + this._fragments.push(buf); + } + const er = this.dataMessage(); + if (er) return cb(er); + this.startLoop(cb); + }); + } + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const messageLength = this._messageLength; + const fragments = this._fragments; + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + if (this._opcode === 2) { + let data; + if (this._binaryType === "nodebuffer") { + data = concat(fragments, messageLength); + } else if (this._binaryType === "arraybuffer") { + data = toArrayBuffer(concat(fragments, messageLength)); + } else { + data = fragments; + } + this.emit("message", data); + } else { + const buf = concat(fragments, messageLength); + if (!isValidUTF8(buf)) { + this._loop = false; + return error(Error, "invalid UTF-8 sequence", true, 1007); + } + this.emit("message", buf.toString()); + } + } + this._state = GET_INFO; + } + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data) { + if (this._opcode === 8) { + this._loop = false; + if (data.length === 0) { + this.emit("conclude", 1005, ""); + this.end(); + } else if (data.length === 1) { + return error(RangeError, "invalid payload length 1", true, 1002); + } else { + const code = data.readUInt16BE(0); + if (!isValidStatusCode(code)) { + return error(RangeError, `invalid status code ${code}`, true, 1002); + } + const buf = data.slice(2); + if (!isValidUTF8(buf)) { + return error(Error, "invalid UTF-8 sequence", true, 1007); + } + this.emit("conclude", code, buf.toString()); + this.end(); + } + } else if (this._opcode === 9) { + this.emit("ping", data); + } else { + this.emit("pong", data); + } + this._state = GET_INFO; + } + }; + module2.exports = Receiver; + function error(ErrorCtor, message, prefix, statusCode) { + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + Error.captureStackTrace(err, error); + err[kStatusCode] = statusCode; + return err; + } + } +}); + +// node_modules/ws/lib/sender.js +var require_sender = __commonJS({ + "node_modules/ws/lib/sender.js"(exports2, module2) { + "use strict"; + var { randomFillSync } = require("crypto"); + var PerMessageDeflate = require_permessage_deflate(); + var { EMPTY_BUFFER } = require_constants(); + var { isValidStatusCode } = require_validation(); + var { mask: applyMask, toBuffer } = require_buffer_util(); + var mask = Buffer.alloc(4); + var Sender = class _Sender { + /** + * Creates a Sender instance. + * + * @param {net.Socket} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + */ + constructor(socket, extensions) { + this._extensions = extensions || {}; + this._socket = socket; + this._firstFragment = true; + this._compress = false; + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {Buffer} data The data to frame + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {Buffer[]} The framed data as a list of `Buffer` instances + * @public + */ + static frame(data, options) { + const merge = options.mask && options.readOnly; + let offset = options.mask ? 6 : 2; + let payloadLength = data.length; + if (data.length >= 65536) { + offset += 8; + payloadLength = 127; + } else if (data.length > 125) { + offset += 2; + payloadLength = 126; + } + const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); + target[0] = options.fin ? options.opcode | 128 : options.opcode; + if (options.rsv1) target[0] |= 64; + target[1] = payloadLength; + if (payloadLength === 126) { + target.writeUInt16BE(data.length, 2); + } else if (payloadLength === 127) { + target.writeUInt32BE(0, 2); + target.writeUInt32BE(data.length, 6); + } + if (!options.mask) return [target, data]; + randomFillSync(mask, 0, 4); + target[1] |= 128; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + if (merge) { + applyMask(data, mask, target, offset, data.length); + return [target]; + } + applyMask(data, mask, data, 0, data.length); + return [target, data]; + } + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {String} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(code, data, mask2, cb) { + let buf; + if (code === void 0) { + buf = EMPTY_BUFFER; + } else if (typeof code !== "number" || !isValidStatusCode(code)) { + throw new TypeError("First argument must be a valid error code number"); + } else if (data === void 0 || data === "") { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + const length = Buffer.byteLength(data); + if (length > 123) { + throw new RangeError("The message must not be greater than 123 bytes"); + } + buf = Buffer.allocUnsafe(2 + length); + buf.writeUInt16BE(code, 0); + buf.write(data, 2); + } + if (this._deflating) { + this.enqueue([this.doClose, buf, mask2, cb]); + } else { + this.doClose(buf, mask2, cb); + } + } + /** + * Frames and sends a close message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @private + */ + doClose(data, mask2, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 8, + mask: mask2, + readOnly: false + }), + cb + ); + } + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(data, mask2, cb) { + const buf = toBuffer(data); + if (buf.length > 125) { + throw new RangeError("The data size must not be greater than 125 bytes"); + } + if (this._deflating) { + this.enqueue([this.doPing, buf, mask2, toBuffer.readOnly, cb]); + } else { + this.doPing(buf, mask2, toBuffer.readOnly, cb); + } + } + /** + * Frames and sends a ping message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified + * @param {Function} [cb] Callback + * @private + */ + doPing(data, mask2, readOnly, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 9, + mask: mask2, + readOnly + }), + cb + ); + } + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(data, mask2, cb) { + const buf = toBuffer(data); + if (buf.length > 125) { + throw new RangeError("The data size must not be greater than 125 bytes"); + } + if (this._deflating) { + this.enqueue([this.doPong, buf, mask2, toBuffer.readOnly, cb]); + } else { + this.doPong(buf, mask2, toBuffer.readOnly, cb); + } + } + /** + * Frames and sends a pong message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified + * @param {Function} [cb] Callback + * @private + */ + doPong(data, mask2, readOnly, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 10, + mask: mask2, + readOnly + }), + cb + ); + } + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(data, options, cb) { + const buf = toBuffer(data); + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + let opcode = options.binary ? 2 : 1; + let rsv1 = options.compress; + if (this._firstFragment) { + this._firstFragment = false; + if (rsv1 && perMessageDeflate) { + rsv1 = buf.length >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + if (options.fin) this._firstFragment = true; + if (perMessageDeflate) { + const opts = { + fin: options.fin, + rsv1, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }; + if (this._deflating) { + this.enqueue([this.dispatch, buf, this._compress, opts, cb]); + } else { + this.dispatch(buf, this._compress, opts, cb); + } + } else { + this.sendFrame( + _Sender.frame(buf, { + fin: options.fin, + rsv1: false, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }), + cb + ); + } + } + /** + * Dispatches a data message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(_Sender.frame(data, options), cb); + return; + } + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + this._bufferedBytes += data.length; + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + if (this._socket.destroyed) { + const err = new Error( + "The socket was closed while data was being compressed" + ); + if (typeof cb === "function") cb(err); + for (let i = 0; i < this._queue.length; i++) { + const callback = this._queue[i][4]; + if (typeof callback === "function") callback(err); + } + return; + } + this._bufferedBytes -= data.length; + this._deflating = false; + options.readOnly = false; + this.sendFrame(_Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params = this._queue.shift(); + this._bufferedBytes -= params[1].length; + Reflect.apply(params[0], this, params.slice(1)); + } + } + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params) { + this._bufferedBytes += params[1].length; + this._queue.push(params); + } + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.cork(); + this._socket.write(list[0]); + this._socket.write(list[1], cb); + this._socket.uncork(); + } else { + this._socket.write(list[0], cb); + } + } + }; + module2.exports = Sender; + } +}); + +// node_modules/ws/lib/event-target.js +var require_event_target = __commonJS({ + "node_modules/ws/lib/event-target.js"(exports2, module2) { + "use strict"; + var Event = class { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @param {Object} target A reference to the target to which the event was + * dispatched + */ + constructor(type, target) { + this.target = target; + this.type = type; + } + }; + var MessageEvent = class extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(data, target) { + super("message", target); + this.data = data; + } + }; + var CloseEvent = class extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {Number} code The status code explaining why the connection is being + * closed + * @param {String} reason A human-readable string explaining why the + * connection is closing + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(code, reason, target) { + super("close", target); + this.wasClean = target._closeFrameReceived && target._closeFrameSent; + this.reason = reason; + this.code = code; + } + }; + var OpenEvent = class extends Event { + /** + * Create a new `OpenEvent`. + * + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(target) { + super("open", target); + } + }; + var ErrorEvent = class extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {Object} error The error that generated this event + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(error, target) { + super("error", target); + this.message = error.message; + this.error = error; + } + }; + var EventTarget = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {Function} listener The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean`` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(type, listener, options) { + if (typeof listener !== "function") return; + function onMessage(data) { + listener.call(this, new MessageEvent(data, this)); + } + function onClose(code, message) { + listener.call(this, new CloseEvent(code, message, this)); + } + function onError(error) { + listener.call(this, new ErrorEvent(error, this)); + } + function onOpen() { + listener.call(this, new OpenEvent(this)); + } + const method = options && options.once ? "once" : "on"; + if (type === "message") { + onMessage._listener = listener; + this[method](type, onMessage); + } else if (type === "close") { + onClose._listener = listener; + this[method](type, onClose); + } else if (type === "error") { + onError._listener = listener; + this[method](type, onError); + } else if (type === "open") { + onOpen._listener = listener; + this[method](type, onOpen); + } else { + this[method](type, listener); + } + }, + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {Function} listener The listener to remove + * @public + */ + removeEventListener(type, listener) { + const listeners = this.listeners(type); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i] === listener || listeners[i]._listener === listener) { + this.removeListener(type, listeners[i]); + } + } + } + }; + module2.exports = EventTarget; + } +}); + +// node_modules/ws/lib/extension.js +var require_extension = __commonJS({ + "node_modules/ws/lib/extension.js"(exports2, module2) { + "use strict"; + var tokenChars = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 0 - 15 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 16 - 31 + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + // 32 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + // 48 - 63 + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 64 - 79 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + // 80 - 95 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 96 - 111 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0 + // 112 - 127 + ]; + function push(dest, name2, elem) { + if (dest[name2] === void 0) dest[name2] = [elem]; + else dest[name2].push(elem); + } + function parse(header) { + const offers = /* @__PURE__ */ Object.create(null); + if (header === void 0 || header === "") return offers; + let params = /* @__PURE__ */ Object.create(null); + let mustUnescape = false; + let isEscaping = false; + let inQuotes = false; + let extensionName; + let paramName; + let start = -1; + let end = -1; + let i = 0; + for (; i < header.length; i++) { + const code = header.charCodeAt(i); + if (extensionName === void 0) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 32 || code === 9) { + if (end === -1 && start !== -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + const name2 = header.slice(start, end); + if (code === 44) { + push(offers, name2, params); + params = /* @__PURE__ */ Object.create(null); + } else { + extensionName = name2; + } + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === void 0) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 32 || code === 9) { + if (end === -1 && start !== -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + push(params, header.slice(start, end), true); + if (code === 44) { + push(offers, extensionName, params); + params = /* @__PURE__ */ Object.create(null); + extensionName = void 0; + } + start = end = -1; + } else if (code === 61 && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 34 && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 92) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 34 && header.charCodeAt(i - 1) === 61) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 32 || code === 9)) { + if (end === -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + let value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ""); + mustUnescape = false; + } + push(params, paramName, value); + if (code === 44) { + push(offers, extensionName, params); + params = /* @__PURE__ */ Object.create(null); + extensionName = void 0; + } + paramName = void 0; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + if (start === -1 || inQuotes) { + throw new SyntaxError("Unexpected end of input"); + } + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === void 0) { + push(offers, token, params); + } else { + if (paramName === void 0) { + push(params, token, true); + } else if (mustUnescape) { + push(params, paramName, token.replace(/\\/g, "")); + } else { + push(params, paramName, token); + } + push(offers, extensionName, params); + } + return offers; + } + function format(extensions) { + return Object.keys(extensions).map((extension) => { + let configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations.map((params) => { + return [extension].concat( + Object.keys(params).map((k) => { + let values = params[k]; + if (!Array.isArray(values)) values = [values]; + return values.map((v) => v === true ? k : `${k}=${v}`).join("; "); + }) + ).join("; "); + }).join(", "); + }).join(", "); + } + module2.exports = { format, parse }; + } +}); + +// node_modules/ws/lib/websocket.js +var require_websocket = __commonJS({ + "node_modules/ws/lib/websocket.js"(exports2, module2) { + "use strict"; + var EventEmitter = require("events"); + var https = require("https"); + var http = require("http"); + var net = require("net"); + var tls = require("tls"); + var { randomBytes, createHash } = require("crypto"); + var { URL } = require("url"); + var PerMessageDeflate = require_permessage_deflate(); + var Receiver = require_receiver(); + var Sender = require_sender(); + var { + BINARY_TYPES, + EMPTY_BUFFER, + GUID, + kStatusCode, + kWebSocket, + NOOP + } = require_constants(); + var { addEventListener, removeEventListener } = require_event_target(); + var { format, parse } = require_extension(); + var { toBuffer } = require_buffer_util(); + var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"]; + var protocolVersions = [8, 13]; + var closeTimeout = 30 * 1e3; + var WebSocket = class _WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|url.URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(address, protocols, options) { + super(); + this._binaryType = BINARY_TYPES[0]; + this._closeCode = 1006; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = ""; + this._closeTimer = null; + this._extensions = {}; + this._protocol = ""; + this._readyState = _WebSocket.CONNECTING; + this._receiver = null; + this._sender = null; + this._socket = null; + if (address !== null) { + this._bufferedAmount = 0; + this._isServer = false; + this._redirects = 0; + if (Array.isArray(protocols)) { + protocols = protocols.join(", "); + } else if (typeof protocols === "object" && protocols !== null) { + options = protocols; + protocols = void 0; + } + initAsClient(this, address, protocols, options); + } else { + this._isServer = true; + } + } + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + set binaryType(type) { + if (!BINARY_TYPES.includes(type)) return; + this._binaryType = type; + if (this._receiver) this._receiver._binaryType = type; + } + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return this._bufferedAmount; + return this._socket._writableState.length + this._sender._bufferedBytes; + } + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + /** + * @type {String} + */ + get url() { + return this._url; + } + /** + * Set up the socket and the internal resources. + * + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Number} [maxPayload=0] The maximum allowed message size + * @private + */ + setSocket(socket, head, maxPayload) { + const receiver = new Receiver( + this.binaryType, + this._extensions, + this._isServer, + maxPayload + ); + this._sender = new Sender(socket, this._extensions); + this._receiver = receiver; + this._socket = socket; + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + receiver.on("conclude", receiverOnConclude); + receiver.on("drain", receiverOnDrain); + receiver.on("error", receiverOnError); + receiver.on("message", receiverOnMessage); + receiver.on("ping", receiverOnPing); + receiver.on("pong", receiverOnPong); + socket.setTimeout(0); + socket.setNoDelay(); + if (head.length > 0) socket.unshift(head); + socket.on("close", socketOnClose); + socket.on("data", socketOnData); + socket.on("end", socketOnEnd); + socket.on("error", socketOnError); + this._readyState = _WebSocket.OPEN; + this.emit("open"); + } + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = _WebSocket.CLOSED; + this.emit("close", this._closeCode, this._closeMessage); + return; + } + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + this._receiver.removeAllListeners(); + this._readyState = _WebSocket.CLOSED; + this.emit("close", this._closeCode, this._closeMessage); + } + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {String} [data] A string explaining why the connection is closing + * @public + */ + close(code, data) { + if (this.readyState === _WebSocket.CLOSED) return; + if (this.readyState === _WebSocket.CONNECTING) { + const msg = "WebSocket was closed before the connection was established"; + return abortHandshake(this, this._req, msg); + } + if (this.readyState === _WebSocket.CLOSING) { + if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); + return; + } + this._readyState = _WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + if (err) return; + this._closeFrameSent = true; + if (this._closeFrameReceived) this._socket.end(); + }); + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof data === "function") { + cb = data; + data = mask = void 0; + } else if (typeof mask === "function") { + cb = mask; + mask = void 0; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + if (mask === void 0) mask = !this._isServer; + this._sender.ping(data || EMPTY_BUFFER, mask, cb); + } + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof data === "function") { + cb = data; + data = mask = void 0; + } else if (typeof mask === "function") { + cb = mask; + mask = void 0; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + if (mask === void 0) mask = !this._isServer; + this._sender.pong(data || EMPTY_BUFFER, mask, cb); + } + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof options === "function") { + cb = options; + options = {}; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + const opts = { + binary: typeof data !== "string", + mask: !this._isServer, + compress: true, + fin: true, + ...options + }; + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + this._sender.send(data || EMPTY_BUFFER, opts, cb); + } + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === _WebSocket.CLOSED) return; + if (this.readyState === _WebSocket.CONNECTING) { + const msg = "WebSocket was closed before the connection was established"; + return abortHandshake(this, this._req, msg); + } + if (this._socket) { + this._readyState = _WebSocket.CLOSING; + this._socket.destroy(); + } + } + }; + readyStates.forEach((readyState, i) => { + const descriptor = { enumerable: true, value: i }; + Object.defineProperty(WebSocket.prototype, readyState, descriptor); + Object.defineProperty(WebSocket, readyState, descriptor); + }); + [ + "binaryType", + "bufferedAmount", + "extensions", + "protocol", + "readyState", + "url" + ].forEach((property) => { + Object.defineProperty(WebSocket.prototype, property, { enumerable: true }); + }); + ["open", "error", "close", "message"].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + configurable: true, + enumerable: true, + /** + * Return the listener of the event. + * + * @return {(Function|undefined)} The event listener or `undefined` + * @public + */ + get() { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) return listeners[i]._listener; + } + return void 0; + }, + /** + * Add a listener for the event. + * + * @param {Function} listener The listener to add + * @public + */ + set(listener) { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) this.removeListener(method, listeners[i]); + } + this.addEventListener(method, listener); + } + }); + }); + WebSocket.prototype.addEventListener = addEventListener; + WebSocket.prototype.removeEventListener = removeEventListener; + module2.exports = WebSocket; + function initAsClient(websocket, address, protocols, options) { + const opts = { + protocolVersion: protocolVersions[1], + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: true, + followRedirects: false, + maxRedirects: 10, + ...options, + createConnection: void 0, + socketPath: void 0, + hostname: void 0, + protocol: void 0, + timeout: void 0, + method: void 0, + host: void 0, + path: void 0, + port: void 0 + }; + if (!protocolVersions.includes(opts.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})` + ); + } + let parsedUrl; + if (address instanceof URL) { + parsedUrl = address; + websocket._url = address.href; + } else { + parsedUrl = new URL(address); + websocket._url = address; + } + const isUnixSocket = parsedUrl.protocol === "ws+unix:"; + if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { + throw new Error(`Invalid URL: ${websocket.url}`); + } + const isSecure = parsedUrl.protocol === "wss:" || parsedUrl.protocol === "https:"; + const defaultPort = isSecure ? 443 : 80; + const key = randomBytes(16).toString("base64"); + const get = isSecure ? https.get : http.get; + let perMessageDeflate; + opts.createConnection = isSecure ? tlsConnect : netConnect; + opts.defaultPort = opts.defaultPort || defaultPort; + opts.port = parsedUrl.port || defaultPort; + opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname; + opts.headers = { + "Sec-WebSocket-Version": opts.protocolVersion, + "Sec-WebSocket-Key": key, + Connection: "Upgrade", + Upgrade: "websocket", + ...opts.headers + }; + opts.path = parsedUrl.pathname + parsedUrl.search; + opts.timeout = opts.handshakeTimeout; + if (opts.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, + false, + opts.maxPayload + ); + opts.headers["Sec-WebSocket-Extensions"] = format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols) { + opts.headers["Sec-WebSocket-Protocol"] = protocols; + } + if (opts.origin) { + if (opts.protocolVersion < 13) { + opts.headers["Sec-WebSocket-Origin"] = opts.origin; + } else { + opts.headers.Origin = opts.origin; + } + } + if (parsedUrl.username || parsedUrl.password) { + opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + if (isUnixSocket) { + const parts = opts.path.split(":"); + opts.socketPath = parts[0]; + opts.path = parts[1]; + } + let req = websocket._req = get(opts); + if (opts.timeout) { + req.on("timeout", () => { + abortHandshake(websocket, req, "Opening handshake has timed out"); + }); + } + req.on("error", (err) => { + if (req === null || req.aborted) return; + req = websocket._req = null; + websocket._readyState = WebSocket.CLOSING; + websocket.emit("error", err); + websocket.emitClose(); + }); + req.on("response", (res) => { + const location = res.headers.location; + const statusCode = res.statusCode; + if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) { + if (++websocket._redirects > opts.maxRedirects) { + abortHandshake(websocket, req, "Maximum redirects exceeded"); + return; + } + req.abort(); + const addr = new URL(location, address); + initAsClient(websocket, addr, protocols, options); + } else if (!websocket.emit("unexpected-response", req, res)) { + abortHandshake( + websocket, + req, + `Unexpected server response: ${res.statusCode}` + ); + } + }); + req.on("upgrade", (res, socket, head) => { + websocket.emit("upgrade", res); + if (websocket.readyState !== WebSocket.CONNECTING) return; + req = websocket._req = null; + const digest = createHash("sha1").update(key + GUID).digest("base64"); + if (res.headers["sec-websocket-accept"] !== digest) { + abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header"); + return; + } + const serverProt = res.headers["sec-websocket-protocol"]; + const protList = (protocols || "").split(/, */); + let protError; + if (!protocols && serverProt) { + protError = "Server sent a subprotocol but none was requested"; + } else if (protocols && !serverProt) { + protError = "Server sent no subprotocol"; + } else if (serverProt && !protList.includes(serverProt)) { + protError = "Server sent an invalid subprotocol"; + } + if (protError) { + abortHandshake(websocket, socket, protError); + return; + } + if (serverProt) websocket._protocol = serverProt; + if (perMessageDeflate) { + try { + const extensions = parse(res.headers["sec-websocket-extensions"]); + if (extensions[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + abortHandshake( + websocket, + socket, + "Invalid Sec-WebSocket-Extensions header" + ); + return; + } + } + websocket.setSocket(socket, head, opts.maxPayload); + }); + } + function netConnect(options) { + options.path = options.socketPath; + return net.connect(options); + } + function tlsConnect(options) { + options.path = void 0; + if (!options.servername && options.servername !== "") { + options.servername = net.isIP(options.host) ? "" : options.host; + } + return tls.connect(options); + } + function abortHandshake(websocket, stream, message) { + websocket._readyState = WebSocket.CLOSING; + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + if (stream.setHeader) { + stream.abort(); + if (stream.socket && !stream.socket.destroyed) { + stream.socket.destroy(); + } + stream.once("abort", websocket.emitClose.bind(websocket)); + websocket.emit("error", err); + } else { + stream.destroy(err); + stream.once("error", websocket.emit.bind(websocket, "error")); + stream.once("close", websocket.emitClose.bind(websocket)); + } + } + function sendAfterClose(websocket, data, cb) { + if (data) { + const length = toBuffer(data).length; + if (websocket._socket) websocket._sender._bufferedBytes += length; + else websocket._bufferedAmount += length; + } + if (cb) { + const err = new Error( + `WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})` + ); + cb(err); + } + } + function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + websocket._socket.removeListener("data", socketOnData); + websocket._socket.resume(); + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + if (code === 1005) websocket.close(); + else websocket.close(code, reason); + } + function receiverOnDrain() { + this[kWebSocket]._socket.resume(); + } + function receiverOnError(err) { + const websocket = this[kWebSocket]; + websocket._socket.removeListener("data", socketOnData); + websocket._readyState = WebSocket.CLOSING; + websocket._closeCode = err[kStatusCode]; + websocket.emit("error", err); + websocket._socket.destroy(); + } + function receiverOnFinish() { + this[kWebSocket].emitClose(); + } + function receiverOnMessage(data) { + this[kWebSocket].emit("message", data); + } + function receiverOnPing(data) { + const websocket = this[kWebSocket]; + websocket.pong(data, !websocket._isServer, NOOP); + websocket.emit("ping", data); + } + function receiverOnPong(data) { + this[kWebSocket].emit("pong", data); + } + function socketOnClose() { + const websocket = this[kWebSocket]; + this.removeListener("close", socketOnClose); + this.removeListener("end", socketOnEnd); + websocket._readyState = WebSocket.CLOSING; + websocket._socket.read(); + websocket._receiver.end(); + this.removeListener("data", socketOnData); + this[kWebSocket] = void 0; + clearTimeout(websocket._closeTimer); + if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) { + websocket.emitClose(); + } else { + websocket._receiver.on("error", receiverOnFinish); + websocket._receiver.on("finish", receiverOnFinish); + } + } + function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } + } + function socketOnEnd() { + const websocket = this[kWebSocket]; + websocket._readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); + } + function socketOnError() { + const websocket = this[kWebSocket]; + this.removeListener("error", socketOnError); + this.on("error", NOOP); + if (websocket) { + websocket._readyState = WebSocket.CLOSING; + this.destroy(); + } + } + } +}); + +// node_modules/ws/lib/stream.js +var require_stream = __commonJS({ + "node_modules/ws/lib/stream.js"(exports2, module2) { + "use strict"; + var { Duplex } = require("stream"); + function emitClose(stream) { + stream.emit("close"); + } + function duplexOnEnd() { + if (!this.destroyed && this._writableState.finished) { + this.destroy(); + } + } + function duplexOnError(err) { + this.removeListener("error", duplexOnError); + this.destroy(); + if (this.listenerCount("error") === 0) { + this.emit("error", err); + } + } + function createWebSocketStream(ws, options) { + let resumeOnReceiverDrain = true; + function receiverOnDrain() { + if (resumeOnReceiverDrain) ws._socket.resume(); + } + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + ws._receiver.removeAllListeners("drain"); + ws._receiver.on("drain", receiverOnDrain); + }); + } else { + ws._receiver.removeAllListeners("drain"); + ws._receiver.on("drain", receiverOnDrain); + } + const duplex = new Duplex({ + ...options, + autoDestroy: false, + emitClose: false, + objectMode: false, + writableObjectMode: false + }); + ws.on("message", function message(msg) { + if (!duplex.push(msg)) { + resumeOnReceiverDrain = false; + ws._socket.pause(); + } + }); + ws.once("error", function error(err) { + if (duplex.destroyed) return; + duplex.destroy(err); + }); + ws.once("close", function close() { + if (duplex.destroyed) return; + duplex.push(null); + }); + duplex._destroy = function(err, callback) { + if (ws.readyState === ws.CLOSED) { + callback(err); + process.nextTick(emitClose, duplex); + return; + } + let called = false; + ws.once("error", function error(err2) { + called = true; + callback(err2); + }); + ws.once("close", function close() { + if (!called) callback(err); + process.nextTick(emitClose, duplex); + }); + ws.terminate(); + }; + duplex._final = function(callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + duplex._final(callback); + }); + return; + } + if (ws._socket === null) return; + if (ws._socket._writableState.finished) { + callback(); + if (duplex._readableState.endEmitted) duplex.destroy(); + } else { + ws._socket.once("finish", function finish() { + callback(); + }); + ws.close(); + } + }; + duplex._read = function() { + if (ws.readyState === ws.OPEN && !resumeOnReceiverDrain) { + resumeOnReceiverDrain = true; + if (!ws._receiver._writableState.needDrain) ws._socket.resume(); + } + }; + duplex._write = function(chunk, encoding, callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + duplex._write(chunk, encoding, callback); + }); + return; + } + ws.send(chunk, callback); + }; + duplex.on("end", duplexOnEnd); + duplex.on("error", duplexOnError); + return duplex; + } + module2.exports = createWebSocketStream; + } +}); + +// node_modules/ws/lib/websocket-server.js +var require_websocket_server = __commonJS({ + "node_modules/ws/lib/websocket-server.js"(exports2, module2) { + "use strict"; + var EventEmitter = require("events"); + var { createHash } = require("crypto"); + var { createServer, STATUS_CODES } = require("http"); + var PerMessageDeflate = require_permessage_deflate(); + var WebSocket = require_websocket(); + var { format, parse } = require_extension(); + var { GUID, kWebSocket } = require_constants(); + var keyRegex = /^[+/0-9A-Za-z]{22}==$/; + var WebSocketServer = class extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {http.Server} [options.server] A pre-created HTTP/S server to use + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(options, callback) { + super(); + options = { + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, + // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + ...options + }; + if (options.port == null && !options.server && !options.noServer) { + throw new TypeError( + 'One of the "port", "server", or "noServer" options must be specified' + ); + } + if (options.port != null) { + this._server = createServer((req, res) => { + const body = STATUS_CODES[426]; + res.writeHead(426, { + "Content-Length": body.length, + "Content-Type": "text/plain" + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + this._server = options.server; + } + if (this._server) { + const emitConnection = this.emit.bind(this, "connection"); + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, "listening"), + error: this.emit.bind(this, "error"), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, emitConnection); + } + }); + } + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) this.clients = /* @__PURE__ */ new Set(); + this.options = options; + } + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + if (!this._server) return null; + return this._server.address(); + } + /** + * Close the server. + * + * @param {Function} [cb] Callback + * @public + */ + close(cb) { + if (cb) this.once("close", cb); + if (this.clients) { + for (const client of this.clients) client.terminate(); + } + const server = this._server; + if (server) { + this._removeListeners(); + this._removeListeners = this._server = null; + if (this.options.port != null) { + server.close(() => this.emit("close")); + return; + } + } + process.nextTick(emitClose, this); + } + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf("?"); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + if (pathname !== this.options.path) return false; + } + return true; + } + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on("error", socketOnError); + const key = req.headers["sec-websocket-key"] !== void 0 ? req.headers["sec-websocket-key"].trim() : false; + const version = +req.headers["sec-websocket-version"]; + const extensions = {}; + if (req.method !== "GET" || req.headers.upgrade.toLowerCase() !== "websocket" || !key || !keyRegex.test(key) || version !== 8 && version !== 13 || !this.shouldHandle(req)) { + return abortHandshake(socket, 400); + } + if (this.options.perMessageDeflate) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + try { + const offers = parse(req.headers["sec-websocket-extensions"]); + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + return abortHandshake(socket, 400); + } + } + if (this.options.verifyClient) { + const info = { + origin: req.headers[`${version === 8 ? "sec-websocket-origin" : "origin"}`], + secure: !!(req.socket.authorized || req.socket.encrypted), + req + }; + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + this.completeUpgrade(key, extensions, req, socket, head, cb); + }); + return; + } + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + this.completeUpgrade(key, extensions, req, socket, head, cb); + } + /** + * Upgrade the connection to WebSocket. + * + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Object} extensions The accepted extensions + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(key, extensions, req, socket, head, cb) { + if (!socket.readable || !socket.writable) return socket.destroy(); + if (socket[kWebSocket]) { + throw new Error( + "server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration" + ); + } + const digest = createHash("sha1").update(key + GUID).digest("base64"); + const headers = [ + "HTTP/1.1 101 Switching Protocols", + "Upgrade: websocket", + "Connection: Upgrade", + `Sec-WebSocket-Accept: ${digest}` + ]; + const ws = new WebSocket(null); + let protocol = req.headers["sec-websocket-protocol"]; + if (protocol) { + protocol = protocol.split(",").map(trim); + if (this.options.handleProtocols) { + protocol = this.options.handleProtocols(protocol, req); + } else { + protocol = protocol[0]; + } + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws._protocol = protocol; + } + } + if (extensions[PerMessageDeflate.extensionName]) { + const params = extensions[PerMessageDeflate.extensionName].params; + const value = format({ + [PerMessageDeflate.extensionName]: [params] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + this.emit("headers", headers, req); + socket.write(headers.concat("\r\n").join("\r\n")); + socket.removeListener("error", socketOnError); + ws.setSocket(socket, head, this.options.maxPayload); + if (this.clients) { + this.clients.add(ws); + ws.on("close", () => this.clients.delete(ws)); + } + cb(ws, req); + } + }; + module2.exports = WebSocketServer; + function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; + } + function emitClose(server) { + server.emit("close"); + } + function socketOnError() { + this.destroy(); + } + function abortHandshake(socket, code, message, headers) { + if (socket.writable) { + message = message || STATUS_CODES[code]; + headers = { + Connection: "close", + "Content-Type": "text/html", + "Content-Length": Buffer.byteLength(message), + ...headers + }; + socket.write( + `HTTP/1.1 ${code} ${STATUS_CODES[code]}\r +` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message + ); + } + socket.removeListener("error", socketOnError); + socket.destroy(); + } + function trim(str) { + return str.trim(); + } + } +}); + +// node_modules/ws/index.js +var require_ws = __commonJS({ + "node_modules/ws/index.js"(exports2, module2) { + "use strict"; + var WebSocket = require_websocket(); + WebSocket.createWebSocketStream = require_stream(); + WebSocket.Server = require_websocket_server(); + WebSocket.Receiver = require_receiver(); + WebSocket.Sender = require_sender(); + module2.exports = WebSocket; + } +}); + +// node_modules/@ethersproject/providers/lib/ws.js +var require_ws2 = __commonJS({ + "node_modules/@ethersproject/providers/lib/ws.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WebSocket = void 0; + var ws_1 = __importDefault(require_ws()); + exports2.WebSocket = ws_1.default; + } +}); + +// node_modules/@ethersproject/providers/lib/websocket-provider.js +var require_websocket_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/websocket-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WebSocketProvider = void 0; + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var json_rpc_provider_1 = require_json_rpc_provider(); + var ws_1 = require_ws2(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var NextId = 1; + var WebSocketProvider = ( + /** @class */ + function(_super) { + __extends(WebSocketProvider2, _super); + function WebSocketProvider2(url, network) { + var _this = this; + if (network === "any") { + logger.throwError("WebSocketProvider does not support 'any' network yet", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "network:any" + }); + } + _this = _super.call(this, url, network) || this; + _this._pollingInterval = -1; + _this._wsReady = false; + (0, properties_1.defineReadOnly)(_this, "_websocket", new ws_1.WebSocket(_this.connection.url)); + (0, properties_1.defineReadOnly)(_this, "_requests", {}); + (0, properties_1.defineReadOnly)(_this, "_subs", {}); + (0, properties_1.defineReadOnly)(_this, "_subIds", {}); + (0, properties_1.defineReadOnly)(_this, "_detectNetwork", _super.prototype.detectNetwork.call(_this)); + _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 !== void 0) { + request.callback(null, result.result); + _this.emit("debug", { + action: "response", + request: JSON.parse(request.payload), + response: result.result, + provider: _this + }); + } else { + var error = null; + if (result.error) { + error = new Error(result.error.message || "unknown error"); + (0, properties_1.defineReadOnly)(error, "code", result.error.code || null); + (0, properties_1.defineReadOnly)(error, "response", data); + } else { + error = new Error("unknown error"); + } + request.callback(error, void 0); + _this.emit("debug", { + action: "response", + error, + request: JSON.parse(request.payload), + provider: _this + }); + } + } else if (result.method === "eth_subscription") { + var sub = _this._subs[result.params.subscription]; + if (sub) { + sub.processFunc(result.params.result); + } + } else { + console.warn("this should not happen"); + } + }; + var fauxPoll = setInterval(function() { + _this.emit("poll"); + }, 1e3); + if (fauxPoll.unref) { + fauxPoll.unref(); + } + return _this; + } + WebSocketProvider2.prototype.detectNetwork = function() { + return this._detectNetwork; + }; + Object.defineProperty(WebSocketProvider2.prototype, "pollingInterval", { + get: function() { + return 0; + }, + set: function(value) { + logger.throwError("cannot set polling interval on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPollingInterval" + }); + }, + enumerable: false, + configurable: true + }); + WebSocketProvider2.prototype.resetEventsBlock = function(blockNumber) { + logger.throwError("cannot reset events block on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resetEventBlock" + }); + }; + WebSocketProvider2.prototype.poll = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, null]; + }); + }); + }; + Object.defineProperty(WebSocketProvider2.prototype, "polling", { + set: function(value) { + if (!value) { + return; + } + logger.throwError("cannot set polling on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPolling" + }); + }, + enumerable: false, + configurable: true + }); + WebSocketProvider2.prototype.send = function(method, params) { + var _this = 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, + params, + id: rid, + jsonrpc: "2.0" + }); + _this.emit("debug", { + action: "request", + request: JSON.parse(payload), + provider: _this + }); + _this._requests[String(rid)] = { callback, payload }; + if (_this._wsReady) { + _this._websocket.send(payload); + } + }); + }; + WebSocketProvider2.defaultUrl = function() { + return "ws://localhost:8546"; + }; + WebSocketProvider2.prototype._subscribe = function(tag, param, processFunc) { + return __awaiter(this, void 0, void 0, function() { + var subIdPromise, subId; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + subIdPromise = this._subIds[tag]; + if (subIdPromise == null) { + subIdPromise = Promise.all(param).then(function(param2) { + return _this.send("eth_subscribe", param2); + }); + this._subIds[tag] = subIdPromise; + } + return [4, subIdPromise]; + case 1: + subId = _a.sent(); + this._subs[subId] = { tag, processFunc }; + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + WebSocketProvider2.prototype._startEvent = function(event) { + var _this = this; + switch (event.type) { + case "block": + this._subscribe("block", ["newHeads"], function(result) { + var blockNumber = bignumber_1.BigNumber.from(result.number).toNumber(); + _this._emitted.block = blockNumber; + _this.emit("block", blockNumber); + }); + break; + case "pending": + this._subscribe("pending", ["newPendingTransactions"], function(result) { + _this.emit("pending", result); + }); + break; + case "filter": + this._subscribe(event.tag, ["logs", this._getFilter(event.filter)], function(result) { + if (result.removed == null) { + result.removed = false; + } + _this.emit(event.filter, _this.formatter.filterLog(result)); + }); + break; + case "tx": { + var emitReceipt_1 = function(event2) { + var hash = event2.hash; + _this.getTransactionReceipt(hash).then(function(receipt) { + if (!receipt) { + return; + } + _this.emit(hash, receipt); + }); + }; + emitReceipt_1(event); + this._subscribe("tx", ["newHeads"], function(result) { + _this._events.filter(function(e) { + return e.type === "tx"; + }).forEach(emitReceipt_1); + }); + break; + } + case "debug": + case "poll": + case "willPoll": + case "didPoll": + case "error": + break; + default: + console.log("unhandled:", event); + break; + } + }; + WebSocketProvider2.prototype._stopEvent = function(event) { + var _this = this; + var tag = event.tag; + if (event.type === "tx") { + if (this._events.filter(function(e) { + return e.type === "tx"; + }).length) { + return; + } + tag = "tx"; + } else if (this.listenerCount(event.event)) { + return; + } + var subId = this._subIds[tag]; + if (!subId) { + return; + } + delete this._subIds[tag]; + subId.then(function(subId2) { + if (!_this._subs[subId2]) { + return; + } + delete _this._subs[subId2]; + _this.send("eth_unsubscribe", [subId2]); + }); + }; + WebSocketProvider2.prototype.destroy = function() { + return __awaiter(this, void 0, void 0, function() { + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(this._websocket.readyState === ws_1.WebSocket.CONNECTING)) return [3, 2]; + return [4, new Promise(function(resolve) { + _this._websocket.onopen = function() { + resolve(true); + }; + _this._websocket.onerror = function() { + resolve(false); + }; + })]; + case 1: + _a.sent(); + _a.label = 2; + case 2: + this._websocket.close(1e3); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + return WebSocketProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.WebSocketProvider = WebSocketProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/url-json-rpc-provider.js +var require_url_json_rpc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/url-json-rpc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.UrlJsonRpcProvider = exports2.StaticJsonRpcProvider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var StaticJsonRpcProvider = ( + /** @class */ + function(_super) { + __extends(StaticJsonRpcProvider2, _super); + function StaticJsonRpcProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + StaticJsonRpcProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var network; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + network = this.network; + if (!(network == null)) return [3, 2]; + return [4, _super.prototype.detectNetwork.call(this)]; + case 1: + network = _a.sent(); + if (!network) { + logger.throwError("no network detected", logger_1.Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + (0, properties_1.defineReadOnly)(this, "_network", network); + this.emit("network", network, null); + } + _a.label = 2; + case 2: + return [2, network]; + } + }); + }); + }; + return StaticJsonRpcProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.StaticJsonRpcProvider = StaticJsonRpcProvider; + var UrlJsonRpcProvider = ( + /** @class */ + function(_super) { + __extends(UrlJsonRpcProvider2, _super); + function UrlJsonRpcProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + logger.checkAbstract(_newTarget, UrlJsonRpcProvider2); + network = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + apiKey = (0, properties_1.getStatic)(_newTarget, "getApiKey")(apiKey); + var connection = (0, properties_1.getStatic)(_newTarget, "getUrl")(network, apiKey); + _this = _super.call(this, connection, network) || this; + if (typeof apiKey === "string") { + (0, properties_1.defineReadOnly)(_this, "apiKey", apiKey); + } else if (apiKey != null) { + Object.keys(apiKey).forEach(function(key) { + (0, properties_1.defineReadOnly)(_this, key, apiKey[key]); + }); + } + return _this; + } + UrlJsonRpcProvider2.prototype._startPending = function() { + logger.warn("WARNING: API provider does not support pending filters"); + }; + UrlJsonRpcProvider2.prototype.isCommunityResource = function() { + return false; + }; + UrlJsonRpcProvider2.prototype.getSigner = function(address) { + return logger.throwError("API provider does not support signing", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" }); + }; + UrlJsonRpcProvider2.prototype.listAccounts = function() { + return Promise.resolve([]); + }; + UrlJsonRpcProvider2.getApiKey = function(apiKey) { + return apiKey; + }; + UrlJsonRpcProvider2.getUrl = function(network, apiKey) { + return logger.throwError("not implemented; sub-classes must override getUrl", logger_1.Logger.errors.NOT_IMPLEMENTED, { + operation: "getUrl" + }); + }; + return UrlJsonRpcProvider2; + }(StaticJsonRpcProvider) + ); + exports2.UrlJsonRpcProvider = UrlJsonRpcProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/alchemy-provider.js +var require_alchemy_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/alchemy-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AlchemyProvider = exports2.AlchemyWebSocketProvider = void 0; + var properties_1 = require_lib4(); + var formatter_1 = require_formatter(); + var websocket_provider_1 = require_websocket_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; + var AlchemyWebSocketProvider = ( + /** @class */ + function(_super) { + __extends(AlchemyWebSocketProvider2, _super); + function AlchemyWebSocketProvider2(network, apiKey) { + var _this = this; + 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) || this; + (0, properties_1.defineReadOnly)(_this, "apiKey", provider.apiKey); + return _this; + } + AlchemyWebSocketProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return AlchemyWebSocketProvider2; + }(websocket_provider_1.WebSocketProvider) + ); + exports2.AlchemyWebSocketProvider = AlchemyWebSocketProvider; + var AlchemyProvider = ( + /** @class */ + function(_super) { + __extends(AlchemyProvider2, _super); + function AlchemyProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + AlchemyProvider2.getWebSocketProvider = function(network, apiKey) { + return new AlchemyWebSocketProvider(network, apiKey); + }; + AlchemyProvider2.getApiKey = function(apiKey) { + if (apiKey == null) { + return defaultApiKey; + } + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey; + }; + AlchemyProvider2.getUrl = function(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(attempt, url) { + if (apiKey === defaultApiKey) { + (0, formatter_1.showThrottleMessage)(); + } + return Promise.resolve(true); + } + }; + }; + AlchemyProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return AlchemyProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.AlchemyProvider = AlchemyProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/cloudflare-provider.js +var require_cloudflare_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/cloudflare-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CloudflareProvider = void 0; + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var CloudflareProvider = ( + /** @class */ + function(_super) { + __extends(CloudflareProvider2, _super); + function CloudflareProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CloudflareProvider2.getApiKey = function(apiKey) { + if (apiKey != null) { + logger.throwArgumentError("apiKey not supported for cloudflare", "apiKey", apiKey); + } + return null; + }; + CloudflareProvider2.getUrl = function(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; + }; + CloudflareProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var block; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "getBlockNumber")) return [3, 2]; + return [4, _super.prototype.perform.call(this, "getBlock", { blockTag: "latest" })]; + case 1: + block = _a.sent(); + return [2, block.number]; + case 2: + return [2, _super.prototype.perform.call(this, method, params)]; + } + }); + }); + }; + return CloudflareProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.CloudflareProvider = CloudflareProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/etherscan-provider.js +var require_etherscan_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/etherscan-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherscanProvider = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var web_1 = require_lib27(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var base_provider_1 = require_base_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; + } + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = (0, bytes_1.hexValue)((0, bytes_1.hexlify)(value)); + } else if (key === "accessList") { + value = "[" + (0, transactions_1.accessListify)(value).map(function(set) { + return '{address:"' + set.address + '",storageKeys:["' + set.storageKeys.join('","') + '"]}'; + }).join(",") + "]"; + } else { + value = (0, bytes_1.hexlify)(value); + } + result[key] = value; + } + return result; + } + function getResult(result) { + 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) { + 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") { + var error = new Error("invalid response"); + error.result = JSON.stringify(result); + throw error; + } + if (result.error) { + var error = new Error(result.error.message || "unknown error"); + if (result.error.code) { + error.code = result.error.code; + } + if (result.error.data) { + error.data = result.error.data; + } + throw error; + } + return result.result; + } + 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) { + if (method === "call" && error.code === logger_1.Logger.errors.SERVER_ERROR) { + var e = error.error; + if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { + var data = e.data; + if (data) { + data = "0x" + data.replace(/^.*0x/i, ""); + } + if ((0, bytes_1.isHexString)(data)) { + return data; + } + logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { + error, + data: "0x" + }); + } + } + var message = error.message; + if (error.code === logger_1.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(); + if (message.match(/insufficient funds/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/another transaction with same nonce/)) { + logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; + } + var EtherscanProvider = ( + /** @class */ + function(_super) { + __extends(EtherscanProvider2, _super); + function EtherscanProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, EtherscanProvider2); + _this = _super.call(this, network) || this; + (0, properties_1.defineReadOnly)(_this, "baseUrl", _this.getBaseUrl()); + (0, properties_1.defineReadOnly)(_this, "apiKey", apiKey || defaultApiKey); + return _this; + } + EtherscanProvider2.prototype.getBaseUrl = function() { + 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); + }; + EtherscanProvider2.prototype.getUrl = function(module3, params) { + var query = Object.keys(params).reduce(function(accum, key) { + var value = params[key]; + if (value != null) { + accum += "&" + key + "=" + value; + } + return accum; + }, ""); + var apiKey = this.apiKey ? "&apikey=" + this.apiKey : ""; + return this.baseUrl + "/api?module=" + module3 + query + apiKey; + }; + EtherscanProvider2.prototype.getPostUrl = function() { + return this.baseUrl + "/api"; + }; + EtherscanProvider2.prototype.getPostData = function(module3, params) { + params.module = module3; + params.apikey = this.apiKey; + return params; + }; + EtherscanProvider2.prototype.fetch = function(module3, params, post) { + return __awaiter(this, void 0, void 0, function() { + var url, payload, procFunc, connection, payloadStr, result; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + url = post ? this.getPostUrl() : this.getUrl(module3, params); + payload = post ? this.getPostData(module3, params) : null; + procFunc = module3 === "proxy" ? getJsonResult : getResult; + this.emit("debug", { + action: "request", + request: url, + provider: this + }); + connection = { + url, + throttleSlotInterval: 1e3, + throttleCallback: function(attempt, url2) { + if (_this.isCommunityResource()) { + (0, formatter_1.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 key + "=" + payload[key]; + }).join("&"); + } + return [4, (0, web_1.fetchJson)(connection, payloadStr, procFunc || getJsonResult)]; + case 1: + result = _a.sent(); + this.emit("debug", { + action: "response", + request: url, + response: (0, properties_1.deepCopy)(result), + provider: this + }); + return [2, result]; + } + }); + }); + }; + EtherscanProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this.network]; + }); + }); + }; + EtherscanProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var _a, postData, error_1, postData, error_2, args, topic0, logs, blocks, i, log, block, _b; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + _a = method; + switch (_a) { + case "getBlockNumber": + return [3, 1]; + case "getGasPrice": + return [3, 2]; + case "getBalance": + return [3, 3]; + case "getTransactionCount": + return [3, 4]; + case "getCode": + return [3, 5]; + case "getStorageAt": + return [3, 6]; + case "sendTransaction": + return [3, 7]; + case "getBlock": + return [3, 8]; + case "getTransaction": + return [3, 9]; + case "getTransactionReceipt": + return [3, 10]; + case "call": + return [3, 11]; + case "estimateGas": + return [3, 15]; + case "getLogs": + return [3, 19]; + case "getEtherPrice": + return [3, 26]; + } + return [3, 28]; + case 1: + return [2, this.fetch("proxy", { action: "eth_blockNumber" })]; + case 2: + return [2, this.fetch("proxy", { action: "eth_gasPrice" })]; + case 3: + return [2, this.fetch("account", { + action: "balance", + address: params.address, + tag: params.blockTag + })]; + case 4: + return [2, this.fetch("proxy", { + action: "eth_getTransactionCount", + address: params.address, + tag: params.blockTag + })]; + case 5: + return [2, this.fetch("proxy", { + action: "eth_getCode", + address: params.address, + tag: params.blockTag + })]; + case 6: + return [2, this.fetch("proxy", { + action: "eth_getStorageAt", + address: params.address, + position: params.position, + tag: params.blockTag + })]; + case 7: + return [2, this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: params.signedTransaction + }, true).catch(function(error) { + return checkError("sendTransaction", error, params.signedTransaction); + })]; + case 8: + if (params.blockTag) { + return [2, this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: params.blockTag, + boolean: params.includeTransactions ? "true" : "false" + })]; + } + throw new Error("getBlock by blockHash not implemented"); + case 9: + return [2, this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: params.transactionHash + })]; + case 10: + return [2, this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: params.transactionHash + })]; + case 11: + if (params.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + postData = getTransactionPostData(params.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + _c.label = 12; + case 12: + _c.trys.push([12, 14, , 15]); + return [4, this.fetch("proxy", postData, true)]; + case 13: + return [2, _c.sent()]; + case 14: + error_1 = _c.sent(); + return [2, checkError("call", error_1, params.transaction)]; + case 15: + postData = getTransactionPostData(params.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + _c.label = 16; + case 16: + _c.trys.push([16, 18, , 19]); + return [4, this.fetch("proxy", postData, true)]; + case 17: + return [2, _c.sent()]; + case 18: + error_2 = _c.sent(); + return [2, checkError("estimateGas", error_2, params.transaction)]; + case 19: + 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; + } + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger.throwError("unsupported topic count", logger_1.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", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { topic0 }); + } + args.topic0 = topic0; + } + } + return [4, this.fetch("logs", args)]; + case 20: + logs = _c.sent(); + blocks = {}; + i = 0; + _c.label = 21; + case 21: + if (!(i < logs.length)) return [3, 25]; + log = logs[i]; + if (log.blockHash != null) { + return [3, 24]; + } + if (!(blocks[log.blockNumber] == null)) return [3, 23]; + return [4, this.getBlock(log.blockNumber)]; + case 22: + block = _c.sent(); + if (block) { + blocks[log.blockNumber] = block.hash; + } + _c.label = 23; + case 23: + log.blockHash = blocks[log.blockNumber]; + _c.label = 24; + case 24: + i++; + return [3, 21]; + case 25: + return [2, logs]; + case 26: + if (this.network.name !== "homestead") { + return [2, 0]; + } + _b = parseFloat; + return [4, this.fetch("stats", { action: "ethprice" })]; + case 27: + return [2, _b.apply(void 0, [_c.sent().ethusd])]; + case 28: + return [3, 29]; + case 29: + return [2, _super.prototype.perform.call(this, method, params)]; + } + }); + }); + }; + EtherscanProvider2.prototype.getHistory = function(addressOrName, startBlock, endBlock) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + var _a; + var _this = this; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + _a = { + action: "txlist" + }; + return [4, this.resolveName(addressOrName)]; + case 1: + params = (_a.address = _b.sent(), _a.startblock = startBlock == null ? 0 : startBlock, _a.endblock = endBlock == null ? 99999999 : endBlock, _a.sort = "asc", _a); + return [4, this.fetch("account", params)]; + case 2: + result = _b.sent(); + return [2, 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 = _this.formatter.transactionResponse(tx); + if (tx.timeStamp) { + item.timestamp = parseInt(tx.timeStamp); + } + return item; + })]; + } + }); + }); + }; + EtherscanProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return EtherscanProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.EtherscanProvider = EtherscanProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/fallback-provider.js +var require_fallback_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/fallback-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FallbackProvider = void 0; + var abstract_provider_1 = require_lib12(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var random_1 = require_lib22(); + var web_1 = require_lib27(); + var base_provider_1 = require_base_provider(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + function now() { + return (/* @__PURE__ */ new Date()).getTime(); + } + function checkNetworks(networks) { + var result = null; + for (var i = 0; i < networks.length; i++) { + var network = networks[i]; + if (network == null) { + return null; + } + if (result) { + 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); + if (values.length % 2) { + return values[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 (bignumber_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); + } + var nextRid = 1; + function stall(duration) { + var cancel = null; + var timer = null; + var promise = new Promise(function(resolve) { + cancel = function() { + if (timer) { + clearTimeout(timer); + timer = null; + } + resolve(); + }; + timer = setTimeout(cancel, duration); + }); + var wait = function(func) { + promise = promise.then(func); + return promise; + }; + function getPromise() { + return promise; + } + return { cancel, getPromise, wait }; + } + var ForwardErrors = [ + logger_1.Logger.errors.CALL_EXCEPTION, + logger_1.Logger.errors.INSUFFICIENT_FUNDS, + logger_1.Logger.errors.NONCE_EXPIRED, + logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, + logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT + ]; + var ForwardProperties = [ + "address", + "args", + "errorArgs", + "errorSignature", + "method", + "transaction" + ]; + function exposeDebugConfig(config, now2) { + var result = { + weight: config.weight + }; + Object.defineProperty(result, "provider", { get: function() { + return config.provider; + } }); + if (config.start) { + result.start = config.start; + } + if (now2) { + result.duration = now2 - 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) { + var tally = {}; + configs.forEach(function(c) { + var value = normalize(c.result); + if (!tally[value]) { + tally[value] = { count: 0, result: c.result }; + } + tally[value].count++; + }); + 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; + } + } + return void 0; + }; + } + function getProcessFunc(provider, method, params) { + var normalize = serialize; + switch (method) { + case "getBlockNumber": + return function(configs) { + var values = configs.map(function(c) { + return c.result; + }); + var blockNumber = median(configs.map(function(c) { + return c.result; + }), 2); + if (blockNumber == null) { + return void 0; + } + blockNumber = Math.ceil(blockNumber); + if (values.indexOf(blockNumber + 1) >= 0) { + blockNumber++; + } + if (blockNumber >= provider._highestBlockNumber) { + provider._highestBlockNumber = blockNumber; + } + return provider._highestBlockNumber; + }; + case "getGasPrice": + return function(configs) { + var values = configs.map(function(c) { + return c.result; + }); + values.sort(); + return values[Math.floor(values.length / 2)]; + }; + case "getEtherPrice": + return function(configs) { + return median(configs.map(function(c) { + return c.result; + })); + }; + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorageAt": + case "call": + case "estimateGas": + case "getLogs": + break; + case "getTransaction": + case "getTransactionReceipt": + normalize = function(tx) { + if (tx == null) { + return null; + } + tx = (0, properties_1.shallowCopy)(tx); + tx.confirmations = -1; + return serialize(tx); + }; + break; + case "getBlock": + if (params.includeTransactions) { + normalize = function(block) { + if (block == null) { + return null; + } + block = (0, properties_1.shallowCopy)(block); + block.transactions = block.transactions.map(function(tx) { + tx = (0, properties_1.shallowCopy)(tx); + tx.confirmations = -1; + return tx; + }); + return serialize(block); + }; + } else { + normalize = function(block) { + if (block == null) { + return null; + } + return serialize(block); + }; + } + break; + default: + throw new Error("unknown method: " + method); + } + return normalizedTally(normalize, provider.quorum); + } + function waitForSync(config, blockNumber) { + return __awaiter(this, void 0, void 0, function() { + var provider; + return __generator(this, function(_a) { + provider = config.provider; + if (provider.blockNumber != null && provider.blockNumber >= blockNumber || blockNumber === -1) { + return [2, provider]; + } + return [2, (0, web_1.poll)(function() { + return new Promise(function(resolve, reject) { + setTimeout(function() { + if (provider.blockNumber >= blockNumber) { + return resolve(provider); + } + if (config.cancelled) { + return resolve(null); + } + return resolve(void 0); + }, 0); + }); + }, { oncePoll: provider })]; + }); + }); + } + function getRunner(config, currentBlockNumber, method, params) { + return __awaiter(this, void 0, void 0, function() { + var provider, _a, filter; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + provider = config.provider; + _a = method; + switch (_a) { + case "getBlockNumber": + return [3, 1]; + case "getGasPrice": + return [3, 1]; + case "getEtherPrice": + return [3, 2]; + case "getBalance": + return [3, 3]; + case "getTransactionCount": + return [3, 3]; + case "getCode": + return [3, 3]; + case "getStorageAt": + return [3, 6]; + case "getBlock": + return [3, 9]; + case "call": + return [3, 12]; + case "estimateGas": + return [3, 12]; + case "getTransaction": + return [3, 15]; + case "getTransactionReceipt": + return [3, 15]; + case "getLogs": + return [3, 16]; + } + return [3, 19]; + case 1: + return [2, provider[method]()]; + case 2: + if (provider.getEtherPrice) { + return [2, provider.getEtherPrice()]; + } + return [3, 19]; + case 3: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 5]; + return [4, waitForSync(config, currentBlockNumber)]; + case 4: + provider = _b.sent(); + _b.label = 5; + case 5: + return [2, provider[method](params.address, params.blockTag || "latest")]; + case 6: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 8]; + return [4, waitForSync(config, currentBlockNumber)]; + case 7: + provider = _b.sent(); + _b.label = 8; + case 8: + return [2, provider.getStorageAt(params.address, params.position, params.blockTag || "latest")]; + case 9: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 11]; + return [4, waitForSync(config, currentBlockNumber)]; + case 10: + provider = _b.sent(); + _b.label = 11; + case 11: + return [2, provider[params.includeTransactions ? "getBlockWithTransactions" : "getBlock"](params.blockTag || params.blockHash)]; + case 12: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 14]; + return [4, waitForSync(config, currentBlockNumber)]; + case 13: + provider = _b.sent(); + _b.label = 14; + case 14: + return [2, provider[method](params.transaction)]; + case 15: + return [2, provider[method](params.transactionHash)]; + case 16: + filter = params.filter; + if (!(filter.fromBlock && (0, bytes_1.isHexString)(filter.fromBlock) || filter.toBlock && (0, bytes_1.isHexString)(filter.toBlock))) return [3, 18]; + return [4, waitForSync(config, currentBlockNumber)]; + case 17: + provider = _b.sent(); + _b.label = 18; + case 18: + return [2, provider.getLogs(filter)]; + case 19: + return [2, logger.throwError("unknown method error", logger_1.Logger.errors.UNKNOWN_ERROR, { + method, + params + })]; + } + }); + }); + } + var FallbackProvider = ( + /** @class */ + function(_super) { + __extends(FallbackProvider2, _super); + function FallbackProvider2(providers, quorum) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, FallbackProvider2); + if (providers.length === 0) { + logger.throwArgumentError("missing providers", "providers", providers); + } + var providerConfigs = providers.map(function(configOrProvider, index) { + if (abstract_provider_1.Provider.isProvider(configOrProvider)) { + var stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2e3 : 750; + var priority = 1; + return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority }); + } + var config = (0, properties_1.shallowCopy)(configOrProvider); + if (config.priority == null) { + config.priority = 1; + } + if (config.stallTimeout == null) { + config.stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2e3 : 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[" + 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); + } + var networkOrReady = checkNetworks(providerConfigs.map(function(c) { + return c.provider.network; + })); + if (networkOrReady == null) { + networkOrReady = new Promise(function(resolve, reject) { + setTimeout(function() { + _this.detectNetwork().then(resolve, reject); + }, 0); + }); + } + _this = _super.call(this, networkOrReady) || this; + (0, properties_1.defineReadOnly)(_this, "providerConfigs", Object.freeze(providerConfigs)); + (0, properties_1.defineReadOnly)(_this, "quorum", quorum); + _this._highestBlockNumber = -1; + return _this; + } + FallbackProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var networks; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, Promise.all(this.providerConfigs.map(function(c) { + return c.provider.getNetwork(); + }))]; + case 1: + networks = _a.sent(); + return [2, checkNetworks(networks)]; + } + }); + }); + }; + FallbackProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var results, i_1, result, processFunc, configs, currentBlockNumber, i, first, _loop_1, this_1, state_1; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "sendTransaction")) return [3, 2]; + return [4, Promise.all(this.providerConfigs.map(function(c) { + return c.provider.sendTransaction(params.signedTransaction).then(function(result2) { + return result2.hash; + }, function(error) { + return error; + }); + }))]; + case 1: + results = _a.sent(); + for (i_1 = 0; i_1 < results.length; i_1++) { + result = results[i_1]; + if (typeof result === "string") { + return [2, result]; + } + } + throw results[0]; + case 2: + if (!(this._highestBlockNumber === -1 && method !== "getBlockNumber")) return [3, 4]; + return [4, this.getBlockNumber()]; + case 3: + _a.sent(); + _a.label = 4; + case 4: + processFunc = getProcessFunc(this, method, params); + configs = (0, random_1.shuffled)(this.providerConfigs.map(properties_1.shallowCopy)); + configs.sort(function(a, b) { + return a.priority - b.priority; + }); + currentBlockNumber = this._highestBlockNumber; + i = 0; + first = true; + _loop_1 = function() { + var t0, inflightWeight, _loop_2, waiting, results2, result2, errors; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + t0 = now(); + inflightWeight = configs.filter(function(c) { + return c.runner && t0 - c.start < c.stallTimeout; + }).reduce(function(accum, c) { + return accum + c.weight; + }, 0); + _loop_2 = function() { + 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(result3) { + config.done = true; + config.result = result3; + if (_this.listenerCount("debug")) { + _this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, now()), + request: { method, params: (0, properties_1.deepCopy)(params) }, + provider: _this + }); + } + }, function(error) { + config.done = true; + config.error = error; + if (_this.listenerCount("debug")) { + _this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, now()), + request: { method, params: (0, properties_1.deepCopy)(params) }, + provider: _this + }); + } + }); + if (this_1.listenerCount("debug")) { + this_1.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, null), + request: { method, params: (0, properties_1.deepCopy)(params) }, + provider: this_1 + }); + } + inflightWeight += config.weight; + }; + while (inflightWeight < this_1.quorum && i < configs.length) { + _loop_2(); + } + 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) return [3, 2]; + return [4, Promise.race(waiting)]; + case 1: + _b.sent(); + _b.label = 2; + case 2: + results2 = configs.filter(function(c) { + return c.done && c.error == null; + }); + if (!(results2.length >= this_1.quorum)) return [3, 5]; + result2 = processFunc(results2); + if (result2 !== void 0) { + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return [2, { value: result2 }]; + } + if (!!first) return [3, 4]; + return [4, stall(100).getPromise()]; + case 3: + _b.sent(); + _b.label = 4; + case 4: + first = false; + _b.label = 5; + case 5: + 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 < _this.quorum) { + return; + } + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + var e = tally.error; + var props = {}; + ForwardProperties.forEach(function(name2) { + if (e[name2] == null) { + return; + } + props[name2] = e[name2]; + }); + logger.throwError(e.reason || e.message, errorCode, props); + }); + if (configs.filter(function(c) { + return !c.done; + }).length === 0) { + return [2, "break"]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }; + this_1 = this; + _a.label = 5; + case 5: + if (false) return [3, 7]; + return [5, _loop_1()]; + case 6: + state_1 = _a.sent(); + if (typeof state_1 === "object") + return [2, state_1.value]; + if (state_1 === "break") + return [3, 7]; + return [3, 5]; + case 7: + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return [2, logger.throwError("failed to meet quorum", logger_1.Logger.errors.SERVER_ERROR, { + method, + params, + //results: configs.map((c) => c.result), + //errors: configs.map((c) => c.error), + results: configs.map(function(c) { + return exposeDebugConfig(c); + }), + provider: this + })]; + } + }); + }); + }; + return FallbackProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.FallbackProvider = FallbackProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/ipc-provider.js +var require_ipc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/ipc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.IpcProvider = void 0; + var net_1 = require("net"); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var IpcProvider = ( + /** @class */ + function(_super) { + __extends(IpcProvider2, _super); + function IpcProvider2(path, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, IpcProvider2); + if (path == null) { + logger.throwError("missing path", logger_1.Logger.errors.MISSING_ARGUMENT, { arg: "path" }); + } + _this = _super.call(this, "ipc://" + path, network) || this; + (0, properties_1.defineReadOnly)(_this, "path", path); + return _this; + } + IpcProvider2.prototype.send = function(method, params) { + var _this = this; + var payload = JSON.stringify({ + method, + params, + id: 42, + jsonrpc: "2.0" + }); + return new Promise(function(resolve, reject) { + var response = Buffer.alloc(0); + var stream = (0, net_1.connect)(_this.path); + stream.on("data", function(data) { + response = Buffer.concat([response, data]); + }); + stream.on("end", function() { + try { + resolve(JSON.parse(response.toString()).result); + stream.destroy(); + } catch (error) { + reject(error); + stream.destroy(); + } + }); + stream.on("error", function(error) { + reject(error); + stream.destroy(); + }); + stream.write(payload); + stream.end(); + }); + }; + return IpcProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.IpcProvider = IpcProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/infura-provider.js +var require_infura_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/infura-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InfuraProvider = exports2.InfuraWebSocketProvider = void 0; + var properties_1 = require_lib4(); + var websocket_provider_1 = require_websocket_provider(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultProjectId = "84842078b09946638c03157f83405213"; + var InfuraWebSocketProvider = ( + /** @class */ + function(_super) { + __extends(InfuraWebSocketProvider2, _super); + function InfuraWebSocketProvider2(network, apiKey) { + var _this = this; + var provider = new InfuraProvider(network, apiKey); + var connection = provider.connection; + if (connection.password) { + logger.throwError("INFURA WebSocket project secrets unsupported", logger_1.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) || this; + (0, properties_1.defineReadOnly)(_this, "apiKey", provider.projectId); + (0, properties_1.defineReadOnly)(_this, "projectId", provider.projectId); + (0, properties_1.defineReadOnly)(_this, "projectSecret", provider.projectSecret); + return _this; + } + InfuraWebSocketProvider2.prototype.isCommunityResource = function() { + return this.projectId === defaultProjectId; + }; + return InfuraWebSocketProvider2; + }(websocket_provider_1.WebSocketProvider) + ); + exports2.InfuraWebSocketProvider = InfuraWebSocketProvider; + var InfuraProvider = ( + /** @class */ + function(_super) { + __extends(InfuraProvider2, _super); + function InfuraProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + InfuraProvider2.getWebSocketProvider = function(network, apiKey) { + return new InfuraWebSocketProvider(network, apiKey); + }; + InfuraProvider2.getApiKey = function(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; + }; + InfuraProvider2.getUrl = function(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", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + var connection = { + allowGzip: true, + url: "https://" + host + "/v3/" + apiKey.projectId, + throttleCallback: function(attempt, url) { + if (apiKey.projectId === defaultProjectId) { + (0, formatter_1.showThrottleMessage)(); + } + return Promise.resolve(true); + } + }; + if (apiKey.projectSecret != null) { + connection.user = ""; + connection.password = apiKey.projectSecret; + } + return connection; + }; + InfuraProvider2.prototype.isCommunityResource = function() { + return this.projectId === defaultProjectId; + }; + return InfuraProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.InfuraProvider = InfuraProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/json-rpc-batch-provider.js +var require_json_rpc_batch_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/json-rpc-batch-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.JsonRpcBatchProvider = void 0; + var properties_1 = require_lib4(); + var web_1 = require_lib27(); + var json_rpc_provider_1 = require_json_rpc_provider(); + var JsonRpcBatchProvider = ( + /** @class */ + function(_super) { + __extends(JsonRpcBatchProvider2, _super); + function JsonRpcBatchProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + JsonRpcBatchProvider2.prototype.send = function(method, params) { + var _this = this; + var request = { + method, + params, + id: this._nextId++, + jsonrpc: "2.0" + }; + if (this._pendingBatch == null) { + this._pendingBatch = []; + } + var inflightRequest = { 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) { + this._pendingBatchAggregator = setTimeout(function() { + var batch = _this._pendingBatch; + _this._pendingBatch = null; + _this._pendingBatchAggregator = null; + var request2 = batch.map(function(inflight) { + return inflight.request; + }); + _this.emit("debug", { + action: "requestBatch", + request: (0, properties_1.deepCopy)(request2), + provider: _this + }); + return (0, web_1.fetchJson)(_this.connection, JSON.stringify(request2)).then(function(result) { + _this.emit("debug", { + action: "response", + request: request2, + response: result, + provider: _this + }); + batch.forEach(function(inflightRequest2, 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; + inflightRequest2.reject(error); + } else { + inflightRequest2.resolve(payload.result); + } + }); + }, function(error) { + _this.emit("debug", { + action: "response", + error, + request: request2, + provider: _this + }); + batch.forEach(function(inflightRequest2) { + inflightRequest2.reject(error); + }); + }); + }, 10); + } + return promise; + }; + return JsonRpcBatchProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.JsonRpcBatchProvider = JsonRpcBatchProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/nodesmith-provider.js +var require_nodesmith_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/nodesmith-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NodesmithProvider = void 0; + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var defaultApiKey = "ETHERS_JS_SHARED"; + var NodesmithProvider = ( + /** @class */ + function(_super) { + __extends(NodesmithProvider2, _super); + function NodesmithProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + NodesmithProvider2.getApiKey = function(apiKey) { + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey || defaultApiKey; + }; + NodesmithProvider2.getUrl = function(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 NodesmithProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.NodesmithProvider = NodesmithProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/pocket-provider.js +var require_pocket_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/pocket-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PocketProvider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultApplicationIds = { + homestead: "6004bcd10040261633ade990", + ropsten: "6004bd4d0040261633ade991", + rinkeby: "6004bda20040261633ade994", + goerli: "6004bd860040261633ade992" + }; + var PocketProvider = ( + /** @class */ + function(_super) { + __extends(PocketProvider2, _super); + function PocketProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + if (apiKey == null) { + var n = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + if (n) { + var applicationId = defaultApplicationIds[n.name]; + if (applicationId) { + apiKey = { + applicationId, + loadBalancer: true + }; + } + } + if (apiKey == null) { + logger.throwError("unsupported network", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + } + _this = _super.call(this, network, apiKey) || this; + return _this; + } + PocketProvider2.getApiKey = function(apiKey) { + if (apiKey == null) { + logger.throwArgumentError("PocketProvider.getApiKey does not support null apiKey", "apiKey", apiKey); + } + var apiKeyObj = { + applicationId: null, + loadBalancer: false, + applicationSecretKey: null + }; + 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; + }; + PocketProvider2.getUrl = function(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", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + var url = null; + if (apiKey.loadBalancer) { + url = "https://" + host + "/v1/lb/" + apiKey.applicationId; + } else { + url = "https://" + host + "/v1/" + apiKey.applicationId; + } + var connection = { url }; + connection.headers = {}; + if (apiKey.applicationSecretKey != null) { + connection.user = ""; + connection.password = apiKey.applicationSecretKey; + } + return connection; + }; + PocketProvider2.prototype.isCommunityResource = function() { + return this.applicationId === defaultApplicationIds[this.network.name]; + }; + return PocketProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.PocketProvider = PocketProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/web3-provider.js +var require_web3_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/web3-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Web3Provider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var _nextId = 1; + function buildWeb3LegacyFetcher(provider, sendFunc) { + var fetcher = "Web3LegacyFetcher"; + return function(method, params) { + var _this = this; + var request = { + method, + params, + id: _nextId++, + jsonrpc: "2.0" + }; + return new Promise(function(resolve, reject) { + _this.emit("debug", { + action: "request", + fetcher, + request: (0, properties_1.deepCopy)(request), + provider: _this + }); + sendFunc(request, function(error, response) { + if (error) { + _this.emit("debug", { + action: "response", + fetcher, + error, + request, + provider: _this + }); + return reject(error); + } + _this.emit("debug", { + action: "response", + fetcher, + request, + response, + provider: _this + }); + if (response.error) { + var error_1 = new Error(response.error.message); + error_1.code = response.error.code; + error_1.data = response.error.data; + return reject(error_1); + } + resolve(response.result); + }); + }); + }; + } + function buildEip1193Fetcher(provider) { + return function(method, params) { + var _this = this; + if (params == null) { + params = []; + } + var request = { method, params }; + this.emit("debug", { + action: "request", + fetcher: "Eip1193Fetcher", + request: (0, properties_1.deepCopy)(request), + provider: this + }); + return provider.request(request).then(function(response) { + _this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + response, + provider: _this + }); + return response; + }, function(error) { + _this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + error, + provider: _this + }); + throw error; + }); + }; + } + var Web3Provider = ( + /** @class */ + function(_super) { + __extends(Web3Provider2, _super); + function Web3Provider2(provider, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Web3Provider2); + 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:"; + } + } + _this = _super.call(this, path, network) || this; + (0, properties_1.defineReadOnly)(_this, "jsonRpcFetchFunc", jsonRpcFetchFunc); + (0, properties_1.defineReadOnly)(_this, "provider", subprovider); + return _this; + } + Web3Provider2.prototype.send = function(method, params) { + return this.jsonRpcFetchFunc(method, params); + }; + return Web3Provider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.Web3Provider = Web3Provider; + } +}); + +// node_modules/@ethersproject/providers/lib/index.js +var require_lib28 = __commonJS({ + "node_modules/@ethersproject/providers/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Formatter = exports2.showThrottleMessage = exports2.isCommunityResourcable = exports2.isCommunityResource = exports2.getNetwork = exports2.getDefaultProvider = exports2.JsonRpcSigner = exports2.IpcProvider = exports2.WebSocketProvider = exports2.Web3Provider = exports2.StaticJsonRpcProvider = exports2.PocketProvider = exports2.NodesmithProvider = exports2.JsonRpcBatchProvider = exports2.JsonRpcProvider = exports2.InfuraWebSocketProvider = exports2.InfuraProvider = exports2.EtherscanProvider = exports2.CloudflareProvider = exports2.AlchemyWebSocketProvider = exports2.AlchemyProvider = exports2.FallbackProvider = exports2.UrlJsonRpcProvider = exports2.Resolver = exports2.BaseProvider = exports2.Provider = void 0; + var abstract_provider_1 = require_lib12(); + Object.defineProperty(exports2, "Provider", { enumerable: true, get: function() { + return abstract_provider_1.Provider; + } }); + var networks_1 = require_lib25(); + Object.defineProperty(exports2, "getNetwork", { enumerable: true, get: function() { + return networks_1.getNetwork; + } }); + var base_provider_1 = require_base_provider(); + Object.defineProperty(exports2, "BaseProvider", { enumerable: true, get: function() { + return base_provider_1.BaseProvider; + } }); + Object.defineProperty(exports2, "Resolver", { enumerable: true, get: function() { + return base_provider_1.Resolver; + } }); + var alchemy_provider_1 = require_alchemy_provider(); + Object.defineProperty(exports2, "AlchemyProvider", { enumerable: true, get: function() { + return alchemy_provider_1.AlchemyProvider; + } }); + Object.defineProperty(exports2, "AlchemyWebSocketProvider", { enumerable: true, get: function() { + return alchemy_provider_1.AlchemyWebSocketProvider; + } }); + var cloudflare_provider_1 = require_cloudflare_provider(); + Object.defineProperty(exports2, "CloudflareProvider", { enumerable: true, get: function() { + return cloudflare_provider_1.CloudflareProvider; + } }); + var etherscan_provider_1 = require_etherscan_provider(); + Object.defineProperty(exports2, "EtherscanProvider", { enumerable: true, get: function() { + return etherscan_provider_1.EtherscanProvider; + } }); + var fallback_provider_1 = require_fallback_provider(); + Object.defineProperty(exports2, "FallbackProvider", { enumerable: true, get: function() { + return fallback_provider_1.FallbackProvider; + } }); + var ipc_provider_1 = require_ipc_provider(); + Object.defineProperty(exports2, "IpcProvider", { enumerable: true, get: function() { + return ipc_provider_1.IpcProvider; + } }); + var infura_provider_1 = require_infura_provider(); + Object.defineProperty(exports2, "InfuraProvider", { enumerable: true, get: function() { + return infura_provider_1.InfuraProvider; + } }); + Object.defineProperty(exports2, "InfuraWebSocketProvider", { enumerable: true, get: function() { + return infura_provider_1.InfuraWebSocketProvider; + } }); + var json_rpc_provider_1 = require_json_rpc_provider(); + Object.defineProperty(exports2, "JsonRpcProvider", { enumerable: true, get: function() { + return json_rpc_provider_1.JsonRpcProvider; + } }); + Object.defineProperty(exports2, "JsonRpcSigner", { enumerable: true, get: function() { + return json_rpc_provider_1.JsonRpcSigner; + } }); + var json_rpc_batch_provider_1 = require_json_rpc_batch_provider(); + Object.defineProperty(exports2, "JsonRpcBatchProvider", { enumerable: true, get: function() { + return json_rpc_batch_provider_1.JsonRpcBatchProvider; + } }); + var nodesmith_provider_1 = require_nodesmith_provider(); + Object.defineProperty(exports2, "NodesmithProvider", { enumerable: true, get: function() { + return nodesmith_provider_1.NodesmithProvider; + } }); + var pocket_provider_1 = require_pocket_provider(); + Object.defineProperty(exports2, "PocketProvider", { enumerable: true, get: function() { + return pocket_provider_1.PocketProvider; + } }); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + Object.defineProperty(exports2, "StaticJsonRpcProvider", { enumerable: true, get: function() { + return url_json_rpc_provider_1.StaticJsonRpcProvider; + } }); + Object.defineProperty(exports2, "UrlJsonRpcProvider", { enumerable: true, get: function() { + return url_json_rpc_provider_1.UrlJsonRpcProvider; + } }); + var web3_provider_1 = require_web3_provider(); + Object.defineProperty(exports2, "Web3Provider", { enumerable: true, get: function() { + return web3_provider_1.Web3Provider; + } }); + var websocket_provider_1 = require_websocket_provider(); + Object.defineProperty(exports2, "WebSocketProvider", { enumerable: true, get: function() { + return websocket_provider_1.WebSocketProvider; + } }); + var formatter_1 = require_formatter(); + Object.defineProperty(exports2, "Formatter", { enumerable: true, get: function() { + return formatter_1.Formatter; + } }); + Object.defineProperty(exports2, "isCommunityResourcable", { enumerable: true, get: function() { + return formatter_1.isCommunityResourcable; + } }); + Object.defineProperty(exports2, "isCommunityResource", { enumerable: true, get: function() { + return formatter_1.isCommunityResource; + } }); + Object.defineProperty(exports2, "showThrottleMessage", { enumerable: true, get: function() { + return formatter_1.showThrottleMessage; + } }); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + function getDefaultProvider(network, options) { + if (network == null) { + network = "homestead"; + } + if (typeof network === "string") { + var match = network.match(/^(ws|http)s?:/i); + if (match) { + switch (match[1]) { + case "http": + return new json_rpc_provider_1.JsonRpcProvider(network); + case "ws": + return new websocket_provider_1.WebSocketProvider(network); + default: + logger.throwArgumentError("unsupported URL scheme", "network", network); + } + } + } + var n = (0, networks_1.getNetwork)(network); + if (!n || !n._defaultProvider) { + logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, { + operation: "getDefaultProvider", + network + }); + } + return n._defaultProvider({ + FallbackProvider: fallback_provider_1.FallbackProvider, + AlchemyProvider: alchemy_provider_1.AlchemyProvider, + CloudflareProvider: cloudflare_provider_1.CloudflareProvider, + EtherscanProvider: etherscan_provider_1.EtherscanProvider, + InfuraProvider: infura_provider_1.InfuraProvider, + JsonRpcProvider: json_rpc_provider_1.JsonRpcProvider, + NodesmithProvider: nodesmith_provider_1.NodesmithProvider, + PocketProvider: pocket_provider_1.PocketProvider, + Web3Provider: web3_provider_1.Web3Provider, + IpcProvider: ipc_provider_1.IpcProvider + }, options); + } + exports2.getDefaultProvider = getDefaultProvider; + } +}); + +// node_modules/@ethersproject/solidity/lib/_version.js +var require_version23 = __commonJS({ + "node_modules/@ethersproject/solidity/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "solidity/5.5.0"; + } +}); + +// node_modules/@ethersproject/solidity/lib/index.js +var require_lib29 = __commonJS({ + "node_modules/@ethersproject/solidity/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sha256 = exports2.keccak256 = exports2.pack = void 0; + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var sha2_1 = require_lib19(); + var strings_1 = require_lib9(); + 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_1 = require_lib(); + var _version_1 = require_version23(); + var logger = new logger_1.Logger(_version_1.version); + function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return (0, bytes_1.zeroPad)(value, 32); + } + return (0, bytes_1.arrayify)(value); + case "string": + return (0, strings_1.toUtf8Bytes)(value); + case "bytes": + return (0, bytes_1.arrayify)(value); + case "bool": + value = value ? "0x01" : "0x00"; + if (isArray) { + return (0, bytes_1.zeroPad)(value, 32); + } + return (0, bytes_1.arrayify)(value); + } + var match = type.match(regexNumber); + if (match) { + 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 = bignumber_1.BigNumber.from(value).toTwos(size); + return (0, bytes_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 ((0, bytes_1.arrayify)(value).byteLength !== size) { + logger.throwArgumentError("invalid value for " + type, "value", value); + } + if (isArray) { + return (0, bytes_1.arrayify)((value + Zeros).substring(0, 66)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + var baseType_1 = match[1]; + var count = parseInt(match[2] || String(value.length)); + if (count != value.length) { + logger.throwArgumentError("invalid array length for " + type, "value", value); + } + var result_1 = []; + value.forEach(function(value2) { + result_1.push(_pack(baseType_1, value2, true)); + }); + return (0, bytes_1.concat)(result_1); + } + return logger.throwArgumentError("invalid type", "type", type); + } + 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 (0, bytes_1.hexlify)((0, bytes_1.concat)(tight)); + } + exports2.pack = pack; + function keccak256(types, values) { + return (0, keccak256_1.keccak256)(pack(types, values)); + } + exports2.keccak256 = keccak256; + function sha256(types, values) { + return (0, sha2_1.sha256)(pack(types, values)); + } + exports2.sha256 = sha256; + } +}); + +// node_modules/@ethersproject/units/lib/_version.js +var require_version24 = __commonJS({ + "node_modules/@ethersproject/units/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "units/5.5.0"; + } +}); + +// node_modules/@ethersproject/units/lib/index.js +var require_lib30 = __commonJS({ + "node_modules/@ethersproject/units/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.parseEther = exports2.formatEther = exports2.parseUnits = exports2.formatUnits = exports2.commify = void 0; + var bignumber_1 = require_lib3(); + var logger_1 = require_lib(); + var _version_1 = require_version24(); + var logger = new logger_1.Logger(_version_1.version); + var names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether" + ]; + 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); + } + var whole = comps[0]; + var negative = ""; + if (whole.substring(0, 1) === "-") { + negative = "-"; + whole = whole.substring(1); + } + 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; + } + exports2.commify = commify; + function formatUnits(value, unitName) { + if (typeof unitName === "string") { + var index = names.indexOf(unitName); + if (index !== -1) { + unitName = 3 * index; + } + } + return (0, bignumber_1.formatFixed)(value, unitName != null ? unitName : 18); + } + exports2.formatUnits = formatUnits; + 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 (0, bignumber_1.parseFixed)(value, unitName != null ? unitName : 18); + } + exports2.parseUnits = parseUnits; + function formatEther(wei) { + return formatUnits(wei, 18); + } + exports2.formatEther = formatEther; + function parseEther(ether) { + return parseUnits(ether, 18); + } + exports2.parseEther = parseEther; + } +}); + +// node_modules/ethers/lib/utils.js +var require_utils5 = __commonJS({ + "node_modules/ethers/lib/utils.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.formatBytes32String = exports2.Utf8ErrorFuncs = exports2.toUtf8String = exports2.toUtf8CodePoints = exports2.toUtf8Bytes = exports2._toEscapedUtf8String = exports2.nameprep = exports2.hexDataSlice = exports2.hexDataLength = exports2.hexZeroPad = exports2.hexValue = exports2.hexStripZeros = exports2.hexConcat = exports2.isHexString = exports2.hexlify = exports2.base64 = exports2.base58 = exports2.TransactionDescription = exports2.LogDescription = exports2.Interface = exports2.SigningKey = exports2.HDNode = exports2.defaultPath = exports2.isBytesLike = exports2.isBytes = exports2.zeroPad = exports2.stripZeros = exports2.concat = exports2.arrayify = exports2.shallowCopy = exports2.resolveProperties = exports2.getStatic = exports2.defineReadOnly = exports2.deepCopy = exports2.checkProperties = exports2.poll = exports2.fetchJson = exports2._fetchData = exports2.RLP = exports2.Logger = exports2.checkResultErrors = exports2.FormatTypes = exports2.ParamType = exports2.FunctionFragment = exports2.EventFragment = exports2.ErrorFragment = exports2.ConstructorFragment = exports2.Fragment = exports2.defaultAbiCoder = exports2.AbiCoder = void 0; + exports2.Indexed = exports2.Utf8ErrorReason = exports2.UnicodeNormalizationForm = exports2.SupportedAlgorithm = exports2.mnemonicToSeed = exports2.isValidMnemonic = exports2.entropyToMnemonic = exports2.mnemonicToEntropy = exports2.getAccountPath = exports2.verifyTypedData = exports2.verifyMessage = exports2.recoverPublicKey = exports2.computePublicKey = exports2.recoverAddress = exports2.computeAddress = exports2.getJsonWalletAddress = exports2.TransactionTypes = exports2.serializeTransaction = exports2.parseTransaction = exports2.accessListify = exports2.joinSignature = exports2.splitSignature = exports2.soliditySha256 = exports2.solidityKeccak256 = exports2.solidityPack = exports2.shuffled = exports2.randomBytes = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = exports2.keccak256 = exports2.computeHmac = exports2.commify = exports2.parseUnits = exports2.formatUnits = exports2.parseEther = exports2.formatEther = exports2.isAddress = exports2.getCreate2Address = exports2.getContractAddress = exports2.getIcapAddress = exports2.getAddress = exports2._TypedDataEncoder = exports2.id = exports2.isValidName = exports2.namehash = exports2.hashMessage = exports2.parseBytes32String = void 0; + var abi_1 = require_lib11(); + Object.defineProperty(exports2, "AbiCoder", { enumerable: true, get: function() { + return abi_1.AbiCoder; + } }); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return abi_1.checkResultErrors; + } }); + Object.defineProperty(exports2, "ConstructorFragment", { enumerable: true, get: function() { + return abi_1.ConstructorFragment; + } }); + Object.defineProperty(exports2, "defaultAbiCoder", { enumerable: true, get: function() { + return abi_1.defaultAbiCoder; + } }); + Object.defineProperty(exports2, "ErrorFragment", { enumerable: true, get: function() { + return abi_1.ErrorFragment; + } }); + Object.defineProperty(exports2, "EventFragment", { enumerable: true, get: function() { + return abi_1.EventFragment; + } }); + Object.defineProperty(exports2, "FormatTypes", { enumerable: true, get: function() { + return abi_1.FormatTypes; + } }); + Object.defineProperty(exports2, "Fragment", { enumerable: true, get: function() { + return abi_1.Fragment; + } }); + Object.defineProperty(exports2, "FunctionFragment", { enumerable: true, get: function() { + return abi_1.FunctionFragment; + } }); + Object.defineProperty(exports2, "Indexed", { enumerable: true, get: function() { + return abi_1.Indexed; + } }); + Object.defineProperty(exports2, "Interface", { enumerable: true, get: function() { + return abi_1.Interface; + } }); + Object.defineProperty(exports2, "LogDescription", { enumerable: true, get: function() { + return abi_1.LogDescription; + } }); + Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() { + return abi_1.ParamType; + } }); + Object.defineProperty(exports2, "TransactionDescription", { enumerable: true, get: function() { + return abi_1.TransactionDescription; + } }); + var address_1 = require_lib7(); + Object.defineProperty(exports2, "getAddress", { enumerable: true, get: function() { + return address_1.getAddress; + } }); + Object.defineProperty(exports2, "getCreate2Address", { enumerable: true, get: function() { + return address_1.getCreate2Address; + } }); + Object.defineProperty(exports2, "getContractAddress", { enumerable: true, get: function() { + return address_1.getContractAddress; + } }); + Object.defineProperty(exports2, "getIcapAddress", { enumerable: true, get: function() { + return address_1.getIcapAddress; + } }); + Object.defineProperty(exports2, "isAddress", { enumerable: true, get: function() { + return address_1.isAddress; + } }); + var base64 = __importStar(require_lib26()); + exports2.base64 = base64; + var basex_1 = require_lib17(); + Object.defineProperty(exports2, "base58", { enumerable: true, get: function() { + return basex_1.Base58; + } }); + var bytes_1 = require_lib2(); + Object.defineProperty(exports2, "arrayify", { enumerable: true, get: function() { + return bytes_1.arrayify; + } }); + Object.defineProperty(exports2, "concat", { enumerable: true, get: function() { + return bytes_1.concat; + } }); + Object.defineProperty(exports2, "hexConcat", { enumerable: true, get: function() { + return bytes_1.hexConcat; + } }); + Object.defineProperty(exports2, "hexDataSlice", { enumerable: true, get: function() { + return bytes_1.hexDataSlice; + } }); + Object.defineProperty(exports2, "hexDataLength", { enumerable: true, get: function() { + return bytes_1.hexDataLength; + } }); + Object.defineProperty(exports2, "hexlify", { enumerable: true, get: function() { + return bytes_1.hexlify; + } }); + Object.defineProperty(exports2, "hexStripZeros", { enumerable: true, get: function() { + return bytes_1.hexStripZeros; + } }); + Object.defineProperty(exports2, "hexValue", { enumerable: true, get: function() { + return bytes_1.hexValue; + } }); + Object.defineProperty(exports2, "hexZeroPad", { enumerable: true, get: function() { + return bytes_1.hexZeroPad; + } }); + Object.defineProperty(exports2, "isBytes", { enumerable: true, get: function() { + return bytes_1.isBytes; + } }); + Object.defineProperty(exports2, "isBytesLike", { enumerable: true, get: function() { + return bytes_1.isBytesLike; + } }); + Object.defineProperty(exports2, "isHexString", { enumerable: true, get: function() { + return bytes_1.isHexString; + } }); + Object.defineProperty(exports2, "joinSignature", { enumerable: true, get: function() { + return bytes_1.joinSignature; + } }); + Object.defineProperty(exports2, "zeroPad", { enumerable: true, get: function() { + return bytes_1.zeroPad; + } }); + Object.defineProperty(exports2, "splitSignature", { enumerable: true, get: function() { + return bytes_1.splitSignature; + } }); + Object.defineProperty(exports2, "stripZeros", { enumerable: true, get: function() { + return bytes_1.stripZeros; + } }); + var hash_1 = require_lib10(); + Object.defineProperty(exports2, "_TypedDataEncoder", { enumerable: true, get: function() { + return hash_1._TypedDataEncoder; + } }); + Object.defineProperty(exports2, "hashMessage", { enumerable: true, get: function() { + return hash_1.hashMessage; + } }); + Object.defineProperty(exports2, "id", { enumerable: true, get: function() { + return hash_1.id; + } }); + Object.defineProperty(exports2, "isValidName", { enumerable: true, get: function() { + return hash_1.isValidName; + } }); + Object.defineProperty(exports2, "namehash", { enumerable: true, get: function() { + return hash_1.namehash; + } }); + var hdnode_1 = require_lib21(); + Object.defineProperty(exports2, "defaultPath", { enumerable: true, get: function() { + return hdnode_1.defaultPath; + } }); + Object.defineProperty(exports2, "entropyToMnemonic", { enumerable: true, get: function() { + return hdnode_1.entropyToMnemonic; + } }); + Object.defineProperty(exports2, "getAccountPath", { enumerable: true, get: function() { + return hdnode_1.getAccountPath; + } }); + Object.defineProperty(exports2, "HDNode", { enumerable: true, get: function() { + return hdnode_1.HDNode; + } }); + Object.defineProperty(exports2, "isValidMnemonic", { enumerable: true, get: function() { + return hdnode_1.isValidMnemonic; + } }); + Object.defineProperty(exports2, "mnemonicToEntropy", { enumerable: true, get: function() { + return hdnode_1.mnemonicToEntropy; + } }); + Object.defineProperty(exports2, "mnemonicToSeed", { enumerable: true, get: function() { + return hdnode_1.mnemonicToSeed; + } }); + var json_wallets_1 = require_lib23(); + Object.defineProperty(exports2, "getJsonWalletAddress", { enumerable: true, get: function() { + return json_wallets_1.getJsonWalletAddress; + } }); + var keccak256_1 = require_lib5(); + Object.defineProperty(exports2, "keccak256", { enumerable: true, get: function() { + return keccak256_1.keccak256; + } }); + var logger_1 = require_lib(); + Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() { + return logger_1.Logger; + } }); + var sha2_1 = require_lib19(); + Object.defineProperty(exports2, "computeHmac", { enumerable: true, get: function() { + return sha2_1.computeHmac; + } }); + Object.defineProperty(exports2, "ripemd160", { enumerable: true, get: function() { + return sha2_1.ripemd160; + } }); + Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() { + return sha2_1.sha256; + } }); + Object.defineProperty(exports2, "sha512", { enumerable: true, get: function() { + return sha2_1.sha512; + } }); + var solidity_1 = require_lib29(); + Object.defineProperty(exports2, "solidityKeccak256", { enumerable: true, get: function() { + return solidity_1.keccak256; + } }); + Object.defineProperty(exports2, "solidityPack", { enumerable: true, get: function() { + return solidity_1.pack; + } }); + Object.defineProperty(exports2, "soliditySha256", { enumerable: true, get: function() { + return solidity_1.sha256; + } }); + var random_1 = require_lib22(); + Object.defineProperty(exports2, "randomBytes", { enumerable: true, get: function() { + return random_1.randomBytes; + } }); + Object.defineProperty(exports2, "shuffled", { enumerable: true, get: function() { + return random_1.shuffled; + } }); + var properties_1 = require_lib4(); + Object.defineProperty(exports2, "checkProperties", { enumerable: true, get: function() { + return properties_1.checkProperties; + } }); + Object.defineProperty(exports2, "deepCopy", { enumerable: true, get: function() { + return properties_1.deepCopy; + } }); + Object.defineProperty(exports2, "defineReadOnly", { enumerable: true, get: function() { + return properties_1.defineReadOnly; + } }); + Object.defineProperty(exports2, "getStatic", { enumerable: true, get: function() { + return properties_1.getStatic; + } }); + Object.defineProperty(exports2, "resolveProperties", { enumerable: true, get: function() { + return properties_1.resolveProperties; + } }); + Object.defineProperty(exports2, "shallowCopy", { enumerable: true, get: function() { + return properties_1.shallowCopy; + } }); + var RLP = __importStar(require_lib6()); + exports2.RLP = RLP; + var signing_key_1 = require_lib14(); + Object.defineProperty(exports2, "computePublicKey", { enumerable: true, get: function() { + return signing_key_1.computePublicKey; + } }); + Object.defineProperty(exports2, "recoverPublicKey", { enumerable: true, get: function() { + return signing_key_1.recoverPublicKey; + } }); + Object.defineProperty(exports2, "SigningKey", { enumerable: true, get: function() { + return signing_key_1.SigningKey; + } }); + var strings_1 = require_lib9(); + Object.defineProperty(exports2, "formatBytes32String", { enumerable: true, get: function() { + return strings_1.formatBytes32String; + } }); + Object.defineProperty(exports2, "nameprep", { enumerable: true, get: function() { + return strings_1.nameprep; + } }); + Object.defineProperty(exports2, "parseBytes32String", { enumerable: true, get: function() { + return strings_1.parseBytes32String; + } }); + Object.defineProperty(exports2, "_toEscapedUtf8String", { enumerable: true, get: function() { + return strings_1._toEscapedUtf8String; + } }); + Object.defineProperty(exports2, "toUtf8Bytes", { enumerable: true, get: function() { + return strings_1.toUtf8Bytes; + } }); + Object.defineProperty(exports2, "toUtf8CodePoints", { enumerable: true, get: function() { + return strings_1.toUtf8CodePoints; + } }); + Object.defineProperty(exports2, "toUtf8String", { enumerable: true, get: function() { + return strings_1.toUtf8String; + } }); + Object.defineProperty(exports2, "Utf8ErrorFuncs", { enumerable: true, get: function() { + return strings_1.Utf8ErrorFuncs; + } }); + var transactions_1 = require_lib15(); + Object.defineProperty(exports2, "accessListify", { enumerable: true, get: function() { + return transactions_1.accessListify; + } }); + Object.defineProperty(exports2, "computeAddress", { enumerable: true, get: function() { + return transactions_1.computeAddress; + } }); + Object.defineProperty(exports2, "parseTransaction", { enumerable: true, get: function() { + return transactions_1.parse; + } }); + Object.defineProperty(exports2, "recoverAddress", { enumerable: true, get: function() { + return transactions_1.recoverAddress; + } }); + Object.defineProperty(exports2, "serializeTransaction", { enumerable: true, get: function() { + return transactions_1.serialize; + } }); + Object.defineProperty(exports2, "TransactionTypes", { enumerable: true, get: function() { + return transactions_1.TransactionTypes; + } }); + var units_1 = require_lib30(); + Object.defineProperty(exports2, "commify", { enumerable: true, get: function() { + return units_1.commify; + } }); + Object.defineProperty(exports2, "formatEther", { enumerable: true, get: function() { + return units_1.formatEther; + } }); + Object.defineProperty(exports2, "parseEther", { enumerable: true, get: function() { + return units_1.parseEther; + } }); + Object.defineProperty(exports2, "formatUnits", { enumerable: true, get: function() { + return units_1.formatUnits; + } }); + Object.defineProperty(exports2, "parseUnits", { enumerable: true, get: function() { + return units_1.parseUnits; + } }); + var wallet_1 = require_lib24(); + Object.defineProperty(exports2, "verifyMessage", { enumerable: true, get: function() { + return wallet_1.verifyMessage; + } }); + Object.defineProperty(exports2, "verifyTypedData", { enumerable: true, get: function() { + return wallet_1.verifyTypedData; + } }); + var web_1 = require_lib27(); + Object.defineProperty(exports2, "_fetchData", { enumerable: true, get: function() { + return web_1._fetchData; + } }); + Object.defineProperty(exports2, "fetchJson", { enumerable: true, get: function() { + return web_1.fetchJson; + } }); + Object.defineProperty(exports2, "poll", { enumerable: true, get: function() { + return web_1.poll; + } }); + var sha2_2 = require_lib19(); + Object.defineProperty(exports2, "SupportedAlgorithm", { enumerable: true, get: function() { + return sha2_2.SupportedAlgorithm; + } }); + var strings_2 = require_lib9(); + Object.defineProperty(exports2, "UnicodeNormalizationForm", { enumerable: true, get: function() { + return strings_2.UnicodeNormalizationForm; + } }); + Object.defineProperty(exports2, "Utf8ErrorReason", { enumerable: true, get: function() { + return strings_2.Utf8ErrorReason; + } }); + } +}); + +// node_modules/ethers/lib/_version.js +var require_version25 = __commonJS({ + "node_modules/ethers/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "ethers/5.5.2"; + } +}); + +// node_modules/ethers/lib/ethers.js +var require_ethers = __commonJS({ + "node_modules/ethers/lib/ethers.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.version = exports2.wordlists = exports2.utils = exports2.logger = exports2.errors = exports2.constants = exports2.FixedNumber = exports2.BigNumber = exports2.ContractFactory = exports2.Contract = exports2.BaseContract = exports2.providers = exports2.getDefaultProvider = exports2.VoidSigner = exports2.Wallet = exports2.Signer = void 0; + var contracts_1 = require_lib16(); + Object.defineProperty(exports2, "BaseContract", { enumerable: true, get: function() { + return contracts_1.BaseContract; + } }); + Object.defineProperty(exports2, "Contract", { enumerable: true, get: function() { + return contracts_1.Contract; + } }); + Object.defineProperty(exports2, "ContractFactory", { enumerable: true, get: function() { + return contracts_1.ContractFactory; + } }); + var bignumber_1 = require_lib3(); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return bignumber_1.BigNumber; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return bignumber_1.FixedNumber; + } }); + var abstract_signer_1 = require_lib13(); + Object.defineProperty(exports2, "Signer", { enumerable: true, get: function() { + return abstract_signer_1.Signer; + } }); + Object.defineProperty(exports2, "VoidSigner", { enumerable: true, get: function() { + return abstract_signer_1.VoidSigner; + } }); + var wallet_1 = require_lib24(); + Object.defineProperty(exports2, "Wallet", { enumerable: true, get: function() { + return wallet_1.Wallet; + } }); + var constants = __importStar(require_lib8()); + exports2.constants = constants; + var providers = __importStar(require_lib28()); + exports2.providers = providers; + var providers_1 = require_lib28(); + Object.defineProperty(exports2, "getDefaultProvider", { enumerable: true, get: function() { + return providers_1.getDefaultProvider; + } }); + var wordlists_1 = require_lib20(); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return wordlists_1.Wordlist; + } }); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return wordlists_1.wordlists; + } }); + var utils = __importStar(require_utils5()); + exports2.utils = utils; + var logger_1 = require_lib(); + Object.defineProperty(exports2, "errors", { enumerable: true, get: function() { + return logger_1.ErrorCode; + } }); + var _version_1 = require_version25(); + Object.defineProperty(exports2, "version", { enumerable: true, get: function() { + return _version_1.version; + } }); + var logger = new logger_1.Logger(_version_1.version); + exports2.logger = logger; + } +}); + +// node_modules/ethers/lib/index.js +var require_lib31 = __commonJS({ + "node_modules/ethers/lib/index.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.version = exports2.wordlists = exports2.utils = exports2.logger = exports2.errors = exports2.constants = exports2.FixedNumber = exports2.BigNumber = exports2.ContractFactory = exports2.Contract = exports2.BaseContract = exports2.providers = exports2.getDefaultProvider = exports2.VoidSigner = exports2.Wallet = exports2.Signer = exports2.ethers = void 0; + var ethers2 = __importStar(require_ethers()); + exports2.ethers = ethers2; + try { + anyGlobal = window; + if (anyGlobal._ethers == null) { + anyGlobal._ethers = ethers2; + } + } catch (error) { + } + var anyGlobal; + var ethers_1 = require_ethers(); + Object.defineProperty(exports2, "Signer", { enumerable: true, get: function() { + return ethers_1.Signer; + } }); + Object.defineProperty(exports2, "Wallet", { enumerable: true, get: function() { + return ethers_1.Wallet; + } }); + Object.defineProperty(exports2, "VoidSigner", { enumerable: true, get: function() { + return ethers_1.VoidSigner; + } }); + Object.defineProperty(exports2, "getDefaultProvider", { enumerable: true, get: function() { + return ethers_1.getDefaultProvider; + } }); + Object.defineProperty(exports2, "providers", { enumerable: true, get: function() { + return ethers_1.providers; + } }); + Object.defineProperty(exports2, "BaseContract", { enumerable: true, get: function() { + return ethers_1.BaseContract; + } }); + Object.defineProperty(exports2, "Contract", { enumerable: true, get: function() { + return ethers_1.Contract; + } }); + Object.defineProperty(exports2, "ContractFactory", { enumerable: true, get: function() { + return ethers_1.ContractFactory; + } }); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return ethers_1.BigNumber; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return ethers_1.FixedNumber; + } }); + Object.defineProperty(exports2, "constants", { enumerable: true, get: function() { + return ethers_1.constants; + } }); + Object.defineProperty(exports2, "errors", { enumerable: true, get: function() { + return ethers_1.errors; + } }); + Object.defineProperty(exports2, "logger", { enumerable: true, get: function() { + return ethers_1.logger; + } }); + Object.defineProperty(exports2, "utils", { enumerable: true, get: function() { + return ethers_1.utils; + } }); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return ethers_1.wordlists; + } }); + Object.defineProperty(exports2, "version", { enumerable: true, get: function() { + return ethers_1.version; + } }); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return ethers_1.Wordlist; + } }); + } +}); + +// src/getSqrtPriceAtTick.ts +var import_decimal = __toESM(require_decimal()); +var import_ethers = __toESM(require_lib31()); +var tickArray = process.argv[2].split(","); +var resultsArray = []; +for (let tick of tickArray) { + const jsResult = new import_decimal.default(1.0001).pow(tick).sqrt().mul(new import_decimal.default(2).pow(96)).toFixed(0); + resultsArray.push(jsResult); +} +process.stdout.write(import_ethers.ethers.utils.defaultAbiCoder.encode(["uint160[]"], [resultsArray])); +/*! Bundled license information: + +js-sha3/src/sha3.js: + (** + * [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 + *) +*/ diff --git a/test/js-scripts/dist/getTickAtSqrtPrice.js b/test/js-scripts/dist/getTickAtSqrtPrice.js new file mode 100644 index 000000000..85725d3fb --- /dev/null +++ b/test/js-scripts/dist/getTickAtSqrtPrice.js @@ -0,0 +1,34131 @@ +"use strict"; +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __commonJS = (cb, mod) => function __require() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + // If the importer is in node compatibility mode or this is not an ESM + // file that has been converted to a CommonJS file using a Babel- + // compatible transform (i.e. "__esModule" has not been set), then set + // "default" to the CommonJS "module.exports" for node compatibility. + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); + +// node_modules/decimal.js/decimal.js +var require_decimal = __commonJS({ + "node_modules/decimal.js/decimal.js"(exports2, module2) { + (function(globalScope) { + "use strict"; + var EXP_LIMIT = 9e15, MAX_DIGITS = 1e9, NUMERALS = "0123456789abcdef", LN10 = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", PI = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", DEFAULTS = { + // These values must be integers within the stated ranges (inclusive). + // Most of these values can be changed at run-time using the `Decimal.config` method. + // The maximum number of significant digits of the result of a calculation or base conversion. + // E.g. `Decimal.config({ precision: 20 });` + precision: 20, + // 1 to MAX_DIGITS + // The rounding mode used when rounding to `precision`. + // + // ROUND_UP 0 Away from zero. + // ROUND_DOWN 1 Towards zero. + // ROUND_CEIL 2 Towards +Infinity. + // ROUND_FLOOR 3 Towards -Infinity. + // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up. + // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down. + // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour. + // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity. + // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity. + // + // E.g. + // `Decimal.rounding = 4;` + // `Decimal.rounding = Decimal.ROUND_HALF_UP;` + rounding: 4, + // 0 to 8 + // The modulo mode used when calculating the modulus: a mod n. + // The quotient (q = a / n) is calculated according to the corresponding rounding mode. + // The remainder (r) is calculated as: r = a - n * q. + // + // UP 0 The remainder is positive if the dividend is negative, else is negative. + // DOWN 1 The remainder has the same sign as the dividend (JavaScript %). + // FLOOR 3 The remainder has the same sign as the divisor (Python %). + // HALF_EVEN 6 The IEEE 754 remainder function. + // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive. + // + // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian + // division (9) are commonly used for the modulus operation. The other rounding modes can also + // be used, but they may not give useful results. + modulo: 1, + // 0 to 9 + // The exponent value at and beneath which `toString` returns exponential notation. + // JavaScript numbers: -7 + toExpNeg: -7, + // 0 to -EXP_LIMIT + // The exponent value at and above which `toString` returns exponential notation. + // JavaScript numbers: 21 + toExpPos: 21, + // 0 to EXP_LIMIT + // The minimum exponent value, beneath which underflow to zero occurs. + // JavaScript numbers: -324 (5e-324) + minE: -EXP_LIMIT, + // -1 to -EXP_LIMIT + // The maximum exponent value, above which overflow to Infinity occurs. + // JavaScript numbers: 308 (1.7976931348623157e+308) + maxE: EXP_LIMIT, + // 1 to EXP_LIMIT + // Whether to use cryptographically-secure random number generation, if available. + crypto: false + // true/false + }, Decimal2, inexact, noConflict, quadrant, external = true, decimalError = "[DecimalError] ", invalidArgument = decimalError + "Invalid argument: ", precisionLimitExceeded = decimalError + "Precision limit exceeded", cryptoUnavailable = decimalError + "crypto unavailable", tag = "[object Decimal]", mathfloor = Math.floor, mathpow = Math.pow, isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, BASE = 1e7, LOG_BASE = 7, MAX_SAFE_INTEGER = 9007199254740991, LN10_PRECISION = LN10.length - 1, PI_PRECISION = PI.length - 1, P = { toStringTag: tag }; + P.absoluteValue = P.abs = function() { + var x = new this.constructor(this); + if (x.s < 0) x.s = 1; + return finalise(x); + }; + P.ceil = function() { + return finalise(new this.constructor(this), this.e + 1, 2); + }; + P.clampedTo = P.clamp = function(min2, max2) { + var k, x = this, Ctor = x.constructor; + min2 = new Ctor(min2); + max2 = new Ctor(max2); + if (!min2.s || !max2.s) return new Ctor(NaN); + if (min2.gt(max2)) throw Error(invalidArgument + max2); + k = x.cmp(min2); + return k < 0 ? min2 : x.cmp(max2) > 0 ? max2 : new Ctor(x); + }; + P.comparedTo = P.cmp = function(y) { + var i, j, xdL, ydL, x = this, xd = x.d, yd = (y = new x.constructor(y)).d, xs = x.s, ys = y.s; + if (!xd || !yd) { + return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1; + } + if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0; + if (xs !== ys) return xs; + if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1; + xdL = xd.length; + ydL = yd.length; + for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) { + if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1; + } + return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1; + }; + P.cosine = P.cos = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.d) return new Ctor(NaN); + if (!x.d[0]) return new Ctor(1); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + x = cosine(Ctor, toLessThanHalfPi(Ctor, x)); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true); + }; + P.cubeRoot = P.cbrt = function() { + var e, m, n, r, rep, s, sd, t, t3, t3plusx, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + external = false; + s = x.s * mathpow(x.s * x, 1 / 3); + if (!s || Math.abs(s) == 1 / 0) { + n = digitsToString(x.d); + e = x.e; + if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? "0" : "00"; + s = mathpow(n, 1 / 3); + e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new Ctor(n); + r.s = x.s; + } else { + r = new Ctor(s.toString()); + } + sd = (e = Ctor.precision) + 3; + for (; ; ) { + t = r; + t3 = t.times(t).times(t); + t3plusx = t3.plus(x); + r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1); + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + if (n == "9999" || !rep && n == "4999") { + if (!rep) { + finalise(t, e + 1, 0); + if (t.times(t).times(t).eq(x)) { + r = t; + break; + } + } + sd += 4; + rep = 1; + } else { + if (!+n || !+n.slice(1) && n.charAt(0) == "5") { + finalise(r, e + 1, 1); + m = !r.times(r).times(r).eq(x); + } + break; + } + } + } + external = true; + return finalise(r, e, Ctor.rounding, m); + }; + P.decimalPlaces = P.dp = function() { + var w, d = this.d, n = NaN; + if (d) { + w = d.length - 1; + n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE; + w = d[w]; + if (w) for (; w % 10 == 0; w /= 10) n--; + if (n < 0) n = 0; + } + return n; + }; + P.dividedBy = P.div = function(y) { + return divide(this, new this.constructor(y)); + }; + P.dividedToIntegerBy = P.divToInt = function(y) { + var x = this, Ctor = x.constructor; + return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding); + }; + P.equals = P.eq = function(y) { + return this.cmp(y) === 0; + }; + P.floor = function() { + return finalise(new this.constructor(this), this.e + 1, 3); + }; + P.greaterThan = P.gt = function(y) { + return this.cmp(y) > 0; + }; + P.greaterThanOrEqualTo = P.gte = function(y) { + var k = this.cmp(y); + return k == 1 || k === 0; + }; + P.hyperbolicCosine = P.cosh = function() { + var k, n, pr, rm, len, x = this, Ctor = x.constructor, one = new Ctor(1); + if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN); + if (x.isZero()) return one; + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + n = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + n = "2.3283064365386962890625e-10"; + } + x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true); + var cosh2_x, i = k, d8 = new Ctor(8); + for (; i--; ) { + cosh2_x = x.times(x); + x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8)))); + } + return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + P.hyperbolicSine = P.sinh = function() { + var k, pr, rm, len, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + 4; + Ctor.rounding = 1; + len = x.d.length; + if (len < 3) { + x = taylorSeries(Ctor, 2, x, x, true); + } else { + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x, true); + var sinh2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); + for (; k--; ) { + sinh2_x = x.times(x); + x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20)))); + } + } + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(x, pr, rm, true); + }; + P.hyperbolicTangent = P.tanh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(x.s); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 7; + Ctor.rounding = 1; + return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm); + }; + P.inverseCosine = P.acos = function() { + var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding; + if (k !== -1) { + return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN); + } + if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5); + Ctor.precision = pr + 6; + Ctor.rounding = 1; + x = x.asin(); + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + Ctor.precision = pr; + Ctor.rounding = rm; + return halfPi.minus(x); + }; + P.inverseHyperbolicCosine = P.acosh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN); + if (!x.isFinite()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4; + Ctor.rounding = 1; + external = false; + x = x.times(x).minus(1).sqrt().plus(x); + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + return x.ln(); + }; + P.inverseHyperbolicSine = P.asinh = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite() || x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6; + Ctor.rounding = 1; + external = false; + x = x.times(x).plus(1).sqrt().plus(x); + external = true; + Ctor.precision = pr; + Ctor.rounding = rm; + return x.ln(); + }; + P.inverseHyperbolicTangent = P.atanh = function() { + var pr, rm, wpr, xsd, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN); + pr = Ctor.precision; + rm = Ctor.rounding; + xsd = x.sd(); + if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true); + Ctor.precision = wpr = xsd - x.e; + x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1); + Ctor.precision = pr + 4; + Ctor.rounding = 1; + x = x.ln(); + Ctor.precision = pr; + Ctor.rounding = rm; + return x.times(0.5); + }; + P.inverseSine = P.asin = function() { + var halfPi, k, pr, rm, x = this, Ctor = x.constructor; + if (x.isZero()) return new Ctor(x); + k = x.abs().cmp(1); + pr = Ctor.precision; + rm = Ctor.rounding; + if (k !== -1) { + if (k === 0) { + halfPi = getPi(Ctor, pr + 4, rm).times(0.5); + halfPi.s = x.s; + return halfPi; + } + return new Ctor(NaN); + } + Ctor.precision = pr + 6; + Ctor.rounding = 1; + x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan(); + Ctor.precision = pr; + Ctor.rounding = rm; + return x.times(2); + }; + P.inverseTangent = P.atan = function() { + var i, j, k, n, px, t, r, wpr, x2, x = this, Ctor = x.constructor, pr = Ctor.precision, rm = Ctor.rounding; + if (!x.isFinite()) { + if (!x.s) return new Ctor(NaN); + if (pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.5); + r.s = x.s; + return r; + } + } else if (x.isZero()) { + return new Ctor(x); + } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) { + r = getPi(Ctor, pr + 4, rm).times(0.25); + r.s = x.s; + return r; + } + Ctor.precision = wpr = pr + 10; + Ctor.rounding = 1; + k = Math.min(28, wpr / LOG_BASE + 2 | 0); + for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1)); + external = false; + j = Math.ceil(wpr / LOG_BASE); + n = 1; + x2 = x.times(x); + r = new Ctor(x); + px = x; + for (; i !== -1; ) { + px = px.times(x2); + t = r.minus(px.div(n += 2)); + px = px.times(x2); + r = t.plus(px.div(n += 2)); + if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--; ) ; + } + if (k) r = r.times(2 << k - 1); + external = true; + return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true); + }; + P.isFinite = function() { + return !!this.d; + }; + P.isInteger = P.isInt = function() { + return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2; + }; + P.isNaN = function() { + return !this.s; + }; + P.isNegative = P.isNeg = function() { + return this.s < 0; + }; + P.isPositive = P.isPos = function() { + return this.s > 0; + }; + P.isZero = function() { + return !!this.d && this.d[0] === 0; + }; + P.lessThan = P.lt = function(y) { + return this.cmp(y) < 0; + }; + P.lessThanOrEqualTo = P.lte = function(y) { + return this.cmp(y) < 1; + }; + P.logarithm = P.log = function(base) { + var isBase10, d, denominator, k, inf, num, sd, r, arg = this, Ctor = arg.constructor, pr = Ctor.precision, rm = Ctor.rounding, guard = 5; + if (base == null) { + base = new Ctor(10); + isBase10 = true; + } else { + base = new Ctor(base); + d = base.d; + if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN); + isBase10 = base.eq(10); + } + d = arg.d; + if (arg.s < 0 || !d || !d[0] || arg.eq(1)) { + return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0); + } + if (isBase10) { + if (d.length > 1) { + inf = true; + } else { + for (k = d[0]; k % 10 === 0; ) k /= 10; + inf = k !== 1; + } + } + external = false; + sd = pr + guard; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + if (checkRoundingDigits(r.d, k = pr, rm)) { + do { + sd += 10; + num = naturalLogarithm(arg, sd); + denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd); + r = divide(num, denominator, sd, 1); + if (!inf) { + if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + break; + } + } while (checkRoundingDigits(r.d, k += 10, rm)); + } + external = true; + return finalise(r, pr, rm); + }; + P.minus = P.sub = function(y) { + var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.d) { + if (!x.s || !y.s) y = new Ctor(NaN); + else if (x.d) y.s = -y.s; + else y = new Ctor(y.d || x.s !== y.s ? x : NaN); + return y; + } + if (x.s != y.s) { + y.s = -y.s; + return x.plus(y); + } + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + if (!xd[0] || !yd[0]) { + if (yd[0]) y.s = -y.s; + else if (xd[0]) y = new Ctor(x); + else return new Ctor(rm === 3 ? -0 : 0); + return external ? finalise(y, pr, rm) : y; + } + e = mathfloor(y.e / LOG_BASE); + xe = mathfloor(x.e / LOG_BASE); + xd = xd.slice(); + k = xe - e; + if (k) { + xLTy = k < 0; + if (xLTy) { + d = xd; + k = -k; + len = yd.length; + } else { + d = yd; + e = xe; + len = xd.length; + } + i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2; + if (k > i) { + k = i; + d.length = 1; + } + d.reverse(); + for (i = k; i--; ) d.push(0); + d.reverse(); + } else { + i = xd.length; + len = yd.length; + xLTy = i < len; + if (xLTy) len = i; + for (i = 0; i < len; i++) { + if (xd[i] != yd[i]) { + xLTy = xd[i] < yd[i]; + break; + } + } + k = 0; + } + if (xLTy) { + d = xd; + xd = yd; + yd = d; + y.s = -y.s; + } + len = xd.length; + for (i = yd.length - len; i > 0; --i) xd[len++] = 0; + for (i = yd.length; i > k; ) { + if (xd[--i] < yd[i]) { + for (j = i; j && xd[--j] === 0; ) xd[j] = BASE - 1; + --xd[j]; + xd[i] += BASE; + } + xd[i] -= yd[i]; + } + for (; xd[--len] === 0; ) xd.pop(); + for (; xd[0] === 0; xd.shift()) --e; + if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0); + y.d = xd; + y.e = getBase10Exponent(xd, e); + return external ? finalise(y, pr, rm) : y; + }; + P.modulo = P.mod = function(y) { + var q, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN); + if (!y.d || x.d && !x.d[0]) { + return finalise(new Ctor(x), Ctor.precision, Ctor.rounding); + } + external = false; + if (Ctor.modulo == 9) { + q = divide(x, y.abs(), 0, 3, 1); + q.s *= y.s; + } else { + q = divide(x, y, 0, Ctor.modulo, 1); + } + q = q.times(y); + external = true; + return x.minus(q); + }; + P.naturalExponential = P.exp = function() { + return naturalExponential(this); + }; + P.naturalLogarithm = P.ln = function() { + return naturalLogarithm(this); + }; + P.negated = P.neg = function() { + var x = new this.constructor(this); + x.s = -x.s; + return finalise(x); + }; + P.plus = P.add = function(y) { + var carry, d, e, i, k, len, pr, rm, xd, yd, x = this, Ctor = x.constructor; + y = new Ctor(y); + if (!x.d || !y.d) { + if (!x.s || !y.s) y = new Ctor(NaN); + else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN); + return y; + } + if (x.s != y.s) { + y.s = -y.s; + return x.minus(y); + } + xd = x.d; + yd = y.d; + pr = Ctor.precision; + rm = Ctor.rounding; + if (!xd[0] || !yd[0]) { + if (!yd[0]) y = new Ctor(x); + return external ? finalise(y, pr, rm) : y; + } + k = mathfloor(x.e / LOG_BASE); + e = mathfloor(y.e / LOG_BASE); + xd = xd.slice(); + i = k - e; + if (i) { + if (i < 0) { + d = xd; + i = -i; + len = yd.length; + } else { + d = yd; + e = k; + len = xd.length; + } + k = Math.ceil(pr / LOG_BASE); + len = k > len ? k + 1 : len + 1; + if (i > len) { + i = len; + d.length = 1; + } + d.reverse(); + for (; i--; ) d.push(0); + d.reverse(); + } + len = xd.length; + i = yd.length; + if (len - i < 0) { + i = len; + d = yd; + yd = xd; + xd = d; + } + for (carry = 0; i; ) { + carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0; + xd[i] %= BASE; + } + if (carry) { + xd.unshift(carry); + ++e; + } + for (len = xd.length; xd[--len] == 0; ) xd.pop(); + y.d = xd; + y.e = getBase10Exponent(xd, e); + return external ? finalise(y, pr, rm) : y; + }; + P.precision = P.sd = function(z) { + var k, x = this; + if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z); + if (x.d) { + k = getPrecision(x.d); + if (z && x.e + 1 > k) k = x.e + 1; + } else { + k = NaN; + } + return k; + }; + P.round = function() { + var x = this, Ctor = x.constructor; + return finalise(new Ctor(x), x.e + 1, Ctor.rounding); + }; + P.sine = P.sin = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE; + Ctor.rounding = 1; + x = sine(Ctor, toLessThanHalfPi(Ctor, x)); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true); + }; + P.squareRoot = P.sqrt = function() { + var m, n, sd, r, rep, t, x = this, d = x.d, e = x.e, s = x.s, Ctor = x.constructor; + if (s !== 1 || !d || !d[0]) { + return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0); + } + external = false; + s = Math.sqrt(+x); + if (s == 0 || s == 1 / 0) { + n = digitsToString(d); + if ((n.length + e) % 2 == 0) n += "0"; + s = Math.sqrt(n); + e = mathfloor((e + 1) / 2) - (e < 0 || e % 2); + if (s == 1 / 0) { + n = "5e" + e; + } else { + n = s.toExponential(); + n = n.slice(0, n.indexOf("e") + 1) + e; + } + r = new Ctor(n); + } else { + r = new Ctor(s.toString()); + } + sd = (e = Ctor.precision) + 3; + for (; ; ) { + t = r; + r = t.plus(divide(x, t, sd + 2, 1)).times(0.5); + if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) { + n = n.slice(sd - 3, sd + 1); + if (n == "9999" || !rep && n == "4999") { + if (!rep) { + finalise(t, e + 1, 0); + if (t.times(t).eq(x)) { + r = t; + break; + } + } + sd += 4; + rep = 1; + } else { + if (!+n || !+n.slice(1) && n.charAt(0) == "5") { + finalise(r, e + 1, 1); + m = !r.times(r).eq(x); + } + break; + } + } + } + external = true; + return finalise(r, e, Ctor.rounding, m); + }; + P.tangent = P.tan = function() { + var pr, rm, x = this, Ctor = x.constructor; + if (!x.isFinite()) return new Ctor(NaN); + if (x.isZero()) return new Ctor(x); + pr = Ctor.precision; + rm = Ctor.rounding; + Ctor.precision = pr + 10; + Ctor.rounding = 1; + x = x.sin(); + x.s = 1; + x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0); + Ctor.precision = pr; + Ctor.rounding = rm; + return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true); + }; + P.times = P.mul = function(y) { + var carry, e, i, k, r, rL, t, xdL, ydL, x = this, Ctor = x.constructor, xd = x.d, yd = (y = new Ctor(y)).d; + y.s *= x.s; + if (!xd || !xd[0] || !yd || !yd[0]) { + return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd ? NaN : !xd || !yd ? y.s / 0 : y.s * 0); + } + e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE); + xdL = xd.length; + ydL = yd.length; + if (xdL < ydL) { + r = xd; + xd = yd; + yd = r; + rL = xdL; + xdL = ydL; + ydL = rL; + } + r = []; + rL = xdL + ydL; + for (i = rL; i--; ) r.push(0); + for (i = ydL; --i >= 0; ) { + carry = 0; + for (k = xdL + i; k > i; ) { + t = r[k] + yd[i] * xd[k - i - 1] + carry; + r[k--] = t % BASE | 0; + carry = t / BASE | 0; + } + r[k] = (r[k] + carry) % BASE | 0; + } + for (; !r[--rL]; ) r.pop(); + if (carry) ++e; + else r.shift(); + y.d = r; + y.e = getBase10Exponent(r, e); + return external ? finalise(y, Ctor.precision, Ctor.rounding) : y; + }; + P.toBinary = function(sd, rm) { + return toStringBinary(this, 2, sd, rm); + }; + P.toDecimalPlaces = P.toDP = function(dp, rm) { + var x = this, Ctor = x.constructor; + x = new Ctor(x); + if (dp === void 0) return x; + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + return finalise(x, dp + x.e + 1, rm); + }; + P.toExponential = function(dp, rm) { + var str, x = this, Ctor = x.constructor; + if (dp === void 0) { + str = finiteToString(x, true); + } else { + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = finalise(new Ctor(x), dp + 1, rm); + str = finiteToString(x, true, dp + 1); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toFixed = function(dp, rm) { + var str, y, x = this, Ctor = x.constructor; + if (dp === void 0) { + str = finiteToString(x); + } else { + checkInt32(dp, 0, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + y = finalise(new Ctor(x), dp + x.e + 1, rm); + str = finiteToString(y, false, dp + y.e + 1); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toFraction = function(maxD) { + var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r, x = this, xd = x.d, Ctor = x.constructor; + if (!xd) return new Ctor(x); + n1 = d0 = new Ctor(1); + d1 = n0 = new Ctor(0); + d = new Ctor(d1); + e = d.e = getPrecision(xd) - x.e - 1; + k = e % LOG_BASE; + d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k); + if (maxD == null) { + maxD = e > 0 ? d : n1; + } else { + n = new Ctor(maxD); + if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n); + maxD = n.gt(d) ? e > 0 ? d : n1 : n; + } + external = false; + n = new Ctor(digitsToString(xd)); + pr = Ctor.precision; + Ctor.precision = e = xd.length * LOG_BASE * 2; + for (; ; ) { + q = divide(n, d, 0, 1, 1); + d2 = d0.plus(q.times(d1)); + if (d2.cmp(maxD) == 1) break; + d0 = d1; + d1 = d2; + d2 = n1; + n1 = n0.plus(q.times(d2)); + n0 = d2; + d2 = d; + d = n.minus(q.times(d2)); + n = d2; + } + d2 = divide(maxD.minus(d0), d1, 0, 1, 1); + n0 = n0.plus(d2.times(n1)); + d0 = d0.plus(d2.times(d1)); + n0.s = n1.s = x.s; + r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0]; + Ctor.precision = pr; + external = true; + return r; + }; + P.toHexadecimal = P.toHex = function(sd, rm) { + return toStringBinary(this, 16, sd, rm); + }; + P.toNearest = function(y, rm) { + var x = this, Ctor = x.constructor; + x = new Ctor(x); + if (y == null) { + if (!x.d) return x; + y = new Ctor(1); + rm = Ctor.rounding; + } else { + y = new Ctor(y); + if (rm === void 0) { + rm = Ctor.rounding; + } else { + checkInt32(rm, 0, 8); + } + if (!x.d) return y.s ? x : y; + if (!y.d) { + if (y.s) y.s = x.s; + return y; + } + } + if (y.d[0]) { + external = false; + x = divide(x, y, 0, rm, 1).times(y); + external = true; + finalise(x); + } else { + y.s = x.s; + x = y; + } + return x; + }; + P.toNumber = function() { + return +this; + }; + P.toOctal = function(sd, rm) { + return toStringBinary(this, 8, sd, rm); + }; + P.toPower = P.pow = function(y) { + var e, k, pr, r, rm, s, x = this, Ctor = x.constructor, yn = +(y = new Ctor(y)); + if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn)); + x = new Ctor(x); + if (x.eq(1)) return x; + pr = Ctor.precision; + rm = Ctor.rounding; + if (y.eq(1)) return finalise(x, pr, rm); + e = mathfloor(y.e / LOG_BASE); + if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) { + r = intPow(Ctor, x, k, pr); + return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm); + } + s = x.s; + if (s < 0) { + if (e < y.d.length - 1) return new Ctor(NaN); + if ((y.d[e] & 1) == 0) s = 1; + if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) { + x.s = s; + return x; + } + } + k = mathpow(+x, yn); + e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log("0." + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + "").e; + if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0); + external = false; + Ctor.rounding = x.s = 1; + k = Math.min(12, (e + "").length); + r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr); + if (r.d) { + r = finalise(r, pr + 5, 1); + if (checkRoundingDigits(r.d, pr, rm)) { + e = pr + 10; + r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1); + if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) { + r = finalise(r, pr + 1, 0); + } + } + } + r.s = s; + external = true; + Ctor.rounding = rm; + return finalise(r, pr, rm); + }; + P.toPrecision = function(sd, rm) { + var str, x = this, Ctor = x.constructor; + if (sd === void 0) { + str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + x = finalise(new Ctor(x), sd, rm); + str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd); + } + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.toSignificantDigits = P.toSD = function(sd, rm) { + var x = this, Ctor = x.constructor; + if (sd === void 0) { + sd = Ctor.precision; + rm = Ctor.rounding; + } else { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } + return finalise(new Ctor(x), sd, rm); + }; + P.toString = function() { + var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + return x.isNeg() && !x.isZero() ? "-" + str : str; + }; + P.truncated = P.trunc = function() { + return finalise(new this.constructor(this), this.e + 1, 1); + }; + P.valueOf = P.toJSON = function() { + var x = this, Ctor = x.constructor, str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos); + return x.isNeg() ? "-" + str : str; + }; + function digitsToString(d) { + var i, k, ws, indexOfLastWord = d.length - 1, str = "", w = d[0]; + if (indexOfLastWord > 0) { + str += w; + for (i = 1; i < indexOfLastWord; i++) { + ws = d[i] + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + str += ws; + } + w = d[i]; + ws = w + ""; + k = LOG_BASE - ws.length; + if (k) str += getZeroString(k); + } else if (w === 0) { + return "0"; + } + for (; w % 10 === 0; ) w /= 10; + return str + w; + } + function checkInt32(i, min2, max2) { + if (i !== ~~i || i < min2 || i > max2) { + throw Error(invalidArgument + i); + } + } + function checkRoundingDigits(d, i, rm, repeating) { + var di, k, r, rd; + for (k = d[0]; k >= 10; k /= 10) --i; + if (--i < 0) { + i += LOG_BASE; + di = 0; + } else { + di = Math.ceil((i + 1) / LOG_BASE); + i %= LOG_BASE; + } + k = mathpow(10, LOG_BASE - i); + rd = d[di] % k | 0; + if (repeating == null) { + if (i < 3) { + if (i == 0) rd = rd / 100 | 0; + else if (i == 1) rd = rd / 10 | 0; + r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 5e4 || rd == 0; + } else { + r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 || (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0; + } + } else { + if (i < 4) { + if (i == 0) rd = rd / 1e3 | 0; + else if (i == 1) rd = rd / 100 | 0; + else if (i == 2) rd = rd / 10 | 0; + r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999; + } else { + r = ((repeating || rm < 4) && rd + 1 == k || !repeating && rm > 3 && rd + 1 == k / 2) && (d[di + 1] / k / 1e3 | 0) == mathpow(10, i - 3) - 1; + } + } + return r; + } + function convertBase(str, baseIn, baseOut) { + var j, arr = [0], arrL, i = 0, strL = str.length; + for (; i < strL; ) { + for (arrL = arr.length; arrL--; ) arr[arrL] *= baseIn; + arr[0] += NUMERALS.indexOf(str.charAt(i++)); + for (j = 0; j < arr.length; j++) { + if (arr[j] > baseOut - 1) { + if (arr[j + 1] === void 0) arr[j + 1] = 0; + arr[j + 1] += arr[j] / baseOut | 0; + arr[j] %= baseOut; + } + } + } + return arr.reverse(); + } + function cosine(Ctor, x) { + var k, len, y; + if (x.isZero()) return x; + len = x.d.length; + if (len < 32) { + k = Math.ceil(len / 3); + y = (1 / tinyPow(4, k)).toString(); + } else { + k = 16; + y = "2.3283064365386962890625e-10"; + } + Ctor.precision += k; + x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1)); + for (var i = k; i--; ) { + var cos2x = x.times(x); + x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1); + } + Ctor.precision -= k; + return x; + } + var divide = /* @__PURE__ */ function() { + function multiplyInteger(x, k, base) { + var temp, carry = 0, i = x.length; + for (x = x.slice(); i--; ) { + temp = x[i] * k + carry; + x[i] = temp % base | 0; + carry = temp / base | 0; + } + if (carry) x.unshift(carry); + return x; + } + function compare(a, b, aL, bL) { + var i, r; + if (aL != bL) { + r = aL > bL ? 1 : -1; + } else { + for (i = r = 0; i < aL; i++) { + if (a[i] != b[i]) { + r = a[i] > b[i] ? 1 : -1; + break; + } + } + } + return r; + } + function subtract(a, b, aL, base) { + var i = 0; + for (; aL--; ) { + a[aL] -= i; + i = a[aL] < b[aL] ? 1 : 0; + a[aL] = i * base + a[aL] - b[aL]; + } + for (; !a[0] && a.length > 1; ) a.shift(); + } + return function(x, y, pr, rm, dp, base) { + var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0, yL, yz, Ctor = x.constructor, sign2 = x.s == y.s ? 1 : -1, xd = x.d, yd = y.d; + if (!xd || !xd[0] || !yd || !yd[0]) { + return new Ctor( + // Return NaN if either NaN, or both Infinity or 0. + !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN : ( + // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0. + xd && xd[0] == 0 || !yd ? sign2 * 0 : sign2 / 0 + ) + ); + } + if (base) { + logBase = 1; + e = x.e - y.e; + } else { + base = BASE; + logBase = LOG_BASE; + e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase); + } + yL = yd.length; + xL = xd.length; + q = new Ctor(sign2); + qd = q.d = []; + for (i = 0; yd[i] == (xd[i] || 0); i++) ; + if (yd[i] > (xd[i] || 0)) e--; + if (pr == null) { + sd = pr = Ctor.precision; + rm = Ctor.rounding; + } else if (dp) { + sd = pr + (x.e - y.e) + 1; + } else { + sd = pr; + } + if (sd < 0) { + qd.push(1); + more = true; + } else { + sd = sd / logBase + 2 | 0; + i = 0; + if (yL == 1) { + k = 0; + yd = yd[0]; + sd++; + for (; (i < xL || k) && sd--; i++) { + t = k * base + (xd[i] || 0); + qd[i] = t / yd | 0; + k = t % yd | 0; + } + more = k || i < xL; + } else { + k = base / (yd[0] + 1) | 0; + if (k > 1) { + yd = multiplyInteger(yd, k, base); + xd = multiplyInteger(xd, k, base); + yL = yd.length; + xL = xd.length; + } + xi = yL; + rem = xd.slice(0, yL); + remL = rem.length; + for (; remL < yL; ) rem[remL++] = 0; + yz = yd.slice(); + yz.unshift(0); + yd0 = yd[0]; + if (yd[1] >= base / 2) ++yd0; + do { + k = 0; + cmp = compare(yd, rem, yL, remL); + if (cmp < 0) { + rem0 = rem[0]; + if (yL != remL) rem0 = rem0 * base + (rem[1] || 0); + k = rem0 / yd0 | 0; + if (k > 1) { + if (k >= base) k = base - 1; + prod = multiplyInteger(yd, k, base); + prodL = prod.length; + remL = rem.length; + cmp = compare(prod, rem, prodL, remL); + if (cmp == 1) { + k--; + subtract(prod, yL < prodL ? yz : yd, prodL, base); + } + } else { + if (k == 0) cmp = k = 1; + prod = yd.slice(); + } + prodL = prod.length; + if (prodL < remL) prod.unshift(0); + subtract(rem, prod, remL, base); + if (cmp == -1) { + remL = rem.length; + cmp = compare(yd, rem, yL, remL); + if (cmp < 1) { + k++; + subtract(rem, yL < remL ? yz : yd, remL, base); + } + } + remL = rem.length; + } else if (cmp === 0) { + k++; + rem = [0]; + } + qd[i++] = k; + if (cmp && rem[0]) { + rem[remL++] = xd[xi] || 0; + } else { + rem = [xd[xi]]; + remL = 1; + } + } while ((xi++ < xL || rem[0] !== void 0) && sd--); + more = rem[0] !== void 0; + } + if (!qd[0]) qd.shift(); + } + if (logBase == 1) { + q.e = e; + inexact = more; + } else { + for (i = 1, k = qd[0]; k >= 10; k /= 10) i++; + q.e = i + e * logBase - 1; + finalise(q, dp ? pr + q.e + 1 : pr, rm, more); + } + return q; + }; + }(); + function finalise(x, sd, rm, isTruncated) { + var digits, i, j, k, rd, roundUp, w, xd, xdi, Ctor = x.constructor; + out: if (sd != null) { + xd = x.d; + if (!xd) return x; + for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++; + i = sd - digits; + if (i < 0) { + i += LOG_BASE; + j = sd; + w = xd[xdi = 0]; + rd = w / mathpow(10, digits - j - 1) % 10 | 0; + } else { + xdi = Math.ceil((i + 1) / LOG_BASE); + k = xd.length; + if (xdi >= k) { + if (isTruncated) { + for (; k++ <= xdi; ) xd.push(0); + w = rd = 0; + digits = 1; + i %= LOG_BASE; + j = i - LOG_BASE + 1; + } else { + break out; + } + } else { + w = k = xd[xdi]; + for (digits = 1; k >= 10; k /= 10) digits++; + i %= LOG_BASE; + j = i - LOG_BASE + digits; + rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0; + } + } + isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1)); + roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && // Check whether the digit to the left of the rounding digit is odd. + (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7)); + if (sd < 1 || !xd[0]) { + xd.length = 0; + if (roundUp) { + sd -= x.e + 1; + xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE); + x.e = -sd || 0; + } else { + xd[0] = x.e = 0; + } + return x; + } + if (i == 0) { + xd.length = xdi; + k = 1; + xdi--; + } else { + xd.length = xdi + 1; + k = mathpow(10, LOG_BASE - i); + xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0; + } + if (roundUp) { + for (; ; ) { + if (xdi == 0) { + for (i = 1, j = xd[0]; j >= 10; j /= 10) i++; + j = xd[0] += k; + for (k = 1; j >= 10; j /= 10) k++; + if (i != k) { + x.e++; + if (xd[0] == BASE) xd[0] = 1; + } + break; + } else { + xd[xdi] += k; + if (xd[xdi] != BASE) break; + xd[xdi--] = 0; + k = 1; + } + } + } + for (i = xd.length; xd[--i] === 0; ) xd.pop(); + } + if (external) { + if (x.e > Ctor.maxE) { + x.d = null; + x.e = NaN; + } else if (x.e < Ctor.minE) { + x.e = 0; + x.d = [0]; + } + } + return x; + } + function finiteToString(x, isExp, sd) { + if (!x.isFinite()) return nonFiniteToString(x); + var k, e = x.e, str = digitsToString(x.d), len = str.length; + if (isExp) { + if (sd && (k = sd - len) > 0) { + str = str.charAt(0) + "." + str.slice(1) + getZeroString(k); + } else if (len > 1) { + str = str.charAt(0) + "." + str.slice(1); + } + str = str + (x.e < 0 ? "e" : "e+") + x.e; + } else if (e < 0) { + str = "0." + getZeroString(-e - 1) + str; + if (sd && (k = sd - len) > 0) str += getZeroString(k); + } else if (e >= len) { + str += getZeroString(e + 1 - len); + if (sd && (k = sd - e - 1) > 0) str = str + "." + getZeroString(k); + } else { + if ((k = e + 1) < len) str = str.slice(0, k) + "." + str.slice(k); + if (sd && (k = sd - len) > 0) { + if (e + 1 === len) str += "."; + str += getZeroString(k); + } + } + return str; + } + function getBase10Exponent(digits, e) { + var w = digits[0]; + for (e *= LOG_BASE; w >= 10; w /= 10) e++; + return e; + } + function getLn10(Ctor, sd, pr) { + if (sd > LN10_PRECISION) { + external = true; + if (pr) Ctor.precision = pr; + throw Error(precisionLimitExceeded); + } + return finalise(new Ctor(LN10), sd, 1, true); + } + function getPi(Ctor, sd, rm) { + if (sd > PI_PRECISION) throw Error(precisionLimitExceeded); + return finalise(new Ctor(PI), sd, rm, true); + } + function getPrecision(digits) { + var w = digits.length - 1, len = w * LOG_BASE + 1; + w = digits[w]; + if (w) { + for (; w % 10 == 0; w /= 10) len--; + for (w = digits[0]; w >= 10; w /= 10) len++; + } + return len; + } + function getZeroString(k) { + var zs = ""; + for (; k--; ) zs += "0"; + return zs; + } + function intPow(Ctor, x, n, pr) { + var isTruncated, r = new Ctor(1), k = Math.ceil(pr / LOG_BASE + 4); + external = false; + for (; ; ) { + if (n % 2) { + r = r.times(x); + if (truncate(r.d, k)) isTruncated = true; + } + n = mathfloor(n / 2); + if (n === 0) { + n = r.d.length - 1; + if (isTruncated && r.d[n] === 0) ++r.d[n]; + break; + } + x = x.times(x); + truncate(x.d, k); + } + external = true; + return r; + } + function isOdd(n) { + return n.d[n.d.length - 1] & 1; + } + function maxOrMin(Ctor, args, ltgt) { + var y, x = new Ctor(args[0]), i = 0; + for (; ++i < args.length; ) { + y = new Ctor(args[i]); + if (!y.s) { + x = y; + break; + } else if (x[ltgt](y)) { + x = y; + } + } + return x; + } + function naturalExponential(x, sd) { + var denominator, guard, j, pow2, sum2, t, wpr, rep = 0, i = 0, k = 0, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; + if (!x.d || !x.d[0] || x.e > 17) { + return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0); + } + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + t = new Ctor(0.03125); + while (x.e > -2) { + x = x.times(t); + k += 5; + } + guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0; + wpr += guard; + denominator = pow2 = sum2 = new Ctor(1); + Ctor.precision = wpr; + for (; ; ) { + pow2 = finalise(pow2.times(x), wpr, 1); + denominator = denominator.times(++i); + t = sum2.plus(divide(pow2, denominator, wpr, 1)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { + j = k; + while (j--) sum2 = finalise(sum2.times(sum2), wpr, 1); + if (sd == null) { + if (rep < 3 && checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += 10; + denominator = pow2 = t = new Ctor(1); + i = 0; + rep++; + } else { + return finalise(sum2, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum2; + } + } + sum2 = t; + } + } + function naturalLogarithm(y, sd) { + var c, c0, denominator, e, numerator, rep, sum2, t, wpr, x1, x2, n = 1, guard = 10, x = y, xd = x.d, Ctor = x.constructor, rm = Ctor.rounding, pr = Ctor.precision; + if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) { + return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x); + } + if (sd == null) { + external = false; + wpr = pr; + } else { + wpr = sd; + } + Ctor.precision = wpr += guard; + c = digitsToString(xd); + c0 = c.charAt(0); + if (Math.abs(e = x.e) < 15e14) { + while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) { + x = x.times(y); + c = digitsToString(x.d); + c0 = c.charAt(0); + n++; + } + e = x.e; + if (c0 > 1) { + x = new Ctor("0." + c); + e++; + } else { + x = new Ctor(c0 + "." + c.slice(1)); + } + } else { + t = getLn10(Ctor, wpr + 2, pr).times(e + ""); + x = naturalLogarithm(new Ctor(c0 + "." + c.slice(1)), wpr - guard).plus(t); + Ctor.precision = pr; + return sd == null ? finalise(x, pr, rm, external = true) : x; + } + x1 = x; + sum2 = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = 3; + for (; ; ) { + numerator = finalise(numerator.times(x2), wpr, 1); + t = sum2.plus(divide(numerator, new Ctor(denominator), wpr, 1)); + if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum2.d).slice(0, wpr)) { + sum2 = sum2.times(2); + if (e !== 0) sum2 = sum2.plus(getLn10(Ctor, wpr + 2, pr).times(e + "")); + sum2 = divide(sum2, new Ctor(n), wpr, 1); + if (sd == null) { + if (checkRoundingDigits(sum2.d, wpr - guard, rm, rep)) { + Ctor.precision = wpr += guard; + t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1); + x2 = finalise(x.times(x), wpr, 1); + denominator = rep = 1; + } else { + return finalise(sum2, Ctor.precision = pr, rm, external = true); + } + } else { + Ctor.precision = pr; + return sum2; + } + } + sum2 = t; + denominator += 2; + } + } + function nonFiniteToString(x) { + return String(x.s * x.s / 0); + } + function parseDecimal(x, str) { + var e, i, len; + if ((e = str.indexOf(".")) > -1) str = str.replace(".", ""); + if ((i = str.search(/e/i)) > 0) { + if (e < 0) e = i; + e += +str.slice(i + 1); + str = str.substring(0, i); + } else if (e < 0) { + e = str.length; + } + for (i = 0; str.charCodeAt(i) === 48; i++) ; + for (len = str.length; str.charCodeAt(len - 1) === 48; --len) ; + str = str.slice(i, len); + if (str) { + len -= i; + x.e = e = e - i - 1; + x.d = []; + i = (e + 1) % LOG_BASE; + if (e < 0) i += LOG_BASE; + if (i < len) { + if (i) x.d.push(+str.slice(0, i)); + for (len -= LOG_BASE; i < len; ) x.d.push(+str.slice(i, i += LOG_BASE)); + str = str.slice(i); + i = LOG_BASE - str.length; + } else { + i -= len; + } + for (; i--; ) str += "0"; + x.d.push(+str); + if (external) { + if (x.e > x.constructor.maxE) { + x.d = null; + x.e = NaN; + } else if (x.e < x.constructor.minE) { + x.e = 0; + x.d = [0]; + } + } + } else { + x.e = 0; + x.d = [0]; + } + return x; + } + function parseOther(x, str) { + var base, Ctor, divisor, i, isFloat, len, p, xd, xe; + if (str.indexOf("_") > -1) { + str = str.replace(/(\d)_(?=\d)/g, "$1"); + if (isDecimal.test(str)) return parseDecimal(x, str); + } else if (str === "Infinity" || str === "NaN") { + if (!+str) x.s = NaN; + x.e = NaN; + x.d = null; + return x; + } + if (isHex.test(str)) { + base = 16; + str = str.toLowerCase(); + } else if (isBinary.test(str)) { + base = 2; + } else if (isOctal.test(str)) { + base = 8; + } else { + throw Error(invalidArgument + str); + } + i = str.search(/p/i); + if (i > 0) { + p = +str.slice(i + 1); + str = str.substring(2, i); + } else { + str = str.slice(2); + } + i = str.indexOf("."); + isFloat = i >= 0; + Ctor = x.constructor; + if (isFloat) { + str = str.replace(".", ""); + len = str.length; + i = len - i; + divisor = intPow(Ctor, new Ctor(base), i, i * 2); + } + xd = convertBase(str, base, BASE); + xe = xd.length - 1; + for (i = xe; xd[i] === 0; --i) xd.pop(); + if (i < 0) return new Ctor(x.s * 0); + x.e = getBase10Exponent(xd, xe); + x.d = xd; + external = false; + if (isFloat) x = divide(x, divisor, len * 4); + if (p) x = x.times(Math.abs(p) < 54 ? mathpow(2, p) : Decimal2.pow(2, p)); + external = true; + return x; + } + function sine(Ctor, x) { + var k, len = x.d.length; + if (len < 3) { + return x.isZero() ? x : taylorSeries(Ctor, 2, x, x); + } + k = 1.4 * Math.sqrt(len); + k = k > 16 ? 16 : k | 0; + x = x.times(1 / tinyPow(5, k)); + x = taylorSeries(Ctor, 2, x, x); + var sin2_x, d5 = new Ctor(5), d16 = new Ctor(16), d20 = new Ctor(20); + for (; k--; ) { + sin2_x = x.times(x); + x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20)))); + } + return x; + } + function taylorSeries(Ctor, n, x, y, isHyperbolic) { + var j, t, u, x2, i = 1, pr = Ctor.precision, k = Math.ceil(pr / LOG_BASE); + external = false; + x2 = x.times(x); + u = new Ctor(y); + for (; ; ) { + t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1); + u = isHyperbolic ? y.plus(t) : y.minus(t); + y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1); + t = u.plus(y); + if (t.d[k] !== void 0) { + for (j = k; t.d[j] === u.d[j] && j--; ) ; + if (j == -1) break; + } + j = u; + u = y; + y = t; + t = j; + i++; + } + external = true; + t.d.length = k + 1; + return t; + } + function tinyPow(b, e) { + var n = b; + while (--e) n *= b; + return n; + } + function toLessThanHalfPi(Ctor, x) { + var t, isNeg = x.s < 0, pi = getPi(Ctor, Ctor.precision, 1), halfPi = pi.times(0.5); + x = x.abs(); + if (x.lte(halfPi)) { + quadrant = isNeg ? 4 : 1; + return x; + } + t = x.divToInt(pi); + if (t.isZero()) { + quadrant = isNeg ? 3 : 2; + } else { + x = x.minus(t.times(pi)); + if (x.lte(halfPi)) { + quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1; + return x; + } + quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2; + } + return x.minus(pi).abs(); + } + function toStringBinary(x, baseOut, sd, rm) { + var base, e, i, k, len, roundUp, str, xd, y, Ctor = x.constructor, isExp = sd !== void 0; + if (isExp) { + checkInt32(sd, 1, MAX_DIGITS); + if (rm === void 0) rm = Ctor.rounding; + else checkInt32(rm, 0, 8); + } else { + sd = Ctor.precision; + rm = Ctor.rounding; + } + if (!x.isFinite()) { + str = nonFiniteToString(x); + } else { + str = finiteToString(x); + i = str.indexOf("."); + if (isExp) { + base = 2; + if (baseOut == 16) { + sd = sd * 4 - 3; + } else if (baseOut == 8) { + sd = sd * 3 - 2; + } + } else { + base = baseOut; + } + if (i >= 0) { + str = str.replace(".", ""); + y = new Ctor(1); + y.e = str.length - i; + y.d = convertBase(finiteToString(y), 10, base); + y.e = y.d.length; + } + xd = convertBase(str, 10, base); + e = len = xd.length; + for (; xd[--len] == 0; ) xd.pop(); + if (!xd[0]) { + str = isExp ? "0p+0" : "0"; + } else { + if (i < 0) { + e--; + } else { + x = new Ctor(x); + x.d = xd; + x.e = e; + x = divide(x, y, sd, rm, 0, base); + xd = x.d; + e = x.e; + roundUp = inexact; + } + i = xd[sd]; + k = base / 2; + roundUp = roundUp || xd[sd + 1] !== void 0; + roundUp = rm < 4 ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2)) : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 || rm === (x.s < 0 ? 8 : 7)); + xd.length = sd; + if (roundUp) { + for (; ++xd[--sd] > base - 1; ) { + xd[sd] = 0; + if (!sd) { + ++e; + xd.unshift(1); + } + } + } + for (len = xd.length; !xd[len - 1]; --len) ; + for (i = 0, str = ""; i < len; i++) str += NUMERALS.charAt(xd[i]); + if (isExp) { + if (len > 1) { + if (baseOut == 16 || baseOut == 8) { + i = baseOut == 16 ? 4 : 3; + for (--len; len % i; len++) str += "0"; + xd = convertBase(str, base, baseOut); + for (len = xd.length; !xd[len - 1]; --len) ; + for (i = 1, str = "1."; i < len; i++) str += NUMERALS.charAt(xd[i]); + } else { + str = str.charAt(0) + "." + str.slice(1); + } + } + str = str + (e < 0 ? "p" : "p+") + e; + } else if (e < 0) { + for (; ++e; ) str = "0" + str; + str = "0." + str; + } else { + if (++e > len) for (e -= len; e--; ) str += "0"; + else if (e < len) str = str.slice(0, e) + "." + str.slice(e); + } + } + str = (baseOut == 16 ? "0x" : baseOut == 2 ? "0b" : baseOut == 8 ? "0o" : "") + str; + } + return x.s < 0 ? "-" + str : str; + } + function truncate(arr, len) { + if (arr.length > len) { + arr.length = len; + return true; + } + } + function abs(x) { + return new this(x).abs(); + } + function acos(x) { + return new this(x).acos(); + } + function acosh(x) { + return new this(x).acosh(); + } + function add(x, y) { + return new this(x).plus(y); + } + function asin(x) { + return new this(x).asin(); + } + function asinh(x) { + return new this(x).asinh(); + } + function atan(x) { + return new this(x).atan(); + } + function atanh(x) { + return new this(x).atanh(); + } + function atan2(y, x) { + y = new this(y); + x = new this(x); + var r, pr = this.precision, rm = this.rounding, wpr = pr + 4; + if (!y.s || !x.s) { + r = new this(NaN); + } else if (!y.d && !x.d) { + r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75); + r.s = y.s; + } else if (!x.d || y.isZero()) { + r = x.s < 0 ? getPi(this, pr, rm) : new this(0); + r.s = y.s; + } else if (!y.d || x.isZero()) { + r = getPi(this, wpr, 1).times(0.5); + r.s = y.s; + } else if (x.s < 0) { + this.precision = wpr; + this.rounding = 1; + r = this.atan(divide(y, x, wpr, 1)); + x = getPi(this, wpr, 1); + this.precision = pr; + this.rounding = rm; + r = y.s < 0 ? r.minus(x) : r.plus(x); + } else { + r = this.atan(divide(y, x, wpr, 1)); + } + return r; + } + function cbrt(x) { + return new this(x).cbrt(); + } + function ceil(x) { + return finalise(x = new this(x), x.e + 1, 2); + } + function clamp(x, min2, max2) { + return new this(x).clamp(min2, max2); + } + function config(obj) { + if (!obj || typeof obj !== "object") throw Error(decimalError + "Object expected"); + var i, p, v, useDefaults = obj.defaults === true, ps = [ + "precision", + 1, + MAX_DIGITS, + "rounding", + 0, + 8, + "toExpNeg", + -EXP_LIMIT, + 0, + "toExpPos", + 0, + EXP_LIMIT, + "maxE", + 0, + EXP_LIMIT, + "minE", + -EXP_LIMIT, + 0, + "modulo", + 0, + 9 + ]; + for (i = 0; i < ps.length; i += 3) { + if (p = ps[i], useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v; + else throw Error(invalidArgument + p + ": " + v); + } + } + if (p = "crypto", useDefaults) this[p] = DEFAULTS[p]; + if ((v = obj[p]) !== void 0) { + if (v === true || v === false || v === 0 || v === 1) { + if (v) { + if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) { + this[p] = true; + } else { + throw Error(cryptoUnavailable); + } + } else { + this[p] = false; + } + } else { + throw Error(invalidArgument + p + ": " + v); + } + } + return this; + } + function cos(x) { + return new this(x).cos(); + } + function cosh(x) { + return new this(x).cosh(); + } + function clone(obj) { + var i, p, ps; + function Decimal3(v) { + var e, i2, t, x = this; + if (!(x instanceof Decimal3)) return new Decimal3(v); + x.constructor = Decimal3; + if (isDecimalInstance(v)) { + x.s = v.s; + if (external) { + if (!v.d || v.e > Decimal3.maxE) { + x.e = NaN; + x.d = null; + } else if (v.e < Decimal3.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = v.e; + x.d = v.d.slice(); + } + } else { + x.e = v.e; + x.d = v.d ? v.d.slice() : v.d; + } + return; + } + t = typeof v; + if (t === "number") { + if (v === 0) { + x.s = 1 / v < 0 ? -1 : 1; + x.e = 0; + x.d = [0]; + return; + } + if (v < 0) { + v = -v; + x.s = -1; + } else { + x.s = 1; + } + if (v === ~~v && v < 1e7) { + for (e = 0, i2 = v; i2 >= 10; i2 /= 10) e++; + if (external) { + if (e > Decimal3.maxE) { + x.e = NaN; + x.d = null; + } else if (e < Decimal3.minE) { + x.e = 0; + x.d = [0]; + } else { + x.e = e; + x.d = [v]; + } + } else { + x.e = e; + x.d = [v]; + } + return; + } else if (v * 0 !== 0) { + if (!v) x.s = NaN; + x.e = NaN; + x.d = null; + return; + } + return parseDecimal(x, v.toString()); + } else if (t !== "string") { + throw Error(invalidArgument + v); + } + if ((i2 = v.charCodeAt(0)) === 45) { + v = v.slice(1); + x.s = -1; + } else { + if (i2 === 43) v = v.slice(1); + x.s = 1; + } + return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v); + } + Decimal3.prototype = P; + Decimal3.ROUND_UP = 0; + Decimal3.ROUND_DOWN = 1; + Decimal3.ROUND_CEIL = 2; + Decimal3.ROUND_FLOOR = 3; + Decimal3.ROUND_HALF_UP = 4; + Decimal3.ROUND_HALF_DOWN = 5; + Decimal3.ROUND_HALF_EVEN = 6; + Decimal3.ROUND_HALF_CEIL = 7; + Decimal3.ROUND_HALF_FLOOR = 8; + Decimal3.EUCLID = 9; + Decimal3.config = Decimal3.set = config; + Decimal3.clone = clone; + Decimal3.isDecimal = isDecimalInstance; + Decimal3.abs = abs; + Decimal3.acos = acos; + Decimal3.acosh = acosh; + Decimal3.add = add; + Decimal3.asin = asin; + Decimal3.asinh = asinh; + Decimal3.atan = atan; + Decimal3.atanh = atanh; + Decimal3.atan2 = atan2; + Decimal3.cbrt = cbrt; + Decimal3.ceil = ceil; + Decimal3.clamp = clamp; + Decimal3.cos = cos; + Decimal3.cosh = cosh; + Decimal3.div = div; + Decimal3.exp = exp; + Decimal3.floor = floor; + Decimal3.hypot = hypot; + Decimal3.ln = ln; + Decimal3.log = log; + Decimal3.log10 = log10; + Decimal3.log2 = log2; + Decimal3.max = max; + Decimal3.min = min; + Decimal3.mod = mod; + Decimal3.mul = mul; + Decimal3.pow = pow; + Decimal3.random = random; + Decimal3.round = round; + Decimal3.sign = sign; + Decimal3.sin = sin; + Decimal3.sinh = sinh; + Decimal3.sqrt = sqrt; + Decimal3.sub = sub; + Decimal3.sum = sum; + Decimal3.tan = tan; + Decimal3.tanh = tanh; + Decimal3.trunc = trunc; + if (obj === void 0) obj = {}; + if (obj) { + if (obj.defaults !== true) { + ps = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"]; + for (i = 0; i < ps.length; ) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p]; + } + } + Decimal3.config(obj); + return Decimal3; + } + function div(x, y) { + return new this(x).div(y); + } + function exp(x) { + return new this(x).exp(); + } + function floor(x) { + return finalise(x = new this(x), x.e + 1, 3); + } + function hypot() { + var i, n, t = new this(0); + external = false; + for (i = 0; i < arguments.length; ) { + n = new this(arguments[i++]); + if (!n.d) { + if (n.s) { + external = true; + return new this(1 / 0); + } + t = n; + } else if (t.d) { + t = t.plus(n.times(n)); + } + } + external = true; + return t.sqrt(); + } + function isDecimalInstance(obj) { + return obj instanceof Decimal2 || obj && obj.toStringTag === tag || false; + } + function ln(x) { + return new this(x).ln(); + } + function log(x, y) { + return new this(x).log(y); + } + function log2(x) { + return new this(x).log(2); + } + function log10(x) { + return new this(x).log(10); + } + function max() { + return maxOrMin(this, arguments, "lt"); + } + function min() { + return maxOrMin(this, arguments, "gt"); + } + function mod(x, y) { + return new this(x).mod(y); + } + function mul(x, y) { + return new this(x).mul(y); + } + function pow(x, y) { + return new this(x).pow(y); + } + function random(sd) { + var d, e, k, n, i = 0, r = new this(1), rd = []; + if (sd === void 0) sd = this.precision; + else checkInt32(sd, 1, MAX_DIGITS); + k = Math.ceil(sd / LOG_BASE); + if (!this.crypto) { + for (; i < k; ) rd[i++] = Math.random() * 1e7 | 0; + } else if (crypto.getRandomValues) { + d = crypto.getRandomValues(new Uint32Array(k)); + for (; i < k; ) { + n = d[i]; + if (n >= 429e7) { + d[i] = crypto.getRandomValues(new Uint32Array(1))[0]; + } else { + rd[i++] = n % 1e7; + } + } + } else if (crypto.randomBytes) { + d = crypto.randomBytes(k *= 4); + for (; i < k; ) { + n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 127) << 24); + if (n >= 214e7) { + crypto.randomBytes(4).copy(d, i); + } else { + rd.push(n % 1e7); + i += 4; + } + } + i = k / 4; + } else { + throw Error(cryptoUnavailable); + } + k = rd[--i]; + sd %= LOG_BASE; + if (k && sd) { + n = mathpow(10, LOG_BASE - sd); + rd[i] = (k / n | 0) * n; + } + for (; rd[i] === 0; i--) rd.pop(); + if (i < 0) { + e = 0; + rd = [0]; + } else { + e = -1; + for (; rd[0] === 0; e -= LOG_BASE) rd.shift(); + for (k = 1, n = rd[0]; n >= 10; n /= 10) k++; + if (k < LOG_BASE) e -= LOG_BASE - k; + } + r.e = e; + r.d = rd; + return r; + } + function round(x) { + return finalise(x = new this(x), x.e + 1, this.rounding); + } + function sign(x) { + x = new this(x); + return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN; + } + function sin(x) { + return new this(x).sin(); + } + function sinh(x) { + return new this(x).sinh(); + } + function sqrt(x) { + return new this(x).sqrt(); + } + function sub(x, y) { + return new this(x).sub(y); + } + function sum() { + var i = 0, args = arguments, x = new this(args[i]); + external = false; + for (; x.s && ++i < args.length; ) x = x.plus(args[i]); + external = true; + return finalise(x, this.precision, this.rounding); + } + function tan(x) { + return new this(x).tan(); + } + function tanh(x) { + return new this(x).tanh(); + } + function trunc(x) { + return finalise(x = new this(x), x.e + 1, 1); + } + Decimal2 = clone(DEFAULTS); + Decimal2.prototype.constructor = Decimal2; + Decimal2["default"] = Decimal2.Decimal = Decimal2; + LN10 = new Decimal2(LN10); + PI = new Decimal2(PI); + if (typeof define == "function" && define.amd) { + define(function() { + return Decimal2; + }); + } else if (typeof module2 != "undefined" && module2.exports) { + if (typeof Symbol == "function" && typeof Symbol.iterator == "symbol") { + P[Symbol["for"]("nodejs.util.inspect.custom")] = P.toString; + P[Symbol.toStringTag] = "Decimal"; + } + module2.exports = Decimal2; + } else { + if (!globalScope) { + globalScope = typeof self != "undefined" && self && self.self == self ? self : window; + } + noConflict = globalScope.Decimal; + Decimal2.noConflict = function() { + globalScope.Decimal = noConflict; + return Decimal2; + }; + globalScope.Decimal = Decimal2; + } + })(exports2); + } +}); + +// node_modules/bn.js/lib/bn.js +var require_bn = __commonJS({ + "node_modules/bn.js/lib/bn.js"(exports2, module2) { + (function(module3, exports3) { + "use strict"; + function assert(val, msg) { + if (!val) throw new Error(msg || "Assertion failed"); + } + function inherits(ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + function BN(number, base, endian) { + if (BN.isBN(number)) { + return number; + } + this.negative = 0; + this.words = null; + this.length = 0; + 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 module3 === "object") { + module3.exports = BN; + } else { + exports3.BN = BN; + } + BN.BN = BN; + BN.wordSize = 26; + var Buffer2; + try { + if (typeof window !== "undefined" && typeof window.Buffer !== "undefined") { + Buffer2 = window.Buffer; + } else { + Buffer2 = require("buffer").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 < 67108864) { + this.words = [number & 67108863]; + this.length = 1; + } else if (number < 4503599627370496) { + this.words = [ + number & 67108863, + number / 67108864 & 67108863 + ]; + this.length = 2; + } else { + assert(number < 9007199254740992); + this.words = [ + number & 67108863, + number / 67108864 & 67108863, + 1 + ]; + this.length = 3; + } + if (endian !== "le") return; + this._initArray(this.toArray(), base, endian); + }; + BN.prototype._initArray = function _initArray(number, base, endian) { + 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 & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + 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 & 67108863; + this.words[j + 1] = w >>> 26 - off & 67108863; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + function parseHex4Bits(string, index) { + var c = string.charCodeAt(index); + if (c >= 65 && c <= 70) { + return c - 55; + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + return c - 48 & 15; + } + } + 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) { + 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 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 & 67108863; + 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 & 67108863; + 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; + if (c >= 49) { + r += c - 49 + 10; + } else if (c >= 17) { + r += c - 17 + 10; + } else { + r += c; + } + } + return r; + } + BN.prototype._parseBase = function _parseBase(number, base, start) { + this.words = [0]; + this.length = 1; + for (var limbLen = 0, limbPow = 1; limbPow <= 67108863; 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 < 67108864) { + 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 < 67108864) { + 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; + }; + 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() { + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + BN.prototype.inspect = function inspect() { + return (this.red ? ""; + }; + 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, + 1e7, + 19487171, + 35831808, + 62748517, + 7529536, + 11390625, + 16777216, + 24137569, + 34012224, + 47045881, + 64e6, + 4084101, + 5153632, + 6436343, + 7962624, + 9765625, + 11881376, + 14348907, + 17210368, + 20511149, + 243e5, + 28629151, + 33554432, + 39135393, + 45435424, + 52521875, + 60466176 + ]; + 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) & 16777215).toString(16); + carry = w >>> 24 - off & 16777215; + 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 = groupSizes[base]; + 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] * 67108864; + } else if (this.length === 3 && this.words[2] === 1) { + ret += 4503599627370496 + this.words[1] * 67108864; + } 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 Buffer2 !== "undefined"); + return this.toArrayLike(Buffer2, 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) { + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + for (i = 0; !q.isZero(); i++) { + b = q.andln(255); + q.iushrn(8); + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(255); + 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 >= 4096) { + r += 13; + t >>>= 13; + } + if (t >= 64) { + r += 7; + t >>>= 7; + } + if (t >= 8) { + r += 4; + t >>>= 4; + } + if (t >= 2) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + BN.prototype._zeroBits = function _zeroBits(w) { + if (w === 0) return 26; + var t = w; + var r = 0; + if ((t & 8191) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 127) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 15) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 1) === 0) { + r++; + } + return r; + }; + 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; + } + 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; + }; + BN.prototype.neg = function neg() { + return this.clone().ineg(); + }; + BN.prototype.ineg = function ineg() { + if (!this.isZero()) { + this.negative ^= 1; + } + return this; + }; + 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); + }; + 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); + }; + BN.prototype.iuand = function iuand(num) { + 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); + }; + 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); + }; + BN.prototype.iuxor = function iuxor(num) { + 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); + }; + 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); + }; + BN.prototype.inotn = function inotn(width) { + assert(typeof width === "number" && width >= 0); + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + this._expand(bytesNeeded); + if (bitsLeft > 0) { + bytesNeeded--; + } + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 67108863; + } + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft; + } + return this.strip(); + }; + BN.prototype.notn = function notn(width) { + return this.clone().inotn(width); + }; + 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(); + }; + BN.prototype.iadd = function iadd(num) { + var r; + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + 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 & 67108863; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 67108863; + carry = r >>> 26; + } + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + return 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); + }; + BN.prototype.isub = function isub(num) { + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + var cmp = this.cmp(num); + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + 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 & 67108863; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 67108863; + } + 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(); + }; + BN.prototype.sub = function sub(num) { + return this.clone().isub(num); + }; + function smallMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + var len = self2.length + num.length | 0; + out.length = len; + len = len - 1 | 0; + var a = self2.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + var lo = r & 67108863; + var carry = r / 67108864 | 0; + out.words[0] = lo; + for (var k = 1; k < len; k++) { + var ncarry = carry >>> 26; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i = k - j | 0; + a = self2.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += r / 67108864 | 0; + rword = r & 67108863; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + return out.strip(); + } + var comb10MulTo = function comb10MulTo2(self2, num, out) { + var a = self2.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 & 8191; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 8191; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 8191; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 8191; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 8191; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 8191; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 8191; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 8191; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 8191; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 8191; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 8191; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 8191; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 8191; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 8191; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 8191; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 8191; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 8191; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 8191; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 8191; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 8191; + var bh9 = b9 >>> 13; + out.negative = self2.negative ^ num.negative; + out.length = 19; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w0 >>> 26) | 0; + w0 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w1 >>> 26) | 0; + w1 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w2 >>> 26) | 0; + w2 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w3 >>> 26) | 0; + w3 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w4 >>> 26) | 0; + w4 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w5 >>> 26) | 0; + w5 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w6 >>> 26) | 0; + w6 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w7 >>> 26) | 0; + w7 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w8 >>> 26) | 0; + w8 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w9 >>> 26) | 0; + w9 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w10 >>> 26) | 0; + w10 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w11 >>> 26) | 0; + w11 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w12 >>> 26) | 0; + w12 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w13 >>> 26) | 0; + w13 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w14 >>> 26) | 0; + w14 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w15 >>> 26) | 0; + w15 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w16 >>> 26) | 0; + w16 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w17 >>> 26) | 0; + w17 &= 67108863; + 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 & 8191) << 13) | 0; + c = (hi + (mid >>> 13) | 0) + (w18 >>> 26) | 0; + w18 &= 67108863; + 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; + }; + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + function bigMulTo(self2, num, out) { + out.negative = num.negative ^ self2.negative; + out.length = self2.length + num.length; + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 67108863; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self2.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self2.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + var lo = r & 67108863; + ncarry = ncarry + (r / 67108864 | 0) | 0; + lo = lo + rword | 0; + rword = lo & 67108863; + ncarry = ncarry + (lo >>> 26) | 0; + hncarry += ncarry >>> 26; + ncarry &= 67108863; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + return out.strip(); + } + function jumboMulTo(self2, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self2, 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; + }; + 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; + }; + 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; + }; + 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; + 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) * 8192 + Math.round(ws[2 * i] / N) + carry; + ws[i] = w & 67108863; + if (w < 67108864) { + carry = 0; + } else { + carry = w / 67108864 | 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 & 8191; + carry = carry >>> 13; + rws[2 * i + 1] = carry & 8191; + carry = carry >>> 13; + } + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + assert(carry === 0); + assert((carry & ~8191) === 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(); + }; + BN.prototype.mul = function mul(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + BN.prototype.mulf = function mulf(num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + BN.prototype.imul = function imul(num) { + return this.clone().mulTo(num, this); + }; + BN.prototype.imuln = function imuln(num) { + assert(typeof num === "number"); + assert(num < 67108864); + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 67108863) + (carry & 67108863); + carry >>= 26; + carry += w / 67108864 | 0; + carry += lo >>> 26; + this.words[i] = lo & 67108863; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + BN.prototype.muln = function muln(num) { + return this.clone().imuln(num); + }; + BN.prototype.sqr = function sqr() { + return this.mul(this); + }; + BN.prototype.isqr = function isqr() { + return this.imul(this.clone()); + }; + BN.prototype.pow = function pow(num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + 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; + }; + BN.prototype.iushln = function iushln(bits) { + assert(typeof bits === "number" && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = 67108863 >>> 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) { + assert(this.negative === 0); + return this.iushln(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 = 67108863 ^ 67108863 >>> r << r; + var maskedWords = extended; + h -= s; + h = Math.max(0, h); + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + if (s === 0) { + } 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; + } + 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) { + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + BN.prototype.shln = function shln(bits) { + return this.clone().ishln(bits); + }; + BN.prototype.ushln = function ushln(bits) { + return this.clone().iushln(bits); + }; + BN.prototype.shrn = function shrn(bits) { + return this.clone().ishrn(bits); + }; + BN.prototype.ushrn = function ushrn(bits) { + return this.clone().iushrn(bits); + }; + 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; + if (this.length <= s) return false; + var w = this.words[s]; + return !!(w & q); + }; + 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 = 67108863 ^ 67108863 >>> r << r; + this.words[this.length - 1] &= mask; + } + return this.strip(); + }; + BN.prototype.maskn = function maskn(bits) { + return this.clone().imaskn(bits); + }; + BN.prototype.iaddn = function iaddn(num) { + assert(typeof num === "number"); + assert(num < 67108864); + if (num < 0) return this.isubn(-num); + 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; + } + return this._iaddn(num); + }; + BN.prototype._iaddn = function _iaddn(num) { + this.words[0] += num; + for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) { + this.words[i] -= 67108864; + 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; + }; + BN.prototype.isubn = function isubn(num) { + assert(typeof num === "number"); + assert(num < 67108864); + 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 { + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 67108864; + 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 & 67108863; + carry = (w >> 26) - (right / 67108864 | 0); + this.words[i + shift] = w & 67108863; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 67108863; + } + if (carry === 0) return this.strip(); + 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 & 67108863; + } + 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; + 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; + } + 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) * 67108864 + (a.words[b.length + j - 1] | 0); + qj = Math.min(qj / bhi | 0, 67108863); + 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(); + if (mode !== "div" && shift !== 0) { + a.iushrn(shift); + } + return { + div: q || null, + mod: a + }; + }; + 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, + mod + }; + } + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + if (mode !== "mod") { + div = res.div.neg(); + } + return { + 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 + }; + } + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + 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); + }; + BN.prototype.div = function div(num) { + return this.divmod(num, "div", false).div; + }; + 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; + }; + BN.prototype.divRound = function divRound(num) { + var dm = this.divmod(num); + 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); + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + BN.prototype.modn = function modn(num) { + assert(num <= 67108863); + 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; + }; + BN.prototype.idivn = function idivn(num) { + assert(num <= 67108863); + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 67108864; + 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(); + } + var A = new BN(1); + var B = new BN(0); + 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) + }; + }; + 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; + 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) { + 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); + }; + 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; + }; + BN.prototype.andln = function andln(num) { + return this.words[0] & num; + }; + BN.prototype.bincn = function bincn(bit) { + assert(typeof bit === "number"); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + 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 &= 67108863; + 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 <= 67108863, "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; + }; + 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; + }; + BN.prototype.ucmp = function ucmp(num) { + 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; + }; + 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); + }; + 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); + }; + 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); + }; + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + function MPrime(name2, p) { + this.name = name2; + 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) { + 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 !== void 0) { + r.strip(); + } 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) { + var mask = 4194303; + 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; + } + 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) { + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 977; + num.words[i] = lo & 67108863; + lo = w * 64 + (lo / 67108864 | 0); + } + 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() { + MPrime.call( + this, + "25519", + "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed" + ); + } + inherits(P25519, MPrime); + P25519.prototype.imulK = function imulK(num) { + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 19 + carry; + var lo = hi & 67108863; + hi >>>= 26; + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + BN._prime = function prime(name2) { + if (primes[name2]) return primes[name2]; + var prime2; + if (name2 === "k256") { + prime2 = new K256(); + } else if (name2 === "p224") { + prime2 = new P224(); + } else if (name2 === "p192") { + prime2 = new P192(); + } else if (name2 === "p25519") { + prime2 = new P25519(); + } else { + throw new Error("Unknown prime " + name2); + } + primes[name2] = prime2; + return prime2; + }; + 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); + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + 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(); + 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; + }; + 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) { + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; + })(typeof module2 === "undefined" || module2, exports2); + } +}); + +// node_modules/@ethersproject/logger/lib/_version.js +var require_version = __commonJS({ + "node_modules/@ethersproject/logger/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "logger/5.5.0"; + } +}); + +// node_modules/@ethersproject/logger/lib/index.js +var require_lib = __commonJS({ + "node_modules/@ethersproject/logger/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Logger = exports2.ErrorCode = exports2.LogLevel = void 0; + 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 _version_1 = require_version(); + var _globalLogger = null; + function _checkNormalize() { + try { + var missing_1 = []; + ["NFD", "NFC", "NFKD", "NFKC"].forEach(function(form) { + try { + if ("test".normalize(form) !== "test") { + throw new Error("bad normalize"); + } + ; + } catch (error) { + missing_1.push(form); + } + }); + if (missing_1.length) { + throw new Error("missing " + missing_1.join(", ")); + } + if (String.fromCharCode(233).normalize("NFD") !== String.fromCharCode(101, 769)) { + throw new Error("broken implementation"); + } + } catch (error) { + return error.message; + } + return null; + } + var _normalizeError = _checkNormalize(); + var LogLevel; + (function(LogLevel2) { + LogLevel2["DEBUG"] = "DEBUG"; + LogLevel2["INFO"] = "INFO"; + LogLevel2["WARNING"] = "WARNING"; + LogLevel2["ERROR"] = "ERROR"; + LogLevel2["OFF"] = "OFF"; + })(LogLevel = exports2.LogLevel || (exports2.LogLevel = {})); + var ErrorCode; + (function(ErrorCode2) { + ErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR"; + ErrorCode2["NOT_IMPLEMENTED"] = "NOT_IMPLEMENTED"; + ErrorCode2["UNSUPPORTED_OPERATION"] = "UNSUPPORTED_OPERATION"; + ErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR"; + ErrorCode2["SERVER_ERROR"] = "SERVER_ERROR"; + ErrorCode2["TIMEOUT"] = "TIMEOUT"; + ErrorCode2["BUFFER_OVERRUN"] = "BUFFER_OVERRUN"; + ErrorCode2["NUMERIC_FAULT"] = "NUMERIC_FAULT"; + ErrorCode2["MISSING_NEW"] = "MISSING_NEW"; + ErrorCode2["INVALID_ARGUMENT"] = "INVALID_ARGUMENT"; + ErrorCode2["MISSING_ARGUMENT"] = "MISSING_ARGUMENT"; + ErrorCode2["UNEXPECTED_ARGUMENT"] = "UNEXPECTED_ARGUMENT"; + ErrorCode2["CALL_EXCEPTION"] = "CALL_EXCEPTION"; + ErrorCode2["INSUFFICIENT_FUNDS"] = "INSUFFICIENT_FUNDS"; + ErrorCode2["NONCE_EXPIRED"] = "NONCE_EXPIRED"; + ErrorCode2["REPLACEMENT_UNDERPRICED"] = "REPLACEMENT_UNDERPRICED"; + ErrorCode2["UNPREDICTABLE_GAS_LIMIT"] = "UNPREDICTABLE_GAS_LIMIT"; + ErrorCode2["TRANSACTION_REPLACED"] = "TRANSACTION_REPLACED"; + })(ErrorCode = exports2.ErrorCode || (exports2.ErrorCode = {})); + var HEX = "0123456789abcdef"; + var Logger = ( + /** @class */ + function() { + function Logger2(version) { + Object.defineProperty(this, "version", { + enumerable: true, + value: version, + writable: false + }); + } + Logger2.prototype._log = function(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); + }; + Logger2.prototype.debug = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.DEBUG, args); + }; + Logger2.prototype.info = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.INFO, args); + }; + Logger2.prototype.warn = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + this._log(Logger2.levels.WARNING, args); + }; + Logger2.prototype.makeError = function(message, code, params) { + if (_censorErrors) { + return this.makeError("censored error", code, {}); + } + if (!code) { + code = Logger2.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] & 15]; + } + messageDetails.push(key + "=Uint8Array(0x" + hex + ")"); + } else { + messageDetails.push(key + "=" + JSON.stringify(value)); + } + } catch (error2) { + messageDetails.push(key + "=" + JSON.stringify(params[key].toString())); + } + }); + messageDetails.push("code=" + code); + messageDetails.push("version=" + this.version); + var reason = message; + if (messageDetails.length) { + message += " (" + messageDetails.join(", ") + ")"; + } + var error = new Error(message); + error.reason = reason; + error.code = code; + Object.keys(params).forEach(function(key) { + error[key] = params[key]; + }); + return error; + }; + Logger2.prototype.throwError = function(message, code, params) { + throw this.makeError(message, code, params); + }; + Logger2.prototype.throwArgumentError = function(message, name2, value) { + return this.throwError(message, Logger2.errors.INVALID_ARGUMENT, { + argument: name2, + value + }); + }; + Logger2.prototype.assert = function(condition, message, code, params) { + if (!!condition) { + return; + } + this.throwError(message, code, params); + }; + Logger2.prototype.assertArgument = function(condition, message, name2, value) { + if (!!condition) { + return; + } + this.throwArgumentError(message, name2, value); + }; + Logger2.prototype.checkNormalize = function(message) { + if (message == null) { + message = "platform missing String.prototype.normalize"; + } + if (_normalizeError) { + this.throwError("platform missing String.prototype.normalize", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "String.prototype.normalize", + form: _normalizeError + }); + } + }; + Logger2.prototype.checkSafeUint53 = function(value, message) { + if (typeof value !== "number") { + return; + } + if (message == null) { + message = "value not safe"; + } + if (value < 0 || value >= 9007199254740991) { + this.throwError(message, Logger2.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "out-of-safe-range", + value + }); + } + if (value % 1) { + this.throwError(message, Logger2.errors.NUMERIC_FAULT, { + operation: "checkSafeInteger", + fault: "non-integer", + value + }); + } + }; + Logger2.prototype.checkArgumentCount = function(count, expectedCount, message) { + if (message) { + message = ": " + message; + } else { + message = ""; + } + if (count < expectedCount) { + this.throwError("missing argument" + message, Logger2.errors.MISSING_ARGUMENT, { + count, + expectedCount + }); + } + if (count > expectedCount) { + this.throwError("too many arguments" + message, Logger2.errors.UNEXPECTED_ARGUMENT, { + count, + expectedCount + }); + } + }; + Logger2.prototype.checkNew = function(target, kind) { + if (target === Object || target == null) { + this.throwError("missing new", Logger2.errors.MISSING_NEW, { name: kind.name }); + } + }; + Logger2.prototype.checkAbstract = function(target, kind) { + if (target === kind) { + this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger2.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" }); + } else if (target === Object || target == null) { + this.throwError("missing new", Logger2.errors.MISSING_NEW, { name: kind.name }); + } + }; + Logger2.globalLogger = function() { + if (!_globalLogger) { + _globalLogger = new Logger2(_version_1.version); + } + return _globalLogger; + }; + Logger2.setCensorship = function(censorship, permanent) { + if (!censorship && permanent) { + this.globalLogger().throwError("cannot permanently disable censorship", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + if (_permanentCensorErrors) { + if (!censorship) { + return; + } + this.globalLogger().throwError("error censorship permanent", Logger2.errors.UNSUPPORTED_OPERATION, { + operation: "setCensorship" + }); + } + _censorErrors = !!censorship; + _permanentCensorErrors = !!permanent; + }; + Logger2.setLogLevel = function(logLevel) { + var level = LogLevels[logLevel.toLowerCase()]; + if (level == null) { + Logger2.globalLogger().warn("invalid log level - " + logLevel); + return; + } + _logLevel = level; + }; + Logger2.from = function(version) { + return new Logger2(version); + }; + Logger2.errors = ErrorCode; + Logger2.levels = LogLevel; + return Logger2; + }() + ); + exports2.Logger = Logger; + } +}); + +// node_modules/@ethersproject/bytes/lib/_version.js +var require_version2 = __commonJS({ + "node_modules/@ethersproject/bytes/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "bytes/5.5.0"; + } +}); + +// node_modules/@ethersproject/bytes/lib/index.js +var require_lib2 = __commonJS({ + "node_modules/@ethersproject/bytes/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.joinSignature = exports2.splitSignature = exports2.hexZeroPad = exports2.hexStripZeros = exports2.hexValue = exports2.hexConcat = exports2.hexDataSlice = exports2.hexDataLength = exports2.hexlify = exports2.isHexString = exports2.zeroPad = exports2.stripZeros = exports2.concat = exports2.arrayify = exports2.isBytes = exports2.isBytesLike = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version2(); + var logger = new logger_1.Logger(_version_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); + } + exports2.isBytesLike = isBytesLike; + 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; + } + exports2.isBytes = isBytes; + function arrayify(value, options) { + if (!options) { + options = {}; + } + if (typeof value === "number") { + logger.checkSafeUint53(value, "invalid arrayify value"); + var result = []; + while (value) { + result.unshift(value & 255); + 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); + } + exports2.arrayify = arrayify; + 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); + } + exports2.concat = concat; + function stripZeros(value) { + var result = arrayify(value); + if (result.length === 0) { + return result; + } + var start = 0; + while (start < result.length && result[start] === 0) { + start++; + } + if (start) { + result = result.slice(start); + } + return result; + } + exports2.stripZeros = stripZeros; + 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); + } + exports2.zeroPad = zeroPad; + 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; + } + exports2.isHexString = isHexString; + 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 & 15] + 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 & 240) >> 4] + HexCharacters[v & 15]; + } + return result; + } + return logger.throwArgumentError("invalid hexlify value", "value", value); + } + exports2.hexlify = hexlify; + function hexDataLength(data) { + if (typeof data !== "string") { + data = hexlify(data); + } else if (!isHexString(data) || data.length % 2) { + return null; + } + return (data.length - 2) / 2; + } + exports2.hexDataLength = hexDataLength; + 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); + } + exports2.hexDataSlice = hexDataSlice; + function hexConcat(items) { + var result = "0x"; + items.forEach(function(item) { + result += hexlify(item).substring(2); + }); + return result; + } + exports2.hexConcat = hexConcat; + function hexValue(value) { + var trimmed = hexStripZeros(hexlify(value, { hexPad: "left" })); + if (trimmed === "0x") { + return "0x0"; + } + return trimmed; + } + exports2.hexValue = hexValue; + 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); + } + exports2.hexStripZeros = hexStripZeros; + 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; + } + exports2.hexZeroPad = hexZeroPad; + 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); + } + result.r = hexlify(bytes.slice(0, 32)); + result.s = hexlify(bytes.slice(32, 64)); + result.v = bytes[64]; + if (result.v < 27) { + if (result.v === 0 || result.v === 1) { + result.v += 27; + } else { + logger.throwArgumentError("signature invalid v byte", "signature", signature); + } + } + result.recoveryParam = 1 - result.v % 2; + if (result.recoveryParam) { + bytes[32] |= 128; + } + 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 (result._vs != null) { + var vs_1 = zeroPad(arrayify(result._vs), 32); + result._vs = hexlify(vs_1); + var recoveryParam = vs_1[0] >= 128 ? 1 : 0; + if (result.recoveryParam == null) { + result.recoveryParam = recoveryParam; + } else if (result.recoveryParam !== recoveryParam) { + logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature); + } + vs_1[0] &= 127; + var s = hexlify(vs_1); + if (result.s == null) { + result.s = s; + } else if (result.s !== s) { + logger.throwArgumentError("signature v mismatch _vs", "signature", signature); + } + } + 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] |= 128; + } + var _vs = hexlify(vs); + if (result._vs) { + if (!isHexString(result._vs)) { + logger.throwArgumentError("signature invalid _vs", "signature", signature); + } + result._vs = hexZeroPad(result._vs, 32); + } + if (result._vs == null) { + result._vs = _vs; + } else if (result._vs !== _vs) { + logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature); + } + } + return result; + } + exports2.splitSignature = splitSignature; + function joinSignature(signature) { + signature = splitSignature(signature); + return hexlify(concat([ + signature.r, + signature.s, + signature.recoveryParam ? "0x1c" : "0x1b" + ])); + } + exports2.joinSignature = joinSignature; + } +}); + +// node_modules/@ethersproject/bignumber/lib/_version.js +var require_version3 = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "bignumber/5.5.0"; + } +}); + +// node_modules/@ethersproject/bignumber/lib/bignumber.js +var require_bignumber = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/bignumber.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._base16To36 = exports2._base36To16 = exports2.BigNumber = exports2.isBigNumberish = void 0; + var bn_js_1 = __importDefault(require_bn()); + var BN = bn_js_1.default.BN; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version3(); + var logger = new logger_1.Logger(_version_1.version); + var _constructorGuard = {}; + var MAX_SAFE = 9007199254740991; + function isBigNumberish(value) { + return value != null && (BigNumber.isBigNumber(value) || typeof value === "number" && value % 1 === 0 || typeof value === "string" && !!value.match(/^-?[0-9]+$/) || (0, bytes_1.isHexString)(value) || typeof value === "bigint" || (0, bytes_1.isBytes)(value)); + } + exports2.isBigNumberish = isBigNumberish; + var _warnedToStringRadix = false; + var BigNumber = ( + /** @class */ + function() { + function BigNumber2(constructorGuard, hex) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, BigNumber2); + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot call constructor directly; use BigNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new (BigNumber)" + }); + } + this._hex = hex; + this._isBigNumber = true; + Object.freeze(this); + } + BigNumber2.prototype.fromTwos = function(value) { + return toBigNumber(toBN(this).fromTwos(value)); + }; + BigNumber2.prototype.toTwos = function(value) { + return toBigNumber(toBN(this).toTwos(value)); + }; + BigNumber2.prototype.abs = function() { + if (this._hex[0] === "-") { + return BigNumber2.from(this._hex.substring(1)); + } + return this; + }; + BigNumber2.prototype.add = function(other) { + return toBigNumber(toBN(this).add(toBN(other))); + }; + BigNumber2.prototype.sub = function(other) { + return toBigNumber(toBN(this).sub(toBN(other))); + }; + BigNumber2.prototype.div = function(other) { + var o = BigNumber2.from(other); + if (o.isZero()) { + throwFault("division by zero", "div"); + } + return toBigNumber(toBN(this).div(toBN(other))); + }; + BigNumber2.prototype.mul = function(other) { + return toBigNumber(toBN(this).mul(toBN(other))); + }; + BigNumber2.prototype.mod = function(other) { + var value = toBN(other); + if (value.isNeg()) { + throwFault("cannot modulo negative values", "mod"); + } + return toBigNumber(toBN(this).umod(value)); + }; + BigNumber2.prototype.pow = function(other) { + var value = toBN(other); + if (value.isNeg()) { + throwFault("cannot raise to negative values", "pow"); + } + return toBigNumber(toBN(this).pow(value)); + }; + BigNumber2.prototype.and = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'and' negative values", "and"); + } + return toBigNumber(toBN(this).and(value)); + }; + BigNumber2.prototype.or = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'or' negative values", "or"); + } + return toBigNumber(toBN(this).or(value)); + }; + BigNumber2.prototype.xor = function(other) { + var value = toBN(other); + if (this.isNegative() || value.isNeg()) { + throwFault("cannot 'xor' negative values", "xor"); + } + return toBigNumber(toBN(this).xor(value)); + }; + BigNumber2.prototype.mask = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot mask negative values", "mask"); + } + return toBigNumber(toBN(this).maskn(value)); + }; + BigNumber2.prototype.shl = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shl"); + } + return toBigNumber(toBN(this).shln(value)); + }; + BigNumber2.prototype.shr = function(value) { + if (this.isNegative() || value < 0) { + throwFault("cannot shift negative values", "shr"); + } + return toBigNumber(toBN(this).shrn(value)); + }; + BigNumber2.prototype.eq = function(other) { + return toBN(this).eq(toBN(other)); + }; + BigNumber2.prototype.lt = function(other) { + return toBN(this).lt(toBN(other)); + }; + BigNumber2.prototype.lte = function(other) { + return toBN(this).lte(toBN(other)); + }; + BigNumber2.prototype.gt = function(other) { + return toBN(this).gt(toBN(other)); + }; + BigNumber2.prototype.gte = function(other) { + return toBN(this).gte(toBN(other)); + }; + BigNumber2.prototype.isNegative = function() { + return this._hex[0] === "-"; + }; + BigNumber2.prototype.isZero = function() { + return toBN(this).isZero(); + }; + BigNumber2.prototype.toNumber = function() { + try { + return toBN(this).toNumber(); + } catch (error) { + throwFault("overflow", "toNumber", this.toString()); + } + return null; + }; + BigNumber2.prototype.toBigInt = function() { + try { + return BigInt(this.toString()); + } catch (e) { + } + return logger.throwError("this platform does not support BigInt", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + value: this.toString() + }); + }; + BigNumber2.prototype.toString = function() { + 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()", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); + } else { + logger.throwError("BigNumber.toString does not accept parameters", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {}); + } + } + return toBN(this).toString(10); + }; + BigNumber2.prototype.toHexString = function() { + return this._hex; + }; + BigNumber2.prototype.toJSON = function(key) { + return { type: "BigNumber", hex: this.toHexString() }; + }; + BigNumber2.from = function(value) { + if (value instanceof BigNumber2) { + return value; + } + if (typeof value === "string") { + if (value.match(/^-?0x[0-9a-f]+$/i)) { + return new BigNumber2(_constructorGuard, toHex(value)); + } + if (value.match(/^-?[0-9]+$/)) { + return new BigNumber2(_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 BigNumber2.from(String(value)); + } + var anyValue = value; + if (typeof anyValue === "bigint") { + return BigNumber2.from(anyValue.toString()); + } + if ((0, bytes_1.isBytes)(anyValue)) { + return BigNumber2.from((0, bytes_1.hexlify)(anyValue)); + } + if (anyValue) { + if (anyValue.toHexString) { + var hex = anyValue.toHexString(); + if (typeof hex === "string") { + return BigNumber2.from(hex); + } + } else { + var hex = anyValue._hex; + if (hex == null && anyValue.type === "BigNumber") { + hex = anyValue.hex; + } + if (typeof hex === "string") { + if ((0, bytes_1.isHexString)(hex) || hex[0] === "-" && (0, bytes_1.isHexString)(hex.substring(1))) { + return BigNumber2.from(hex); + } + } + } + } + return logger.throwArgumentError("invalid BigNumber value", "value", value); + }; + BigNumber2.isBigNumber = function(value) { + return !!(value && value._isBigNumber); + }; + return BigNumber2; + }() + ); + exports2.BigNumber = BigNumber; + function toHex(value) { + if (typeof value !== "string") { + return toHex(value.toString(16)); + } + if (value[0] === "-") { + value = value.substring(1); + if (value[0] === "-") { + logger.throwArgumentError("invalid hex", "value", value); + } + value = toHex(value); + if (value === "0x00") { + return value; + } + return "-" + value; + } + if (value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if (value === "0x") { + return "0x00"; + } + if (value.length % 2) { + value = "0x0" + value.substring(2); + } + 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, operation }; + if (value != null) { + params.value = value; + } + return logger.throwError(fault, logger_1.Logger.errors.NUMERIC_FAULT, params); + } + function _base36To16(value) { + return new BN(value, 36).toString(16); + } + exports2._base36To16 = _base36To16; + function _base16To36(value) { + return new BN(value, 16).toString(36); + } + exports2._base16To36 = _base16To36; + } +}); + +// node_modules/@ethersproject/bignumber/lib/fixednumber.js +var require_fixednumber = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/fixednumber.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FixedNumber = exports2.FixedFormat = exports2.parseFixed = exports2.formatFixed = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version3(); + var logger = new logger_1.Logger(_version_1.version); + var bignumber_1 = require_bignumber(); + var _constructorGuard = {}; + var Zero = bignumber_1.BigNumber.from(0); + var NegativeOne = bignumber_1.BigNumber.from(-1); + function throwFault(message, fault, operation, value) { + var params = { fault, operation }; + if (value !== void 0) { + params.value = value; + } + return logger.throwError(message, logger_1.Logger.errors.NUMERIC_FAULT, params); + } + var zeros = "0"; + while (zeros.length < 256) { + zeros += zeros; + } + function getMultiplier(decimals) { + if (typeof decimals !== "number") { + try { + decimals = bignumber_1.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); + value = bignumber_1.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; + } + 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; + } + exports2.formatFixed = formatFixed; + 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); + } + var negative = value.substring(0, 1) === "-"; + if (negative) { + value = value.substring(1); + } + if (value === ".") { + logger.throwArgumentError("missing value", "value", value); + } + 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"; + } + while (fraction[fraction.length - 1] === "0") { + fraction = fraction.substring(0, fraction.length - 1); + } + if (fraction.length > multiplier.length - 1) { + throwFault("fractional component exceeds decimals", "underflow", "parseFixed"); + } + if (fraction === "") { + fraction = "0"; + } + while (fraction.length < multiplier.length - 1) { + fraction += "0"; + } + var wholeValue = bignumber_1.BigNumber.from(whole); + var fractionValue = bignumber_1.BigNumber.from(fraction); + var wei = wholeValue.mul(multiplier).add(fractionValue); + if (negative) { + wei = wei.mul(NegativeOne); + } + return wei; + } + exports2.parseFixed = parseFixed; + var FixedFormat = ( + /** @class */ + function() { + function FixedFormat2(constructorGuard, signed, width, decimals) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedFormat constructor; use FixedFormat.from", logger_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); + } + FixedFormat2.from = function(value) { + if (value instanceof FixedFormat2) { + return value; + } + if (typeof value === "number") { + value = "fixed128x" + value; + } + var signed = true; + var width = 128; + var decimals = 18; + if (typeof value === "string") { + if (value === "fixed") { + } 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(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 FixedFormat2(_constructorGuard, signed, width, decimals); + }; + return FixedFormat2; + }() + ); + exports2.FixedFormat = FixedFormat; + var FixedNumber = ( + /** @class */ + function() { + function FixedNumber2(constructorGuard, hex, value, format) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, FixedNumber2); + if (constructorGuard !== _constructorGuard) { + logger.throwError("cannot use FixedNumber constructor; use FixedNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new FixedFormat" + }); + } + this.format = format; + this._hex = hex; + this._value = value; + this._isFixedNumber = true; + Object.freeze(this); + } + FixedNumber2.prototype._checkFormat = function(other) { + if (this.format.name !== other.format.name) { + logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other); + } + }; + FixedNumber2.prototype.addUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.add(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.subUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.sub(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.mulUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format); + }; + FixedNumber2.prototype.divUnsafe = function(other) { + this._checkFormat(other); + var a = parseFixed(this._value, this.format.decimals); + var b = parseFixed(other._value, other.format.decimals); + return FixedNumber2.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format); + }; + FixedNumber2.prototype.floor = function() { + var comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + var result = FixedNumber2.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + if (this.isNegative() && hasFraction) { + result = result.subUnsafe(ONE.toFormat(result.format)); + } + return result; + }; + FixedNumber2.prototype.ceiling = function() { + var comps = this.toString().split("."); + if (comps.length === 1) { + comps.push("0"); + } + var result = FixedNumber2.from(comps[0], this.format); + var hasFraction = !comps[1].match(/^(0*)$/); + if (!this.isNegative() && hasFraction) { + result = result.addUnsafe(ONE.toFormat(result.format)); + } + return result; + }; + FixedNumber2.prototype.round = function(decimals) { + if (decimals == null) { + decimals = 0; + } + 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 = FixedNumber2.from("1" + zeros.substring(0, decimals), this.format); + var bump = BUMP.toFormat(this.format); + return this.mulUnsafe(factor).addUnsafe(bump).floor().divUnsafe(factor); + }; + FixedNumber2.prototype.isZero = function() { + return this._value === "0.0" || this._value === "0"; + }; + FixedNumber2.prototype.isNegative = function() { + return this._value[0] === "-"; + }; + FixedNumber2.prototype.toString = function() { + return this._value; + }; + FixedNumber2.prototype.toHexString = function(width) { + if (width == null) { + return this._hex; + } + if (width % 8) { + logger.throwArgumentError("invalid byte width", "width", width); + } + var hex = bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString(); + return (0, bytes_1.hexZeroPad)(hex, width / 8); + }; + FixedNumber2.prototype.toUnsafeFloat = function() { + return parseFloat(this.toString()); + }; + FixedNumber2.prototype.toFormat = function(format) { + return FixedNumber2.fromString(this._value, format); + }; + FixedNumber2.fromValue = function(value, decimals, format) { + if (format == null && decimals != null && !(0, bignumber_1.isBigNumberish)(decimals)) { + format = decimals; + decimals = null; + } + if (decimals == null) { + decimals = 0; + } + if (format == null) { + format = "fixed"; + } + return FixedNumber2.fromString(formatFixed(value, decimals), FixedFormat.from(format)); + }; + FixedNumber2.fromString = function(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 = (0, bytes_1.hexZeroPad)(hex, fixedFormat.width / 8); + } + var decimal = formatFixed(numeric, fixedFormat.decimals); + return new FixedNumber2(_constructorGuard, hex, decimal, fixedFormat); + }; + FixedNumber2.fromBytes = function(value, format) { + if (format == null) { + format = "fixed"; + } + var fixedFormat = FixedFormat.from(format); + if ((0, bytes_1.arrayify)(value).length > fixedFormat.width / 8) { + throw new Error("overflow"); + } + var numeric = bignumber_1.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 FixedNumber2(_constructorGuard, hex, decimal, fixedFormat); + }; + FixedNumber2.from = function(value, format) { + if (typeof value === "string") { + return FixedNumber2.fromString(value, format); + } + if ((0, bytes_1.isBytes)(value)) { + return FixedNumber2.fromBytes(value, format); + } + try { + return FixedNumber2.fromValue(value, 0, format); + } catch (error) { + if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT) { + throw error; + } + } + return logger.throwArgumentError("invalid FixedNumber value", "value", value); + }; + FixedNumber2.isFixedNumber = function(value) { + return !!(value && value._isFixedNumber); + }; + return FixedNumber2; + }() + ); + exports2.FixedNumber = FixedNumber; + var ONE = FixedNumber.from(1); + var BUMP = FixedNumber.from("0.5"); + } +}); + +// node_modules/@ethersproject/bignumber/lib/index.js +var require_lib3 = __commonJS({ + "node_modules/@ethersproject/bignumber/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._base36To16 = exports2._base16To36 = exports2.parseFixed = exports2.FixedNumber = exports2.FixedFormat = exports2.formatFixed = exports2.BigNumber = void 0; + var bignumber_1 = require_bignumber(); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return bignumber_1.BigNumber; + } }); + var fixednumber_1 = require_fixednumber(); + Object.defineProperty(exports2, "formatFixed", { enumerable: true, get: function() { + return fixednumber_1.formatFixed; + } }); + Object.defineProperty(exports2, "FixedFormat", { enumerable: true, get: function() { + return fixednumber_1.FixedFormat; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return fixednumber_1.FixedNumber; + } }); + Object.defineProperty(exports2, "parseFixed", { enumerable: true, get: function() { + return fixednumber_1.parseFixed; + } }); + var bignumber_2 = require_bignumber(); + Object.defineProperty(exports2, "_base16To36", { enumerable: true, get: function() { + return bignumber_2._base16To36; + } }); + Object.defineProperty(exports2, "_base36To16", { enumerable: true, get: function() { + return bignumber_2._base36To16; + } }); + } +}); + +// node_modules/@ethersproject/properties/lib/_version.js +var require_version4 = __commonJS({ + "node_modules/@ethersproject/properties/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "properties/5.5.0"; + } +}); + +// node_modules/@ethersproject/properties/lib/index.js +var require_lib4 = __commonJS({ + "node_modules/@ethersproject/properties/lib/index.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Description = exports2.deepCopy = exports2.shallowCopy = exports2.checkProperties = exports2.resolveProperties = exports2.getStatic = exports2.defineReadOnly = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version4(); + var logger = new logger_1.Logger(_version_1.version); + function defineReadOnly(object, name2, value) { + Object.defineProperty(object, name2, { + enumerable: true, + value, + writable: false + }); + } + exports2.defineReadOnly = defineReadOnly; + 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; + } + exports2.getStatic = getStatic; + function resolveProperties(object) { + return __awaiter(this, void 0, void 0, function() { + var promises, results; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + promises = Object.keys(object).map(function(key) { + var value = object[key]; + return Promise.resolve(value).then(function(v) { + return { key, value: v }; + }); + }); + return [4, Promise.all(promises)]; + case 1: + results = _a.sent(); + return [2, results.reduce(function(accum, result) { + accum[result.key] = result.value; + return accum; + }, {})]; + } + }); + }); + } + exports2.resolveProperties = resolveProperties; + 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); + } + }); + } + exports2.checkProperties = checkProperties; + function shallowCopy(object) { + var result = {}; + for (var key in object) { + result[key] = object[key]; + } + return result; + } + exports2.shallowCopy = shallowCopy; + var opaque = { bigint: true, boolean: true, "function": true, number: true, string: true }; + function _isFrozen(object) { + if (object === void 0 || 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) { + continue; + } + if (!_isFrozen(value)) { + return false; + } + } + return true; + } + return logger.throwArgumentError("Cannot deepCopy " + typeof object, "object", object); + } + function _deepCopy(object) { + if (_isFrozen(object)) { + return object; + } + 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 === void 0) { + continue; + } + defineReadOnly(result, key, deepCopy(value)); + } + return result; + } + return logger.throwArgumentError("Cannot deepCopy " + typeof object, "object", object); + } + function deepCopy(object) { + return _deepCopy(object); + } + exports2.deepCopy = deepCopy; + var Description = ( + /** @class */ + /* @__PURE__ */ function() { + function Description2(info) { + for (var key in info) { + this[key] = deepCopy(info[key]); + } + } + return Description2; + }() + ); + exports2.Description = Description; + } +}); + +// node_modules/@ethersproject/abi/lib/_version.js +var require_version5 = __commonJS({ + "node_modules/@ethersproject/abi/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abi/5.5.0"; + } +}); + +// node_modules/@ethersproject/abi/lib/fragments.js +var require_fragments = __commonJS({ + "node_modules/@ethersproject/abi/lib/fragments.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ErrorFragment = exports2.FunctionFragment = exports2.ConstructorFragment = exports2.EventFragment = exports2.Fragment = exports2.ParamType = exports2.FormatTypes = void 0; + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var _constructorGuard = {}; + var ModifiersBytes = { calldata: true, memory: true, storage: true }; + var ModifiersNest = { calldata: true, memory: true }; + function checkModifier(type, name2) { + if (type === "bytes" || type === "string") { + if (ModifiersBytes[name2]) { + return true; + } + } else if (type === "address") { + if (name2 === "payable") { + return true; + } + } else if (type.indexOf("[") >= 0 || type === "tuple") { + if (ModifiersNest[name2]) { + return true; + } + } + if (ModifiersBytes[name2] || name2 === "payable") { + logger.throwArgumentError("invalid modifier", "name", name2); + } + return false; + } + function parseParamType(param, allowIndexed) { + var originalParam = param; + function throwError(i2) { + logger.throwArgumentError("unexpected character at position " + i2, "param", param); + } + param = param.replace(/\s/g, " "); + function newNode(parent2) { + var node2 = { type: "", name: "", parent: parent2, state: { allowType: true } }; + if (allowIndexed) { + node2.indexed = false; + } + return node2; + } + 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); + node.parent.components.push(sibling); + delete node.parent; + node = sibling; + break; + case " ": + 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 (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) { + (0, properties_1.defineReadOnly)(object, key, params[key]); + } + } + exports2.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 = ( + /** @class */ + function() { + function ParamType2(constructorGuard, params) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("use fromString", logger_1.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: ParamType2.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); + } + ParamType2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + var result_1 = { + type: this.baseType === "tuple" ? "tuple" : this.type, + name: this.name || void 0 + }; + if (typeof this.indexed === "boolean") { + result_1.indexed = this.indexed; + } + if (this.components) { + result_1.components = this.components.map(function(comp) { + return JSON.parse(comp.format(format)); + }); + } + return JSON.stringify(result_1); + } + var result = ""; + if (this.baseType === "array") { + result += this.arrayChildren.format(format); + result += "[" + (this.arrayLength < 0 ? "" : String(this.arrayLength)) + "]"; + } else { + if (this.baseType === "tuple") { + if (format !== exports2.FormatTypes.sighash) { + result += this.type; + } + result += "(" + this.components.map(function(comp) { + return comp.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ")"; + } else { + result += this.type; + } + } + if (format !== exports2.FormatTypes.sighash) { + if (this.indexed === true) { + result += " indexed"; + } + if (format === exports2.FormatTypes.full && this.name) { + result += " " + this.name; + } + } + return result; + }; + ParamType2.from = function(value, allowIndexed) { + if (typeof value === "string") { + return ParamType2.fromString(value, allowIndexed); + } + return ParamType2.fromObject(value); + }; + ParamType2.fromObject = function(value) { + if (ParamType2.isParamType(value)) { + return value; + } + return new ParamType2(_constructorGuard, { + name: value.name || null, + type: verifyType(value.type), + indexed: value.indexed == null ? null : !!value.indexed, + components: value.components ? value.components.map(ParamType2.fromObject) : null + }); + }; + ParamType2.fromString = function(value, allowIndexed) { + function ParamTypify(node) { + return ParamType2.fromObject({ + name: node.name, + type: node.type, + indexed: node.indexed, + components: node.components + }); + } + return ParamTypify(parseParamType(value, !!allowIndexed)); + }; + ParamType2.isParamType = function(value) { + return !!(value != null && value._isParamType); + }; + return ParamType2; + }() + ); + exports2.ParamType = ParamType; + function parseParams(value, allowIndex) { + return splitNesting(value).map(function(param) { + return ParamType.fromString(param, allowIndex); + }); + } + var Fragment = ( + /** @class */ + function() { + function Fragment2(constructorGuard, params) { + if (constructorGuard !== _constructorGuard) { + logger.throwError("use a static from method", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Fragment()" + }); + } + populate(this, params); + this._isFragment = true; + Object.freeze(this); + } + Fragment2.from = function(value) { + if (Fragment2.isFragment(value)) { + return value; + } + if (typeof value === "string") { + return Fragment2.fromString(value); + } + return Fragment2.fromObject(value); + }; + Fragment2.fromObject = function(value) { + if (Fragment2.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": + return null; + } + return logger.throwArgumentError("invalid fragment object", "value", value); + }; + Fragment2.fromString = function(value) { + 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); + }; + Fragment2.isFragment = function(value) { + return !!(value && value._isFragment); + }; + return Fragment2; + }() + ); + exports2.Fragment = Fragment; + var EventFragment = ( + /** @class */ + function(_super) { + __extends(EventFragment2, _super); + function EventFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + EventFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + var result = ""; + if (format !== exports2.FormatTypes.sighash) { + result += "event "; + } + result += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (format !== exports2.FormatTypes.sighash) { + if (this.anonymous) { + result += "anonymous "; + } + } + return result.trim(); + }; + EventFragment2.from = function(value) { + if (typeof value === "string") { + return EventFragment2.fromString(value); + } + return EventFragment2.fromObject(value); + }; + EventFragment2.fromObject = function(value) { + if (EventFragment2.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 EventFragment2(_constructorGuard, params); + }; + EventFragment2.fromString = function(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 EventFragment2.fromObject({ + name: match[1].trim(), + anonymous, + inputs: parseParams(match[2], true), + type: "event" + }); + }; + EventFragment2.isEventFragment = function(value) { + return value && value._isFragment && value.type === "event"; + }; + return EventFragment2; + }(Fragment) + ); + exports2.EventFragment = EventFragment; + 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 = bignumber_1.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; + 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); + } + } + 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 (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 = ( + /** @class */ + function(_super) { + __extends(ConstructorFragment2, _super); + function ConstructorFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ConstructorFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "constructor", + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + if (format === exports2.FormatTypes.sighash) { + logger.throwError("cannot format a constructor for sighash", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "format(sighash)" + }); + } + var result = "constructor(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (this.stateMutability && this.stateMutability !== "nonpayable") { + result += this.stateMutability + " "; + } + return result.trim(); + }; + ConstructorFragment2.from = function(value) { + if (typeof value === "string") { + return ConstructorFragment2.fromString(value); + } + return ConstructorFragment2.fromObject(value); + }; + ConstructorFragment2.fromObject = function(value) { + if (ConstructorFragment2.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 ? bignumber_1.BigNumber.from(value.gas) : null + }; + return new ConstructorFragment2(_constructorGuard, params); + }; + ConstructorFragment2.fromString = function(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 ConstructorFragment2.fromObject(params); + }; + ConstructorFragment2.isConstructorFragment = function(value) { + return value && value._isFragment && value.type === "constructor"; + }; + return ConstructorFragment2; + }(Fragment) + ); + exports2.ConstructorFragment = ConstructorFragment; + var FunctionFragment = ( + /** @class */ + function(_super) { + __extends(FunctionFragment2, _super); + function FunctionFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + FunctionFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: this.stateMutability !== "nonpayable" ? this.stateMutability : void 0, + payable: this.payable, + gas: this.gas ? this.gas.toNumber() : void 0, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }), + outputs: this.outputs.map(function(output) { + return JSON.parse(output.format(format)); + }) + }); + } + var result = ""; + if (format !== exports2.FormatTypes.sighash) { + result += "function "; + } + result += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + if (format !== exports2.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(format); + }).join(", ") + ") "; + } + if (this.gas != null) { + result += "@" + this.gas.toString() + " "; + } + } + return result.trim(); + }; + FunctionFragment2.from = function(value) { + if (typeof value === "string") { + return FunctionFragment2.fromString(value); + } + return FunctionFragment2.fromObject(value); + }; + FunctionFragment2.fromObject = function(value) { + if (FunctionFragment2.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 ? bignumber_1.BigNumber.from(value.gas) : null + }; + return new FunctionFragment2(_constructorGuard, params); + }; + FunctionFragment2.fromString = function(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); + 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 FunctionFragment2.fromObject(params); + }; + FunctionFragment2.isFunctionFragment = function(value) { + return value && value._isFragment && value.type === "function"; + }; + return FunctionFragment2; + }(ConstructorFragment) + ); + exports2.FunctionFragment = FunctionFragment; + function checkForbidden(fragment) { + var sig = fragment.format(); + if (sig === "Error(string)" || sig === "Panic(uint256)") { + logger.throwArgumentError("cannot specify user defined " + sig + " error", "fragment", fragment); + } + return fragment; + } + var ErrorFragment = ( + /** @class */ + function(_super) { + __extends(ErrorFragment2, _super); + function ErrorFragment2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ErrorFragment2.prototype.format = function(format) { + if (!format) { + format = exports2.FormatTypes.sighash; + } + if (!exports2.FormatTypes[format]) { + logger.throwArgumentError("invalid format type", "format", format); + } + if (format === exports2.FormatTypes.json) { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map(function(input) { + return JSON.parse(input.format(format)); + }) + }); + } + var result = ""; + if (format !== exports2.FormatTypes.sighash) { + result += "error "; + } + result += this.name + "(" + this.inputs.map(function(input) { + return input.format(format); + }).join(format === exports2.FormatTypes.full ? ", " : ",") + ") "; + return result.trim(); + }; + ErrorFragment2.from = function(value) { + if (typeof value === "string") { + return ErrorFragment2.fromString(value); + } + return ErrorFragment2.fromObject(value); + }; + ErrorFragment2.fromObject = function(value) { + if (ErrorFragment2.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 ErrorFragment2(_constructorGuard, params)); + }; + ErrorFragment2.fromString = function(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(ErrorFragment2.fromObject(params)); + }; + ErrorFragment2.isErrorFragment = function(value) { + return value && value._isFragment && value.type === "error"; + }; + return ErrorFragment2; + }(Fragment) + ); + exports2.ErrorFragment = ErrorFragment; + function verifyType(type) { + if (type.match(/^uint($|[^1-9])/)) { + type = "uint256" + type.substring(4); + } else if (type.match(/^int($|[^1-9])/)) { + type = "int256" + type.substring(3); + } + return type; + } + var regexIdentifier = new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$"); + function verifyIdentifier(value) { + if (!value || !value.match(regexIdentifier)) { + logger.throwArgumentError('invalid identifier "' + 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/coders/abstract-coder.js +var require_abstract_coder = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/abstract-coder.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Reader = exports2.Writer = exports2.Coder = exports2.checkResultErrors = void 0; + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + function checkResultErrors(result) { + var errors = []; + var checkErrors = function(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 }); + } + } + }; + checkErrors([], result); + return errors; + } + exports2.checkResultErrors = checkResultErrors; + var Coder = ( + /** @class */ + function() { + function Coder2(name2, type, localName, dynamic) { + this.name = name2; + this.type = type; + this.localName = localName; + this.dynamic = dynamic; + } + Coder2.prototype._throwError = function(message, value) { + logger.throwArgumentError(message, this.localName, value); + }; + return Coder2; + }() + ); + exports2.Coder = Coder; + var Writer = ( + /** @class */ + function() { + function Writer2(wordSize) { + (0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32); + this._data = []; + this._dataLength = 0; + this._padding = new Uint8Array(wordSize); + } + Object.defineProperty(Writer2.prototype, "data", { + get: function() { + return (0, bytes_1.hexConcat)(this._data); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Writer2.prototype, "length", { + get: function() { + return this._dataLength; + }, + enumerable: false, + configurable: true + }); + Writer2.prototype._writeData = function(data) { + this._data.push(data); + this._dataLength += data.length; + return data.length; + }; + Writer2.prototype.appendWriter = function(writer) { + return this._writeData((0, bytes_1.concat)(writer._data)); + }; + Writer2.prototype.writeBytes = function(value) { + var bytes = (0, bytes_1.arrayify)(value); + var paddingOffset = bytes.length % this.wordSize; + if (paddingOffset) { + bytes = (0, bytes_1.concat)([bytes, this._padding.slice(paddingOffset)]); + } + return this._writeData(bytes); + }; + Writer2.prototype._getValue = function(value) { + var bytes = (0, bytes_1.arrayify)(bignumber_1.BigNumber.from(value)); + if (bytes.length > this.wordSize) { + logger.throwError("value out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: this.wordSize, + offset: bytes.length + }); + } + if (bytes.length % this.wordSize) { + bytes = (0, bytes_1.concat)([this._padding.slice(bytes.length % this.wordSize), bytes]); + } + return bytes; + }; + Writer2.prototype.writeValue = function(value) { + return this._writeData(this._getValue(value)); + }; + Writer2.prototype.writeUpdatableValue = function() { + 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 Writer2; + }() + ); + exports2.Writer = Writer; + var Reader = ( + /** @class */ + function() { + function Reader2(data, wordSize, coerceFunc, allowLoose) { + (0, properties_1.defineReadOnly)(this, "_data", (0, bytes_1.arrayify)(data)); + (0, properties_1.defineReadOnly)(this, "wordSize", wordSize || 32); + (0, properties_1.defineReadOnly)(this, "_coerceFunc", coerceFunc); + (0, properties_1.defineReadOnly)(this, "allowLoose", allowLoose); + this._offset = 0; + } + Object.defineProperty(Reader2.prototype, "data", { + get: function() { + return (0, bytes_1.hexlify)(this._data); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Reader2.prototype, "consumed", { + get: function() { + return this._offset; + }, + enumerable: false, + configurable: true + }); + Reader2.coerce = function(name2, value) { + var match = name2.match("^u?int([0-9]+)$"); + if (match && parseInt(match[1]) <= 48) { + value = value.toNumber(); + } + return value; + }; + Reader2.prototype.coerce = function(name2, value) { + if (this._coerceFunc) { + return this._coerceFunc(name2, value); + } + return Reader2.coerce(name2, value); + }; + Reader2.prototype._peekBytes = function(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", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: this._data.length, + offset: this._offset + alignedLength + }); + } + } + return this._data.slice(this._offset, this._offset + alignedLength); + }; + Reader2.prototype.subReader = function(offset) { + return new Reader2(this._data.slice(this._offset + offset), this.wordSize, this._coerceFunc, this.allowLoose); + }; + Reader2.prototype.readBytes = function(length, loose) { + var bytes = this._peekBytes(0, length, !!loose); + this._offset += bytes.length; + return bytes.slice(0, length); + }; + Reader2.prototype.readValue = function() { + return bignumber_1.BigNumber.from(this.readBytes(this.wordSize)); + }; + return Reader2; + }() + ); + exports2.Reader = Reader; + } +}); + +// node_modules/js-sha3/src/sha3.js +var require_sha3 = __commonJS({ + "node_modules/js-sha3/src/sha3.js"(exports2, module2) { + (function() { + "use strict"; + var INPUT_ERROR = "input is invalid type"; + var FINALIZE_ERROR = "finalize already called"; + var WINDOW = typeof window === "object"; + var root = WINDOW ? window : {}; + if (root.JS_SHA3_NO_WINDOW) { + WINDOW = false; + } + var WEB_WORKER = !WINDOW && typeof self === "object"; + var NODE_JS = !root.JS_SHA3_NO_NODE_JS && 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 && typeof module2 === "object" && module2.exports; + var AMD = typeof define === "function" && define.amd; + 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(bits2, padding, outputType) { + return function(message) { + return new Keccak(bits2, padding, bits2).update(message)[outputType](); + }; + }; + var createShakeOutputMethod = function(bits2, padding, outputType) { + return function(message, outputBits) { + return new Keccak(bits2, padding, outputBits).update(message)[outputType](); + }; + }; + var createCshakeOutputMethod = function(bits2, padding, outputType) { + return function(message, outputBits, n, s) { + return methods["cshake" + bits2].update(message, outputBits, n, s)[outputType](); + }; + }; + var createKmacOutputMethod = function(bits2, padding, outputType) { + return function(key, message, outputBits, s) { + return methods["kmac" + bits2].update(key, message, outputBits, s)[outputType](); + }; + }; + var createOutputMethods = function(method, createMethod2, bits2, padding) { + for (var i2 = 0; i2 < OUTPUT_TYPES.length; ++i2) { + var type = OUTPUT_TYPES[i2]; + method[type] = createMethod2(bits2, padding, type); + } + return method; + }; + var createMethod = function(bits2, padding) { + var method = createOutputMethod(bits2, padding, "hex"); + method.create = function() { + return new Keccak(bits2, padding, bits2); + }; + method.update = function(message) { + return method.create().update(message); + }; + return createOutputMethods(method, createOutputMethod, bits2, padding); + }; + var createShakeMethod = function(bits2, padding) { + var method = createShakeOutputMethod(bits2, padding, "hex"); + method.create = function(outputBits) { + return new Keccak(bits2, padding, outputBits); + }; + method.update = function(message, outputBits) { + return method.create(outputBits).update(message); + }; + return createOutputMethods(method, createShakeOutputMethod, bits2, padding); + }; + var createCshakeMethod = function(bits2, padding) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createCshakeOutputMethod(bits2, padding, "hex"); + method.create = function(outputBits, n, s) { + if (!n && !s) { + return methods["shake" + bits2].create(outputBits); + } else { + return new Keccak(bits2, 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, bits2, padding); + }; + var createKmacMethod = function(bits2, padding) { + var w = CSHAKE_BYTEPAD[bits2]; + var method = createKmacOutputMethod(bits2, padding, "hex"); + method.create = function(key, outputBits, s) { + return new Kmac(bits2, 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, bits2, padding); + }; + var algorithms = [ + { name: "keccak", padding: KECCAK_PADDING, bits: BITS, createMethod }, + { name: "sha3", padding: PADDING, bits: BITS, 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(bits2, 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 - (bits2 << 1) >> 5; + this.byteCount = this.blockCount << 2; + this.outputBlocks = outputBits >> 5; + this.extraBytes = (outputBits & 31) >> 3; + for (var i2 = 0; i2 < 50; ++i2) { + this.s[i2] = 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, i2, code; + while (index < length) { + if (this.reset) { + this.reset = false; + blocks[0] = this.block; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; + } + } + if (notString) { + for (i2 = this.start; index < length && i2 < byteCount; ++index) { + blocks[i2 >> 2] |= message[index] << SHIFT[i2++ & 3]; + } + } else { + for (i2 = this.start; index < length && i2 < byteCount; ++index) { + code = message.charCodeAt(index); + if (code < 128) { + blocks[i2 >> 2] |= code << SHIFT[i2++ & 3]; + } else if (code < 2048) { + blocks[i2 >> 2] |= (192 | code >> 6) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } else if (code < 55296 || code >= 57344) { + blocks[i2 >> 2] |= (224 | code >> 12) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } else { + code = 65536 + ((code & 1023) << 10 | message.charCodeAt(++index) & 1023); + blocks[i2 >> 2] |= (240 | code >> 18) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 12 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code & 63) << SHIFT[i2++ & 3]; + } + } + } + this.lastByteIndex = i2; + if (i2 >= byteCount) { + this.start = i2 - byteCount; + this.block = blocks[blockCount]; + for (i2 = 0; i2 < blockCount; ++i2) { + s[i2] ^= blocks[i2]; + } + f(s); + this.reset = true; + } else { + this.start = i2; + } + } + 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 i2 = 0; i2 < str.length; ++i2) { + var code = str.charCodeAt(i2); + if (code < 128) { + bytes += 1; + } else if (code < 2048) { + bytes += 2; + } else if (code < 55296 || code >= 57344) { + bytes += 3; + } else { + code = 65536 + ((code & 1023) << 10 | str.charCodeAt(++i2) & 1023); + 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 i2 = 0; i2 < strs.length; ++i2) { + bytes += this.encodeString(strs[i2]); + } + 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, i2 = this.lastByteIndex, blockCount = this.blockCount, s = this.s; + blocks[i2 >> 2] |= this.padding[i2 & 3]; + if (this.lastByteIndex === this.byteCount) { + blocks[0] = blocks[blockCount]; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; + } + } + blocks[blockCount - 1] |= 2147483648; + for (i2 = 0; i2 < blockCount; ++i2) { + s[i2] ^= blocks[i2]; + } + f(s); + }; + Keccak.prototype.toString = Keccak.prototype.hex = function() { + this.finalize(); + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 0; + var hex = "", block; + while (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + block = s[i2]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15] + HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15] + HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15] + HEX_CHARS[block >> 28 & 15] + HEX_CHARS[block >> 24 & 15]; + } + if (j2 % blockCount === 0) { + f(s); + i2 = 0; + } + } + if (extraBytes) { + block = s[i2]; + hex += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15]; + if (extraBytes > 1) { + hex += HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15]; + } + if (extraBytes > 2) { + hex += HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15]; + } + } + return hex; + }; + Keccak.prototype.arrayBuffer = function() { + this.finalize(); + var blockCount = this.blockCount, s = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j2 = 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 (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + array[j2] = s[i2]; + } + if (j2 % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + array[i2] = s[i2]; + 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, i2 = 0, j2 = 0; + var array = [], offset, block; + while (j2 < outputBlocks) { + for (i2 = 0; i2 < blockCount && j2 < outputBlocks; ++i2, ++j2) { + offset = j2 << 2; + block = s[i2]; + array[offset] = block & 255; + array[offset + 1] = block >> 8 & 255; + array[offset + 2] = block >> 16 & 255; + array[offset + 3] = block >> 24 & 255; + } + if (j2 % blockCount === 0) { + f(s); + } + } + if (extraBytes) { + offset = j2 << 2; + block = s[i2]; + array[offset] = block & 255; + if (extraBytes > 1) { + array[offset + 1] = block >> 8 & 255; + } + if (extraBytes > 2) { + array[offset + 2] = block >> 16 & 255; + } + } + return array; + }; + function Kmac(bits2, padding, outputBits) { + Keccak.call(this, bits2, padding, outputBits); + } + Kmac.prototype = new Keccak(); + Kmac.prototype.finalize = function() { + this.encode(this.outputBits, true); + return Keccak.prototype.finalize.call(this); + }; + var f = function(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) { + module2.exports = methods; + } else { + for (i = 0; i < methodNames.length; ++i) { + root[methodNames[i]] = methods[methodNames[i]]; + } + if (AMD) { + define(function() { + return methods; + }); + } + } + })(); + } +}); + +// node_modules/@ethersproject/keccak256/lib/index.js +var require_lib5 = __commonJS({ + "node_modules/@ethersproject/keccak256/lib/index.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.keccak256 = void 0; + var js_sha3_1 = __importDefault(require_sha3()); + var bytes_1 = require_lib2(); + function keccak256(data) { + return "0x" + js_sha3_1.default.keccak_256((0, bytes_1.arrayify)(data)); + } + exports2.keccak256 = keccak256; + } +}); + +// node_modules/@ethersproject/rlp/lib/_version.js +var require_version6 = __commonJS({ + "node_modules/@ethersproject/rlp/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "rlp/5.5.0"; + } +}); + +// node_modules/@ethersproject/rlp/lib/index.js +var require_lib6 = __commonJS({ + "node_modules/@ethersproject/rlp/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decode = exports2.encode = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version6(); + var logger = new logger_1.Logger(_version_1.version); + function arrayifyInteger(value) { + var result = []; + while (value) { + result.unshift(value & 255); + 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_1 = []; + object.forEach(function(child) { + payload_1 = payload_1.concat(_encode(child)); + }); + if (payload_1.length <= 55) { + payload_1.unshift(192 + payload_1.length); + return payload_1; + } + var length_1 = arrayifyInteger(payload_1.length); + length_1.unshift(247 + length_1.length); + return length_1.concat(payload_1); + } + if (!(0, bytes_1.isBytesLike)(object)) { + logger.throwArgumentError("RLP object must be BytesLike", "object", object); + } + var data = Array.prototype.slice.call((0, bytes_1.arrayify)(object)); + if (data.length === 1 && data[0] <= 127) { + return data; + } else if (data.length <= 55) { + data.unshift(128 + data.length); + return data; + } + var length = arrayifyInteger(data.length); + length.unshift(183 + length.length); + return length.concat(data); + } + function encode(object) { + return (0, bytes_1.hexlify)(_encode(object)); + } + exports2.encode = encode; + 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", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + } + return { consumed: 1 + length, result }; + } + function _decode(data, offset) { + if (data.length === 0) { + logger.throwError("data too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + if (data[offset] >= 248) { + var lengthLength = data[offset] - 247; + if (offset + 1 + lengthLength > data.length) { + logger.throwError("data short segment too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var length_2 = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length_2 > data.length) { + logger.throwError("data long segment too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length_2); + } else if (data[offset] >= 192) { + var length_3 = data[offset] - 192; + if (offset + 1 + length_3 > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + return _decodeChildren(data, offset, offset + 1, length_3); + } else if (data[offset] >= 184) { + var lengthLength = data[offset] - 183; + if (offset + 1 + lengthLength > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var length_4 = unarrayifyInteger(data, offset + 1, lengthLength); + if (offset + 1 + lengthLength + length_4 > data.length) { + logger.throwError("data array too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var result = (0, bytes_1.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length_4)); + return { consumed: 1 + lengthLength + length_4, result }; + } else if (data[offset] >= 128) { + var length_5 = data[offset] - 128; + if (offset + 1 + length_5 > data.length) { + logger.throwError("data too short", logger_1.Logger.errors.BUFFER_OVERRUN, {}); + } + var result = (0, bytes_1.hexlify)(data.slice(offset + 1, offset + 1 + length_5)); + return { consumed: 1 + length_5, result }; + } + return { consumed: 1, result: (0, bytes_1.hexlify)(data[offset]) }; + } + function decode(data) { + var bytes = (0, bytes_1.arrayify)(data); + var decoded = _decode(bytes, 0); + if (decoded.consumed !== bytes.length) { + logger.throwArgumentError("invalid rlp data", "data", data); + } + return decoded.result; + } + exports2.decode = decode; + } +}); + +// node_modules/@ethersproject/address/lib/_version.js +var require_version7 = __commonJS({ + "node_modules/@ethersproject/address/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "address/5.5.0"; + } +}); + +// node_modules/@ethersproject/address/lib/index.js +var require_lib7 = __commonJS({ + "node_modules/@ethersproject/address/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getCreate2Address = exports2.getContractAddress = exports2.getIcapAddress = exports2.isAddress = exports2.getAddress = void 0; + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var keccak256_1 = require_lib5(); + var rlp_1 = require_lib6(); + var logger_1 = require_lib(); + var _version_1 = require_version7(); + var logger = new logger_1.Logger(_version_1.version); + function getChecksumAddress(address) { + if (!(0, bytes_1.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 i2 = 0; i2 < 40; i2++) { + expanded[i2] = chars[i2].charCodeAt(0); + } + var hashed = (0, bytes_1.arrayify)((0, keccak256_1.keccak256)(expanded)); + for (var i2 = 0; i2 < 40; i2 += 2) { + if (hashed[i2 >> 1] >> 4 >= 8) { + chars[i2] = chars[i2].toUpperCase(); + } + if ((hashed[i2 >> 1] & 15) >= 8) { + chars[i2 + 1] = chars[i2 + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); + } + var MAX_SAFE_INTEGER = 9007199254740991; + function log10(x) { + if (Math.log10) { + return Math.log10(x); + } + return Math.log(x) / Math.LN10; + } + var ibanLookup = {}; + for (i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); + } + var i; + for (i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); + } + var i; + 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(""); + 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}$/)) { + if (address.substring(0, 2) !== "0x") { + address = "0x" + address; + } + result = getChecksumAddress(address); + if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) { + logger.throwArgumentError("bad address checksum", "address", address); + } + } else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + if (address.substring(2, 4) !== ibanChecksum(address)) { + logger.throwArgumentError("bad icap checksum", "address", address); + } + result = (0, bignumber_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; + } + exports2.getAddress = getAddress; + function isAddress(address) { + try { + getAddress(address); + return true; + } catch (error) { + } + return false; + } + exports2.isAddress = isAddress; + function getIcapAddress(address) { + var base36 = (0, bignumber_1._base16To36)(getAddress(address).substring(2)).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; + } + exports2.getIcapAddress = getIcapAddress; + function getContractAddress(transaction) { + var from = null; + try { + from = getAddress(transaction.from); + } catch (error) { + logger.throwArgumentError("missing from address", "transaction", transaction); + } + var nonce = (0, bytes_1.stripZeros)((0, bytes_1.arrayify)(bignumber_1.BigNumber.from(transaction.nonce).toHexString())); + return getAddress((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, rlp_1.encode)([from, nonce])), 12)); + } + exports2.getContractAddress = getContractAddress; + function getCreate2Address(from, salt, initCodeHash) { + if ((0, bytes_1.hexDataLength)(salt) !== 32) { + logger.throwArgumentError("salt must be 32 bytes", "salt", salt); + } + if ((0, bytes_1.hexDataLength)(initCodeHash) !== 32) { + logger.throwArgumentError("initCodeHash must be 32 bytes", "initCodeHash", initCodeHash); + } + return getAddress((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.concat)(["0xff", getAddress(from), salt, initCodeHash])), 12)); + } + exports2.getCreate2Address = getCreate2Address; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/address.js +var require_address = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/address.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AddressCoder = void 0; + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var AddressCoder = ( + /** @class */ + function(_super) { + __extends(AddressCoder2, _super); + function AddressCoder2(localName) { + return _super.call(this, "address", "address", localName, false) || this; + } + AddressCoder2.prototype.defaultValue = function() { + return "0x0000000000000000000000000000000000000000"; + }; + AddressCoder2.prototype.encode = function(writer, value) { + try { + value = (0, address_1.getAddress)(value); + } catch (error) { + this._throwError(error.message, value); + } + return writer.writeValue(value); + }; + AddressCoder2.prototype.decode = function(reader) { + return (0, address_1.getAddress)((0, bytes_1.hexZeroPad)(reader.readValue().toHexString(), 20)); + }; + return AddressCoder2; + }(abstract_coder_1.Coder) + ); + exports2.AddressCoder = AddressCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/anonymous.js +var require_anonymous = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/anonymous.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AnonymousCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var AnonymousCoder = ( + /** @class */ + function(_super) { + __extends(AnonymousCoder2, _super); + function AnonymousCoder2(coder) { + var _this = _super.call(this, coder.name, coder.type, void 0, coder.dynamic) || this; + _this.coder = coder; + return _this; + } + AnonymousCoder2.prototype.defaultValue = function() { + return this.coder.defaultValue(); + }; + AnonymousCoder2.prototype.encode = function(writer, value) { + return this.coder.encode(writer, value); + }; + AnonymousCoder2.prototype.decode = function(reader) { + return this.coder.decode(reader); + }; + return AnonymousCoder2; + }(abstract_coder_1.Coder) + ); + exports2.AnonymousCoder = AnonymousCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/array.js +var require_array = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/array.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ArrayCoder = exports2.unpack = exports2.pack = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var abstract_coder_1 = require_abstract_coder(); + var anonymous_1 = require_anonymous(); + function pack(writer, coders, values) { + var arrayValues = null; + if (Array.isArray(values)) { + arrayValues = values; + } else if (values && typeof values === "object") { + var unique_1 = {}; + arrayValues = coders.map(function(coder) { + var name2 = coder.localName; + if (!name2) { + logger.throwError("cannot encode object for signature with missing names", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + if (unique_1[name2]) { + logger.throwError("cannot encode object for signature with duplicate names", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "values", + coder, + value: values + }); + } + unique_1[name2] = true; + return values[name2]; + }); + } 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_1.Writer(writer.wordSize); + var dynamicWriter = new abstract_coder_1.Writer(writer.wordSize); + var updateFuncs = []; + coders.forEach(function(coder, index) { + var value = arrayValues[index]; + if (coder.dynamic) { + var dynamicOffset_1 = dynamicWriter.length; + coder.encode(dynamicWriter, value); + var updateFunc_1 = staticWriter.writeUpdatableValue(); + updateFuncs.push(function(baseOffset) { + updateFunc_1(baseOffset + dynamicOffset_1); + }); + } else { + coder.encode(staticWriter, value); + } + }); + updateFuncs.forEach(function(func) { + func(staticWriter.length); + }); + var length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; + } + exports2.pack = pack; + function unpack(reader, coders) { + var values = []; + 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) { + if (error.code === logger_1.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) { + if (error.code === logger_1.Logger.errors.BUFFER_OVERRUN) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value != void 0) { + values.push(value); + } + }); + var uniqueNames = coders.reduce(function(accum, coder) { + var name2 = coder.localName; + if (name2) { + if (!accum[name2]) { + accum[name2] = 0; + } + accum[name2]++; + } + return accum; + }, {}); + coders.forEach(function(coder, index) { + var name2 = coder.localName; + if (!name2 || uniqueNames[name2] !== 1) { + return; + } + if (name2 === "length") { + name2 = "_length"; + } + if (values[name2] != null) { + return; + } + var value = values[index]; + if (value instanceof Error) { + Object.defineProperty(values, name2, { + enumerable: true, + get: function() { + throw value; + } + }); + } else { + values[name2] = value; + } + }); + var _loop_1 = function(i2) { + var value = values[i2]; + if (value instanceof Error) { + Object.defineProperty(values, i2, { + enumerable: true, + get: function() { + throw value; + } + }); + } + }; + for (var i = 0; i < values.length; i++) { + _loop_1(i); + } + return Object.freeze(values); + } + exports2.unpack = unpack; + var ArrayCoder = ( + /** @class */ + function(_super) { + __extends(ArrayCoder2, _super); + function ArrayCoder2(coder, length, localName) { + var _this = this; + var type = coder.type + "[" + (length >= 0 ? length : "") + "]"; + var dynamic = length === -1 || coder.dynamic; + _this = _super.call(this, "array", type, localName, dynamic) || this; + _this.coder = coder; + _this.length = length; + return _this; + } + ArrayCoder2.prototype.defaultValue = function() { + var defaultChild = this.coder.defaultValue(); + var result = []; + for (var i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + }; + ArrayCoder2.prototype.encode = function(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); + }; + ArrayCoder2.prototype.decode = function(reader) { + var count = this.length; + if (count === -1) { + count = reader.readValue().toNumber(); + if (count * 32 > reader._data.length) { + logger.throwError("insufficient data length", logger_1.Logger.errors.BUFFER_OVERRUN, { + length: reader._data.length, + count + }); + } + } + var coders = []; + for (var i = 0; i < count; i++) { + coders.push(new anonymous_1.AnonymousCoder(this.coder)); + } + return reader.coerce(this.name, unpack(reader, coders)); + }; + return ArrayCoder2; + }(abstract_coder_1.Coder) + ); + exports2.ArrayCoder = ArrayCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/boolean.js +var require_boolean = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/boolean.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BooleanCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var BooleanCoder = ( + /** @class */ + function(_super) { + __extends(BooleanCoder2, _super); + function BooleanCoder2(localName) { + return _super.call(this, "bool", "bool", localName, false) || this; + } + BooleanCoder2.prototype.defaultValue = function() { + return false; + }; + BooleanCoder2.prototype.encode = function(writer, value) { + return writer.writeValue(value ? 1 : 0); + }; + BooleanCoder2.prototype.decode = function(reader) { + return reader.coerce(this.type, !reader.readValue().isZero()); + }; + return BooleanCoder2; + }(abstract_coder_1.Coder) + ); + exports2.BooleanCoder = BooleanCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/bytes.js +var require_bytes = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/bytes.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BytesCoder = exports2.DynamicBytesCoder = void 0; + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var DynamicBytesCoder = ( + /** @class */ + function(_super) { + __extends(DynamicBytesCoder2, _super); + function DynamicBytesCoder2(type, localName) { + return _super.call(this, type, type, localName, true) || this; + } + DynamicBytesCoder2.prototype.defaultValue = function() { + return "0x"; + }; + DynamicBytesCoder2.prototype.encode = function(writer, value) { + value = (0, bytes_1.arrayify)(value); + var length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + }; + DynamicBytesCoder2.prototype.decode = function(reader) { + return reader.readBytes(reader.readValue().toNumber(), true); + }; + return DynamicBytesCoder2; + }(abstract_coder_1.Coder) + ); + exports2.DynamicBytesCoder = DynamicBytesCoder; + var BytesCoder = ( + /** @class */ + function(_super) { + __extends(BytesCoder2, _super); + function BytesCoder2(localName) { + return _super.call(this, "bytes", localName) || this; + } + BytesCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, bytes_1.hexlify)(_super.prototype.decode.call(this, reader))); + }; + return BytesCoder2; + }(DynamicBytesCoder) + ); + exports2.BytesCoder = BytesCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/fixed-bytes.js +var require_fixed_bytes = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/fixed-bytes.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FixedBytesCoder = void 0; + var bytes_1 = require_lib2(); + var abstract_coder_1 = require_abstract_coder(); + var FixedBytesCoder = ( + /** @class */ + function(_super) { + __extends(FixedBytesCoder2, _super); + function FixedBytesCoder2(size, localName) { + var _this = this; + var name2 = "bytes" + String(size); + _this = _super.call(this, name2, name2, localName, false) || this; + _this.size = size; + return _this; + } + FixedBytesCoder2.prototype.defaultValue = function() { + return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0, 2 + this.size * 2); + }; + FixedBytesCoder2.prototype.encode = function(writer, value) { + var data = (0, bytes_1.arrayify)(value); + if (data.length !== this.size) { + this._throwError("incorrect data length", value); + } + return writer.writeBytes(data); + }; + FixedBytesCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, bytes_1.hexlify)(reader.readBytes(this.size))); + }; + return FixedBytesCoder2; + }(abstract_coder_1.Coder) + ); + exports2.FixedBytesCoder = FixedBytesCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/null.js +var require_null = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/null.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NullCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var NullCoder = ( + /** @class */ + function(_super) { + __extends(NullCoder2, _super); + function NullCoder2(localName) { + return _super.call(this, "null", "", localName, false) || this; + } + NullCoder2.prototype.defaultValue = function() { + return null; + }; + NullCoder2.prototype.encode = function(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes([]); + }; + NullCoder2.prototype.decode = function(reader) { + reader.readBytes(0); + return reader.coerce(this.name, null); + }; + return NullCoder2; + }(abstract_coder_1.Coder) + ); + exports2.NullCoder = NullCoder; + } +}); + +// node_modules/@ethersproject/constants/lib/addresses.js +var require_addresses = __commonJS({ + "node_modules/@ethersproject/constants/lib/addresses.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AddressZero = void 0; + exports2.AddressZero = "0x0000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib/bignumbers.js +var require_bignumbers = __commonJS({ + "node_modules/@ethersproject/constants/lib/bignumbers.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.MaxInt256 = exports2.MinInt256 = exports2.MaxUint256 = exports2.WeiPerEther = exports2.Two = exports2.One = exports2.Zero = exports2.NegativeOne = void 0; + var bignumber_1 = require_lib3(); + var NegativeOne = /* @__PURE__ */ bignumber_1.BigNumber.from(-1); + exports2.NegativeOne = NegativeOne; + var Zero = /* @__PURE__ */ bignumber_1.BigNumber.from(0); + exports2.Zero = Zero; + var One = /* @__PURE__ */ bignumber_1.BigNumber.from(1); + exports2.One = One; + var Two = /* @__PURE__ */ bignumber_1.BigNumber.from(2); + exports2.Two = Two; + var WeiPerEther = /* @__PURE__ */ bignumber_1.BigNumber.from("1000000000000000000"); + exports2.WeiPerEther = WeiPerEther; + var MaxUint256 = /* @__PURE__ */ bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + exports2.MaxUint256 = MaxUint256; + var MinInt256 = /* @__PURE__ */ bignumber_1.BigNumber.from("-0x8000000000000000000000000000000000000000000000000000000000000000"); + exports2.MinInt256 = MinInt256; + var MaxInt256 = /* @__PURE__ */ bignumber_1.BigNumber.from("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + exports2.MaxInt256 = MaxInt256; + } +}); + +// node_modules/@ethersproject/constants/lib/hashes.js +var require_hashes = __commonJS({ + "node_modules/@ethersproject/constants/lib/hashes.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.HashZero = void 0; + exports2.HashZero = "0x0000000000000000000000000000000000000000000000000000000000000000"; + } +}); + +// node_modules/@ethersproject/constants/lib/strings.js +var require_strings = __commonJS({ + "node_modules/@ethersproject/constants/lib/strings.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherSymbol = void 0; + exports2.EtherSymbol = "\u039E"; + } +}); + +// node_modules/@ethersproject/constants/lib/index.js +var require_lib8 = __commonJS({ + "node_modules/@ethersproject/constants/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherSymbol = exports2.HashZero = exports2.MaxInt256 = exports2.MinInt256 = exports2.MaxUint256 = exports2.WeiPerEther = exports2.Two = exports2.One = exports2.Zero = exports2.NegativeOne = exports2.AddressZero = void 0; + var addresses_1 = require_addresses(); + Object.defineProperty(exports2, "AddressZero", { enumerable: true, get: function() { + return addresses_1.AddressZero; + } }); + var bignumbers_1 = require_bignumbers(); + Object.defineProperty(exports2, "NegativeOne", { enumerable: true, get: function() { + return bignumbers_1.NegativeOne; + } }); + Object.defineProperty(exports2, "Zero", { enumerable: true, get: function() { + return bignumbers_1.Zero; + } }); + Object.defineProperty(exports2, "One", { enumerable: true, get: function() { + return bignumbers_1.One; + } }); + Object.defineProperty(exports2, "Two", { enumerable: true, get: function() { + return bignumbers_1.Two; + } }); + Object.defineProperty(exports2, "WeiPerEther", { enumerable: true, get: function() { + return bignumbers_1.WeiPerEther; + } }); + Object.defineProperty(exports2, "MaxUint256", { enumerable: true, get: function() { + return bignumbers_1.MaxUint256; + } }); + Object.defineProperty(exports2, "MinInt256", { enumerable: true, get: function() { + return bignumbers_1.MinInt256; + } }); + Object.defineProperty(exports2, "MaxInt256", { enumerable: true, get: function() { + return bignumbers_1.MaxInt256; + } }); + var hashes_1 = require_hashes(); + Object.defineProperty(exports2, "HashZero", { enumerable: true, get: function() { + return hashes_1.HashZero; + } }); + var strings_1 = require_strings(); + Object.defineProperty(exports2, "EtherSymbol", { enumerable: true, get: function() { + return strings_1.EtherSymbol; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/coders/number.js +var require_number = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/number.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NumberCoder = void 0; + var bignumber_1 = require_lib3(); + var constants_1 = require_lib8(); + var abstract_coder_1 = require_abstract_coder(); + var NumberCoder = ( + /** @class */ + function(_super) { + __extends(NumberCoder2, _super); + function NumberCoder2(size, signed, localName) { + var _this = this; + var name2 = (signed ? "int" : "uint") + size * 8; + _this = _super.call(this, name2, name2, localName, false) || this; + _this.size = size; + _this.signed = signed; + return _this; + } + NumberCoder2.prototype.defaultValue = function() { + return 0; + }; + NumberCoder2.prototype.encode = function(writer, value) { + var v = bignumber_1.BigNumber.from(value); + var maxUintValue = constants_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(constants_1.One).mul(constants_1.NegativeOne))) { + this._throwError("value out-of-bounds", value); + } + } else if (v.lt(constants_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); + }; + NumberCoder2.prototype.decode = function(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 NumberCoder2; + }(abstract_coder_1.Coder) + ); + exports2.NumberCoder = NumberCoder; + } +}); + +// node_modules/@ethersproject/strings/lib/_version.js +var require_version8 = __commonJS({ + "node_modules/@ethersproject/strings/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "strings/5.5.0"; + } +}); + +// node_modules/@ethersproject/strings/lib/utf8.js +var require_utf8 = __commonJS({ + "node_modules/@ethersproject/strings/lib/utf8.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.toUtf8CodePoints = exports2.toUtf8String = exports2._toUtf8String = exports2._toEscapedUtf8String = exports2.toUtf8Bytes = exports2.Utf8ErrorFuncs = exports2.Utf8ErrorReason = exports2.UnicodeNormalizationForm = void 0; + var bytes_1 = require_lib2(); + var logger_1 = require_lib(); + var _version_1 = require_version8(); + var logger = new logger_1.Logger(_version_1.version); + var UnicodeNormalizationForm; + (function(UnicodeNormalizationForm2) { + UnicodeNormalizationForm2["current"] = ""; + UnicodeNormalizationForm2["NFC"] = "NFC"; + UnicodeNormalizationForm2["NFD"] = "NFD"; + UnicodeNormalizationForm2["NFKC"] = "NFKC"; + UnicodeNormalizationForm2["NFKD"] = "NFKD"; + })(UnicodeNormalizationForm = exports2.UnicodeNormalizationForm || (exports2.UnicodeNormalizationForm = {})); + var Utf8ErrorReason; + (function(Utf8ErrorReason2) { + Utf8ErrorReason2["UNEXPECTED_CONTINUE"] = "unexpected continuation byte"; + Utf8ErrorReason2["BAD_PREFIX"] = "bad codepoint prefix"; + Utf8ErrorReason2["OVERRUN"] = "string overrun"; + Utf8ErrorReason2["MISSING_CONTINUE"] = "missing continuation byte"; + Utf8ErrorReason2["OUT_OF_RANGE"] = "out of UTF-8 range"; + Utf8ErrorReason2["UTF16_SURROGATE"] = "UTF-16 surrogate"; + Utf8ErrorReason2["OVERLONG"] = "overlong representation"; + })(Utf8ErrorReason = exports2.Utf8ErrorReason || (exports2.Utf8ErrorReason = {})); + function errorFunc(reason, offset, bytes, output, badCodepoint) { + return logger.throwArgumentError("invalid codepoint at offset " + offset + "; " + reason, "bytes", bytes); + } + function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + 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 !== 2) { + break; + } + i++; + } + return i; + } + if (reason === Utf8ErrorReason.OVERRUN) { + return bytes.length - offset - 1; + } + return 0; + } + function replaceFunc(reason, offset, bytes, output, badCodepoint) { + if (reason === Utf8ErrorReason.OVERLONG) { + output.push(badCodepoint); + return 0; + } + output.push(65533); + return ignoreFunc(reason, offset, bytes, output, badCodepoint); + } + exports2.Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc + }); + function getUtf8CodePoints(bytes, onError) { + if (onError == null) { + onError = exports2.Utf8ErrorFuncs.error; + } + bytes = (0, bytes_1.arrayify)(bytes); + var result = []; + var i = 0; + while (i < bytes.length) { + var c = bytes[i++]; + if (c >> 7 === 0) { + result.push(c); + continue; + } + var extraLength = null; + var overlongMask = null; + if ((c & 224) === 192) { + extraLength = 1; + overlongMask = 127; + } else if ((c & 240) === 224) { + extraLength = 2; + overlongMask = 2047; + } else if ((c & 248) === 240) { + extraLength = 3; + overlongMask = 65535; + } else { + if ((c & 192) === 128) { + i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes, result); + } else { + i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes, result); + } + continue; + } + if (i - 1 + extraLength >= bytes.length) { + i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes, result); + continue; + } + var res = c & (1 << 8 - extraLength - 1) - 1; + for (var j = 0; j < extraLength; j++) { + var nextChar = bytes[i]; + if ((nextChar & 192) != 128) { + i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes, result); + res = null; + break; + } + ; + res = res << 6 | nextChar & 63; + i++; + } + if (res === null) { + continue; + } + if (res > 1114111) { + i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes, result, res); + continue; + } + if (res >= 55296 && res <= 57343) { + i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes, result, res); + continue; + } + if (res <= overlongMask) { + i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; + } + function toUtf8Bytes(str, form) { + if (form === void 0) { + form = 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 < 128) { + result.push(c); + } else if (c < 2048) { + result.push(c >> 6 | 192); + result.push(c & 63 | 128); + } else if ((c & 64512) == 55296) { + i++; + var c2 = str.charCodeAt(i); + if (i >= str.length || (c2 & 64512) !== 56320) { + throw new Error("invalid utf-8 string"); + } + var pair = 65536 + ((c & 1023) << 10) + (c2 & 1023); + result.push(pair >> 18 | 240); + result.push(pair >> 12 & 63 | 128); + result.push(pair >> 6 & 63 | 128); + result.push(pair & 63 | 128); + } else { + result.push(c >> 12 | 224); + result.push(c >> 6 & 63 | 128); + result.push(c & 63 | 128); + } + } + return (0, bytes_1.arrayify)(result); + } + exports2.toUtf8Bytes = toUtf8Bytes; + 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 <= 65535) { + return escapeChar(codePoint); + } + codePoint -= 65536; + return escapeChar((codePoint >> 10 & 1023) + 55296) + escapeChar((codePoint & 1023) + 56320); + }).join("") + '"'; + } + exports2._toEscapedUtf8String = _toEscapedUtf8String; + function _toUtf8String(codePoints) { + return codePoints.map(function(codePoint) { + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); + } + codePoint -= 65536; + return String.fromCharCode((codePoint >> 10 & 1023) + 55296, (codePoint & 1023) + 56320); + }).join(""); + } + exports2._toUtf8String = _toUtf8String; + function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); + } + exports2.toUtf8String = toUtf8String; + function toUtf8CodePoints(str, form) { + if (form === void 0) { + form = UnicodeNormalizationForm.current; + } + return getUtf8CodePoints(toUtf8Bytes(str, form)); + } + exports2.toUtf8CodePoints = toUtf8CodePoints; + } +}); + +// node_modules/@ethersproject/strings/lib/bytes32.js +var require_bytes32 = __commonJS({ + "node_modules/@ethersproject/strings/lib/bytes32.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.parseBytes32String = exports2.formatBytes32String = void 0; + var constants_1 = require_lib8(); + var bytes_1 = require_lib2(); + var utf8_1 = require_utf8(); + function formatBytes32String(text) { + var bytes = (0, utf8_1.toUtf8Bytes)(text); + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([bytes, constants_1.HashZero]).slice(0, 32)); + } + exports2.formatBytes32String = formatBytes32String; + function parseBytes32String(bytes) { + var data = (0, bytes_1.arrayify)(bytes); + 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"); + } + var length = 31; + while (data[length - 1] === 0) { + length--; + } + return (0, utf8_1.toUtf8String)(data.slice(0, length)); + } + exports2.parseBytes32String = parseBytes32String; + } +}); + +// node_modules/@ethersproject/strings/lib/idna.js +var require_idna = __commonJS({ + "node_modules/@ethersproject/strings/lib/idna.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.nameprep = exports2._nameprepTableC = exports2._nameprepTableB2 = exports2._nameprepTableA1 = void 0; + var utf8_1 = require_utf8(); + 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(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"); + 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(value2) { + accum.push(value2); + }); + return accum; + }, []); + } + function _nameprepTableA1(codepoint) { + return !!matchMap(codepoint, Table_A_1_ranges); + } + exports2._nameprepTableA1 = _nameprepTableA1; + 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; + } + exports2._nameprepTableB2 = _nameprepTableB2; + function _nameprepTableC(codepoint) { + return !!matchMap(codepoint, Table_C_ranges); + } + exports2._nameprepTableC = _nameprepTableC; + function nameprep(value) { + if (value.match(/^[a-z0-9-]*$/i) && value.length <= 59) { + return value.toLowerCase(); + } + var codes = (0, utf8_1.toUtf8CodePoints)(value); + codes = flatten(codes.map(function(code) { + if (Table_B_1_flags.indexOf(code) >= 0) { + return []; + } + if (code >= 65024 && code <= 65039) { + return []; + } + var codesTableB2 = _nameprepTableB2(code); + if (codesTableB2) { + return codesTableB2; + } + return [code]; + })); + codes = (0, utf8_1.toUtf8CodePoints)((0, utf8_1._toUtf8String)(codes), utf8_1.UnicodeNormalizationForm.NFKC); + codes.forEach(function(code) { + if (_nameprepTableC(code)) { + throw new Error("STRINGPREP_CONTAINS_PROHIBITED"); + } + }); + codes.forEach(function(code) { + if (_nameprepTableA1(code)) { + throw new Error("STRINGPREP_CONTAINS_UNASSIGNED"); + } + }); + var name2 = (0, utf8_1._toUtf8String)(codes); + if (name2.substring(0, 1) === "-" || name2.substring(2, 4) === "--" || name2.substring(name2.length - 1) === "-") { + throw new Error("invalid hyphen"); + } + if (name2.length > 63) { + throw new Error("too long"); + } + return name2; + } + exports2.nameprep = nameprep; + } +}); + +// node_modules/@ethersproject/strings/lib/index.js +var require_lib9 = __commonJS({ + "node_modules/@ethersproject/strings/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.nameprep = exports2.parseBytes32String = exports2.formatBytes32String = exports2.UnicodeNormalizationForm = exports2.Utf8ErrorReason = exports2.Utf8ErrorFuncs = exports2.toUtf8String = exports2.toUtf8CodePoints = exports2.toUtf8Bytes = exports2._toEscapedUtf8String = void 0; + var bytes32_1 = require_bytes32(); + Object.defineProperty(exports2, "formatBytes32String", { enumerable: true, get: function() { + return bytes32_1.formatBytes32String; + } }); + Object.defineProperty(exports2, "parseBytes32String", { enumerable: true, get: function() { + return bytes32_1.parseBytes32String; + } }); + var idna_1 = require_idna(); + Object.defineProperty(exports2, "nameprep", { enumerable: true, get: function() { + return idna_1.nameprep; + } }); + var utf8_1 = require_utf8(); + Object.defineProperty(exports2, "_toEscapedUtf8String", { enumerable: true, get: function() { + return utf8_1._toEscapedUtf8String; + } }); + Object.defineProperty(exports2, "toUtf8Bytes", { enumerable: true, get: function() { + return utf8_1.toUtf8Bytes; + } }); + Object.defineProperty(exports2, "toUtf8CodePoints", { enumerable: true, get: function() { + return utf8_1.toUtf8CodePoints; + } }); + Object.defineProperty(exports2, "toUtf8String", { enumerable: true, get: function() { + return utf8_1.toUtf8String; + } }); + Object.defineProperty(exports2, "UnicodeNormalizationForm", { enumerable: true, get: function() { + return utf8_1.UnicodeNormalizationForm; + } }); + Object.defineProperty(exports2, "Utf8ErrorFuncs", { enumerable: true, get: function() { + return utf8_1.Utf8ErrorFuncs; + } }); + Object.defineProperty(exports2, "Utf8ErrorReason", { enumerable: true, get: function() { + return utf8_1.Utf8ErrorReason; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/coders/string.js +var require_string = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/string.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.StringCoder = void 0; + var strings_1 = require_lib9(); + var bytes_1 = require_bytes(); + var StringCoder = ( + /** @class */ + function(_super) { + __extends(StringCoder2, _super); + function StringCoder2(localName) { + return _super.call(this, "string", localName) || this; + } + StringCoder2.prototype.defaultValue = function() { + return ""; + }; + StringCoder2.prototype.encode = function(writer, value) { + return _super.prototype.encode.call(this, writer, (0, strings_1.toUtf8Bytes)(value)); + }; + StringCoder2.prototype.decode = function(reader) { + return (0, strings_1.toUtf8String)(_super.prototype.decode.call(this, reader)); + }; + return StringCoder2; + }(bytes_1.DynamicBytesCoder) + ); + exports2.StringCoder = StringCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/coders/tuple.js +var require_tuple = __commonJS({ + "node_modules/@ethersproject/abi/lib/coders/tuple.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TupleCoder = void 0; + var abstract_coder_1 = require_abstract_coder(); + var array_1 = require_array(); + var TupleCoder = ( + /** @class */ + function(_super) { + __extends(TupleCoder2, _super); + function TupleCoder2(coders, localName) { + var _this = this; + 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; + _this.coders = coders; + return _this; + } + TupleCoder2.prototype.defaultValue = function() { + var values = []; + this.coders.forEach(function(coder) { + values.push(coder.defaultValue()); + }); + var uniqueNames = this.coders.reduce(function(accum, coder) { + var name2 = coder.localName; + if (name2) { + if (!accum[name2]) { + accum[name2] = 0; + } + accum[name2]++; + } + return accum; + }, {}); + this.coders.forEach(function(coder, index) { + var name2 = coder.localName; + if (!name2 || uniqueNames[name2] !== 1) { + return; + } + if (name2 === "length") { + name2 = "_length"; + } + if (values[name2] != null) { + return; + } + values[name2] = values[index]; + }); + return Object.freeze(values); + }; + TupleCoder2.prototype.encode = function(writer, value) { + return (0, array_1.pack)(writer, this.coders, value); + }; + TupleCoder2.prototype.decode = function(reader) { + return reader.coerce(this.name, (0, array_1.unpack)(reader, this.coders)); + }; + return TupleCoder2; + }(abstract_coder_1.Coder) + ); + exports2.TupleCoder = TupleCoder; + } +}); + +// node_modules/@ethersproject/abi/lib/abi-coder.js +var require_abi_coder = __commonJS({ + "node_modules/@ethersproject/abi/lib/abi-coder.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.defaultAbiCoder = exports2.AbiCoder = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var abstract_coder_1 = require_abstract_coder(); + var address_1 = require_address(); + var array_1 = require_array(); + var boolean_1 = require_boolean(); + var bytes_2 = require_bytes(); + var fixed_bytes_1 = require_fixed_bytes(); + var null_1 = require_null(); + var number_1 = require_number(); + var string_1 = require_string(); + var tuple_1 = require_tuple(); + var fragments_1 = require_fragments(); + var paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); + var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); + var AbiCoder = ( + /** @class */ + function() { + function AbiCoder2(coerceFunc) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, AbiCoder2); + (0, properties_1.defineReadOnly)(this, "coerceFunc", coerceFunc || null); + } + AbiCoder2.prototype._getCoder = function(param) { + var _this = this; + switch (param.baseType) { + case "address": + return new address_1.AddressCoder(param.name); + case "bool": + return new boolean_1.BooleanCoder(param.name); + case "string": + return new string_1.StringCoder(param.name); + case "bytes": + return new bytes_2.BytesCoder(param.name); + case "array": + return new array_1.ArrayCoder(this._getCoder(param.arrayChildren), param.arrayLength, param.name); + case "tuple": + return new tuple_1.TupleCoder((param.components || []).map(function(component) { + return _this._getCoder(component); + }), param.name); + case "": + return new null_1.NullCoder(param.name); + } + 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 number_1.NumberCoder(size / 8, match[1] === "int", param.name); + } + 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 fixed_bytes_1.FixedBytesCoder(size, param.name); + } + return logger.throwArgumentError("invalid type", "type", param.type); + }; + AbiCoder2.prototype._getWordSize = function() { + return 32; + }; + AbiCoder2.prototype._getReader = function(data, allowLoose) { + return new abstract_coder_1.Reader(data, this._getWordSize(), this.coerceFunc, allowLoose); + }; + AbiCoder2.prototype._getWriter = function() { + return new abstract_coder_1.Writer(this._getWordSize()); + }; + AbiCoder2.prototype.getDefaultValue = function(types) { + var _this = this; + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + return coder.defaultValue(); + }; + AbiCoder2.prototype.encode = function(types, values) { + var _this = this; + if (types.length !== values.length) { + logger.throwError("types/values length mismatch", logger_1.Logger.errors.INVALID_ARGUMENT, { + count: { types: types.length, values: values.length }, + value: { types, values } + }); + } + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + var writer = this._getWriter(); + coder.encode(writer, values); + return writer.data; + }; + AbiCoder2.prototype.decode = function(types, data, loose) { + var _this = this; + var coders = types.map(function(type) { + return _this._getCoder(fragments_1.ParamType.from(type)); + }); + var coder = new tuple_1.TupleCoder(coders, "_"); + return coder.decode(this._getReader((0, bytes_1.arrayify)(data), loose)); + }; + return AbiCoder2; + }() + ); + exports2.AbiCoder = AbiCoder; + exports2.defaultAbiCoder = new AbiCoder(); + } +}); + +// node_modules/@ethersproject/hash/lib/id.js +var require_id = __commonJS({ + "node_modules/@ethersproject/hash/lib/id.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.id = void 0; + var keccak256_1 = require_lib5(); + var strings_1 = require_lib9(); + function id(text) { + return (0, keccak256_1.keccak256)((0, strings_1.toUtf8Bytes)(text)); + } + exports2.id = id; + } +}); + +// node_modules/@ethersproject/hash/lib/_version.js +var require_version9 = __commonJS({ + "node_modules/@ethersproject/hash/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "hash/5.5.0"; + } +}); + +// node_modules/@ethersproject/hash/lib/namehash.js +var require_namehash = __commonJS({ + "node_modules/@ethersproject/hash/lib/namehash.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.namehash = exports2.isValidName = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + var keccak256_1 = require_lib5(); + var logger_1 = require_lib(); + var _version_1 = require_version9(); + var logger = new logger_1.Logger(_version_1.version); + var Zeros = new Uint8Array(32); + Zeros.fill(0); + var Partition = new RegExp("^((.*)\\.)?([^.]+)$"); + function isValidName(name2) { + try { + var comps = name2.split("."); + for (var i = 0; i < comps.length; i++) { + if ((0, strings_1.nameprep)(comps[i]).length === 0) { + throw new Error("empty"); + } + } + return true; + } catch (error) { + } + return false; + } + exports2.isValidName = isValidName; + function namehash(name2) { + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid ENS name; not a string", "name", name2); + } + var current = name2; + var result = Zeros; + while (current.length) { + var partition = current.match(Partition); + if (partition == null || partition[2] === "") { + logger.throwArgumentError("invalid ENS address; missing component", "name", name2); + } + var label = (0, strings_1.toUtf8Bytes)((0, strings_1.nameprep)(partition[3])); + result = (0, keccak256_1.keccak256)((0, bytes_1.concat)([result, (0, keccak256_1.keccak256)(label)])); + current = partition[2] || ""; + } + return (0, bytes_1.hexlify)(result); + } + exports2.namehash = namehash; + } +}); + +// node_modules/@ethersproject/hash/lib/message.js +var require_message = __commonJS({ + "node_modules/@ethersproject/hash/lib/message.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.hashMessage = exports2.messagePrefix = void 0; + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var strings_1 = require_lib9(); + exports2.messagePrefix = "Ethereum Signed Message:\n"; + function hashMessage(message) { + if (typeof message === "string") { + message = (0, strings_1.toUtf8Bytes)(message); + } + return (0, keccak256_1.keccak256)((0, bytes_1.concat)([ + (0, strings_1.toUtf8Bytes)(exports2.messagePrefix), + (0, strings_1.toUtf8Bytes)(String(message.length)), + message + ])); + } + exports2.hashMessage = hashMessage; + } +}); + +// node_modules/@ethersproject/hash/lib/typed-data.js +var require_typed_data = __commonJS({ + "node_modules/@ethersproject/hash/lib/typed-data.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TypedDataEncoder = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version9(); + var logger = new logger_1.Logger(_version_1.version); + var id_1 = require_id(); + var padding = new Uint8Array(32); + padding.fill(0); + var NegativeOne = bignumber_1.BigNumber.from(-1); + var Zero = bignumber_1.BigNumber.from(0); + var One = bignumber_1.BigNumber.from(1); + var MaxUint256 = bignumber_1.BigNumber.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); + function hexPadRight(value) { + var bytes = (0, bytes_1.arrayify)(value); + var padOffset = bytes.length % 32; + if (padOffset) { + return (0, bytes_1.hexConcat)([bytes, padding.slice(padOffset)]); + } + return (0, bytes_1.hexlify)(bytes); + } + var hexTrue = (0, bytes_1.hexZeroPad)(One.toHexString(), 32); + var hexFalse = (0, bytes_1.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 " + JSON.stringify(key), "domain." + key, value); + } + return value; + }; + } + var domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function(value) { + try { + return bignumber_1.BigNumber.from(value).toString(); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value for "chainId"', "domain.chainId", value); + }, + verifyingContract: function(value) { + try { + return (0, address_1.getAddress)(value).toLowerCase(); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value "verifyingContract"', "domain.verifyingContract", value); + }, + salt: function(value) { + try { + var bytes = (0, bytes_1.arrayify)(value); + if (bytes.length !== 32) { + throw new Error("bad length"); + } + return (0, bytes_1.hexlify)(bytes); + } catch (error) { + } + return logger.throwArgumentError('invalid domain value "salt"', "domain.salt", value); + } + }; + function getBaseEncoder(type) { + { + 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_1 = MaxUint256.mask(signed ? width - 1 : width); + var boundsLower_1 = signed ? boundsUpper_1.add(One).mul(NegativeOne) : Zero; + return function(value) { + var v = bignumber_1.BigNumber.from(value); + if (v.lt(boundsLower_1) || v.gt(boundsUpper_1)) { + logger.throwArgumentError("value out-of-bounds for " + type, "value", value); + } + return (0, bytes_1.hexZeroPad)(v.toTwos(256).toHexString(), 32); + }; + } + } + { + var match = type.match(/^bytes(\d+)$/); + if (match) { + var width_1 = parseInt(match[1]); + if (width_1 === 0 || width_1 > 32 || match[1] !== String(width_1)) { + logger.throwArgumentError("invalid bytes width", "type", type); + } + return function(value) { + var bytes = (0, bytes_1.arrayify)(value); + if (bytes.length !== width_1) { + logger.throwArgumentError("invalid length for " + type, "value", value); + } + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": + return function(value) { + return (0, bytes_1.hexZeroPad)((0, address_1.getAddress)(value), 32); + }; + case "bool": + return function(value) { + return !value ? hexFalse : hexTrue; + }; + case "bytes": + return function(value) { + return (0, keccak256_1.keccak256)(value); + }; + case "string": + return function(value) { + return (0, id_1.id)(value); + }; + } + return null; + } + function encodeType(name2, fields) { + return name2 + "(" + fields.map(function(_a) { + var name3 = _a.name, type = _a.type; + return type + " " + name3; + }).join(",") + ")"; + } + var TypedDataEncoder = ( + /** @class */ + function() { + function TypedDataEncoder2(types) { + (0, properties_1.defineReadOnly)(this, "types", Object.freeze((0, properties_1.deepCopy)(types))); + (0, properties_1.defineReadOnly)(this, "_encoderCache", {}); + (0, properties_1.defineReadOnly)(this, "_types", {}); + var links = {}; + var parents = {}; + var subtypes = {}; + Object.keys(types).forEach(function(type) { + links[type] = {}; + parents[type] = []; + subtypes[type] = {}; + }); + var _loop_1 = function(name_12) { + var uniqueNames = {}; + types[name_12].forEach(function(field) { + if (uniqueNames[field.name]) { + logger.throwArgumentError("duplicate variable name " + JSON.stringify(field.name) + " in " + JSON.stringify(name_12), "types", types); + } + uniqueNames[field.name] = true; + var baseType = field.type.match(/^([^\x5b]*)(\x5b|$)/)[1]; + if (baseType === name_12) { + logger.throwArgumentError("circular type reference to " + JSON.stringify(baseType), "types", types); + } + var encoder = getBaseEncoder(baseType); + if (encoder) { + return; + } + if (!parents[baseType]) { + logger.throwArgumentError("unknown type " + JSON.stringify(baseType), "types", types); + } + parents[baseType].push(name_12); + links[name_12][baseType] = true; + }); + }; + for (var name_1 in types) { + _loop_1(name_1); + } + 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: " + primaryTypes.map(function(t) { + return JSON.stringify(t); + }).join(", "), "types", types); + } + (0, properties_1.defineReadOnly)(this, "primaryType", primaryTypes[0]); + function checkCircular(type, found) { + if (found[type]) { + logger.throwArgumentError("circular type reference to " + JSON.stringify(type), "types", types); + } + found[type] = true; + Object.keys(links[type]).forEach(function(child) { + if (!parents[child]) { + return; + } + checkCircular(child, found); + Object.keys(found).forEach(function(subtype) { + subtypes[subtype][child] = true; + }); + }); + delete found[type]; + } + checkCircular(this.primaryType, {}); + for (var name_2 in subtypes) { + var st = Object.keys(subtypes[name_2]); + st.sort(); + this._types[name_2] = encodeType(name_2, types[name_2]) + st.map(function(t) { + return encodeType(t, types[t]); + }).join(""); + } + } + TypedDataEncoder2.prototype.getEncoder = function(type) { + var encoder = this._encoderCache[type]; + if (!encoder) { + encoder = this._encoderCache[type] = this._getEncoder(type); + } + return encoder; + }; + TypedDataEncoder2.prototype._getEncoder = function(type) { + var _this = this; + { + var encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + var subtype_1 = match[1]; + var subEncoder_1 = this.getEncoder(subtype_1); + var length_1 = parseInt(match[3]); + return function(value) { + if (length_1 >= 0 && value.length !== length_1) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + var result = value.map(subEncoder_1); + if (_this._types[subtype_1]) { + result = result.map(keccak256_1.keccak256); + } + return (0, keccak256_1.keccak256)((0, bytes_1.hexConcat)(result)); + }; + } + var fields = this.types[type]; + if (fields) { + var encodedType_1 = (0, id_1.id)(this._types[type]); + return function(value) { + var values = fields.map(function(_a) { + var name2 = _a.name, type2 = _a.type; + var result = _this.getEncoder(type2)(value[name2]); + if (_this._types[type2]) { + return (0, keccak256_1.keccak256)(result); + } + return result; + }); + values.unshift(encodedType_1); + return (0, bytes_1.hexConcat)(values); + }; + } + return logger.throwArgumentError("unknown type: " + type, "type", type); + }; + TypedDataEncoder2.prototype.encodeType = function(name2) { + var result = this._types[name2]; + if (!result) { + logger.throwArgumentError("unknown type: " + JSON.stringify(name2), "name", name2); + } + return result; + }; + TypedDataEncoder2.prototype.encodeData = function(type, value) { + return this.getEncoder(type)(value); + }; + TypedDataEncoder2.prototype.hashStruct = function(name2, value) { + return (0, keccak256_1.keccak256)(this.encodeData(name2, value)); + }; + TypedDataEncoder2.prototype.encode = function(value) { + return this.encodeData(this.primaryType, value); + }; + TypedDataEncoder2.prototype.hash = function(value) { + return this.hashStruct(this.primaryType, value); + }; + TypedDataEncoder2.prototype._visit = function(type, value, callback) { + var _this = this; + { + var encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + var match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + var subtype_2 = match[1]; + var length_2 = parseInt(match[3]); + if (length_2 >= 0 && value.length !== length_2) { + logger.throwArgumentError("array length mismatch; expected length ${ arrayLength }", "value", value); + } + return value.map(function(v) { + return _this._visit(subtype_2, v, callback); + }); + } + var fields = this.types[type]; + if (fields) { + return fields.reduce(function(accum, _a) { + var name2 = _a.name, type2 = _a.type; + accum[name2] = _this._visit(type2, value[name2], callback); + return accum; + }, {}); + } + return logger.throwArgumentError("unknown type: " + type, "type", type); + }; + TypedDataEncoder2.prototype.visit = function(value, callback) { + return this._visit(this.primaryType, value, callback); + }; + TypedDataEncoder2.from = function(types) { + return new TypedDataEncoder2(types); + }; + TypedDataEncoder2.getPrimaryType = function(types) { + return TypedDataEncoder2.from(types).primaryType; + }; + TypedDataEncoder2.hashStruct = function(name2, types, value) { + return TypedDataEncoder2.from(types).hashStruct(name2, value); + }; + TypedDataEncoder2.hashDomain = function(domain) { + var domainFields = []; + for (var name_3 in domain) { + var type = domainFieldTypes[name_3]; + if (!type) { + logger.throwArgumentError("invalid typed-data domain key: " + JSON.stringify(name_3), "domain", domain); + } + domainFields.push({ name: name_3, type }); + } + domainFields.sort(function(a, b) { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder2.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + }; + TypedDataEncoder2.encode = function(domain, types, value) { + return (0, bytes_1.hexConcat)([ + "0x1901", + TypedDataEncoder2.hashDomain(domain), + TypedDataEncoder2.from(types).hash(value) + ]); + }; + TypedDataEncoder2.hash = function(domain, types, value) { + return (0, keccak256_1.keccak256)(TypedDataEncoder2.encode(domain, types, value)); + }; + TypedDataEncoder2.resolveNames = function(domain, types, value, resolveName) { + return __awaiter(this, void 0, void 0, function() { + var ensCache, encoder, _a, _b, _i, name_4, _c, _d; + return __generator(this, function(_e) { + switch (_e.label) { + case 0: + domain = (0, properties_1.shallowCopy)(domain); + ensCache = {}; + if (domain.verifyingContract && !(0, bytes_1.isHexString)(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + encoder = TypedDataEncoder2.from(types); + encoder.visit(value, function(type, value2) { + if (type === "address" && !(0, bytes_1.isHexString)(value2, 20)) { + ensCache[value2] = "0x"; + } + return value2; + }); + _a = []; + for (_b in ensCache) + _a.push(_b); + _i = 0; + _e.label = 1; + case 1: + if (!(_i < _a.length)) return [3, 4]; + name_4 = _a[_i]; + _c = ensCache; + _d = name_4; + return [4, resolveName(name_4)]; + case 2: + _c[_d] = _e.sent(); + _e.label = 3; + case 3: + _i++; + return [3, 1]; + case 4: + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + value = encoder.visit(value, function(type, value2) { + if (type === "address" && ensCache[value2]) { + return ensCache[value2]; + } + return value2; + }); + return [2, { domain, value }]; + } + }); + }); + }; + TypedDataEncoder2.getPayload = function(domain, types, value) { + TypedDataEncoder2.hashDomain(domain); + var domainValues = {}; + var domainTypes = []; + domainFieldNames.forEach(function(name2) { + var value2 = domain[name2]; + if (value2 == null) { + return; + } + domainValues[name2] = domainChecks[name2](value2); + domainTypes.push({ name: name2, type: domainFieldTypes[name2] }); + }); + var encoder = TypedDataEncoder2.from(types); + var typesWithDomain = (0, properties_1.shallowCopy)(types); + if (typesWithDomain.EIP712Domain) { + logger.throwArgumentError("types must not contain EIP712Domain type", "types.EIP712Domain", types); + } else { + typesWithDomain.EIP712Domain = domainTypes; + } + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, function(type, value2) { + if (type.match(/^bytes(\d*)/)) { + return (0, bytes_1.hexlify)((0, bytes_1.arrayify)(value2)); + } + if (type.match(/^u?int/)) { + return bignumber_1.BigNumber.from(value2).toString(); + } + switch (type) { + case "address": + return value2.toLowerCase(); + case "bool": + return !!value2; + case "string": + if (typeof value2 !== "string") { + logger.throwArgumentError("invalid string", "value", value2); + } + return value2; + } + return logger.throwArgumentError("unsupported type", "type", type); + }) + }; + }; + return TypedDataEncoder2; + }() + ); + exports2.TypedDataEncoder = TypedDataEncoder; + } +}); + +// node_modules/@ethersproject/hash/lib/index.js +var require_lib10 = __commonJS({ + "node_modules/@ethersproject/hash/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2._TypedDataEncoder = exports2.hashMessage = exports2.messagePrefix = exports2.isValidName = exports2.namehash = exports2.id = void 0; + var id_1 = require_id(); + Object.defineProperty(exports2, "id", { enumerable: true, get: function() { + return id_1.id; + } }); + var namehash_1 = require_namehash(); + Object.defineProperty(exports2, "isValidName", { enumerable: true, get: function() { + return namehash_1.isValidName; + } }); + Object.defineProperty(exports2, "namehash", { enumerable: true, get: function() { + return namehash_1.namehash; + } }); + var message_1 = require_message(); + Object.defineProperty(exports2, "hashMessage", { enumerable: true, get: function() { + return message_1.hashMessage; + } }); + Object.defineProperty(exports2, "messagePrefix", { enumerable: true, get: function() { + return message_1.messagePrefix; + } }); + var typed_data_1 = require_typed_data(); + Object.defineProperty(exports2, "_TypedDataEncoder", { enumerable: true, get: function() { + return typed_data_1.TypedDataEncoder; + } }); + } +}); + +// node_modules/@ethersproject/abi/lib/interface.js +var require_interface = __commonJS({ + "node_modules/@ethersproject/abi/lib/interface.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Interface = exports2.Indexed = exports2.ErrorDescription = exports2.TransactionDescription = exports2.LogDescription = exports2.checkResultErrors = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var abi_coder_1 = require_abi_coder(); + var abstract_coder_1 = require_abstract_coder(); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return abstract_coder_1.checkResultErrors; + } }); + var fragments_1 = require_fragments(); + var logger_1 = require_lib(); + var _version_1 = require_version5(); + var logger = new logger_1.Logger(_version_1.version); + var LogDescription = ( + /** @class */ + function(_super) { + __extends(LogDescription2, _super); + function LogDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return LogDescription2; + }(properties_1.Description) + ); + exports2.LogDescription = LogDescription; + var TransactionDescription = ( + /** @class */ + function(_super) { + __extends(TransactionDescription2, _super); + function TransactionDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return TransactionDescription2; + }(properties_1.Description) + ); + exports2.TransactionDescription = TransactionDescription; + var ErrorDescription = ( + /** @class */ + function(_super) { + __extends(ErrorDescription2, _super); + function ErrorDescription2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return ErrorDescription2; + }(properties_1.Description) + ); + exports2.ErrorDescription = ErrorDescription; + var Indexed = ( + /** @class */ + function(_super) { + __extends(Indexed2, _super); + function Indexed2() { + return _super !== null && _super.apply(this, arguments) || this; + } + Indexed2.isIndexed = function(value) { + return !!(value && value._isIndexed); + }; + return Indexed2; + }(properties_1.Description) + ); + exports2.Indexed = Indexed; + 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 " + property); + wrap.error = error; + return wrap; + } + var Interface = ( + /** @class */ + function() { + function Interface2(fragments) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Interface2); + var abi = []; + if (typeof fragments === "string") { + abi = JSON.parse(fragments); + } else { + abi = fragments; + } + (0, properties_1.defineReadOnly)(this, "fragments", abi.map(function(fragment) { + return fragments_1.Fragment.from(fragment); + }).filter(function(fragment) { + return fragment != null; + })); + (0, properties_1.defineReadOnly)(this, "_abiCoder", (0, properties_1.getStatic)(_newTarget, "getAbiCoder")()); + (0, properties_1.defineReadOnly)(this, "functions", {}); + (0, properties_1.defineReadOnly)(this, "errors", {}); + (0, properties_1.defineReadOnly)(this, "events", {}); + (0, properties_1.defineReadOnly)(this, "structs", {}); + this.fragments.forEach(function(fragment) { + var bucket = null; + switch (fragment.type) { + case "constructor": + if (_this.deploy) { + logger.warn("duplicate definition - constructor"); + return; + } + (0, properties_1.defineReadOnly)(_this, "deploy", fragment); + return; + case "function": + bucket = _this.functions; + break; + case "event": + 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 (!this.deploy) { + (0, properties_1.defineReadOnly)(this, "deploy", fragments_1.ConstructorFragment.from({ + payable: false, + type: "constructor" + })); + } + (0, properties_1.defineReadOnly)(this, "_isInterface", true); + } + Interface2.prototype.format = function(format) { + if (!format) { + format = fragments_1.FormatTypes.full; + } + if (format === fragments_1.FormatTypes.sighash) { + logger.throwArgumentError("interface does not support formatting sighash", "format", format); + } + var abi = this.fragments.map(function(fragment) { + return fragment.format(format); + }); + if (format === fragments_1.FormatTypes.json) { + return JSON.stringify(abi.map(function(j) { + return JSON.parse(j); + })); + } + return abi; + }; + Interface2.getAbiCoder = function() { + return abi_coder_1.defaultAbiCoder; + }; + Interface2.getAddress = function(address) { + return (0, address_1.getAddress)(address); + }; + Interface2.getSighash = function(fragment) { + return (0, bytes_1.hexDataSlice)((0, hash_1.id)(fragment.format()), 0, 4); + }; + Interface2.getEventTopic = function(eventFragment) { + return (0, hash_1.id)(eventFragment.format()); + }; + Interface2.prototype.getFunction = function(nameOrSignatureOrSighash) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrSighash)) { + for (var name_1 in this.functions) { + if (nameOrSignatureOrSighash === this.getSighash(name_1)) { + return this.functions[name_1]; + } + } + logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var name_2 = nameOrSignatureOrSighash.trim(); + var matching = Object.keys(this.functions).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_2; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching function", "name", name_2); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching functions", "name", name_2); + } + return this.functions[matching[0]]; + } + var result = this.functions[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash); + } + return result; + }; + Interface2.prototype.getEvent = function(nameOrSignatureOrTopic) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrTopic)) { + var topichash = nameOrSignatureOrTopic.toLowerCase(); + for (var name_3 in this.events) { + if (topichash === this.getEventTopic(name_3)) { + return this.events[name_3]; + } + } + logger.throwArgumentError("no matching event", "topichash", topichash); + } + if (nameOrSignatureOrTopic.indexOf("(") === -1) { + var name_4 = nameOrSignatureOrTopic.trim(); + var matching = Object.keys(this.events).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_4; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching event", "name", name_4); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching events", "name", name_4); + } + return this.events[matching[0]]; + } + var result = this.events[fragments_1.EventFragment.fromString(nameOrSignatureOrTopic).format()]; + if (!result) { + logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic); + } + return result; + }; + Interface2.prototype.getError = function(nameOrSignatureOrSighash) { + if ((0, bytes_1.isHexString)(nameOrSignatureOrSighash)) { + var getSighash = (0, properties_1.getStatic)(this.constructor, "getSighash"); + for (var name_5 in this.errors) { + var error = this.errors[name_5]; + if (nameOrSignatureOrSighash === getSighash(error)) { + return this.errors[name_5]; + } + } + logger.throwArgumentError("no matching error", "sighash", nameOrSignatureOrSighash); + } + if (nameOrSignatureOrSighash.indexOf("(") === -1) { + var name_6 = nameOrSignatureOrSighash.trim(); + var matching = Object.keys(this.errors).filter(function(f) { + return f.split( + "(" + /* fix:) */ + )[0] === name_6; + }); + if (matching.length === 0) { + logger.throwArgumentError("no matching error", "name", name_6); + } else if (matching.length > 1) { + logger.throwArgumentError("multiple matching errors", "name", name_6); + } + return this.errors[matching[0]]; + } + var result = this.errors[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()]; + if (!result) { + logger.throwArgumentError("no matching error", "signature", nameOrSignatureOrSighash); + } + return result; + }; + Interface2.prototype.getSighash = function(fragment) { + if (typeof fragment === "string") { + try { + fragment = this.getFunction(fragment); + } catch (error) { + try { + fragment = this.getError(fragment); + } catch (_) { + throw error; + } + } + } + return (0, properties_1.getStatic)(this.constructor, "getSighash")(fragment); + }; + Interface2.prototype.getEventTopic = function(eventFragment) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + return (0, properties_1.getStatic)(this.constructor, "getEventTopic")(eventFragment); + }; + Interface2.prototype._decodeParams = function(params, data) { + return this._abiCoder.decode(params, data); + }; + Interface2.prototype._encodeParams = function(params, values) { + return this._abiCoder.encode(params, values); + }; + Interface2.prototype.encodeDeploy = function(values) { + return this._encodeParams(this.deploy.inputs, values || []); + }; + Interface2.prototype.decodeErrorResult = function(fragment, data) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + var bytes = (0, bytes_1.arrayify)(data); + if ((0, bytes_1.hexlify)(bytes.slice(0, 4)) !== this.getSighash(fragment)) { + logger.throwArgumentError("data signature does not match error " + fragment.name + ".", "data", (0, bytes_1.hexlify)(bytes)); + } + return this._decodeParams(fragment.inputs, bytes.slice(4)); + }; + Interface2.prototype.encodeErrorResult = function(fragment, values) { + if (typeof fragment === "string") { + fragment = this.getError(fragment); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.getSighash(fragment), + this._encodeParams(fragment.inputs, values || []) + ])); + }; + Interface2.prototype.decodeFunctionData = function(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + var bytes = (0, bytes_1.arrayify)(data); + if ((0, bytes_1.hexlify)(bytes.slice(0, 4)) !== this.getSighash(functionFragment)) { + logger.throwArgumentError("data signature does not match function " + functionFragment.name + ".", "data", (0, bytes_1.hexlify)(bytes)); + } + return this._decodeParams(functionFragment.inputs, bytes.slice(4)); + }; + Interface2.prototype.encodeFunctionData = function(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.getSighash(functionFragment), + this._encodeParams(functionFragment.inputs, values || []) + ])); + }; + Interface2.prototype.decodeFunctionResult = function(functionFragment, data) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + var bytes = (0, bytes_1.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 (error2) { + } + break; + case 4: { + var selector = (0, bytes_1.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 (error2) { + console.log(error2); + } + } + break; + } + } + return logger.throwError("call revert exception", logger_1.Logger.errors.CALL_EXCEPTION, { + method: functionFragment.format(), + errorArgs, + errorName, + errorSignature, + reason + }); + }; + Interface2.prototype.encodeFunctionResult = function(functionFragment, values) { + if (typeof functionFragment === "string") { + functionFragment = this.getFunction(functionFragment); + } + return (0, bytes_1.hexlify)(this._abiCoder.encode(functionFragment.outputs, values || [])); + }; + Interface2.prototype.encodeFilterTopics = function(eventFragment, values) { + var _this = this; + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (values.length > eventFragment.inputs.length) { + logger.throwError("too many arguments for " + eventFragment.format(), logger_1.Logger.errors.UNEXPECTED_ARGUMENT, { + argument: "values", + value: values + }); + } + var topics = []; + if (!eventFragment.anonymous) { + topics.push(this.getEventTopic(eventFragment)); + } + var encodeTopic = function(param, value) { + if (param.type === "string") { + return (0, hash_1.id)(value); + } else if (param.type === "bytes") { + return (0, keccak256_1.keccak256)((0, bytes_1.hexlify)(value)); + } + if (param.type === "address") { + _this._abiCoder.encode(["address"], [value]); + } + return (0, bytes_1.hexZeroPad)((0, bytes_1.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(value2) { + return encodeTopic(param, value2); + })); + } else { + topics.push(encodeTopic(param, value)); + } + }); + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + }; + Interface2.prototype.encodeEventLog = function(eventFragment, values) { + var _this = 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((0, hash_1.id)(value)); + } else if (param.type === "bytes") { + topics.push((0, keccak256_1.keccak256)(value)); + } else if (param.baseType === "tuple" || param.baseType === "array") { + throw new Error("not implemented"); + } else { + topics.push(_this._abiCoder.encode([param.type], [value])); + } + } else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: this._abiCoder.encode(dataTypes, dataValues), + topics + }; + }; + Interface2.prototype.decodeEventLog = function(eventFragment, data, topics) { + if (typeof eventFragment === "string") { + eventFragment = this.getEvent(eventFragment); + } + if (topics != null && !eventFragment.anonymous) { + var topicHash = this.getEventTopic(eventFragment); + if (!(0, bytes_1.isHexString)(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { + logger.throwError("fragment/topic mismatch", logger_1.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_1.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, (0, bytes_1.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; + } + } + if (param.name && result[param.name] == null) { + var value_1 = result[index]; + if (value_1 instanceof Error) { + Object.defineProperty(result, param.name, { + enumerable: true, + get: function() { + throw wrapAccessError("property " + JSON.stringify(param.name), value_1); + } + }); + } else { + result[param.name] = value_1; + } + } + }); + var _loop_1 = function(i2) { + var value = result[i2]; + if (value instanceof Error) { + Object.defineProperty(result, i2, { + enumerable: true, + get: function() { + throw wrapAccessError("index " + i2, value); + } + }); + } + }; + for (var i = 0; i < result.length; i++) { + _loop_1(i); + } + return Object.freeze(result); + }; + Interface2.prototype.parseTransaction = function(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: bignumber_1.BigNumber.from(tx.value || "0") + }); + }; + Interface2.prototype.parseLog = function(log) { + var fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + return new LogDescription({ + eventFragment: fragment, + name: fragment.name, + signature: fragment.format(), + topic: this.getEventTopic(fragment), + args: this.decodeEventLog(fragment, log.data, log.topics) + }); + }; + Interface2.prototype.parseError = function(data) { + var hexData = (0, bytes_1.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) + }); + }; + Interface2.isInterface = function(value) { + return !!(value && value._isInterface); + }; + return Interface2; + }() + ); + exports2.Interface = Interface; + } +}); + +// node_modules/@ethersproject/abi/lib/index.js +var require_lib11 = __commonJS({ + "node_modules/@ethersproject/abi/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.TransactionDescription = exports2.LogDescription = exports2.checkResultErrors = exports2.Indexed = exports2.Interface = exports2.defaultAbiCoder = exports2.AbiCoder = exports2.FormatTypes = exports2.ParamType = exports2.FunctionFragment = exports2.Fragment = exports2.EventFragment = exports2.ErrorFragment = exports2.ConstructorFragment = void 0; + var fragments_1 = require_fragments(); + Object.defineProperty(exports2, "ConstructorFragment", { enumerable: true, get: function() { + return fragments_1.ConstructorFragment; + } }); + Object.defineProperty(exports2, "ErrorFragment", { enumerable: true, get: function() { + return fragments_1.ErrorFragment; + } }); + Object.defineProperty(exports2, "EventFragment", { enumerable: true, get: function() { + return fragments_1.EventFragment; + } }); + Object.defineProperty(exports2, "FormatTypes", { enumerable: true, get: function() { + return fragments_1.FormatTypes; + } }); + Object.defineProperty(exports2, "Fragment", { enumerable: true, get: function() { + return fragments_1.Fragment; + } }); + Object.defineProperty(exports2, "FunctionFragment", { enumerable: true, get: function() { + return fragments_1.FunctionFragment; + } }); + Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() { + return fragments_1.ParamType; + } }); + var abi_coder_1 = require_abi_coder(); + Object.defineProperty(exports2, "AbiCoder", { enumerable: true, get: function() { + return abi_coder_1.AbiCoder; + } }); + Object.defineProperty(exports2, "defaultAbiCoder", { enumerable: true, get: function() { + return abi_coder_1.defaultAbiCoder; + } }); + var interface_1 = require_interface(); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return interface_1.checkResultErrors; + } }); + Object.defineProperty(exports2, "Indexed", { enumerable: true, get: function() { + return interface_1.Indexed; + } }); + Object.defineProperty(exports2, "Interface", { enumerable: true, get: function() { + return interface_1.Interface; + } }); + Object.defineProperty(exports2, "LogDescription", { enumerable: true, get: function() { + return interface_1.LogDescription; + } }); + Object.defineProperty(exports2, "TransactionDescription", { enumerable: true, get: function() { + return interface_1.TransactionDescription; + } }); + } +}); + +// node_modules/@ethersproject/abstract-provider/lib/_version.js +var require_version10 = __commonJS({ + "node_modules/@ethersproject/abstract-provider/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abstract-provider/5.5.1"; + } +}); + +// node_modules/@ethersproject/abstract-provider/lib/index.js +var require_lib12 = __commonJS({ + "node_modules/@ethersproject/abstract-provider/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Provider = exports2.TransactionOrderForkEvent = exports2.TransactionForkEvent = exports2.BlockForkEvent = exports2.ForkEvent = void 0; + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version10(); + var logger = new logger_1.Logger(_version_1.version); + var ForkEvent = ( + /** @class */ + function(_super) { + __extends(ForkEvent2, _super); + function ForkEvent2() { + return _super !== null && _super.apply(this, arguments) || this; + } + ForkEvent2.isForkEvent = function(value) { + return !!(value && value._isForkEvent); + }; + return ForkEvent2; + }(properties_1.Description) + ); + exports2.ForkEvent = ForkEvent; + var BlockForkEvent = ( + /** @class */ + function(_super) { + __extends(BlockForkEvent2, _super); + function BlockForkEvent2(blockHash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(blockHash, 32)) { + logger.throwArgumentError("invalid blockHash", "blockHash", blockHash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isBlockForkEvent: true, + expiry: expiry || 0, + blockHash + }) || this; + return _this; + } + return BlockForkEvent2; + }(ForkEvent) + ); + exports2.BlockForkEvent = BlockForkEvent; + var TransactionForkEvent = ( + /** @class */ + function(_super) { + __extends(TransactionForkEvent2, _super); + function TransactionForkEvent2(hash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(hash, 32)) { + logger.throwArgumentError("invalid transaction hash", "hash", hash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isTransactionForkEvent: true, + expiry: expiry || 0, + hash + }) || this; + return _this; + } + return TransactionForkEvent2; + }(ForkEvent) + ); + exports2.TransactionForkEvent = TransactionForkEvent; + var TransactionOrderForkEvent = ( + /** @class */ + function(_super) { + __extends(TransactionOrderForkEvent2, _super); + function TransactionOrderForkEvent2(beforeHash, afterHash, expiry) { + var _this = this; + if (!(0, bytes_1.isHexString)(beforeHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash); + } + if (!(0, bytes_1.isHexString)(afterHash, 32)) { + logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash); + } + _this = _super.call(this, { + _isForkEvent: true, + _isTransactionOrderForkEvent: true, + expiry: expiry || 0, + beforeHash, + afterHash + }) || this; + return _this; + } + return TransactionOrderForkEvent2; + }(ForkEvent) + ); + exports2.TransactionOrderForkEvent = TransactionOrderForkEvent; + var Provider = ( + /** @class */ + function() { + function Provider2() { + var _newTarget = this.constructor; + logger.checkAbstract(_newTarget, Provider2); + (0, properties_1.defineReadOnly)(this, "_isProvider", true); + } + Provider2.prototype.getFeeData = function() { + return __awaiter(this, void 0, void 0, function() { + var _a, block, gasPrice, maxFeePerGas, maxPriorityFeePerGas; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, (0, properties_1.resolveProperties)({ + block: this.getBlock("latest"), + gasPrice: this.getGasPrice().catch(function(error) { + return null; + }) + })]; + case 1: + _a = _b.sent(), block = _a.block, gasPrice = _a.gasPrice; + maxFeePerGas = null, maxPriorityFeePerGas = null; + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = bignumber_1.BigNumber.from("2500000000"); + maxFeePerGas = block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas); + } + return [2, { maxFeePerGas, maxPriorityFeePerGas, gasPrice }]; + } + }); + }); + }; + Provider2.prototype.addListener = function(eventName, listener) { + return this.on(eventName, listener); + }; + Provider2.prototype.removeListener = function(eventName, listener) { + return this.off(eventName, listener); + }; + Provider2.isProvider = function(value) { + return !!(value && value._isProvider); + }; + return Provider2; + }() + ); + exports2.Provider = Provider; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib/_version.js +var require_version11 = __commonJS({ + "node_modules/@ethersproject/abstract-signer/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "abstract-signer/5.5.0"; + } +}); + +// node_modules/@ethersproject/abstract-signer/lib/index.js +var require_lib13 = __commonJS({ + "node_modules/@ethersproject/abstract-signer/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.VoidSigner = exports2.Signer = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version11(); + var logger = new logger_1.Logger(_version_1.version); + var allowedTransactionKeys = [ + "accessList", + "chainId", + "customData", + "data", + "from", + "gasLimit", + "gasPrice", + "maxFeePerGas", + "maxPriorityFeePerGas", + "nonce", + "to", + "type", + "value" + ]; + var forwardErrors = [ + logger_1.Logger.errors.INSUFFICIENT_FUNDS, + logger_1.Logger.errors.NONCE_EXPIRED, + logger_1.Logger.errors.REPLACEMENT_UNDERPRICED + ]; + var Signer = ( + /** @class */ + function() { + function Signer2() { + var _newTarget = this.constructor; + logger.checkAbstract(_newTarget, Signer2); + (0, properties_1.defineReadOnly)(this, "_isSigner", true); + } + Signer2.prototype.getBalance = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getBalance"); + return [4, this.provider.getBalance(this.getAddress(), blockTag)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getTransactionCount = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getTransactionCount"); + return [4, this.provider.getTransactionCount(this.getAddress(), blockTag)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.estimateGas = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("estimateGas"); + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + return [4, this.provider.estimateGas(tx)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.call = function(transaction, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("call"); + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + return [4, this.provider.call(tx, blockTag)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.sendTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx, signedTx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("sendTransaction"); + return [4, this.populateTransaction(transaction)]; + case 1: + tx = _a.sent(); + return [4, this.signTransaction(tx)]; + case 2: + signedTx = _a.sent(); + return [4, this.provider.sendTransaction(signedTx)]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getChainId = function() { + return __awaiter(this, void 0, void 0, function() { + var network; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getChainId"); + return [4, this.provider.getNetwork()]; + case 1: + network = _a.sent(); + return [2, network.chainId]; + } + }); + }); + }; + Signer2.prototype.getGasPrice = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getGasPrice"); + return [4, this.provider.getGasPrice()]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.getFeeData = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("getFeeData"); + return [4, this.provider.getFeeData()]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.resolveName = function(name2) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + this._checkProvider("resolveName"); + return [4, this.provider.resolveName(name2)]; + case 1: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype.checkTransaction = function(transaction) { + for (var key in transaction) { + if (allowedTransactionKeys.indexOf(key) === -1) { + logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction); + } + } + var tx = (0, properties_1.shallowCopy)(transaction); + if (tx.from == null) { + tx.from = this.getAddress(); + } else { + 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; + }; + Signer2.prototype.populateTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var tx, hasEip1559, feeData, gasPrice; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, (0, properties_1.resolveProperties)(this.checkTransaction(transaction))]; + case 1: + tx = _a.sent(); + if (tx.to != null) { + tx.to = Promise.resolve(tx.to).then(function(to) { + return __awaiter(_this, void 0, void 0, function() { + var address; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + if (to == null) { + return [2, null]; + } + return [4, this.resolveName(to)]; + case 1: + address = _a2.sent(); + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return [2, address]; + } + }); + }); + }); + tx.to.catch(function(error) { + }); + } + 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))) return [3, 2]; + tx.type = 2; + return [3, 5]; + case 2: + if (!(tx.type === 0 || tx.type === 1)) return [3, 3]; + if (tx.gasPrice == null) { + tx.gasPrice = this.getGasPrice(); + } + return [3, 5]; + case 3: + return [4, this.getFeeData()]; + case 4: + feeData = _a.sent(); + if (tx.type == null) { + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + tx.type = 2; + if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + delete tx.gasPrice; + tx.maxFeePerGas = gasPrice; + tx.maxPriorityFeePerGas = gasPrice; + } else { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } else if (feeData.gasPrice != null) { + if (hasEip1559) { + logger.throwError("network does not support EIP-1559", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "populateTransaction" + }); + } + if (tx.gasPrice == null) { + tx.gasPrice = feeData.gasPrice; + } + tx.type = 0; + } else { + logger.throwError("failed to get consistent fee data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signer.getFeeData" + }); + } + } else if (tx.type === 2) { + if (tx.maxFeePerGas == null) { + tx.maxFeePerGas = feeData.maxFeePerGas; + } + if (tx.maxPriorityFeePerGas == null) { + tx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + _a.label = 5; + case 5: + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + 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]; + }); + } + return [4, (0, properties_1.resolveProperties)(tx)]; + case 6: + return [2, _a.sent()]; + } + }); + }); + }; + Signer2.prototype._checkProvider = function(operation) { + if (!this.provider) { + logger.throwError("missing provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: operation || "_checkProvider" + }); + } + }; + Signer2.isSigner = function(value) { + return !!(value && value._isSigner); + }; + return Signer2; + }() + ); + exports2.Signer = Signer; + var VoidSigner = ( + /** @class */ + function(_super) { + __extends(VoidSigner2, _super); + function VoidSigner2(address, provider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, VoidSigner2); + _this = _super.call(this) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "provider", provider || null); + return _this; + } + VoidSigner2.prototype.getAddress = function() { + return Promise.resolve(this.address); + }; + VoidSigner2.prototype._fail = function(message, operation) { + return Promise.resolve().then(function() { + logger.throwError(message, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation }); + }); + }; + VoidSigner2.prototype.signMessage = function(message) { + return this._fail("VoidSigner cannot sign messages", "signMessage"); + }; + VoidSigner2.prototype.signTransaction = function(transaction) { + return this._fail("VoidSigner cannot sign transactions", "signTransaction"); + }; + VoidSigner2.prototype._signTypedData = function(domain, types, value) { + return this._fail("VoidSigner cannot sign typed data", "signTypedData"); + }; + VoidSigner2.prototype.connect = function(provider) { + return new VoidSigner2(this.address, provider); + }; + return VoidSigner2; + }(Signer) + ); + exports2.VoidSigner = VoidSigner; + } +}); + +// node_modules/elliptic/package.json +var require_package = __commonJS({ + "node_modules/elliptic/package.json"(exports2, module2) { + module2.exports = { + name: "elliptic", + version: "6.5.4", + description: "EC cryptography", + main: "lib/elliptic.js", + files: [ + "lib" + ], + scripts: { + lint: "eslint lib test", + "lint:fix": "npm run lint -- --fix", + unit: "istanbul test _mocha --reporter=spec test/index.js", + test: "npm run lint && npm run unit", + version: "grunt dist && git add dist/" + }, + repository: { + type: "git", + url: "git@github.com:indutny/elliptic" + }, + keywords: [ + "EC", + "Elliptic", + "curve", + "Cryptography" + ], + author: "Fedor Indutny ", + license: "MIT", + bugs: { + url: "https://github.com/indutny/elliptic/issues" + }, + homepage: "https://github.com/indutny/elliptic", + devDependencies: { + brfs: "^2.0.2", + coveralls: "^3.1.0", + eslint: "^7.6.0", + grunt: "^1.2.1", + "grunt-browserify": "^5.3.0", + "grunt-cli": "^1.3.2", + "grunt-contrib-connect": "^3.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^5.0.0", + "grunt-mocha-istanbul": "^5.0.2", + "grunt-saucelabs": "^9.0.1", + istanbul: "^0.4.5", + mocha: "^8.0.1" + }, + dependencies: { + "bn.js": "^4.11.9", + brorand: "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + inherits: "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }; + } +}); + +// node_modules/minimalistic-assert/index.js +var require_minimalistic_assert = __commonJS({ + "node_modules/minimalistic-assert/index.js"(exports2, module2) { + module2.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/minimalistic-crypto-utils/lib/utils.js +var require_utils = __commonJS({ + "node_modules/minimalistic-crypto-utils/lib/utils.js"(exports2) { + "use strict"; + var utils = exports2; + 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 & 255; + 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; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/utils.js +var require_utils2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/utils.js"(exports2) { + "use strict"; + var utils = exports2; + var BN = require_bn(); + var minAssert = require_minimalistic_assert(); + var minUtils = require_utils(); + utils.assert = minAssert; + utils.toArray = minUtils.toArray; + utils.zero2 = minUtils.zero2; + utils.toHex = minUtils.toHex; + utils.encode = minUtils.encode; + 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; + 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) { + 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); + 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, name2, computer) { + var key = "_" + name2; + obj.prototype[name2] = function cachedProperty2() { + return this[key] !== void 0 ? 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(bytes, "hex", "le"); + } + utils.intFromLE = intFromLE; + } +}); + +// node_modules/brorand/index.js +var require_brorand = __commonJS({ + "node_modules/brorand/index.js"(exports2, module2) { + var r; + module2.exports = function rand(len) { + if (!r) + r = new Rand(null); + return r.generate(len); + }; + function Rand(rand) { + this.rand = rand; + } + module2.exports.Rand = Rand; + Rand.prototype.generate = function generate(len) { + return this._rand(len); + }; + Rand.prototype._rand = function _rand(n) { + if (this.rand.getBytes) + return this.rand.getBytes(n); + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; + }; + if (typeof self === "object") { + if (self.crypto && self.crypto.getRandomValues) { + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.crypto.getRandomValues(arr); + return arr; + }; + } else if (self.msCrypto && self.msCrypto.getRandomValues) { + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.msCrypto.getRandomValues(arr); + return arr; + }; + } else if (typeof window === "object") { + Rand.prototype._rand = function() { + throw new Error("Not implemented yet"); + }; + } + } else { + try { + crypto2 = require("crypto"); + if (typeof crypto2.randomBytes !== "function") + throw new Error("Not supported"); + Rand.prototype._rand = function _rand(n) { + return crypto2.randomBytes(n); + }; + } catch (e) { + } + } + var crypto2; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/base.js +var require_base = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/base.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var getNAF = utils.getNAF; + var getJSF = utils.getJSF; + var assert = utils.assert; + function BaseCurve(type, conf) { + this.type = type; + this.p = new BN(conf.p, 16); + this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); + this.zero = new BN(0).toRed(this.red); + this.one = new BN(1).toRed(this.red); + this.two = new BN(2).toRed(this.red); + this.n = conf.n && new BN(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + 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; + 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); + } + } + module2.exports = 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(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; + 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; + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + var naf = getNAF(k, w, this._bitLength); + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + 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(z !== 0); + if (p.type === "affine") { + if (z > 0) + acc = acc.mixedAdd(wnd[z - 1 >> 1]); + else + acc = acc.mixedAdd(wnd[-z - 1 >> 1].neg()); + } else { + 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; + 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; + } + 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 */ + ]; + 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); + } + } + 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 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.toArray(bytes, enc); + var len = this.p.byteLength(); + if ((bytes[0] === 4 || bytes[0] === 6 || bytes[0] === 7) && bytes.length - 1 === 2 * len) { + if (bytes[0] === 6) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 7) + assert(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] === 2 || bytes[0] === 3) && bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 3); + } + 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() ? 2 : 3].concat(x); + return [4].concat(x, this.getY().toArray("be", len)); + }; + BasePoint.prototype.encode = function encode(enc, compact) { + return utils.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, + 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, + 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; + }; + } +}); + +// node_modules/inherits/inherits_browser.js +var require_inherits_browser = __commonJS({ + "node_modules/inherits/inherits_browser.js"(exports2, module2) { + if (typeof Object.create === "function") { + module2.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 { + module2.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor; + var TempCtor = function() { + }; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + }; + } + } +}); + +// node_modules/inherits/inherits.js +var require_inherits = __commonJS({ + "node_modules/inherits/inherits.js"(exports2, module2) { + try { + util = require("util"); + if (typeof util.inherits !== "function") throw ""; + module2.exports = util.inherits; + } catch (e) { + module2.exports = require_inherits_browser(); + } + var util; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/short.js +var require_short = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/short.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var assert = utils.assert; + function ShortCurve(conf) { + Base.call(this, "short", conf); + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(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; + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); + } + inherits(ShortCurve, Base); + module2.exports = ShortCurve; + ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + var beta; + var lambda; + if (conf.beta) { + beta = new BN(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new BN(conf.lambda, 16); + } else { + 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(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new BN(vec.a, 16), + b: new BN(vec.b, 16) + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + return { + beta, + lambda, + basis + }; + }; + ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + var red = num === this.p ? this.red : BN.mont(num); + var tinv = new BN(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + var s = new BN(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) { + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + var u = lambda; + var v = this.n.clone(); + var x1 = new BN(1); + var y1 = new BN(0); + var x2 = new BN(0); + var y2 = new BN(1); + var a0; + var b0; + var a1; + var b1; + 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; + } + 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); + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1, k2 }; + }; + ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(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"); + 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); + 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(x, 16); + this.y = new BN(y, 16); + 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(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(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(obj2) { + return curve.point(obj2[0], obj2[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) { + if (this.inf) + return p; + if (p.inf) + return this; + if (this.eq(p)) + return this.dbl(); + if (this.neg().eq(p)) + return this.curve.point(null, null); + 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; + 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(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(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(0); + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = new BN(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(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) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + 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) { + if (this.isInfinity()) + return p.toJ(); + if (p.isInfinity()) + return this; + 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; + } + 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(); + 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; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + var m = xx.redAdd(xx).redIAdd(xx); + var t = m.redSqr().redISub(s).redISub(s); + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + nx = t; + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var a = this.x.redSqr(); + var b = this.y.redSqr(); + var c = b.redSqr(); + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + var e = a.redAdd(a).redIAdd(a); + var f = e.redSqr(); + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + nx = f.redISub(d).redISub(d); + ny = e.redMul(d.redISub(nx)).redISub(c8); + 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; + if (this.zOne) { + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var yyyy = yy.redSqr(); + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + var t = m.redSqr().redISub(s).redISub(s); + nx = t; + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + nz = this.y.redAdd(this.y); + } else { + var delta = this.z.redSqr(); + var gamma = this.y.redSqr(); + var beta = this.x.redMul(gamma); + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + 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; + 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); + var xx = this.x.redSqr(); + var yy = this.y.redSqr(); + var zz = this.z.redSqr(); + var yyyy = yy.redSqr(); + var m = xx.redAdd(xx).redIAdd(xx); + var mm = m.redSqr(); + 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); + var ee = e.redSqr(); + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + 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); + 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); + 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(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; + 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; + 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() { + return this.z.cmpn(0) === 0; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/mont.js +var require_mont = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/mont.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var utils = require_utils2(); + function MontCurve(conf) { + Base.call(this, "mont", conf); + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.i4 = new BN(4).toRed(this.red).redInvm(); + this.two = new BN(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); + } + inherits(MontCurve, Base); + module2.exports = MontCurve; + MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + return y.redSqr().cmp(rhs) === 0; + }; + function Point(curve, x, z) { + Base.BasePoint.call(this, curve, "projective"); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new BN(x, 16); + this.z = new BN(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } + } + inherits(Point, Base.BasePoint); + MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + return this.point(utils.toArray(bytes, enc), 1); + }; + MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); + }; + MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); + }; + Point.prototype.precompute = function precompute() { + }; + Point.prototype._encode = function _encode() { + return this.getX().toArray("be", this.curve.p.byteLength()); + }; + Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); + }; + Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ""; + return ""; + }; + Point.prototype.isInfinity = function isInfinity() { + return this.z.cmpn(0) === 0; + }; + Point.prototype.dbl = function dbl() { + var a = this.x.redAdd(this.z); + var aa = a.redSqr(); + var b = this.x.redSub(this.z); + var bb = b.redSqr(); + var c = aa.redSub(bb); + var nx = aa.redMul(bb); + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); + }; + Point.prototype.add = function add() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.diffAdd = function diffAdd(p, diff) { + var a = this.x.redAdd(this.z); + var b = this.x.redSub(this.z); + var c = p.x.redAdd(p.z); + var d = p.x.redSub(p.z); + var da = d.redMul(a); + var cb = c.redMul(b); + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); + }; + Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; + var b = this.curve.point(null, null); + var c = this; + for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) + bits.push(t.andln(1)); + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + a = a.diffAdd(b, c); + b = b.dbl(); + } else { + b = a.diffAdd(b, c); + a = a.dbl(); + } + } + return b; + }; + Point.prototype.mulAdd = function mulAdd() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.jumlAdd = function jumlAdd() { + throw new Error("Not supported on Montgomery curve"); + }; + Point.prototype.eq = function eq(other) { + return this.getX().cmp(other.getX()) === 0; + }; + Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; + }; + Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/edwards.js +var require_edwards = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/edwards.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var BN = require_bn(); + var inherits = require_inherits(); + var Base = require_base(); + var assert = utils.assert; + function EdwardsCurve(conf) { + this.twisted = (conf.a | 0) !== 1; + this.mOneA = this.twisted && (conf.a | 0) === -1; + this.extended = this.mOneA; + Base.call(this, "edwards", conf); + this.a = new BN(conf.a, 16).umod(this.red.m); + this.a = this.a.toRed(this.red); + this.c = new BN(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new BN(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = (conf.c | 0) === 1; + } + inherits(EdwardsCurve, Base); + module2.exports = EdwardsCurve; + EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); + }; + EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); + }; + EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); + }; + EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + var y2 = rhs.redMul(lhs.redInvm()); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error("invalid point"); + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + return this.point(x, y); + }; + EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { + y = new BN(y, 16); + if (!y.red) + y = y.toRed(this.red); + var y2 = y.redSqr(); + var lhs = y2.redSub(this.c2); + var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a); + var x2 = lhs.redMul(rhs.redInvm()); + if (x2.cmp(this.zero) === 0) { + if (odd) + throw new Error("invalid point"); + else + return this.point(this.zero, y); + } + var x = x2.redSqrt(); + if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) + throw new Error("invalid point"); + if (x.fromRed().isOdd() !== odd) + x = x.redNeg(); + return this.point(x, y); + }; + EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + point.normalize(); + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + return lhs.cmp(rhs) === 0; + }; + function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, "projective"); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = z ? new BN(z, 16) : this.curve.one; + this.t = t && new BN(t, 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); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } + } + inherits(Point, Base.BasePoint); + EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); + }; + EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); + }; + Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); + }; + Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ""; + return ""; + }; + Point.prototype.isInfinity = function isInfinity() { + return this.x.cmpn(0) === 0 && (this.y.cmp(this.z) === 0 || this.zOne && this.y.cmp(this.curve.c) === 0); + }; + Point.prototype._extDbl = function _extDbl() { + var a = this.x.redSqr(); + var b = this.y.redSqr(); + var c = this.z.redSqr(); + c = c.redIAdd(c); + var d = this.curve._mulA(a); + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + var g = d.redAdd(b); + var f = g.redSub(c); + var h = d.redSub(b); + var nx = e.redMul(f); + var ny = g.redMul(h); + var nt = e.redMul(h); + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); + }; + Point.prototype._projDbl = function _projDbl() { + var b = this.x.redAdd(this.y).redSqr(); + var c = this.x.redSqr(); + var d = this.y.redSqr(); + var nx; + var ny; + var nz; + var e; + var h; + var j; + if (this.curve.twisted) { + e = this.curve._mulA(c); + var f = e.redAdd(d); + if (this.zOne) { + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + ny = f.redMul(e.redSub(d)); + nz = f.redSqr().redSub(f).redSub(f); + } else { + h = this.z.redSqr(); + j = f.redSub(h).redISub(h); + nx = b.redSub(c).redISub(d).redMul(j); + ny = f.redMul(e.redSub(d)); + nz = f.redMul(j); + } + } else { + e = c.redAdd(d); + h = this.curve._mulC(this.z).redSqr(); + j = e.redSub(h).redSub(h); + nx = this.curve._mulC(b.redISub(e)).redMul(j); + ny = this.curve._mulC(e).redMul(c.redISub(d)); + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); + }; + Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); + }; + Point.prototype._extAdd = function _extAdd(p) { + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + var c = this.t.redMul(this.curve.dd).redMul(p.t); + var d = this.z.redMul(p.z.redAdd(p.z)); + var e = b.redSub(a); + var f = d.redSub(c); + var g = d.redAdd(c); + var h = b.redAdd(a); + var nx = e.redMul(f); + var ny = g.redMul(h); + var nt = e.redMul(h); + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); + }; + Point.prototype._projAdd = function _projAdd(p) { + var a = this.z.redMul(p.z); + var b = a.redSqr(); + var c = this.x.redMul(p.x); + var d = this.y.redMul(p.y); + var e = this.curve.d.redMul(c).redMul(d); + var f = b.redSub(e); + var g = b.redAdd(e); + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + var ny; + var nz; + if (this.curve.twisted) { + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + nz = f.redMul(g); + } else { + ny = a.redMul(g).redMul(d.redSub(c)); + nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); + }; + Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); + }; + Point.prototype.mul = function mul(k) { + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); + }; + Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, false); + }; + Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [this, p], [k1, k2], 2, true); + }; + Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; + }; + Point.prototype.neg = function neg() { + return this.curve.point( + this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg() + ); + }; + Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); + }; + Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); + }; + Point.prototype.eq = function eq(other) { + return this === other || this.getX().cmp(other.getX()) === 0 && this.getY().cmp(other.getY()) === 0; + }; + Point.prototype.eqXToP = function eqXToP(x) { + var rx = x.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(rx) === 0) + return true; + var xc = x.clone(); + var t = this.curve.redN.redMul(this.z); + 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; + } + }; + Point.prototype.toP = Point.prototype.normalize; + Point.prototype.mixedAdd = Point.prototype.add; + } +}); + +// node_modules/elliptic/lib/elliptic/curve/index.js +var require_curve = __commonJS({ + "node_modules/elliptic/lib/elliptic/curve/index.js"(exports2) { + "use strict"; + var curve = exports2; + curve.base = require_base(); + curve.short = require_short(); + curve.mont = require_mont(); + curve.edwards = require_edwards(); + } +}); + +// node_modules/hash.js/lib/hash/utils.js +var require_utils3 = __commonJS({ + "node_modules/hash.js/lib/hash/utils.js"(exports2) { + "use strict"; + var assert = require_minimalistic_assert(); + var inherits = require_inherits(); + exports2.inherits = inherits; + function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 64512) !== 55296) { + return false; + } + if (i < 0 || i + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i + 1) & 64512) === 56320; + } + function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === "string") { + if (!enc) { + 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 = 65536 + ((c & 1023) << 10) + (msg.charCodeAt(++i) & 1023); + 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; + } + exports2.toArray = toArray; + function toHex(msg) { + var res = ""; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; + } + exports2.toHex = toHex; + function htonl(w) { + var res = w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (w & 255) << 24; + return res >>> 0; + } + exports2.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; + } + exports2.toHex32 = toHex32; + function zero2(word) { + if (word.length === 1) + return "0" + word; + else + return word; + } + exports2.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; + } + exports2.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; + } + exports2.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 & 255; + res[k + 2] = m >>> 8 & 255; + res[k + 3] = m & 255; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = m >>> 16 & 255; + res[k + 1] = m >>> 8 & 255; + res[k] = m & 255; + } + } + return res; + } + exports2.split32 = split32; + function rotr32(w, b) { + return w >>> b | w << 32 - b; + } + exports2.rotr32 = rotr32; + function rotl32(w, b) { + return w << b | w >>> 32 - b; + } + exports2.rotl32 = rotl32; + function sum32(a, b) { + return a + b >>> 0; + } + exports2.sum32 = sum32; + function sum32_3(a, b, c) { + return a + b + c >>> 0; + } + exports2.sum32_3 = sum32_3; + function sum32_4(a, b, c, d) { + return a + b + c + d >>> 0; + } + exports2.sum32_4 = sum32_4; + function sum32_5(a, b, c, d, e) { + return a + b + c + d + e >>> 0; + } + exports2.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; + } + exports2.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; + } + exports2.sum64_hi = sum64_hi; + function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; + } + exports2.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; + } + exports2.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; + } + exports2.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; + } + exports2.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; + } + exports2.sum64_5_lo = sum64_5_lo; + function rotr64_hi(ah, al, num) { + var r = al << 32 - num | ah >>> num; + return r >>> 0; + } + exports2.rotr64_hi = rotr64_hi; + function rotr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; + } + exports2.rotr64_lo = rotr64_lo; + function shr64_hi(ah, al, num) { + return ah >>> num; + } + exports2.shr64_hi = shr64_hi; + function shr64_lo(ah, al, num) { + var r = ah << 32 - num | al >>> num; + return r >>> 0; + } + exports2.shr64_lo = shr64_lo; + } +}); + +// node_modules/hash.js/lib/hash/common.js +var require_common = __commonJS({ + "node_modules/hash.js/lib/hash/common.js"(exports2) { + "use strict"; + var utils = require_utils3(); + var assert = require_minimalistic_assert(); + 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; + } + exports2.BlockHash = BlockHash; + BlockHash.prototype.update = function update(msg, enc) { + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + if (this.pending.length >= this._delta8) { + msg = this.pending; + 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] = 128; + for (var i = 1; i < k; i++) + res[i] = 0; + 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 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len & 255; + } else { + res[i++] = len & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 24 & 255; + 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/sha/common.js +var require_common2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/common.js"(exports2) { + "use strict"; + var utils = require_utils3(); + 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); + } + exports2.ft_1 = ft_1; + function ch32(x, y, z) { + return x & y ^ ~x & z; + } + exports2.ch32 = ch32; + function maj32(x, y, z) { + return x & y ^ x & z ^ y & z; + } + exports2.maj32 = maj32; + function p32(x, y, z) { + return x ^ y ^ z; + } + exports2.p32 = p32; + function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); + } + exports2.s0_256 = s0_256; + function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); + } + exports2.s1_256 = s1_256; + function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3; + } + exports2.g0_256 = g0_256; + function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10; + } + exports2.g1_256 = g1_256; + } +}); + +// node_modules/hash.js/lib/hash/sha/1.js +var require__ = __commonJS({ + "node_modules/hash.js/lib/hash/sha/1.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var shaCommon = require_common2(); + 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 = [ + 1518500249, + 1859775393, + 2400959708, + 3395469782 + ]; + function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + BlockHash.call(this); + this.h = [ + 1732584193, + 4023233417, + 2562383102, + 271733878, + 3285377520 + ]; + this.W = new Array(80); + } + utils.inherits(SHA1, BlockHash); + module2.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/256.js +var require__2 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/256.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var shaCommon = require_common2(); + var assert = require_minimalistic_assert(); + 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 = [ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]; + function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + BlockHash.call(this); + this.h = [ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ]; + this.k = sha256_K; + this.W = new Array(64); + } + utils.inherits(SHA256, BlockHash); + module2.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/224.js +var require__3 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/224.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var SHA256 = require__2(); + function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + SHA256.call(this); + this.h = [ + 3238371032, + 914150663, + 812702999, + 4144912697, + 4290775857, + 1750603025, + 1694076839, + 3204075428 + ]; + } + utils.inherits(SHA224, SHA256); + module2.exports = SHA224; + SHA224.blockSize = 512; + SHA224.outSize = 224; + SHA224.hmacStrength = 192; + SHA224.padLength = 64; + SHA224.prototype._digest = function digest(enc) { + 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/512.js +var require__4 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/512.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + var assert = require_minimalistic_assert(); + 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 = [ + 1116352408, + 3609767458, + 1899447441, + 602891725, + 3049323471, + 3964484399, + 3921009573, + 2173295548, + 961987163, + 4081628472, + 1508970993, + 3053834265, + 2453635748, + 2937671579, + 2870763221, + 3664609560, + 3624381080, + 2734883394, + 310598401, + 1164996542, + 607225278, + 1323610764, + 1426881987, + 3590304994, + 1925078388, + 4068182383, + 2162078206, + 991336113, + 2614888103, + 633803317, + 3248222580, + 3479774868, + 3835390401, + 2666613458, + 4022224774, + 944711139, + 264347078, + 2341262773, + 604807628, + 2007800933, + 770255983, + 1495990901, + 1249150122, + 1856431235, + 1555081692, + 3175218132, + 1996064986, + 2198950837, + 2554220882, + 3999719339, + 2821834349, + 766784016, + 2952996808, + 2566594879, + 3210313671, + 3203337956, + 3336571891, + 1034457026, + 3584528711, + 2466948901, + 113926993, + 3758326383, + 338241895, + 168717936, + 666307205, + 1188179964, + 773529912, + 1546045734, + 1294757372, + 1522805485, + 1396182291, + 2643833823, + 1695183700, + 2343527390, + 1986661051, + 1014477480, + 2177026350, + 1206759142, + 2456956037, + 344077627, + 2730485921, + 1290863460, + 2820302411, + 3158454273, + 3259730800, + 3505952657, + 3345764771, + 106217008, + 3516065817, + 3606008344, + 3600352804, + 1432725776, + 4094571909, + 1467031594, + 275423344, + 851169720, + 430227734, + 3100823752, + 506948616, + 1363258195, + 659060556, + 3750685593, + 883997877, + 3785050280, + 958139571, + 3318307427, + 1322822218, + 3812723403, + 1537002063, + 2003034995, + 1747873779, + 3602036899, + 1955562222, + 1575990012, + 2024104815, + 1125592928, + 2227730452, + 2716904306, + 2361852424, + 442776044, + 2428436474, + 593698344, + 2756734187, + 3733110249, + 3204031479, + 2999351573, + 3329325298, + 3815920427, + 3391569614, + 3928383900, + 3515267271, + 566280711, + 3940187606, + 3454069534, + 4118630271, + 4000239992, + 116418474, + 1914138554, + 174292421, + 2731055270, + 289380356, + 3203993006, + 460393269, + 320620315, + 685471733, + 587496836, + 852142971, + 1086792851, + 1017036298, + 365543100, + 1126000580, + 2618297676, + 1288033470, + 3409855158, + 1501505948, + 4234509866, + 1607167915, + 987167468, + 1816402316, + 1246189591 + ]; + function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + BlockHash.call(this); + this.h = [ + 1779033703, + 4089235720, + 3144134277, + 2227873595, + 1013904242, + 4271175723, + 2773480762, + 1595750129, + 1359893119, + 2917565137, + 2600822924, + 725511199, + 528734635, + 4215389547, + 1541459225, + 327033209 + ]; + this.k = sha512_K; + this.W = new Array(160); + } + utils.inherits(SHA512, BlockHash); + module2.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; + 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]); + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; + 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 += 4294967296; + return r; + } + function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ ~xl & zl; + if (r < 0) + r += 4294967296; + return r; + } + function maj64_hi(xh, xl, yh, yl, zh) { + var r = xh & yh ^ xh & zh ^ yh & zh; + if (r < 0) + r += 4294967296; + return r; + } + function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = xl & yl ^ xl & zl ^ yl & zl; + if (r < 0) + r += 4294967296; + return r; + } + function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); + var c2_hi = rotr64_hi(xl, xh, 7); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + return r; + } + function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); + var c2_lo = rotr64_lo(xl, xh, 7); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + 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); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + 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); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + 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 += 4294967296; + 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 += 4294967296; + return r; + } + function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); + var c2_hi = shr64_hi(xh, xl, 6); + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 4294967296; + return r; + } + function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); + var c2_lo = shr64_lo(xh, xl, 6); + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 4294967296; + return r; + } + } +}); + +// node_modules/hash.js/lib/hash/sha/384.js +var require__5 = __commonJS({ + "node_modules/hash.js/lib/hash/sha/384.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var SHA512 = require__4(); + function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + SHA512.call(this); + this.h = [ + 3418070365, + 3238371032, + 1654270250, + 914150663, + 2438529370, + 812702999, + 355462360, + 4144912697, + 1731405415, + 4290775857, + 2394180231, + 1750603025, + 3675008525, + 1694076839, + 1203062813, + 3204075428 + ]; + } + utils.inherits(SHA384, SHA512); + module2.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.js +var require_sha = __commonJS({ + "node_modules/hash.js/lib/hash/sha.js"(exports2) { + "use strict"; + exports2.sha1 = require__(); + exports2.sha224 = require__3(); + exports2.sha256 = require__2(); + exports2.sha384 = require__5(); + exports2.sha512 = require__4(); + } +}); + +// node_modules/hash.js/lib/hash/ripemd.js +var require_ripemd = __commonJS({ + "node_modules/hash.js/lib/hash/ripemd.js"(exports2) { + "use strict"; + var utils = require_utils3(); + var common = require_common(); + 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 = [1732584193, 4023233417, 2562383102, 271733878, 3285377520]; + this.endian = "little"; + } + utils.inherits(RIPEMD160, BlockHash); + exports2.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 0; + else if (j <= 31) + return 1518500249; + else if (j <= 47) + return 1859775393; + else if (j <= 63) + return 2400959708; + else + return 2840853838; + } + function Kh(j) { + if (j <= 15) + return 1352829926; + else if (j <= 31) + return 1548603684; + else if (j <= 47) + return 1836072691; + else if (j <= 63) + return 2053994217; + else + return 0; + } + 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/hmac.js +var require_hmac = __commonJS({ + "node_modules/hash.js/lib/hash/hmac.js"(exports2, module2) { + "use strict"; + var utils = require_utils3(); + var assert = require_minimalistic_assert(); + 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)); + } + module2.exports = Hmac; + Hmac.prototype._init = function init(key) { + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + for (i = 0; i < key.length; i++) + key[i] ^= 54; + this.inner = new this.Hash().update(key); + for (i = 0; i < key.length; i++) + key[i] ^= 106; + 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.js +var require_hash = __commonJS({ + "node_modules/hash.js/lib/hash.js"(exports2) { + var hash = exports2; + hash.utils = require_utils3(); + hash.common = require_common(); + hash.sha = require_sha(); + hash.ripemd = require_ripemd(); + hash.hmac = require_hmac(); + 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/elliptic/lib/elliptic/precomputed/secp256k1.js +var require_secp256k1 = __commonJS({ + "node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js"(exports2, module2) { + module2.exports = { + doubles: { + step: 4, + points: [ + [ + "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", + "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821" + ], + [ + "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", + "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf" + ], + [ + "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", + "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695" + ], + [ + "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", + "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9" + ], + [ + "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", + "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36" + ], + [ + "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", + "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f" + ], + [ + "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", + "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999" + ], + [ + "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", + "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09" + ], + [ + "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", + "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d" + ], + [ + "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", + "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088" + ], + [ + "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", + "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d" + ], + [ + "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", + "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8" + ], + [ + "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", + "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a" + ], + [ + "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", + "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453" + ], + [ + "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", + "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160" + ], + [ + "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", + "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0" + ], + [ + "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", + "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6" + ], + [ + "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", + "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589" + ], + [ + "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", + "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17" + ], + [ + "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", + "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda" + ], + [ + "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", + "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd" + ], + [ + "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", + "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2" + ], + [ + "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", + "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6" + ], + [ + "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", + "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f" + ], + [ + "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", + "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01" + ], + [ + "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", + "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3" + ], + [ + "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", + "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f" + ], + [ + "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", + "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7" + ], + [ + "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", + "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78" + ], + [ + "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", + "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1" + ], + [ + "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", + "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150" + ], + [ + "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", + "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82" + ], + [ + "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", + "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc" + ], + [ + "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", + "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b" + ], + [ + "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", + "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51" + ], + [ + "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", + "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45" + ], + [ + "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", + "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120" + ], + [ + "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", + "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84" + ], + [ + "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", + "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d" + ], + [ + "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", + "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d" + ], + [ + "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", + "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8" + ], + [ + "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", + "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8" + ], + [ + "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", + "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac" + ], + [ + "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", + "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f" + ], + [ + "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", + "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962" + ], + [ + "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", + "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907" + ], + [ + "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", + "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec" + ], + [ + "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", + "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d" + ], + [ + "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", + "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414" + ], + [ + "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", + "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd" + ], + [ + "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", + "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0" + ], + [ + "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", + "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811" + ], + [ + "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", + "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1" + ], + [ + "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", + "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c" + ], + [ + "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", + "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73" + ], + [ + "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", + "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd" + ], + [ + "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", + "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405" + ], + [ + "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", + "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589" + ], + [ + "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", + "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e" + ], + [ + "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", + "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27" + ], + [ + "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", + "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1" + ], + [ + "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", + "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482" + ], + [ + "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", + "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945" + ], + [ + "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", + "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573" + ], + [ + "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", + "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82" + ] + ] + }, + naf: { + wnd: 7, + points: [ + [ + "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", + "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672" + ], + [ + "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", + "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6" + ], + [ + "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", + "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da" + ], + [ + "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", + "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37" + ], + [ + "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", + "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b" + ], + [ + "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", + "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81" + ], + [ + "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", + "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58" + ], + [ + "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", + "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77" + ], + [ + "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", + "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a" + ], + [ + "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", + "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c" + ], + [ + "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", + "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67" + ], + [ + "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", + "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402" + ], + [ + "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", + "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55" + ], + [ + "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", + "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482" + ], + [ + "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", + "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82" + ], + [ + "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", + "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396" + ], + [ + "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", + "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49" + ], + [ + "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", + "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf" + ], + [ + "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", + "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a" + ], + [ + "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", + "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7" + ], + [ + "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", + "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933" + ], + [ + "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", + "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a" + ], + [ + "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", + "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6" + ], + [ + "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", + "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37" + ], + [ + "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", + "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e" + ], + [ + "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", + "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6" + ], + [ + "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", + "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476" + ], + [ + "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", + "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40" + ], + [ + "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", + "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61" + ], + [ + "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", + "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683" + ], + [ + "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", + "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5" + ], + [ + "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", + "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b" + ], + [ + "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", + "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417" + ], + [ + "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", + "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868" + ], + [ + "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", + "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a" + ], + [ + "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", + "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6" + ], + [ + "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", + "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996" + ], + [ + "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", + "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e" + ], + [ + "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", + "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d" + ], + [ + "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", + "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2" + ], + [ + "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", + "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e" + ], + [ + "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", + "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437" + ], + [ + "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", + "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311" + ], + [ + "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", + "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4" + ], + [ + "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", + "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575" + ], + [ + "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", + "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d" + ], + [ + "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", + "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d" + ], + [ + "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", + "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629" + ], + [ + "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", + "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06" + ], + [ + "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", + "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374" + ], + [ + "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", + "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee" + ], + [ + "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", + "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1" + ], + [ + "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", + "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b" + ], + [ + "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", + "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661" + ], + [ + "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", + "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6" + ], + [ + "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", + "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e" + ], + [ + "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", + "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d" + ], + [ + "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", + "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc" + ], + [ + "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", + "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4" + ], + [ + "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", + "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c" + ], + [ + "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", + "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b" + ], + [ + "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", + "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913" + ], + [ + "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", + "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154" + ], + [ + "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", + "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865" + ], + [ + "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", + "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc" + ], + [ + "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", + "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224" + ], + [ + "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", + "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e" + ], + [ + "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", + "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6" + ], + [ + "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", + "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511" + ], + [ + "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", + "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b" + ], + [ + "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", + "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2" + ], + [ + "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", + "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c" + ], + [ + "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", + "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3" + ], + [ + "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", + "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d" + ], + [ + "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", + "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700" + ], + [ + "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", + "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4" + ], + [ + "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", + "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196" + ], + [ + "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", + "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4" + ], + [ + "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", + "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257" + ], + [ + "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", + "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13" + ], + [ + "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", + "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096" + ], + [ + "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", + "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38" + ], + [ + "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", + "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f" + ], + [ + "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", + "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448" + ], + [ + "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", + "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a" + ], + [ + "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", + "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4" + ], + [ + "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", + "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437" + ], + [ + "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", + "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7" + ], + [ + "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", + "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d" + ], + [ + "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", + "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a" + ], + [ + "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", + "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54" + ], + [ + "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", + "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77" + ], + [ + "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", + "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517" + ], + [ + "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", + "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10" + ], + [ + "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", + "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125" + ], + [ + "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", + "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e" + ], + [ + "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", + "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1" + ], + [ + "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", + "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2" + ], + [ + "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", + "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423" + ], + [ + "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", + "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8" + ], + [ + "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", + "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758" + ], + [ + "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", + "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375" + ], + [ + "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", + "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d" + ], + [ + "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", + "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec" + ], + [ + "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", + "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0" + ], + [ + "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", + "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c" + ], + [ + "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", + "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4" + ], + [ + "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", + "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f" + ], + [ + "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", + "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649" + ], + [ + "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", + "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826" + ], + [ + "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", + "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5" + ], + [ + "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", + "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87" + ], + [ + "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", + "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b" + ], + [ + "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", + "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc" + ], + [ + "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", + "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c" + ], + [ + "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", + "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f" + ], + [ + "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", + "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a" + ], + [ + "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", + "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46" + ], + [ + "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", + "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f" + ], + [ + "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", + "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03" + ], + [ + "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", + "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08" + ], + [ + "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", + "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8" + ], + [ + "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", + "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373" + ], + [ + "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", + "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3" + ], + [ + "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", + "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8" + ], + [ + "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", + "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1" + ], + [ + "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", + "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9" + ] + ] + } + }; + } +}); + +// node_modules/elliptic/lib/elliptic/curves.js +var require_curves = __commonJS({ + "node_modules/elliptic/lib/elliptic/curves.js"(exports2) { + "use strict"; + var curves = exports2; + var hash = require_hash(); + var curve = require_curve(); + var utils = require_utils2(); + var assert = utils.assert; + function PresetCurve(options) { + if (options.type === "short") + this.curve = new curve.short(options); + else if (options.type === "edwards") + this.curve = new curve.edwards(options); + else + this.curve = new curve.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(name2, options) { + Object.defineProperty(curves, name2, { + configurable: true, + enumerable: true, + get: function() { + var curve2 = new PresetCurve(options); + Object.defineProperty(curves, name2, { + configurable: true, + enumerable: true, + value: curve2 + }); + return curve2; + } + }); + } + 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.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.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.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.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.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.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.sha256, + gRed: false, + g: [ + "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", + // 4/5 + "6666666666666666666666666666666666666666666666666666666666666658" + ] + }); + var pre; + try { + pre = require_secp256k1(); + } catch (e) { + pre = void 0; + } + 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.sha256, + // Precomputed endomorphism + beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee", + lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72", + basis: [ + { + a: "3086d221a7d46bcde86c90e49284eb15", + b: "-e4437ed6010e88286f547fa90abfe4c3" + }, + { + a: "114ca50f7a8e2f3f657c1108d9d44cfd8", + b: "3086d221a7d46bcde86c90e49284eb15" + } + ], + gRed: false, + g: [ + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", + "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", + pre + ] + }); + } +}); + +// node_modules/hmac-drbg/lib/hmac-drbg.js +var require_hmac_drbg = __commonJS({ + "node_modules/hmac-drbg/lib/hmac-drbg.js"(exports2, module2) { + "use strict"; + var hash = require_hash(); + var utils = require_utils(); + var assert = require_minimalistic_assert(); + 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.toArray(options.entropy, options.entropyEnc || "hex"); + var nonce = utils.toArray(options.nonce, options.nonceEnc || "hex"); + var pers = utils.toArray(options.pers, options.persEnc || "hex"); + assert( + entropy.length >= this.minEntropy / 8, + "Not enough entropy. Minimum is: " + this.minEntropy + " bits" + ); + this._init(entropy, nonce, pers); + } + module2.exports = 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] = 0; + this.V[i] = 1; + } + this._update(seed); + this._reseed = 1; + this.reseedInterval = 281474976710656; + }; + HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); + }; + HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac().update(this.V).update([0]); + 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([1]).update(seed).digest(); + this.V = this._hmac().update(this.V).digest(); + }; + HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + if (typeof entropyEnc !== "string") { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + entropy = utils.toArray(entropy, entropyEnc); + add = utils.toArray(add, addEnc); + assert( + 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"); + if (typeof enc !== "string") { + addEnc = add; + add = enc; + enc = null; + } + if (add) { + add = utils.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.encode(res, enc); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/key.js +var require_key = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/key.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); + } + module2.exports = KeyPair; + KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(ec, { + pub, + pubEnc: enc + }); + }; + KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + return new KeyPair(ec, { + 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) { + 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(key, enc || 16); + this.priv = this.priv.umod(this.ec.curve.n); + }; + KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + if (this.ec.curve.type === "mont") { + assert(key.x, "Need x coordinate"); + } else if (this.ec.curve.type === "short" || this.ec.curve.type === "edwards") { + assert(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); + }; + KeyPair.prototype.derive = function derive(pub) { + if (!pub.validate()) { + assert(pub.validate(), "public point not validated"); + } + return pub.mul(this.priv).getX(); + }; + 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 ""; + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/signature.js +var require_signature = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/signature.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + function Signature(options, enc) { + if (options instanceof Signature) + return options; + if (this._importDER(options, enc)) + return; + assert(options.r && options.s, "Signature without r or s"); + this.r = new BN(options.r, 16); + this.s = new BN(options.s, 16); + if (options.recoveryParam === void 0) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; + } + module2.exports = Signature; + function Position() { + this.place = 0; + } + function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 128)) { + return initial; + } + var octetLen = initial & 15; + 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; + } + if (val <= 127) { + return false; + } + p.place = off; + return val; + } + function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 128) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); + } + Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 48) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if (len + p.place !== data.length) { + return false; + } + if (data[p.place++] !== 2) { + 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++] !== 2) { + 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] & 128) { + r = r.slice(1); + } else { + return false; + } + } + if (s[0] === 0) { + if (s[1] & 128) { + s = s.slice(1); + } else { + return false; + } + } + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + return true; + }; + function constructLength(arr, len) { + if (len < 128) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 128); + while (--octets) { + arr.push(len >>> (octets << 3) & 255); + } + arr.push(len); + } + Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + if (r[0] & 128) + r = [0].concat(r); + if (s[0] & 128) + s = [0].concat(s); + r = rmPadding(r); + s = rmPadding(s); + while (!s[0] && !(s[1] & 128)) { + s = s.slice(1); + } + var arr = [2]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(2); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [48]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/ec/index.js +var require_ec = __commonJS({ + "node_modules/elliptic/lib/elliptic/ec/index.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var HmacDRBG = require_hmac_drbg(); + var utils = require_utils2(); + var curves = require_curves(); + var rand = require_brorand(); + var assert = utils.assert; + var KeyPair = require_key(); + var Signature = require_signature(); + function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + if (typeof options === "string") { + assert( + Object.prototype.hasOwnProperty.call(curves, options), + "Unknown curve " + options + ); + options = curves[options]; + } + if (options instanceof curves.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; + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + this.hash = options.hash || options.curve.hash; + } + module2.exports = EC; + EC.prototype.keyPair = function keyPair(options) { + return new KeyPair(this, options); + }; + EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return KeyPair.fromPrivate(this, priv, enc); + }; + EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return KeyPair.fromPublic(this, pub, enc); + }; + EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + 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(2)); + for (; ; ) { + var priv = new BN(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(msg, 16)); + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray("be", bytes); + var nonce = msg.toArray("be", bytes); + var drbg = new HmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce, + pers: options.pers, + persEnc: options.persEnc || "utf8" + }); + var ns1 = this.n.sub(new BN(1)); + for (var iter = 0; ; iter++) { + var k = options.k ? options.k(iter) : new BN(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); + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + return new Signature({ r, s, recoveryParam }); + } + }; + EC.prototype.verify = function verify(msg, signature, key, enc) { + msg = this._truncateToN(new BN(msg, 16)); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, "hex"); + var r = signature.r; + var s = signature.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; + 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; + } + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + return p.eqXToP(r); + }; + EC.prototype.recoverPubKey = function(msg, signature, j, enc) { + assert((3 & j) === j, "The recovery param is more than two bits"); + signature = new Signature(signature, enc); + var n = this.n; + var e = new BN(msg); + var r = signature.r; + var s = signature.s; + 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"); + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + return this.g.mulAdd(s1, r, s2); + }; + EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { + signature = new Signature(signature, enc); + if (signature.recoveryParam !== null) + return signature.recoveryParam; + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature, i); + } catch (e2) { + continue; + } + if (Qprime.eq(Q)) + return i; + } + throw new Error("Unable to find valid recovery factor"); + }; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/key.js +var require_key2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/key.js"(exports2, module2) { + "use strict"; + var utils = require_utils2(); + var assert = utils.assert; + var parseBytes = utils.parseBytes; + var cachedProperty = utils.cachedProperty; + function KeyPair(eddsa, params) { + this.eddsa = eddsa; + this._secret = parseBytes(params.secret); + if (eddsa.isPoint(params.pub)) + this._pub = params.pub; + else + this._pubBytes = parseBytes(params.pub); + } + KeyPair.fromPublic = function fromPublic(eddsa, pub) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(eddsa, { pub }); + }; + KeyPair.fromSecret = function fromSecret(eddsa, secret) { + if (secret instanceof KeyPair) + return secret; + return new KeyPair(eddsa, { secret }); + }; + KeyPair.prototype.secret = function secret() { + return this._secret; + }; + cachedProperty(KeyPair, "pubBytes", function pubBytes() { + return this.eddsa.encodePoint(this.pub()); + }); + cachedProperty(KeyPair, "pub", function pub() { + if (this._pubBytes) + return this.eddsa.decodePoint(this._pubBytes); + return this.eddsa.g.mul(this.priv()); + }); + cachedProperty(KeyPair, "privBytes", function privBytes() { + var eddsa = this.eddsa; + var hash = this.hash(); + var lastIx = eddsa.encodingLength - 1; + var a = hash.slice(0, eddsa.encodingLength); + a[0] &= 248; + a[lastIx] &= 127; + a[lastIx] |= 64; + return a; + }); + cachedProperty(KeyPair, "priv", function priv() { + return this.eddsa.decodeInt(this.privBytes()); + }); + cachedProperty(KeyPair, "hash", function hash() { + return this.eddsa.hash().update(this.secret()).digest(); + }); + cachedProperty(KeyPair, "messagePrefix", function messagePrefix() { + return this.hash().slice(this.eddsa.encodingLength); + }); + KeyPair.prototype.sign = function sign(message) { + assert(this._secret, "KeyPair can only verify"); + return this.eddsa.sign(message, this); + }; + KeyPair.prototype.verify = function verify(message, sig) { + return this.eddsa.verify(message, sig, this); + }; + KeyPair.prototype.getSecret = function getSecret(enc) { + assert(this._secret, "KeyPair is public only"); + return utils.encode(this.secret(), enc); + }; + KeyPair.prototype.getPublic = function getPublic(enc) { + return utils.encode(this.pubBytes(), enc); + }; + module2.exports = KeyPair; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/signature.js +var require_signature2 = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/signature.js"(exports2, module2) { + "use strict"; + var BN = require_bn(); + var utils = require_utils2(); + var assert = utils.assert; + var cachedProperty = utils.cachedProperty; + var parseBytes = utils.parseBytes; + function Signature(eddsa, sig) { + this.eddsa = eddsa; + if (typeof sig !== "object") + sig = parseBytes(sig); + if (Array.isArray(sig)) { + sig = { + R: sig.slice(0, eddsa.encodingLength), + S: sig.slice(eddsa.encodingLength) + }; + } + assert(sig.R && sig.S, "Signature without R or S"); + if (eddsa.isPoint(sig.R)) + this._R = sig.R; + if (sig.S instanceof BN) + this._S = sig.S; + this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded; + this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded; + } + cachedProperty(Signature, "S", function S() { + return this.eddsa.decodeInt(this.Sencoded()); + }); + cachedProperty(Signature, "R", function R() { + return this.eddsa.decodePoint(this.Rencoded()); + }); + cachedProperty(Signature, "Rencoded", function Rencoded() { + return this.eddsa.encodePoint(this.R()); + }); + cachedProperty(Signature, "Sencoded", function Sencoded() { + return this.eddsa.encodeInt(this.S()); + }); + Signature.prototype.toBytes = function toBytes() { + return this.Rencoded().concat(this.Sencoded()); + }; + Signature.prototype.toHex = function toHex() { + return utils.encode(this.toBytes(), "hex").toUpperCase(); + }; + module2.exports = Signature; + } +}); + +// node_modules/elliptic/lib/elliptic/eddsa/index.js +var require_eddsa = __commonJS({ + "node_modules/elliptic/lib/elliptic/eddsa/index.js"(exports2, module2) { + "use strict"; + var hash = require_hash(); + var curves = require_curves(); + var utils = require_utils2(); + var assert = utils.assert; + var parseBytes = utils.parseBytes; + var KeyPair = require_key2(); + var Signature = require_signature2(); + function EDDSA(curve) { + assert(curve === "ed25519", "only tested with ed25519 so far"); + if (!(this instanceof EDDSA)) + return new EDDSA(curve); + curve = curves[curve].curve; + this.curve = curve; + this.g = curve.g; + this.g.precompute(curve.n.bitLength() + 1); + this.pointClass = curve.point().constructor; + this.encodingLength = Math.ceil(curve.n.bitLength() / 8); + this.hash = hash.sha512; + } + module2.exports = EDDSA; + EDDSA.prototype.sign = function sign(message, secret) { + message = parseBytes(message); + var key = this.keyFromSecret(secret); + var r = this.hashInt(key.messagePrefix(), message); + var R = this.g.mul(r); + var Rencoded = this.encodePoint(R); + var s_ = this.hashInt(Rencoded, key.pubBytes(), message).mul(key.priv()); + var S = r.add(s_).umod(this.curve.n); + return this.makeSignature({ R, S, Rencoded }); + }; + EDDSA.prototype.verify = function verify(message, sig, pub) { + message = parseBytes(message); + sig = this.makeSignature(sig); + var key = this.keyFromPublic(pub); + var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); + var SG = this.g.mul(sig.S()); + var RplusAh = sig.R().add(key.pub().mul(h)); + return RplusAh.eq(SG); + }; + EDDSA.prototype.hashInt = function hashInt() { + var hash2 = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash2.update(arguments[i]); + return utils.intFromLE(hash2.digest()).umod(this.curve.n); + }; + EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { + return KeyPair.fromPublic(this, pub); + }; + EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { + return KeyPair.fromSecret(this, secret); + }; + EDDSA.prototype.makeSignature = function makeSignature(sig) { + if (sig instanceof Signature) + return sig; + return new Signature(this, sig); + }; + EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray("le", this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 128 : 0; + return enc; + }; + EDDSA.prototype.decodePoint = function decodePoint(bytes) { + bytes = utils.parseBytes(bytes); + var lastIx = bytes.length - 1; + var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~128); + var xIsOdd = (bytes[lastIx] & 128) !== 0; + var y = utils.intFromLE(normed); + return this.curve.pointFromY(y, xIsOdd); + }; + EDDSA.prototype.encodeInt = function encodeInt(num) { + return num.toArray("le", this.encodingLength); + }; + EDDSA.prototype.decodeInt = function decodeInt(bytes) { + return utils.intFromLE(bytes); + }; + EDDSA.prototype.isPoint = function isPoint(val) { + return val instanceof this.pointClass; + }; + } +}); + +// node_modules/elliptic/lib/elliptic.js +var require_elliptic = __commonJS({ + "node_modules/elliptic/lib/elliptic.js"(exports2) { + "use strict"; + var elliptic = exports2; + elliptic.version = require_package().version; + elliptic.utils = require_utils2(); + elliptic.rand = require_brorand(); + elliptic.curve = require_curve(); + elliptic.curves = require_curves(); + elliptic.ec = require_ec(); + elliptic.eddsa = require_eddsa(); + } +}); + +// node_modules/@ethersproject/signing-key/lib/elliptic.js +var require_elliptic2 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/elliptic.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EC = void 0; + var elliptic_1 = __importDefault(require_elliptic()); + var EC = elliptic_1.default.ec; + exports2.EC = EC; + } +}); + +// node_modules/@ethersproject/signing-key/lib/_version.js +var require_version12 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "signing-key/5.5.0"; + } +}); + +// node_modules/@ethersproject/signing-key/lib/index.js +var require_lib14 = __commonJS({ + "node_modules/@ethersproject/signing-key/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.computePublicKey = exports2.recoverPublicKey = exports2.SigningKey = void 0; + var elliptic_1 = require_elliptic2(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version12(); + var logger = new logger_1.Logger(_version_1.version); + var _curve = null; + function getCurve() { + if (!_curve) { + _curve = new elliptic_1.EC("secp256k1"); + } + return _curve; + } + var SigningKey = ( + /** @class */ + function() { + function SigningKey2(privateKey) { + (0, properties_1.defineReadOnly)(this, "curve", "secp256k1"); + (0, properties_1.defineReadOnly)(this, "privateKey", (0, bytes_1.hexlify)(privateKey)); + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + (0, properties_1.defineReadOnly)(this, "publicKey", "0x" + keyPair.getPublic(false, "hex")); + (0, properties_1.defineReadOnly)(this, "compressedPublicKey", "0x" + keyPair.getPublic(true, "hex")); + (0, properties_1.defineReadOnly)(this, "_isSigningKey", true); + } + SigningKey2.prototype._addPoint = function(other) { + var p0 = getCurve().keyFromPublic((0, bytes_1.arrayify)(this.publicKey)); + var p1 = getCurve().keyFromPublic((0, bytes_1.arrayify)(other)); + return "0x" + p0.pub.add(p1.pub).encodeCompressed("hex"); + }; + SigningKey2.prototype.signDigest = function(digest) { + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + var digestBytes = (0, bytes_1.arrayify)(digest); + if (digestBytes.length !== 32) { + logger.throwArgumentError("bad digest length", "digest", digest); + } + var signature = keyPair.sign(digestBytes, { canonical: true }); + return (0, bytes_1.splitSignature)({ + recoveryParam: signature.recoveryParam, + r: (0, bytes_1.hexZeroPad)("0x" + signature.r.toString(16), 32), + s: (0, bytes_1.hexZeroPad)("0x" + signature.s.toString(16), 32) + }); + }; + SigningKey2.prototype.computeSharedSecret = function(otherKey) { + var keyPair = getCurve().keyFromPrivate((0, bytes_1.arrayify)(this.privateKey)); + var otherKeyPair = getCurve().keyFromPublic((0, bytes_1.arrayify)(computePublicKey(otherKey))); + return (0, bytes_1.hexZeroPad)("0x" + keyPair.derive(otherKeyPair.getPublic()).toString(16), 32); + }; + SigningKey2.isSigningKey = function(value) { + return !!(value && value._isSigningKey); + }; + return SigningKey2; + }() + ); + exports2.SigningKey = SigningKey; + function recoverPublicKey(digest, signature) { + var sig = (0, bytes_1.splitSignature)(signature); + var rs = { r: (0, bytes_1.arrayify)(sig.r), s: (0, bytes_1.arrayify)(sig.s) }; + return "0x" + getCurve().recoverPubKey((0, bytes_1.arrayify)(digest), rs, sig.recoveryParam).encode("hex", false); + } + exports2.recoverPublicKey = recoverPublicKey; + function computePublicKey(key, compressed) { + var bytes = (0, bytes_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 (0, bytes_1.hexlify)(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(false, "hex"); + } else if (bytes.length === 65) { + if (!compressed) { + return (0, bytes_1.hexlify)(bytes); + } + return "0x" + getCurve().keyFromPublic(bytes).getPublic(true, "hex"); + } + return logger.throwArgumentError("invalid public or private key", "key", "[REDACTED]"); + } + exports2.computePublicKey = computePublicKey; + } +}); + +// node_modules/@ethersproject/transactions/lib/_version.js +var require_version13 = __commonJS({ + "node_modules/@ethersproject/transactions/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "transactions/5.5.0"; + } +}); + +// node_modules/@ethersproject/transactions/lib/index.js +var require_lib15 = __commonJS({ + "node_modules/@ethersproject/transactions/lib/index.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.parse = exports2.serialize = exports2.accessListify = exports2.recoverAddress = exports2.computeAddress = exports2.TransactionTypes = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var RLP = __importStar(require_lib6()); + var signing_key_1 = require_lib14(); + var logger_1 = require_lib(); + var _version_1 = require_version13(); + var logger = new logger_1.Logger(_version_1.version); + var TransactionTypes; + (function(TransactionTypes2) { + TransactionTypes2[TransactionTypes2["legacy"] = 0] = "legacy"; + TransactionTypes2[TransactionTypes2["eip2930"] = 1] = "eip2930"; + TransactionTypes2[TransactionTypes2["eip1559"] = 2] = "eip1559"; + })(TransactionTypes = exports2.TransactionTypes || (exports2.TransactionTypes = {})); + function handleAddress(value) { + if (value === "0x") { + return null; + } + return (0, address_1.getAddress)(value); + } + function handleNumber(value) { + if (value === "0x") { + return constants_1.Zero; + } + return bignumber_1.BigNumber.from(value); + } + 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 = (0, signing_key_1.computePublicKey)(key); + return (0, address_1.getAddress)((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.hexDataSlice)(publicKey, 1)), 12)); + } + exports2.computeAddress = computeAddress; + function recoverAddress(digest, signature) { + return computeAddress((0, signing_key_1.recoverPublicKey)((0, bytes_1.arrayify)(digest), signature)); + } + exports2.recoverAddress = recoverAddress; + function formatNumber(value, name2) { + var result = (0, bytes_1.stripZeros)(bignumber_1.BigNumber.from(value).toHexString()); + if (result.length > 32) { + logger.throwArgumentError("invalid length for " + name2, "transaction:" + name2, value); + } + return result; + } + function accessSetify(addr, storageKeys) { + return { + address: (0, address_1.getAddress)(addr), + storageKeys: (storageKeys || []).map(function(storageKey, index) { + if ((0, bytes_1.hexDataLength)(storageKey) !== 32) { + logger.throwArgumentError("invalid access list storageKey", "accessList[" + addr + ":" + 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[" + 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; + } + exports2.accessListify = accessListify; + function formatAccessList(value) { + return accessListify(value).map(function(set) { + return [set.address, set.storageKeys]; + }); + } + function _serializeEip1559(transaction, signature) { + if (transaction.gasPrice != null) { + var gasPrice = bignumber_1.BigNumber.from(transaction.gasPrice); + var maxFeePerGas = bignumber_1.BigNumber.from(transaction.maxFeePerGas || 0); + if (!gasPrice.eq(maxFeePerGas)) { + logger.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas", "tx", { + gasPrice, + 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 ? (0, address_1.getAddress)(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature) { + var sig = (0, bytes_1.splitSignature)(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push((0, bytes_1.stripZeros)(sig.r)); + fields.push((0, bytes_1.stripZeros)(sig.s)); + } + return (0, bytes_1.hexConcat)(["0x02", RLP.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 ? (0, address_1.getAddress)(transaction.to) : "0x", + formatNumber(transaction.value || 0, "value"), + transaction.data || "0x", + formatAccessList(transaction.accessList || []) + ]; + if (signature) { + var sig = (0, bytes_1.splitSignature)(signature); + fields.push(formatNumber(sig.recoveryParam, "recoveryParam")); + fields.push((0, bytes_1.stripZeros)(sig.r)); + fields.push((0, bytes_1.stripZeros)(sig.s)); + } + return (0, bytes_1.hexConcat)(["0x01", RLP.encode(fields)]); + } + function _serialize(transaction, signature) { + (0, properties_1.checkProperties)(transaction, allowedTransactionKeys); + var raw = []; + transactionFields.forEach(function(fieldInfo) { + var value = transaction[fieldInfo.name] || []; + var options = {}; + if (fieldInfo.numeric) { + options.hexPad = "left"; + } + value = (0, bytes_1.arrayify)((0, bytes_1.hexlify)(value, options)); + if (fieldInfo.length && value.length !== fieldInfo.length && value.length > 0) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + if (fieldInfo.maxLength) { + value = (0, bytes_1.stripZeros)(value); + if (value.length > fieldInfo.maxLength) { + logger.throwArgumentError("invalid length for " + fieldInfo.name, "transaction:" + fieldInfo.name, value); + } + } + raw.push((0, bytes_1.hexlify)(value)); + }); + var chainId = 0; + if (transaction.chainId != null) { + chainId = transaction.chainId; + if (typeof chainId !== "number") { + logger.throwArgumentError("invalid transaction.chainId", "transaction", transaction); + } + } else if (signature && !(0, bytes_1.isBytesLike)(signature) && signature.v > 28) { + chainId = Math.floor((signature.v - 35) / 2); + } + if (chainId !== 0) { + raw.push((0, bytes_1.hexlify)(chainId)); + raw.push("0x"); + raw.push("0x"); + } + if (!signature) { + return RLP.encode(raw); + } + var sig = (0, bytes_1.splitSignature)(signature); + var v = 27 + sig.recoveryParam; + if (chainId !== 0) { + raw.pop(); + raw.pop(); + raw.pop(); + v += chainId * 2 + 8; + 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((0, bytes_1.hexlify)(v)); + raw.push((0, bytes_1.stripZeros)((0, bytes_1.arrayify)(sig.r))); + raw.push((0, bytes_1.stripZeros)((0, bytes_1.arrayify)(sig.s))); + return RLP.encode(raw); + } + function serialize(transaction, signature) { + 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); + } + switch (transaction.type) { + case 1: + return _serializeEip2930(transaction, signature); + case 2: + return _serializeEip1559(transaction, signature); + default: + break; + } + return logger.throwError("unsupported transaction type: " + transaction.type, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "serializeTransaction", + transactionType: transaction.type + }); + } + exports2.serialize = serialize; + function _parseEipSignature(tx, fields, serialize2) { + 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 = (0, bytes_1.hexZeroPad)(fields[1], 32); + tx.s = (0, bytes_1.hexZeroPad)(fields[2], 32); + try { + var digest = (0, keccak256_1.keccak256)(serialize2(tx)); + tx.from = recoverAddress(digest, { r: tx.r, s: tx.s, recoveryParam: tx.v }); + } catch (error) { + console.log(error); + } + } + function _parseEip1559(payload) { + var transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 9 && transaction.length !== 12) { + logger.throwArgumentError("invalid component count for transaction type: 2", "payload", (0, bytes_1.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, + maxFeePerGas, + gasPrice: null, + gasLimit: handleNumber(transaction[4]), + to: handleAddress(transaction[5]), + value: handleNumber(transaction[6]), + data: transaction[7], + accessList: accessListify(transaction[8]) + }; + if (transaction.length === 9) { + return tx; + } + tx.hash = (0, keccak256_1.keccak256)(payload); + _parseEipSignature(tx, transaction.slice(9), _serializeEip1559); + return tx; + } + function _parseEip2930(payload) { + var transaction = RLP.decode(payload.slice(1)); + if (transaction.length !== 8 && transaction.length !== 11) { + logger.throwArgumentError("invalid component count for transaction type: 1", "payload", (0, bytes_1.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]) + }; + if (transaction.length === 8) { + return tx; + } + tx.hash = (0, keccak256_1.keccak256)(payload); + _parseEipSignature(tx, transaction.slice(8), _serializeEip2930); + return tx; + } + function _parse(rawTransaction) { + var transaction = RLP.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 + }; + if (transaction.length === 6) { + return tx; + } + try { + tx.v = bignumber_1.BigNumber.from(transaction[6]).toNumber(); + } catch (error) { + console.log(error); + return tx; + } + tx.r = (0, bytes_1.hexZeroPad)(transaction[7], 32); + tx.s = (0, bytes_1.hexZeroPad)(transaction[8], 32); + if (bignumber_1.BigNumber.from(tx.r).isZero() && bignumber_1.BigNumber.from(tx.s).isZero()) { + tx.chainId = tx.v; + tx.v = 0; + } else { + 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((0, bytes_1.hexlify)(tx.chainId)); + raw.push("0x"); + raw.push("0x"); + recoveryParam -= tx.chainId * 2 + 8; + } + var digest = (0, keccak256_1.keccak256)(RLP.encode(raw)); + try { + tx.from = recoverAddress(digest, { r: (0, bytes_1.hexlify)(tx.r), s: (0, bytes_1.hexlify)(tx.s), recoveryParam }); + } catch (error) { + console.log(error); + } + tx.hash = (0, keccak256_1.keccak256)(rawTransaction); + } + tx.type = null; + return tx; + } + function parse(rawTransaction) { + var payload = (0, bytes_1.arrayify)(rawTransaction); + if (payload[0] > 127) { + return _parse(payload); + } + switch (payload[0]) { + case 1: + return _parseEip2930(payload); + case 2: + return _parseEip1559(payload); + default: + break; + } + return logger.throwError("unsupported transaction type: " + payload[0], logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "parseTransaction", + transactionType: payload[0] + }); + } + exports2.parse = parse; + } +}); + +// node_modules/@ethersproject/contracts/lib/_version.js +var require_version14 = __commonJS({ + "node_modules/@ethersproject/contracts/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "contracts/5.5.0"; + } +}); + +// node_modules/@ethersproject/contracts/lib/index.js +var require_lib16 = __commonJS({ + "node_modules/@ethersproject/contracts/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __spreadArray = exports2 && exports2.__spreadArray || function(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.ContractFactory = exports2.Contract = exports2.BaseContract = void 0; + var abi_1 = require_lib11(); + var abstract_provider_1 = require_lib12(); + var abstract_signer_1 = require_lib13(); + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version14(); + var logger = new logger_1.Logger(_version_1.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, function() { + var name2, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, nameOrPromise]; + case 1: + name2 = _a.sent(); + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", name2); + } + try { + return [2, (0, address_1.getAddress)(name2)]; + } catch (error) { + } + if (!resolver) { + logger.throwError("a provider or signer is needed to resolve ENS names", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName" + }); + } + return [4, resolver.resolveName(name2)]; + case 2: + address = _a.sent(); + if (address == null) { + logger.throwArgumentError("resolver or addr is not configured for ENS name", "name", name2); + } + return [2, address]; + } + }); + }); + } + function resolveAddresses(resolver, value, paramType) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!Array.isArray(paramType)) return [3, 2]; + return [4, Promise.all(paramType.map(function(paramType2, index) { + return resolveAddresses(resolver, Array.isArray(value) ? value[index] : value[paramType2.name], paramType2); + }))]; + case 1: + return [2, _a.sent()]; + case 2: + if (!(paramType.type === "address")) return [3, 4]; + return [4, resolveName(resolver, value)]; + case 3: + return [2, _a.sent()]; + case 4: + if (!(paramType.type === "tuple")) return [3, 6]; + return [4, resolveAddresses(resolver, value, paramType.components)]; + case 5: + return [2, _a.sent()]; + case 6: + if (!(paramType.baseType === "array")) return [3, 8]; + if (!Array.isArray(value)) { + return [2, Promise.reject(logger.makeError("invalid value for array", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "value", + value + }))]; + } + return [4, Promise.all(value.map(function(v) { + return resolveAddresses(resolver, v, paramType.arrayChildren); + }))]; + case 7: + return [2, _a.sent()]; + case 8: + return [2, value]; + } + }); + }); + } + function populateTransaction(contract, fragment, args) { + return __awaiter(this, void 0, void 0, function() { + var overrides, resolved, data, tx, ro, intrinsic, bytes, i, roValue, leftovers; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + overrides = {}; + if (args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object") { + overrides = (0, properties_1.shallowCopy)(args.pop()); + } + logger.checkArgumentCount(args.length, fragment.inputs.length, "passed to contract"); + if (contract.signer) { + if (overrides.from) { + overrides.from = (0, properties_1.resolveProperties)({ + override: resolveName(contract.signer, overrides.from), + signer: contract.signer.getAddress() + }).then(function(check) { + return __awaiter(_this, void 0, void 0, function() { + return __generator(this, function(_a2) { + if ((0, address_1.getAddress)(check.signer) !== check.override) { + logger.throwError("Contract with a Signer cannot override from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.from" + }); + } + return [2, check.override]; + }); + }); + }); + } else { + overrides.from = contract.signer.getAddress(); + } + } else if (overrides.from) { + overrides.from = resolveName(contract.provider, overrides.from); + } + return [4, (0, properties_1.resolveProperties)({ + args: resolveAddresses(contract.signer || contract.provider, args, fragment.inputs), + address: contract.resolvedAddress, + overrides: (0, properties_1.resolveProperties)(overrides) || {} + })]; + case 1: + resolved = _a.sent(); + data = contract.interface.encodeFunctionData(fragment, resolved.args); + tx = { + data, + to: resolved.address + }; + ro = resolved.overrides; + if (ro.nonce != null) { + tx.nonce = bignumber_1.BigNumber.from(ro.nonce).toNumber(); + } + if (ro.gasLimit != null) { + tx.gasLimit = bignumber_1.BigNumber.from(ro.gasLimit); + } + if (ro.gasPrice != null) { + tx.gasPrice = bignumber_1.BigNumber.from(ro.gasPrice); + } + if (ro.maxFeePerGas != null) { + tx.maxFeePerGas = bignumber_1.BigNumber.from(ro.maxFeePerGas); + } + if (ro.maxPriorityFeePerGas != null) { + tx.maxPriorityFeePerGas = bignumber_1.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 = (0, transactions_1.accessListify)(ro.accessList); + } + if (tx.gasLimit == null && fragment.gas != null) { + intrinsic = 21e3; + bytes = (0, bytes_1.arrayify)(data); + for (i = 0; i < bytes.length; i++) { + intrinsic += 4; + if (bytes[i]) { + intrinsic += 64; + } + } + tx.gasLimit = bignumber_1.BigNumber.from(fragment.gas).add(intrinsic); + } + if (ro.value) { + roValue = bignumber_1.BigNumber.from(ro.value); + if (!roValue.isZero() && !fragment.payable) { + logger.throwError("non-payable method cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: overrides.value + }); + } + tx.value = roValue; + } + if (ro.customData) { + tx.customData = (0, properties_1.shallowCopy)(ro.customData); + } + 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; + leftovers = Object.keys(overrides).filter(function(key) { + return overrides[key] != null; + }); + if (leftovers.length) { + logger.throwError("cannot override " + leftovers.map(function(l) { + return JSON.stringify(l); + }).join(","), logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides", + overrides: leftovers + }); + } + return [2, tx]; + } + }); + }); + } + function buildPopulate(contract, fragment) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return populateTransaction(contract, fragment, args); + }; + } + function buildEstimate(contract, fragment) { + var signerOrProvider = contract.signer || contract.provider; + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!signerOrProvider) { + logger.throwError("estimate require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "estimateGas" + }); + } + return [4, populateTransaction(contract, fragment, args)]; + case 1: + tx = _a.sent(); + return [4, signerOrProvider.estimateGas(tx)]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + } + 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 = (0, properties_1.deepCopy)(log); + var parsed = null; + try { + parsed = contract.interface.parseLog(log); + } catch (e) { + } + 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; + } + 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() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var blockTag, overrides, tx, result, value; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + blockTag = void 0; + if (!(args.length === fragment.inputs.length + 1 && typeof args[args.length - 1] === "object")) return [3, 3]; + overrides = (0, properties_1.shallowCopy)(args.pop()); + if (!(overrides.blockTag != null)) return [3, 2]; + return [4, overrides.blockTag]; + case 1: + blockTag = _a.sent(); + _a.label = 2; + case 2: + delete overrides.blockTag; + args.push(overrides); + _a.label = 3; + case 3: + if (!(contract.deployTransaction != null)) return [3, 5]; + return [4, contract._deployed(blockTag)]; + case 4: + _a.sent(); + _a.label = 5; + case 5: + return [4, populateTransaction(contract, fragment, args)]; + case 6: + tx = _a.sent(); + return [4, signerOrProvider.call(tx, blockTag)]; + case 7: + result = _a.sent(); + try { + value = contract.interface.decodeFunctionResult(fragment, result); + if (collapseSimple && fragment.outputs.length === 1) { + value = value[0]; + } + return [2, value]; + } catch (error) { + if (error.code === logger_1.Logger.errors.CALL_EXCEPTION) { + error.address = contract.address; + error.args = args; + error.transaction = tx; + } + throw error; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + } + function buildSend(contract, fragment) { + return function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var txRequest, tx; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!contract.signer) { + logger.throwError("sending a transaction requires a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "sendTransaction" + }); + } + if (!(contract.deployTransaction != null)) return [3, 2]; + return [4, contract._deployed()]; + case 1: + _a.sent(); + _a.label = 2; + case 2: + return [4, populateTransaction(contract, fragment, args)]; + case 3: + txRequest = _a.sent(); + return [4, contract.signer.sendTransaction(txRequest)]; + case 4: + tx = _a.sent(); + addContractWait(contract, tx); + return [2, tx]; + } + }); + }); + }; + } + 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 = ( + /** @class */ + function() { + function RunningEvent2(tag, filter) { + (0, properties_1.defineReadOnly)(this, "tag", tag); + (0, properties_1.defineReadOnly)(this, "filter", filter); + this._listeners = []; + } + RunningEvent2.prototype.addListener = function(listener, once) { + this._listeners.push({ listener, once }); + }; + RunningEvent2.prototype.removeListener = function(listener) { + var done = false; + this._listeners = this._listeners.filter(function(item) { + if (done || item.listener !== listener) { + return true; + } + done = true; + return false; + }); + }; + RunningEvent2.prototype.removeAllListeners = function() { + this._listeners = []; + }; + RunningEvent2.prototype.listeners = function() { + return this._listeners.map(function(i) { + return i.listener; + }); + }; + RunningEvent2.prototype.listenerCount = function() { + return this._listeners.length; + }; + RunningEvent2.prototype.run = function(args) { + var _this = this; + var listenerCount = this.listenerCount(); + this._listeners = this._listeners.filter(function(item) { + var argsCopy = args.slice(); + setTimeout(function() { + item.listener.apply(_this, argsCopy); + }, 0); + return !item.once; + }); + return listenerCount; + }; + RunningEvent2.prototype.prepareEvent = function(event) { + }; + RunningEvent2.prototype.getEmit = function(event) { + return [event]; + }; + return RunningEvent2; + }() + ); + var ErrorRunningEvent = ( + /** @class */ + function(_super) { + __extends(ErrorRunningEvent2, _super); + function ErrorRunningEvent2() { + return _super.call(this, "error", null) || this; + } + return ErrorRunningEvent2; + }(RunningEvent) + ); + var FragmentRunningEvent = ( + /** @class */ + function(_super) { + __extends(FragmentRunningEvent2, _super); + function FragmentRunningEvent2(address, contractInterface, fragment, topics) { + var _this = this; + var filter = { + 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]; + } + _this = _super.call(this, getEventTag(filter), filter) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "interface", contractInterface); + (0, properties_1.defineReadOnly)(_this, "fragment", fragment); + return _this; + } + FragmentRunningEvent2.prototype.prepareEvent = function(event) { + var _this = this; + _super.prototype.prepareEvent.call(this, event); + event.event = this.fragment.name; + event.eventSignature = this.fragment.format(); + event.decode = function(data, topics) { + return _this.interface.decodeEventLog(_this.fragment, data, topics); + }; + try { + event.args = this.interface.decodeEventLog(this.fragment, event.data, event.topics); + } catch (error) { + event.args = null; + event.decodeError = error; + } + }; + FragmentRunningEvent2.prototype.getEmit = function(event) { + var errors = (0, abi_1.checkResultErrors)(event.args); + if (errors.length) { + throw errors[0].error; + } + var args = (event.args || []).slice(); + args.push(event); + return args; + }; + return FragmentRunningEvent2; + }(RunningEvent) + ); + var WildcardRunningEvent = ( + /** @class */ + function(_super) { + __extends(WildcardRunningEvent2, _super); + function WildcardRunningEvent2(address, contractInterface) { + var _this = _super.call(this, "*", { address }) || this; + (0, properties_1.defineReadOnly)(_this, "address", address); + (0, properties_1.defineReadOnly)(_this, "interface", contractInterface); + return _this; + } + WildcardRunningEvent2.prototype.prepareEvent = function(event) { + var _this = this; + _super.prototype.prepareEvent.call(this, event); + try { + var parsed_1 = this.interface.parseLog(event); + event.event = parsed_1.name; + event.eventSignature = parsed_1.signature; + event.decode = function(data, topics) { + return _this.interface.decodeEventLog(parsed_1.eventFragment, data, topics); + }; + event.args = parsed_1.args; + } catch (error) { + } + }; + return WildcardRunningEvent2; + }(RunningEvent) + ); + var BaseContract = ( + /** @class */ + function() { + function BaseContract2(addressOrName, contractInterface, signerOrProvider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Contract); + (0, properties_1.defineReadOnly)(this, "interface", (0, properties_1.getStatic)(_newTarget, "getInterface")(contractInterface)); + if (signerOrProvider == null) { + (0, properties_1.defineReadOnly)(this, "provider", null); + (0, properties_1.defineReadOnly)(this, "signer", null); + } else if (abstract_signer_1.Signer.isSigner(signerOrProvider)) { + (0, properties_1.defineReadOnly)(this, "provider", signerOrProvider.provider || null); + (0, properties_1.defineReadOnly)(this, "signer", signerOrProvider); + } else if (abstract_provider_1.Provider.isProvider(signerOrProvider)) { + (0, properties_1.defineReadOnly)(this, "provider", signerOrProvider); + (0, properties_1.defineReadOnly)(this, "signer", null); + } else { + logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider); + } + (0, properties_1.defineReadOnly)(this, "callStatic", {}); + (0, properties_1.defineReadOnly)(this, "estimateGas", {}); + (0, properties_1.defineReadOnly)(this, "functions", {}); + (0, properties_1.defineReadOnly)(this, "populateTransaction", {}); + (0, properties_1.defineReadOnly)(this, "filters", {}); + { + var uniqueFilters_1 = {}; + Object.keys(this.interface.events).forEach(function(eventSignature) { + var event = _this.interface.events[eventSignature]; + (0, properties_1.defineReadOnly)(_this.filters, eventSignature, function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return { + address: _this.address, + topics: _this.interface.encodeFilterTopics(event, args) + }; + }); + if (!uniqueFilters_1[event.name]) { + uniqueFilters_1[event.name] = []; + } + uniqueFilters_1[event.name].push(eventSignature); + }); + Object.keys(uniqueFilters_1).forEach(function(name2) { + var filters = uniqueFilters_1[name2]; + if (filters.length === 1) { + (0, properties_1.defineReadOnly)(_this.filters, name2, _this.filters[filters[0]]); + } else { + logger.warn("Duplicate definition of " + name2 + " (" + filters.join(", ") + ")"); + } + }); + } + (0, properties_1.defineReadOnly)(this, "_runningEvents", {}); + (0, properties_1.defineReadOnly)(this, "_wrappedEmits", {}); + if (addressOrName == null) { + logger.throwArgumentError("invalid contract address or ENS name", "addressOrName", addressOrName); + } + (0, properties_1.defineReadOnly)(this, "address", addressOrName); + if (this.provider) { + (0, properties_1.defineReadOnly)(this, "resolvedAddress", resolveName(this.provider, addressOrName)); + } else { + try { + (0, properties_1.defineReadOnly)(this, "resolvedAddress", Promise.resolve((0, address_1.getAddress)(addressOrName))); + } catch (error) { + logger.throwError("provider is required to use ENS name as contract address", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "new Contract" + }); + } + } + var uniqueNames = {}; + var uniqueSignatures = {}; + Object.keys(this.interface.functions).forEach(function(signature) { + var fragment = _this.interface.functions[signature]; + if (uniqueSignatures[signature]) { + logger.warn("Duplicate ABI entry for " + JSON.stringify(signature)); + return; + } + uniqueSignatures[signature] = true; + { + var name_1 = fragment.name; + if (!uniqueNames["%" + name_1]) { + uniqueNames["%" + name_1] = []; + } + uniqueNames["%" + name_1].push(signature); + } + if (_this[signature] == null) { + (0, properties_1.defineReadOnly)(_this, signature, buildDefault(_this, fragment, true)); + } + if (_this.functions[signature] == null) { + (0, properties_1.defineReadOnly)(_this.functions, signature, buildDefault(_this, fragment, false)); + } + if (_this.callStatic[signature] == null) { + (0, properties_1.defineReadOnly)(_this.callStatic, signature, buildCall(_this, fragment, true)); + } + if (_this.populateTransaction[signature] == null) { + (0, properties_1.defineReadOnly)(_this.populateTransaction, signature, buildPopulate(_this, fragment)); + } + if (_this.estimateGas[signature] == null) { + (0, properties_1.defineReadOnly)(_this.estimateGas, signature, buildEstimate(_this, fragment)); + } + }); + Object.keys(uniqueNames).forEach(function(name2) { + var signatures = uniqueNames[name2]; + if (signatures.length > 1) { + return; + } + name2 = name2.substring(1); + var signature = signatures[0]; + try { + if (_this[name2] == null) { + (0, properties_1.defineReadOnly)(_this, name2, _this[signature]); + } + } catch (e) { + } + if (_this.functions[name2] == null) { + (0, properties_1.defineReadOnly)(_this.functions, name2, _this.functions[signature]); + } + if (_this.callStatic[name2] == null) { + (0, properties_1.defineReadOnly)(_this.callStatic, name2, _this.callStatic[signature]); + } + if (_this.populateTransaction[name2] == null) { + (0, properties_1.defineReadOnly)(_this.populateTransaction, name2, _this.populateTransaction[signature]); + } + if (_this.estimateGas[name2] == null) { + (0, properties_1.defineReadOnly)(_this.estimateGas, name2, _this.estimateGas[signature]); + } + }); + } + BaseContract2.getContractAddress = function(transaction) { + return (0, address_1.getContractAddress)(transaction); + }; + BaseContract2.getInterface = function(contractInterface) { + if (abi_1.Interface.isInterface(contractInterface)) { + return contractInterface; + } + return new abi_1.Interface(contractInterface); + }; + BaseContract2.prototype.deployed = function() { + return this._deployed(); + }; + BaseContract2.prototype._deployed = function(blockTag) { + var _this = this; + if (!this._deployedPromise) { + if (this.deployTransaction) { + this._deployedPromise = this.deployTransaction.wait().then(function() { + return _this; + }); + } else { + this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function(code) { + if (code === "0x") { + logger.throwError("contract not deployed", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + contractAddress: _this.address, + operation: "getDeployed" + }); + } + return _this; + }); + } + } + return this._deployedPromise; + }; + BaseContract2.prototype.fallback = function(overrides) { + var _this = this; + if (!this.signer) { + logger.throwError("sending a transactions require a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); + } + var tx = (0, properties_1.shallowCopy)(overrides || {}); + ["from", "to"].forEach(function(key) { + if (tx[key] == null) { + return; + } + logger.throwError("cannot override " + key, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key }); + }); + tx.to = this.resolvedAddress; + return this.deployed().then(function() { + return _this.signer.sendTransaction(tx); + }); + }; + BaseContract2.prototype.connect = function(signerOrProvider) { + if (typeof signerOrProvider === "string") { + signerOrProvider = new abstract_signer_1.VoidSigner(signerOrProvider, this.provider); + } + var contract = new this.constructor(this.address, this.interface, signerOrProvider); + if (this.deployTransaction) { + (0, properties_1.defineReadOnly)(contract, "deployTransaction", this.deployTransaction); + } + return contract; + }; + BaseContract2.prototype.attach = function(addressOrName) { + return new this.constructor(addressOrName, this.interface, this.signer || this.provider); + }; + BaseContract2.isIndexed = function(value) { + return abi_1.Indexed.isIndexed(value); + }; + BaseContract2.prototype._normalizeRunningEvent = function(runningEvent) { + if (this._runningEvents[runningEvent.tag]) { + return this._runningEvents[runningEvent.tag]; + } + return runningEvent; + }; + BaseContract2.prototype._getRunningEvent = function(eventName) { + if (typeof eventName === "string") { + if (eventName === "error") { + return this._normalizeRunningEvent(new ErrorRunningEvent()); + } + if (eventName === "event") { + return this._normalizeRunningEvent(new RunningEvent("event", null)); + } + if (eventName === "*") { + return this._normalizeRunningEvent(new WildcardRunningEvent(this.address, this.interface)); + } + var fragment = this.interface.getEvent(eventName); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment)); + } + if (eventName.topics && eventName.topics.length > 0) { + try { + var topic = eventName.topics[0]; + if (typeof topic !== "string") { + throw new Error("invalid topic"); + } + var fragment = this.interface.getEvent(topic); + return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment, eventName.topics)); + } catch (error) { + } + 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)); + }; + BaseContract2.prototype._checkRunningEvents = function(runningEvent) { + if (runningEvent.listenerCount() === 0) { + delete this._runningEvents[runningEvent.tag]; + var emit = this._wrappedEmits[runningEvent.tag]; + if (emit && runningEvent.filter) { + this.provider.off(runningEvent.filter, emit); + delete this._wrappedEmits[runningEvent.tag]; + } + } + }; + BaseContract2.prototype._wrapEvent = function(runningEvent, log, listener) { + var _this = this; + var event = (0, properties_1.deepCopy)(log); + event.removeListener = function() { + if (!listener) { + return; + } + runningEvent.removeListener(listener); + _this._checkRunningEvents(runningEvent); + }; + event.getBlock = function() { + return _this.provider.getBlock(log.blockHash); + }; + event.getTransaction = function() { + return _this.provider.getTransaction(log.transactionHash); + }; + event.getTransactionReceipt = function() { + return _this.provider.getTransactionReceipt(log.transactionHash); + }; + runningEvent.prepareEvent(event); + return event; + }; + BaseContract2.prototype._addEventListener = function(runningEvent, listener, once) { + var _this = this; + if (!this.provider) { + logger.throwError("events require a provider or a signer with a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" }); + } + runningEvent.addListener(listener, once); + this._runningEvents[runningEvent.tag] = runningEvent; + if (!this._wrappedEmits[runningEvent.tag]) { + var wrappedEmit = function(log) { + var event = _this._wrapEvent(runningEvent, log, listener); + if (event.decodeError == null) { + try { + var args = runningEvent.getEmit(event); + _this.emit.apply(_this, __spreadArray([runningEvent.filter], args, false)); + } catch (error) { + event.decodeError = error.error; + } + } + if (runningEvent.filter != null) { + _this.emit("event", event); + } + if (event.decodeError != null) { + _this.emit("error", event.decodeError, event); + } + }; + this._wrappedEmits[runningEvent.tag] = wrappedEmit; + if (runningEvent.filter != null) { + this.provider.on(runningEvent.filter, wrappedEmit); + } + } + }; + BaseContract2.prototype.queryFilter = function(event, fromBlockOrBlockhash, toBlock) { + var _this = this; + var runningEvent = this._getRunningEvent(event); + var filter = (0, properties_1.shallowCopy)(runningEvent.filter); + if (typeof fromBlockOrBlockhash === "string" && (0, bytes_1.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 _this._wrapEvent(runningEvent, log, null); + }); + }); + }; + BaseContract2.prototype.on = function(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, false); + return this; + }; + BaseContract2.prototype.once = function(event, listener) { + this._addEventListener(this._getRunningEvent(event), listener, true); + return this; + }; + BaseContract2.prototype.emit = function(eventName) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + if (!this.provider) { + return false; + } + var runningEvent = this._getRunningEvent(eventName); + var result = runningEvent.run(args) > 0; + this._checkRunningEvents(runningEvent); + return result; + }; + BaseContract2.prototype.listenerCount = function(eventName) { + var _this = this; + if (!this.provider) { + return 0; + } + if (eventName == null) { + return Object.keys(this._runningEvents).reduce(function(accum, key) { + return accum + _this._runningEvents[key].listenerCount(); + }, 0); + } + return this._getRunningEvent(eventName).listenerCount(); + }; + BaseContract2.prototype.listeners = function(eventName) { + if (!this.provider) { + return []; + } + if (eventName == null) { + var result_1 = []; + for (var tag in this._runningEvents) { + this._runningEvents[tag].listeners().forEach(function(listener) { + result_1.push(listener); + }); + } + return result_1; + } + return this._getRunningEvent(eventName).listeners(); + }; + BaseContract2.prototype.removeAllListeners = function(eventName) { + if (!this.provider) { + return this; + } + if (eventName == null) { + for (var tag in this._runningEvents) { + var runningEvent_1 = this._runningEvents[tag]; + runningEvent_1.removeAllListeners(); + this._checkRunningEvents(runningEvent_1); + } + return this; + } + var runningEvent = this._getRunningEvent(eventName); + runningEvent.removeAllListeners(); + this._checkRunningEvents(runningEvent); + return this; + }; + BaseContract2.prototype.off = function(eventName, listener) { + if (!this.provider) { + return this; + } + var runningEvent = this._getRunningEvent(eventName); + runningEvent.removeListener(listener); + this._checkRunningEvents(runningEvent); + return this; + }; + BaseContract2.prototype.removeListener = function(eventName, listener) { + return this.off(eventName, listener); + }; + return BaseContract2; + }() + ); + exports2.BaseContract = BaseContract; + var Contract = ( + /** @class */ + function(_super) { + __extends(Contract2, _super); + function Contract2() { + return _super !== null && _super.apply(this, arguments) || this; + } + return Contract2; + }(BaseContract) + ); + exports2.Contract = Contract; + var ContractFactory = ( + /** @class */ + function() { + function ContractFactory2(contractInterface, bytecode, signer) { + var _newTarget = this.constructor; + var bytecodeHex = null; + if (typeof bytecode === "string") { + bytecodeHex = bytecode; + } else if ((0, bytes_1.isBytes)(bytecode)) { + bytecodeHex = (0, bytes_1.hexlify)(bytecode); + } else if (bytecode && typeof bytecode.object === "string") { + bytecodeHex = bytecode.object; + } else { + bytecodeHex = "!"; + } + if (bytecodeHex.substring(0, 2) !== "0x") { + bytecodeHex = "0x" + bytecodeHex; + } + if (!(0, bytes_1.isHexString)(bytecodeHex) || bytecodeHex.length % 2) { + logger.throwArgumentError("invalid bytecode", "bytecode", bytecode); + } + if (signer && !abstract_signer_1.Signer.isSigner(signer)) { + logger.throwArgumentError("invalid signer", "signer", signer); + } + (0, properties_1.defineReadOnly)(this, "bytecode", bytecodeHex); + (0, properties_1.defineReadOnly)(this, "interface", (0, properties_1.getStatic)(_newTarget, "getInterface")(contractInterface)); + (0, properties_1.defineReadOnly)(this, "signer", signer || null); + } + ContractFactory2.prototype.getDeployTransaction = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var tx = {}; + if (args.length === this.interface.deploy.inputs.length + 1 && typeof args[args.length - 1] === "object") { + tx = (0, properties_1.shallowCopy)(args.pop()); + for (var key in tx) { + if (!allowedTransactionKeys[key]) { + throw new Error("unknown transaction override " + key); + } + } + } + ["data", "from", "to"].forEach(function(key2) { + if (tx[key2] == null) { + return; + } + logger.throwError("cannot override " + key2, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key2 }); + }); + if (tx.value) { + var value = bignumber_1.BigNumber.from(tx.value); + if (!value.isZero() && !this.interface.deploy.payable) { + logger.throwError("non-payable constructor cannot override value", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "overrides.value", + value: tx.value + }); + } + } + logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + tx.data = (0, bytes_1.hexlify)((0, bytes_1.concat)([ + this.bytecode, + this.interface.encodeDeploy(args) + ])); + return tx; + }; + ContractFactory2.prototype.deploy = function() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(this, void 0, void 0, function() { + var overrides, params, unsignedTx, tx, address, contract; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + overrides = {}; + if (args.length === this.interface.deploy.inputs.length + 1) { + overrides = args.pop(); + } + logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor"); + return [4, resolveAddresses(this.signer, args, this.interface.deploy.inputs)]; + case 1: + params = _a.sent(); + params.push(overrides); + unsignedTx = this.getDeployTransaction.apply(this, params); + return [4, this.signer.sendTransaction(unsignedTx)]; + case 2: + tx = _a.sent(); + address = (0, properties_1.getStatic)(this.constructor, "getContractAddress")(tx); + contract = (0, properties_1.getStatic)(this.constructor, "getContract")(address, this.interface, this.signer); + addContractWait(contract, tx); + (0, properties_1.defineReadOnly)(contract, "deployTransaction", tx); + return [2, contract]; + } + }); + }); + }; + ContractFactory2.prototype.attach = function(address) { + return this.constructor.getContract(address, this.interface, this.signer); + }; + ContractFactory2.prototype.connect = function(signer) { + return new this.constructor(this.interface, this.bytecode, signer); + }; + ContractFactory2.fromSolidity = function(compilerOutput, signer) { + if (compilerOutput == null) { + logger.throwError("missing compiler output", logger_1.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); + }; + ContractFactory2.getInterface = function(contractInterface) { + return Contract.getInterface(contractInterface); + }; + ContractFactory2.getContractAddress = function(tx) { + return (0, address_1.getContractAddress)(tx); + }; + ContractFactory2.getContract = function(address, contractInterface, signer) { + return new Contract(address, contractInterface, signer); + }; + return ContractFactory2; + }() + ); + exports2.ContractFactory = ContractFactory; + } +}); + +// node_modules/@ethersproject/basex/lib/index.js +var require_lib17 = __commonJS({ + "node_modules/@ethersproject/basex/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Base58 = exports2.Base32 = exports2.BaseX = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var BaseX = ( + /** @class */ + function() { + function BaseX2(alphabet) { + (0, properties_1.defineReadOnly)(this, "alphabet", alphabet); + (0, properties_1.defineReadOnly)(this, "base", alphabet.length); + (0, properties_1.defineReadOnly)(this, "_alphabetMap", {}); + (0, properties_1.defineReadOnly)(this, "_leader", alphabet.charAt(0)); + for (var i = 0; i < alphabet.length; i++) { + this._alphabetMap[alphabet.charAt(i)] = i; + } + } + BaseX2.prototype.encode = function(value) { + var source = (0, bytes_1.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 = ""; + for (var k = 0; source[k] === 0 && k < source.length - 1; ++k) { + string += this._leader; + } + for (var q = digits.length - 1; q >= 0; --q) { + string += this.alphabet[digits[q]]; + } + return string; + }; + BaseX2.prototype.decode = function(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 === void 0) { + 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 & 255; + carry >>= 8; + } + while (carry > 0) { + bytes.push(carry & 255); + carry >>= 8; + } + } + for (var k = 0; value[k] === this._leader && k < value.length - 1; ++k) { + bytes.push(0); + } + return (0, bytes_1.arrayify)(new Uint8Array(bytes.reverse())); + }; + return BaseX2; + }() + ); + exports2.BaseX = BaseX; + var Base32 = new BaseX("abcdefghijklmnopqrstuvwxyz234567"); + exports2.Base32 = Base32; + var Base58 = new BaseX("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); + exports2.Base58 = Base58; + } +}); + +// node_modules/@ethersproject/pbkdf2/lib/pbkdf2.js +var require_pbkdf2 = __commonJS({ + "node_modules/@ethersproject/pbkdf2/lib/pbkdf2.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.pbkdf2 = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + function bufferify(value) { + return Buffer.from((0, bytes_1.arrayify)(value)); + } + function pbkdf2(password, salt, iterations, keylen, hashAlgorithm) { + return (0, bytes_1.hexlify)((0, crypto_1.pbkdf2Sync)(bufferify(password), bufferify(salt), iterations, keylen, hashAlgorithm)); + } + exports2.pbkdf2 = pbkdf2; + } +}); + +// node_modules/@ethersproject/pbkdf2/lib/index.js +var require_lib18 = __commonJS({ + "node_modules/@ethersproject/pbkdf2/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.pbkdf2 = void 0; + var pbkdf2_1 = require_pbkdf2(); + Object.defineProperty(exports2, "pbkdf2", { enumerable: true, get: function() { + return pbkdf2_1.pbkdf2; + } }); + } +}); + +// node_modules/@ethersproject/sha2/lib/types.js +var require_types = __commonJS({ + "node_modules/@ethersproject/sha2/lib/types.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SupportedAlgorithm = void 0; + var SupportedAlgorithm; + (function(SupportedAlgorithm2) { + SupportedAlgorithm2["sha256"] = "sha256"; + SupportedAlgorithm2["sha512"] = "sha512"; + })(SupportedAlgorithm = exports2.SupportedAlgorithm || (exports2.SupportedAlgorithm = {})); + } +}); + +// node_modules/@ethersproject/sha2/lib/_version.js +var require_version15 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "sha2/5.5.0"; + } +}); + +// node_modules/@ethersproject/sha2/lib/sha2.js +var require_sha2 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/sha2.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.computeHmac = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + var types_1 = require_types(); + var logger_1 = require_lib(); + var _version_1 = require_version15(); + var logger = new logger_1.Logger(_version_1.version); + function ripemd160(data) { + return "0x" + (0, crypto_1.createHash)("ripemd160").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.ripemd160 = ripemd160; + function sha256(data) { + return "0x" + (0, crypto_1.createHash)("sha256").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.sha256 = sha256; + function sha512(data) { + return "0x" + (0, crypto_1.createHash)("sha512").update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.sha512 = sha512; + function computeHmac(algorithm, key, data) { + if (!types_1.SupportedAlgorithm[algorithm]) { + logger.throwError("unsupported algorithm - " + algorithm, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "computeHmac", + algorithm + }); + } + return "0x" + (0, crypto_1.createHmac)(algorithm, Buffer.from((0, bytes_1.arrayify)(key))).update(Buffer.from((0, bytes_1.arrayify)(data))).digest("hex"); + } + exports2.computeHmac = computeHmac; + } +}); + +// node_modules/@ethersproject/sha2/lib/index.js +var require_lib19 = __commonJS({ + "node_modules/@ethersproject/sha2/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.SupportedAlgorithm = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = exports2.computeHmac = void 0; + var sha2_1 = require_sha2(); + Object.defineProperty(exports2, "computeHmac", { enumerable: true, get: function() { + return sha2_1.computeHmac; + } }); + Object.defineProperty(exports2, "ripemd160", { enumerable: true, get: function() { + return sha2_1.ripemd160; + } }); + Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() { + return sha2_1.sha256; + } }); + Object.defineProperty(exports2, "sha512", { enumerable: true, get: function() { + return sha2_1.sha512; + } }); + var types_1 = require_types(); + Object.defineProperty(exports2, "SupportedAlgorithm", { enumerable: true, get: function() { + return types_1.SupportedAlgorithm; + } }); + } +}); + +// node_modules/@ethersproject/wordlists/lib/_version.js +var require_version16 = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "wordlists/5.5.0"; + } +}); + +// node_modules/@ethersproject/wordlists/lib/wordlist.js +var require_wordlist = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/wordlist.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.logger = void 0; + var exportWordlist = false; + var hash_1 = require_lib10(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version16(); + exports2.logger = new logger_1.Logger(_version_1.version); + var Wordlist = ( + /** @class */ + function() { + function Wordlist2(locale) { + var _newTarget = this.constructor; + exports2.logger.checkAbstract(_newTarget, Wordlist2); + (0, properties_1.defineReadOnly)(this, "locale", locale); + } + Wordlist2.prototype.split = function(mnemonic) { + return mnemonic.toLowerCase().split(/ +/g); + }; + Wordlist2.prototype.join = function(words) { + return words.join(" "); + }; + Wordlist2.check = function(wordlist) { + var words = []; + for (var i = 0; i < 2048; i++) { + var word = wordlist.getWord(i); + if (i !== wordlist.getWordIndex(word)) { + return "0x"; + } + words.push(word); + } + return (0, hash_1.id)(words.join("\n") + "\n"); + }; + Wordlist2.register = function(lang, name2) { + if (!name2) { + name2 = lang.locale; + } + if (exportWordlist) { + try { + var anyGlobal = window; + if (anyGlobal._ethers && anyGlobal._ethers.wordlists) { + if (!anyGlobal._ethers.wordlists[name2]) { + (0, properties_1.defineReadOnly)(anyGlobal._ethers.wordlists, name2, lang); + } + } + } catch (error) { + } + } + }; + return Wordlist2; + }() + ); + exports2.Wordlist = Wordlist; + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-cz.js +var require_lang_cz = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-cz.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langCz = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbdikaceAbecedaAdresaAgreseAkceAktovkaAlejAlkoholAmputaceAnanasAndulkaAnekdotaAnketaAntikaAnulovatArchaAroganceAsfaltAsistentAspiraceAstmaAstronomAtlasAtletikaAtolAutobusAzylBabkaBachorBacilBaculkaBadatelBagetaBagrBahnoBakterieBaladaBaletkaBalkonBalonekBalvanBalzaBambusBankomatBarbarBaretBarmanBarokoBarvaBaterkaBatohBavlnaBazalkaBazilikaBazukaBednaBeranBesedaBestieBetonBezinkaBezmocBeztakBicyklBidloBiftekBikinyBilanceBiografBiologBitvaBizonBlahobytBlatouchBlechaBleduleBleskBlikatBliznaBlokovatBlouditBludBobekBobrBodlinaBodnoutBohatostBojkotBojovatBokorysBolestBorecBoroviceBotaBoubelBouchatBoudaBouleBouratBoxerBradavkaBramboraBrankaBratrBreptaBriketaBrkoBrlohBronzBroskevBrunetkaBrusinkaBrzdaBrzyBublinaBubnovatBuchtaBuditelBudkaBudovaBufetBujarostBukviceBuldokBulvaBundaBunkrBurzaButikBuvolBuzolaBydletBylinaBytovkaBzukotCapartCarevnaCedrCeduleCejchCejnCelaCelerCelkemCelniceCeninaCennostCenovkaCentrumCenzorCestopisCetkaChalupaChapadloCharitaChataChechtatChemieChichotChirurgChladChlebaChlubitChmelChmuraChobotChocholChodbaCholeraChomoutChopitChorobaChovChrapotChrlitChrtChrupChtivostChudinaChutnatChvatChvilkaChvostChybaChystatChytitCibuleCigaretaCihelnaCihlaCinkotCirkusCisternaCitaceCitrusCizinecCizostClonaCokolivCouvatCtitelCtnostCudnostCuketaCukrCupotCvaknoutCvalCvikCvrkotCyklistaDalekoDarebaDatelDatumDceraDebataDechovkaDecibelDeficitDeflaceDeklDekretDemokratDepreseDerbyDeskaDetektivDikobrazDiktovatDiodaDiplomDiskDisplejDivadloDivochDlahaDlouhoDluhopisDnesDobroDobytekDocentDochutitDodnesDohledDohodaDohraDojemDojniceDokladDokolaDoktorDokumentDolarDolevaDolinaDomaDominantDomluvitDomovDonutitDopadDopisDoplnitDoposudDoprovodDopustitDorazitDorostDortDosahDoslovDostatekDosudDosytaDotazDotekDotknoutDoufatDoutnatDovozceDozaduDoznatDozorceDrahotaDrakDramatikDravecDrazeDrdolDrobnostDrogerieDrozdDrsnostDrtitDrzostDubenDuchovnoDudekDuhaDuhovkaDusitDusnoDutostDvojiceDvorecDynamitEkologEkonomieElektronElipsaEmailEmiseEmoceEmpatieEpizodaEpochaEpopejEposEsejEsenceEskortaEskymoEtiketaEuforieEvoluceExekuceExkurzeExpediceExplozeExportExtraktFackaFajfkaFakultaFanatikFantazieFarmacieFavoritFazoleFederaceFejetonFenkaFialkaFigurantFilozofFiltrFinanceFintaFixaceFjordFlanelFlirtFlotilaFondFosforFotbalFotkaFotonFrakceFreskaFrontaFukarFunkceFyzikaGalejeGarantGenetikaGeologGilotinaGlazuraGlejtGolemGolfistaGotikaGrafGramofonGranuleGrepGrilGrogGroteskaGumaHadiceHadrHalaHalenkaHanbaHanopisHarfaHarpunaHavranHebkostHejkalHejnoHejtmanHektarHelmaHematomHerecHernaHesloHezkyHistorikHladovkaHlasivkyHlavaHledatHlenHlodavecHlohHloupostHltatHlubinaHluchotaHmatHmotaHmyzHnisHnojivoHnoutHoblinaHobojHochHodinyHodlatHodnotaHodovatHojnostHokejHolinkaHolkaHolubHomoleHonitbaHonoraceHoralHordaHorizontHorkoHorlivecHormonHorninaHoroskopHorstvoHospodaHostinaHotovostHoubaHoufHoupatHouskaHovorHradbaHraniceHravostHrazdaHrbolekHrdinaHrdloHrdostHrnekHrobkaHromadaHrotHroudaHrozenHrstkaHrubostHryzatHubenostHubnoutHudbaHukotHumrHusitaHustotaHvozdHybnostHydrantHygienaHymnaHysterikIdylkaIhnedIkonaIluzeImunitaInfekceInflaceInkasoInovaceInspekceInternetInvalidaInvestorInzerceIronieJablkoJachtaJahodaJakmileJakostJalovecJantarJarmarkJaroJasanJasnoJatkaJavorJazykJedinecJedleJednatelJehlanJekotJelenJelitoJemnostJenomJepiceJeseterJevitJezdecJezeroJinakJindyJinochJiskraJistotaJitrniceJizvaJmenovatJogurtJurtaKabaretKabelKabinetKachnaKadetKadidloKahanKajakKajutaKakaoKaktusKalamitaKalhotyKalibrKalnostKameraKamkolivKamnaKanibalKanoeKantorKapalinaKapelaKapitolaKapkaKapleKapotaKaprKapustaKapybaraKaramelKarotkaKartonKasaKatalogKatedraKauceKauzaKavalecKazajkaKazetaKazivostKdekolivKdesiKedlubenKempKeramikaKinoKlacekKladivoKlamKlapotKlasikaKlaunKlecKlenbaKlepatKlesnoutKlidKlimaKlisnaKloboukKlokanKlopaKloubKlubovnaKlusatKluzkostKmenKmitatKmotrKnihaKnotKoaliceKoberecKobkaKoblihaKobylaKocourKohoutKojenecKokosKoktejlKolapsKoledaKolizeKoloKomandoKometaKomikKomnataKomoraKompasKomunitaKonatKonceptKondiceKonecKonfeseKongresKoninaKonkursKontaktKonzervaKopanecKopieKopnoutKoprovkaKorbelKorektorKormidloKoroptevKorpusKorunaKorytoKorzetKosatecKostkaKotelKotletaKotoulKoukatKoupelnaKousekKouzloKovbojKozaKozorohKrabiceKrachKrajinaKralovatKrasopisKravataKreditKrejcarKresbaKrevetaKriketKritikKrizeKrkavecKrmelecKrmivoKrocanKrokKronikaKropitKroupaKrovkaKrtekKruhadloKrupiceKrutostKrvinkaKrychleKryptaKrystalKrytKudlankaKufrKujnostKuklaKulajdaKulichKulkaKulometKulturaKunaKupodivuKurtKurzorKutilKvalitaKvasinkaKvestorKynologKyselinaKytaraKyticeKytkaKytovecKyvadloLabradorLachtanLadnostLaikLakomecLamelaLampaLanovkaLasiceLasoLasturaLatinkaLavinaLebkaLeckdyLedenLedniceLedovkaLedvinaLegendaLegieLegraceLehceLehkostLehnoutLektvarLenochodLentilkaLepenkaLepidloLetadloLetecLetmoLetokruhLevhartLevitaceLevobokLibraLichotkaLidojedLidskostLihovinaLijavecLilekLimetkaLinieLinkaLinoleumListopadLitinaLitovatLobistaLodivodLogikaLogopedLokalitaLoketLomcovatLopataLopuchLordLososLotrLoudalLouhLoukaLouskatLovecLstivostLucernaLuciferLumpLuskLustraceLviceLyraLyrikaLysinaMadamMadloMagistrMahagonMajetekMajitelMajoritaMakakMakoviceMakrelaMalbaMalinaMalovatMalviceMaminkaMandleMankoMarnostMasakrMaskotMasopustMaticeMatrikaMaturitaMazanecMazivoMazlitMazurkaMdlobaMechanikMeditaceMedovinaMelasaMelounMentolkaMetlaMetodaMetrMezeraMigraceMihnoutMihuleMikinaMikrofonMilenecMilimetrMilostMimikaMincovnaMinibarMinometMinulostMiskaMistrMixovatMladostMlhaMlhovinaMlokMlsatMluvitMnichMnohemMobilMocnostModelkaModlitbaMohylaMokroMolekulaMomentkaMonarchaMonoklMonstrumMontovatMonzunMosazMoskytMostMotivaceMotorkaMotykaMouchaMoudrostMozaikaMozekMozolMramorMravenecMrkevMrtvolaMrzetMrzutostMstitelMudrcMuflonMulatMumieMuniceMusetMutaceMuzeumMuzikantMyslivecMzdaNabouratNachytatNadaceNadbytekNadhozNadobroNadpisNahlasNahnatNahodileNahraditNaivitaNajednouNajistoNajmoutNaklonitNakonecNakrmitNalevoNamazatNamluvitNanometrNaokoNaopakNaostroNapadatNapevnoNaplnitNapnoutNaposledNaprostoNaroditNarubyNarychloNasaditNasekatNaslepoNastatNatolikNavenekNavrchNavzdoryNazvatNebeNechatNeckyNedalekoNedbatNeduhNegaceNehetNehodaNejenNejprveNeklidNelibostNemilostNemocNeochotaNeonkaNepokojNerostNervNesmyslNesouladNetvorNeuronNevinaNezvykleNicotaNijakNikamNikdyNiklNikterakNitroNoclehNohaviceNominaceNoraNorekNositelNosnostNouzeNovinyNovotaNozdraNudaNudleNugetNutitNutnostNutrieNymfaObalObarvitObavaObdivObecObehnatObejmoutObezitaObhajobaObilniceObjasnitObjektObklopitOblastOblekOblibaOblohaObludaObnosObohatitObojekOboutObrazecObrnaObrubaObrysObsahObsluhaObstaratObuvObvazObvinitObvodObvykleObyvatelObzorOcasOcelOcenitOchladitOchotaOchranaOcitnoutOdbojOdbytOdchodOdcizitOdebratOdeslatOdevzdatOdezvaOdhadceOdhoditOdjetOdjinudOdkazOdkoupitOdlivOdlukaOdmlkaOdolnostOdpadOdpisOdploutOdporOdpustitOdpykatOdrazkaOdsouditOdstupOdsunOdtokOdtudOdvahaOdvetaOdvolatOdvracetOdznakOfinaOfsajdOhlasOhniskoOhradaOhrozitOhryzekOkapOkeniceOklikaOknoOkouzlitOkovyOkrasaOkresOkrsekOkruhOkupantOkurkaOkusitOlejninaOlizovatOmakOmeletaOmezitOmladinaOmlouvatOmluvaOmylOnehdyOpakovatOpasekOperaceOpiceOpilostOpisovatOporaOpoziceOpravduOprotiOrbitalOrchestrOrgieOrliceOrlojOrtelOsadaOschnoutOsikaOsivoOslavaOslepitOslnitOslovitOsnovaOsobaOsolitOspalecOstenOstrahaOstudaOstychOsvojitOteplitOtiskOtopOtrhatOtrlostOtrokOtrubyOtvorOvanoutOvarOvesOvlivnitOvoceOxidOzdobaPachatelPacientPadouchPahorekPaktPalandaPalecPalivoPalubaPamfletPamlsekPanenkaPanikaPannaPanovatPanstvoPantoflePaprikaParketaParodiePartaParukaParybaPasekaPasivitaPastelkaPatentPatronaPavoukPaznehtPazourekPeckaPedagogPejsekPekloPelotonPenaltaPendrekPenzePeriskopPeroPestrostPetardaPeticePetrolejPevninaPexesoPianistaPihaPijavicePiklePiknikPilinaPilnostPilulkaPinzetaPipetaPisatelPistolePitevnaPivnicePivovarPlacentaPlakatPlamenPlanetaPlastikaPlatitPlavidloPlazPlechPlemenoPlentaPlesPletivoPlevelPlivatPlnitPlnoPlochaPlodinaPlombaPloutPlukPlynPobavitPobytPochodPocitPoctivecPodatPodcenitPodepsatPodhledPodivitPodkladPodmanitPodnikPodobaPodporaPodrazPodstataPodvodPodzimPoeziePohankaPohnutkaPohovorPohromaPohybPointaPojistkaPojmoutPokazitPoklesPokojPokrokPokutaPokynPolednePolibekPolknoutPolohaPolynomPomaluPominoutPomlkaPomocPomstaPomysletPonechatPonorkaPonurostPopadatPopelPopisekPoplachPoprositPopsatPopudPoradcePorcePorodPoruchaPoryvPosaditPosedPosilaPoskokPoslanecPosouditPospoluPostavaPosudekPosypPotahPotkanPotleskPotomekPotravaPotupaPotvoraPoukazPoutoPouzdroPovahaPovidlaPovlakPovozPovrchPovstatPovykPovzdechPozdravPozemekPoznatekPozorPozvatPracovatPrahoryPraktikaPralesPraotecPraporekPrasePravdaPrincipPrknoProbuditProcentoProdejProfeseProhraProjektProlomitPromilePronikatPropadProrokProsbaProtonProutekProvazPrskavkaPrstenPrudkostPrutPrvekPrvohoryPsanecPsovodPstruhPtactvoPubertaPuchPudlPukavecPuklinaPukrlePultPumpaPuncPupenPusaPusinkaPustinaPutovatPutykaPyramidaPyskPytelRacekRachotRadiaceRadniceRadonRaftRagbyRaketaRakovinaRamenoRampouchRandeRarachRaritaRasovnaRastrRatolestRazanceRazidloReagovatReakceReceptRedaktorReferentReflexRejnokReklamaRekordRekrutRektorReputaceRevizeRevmaRevolverRezervaRiskovatRizikoRobotikaRodokmenRohovkaRokleRokokoRomanetoRopovodRopuchaRorejsRosolRostlinaRotmistrRotopedRotundaRoubenkaRouchoRoupRouraRovinaRovniceRozborRozchodRozdatRozeznatRozhodceRozinkaRozjezdRozkazRozlohaRozmarRozpadRozruchRozsahRoztokRozumRozvodRubrikaRuchadloRukaviceRukopisRybaRybolovRychlostRydloRypadloRytinaRyzostSadistaSahatSakoSamecSamizdatSamotaSanitkaSardinkaSasankaSatelitSazbaSazeniceSborSchovatSebrankaSeceseSedadloSedimentSedloSehnatSejmoutSekeraSektaSekundaSekvojeSemenoSenoServisSesaditSeshoraSeskokSeslatSestraSesuvSesypatSetbaSetinaSetkatSetnoutSetrvatSeverSeznamShodaShrnoutSifonSilniceSirkaSirotekSirupSituaceSkafandrSkaliskoSkanzenSkautSkeptikSkicaSkladbaSkleniceSkloSkluzSkobaSkokanSkoroSkriptaSkrzSkupinaSkvostSkvrnaSlabikaSladidloSlaninaSlastSlavnostSledovatSlepecSlevaSlezinaSlibSlinaSlizniceSlonSloupekSlovoSluchSluhaSlunceSlupkaSlzaSmaragdSmetanaSmilstvoSmlouvaSmogSmradSmrkSmrtkaSmutekSmyslSnadSnahaSnobSobotaSochaSodovkaSokolSopkaSotvaSoubojSoucitSoudceSouhlasSouladSoumrakSoupravaSousedSoutokSouvisetSpalovnaSpasitelSpisSplavSpodekSpojenecSpoluSponzorSpornostSpoustaSprchaSpustitSrandaSrazSrdceSrnaSrnecSrovnatSrpenSrstSrubStaniceStarostaStatikaStavbaStehnoStezkaStodolaStolekStopaStornoStoupatStrachStresStrhnoutStromStrunaStudnaStupniceStvolStykSubjektSubtropySucharSudostSuknoSundatSunoutSurikataSurovinaSvahSvalstvoSvetrSvatbaSvazekSvisleSvitekSvobodaSvodidloSvorkaSvrabSykavkaSykotSynekSynovecSypatSypkostSyrovostSyselSytostTabletkaTabuleTahounTajemnoTajfunTajgaTajitTajnostTaktikaTamhleTamponTancovatTanecTankerTapetaTaveninaTazatelTechnikaTehdyTekutinaTelefonTemnotaTendenceTenistaTenorTeplotaTepnaTeprveTerapieTermoskaTextilTichoTiskopisTitulekTkadlecTkaninaTlapkaTleskatTlukotTlupaTmelToaletaTopinkaTopolTorzoTouhaToulecTradiceTraktorTrampTrasaTraverzaTrefitTrestTrezorTrhavinaTrhlinaTrochuTrojiceTroskaTroubaTrpceTrpitelTrpkostTrubecTruchlitTruhliceTrusTrvatTudyTuhnoutTuhostTundraTuristaTurnajTuzemskoTvarohTvorbaTvrdostTvrzTygrTykevUbohostUbozeUbratUbrousekUbrusUbytovnaUchoUctivostUdivitUhraditUjednatUjistitUjmoutUkazatelUklidnitUklonitUkotvitUkrojitUliceUlitaUlovitUmyvadloUnavitUniformaUniknoutUpadnoutUplatnitUplynoutUpoutatUpravitUranUrazitUsednoutUsilovatUsmrtitUsnadnitUsnoutUsouditUstlatUstrnoutUtahovatUtkatUtlumitUtonoutUtopenecUtrousitUvalitUvolnitUvozovkaUzdravitUzelUzeninaUzlinaUznatVagonValchaValounVanaVandalVanilkaVaranVarhanyVarovatVcelkuVchodVdovaVedroVegetaceVejceVelbloudVeletrhVelitelVelmocVelrybaVenkovVerandaVerzeVeselkaVeskrzeVesniceVespoduVestaVeterinaVeverkaVibraceVichrVideohraVidinaVidleVilaViniceVisetVitalitaVizeVizitkaVjezdVkladVkusVlajkaVlakVlasecVlevoVlhkostVlivVlnovkaVloupatVnucovatVnukVodaVodivostVodoznakVodstvoVojenskyVojnaVojskoVolantVolbaVolitVolnoVoskovkaVozidloVozovnaVpravoVrabecVracetVrahVrataVrbaVrcholekVrhatVrstvaVrtuleVsaditVstoupitVstupVtipVybavitVybratVychovatVydatVydraVyfotitVyhledatVyhnoutVyhoditVyhraditVyhubitVyjasnitVyjetVyjmoutVyklopitVykonatVylekatVymazatVymezitVymizetVymysletVynechatVynikatVynutitVypadatVyplatitVypravitVypustitVyrazitVyrovnatVyrvatVyslovitVysokoVystavitVysunoutVysypatVytasitVytesatVytratitVyvinoutVyvolatVyvrhelVyzdobitVyznatVzaduVzbuditVzchopitVzdorVzduchVzdychatVzestupVzhledemVzkazVzlykatVznikVzorekVzpouraVztahVztekXylofonZabratZabydletZachovatZadarmoZadusitZafoukatZahltitZahoditZahradaZahynoutZajatecZajetZajistitZaklepatZakoupitZalepitZamezitZamotatZamysletZanechatZanikatZaplatitZapojitZapsatZarazitZastavitZasunoutZatajitZatemnitZatknoutZaujmoutZavalitZaveletZavinitZavolatZavrtatZazvonitZbavitZbrusuZbudovatZbytekZdalekaZdarmaZdatnostZdivoZdobitZdrojZdvihZdymadloZeleninaZemanZeminaZeptatZezaduZezdolaZhatitZhltnoutZhlubokaZhotovitZhrubaZimaZimniceZjemnitZklamatZkoumatZkratkaZkumavkaZlatoZlehkaZlobaZlomZlostZlozvykZmapovatZmarZmatekZmijeZmizetZmocnitZmodratZmrzlinaZmutovatZnakZnalostZnamenatZnovuZobrazitZotavitZoubekZoufaleZploditZpomalitZpravaZprostitZprudkaZprvuZradaZranitZrcadloZrnitostZrnoZrovnaZrychlitZrzavostZtichaZtratitZubovinaZubrZvednoutZvenkuZveselaZvonZvratZvukovodZvyk"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } + } + var LangCz = ( + /** @class */ + function(_super) { + __extends(LangCz2, _super); + function LangCz2() { + return _super.call(this, "cz") || this; + } + LangCz2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangCz2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangCz2; + }(wordlist_1.Wordlist) + ); + var langCz = new LangCz(); + exports2.langCz = langCz; + wordlist_1.Wordlist.register(langCz); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-en.js +var require_lang_en = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-en.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langEn = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60") { + wordlist = null; + throw new Error("BIP39 Wordlist for en (English) FAILED"); + } + } + var LangEn = ( + /** @class */ + function(_super) { + __extends(LangEn2, _super); + function LangEn2() { + return _super.call(this, "en") || this; + } + LangEn2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangEn2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangEn2; + }(wordlist_1.Wordlist) + ); + var langEn = new LangEn(); + exports2.langEn = langEn; + wordlist_1.Wordlist.register(langEn); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-es.js +var require_lang_es = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-es.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langEs = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var words = "A/bacoAbdomenAbejaAbiertoAbogadoAbonoAbortoAbrazoAbrirAbueloAbusoAcabarAcademiaAccesoAccio/nAceiteAcelgaAcentoAceptarA/cidoAclararAcne/AcogerAcosoActivoActoActrizActuarAcudirAcuerdoAcusarAdictoAdmitirAdoptarAdornoAduanaAdultoAe/reoAfectarAficio/nAfinarAfirmarA/gilAgitarAgoni/aAgostoAgotarAgregarAgrioAguaAgudoA/guilaAgujaAhogoAhorroAireAislarAjedrezAjenoAjusteAlacra/nAlambreAlarmaAlbaA/lbumAlcaldeAldeaAlegreAlejarAlertaAletaAlfilerAlgaAlgodo/nAliadoAlientoAlivioAlmaAlmejaAlmi/barAltarAltezaAltivoAltoAlturaAlumnoAlzarAmableAmanteAmapolaAmargoAmasarA/mbarA/mbitoAmenoAmigoAmistadAmorAmparoAmplioAnchoAncianoAnclaAndarAnde/nAnemiaA/nguloAnilloA/nimoAni/sAnotarAntenaAntiguoAntojoAnualAnularAnuncioA~adirA~ejoA~oApagarAparatoApetitoApioAplicarApodoAporteApoyoAprenderAprobarApuestaApuroAradoAra~aArarA/rbitroA/rbolArbustoArchivoArcoArderArdillaArduoA/reaA/ridoAriesArmoni/aArne/sAromaArpaArpo/nArregloArrozArrugaArteArtistaAsaAsadoAsaltoAscensoAsegurarAseoAsesorAsientoAsiloAsistirAsnoAsombroA/speroAstillaAstroAstutoAsumirAsuntoAtajoAtaqueAtarAtentoAteoA/ticoAtletaA/tomoAtraerAtrozAtu/nAudazAudioAugeAulaAumentoAusenteAutorAvalAvanceAvaroAveAvellanaAvenaAvestruzAvio/nAvisoAyerAyudaAyunoAzafra/nAzarAzoteAzu/carAzufreAzulBabaBaborBacheBahi/aBaileBajarBalanzaBalco/nBaldeBambu/BancoBandaBa~oBarbaBarcoBarnizBarroBa/sculaBasto/nBasuraBatallaBateri/aBatirBatutaBau/lBazarBebe/BebidaBelloBesarBesoBestiaBichoBienBingoBlancoBloqueBlusaBoaBobinaBoboBocaBocinaBodaBodegaBoinaBolaBoleroBolsaBombaBondadBonitoBonoBonsa/iBordeBorrarBosqueBoteBoti/nBo/vedaBozalBravoBrazoBrechaBreveBrilloBrincoBrisaBrocaBromaBronceBroteBrujaBruscoBrutoBuceoBucleBuenoBueyBufandaBufo/nBu/hoBuitreBultoBurbujaBurlaBurroBuscarButacaBuzo/nCaballoCabezaCabinaCabraCacaoCada/verCadenaCaerCafe/Cai/daCaima/nCajaCajo/nCalCalamarCalcioCaldoCalidadCalleCalmaCalorCalvoCamaCambioCamelloCaminoCampoCa/ncerCandilCanelaCanguroCanicaCantoCa~aCa~o/nCaobaCaosCapazCapita/nCapoteCaptarCapuchaCaraCarbo/nCa/rcelCaretaCargaCari~oCarneCarpetaCarroCartaCasaCascoCaseroCaspaCastorCatorceCatreCaudalCausaCazoCebollaCederCedroCeldaCe/lebreCelosoCe/lulaCementoCenizaCentroCercaCerdoCerezaCeroCerrarCertezaCe/spedCetroChacalChalecoChampu/ChanclaChapaCharlaChicoChisteChivoChoqueChozaChuletaChuparCiclo/nCiegoCieloCienCiertoCifraCigarroCimaCincoCineCintaCipre/sCircoCiruelaCisneCitaCiudadClamorClanClaroClaseClaveClienteClimaCli/nicaCobreCoccio/nCochinoCocinaCocoCo/digoCodoCofreCogerCoheteCoji/nCojoColaColchaColegioColgarColinaCollarColmoColumnaCombateComerComidaCo/modoCompraCondeConejoCongaConocerConsejoContarCopaCopiaCorazo/nCorbataCorchoCordo/nCoronaCorrerCoserCosmosCostaCra/neoCra/terCrearCrecerCrei/doCremaCri/aCrimenCriptaCrisisCromoCro/nicaCroquetaCrudoCruzCuadroCuartoCuatroCuboCubrirCucharaCuelloCuentoCuerdaCuestaCuevaCuidarCulebraCulpaCultoCumbreCumplirCunaCunetaCuotaCupo/nCu/pulaCurarCuriosoCursoCurvaCutisDamaDanzaDarDardoDa/tilDeberDe/bilDe/cadaDecirDedoDefensaDefinirDejarDelfi/nDelgadoDelitoDemoraDensoDentalDeporteDerechoDerrotaDesayunoDeseoDesfileDesnudoDestinoDesvi/oDetalleDetenerDeudaDi/aDiabloDiademaDiamanteDianaDiarioDibujoDictarDienteDietaDiezDifi/cilDignoDilemaDiluirDineroDirectoDirigirDiscoDise~oDisfrazDivaDivinoDobleDoceDolorDomingoDonDonarDoradoDormirDorsoDosDosisDrago/nDrogaDuchaDudaDueloDue~oDulceDu/oDuqueDurarDurezaDuroE/banoEbrioEcharEcoEcuadorEdadEdicio/nEdificioEditorEducarEfectoEficazEjeEjemploElefanteElegirElementoElevarElipseE/liteElixirElogioEludirEmbudoEmitirEmocio/nEmpateEmpe~oEmpleoEmpresaEnanoEncargoEnchufeEnci/aEnemigoEneroEnfadoEnfermoEnga~oEnigmaEnlaceEnormeEnredoEnsayoEnse~arEnteroEntrarEnvaseEnvi/oE/pocaEquipoErizoEscalaEscenaEscolarEscribirEscudoEsenciaEsferaEsfuerzoEspadaEspejoEspi/aEsposaEspumaEsqui/EstarEsteEstiloEstufaEtapaEternoE/ticaEtniaEvadirEvaluarEventoEvitarExactoExamenExcesoExcusaExentoExigirExilioExistirE/xitoExpertoExplicarExponerExtremoFa/bricaFa/bulaFachadaFa/cilFactorFaenaFajaFaldaFalloFalsoFaltarFamaFamiliaFamosoFarao/nFarmaciaFarolFarsaFaseFatigaFaunaFavorFaxFebreroFechaFelizFeoFeriaFerozFe/rtilFervorFesti/nFiableFianzaFiarFibraFiccio/nFichaFideoFiebreFielFieraFiestaFiguraFijarFijoFilaFileteFilialFiltroFinFincaFingirFinitoFirmaFlacoFlautaFlechaFlorFlotaFluirFlujoFlu/orFobiaFocaFogataFogo/nFolioFolletoFondoFormaForroFortunaForzarFosaFotoFracasoFra/gilFranjaFraseFraudeFrei/rFrenoFresaFri/oFritoFrutaFuegoFuenteFuerzaFugaFumarFuncio/nFundaFurgo/nFuriaFusilFu/tbolFuturoGacelaGafasGaitaGajoGalaGaleri/aGalloGambaGanarGanchoGangaGansoGarajeGarzaGasolinaGastarGatoGavila/nGemeloGemirGenGe/neroGenioGenteGeranioGerenteGermenGestoGiganteGimnasioGirarGiroGlaciarGloboGloriaGolGolfoGolosoGolpeGomaGordoGorilaGorraGotaGoteoGozarGradaGra/ficoGranoGrasaGratisGraveGrietaGrilloGripeGrisGritoGrosorGru/aGruesoGrumoGrupoGuanteGuapoGuardiaGuerraGui/aGui~oGuionGuisoGuitarraGusanoGustarHaberHa/bilHablarHacerHachaHadaHallarHamacaHarinaHazHaza~aHebillaHebraHechoHeladoHelioHembraHerirHermanoHe/roeHervirHieloHierroHi/gadoHigieneHijoHimnoHistoriaHocicoHogarHogueraHojaHombreHongoHonorHonraHoraHormigaHornoHostilHoyoHuecoHuelgaHuertaHuesoHuevoHuidaHuirHumanoHu/medoHumildeHumoHundirHuraca/nHurtoIconoIdealIdiomaI/doloIglesiaIglu/IgualIlegalIlusio/nImagenIma/nImitarImparImperioImponerImpulsoIncapazI/ndiceInerteInfielInformeIngenioInicioInmensoInmuneInnatoInsectoInstanteIntere/sI/ntimoIntuirInu/tilInviernoIraIrisIroni/aIslaIsloteJabali/Jabo/nJamo/nJarabeJardi/nJarraJaulaJazmi/nJefeJeringaJineteJornadaJorobaJovenJoyaJuergaJuevesJuezJugadorJugoJugueteJuicioJuncoJunglaJunioJuntarJu/piterJurarJustoJuvenilJuzgarKiloKoalaLabioLacioLacraLadoLadro/nLagartoLa/grimaLagunaLaicoLamerLa/minaLa/mparaLanaLanchaLangostaLanzaLa/pizLargoLarvaLa/stimaLataLa/texLatirLaurelLavarLazoLealLeccio/nLecheLectorLeerLegio/nLegumbreLejanoLenguaLentoLe~aLeo/nLeopardoLesio/nLetalLetraLeveLeyendaLibertadLibroLicorLi/derLidiarLienzoLigaLigeroLimaLi/miteLimo/nLimpioLinceLindoLi/neaLingoteLinoLinternaLi/quidoLisoListaLiteraLitioLitroLlagaLlamaLlantoLlaveLlegarLlenarLlevarLlorarLloverLluviaLoboLocio/nLocoLocuraLo/gicaLogroLombrizLomoLonjaLoteLuchaLucirLugarLujoLunaLunesLupaLustroLutoLuzMacetaMachoMaderaMadreMaduroMaestroMafiaMagiaMagoMai/zMaldadMaletaMallaMaloMama/MamboMamutMancoMandoManejarMangaManiqui/ManjarManoMansoMantaMa~anaMapaMa/quinaMarMarcoMareaMarfilMargenMaridoMa/rmolMarro/nMartesMarzoMasaMa/scaraMasivoMatarMateriaMatizMatrizMa/ximoMayorMazorcaMechaMedallaMedioMe/dulaMejillaMejorMelenaMelo/nMemoriaMenorMensajeMenteMenu/MercadoMerengueMe/ritoMesMeso/nMetaMeterMe/todoMetroMezclaMiedoMielMiembroMigaMilMilagroMilitarMillo/nMimoMinaMineroMi/nimoMinutoMiopeMirarMisaMiseriaMisilMismoMitadMitoMochilaMocio/nModaModeloMohoMojarMoldeMolerMolinoMomentoMomiaMonarcaMonedaMonjaMontoMo~oMoradaMorderMorenoMorirMorroMorsaMortalMoscaMostrarMotivoMoverMo/vilMozoMuchoMudarMuebleMuelaMuerteMuestraMugreMujerMulaMuletaMultaMundoMu~ecaMuralMuroMu/sculoMuseoMusgoMu/sicaMusloNa/carNacio/nNadarNaipeNaranjaNarizNarrarNasalNatalNativoNaturalNa/useaNavalNaveNavidadNecioNe/ctarNegarNegocioNegroNeo/nNervioNetoNeutroNevarNeveraNichoNidoNieblaNietoNi~ezNi~oNi/tidoNivelNoblezaNocheNo/minaNoriaNormaNorteNotaNoticiaNovatoNovelaNovioNubeNucaNu/cleoNudilloNudoNueraNueveNuezNuloNu/meroNutriaOasisObesoObispoObjetoObraObreroObservarObtenerObvioOcaOcasoOce/anoOchentaOchoOcioOcreOctavoOctubreOcultoOcuparOcurrirOdiarOdioOdiseaOesteOfensaOfertaOficioOfrecerOgroOi/doOi/rOjoOlaOleadaOlfatoOlivoOllaOlmoOlorOlvidoOmbligoOndaOnzaOpacoOpcio/nO/peraOpinarOponerOptarO/pticaOpuestoOracio/nOradorOralO/rbitaOrcaOrdenOrejaO/rganoOrgi/aOrgulloOrienteOrigenOrillaOroOrquestaOrugaOsadi/aOscuroOseznoOsoOstraOto~oOtroOvejaO/vuloO/xidoOxi/genoOyenteOzonoPactoPadrePaellaPa/ginaPagoPai/sPa/jaroPalabraPalcoPaletaPa/lidoPalmaPalomaPalparPanPanalPa/nicoPanteraPa~ueloPapa/PapelPapillaPaquetePararParcelaParedParirParoPa/rpadoParquePa/rrafoPartePasarPaseoPasio/nPasoPastaPataPatioPatriaPausaPautaPavoPayasoPeato/nPecadoPeceraPechoPedalPedirPegarPeinePelarPelda~oPeleaPeligroPellejoPeloPelucaPenaPensarPe~o/nPeo/nPeorPepinoPeque~oPeraPerchaPerderPerezaPerfilPericoPerlaPermisoPerroPersonaPesaPescaPe/simoPesta~aPe/taloPetro/leoPezPezu~aPicarPicho/nPiePiedraPiernaPiezaPijamaPilarPilotoPimientaPinoPintorPinzaPi~aPiojoPipaPirataPisarPiscinaPisoPistaPito/nPizcaPlacaPlanPlataPlayaPlazaPleitoPlenoPlomoPlumaPluralPobrePocoPoderPodioPoemaPoesi/aPoetaPolenPolici/aPolloPolvoPomadaPomeloPomoPompaPonerPorcio/nPortalPosadaPoseerPosiblePostePotenciaPotroPozoPradoPrecozPreguntaPremioPrensaPresoPrevioPrimoPri/ncipePrisio/nPrivarProaProbarProcesoProductoProezaProfesorProgramaProlePromesaProntoPropioPro/ximoPruebaPu/blicoPucheroPudorPuebloPuertaPuestoPulgaPulirPulmo/nPulpoPulsoPumaPuntoPu~alPu~oPupaPupilaPure/QuedarQuejaQuemarQuererQuesoQuietoQui/micaQuinceQuitarRa/banoRabiaRaboRacio/nRadicalRai/zRamaRampaRanchoRangoRapazRa/pidoRaptoRasgoRaspaRatoRayoRazaRazo/nReaccio/nRealidadReba~oReboteRecaerRecetaRechazoRecogerRecreoRectoRecursoRedRedondoReducirReflejoReformaRefra/nRefugioRegaloRegirReglaRegresoRehe/nReinoRei/rRejaRelatoRelevoRelieveRellenoRelojRemarRemedioRemoRencorRendirRentaRepartoRepetirReposoReptilResRescateResinaRespetoRestoResumenRetiroRetornoRetratoReunirReve/sRevistaReyRezarRicoRiegoRiendaRiesgoRifaRi/gidoRigorRinco/nRi~o/nRi/oRiquezaRisaRitmoRitoRizoRobleRoceRociarRodarRodeoRodillaRoerRojizoRojoRomeroRomperRonRoncoRondaRopaRoperoRosaRoscaRostroRotarRubi/RuborRudoRuedaRugirRuidoRuinaRuletaRuloRumboRumorRupturaRutaRutinaSa/badoSaberSabioSableSacarSagazSagradoSalaSaldoSaleroSalirSalmo/nSalo/nSalsaSaltoSaludSalvarSambaSancio/nSandi/aSanearSangreSanidadSanoSantoSapoSaqueSardinaSarte/nSastreSata/nSaunaSaxofo/nSeccio/nSecoSecretoSectaSedSeguirSeisSelloSelvaSemanaSemillaSendaSensorSe~alSe~orSepararSepiaSequi/aSerSerieSermo/nServirSesentaSesio/nSetaSetentaSeveroSexoSextoSidraSiestaSieteSigloSignoSi/labaSilbarSilencioSillaSi/mboloSimioSirenaSistemaSitioSituarSobreSocioSodioSolSolapaSoldadoSoledadSo/lidoSoltarSolucio/nSombraSondeoSonidoSonoroSonrisaSopaSoplarSoporteSordoSorpresaSorteoSoste/nSo/tanoSuaveSubirSucesoSudorSuegraSueloSue~oSuerteSufrirSujetoSulta/nSumarSuperarSuplirSuponerSupremoSurSurcoSure~oSurgirSustoSutilTabacoTabiqueTablaTabu/TacoTactoTajoTalarTalcoTalentoTallaTalo/nTama~oTamborTangoTanqueTapaTapeteTapiaTapo/nTaquillaTardeTareaTarifaTarjetaTarotTarroTartaTatuajeTauroTazaTazo/nTeatroTechoTeclaTe/cnicaTejadoTejerTejidoTelaTele/fonoTemaTemorTemploTenazTenderTenerTenisTensoTeori/aTerapiaTercoTe/rminoTernuraTerrorTesisTesoroTestigoTeteraTextoTezTibioTiburo/nTiempoTiendaTierraTiesoTigreTijeraTildeTimbreTi/midoTimoTintaTi/oTi/picoTipoTiraTiro/nTita/nTi/tereTi/tuloTizaToallaTobilloTocarTocinoTodoTogaToldoTomarTonoTontoToparTopeToqueTo/raxToreroTormentaTorneoToroTorpedoTorreTorsoTortugaTosToscoToserTo/xicoTrabajoTractorTraerTra/ficoTragoTrajeTramoTranceTratoTraumaTrazarTre/bolTreguaTreintaTrenTreparTresTribuTrigoTripaTristeTriunfoTrofeoTrompaTroncoTropaTroteTrozoTrucoTruenoTrufaTuberi/aTuboTuertoTumbaTumorTu/nelTu/nicaTurbinaTurismoTurnoTutorUbicarU/lceraUmbralUnidadUnirUniversoUnoUntarU~aUrbanoUrbeUrgenteUrnaUsarUsuarioU/tilUtopi/aUvaVacaVaci/oVacunaVagarVagoVainaVajillaValeVa/lidoValleValorVa/lvulaVampiroVaraVariarVaro/nVasoVecinoVectorVehi/culoVeinteVejezVelaVeleroVelozVenaVencerVendaVenenoVengarVenirVentaVenusVerVeranoVerboVerdeVeredaVerjaVersoVerterVi/aViajeVibrarVicioVi/ctimaVidaVi/deoVidrioViejoViernesVigorVilVillaVinagreVinoVi~edoVioli/nViralVirgoVirtudVisorVi/speraVistaVitaminaViudoVivazViveroVivirVivoVolca/nVolumenVolverVorazVotarVotoVozVueloVulgarYacerYateYeguaYemaYernoYesoYodoYogaYogurZafiroZanjaZapatoZarzaZonaZorroZumoZurdo"; + var lookup = {}; + var wordlist = null; + function dropDiacritic(word) { + wordlist_1.logger.checkNormalize(); + return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word.normalize("NFD").toLowerCase()), function(c) { + return c >= 65 && c <= 90 || c >= 97 && c <= 123; + })); + } + function expand(word) { + var output = []; + Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word), function(c) { + if (c === 47) { + output.push(204); + output.push(129); + } else if (c === 126) { + output.push(110); + output.push(204); + output.push(131); + } else { + output.push(c); + } + }); + return (0, strings_1.toUtf8String)(output); + } + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) { + return expand(w); + }); + wordlist.forEach(function(word, index) { + lookup[dropDiacritic(word)] = index; + }); + if (wordlist_1.Wordlist.check(lang) !== "0xf74fb7092aeacdfbf8959557de22098da512207fb9f109cb526994938cf40300") { + wordlist = null; + throw new Error("BIP39 Wordlist for es (Spanish) FAILED"); + } + } + var LangEs = ( + /** @class */ + function(_super) { + __extends(LangEs2, _super); + function LangEs2() { + return _super.call(this, "es") || this; + } + LangEs2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangEs2.prototype.getWordIndex = function(word) { + loadWords(this); + return lookup[dropDiacritic(word)]; + }; + return LangEs2; + }(wordlist_1.Wordlist) + ); + var langEs = new LangEs(); + exports2.langEs = langEs; + wordlist_1.Wordlist.register(langEs); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-fr.js +var require_lang_fr = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-fr.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langFr = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var words = "AbaisserAbandonAbdiquerAbeilleAbolirAborderAboutirAboyerAbrasifAbreuverAbriterAbrogerAbruptAbsenceAbsoluAbsurdeAbusifAbyssalAcade/mieAcajouAcarienAccablerAccepterAcclamerAccoladeAccrocheAccuserAcerbeAchatAcheterAcidulerAcierAcompteAcque/rirAcronymeActeurActifActuelAdepteAde/quatAdhe/sifAdjectifAdjugerAdmettreAdmirerAdopterAdorerAdoucirAdresseAdroitAdulteAdverbeAe/rerAe/ronefAffaireAffecterAfficheAffreuxAffublerAgacerAgencerAgileAgiterAgraferAgre/ableAgrumeAiderAiguilleAilierAimableAisanceAjouterAjusterAlarmerAlchimieAlerteAlge-breAlgueAlie/nerAlimentAlle/gerAlliageAllouerAllumerAlourdirAlpagaAltesseAlve/oleAmateurAmbiguAmbreAme/nagerAmertumeAmidonAmiralAmorcerAmourAmovibleAmphibieAmpleurAmusantAnalyseAnaphoreAnarchieAnatomieAncienAne/antirAngleAngoisseAnguleuxAnimalAnnexerAnnonceAnnuelAnodinAnomalieAnonymeAnormalAntenneAntidoteAnxieuxApaiserApe/ritifAplanirApologieAppareilAppelerApporterAppuyerAquariumAqueducArbitreArbusteArdeurArdoiseArgentArlequinArmatureArmementArmoireArmureArpenterArracherArriverArroserArsenicArte/rielArticleAspectAsphalteAspirerAssautAsservirAssietteAssocierAssurerAsticotAstreAstuceAtelierAtomeAtriumAtroceAttaqueAttentifAttirerAttraperAubaineAubergeAudaceAudibleAugurerAuroreAutomneAutrucheAvalerAvancerAvariceAvenirAverseAveugleAviateurAvideAvionAviserAvoineAvouerAvrilAxialAxiomeBadgeBafouerBagageBaguetteBaignadeBalancerBalconBaleineBalisageBambinBancaireBandageBanlieueBannie-reBanquierBarbierBarilBaronBarqueBarrageBassinBastionBatailleBateauBatterieBaudrierBavarderBeletteBe/lierBeloteBe/ne/ficeBerceauBergerBerlineBermudaBesaceBesogneBe/tailBeurreBiberonBicycleBiduleBijouBilanBilingueBillardBinaireBiologieBiopsieBiotypeBiscuitBisonBistouriBitumeBizarreBlafardBlagueBlanchirBlessantBlinderBlondBloquerBlousonBobardBobineBoireBoiserBolideBonbonBondirBonheurBonifierBonusBordureBorneBotteBoucleBoueuxBougieBoulonBouquinBourseBoussoleBoutiqueBoxeurBrancheBrasierBraveBrebisBre-cheBreuvageBricolerBrigadeBrillantBriocheBriqueBrochureBroderBronzerBrousseBroyeurBrumeBrusqueBrutalBruyantBuffleBuissonBulletinBureauBurinBustierButinerButoirBuvableBuvetteCabanonCabineCachetteCadeauCadreCafe/ineCaillouCaissonCalculerCalepinCalibreCalmerCalomnieCalvaireCamaradeCame/raCamionCampagneCanalCanetonCanonCantineCanularCapableCaporalCapriceCapsuleCapterCapucheCarabineCarboneCaresserCaribouCarnageCarotteCarreauCartonCascadeCasierCasqueCassureCauserCautionCavalierCaverneCaviarCe/dilleCeintureCe/lesteCelluleCendrierCensurerCentralCercleCe/re/bralCeriseCernerCerveauCesserChagrinChaiseChaleurChambreChanceChapitreCharbonChasseurChatonChaussonChavirerChemiseChenilleChe/quierChercherChevalChienChiffreChignonChime-reChiotChlorureChocolatChoisirChoseChouetteChromeChuteCigareCigogneCimenterCine/maCintrerCirculerCirerCirqueCiterneCitoyenCitronCivilClaironClameurClaquerClasseClavierClientClignerClimatClivageClocheClonageCloporteCobaltCobraCocasseCocotierCoderCodifierCoffreCognerCohe/sionCoifferCoincerCole-reColibriCollineColmaterColonelCombatCome/dieCommandeCompactConcertConduireConfierCongelerConnoterConsonneContactConvexeCopainCopieCorailCorbeauCordageCornicheCorpusCorrectCorte-geCosmiqueCostumeCotonCoudeCoupureCourageCouteauCouvrirCoyoteCrabeCrainteCravateCrayonCre/atureCre/diterCre/meuxCreuserCrevetteCriblerCrierCristalCrite-reCroireCroquerCrotaleCrucialCruelCrypterCubiqueCueillirCuille-reCuisineCuivreCulminerCultiverCumulerCupideCuratifCurseurCyanureCycleCylindreCyniqueDaignerDamierDangerDanseurDauphinDe/battreDe/biterDe/borderDe/briderDe/butantDe/calerDe/cembreDe/chirerDe/ciderDe/clarerDe/corerDe/crireDe/cuplerDe/daleDe/ductifDe/esseDe/fensifDe/filerDe/frayerDe/gagerDe/givrerDe/glutirDe/graferDe/jeunerDe/liceDe/logerDemanderDemeurerDe/molirDe/nicherDe/nouerDentelleDe/nuderDe/partDe/penserDe/phaserDe/placerDe/poserDe/rangerDe/roberDe/sastreDescenteDe/sertDe/signerDe/sobe/irDessinerDestrierDe/tacherDe/testerDe/tourerDe/tresseDevancerDevenirDevinerDevoirDiableDialogueDiamantDicterDiffe/rerDige/rerDigitalDigneDiluerDimancheDiminuerDioxydeDirectifDirigerDiscuterDisposerDissiperDistanceDivertirDiviserDocileDocteurDogmeDoigtDomaineDomicileDompterDonateurDonjonDonnerDopamineDortoirDorureDosageDoseurDossierDotationDouanierDoubleDouceurDouterDoyenDragonDraperDresserDribblerDroitureDuperieDuplexeDurableDurcirDynastieE/blouirE/carterE/charpeE/chelleE/clairerE/clipseE/cloreE/cluseE/coleE/conomieE/corceE/couterE/craserE/cre/merE/crivainE/crouE/cumeE/cureuilE/difierE/duquerEffacerEffectifEffigieEffortEffrayerEffusionE/galiserE/garerE/jecterE/laborerE/largirE/lectronE/le/gantE/le/phantE/le-veE/ligibleE/litismeE/logeE/luciderE/luderEmballerEmbellirEmbryonE/meraudeE/missionEmmenerE/motionE/mouvoirEmpereurEmployerEmporterEmpriseE/mulsionEncadrerEnche-reEnclaveEncocheEndiguerEndosserEndroitEnduireE/nergieEnfanceEnfermerEnfouirEngagerEnginEngloberE/nigmeEnjamberEnjeuEnleverEnnemiEnnuyeuxEnrichirEnrobageEnseigneEntasserEntendreEntierEntourerEntraverE/nume/rerEnvahirEnviableEnvoyerEnzymeE/olienE/paissirE/pargneE/patantE/pauleE/picerieE/pide/mieE/pierE/pilogueE/pineE/pisodeE/pitapheE/poqueE/preuveE/prouverE/puisantE/querreE/quipeE/rigerE/rosionErreurE/ruptionEscalierEspadonEspe-ceEspie-gleEspoirEspritEsquiverEssayerEssenceEssieuEssorerEstimeEstomacEstradeE/tage-reE/talerE/tancheE/tatiqueE/teindreE/tendoirE/ternelE/thanolE/thiqueEthnieE/tirerE/tofferE/toileE/tonnantE/tourdirE/trangeE/troitE/tudeEuphorieE/valuerE/vasionE/ventailE/videnceE/viterE/volutifE/voquerExactExage/rerExaucerExcellerExcitantExclusifExcuseExe/cuterExempleExercerExhalerExhorterExigenceExilerExisterExotiqueExpe/dierExplorerExposerExprimerExquisExtensifExtraireExulterFableFabuleuxFacetteFacileFactureFaiblirFalaiseFameuxFamilleFarceurFarfeluFarineFaroucheFascinerFatalFatigueFauconFautifFaveurFavoriFe/brileFe/conderFe/de/rerFe/linFemmeFe/murFendoirFe/odalFermerFe/roceFerveurFestivalFeuilleFeutreFe/vrierFiascoFicelerFictifFide-leFigureFilatureFiletageFilie-reFilleulFilmerFilouFiltrerFinancerFinirFioleFirmeFissureFixerFlairerFlammeFlasqueFlatteurFle/auFle-cheFleurFlexionFloconFloreFluctuerFluideFluvialFolieFonderieFongibleFontaineForcerForgeronFormulerFortuneFossileFoudreFouge-reFouillerFoulureFourmiFragileFraiseFranchirFrapperFrayeurFre/gateFreinerFrelonFre/mirFre/ne/sieFre-reFriableFrictionFrissonFrivoleFroidFromageFrontalFrotterFruitFugitifFuiteFureurFurieuxFurtifFusionFuturGagnerGalaxieGalerieGambaderGarantirGardienGarnirGarrigueGazelleGazonGe/antGe/latineGe/luleGendarmeGe/ne/ralGe/nieGenouGentilGe/ologieGe/ome-treGe/raniumGermeGestuelGeyserGibierGiclerGirafeGivreGlaceGlaiveGlisserGlobeGloireGlorieuxGolfeurGommeGonflerGorgeGorilleGoudronGouffreGoulotGoupilleGourmandGoutteGraduelGraffitiGraineGrandGrappinGratuitGravirGrenatGriffureGrillerGrimperGrognerGronderGrotteGroupeGrugerGrutierGruye-reGue/pardGuerrierGuideGuimauveGuitareGustatifGymnasteGyrostatHabitudeHachoirHalteHameauHangarHannetonHaricotHarmonieHarponHasardHe/liumHe/matomeHerbeHe/rissonHermineHe/ronHe/siterHeureuxHibernerHibouHilarantHistoireHiverHomardHommageHomoge-neHonneurHonorerHonteuxHordeHorizonHorlogeHormoneHorribleHouleuxHousseHublotHuileuxHumainHumbleHumideHumourHurlerHydromelHygie-neHymneHypnoseIdylleIgnorerIguaneIlliciteIllusionImageImbiberImiterImmenseImmobileImmuableImpactImpe/rialImplorerImposerImprimerImputerIncarnerIncendieIncidentInclinerIncoloreIndexerIndiceInductifIne/ditIneptieInexactInfiniInfligerInformerInfusionInge/rerInhalerInhiberInjecterInjureInnocentInoculerInonderInscrireInsecteInsigneInsoliteInspirerInstinctInsulterIntactIntenseIntimeIntrigueIntuitifInutileInvasionInventerInviterInvoquerIroniqueIrradierIrre/elIrriterIsolerIvoireIvresseJaguarJaillirJambeJanvierJardinJaugerJauneJavelotJetableJetonJeudiJeunesseJoindreJoncherJonglerJoueurJouissifJournalJovialJoyauJoyeuxJubilerJugementJuniorJuponJuristeJusticeJuteuxJuve/nileKayakKimonoKiosqueLabelLabialLabourerLace/rerLactoseLaguneLaineLaisserLaitierLambeauLamelleLampeLanceurLangageLanterneLapinLargeurLarmeLaurierLavaboLavoirLectureLe/galLe/gerLe/gumeLessiveLettreLevierLexiqueLe/zardLiasseLibe/rerLibreLicenceLicorneLie-geLie-vreLigatureLigoterLigueLimerLimiteLimonadeLimpideLine/aireLingotLionceauLiquideLisie-reListerLithiumLitigeLittoralLivreurLogiqueLointainLoisirLombricLoterieLouerLourdLoutreLouveLoyalLubieLucideLucratifLueurLugubreLuisantLumie-reLunaireLundiLuronLutterLuxueuxMachineMagasinMagentaMagiqueMaigreMaillonMaintienMairieMaisonMajorerMalaxerMale/ficeMalheurMaliceMalletteMammouthMandaterManiableManquantManteauManuelMarathonMarbreMarchandMardiMaritimeMarqueurMarronMartelerMascotteMassifMate/rielMatie-reMatraqueMaudireMaussadeMauveMaximalMe/chantMe/connuMe/dailleMe/decinMe/diterMe/duseMeilleurMe/langeMe/lodieMembreMe/moireMenacerMenerMenhirMensongeMentorMercrediMe/riteMerleMessagerMesureMe/talMe/te/oreMe/thodeMe/tierMeubleMiaulerMicrobeMietteMignonMigrerMilieuMillionMimiqueMinceMine/ralMinimalMinorerMinuteMiracleMiroiterMissileMixteMobileModerneMoelleuxMondialMoniteurMonnaieMonotoneMonstreMontagneMonumentMoqueurMorceauMorsureMortierMoteurMotifMoucheMoufleMoulinMoussonMoutonMouvantMultipleMunitionMurailleMure-neMurmureMuscleMuse/umMusicienMutationMuterMutuelMyriadeMyrtilleMyste-reMythiqueNageurNappeNarquoisNarrerNatationNationNatureNaufrageNautiqueNavireNe/buleuxNectarNe/fasteNe/gationNe/gligerNe/gocierNeigeNerveuxNettoyerNeuroneNeutronNeveuNicheNickelNitrateNiveauNobleNocifNocturneNoirceurNoisetteNomadeNombreuxNommerNormatifNotableNotifierNotoireNourrirNouveauNovateurNovembreNoviceNuageNuancerNuireNuisibleNume/roNuptialNuqueNutritifObe/irObjectifObligerObscurObserverObstacleObtenirObturerOccasionOccuperOce/anOctobreOctroyerOctuplerOculaireOdeurOdorantOffenserOfficierOffrirOgiveOiseauOisillonOlfactifOlivierOmbrageOmettreOnctueuxOndulerOne/reuxOniriqueOpaleOpaqueOpe/rerOpinionOpportunOpprimerOpterOptiqueOrageuxOrangeOrbiteOrdonnerOreilleOrganeOrgueilOrificeOrnementOrqueOrtieOscillerOsmoseOssatureOtarieOuraganOursonOutilOutragerOuvrageOvationOxydeOxyge-neOzonePaisiblePalacePalmare-sPalourdePalperPanachePandaPangolinPaniquerPanneauPanoramaPantalonPapayePapierPapoterPapyrusParadoxeParcelleParesseParfumerParlerParoleParrainParsemerPartagerParureParvenirPassionPaste-quePaternelPatiencePatronPavillonPavoiserPayerPaysagePeignePeintrePelagePe/licanPellePelousePeluchePendulePe/ne/trerPe/niblePensifPe/nuriePe/pitePe/plumPerdrixPerforerPe/riodePermuterPerplexePersilPertePeserPe/talePetitPe/trirPeuplePharaonPhobiePhoquePhotonPhrasePhysiquePianoPicturalPie-cePierrePieuvrePilotePinceauPipettePiquerPiroguePiscinePistonPivoterPixelPizzaPlacardPlafondPlaisirPlanerPlaquePlastronPlateauPleurerPlexusPliagePlombPlongerPluiePlumagePochettePoe/siePoe-tePointePoirierPoissonPoivrePolairePolicierPollenPolygonePommadePompierPonctuelPonde/rerPoneyPortiquePositionPosse/derPosturePotagerPoteauPotionPoucePoulainPoumonPourprePoussinPouvoirPrairiePratiquePre/cieuxPre/direPre/fixePre/ludePre/nomPre/sencePre/textePre/voirPrimitifPrincePrisonPriverProble-meProce/derProdigeProfondProgre-sProieProjeterProloguePromenerPropreProspe-reProte/gerProuesseProverbePrudencePruneauPsychosePublicPuceronPuiserPulpePulsarPunaisePunitifPupitrePurifierPuzzlePyramideQuasarQuerelleQuestionQuie/tudeQuitterQuotientRacineRaconterRadieuxRagondinRaideurRaisinRalentirRallongeRamasserRapideRasageRatisserRavagerRavinRayonnerRe/actifRe/agirRe/aliserRe/animerRecevoirRe/citerRe/clamerRe/colterRecruterReculerRecyclerRe/digerRedouterRefaireRe/flexeRe/formerRefrainRefugeRe/galienRe/gionRe/glageRe/gulierRe/ite/rerRejeterRejouerRelatifReleverReliefRemarqueReme-deRemiseRemonterRemplirRemuerRenardRenfortReniflerRenoncerRentrerRenvoiReplierReporterRepriseReptileRequinRe/serveRe/sineuxRe/soudreRespectResterRe/sultatRe/tablirRetenirRe/ticuleRetomberRetracerRe/unionRe/ussirRevancheRevivreRe/volteRe/vulsifRichesseRideauRieurRigideRigolerRincerRiposterRisibleRisqueRituelRivalRivie-reRocheuxRomanceRompreRonceRondinRoseauRosierRotatifRotorRotuleRougeRouilleRouleauRoutineRoyaumeRubanRubisRucheRuelleRugueuxRuinerRuisseauRuserRustiqueRythmeSablerSaboterSabreSacocheSafariSagesseSaisirSaladeSaliveSalonSaluerSamediSanctionSanglierSarcasmeSardineSaturerSaugrenuSaumonSauterSauvageSavantSavonnerScalpelScandaleSce/le/ratSce/narioSceptreSche/maScienceScinderScoreScrutinSculpterSe/anceSe/cableSe/cherSecouerSe/cre/terSe/datifSe/duireSeigneurSe/jourSe/lectifSemaineSemblerSemenceSe/minalSe/nateurSensibleSentenceSe/parerSe/quenceSereinSergentSe/rieuxSerrureSe/rumServiceSe/sameSe/virSevrageSextupleSide/ralSie-cleSie/gerSifflerSigleSignalSilenceSiliciumSimpleSince-reSinistreSiphonSiropSismiqueSituerSkierSocialSocleSodiumSoigneuxSoldatSoleilSolitudeSolubleSombreSommeilSomnolerSondeSongeurSonnetteSonoreSorcierSortirSosieSottiseSoucieuxSoudureSouffleSouleverSoupapeSourceSoutirerSouvenirSpacieuxSpatialSpe/cialSphe-reSpiralStableStationSternumStimulusStipulerStrictStudieuxStupeurStylisteSublimeSubstratSubtilSubvenirSucce-sSucreSuffixeSugge/rerSuiveurSulfateSuperbeSupplierSurfaceSuricateSurmenerSurpriseSursautSurvieSuspectSyllabeSymboleSyme/trieSynapseSyntaxeSyste-meTabacTablierTactileTaillerTalentTalismanTalonnerTambourTamiserTangibleTapisTaquinerTarderTarifTartineTasseTatamiTatouageTaupeTaureauTaxerTe/moinTemporelTenailleTendreTeneurTenirTensionTerminerTerneTerribleTe/tineTexteThe-meThe/orieThe/rapieThoraxTibiaTie-deTimideTirelireTiroirTissuTitaneTitreTituberTobogganTole/rantTomateToniqueTonneauToponymeTorcheTordreTornadeTorpilleTorrentTorseTortueTotemToucherTournageTousserToxineTractionTraficTragiqueTrahirTrainTrancherTravailTre-fleTremperTre/sorTreuilTriageTribunalTricoterTrilogieTriompheTriplerTriturerTrivialTromboneTroncTropicalTroupeauTuileTulipeTumulteTunnelTurbineTuteurTutoyerTuyauTympanTyphonTypiqueTyranUbuesqueUltimeUltrasonUnanimeUnifierUnionUniqueUnitaireUniversUraniumUrbainUrticantUsageUsineUsuelUsureUtileUtopieVacarmeVaccinVagabondVagueVaillantVaincreVaisseauValableValiseVallonValveVampireVanilleVapeurVarierVaseuxVassalVasteVecteurVedetteVe/ge/talVe/hiculeVeinardVe/loceVendrediVe/ne/rerVengerVenimeuxVentouseVerdureVe/rinVernirVerrouVerserVertuVestonVe/te/ranVe/tusteVexantVexerViaducViandeVictoireVidangeVide/oVignetteVigueurVilainVillageVinaigreViolonVipe-reVirementVirtuoseVirusVisageViseurVisionVisqueuxVisuelVitalVitesseViticoleVitrineVivaceVivipareVocationVoguerVoileVoisinVoitureVolailleVolcanVoltigerVolumeVoraceVortexVoterVouloirVoyageVoyelleWagonXe/nonYachtZe-breZe/nithZesteZoologie"; + var wordlist = null; + var lookup = {}; + function dropDiacritic(word) { + wordlist_1.logger.checkNormalize(); + return (0, strings_1.toUtf8String)(Array.prototype.filter.call((0, strings_1.toUtf8Bytes)(word.normalize("NFD").toLowerCase()), function(c) { + return c >= 65 && c <= 90 || c >= 97 && c <= 123; + })); + } + function expand(word) { + var output = []; + Array.prototype.forEach.call((0, strings_1.toUtf8Bytes)(word), function(c) { + if (c === 47) { + output.push(204); + output.push(129); + } else if (c === 45) { + output.push(204); + output.push(128); + } else { + output.push(c); + } + }); + return (0, strings_1.toUtf8String)(output); + } + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" ").map(function(w) { + return expand(w); + }); + wordlist.forEach(function(word, index) { + lookup[dropDiacritic(word)] = index; + }); + if (wordlist_1.Wordlist.check(lang) !== "0x51deb7ae009149dc61a6bd18a918eb7ac78d2775726c68e598b92d002519b045") { + wordlist = null; + throw new Error("BIP39 Wordlist for fr (French) FAILED"); + } + } + var LangFr = ( + /** @class */ + function(_super) { + __extends(LangFr2, _super); + function LangFr2() { + return _super.call(this, "fr") || this; + } + LangFr2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangFr2.prototype.getWordIndex = function(word) { + loadWords(this); + return lookup[dropDiacritic(word)]; + }; + return LangFr2; + }(wordlist_1.Wordlist) + ); + var langFr = new LangFr(); + exports2.langFr = langFr; + wordlist_1.Wordlist.register(langFr); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-ja.js +var require_lang_ja = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-ja.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langJa = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = [ + // 4-kana words + "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgBQhBQhCQuFQmXQiDQUFQZDQsFQdRQkHQbRQlOQlmQPDQjDQwXQMBQMDQcFQTBQTHQrDDXQDNFDGBDGQDGRDpFDhFDmXDZXDbRDMYDRdDTRDrXSAhSBCSBrSGQSEQSHBSVRShYShkSyQSuFSiBSdcSoESocSlmSMBSFBSFKSFNSFdSFcCByCaRCKcCSBCSRCCrCGbCEHCYXCpBCpQCIBCIHCeNCgBCgFCVECVcCmkCmwCZXCZFCdRClOClmClFCjDCjdCnXCwBCwXCcRCFQCFjGXhGNhGDEGDMGCDGCHGIFGgBGVXGVEGVRGmXGsXGdYGoSGbRGnXGwXGwDGWRGFNGFLGFOGFdGFkEABEBDEBFEXOEaBEKSENBENDEYXEIgEIkEgBEgQEgHEhFEudEuFEiBEiHEiFEZDEvBEsXEsFEdXEdREkFEbBEbRElFEPCEfkEFNYAEYAhYBNYQdYDXYSRYCEYYoYgQYgRYuRYmCYZTYdBYbEYlXYjQYRbYWRpKXpQopQnpSFpCXpIBpISphNpdBpdRpbRpcZpFBpFNpFDpFopFrLADLBuLXQLXcLaFLCXLEhLpBLpFLHXLeVLhILdHLdRLoDLbRLrXIABIBQIBCIBsIBoIBMIBRIXaIaRIKYIKRINBINuICDIGBIIDIIkIgRIxFIyQIiHIdRIbYIbRIlHIwRIMYIcRIRVITRIFBIFNIFQOABOAFOBQOaFONBONMOQFOSFOCDOGBOEQOpBOLXOIBOIFOgQOgFOyQOycOmXOsXOdIOkHOMEOMkOWWHBNHXNHXWHNXHDuHDRHSuHSRHHoHhkHmRHdRHkQHlcHlRHwBHWcgAEgAggAkgBNgBQgBEgXOgYcgLXgHjgyQgiBgsFgdagMYgWSgFQgFEVBTVXEVKBVKNVKDVKYVKRVNBVNYVDBVDxVSBVSRVCjVGNVLXVIFVhBVhcVsXVdRVbRVlRhBYhKYhDYhGShxWhmNhdahdkhbRhjohMXhTRxAXxXSxKBxNBxEQxeNxeQxhXxsFxdbxlHxjcxFBxFNxFQxFOxFoyNYyYoybcyMYuBQuBRuBruDMuCouHBudQukkuoBulVuMXuFEmCYmCRmpRmeDmiMmjdmTFmFQiADiBOiaRiKRiNBiNRiSFiGkiGFiERipRiLFiIFihYibHijBijEiMXiWBiFBiFCUBQUXFUaRUNDUNcUNRUNFUDBUSHUCDUGBUGFUEqULNULoUIRUeEUeYUgBUhFUuRUiFUsXUdFUkHUbBUjSUjYUwXUMDUcHURdUTBUrBUrXUrQZAFZXZZaRZKFZNBZQFZCXZGBZYdZpBZLDZIFZHXZHNZeQZVRZVFZmXZiBZvFZdFZkFZbHZbFZwXZcCZcRZRBvBQvBGvBLvBWvCovMYsAFsBDsaRsKFsNFsDrsSHsSFsCXsCRsEBsEHsEfspBsLBsLDsIgsIRseGsbRsFBsFQsFSdNBdSRdCVdGHdYDdHcdVbdySduDdsXdlRdwXdWYdWcdWRkBMkXOkaRkNIkNFkSFkCFkYBkpRkeNkgBkhVkmXksFklVkMBkWDkFNoBNoaQoaFoNBoNXoNaoNEoSRoEroYXoYCoYbopRopFomXojkowXorFbBEbEIbdBbjYlaRlDElMXlFDjKjjSRjGBjYBjYkjpRjLXjIBjOFjeVjbRjwBnXQnSHnpFnLXnINnMBnTRwXBwXNwXYwNFwQFwSBwGFwLXwLDweNwgBwuHwjDwnXMBXMpFMIBMeNMTHcaQcNBcDHcSFcCXcpBcLXcLDcgFcuFcnXcwXccDcTQcrFTQErXNrCHrpFrgFrbFrTHrFcWNYWNbWEHWMXWTR", + // 5-kana words + "ABGHABIJAEAVAYJQALZJAIaRAHNXAHdcAHbRAZJMAZJRAZTRAdVJAklmAbcNAjdRAMnRAMWYAWpRAWgRAFgBAFhBAFdcBNJBBNJDBQKBBQhcBQlmBDEJBYJkBYJTBpNBBpJFBIJBBIJDBIcABOKXBOEJBOVJBOiJBOZJBepBBeLXBeIFBegBBgGJBVJXBuocBiJRBUJQBlXVBlITBwNFBMYVBcqXBTlmBWNFBWiJBWnRBFGHBFwXXKGJXNJBXNZJXDTTXSHSXSVRXSlHXCJDXGQJXEhXXYQJXYbRXOfXXeNcXVJFXhQJXhEJXdTRXjdXXMhBXcQTXRGBXTEBXTnQXFCXXFOFXFgFaBaFaBNJaBCJaBpBaBwXaNJKaNJDaQIBaDpRaEPDaHMFamDJalEJaMZJaFaFaFNBaFQJaFLDaFVHKBCYKBEBKBHDKXaFKXGdKXEJKXpHKXIBKXZDKXwXKKwLKNacKNYJKNJoKNWcKDGdKDTRKChXKGaRKGhBKGbRKEBTKEaRKEPTKLMDKLWRKOHDKVJcKdBcKlIBKlOPKFSBKFEPKFpFNBNJNJBQNBGHNBEPNBHXNBgFNBVXNBZDNBsXNBwXNNaRNNJDNNJENNJkNDCJNDVDNGJRNJiDNZJNNsCJNJFNNFSBNFCXNFEPNFLXNFIFQJBFQCaRQJEQQLJDQLJFQIaRQOqXQHaFQHHQQVJXQVJDQhNJQmEIQZJFQsJXQJrFQWbRDJABDBYJDXNFDXCXDXLXDXZDDXsJDQqXDSJFDJCXDEPkDEqXDYmQDpSJDOCkDOGQDHEIDVJDDuDuDWEBDJFgSBNDSBSFSBGHSBIBSBTQSKVYSJQNSJQiSJCXSEqXSJYVSIiJSOMYSHAHSHaQSeCFSepQSegBSHdHSHrFShSJSJuHSJUFSkNRSrSrSWEBSFaHSJFQSFCXSFGDSFYXSFODSFgBSFVXSFhBSFxFSFkFSFbBSFMFCADdCJXBCXaFCXKFCXNFCXCXCXGBCXEJCXYBCXLDCXIBCXOPCXHXCXgBCXhBCXiBCXlDCXcHCJNBCJNFCDCJCDGBCDVXCDhBCDiDCDJdCCmNCpJFCIaRCOqXCHCHCHZJCViJCuCuCmddCJiFCdNBCdHhClEJCnUJCreSCWlgCWTRCFBFCFNBCFYBCFVFCFhFCFdSCFTBCFWDGBNBGBQFGJBCGBEqGBpBGBgQGNBEGNJYGNkOGNJRGDUFGJpQGHaBGJeNGJeEGVBlGVKjGiJDGvJHGsVJGkEBGMIJGWjNGFBFGFCXGFGBGFYXGFpBGFMFEASJEAWpEJNFECJVEIXSEIQJEOqXEOcFEeNcEHEJEHlFEJgFEhlmEmDJEmZJEiMBEUqXEoSREPBFEPXFEPKFEPSFEPEFEPpFEPLXEPIBEJPdEPcFEPTBEJnXEqlHEMpREFCXEFODEFcFYASJYJAFYBaBYBVXYXpFYDhBYCJBYJGFYYbRYeNcYJeVYiIJYZJcYvJgYvJRYJsXYsJFYMYMYreVpBNHpBEJpBwXpQxFpYEJpeNDpJeDpeSFpeCHpHUJpHbBpHcHpmUJpiiJpUJrpsJuplITpFaBpFQqpFGBpFEfpFYBpFpBpFLJpFIDpFgBpFVXpFyQpFuFpFlFpFjDpFnXpFwXpJFMpFTBLXCJLXEFLXhFLXUJLXbFLalmLNJBLSJQLCLCLGJBLLDJLHaFLeNFLeSHLeCXLepFLhaRLZsJLsJDLsJrLocaLlLlLMdbLFNBLFSBLFEHLFkFIBBFIBXFIBaQIBKXIBSFIBpHIBLXIBgBIBhBIBuHIBmXIBiFIBZXIBvFIBbFIBjQIBwXIBWFIKTRIQUJIDGFICjQIYSRIINXIJeCIVaRImEkIZJFIvJRIsJXIdCJIJoRIbBQIjYBIcqXITFVIreVIFKFIFSFIFCJIFGFIFLDIFIBIJFOIFgBIFVXIJFhIFxFIFmXIFdHIFbBIJFrIJFWOBGBOQfXOOKjOUqXOfXBOqXEOcqXORVJOFIBOFlDHBIOHXiFHNTRHCJXHIaRHHJDHHEJHVbRHZJYHbIBHRsJHRkDHWlmgBKFgBSBgBCDgBGHgBpBgBIBgBVJgBuBgBvFgKDTgQVXgDUJgGSJgOqXgmUMgZIJgTUJgWIEgFBFgFNBgFDJgFSFgFGBgFYXgJFOgFgQgFVXgFhBgFbHgJFWVJABVQKcVDgFVOfXVeDFVhaRVmGdViJYVMaRVFNHhBNDhBCXhBEqhBpFhBLXhNJBhSJRheVXhhKEhxlmhZIJhdBQhkIJhbMNhMUJhMZJxNJgxQUJxDEkxDdFxSJRxplmxeSBxeCXxeGFxeYXxepQxegBxWVcxFEQxFLXxFIBxFgBxFxDxFZtxFdcxFbBxFwXyDJXyDlcuASJuDJpuDIBuCpJuGSJuIJFueEFuZIJusJXudWEuoIBuWGJuFBcuFKEuFNFuFQFuFDJuFGJuFVJuFUtuFdHuFTBmBYJmNJYmQhkmLJDmLJomIdXmiJYmvJRmsJRmklmmMBymMuCmclmmcnQiJABiJBNiJBDiBSFiBCJiBEFiBYBiBpFiBLXiBTHiJNciDEfiCZJiECJiJEqiOkHiHKFieNDiHJQieQcieDHieSFieCXieGFieEFieIHiegFihUJixNoioNXiFaBiFKFiFNDiFEPiFYXitFOitFHiFgBiFVEiFmXiFitiFbBiFMFiFrFUCXQUIoQUIJcUHQJUeCEUHwXUUJDUUqXUdWcUcqXUrnQUFNDUFSHUFCFUFEfUFLXUtFOZBXOZXSBZXpFZXVXZEQJZEJkZpDJZOqXZeNHZeCDZUqXZFBQZFEHZFLXvBAFvBKFvBCXvBEPvBpHvBIDvBgFvBuHvQNJvFNFvFGBvFIBvJFcsXCDsXLXsXsXsXlFsXcHsQqXsJQFsEqXseIFsFEHsFjDdBxOdNpRdNJRdEJbdpJRdhZJdnSJdrjNdFNJdFQHdFhNkNJDkYaRkHNRkHSRkVbRkuMRkjSJkcqDoSJFoEiJoYZJoOfXohEBoMGQocqXbBAFbBXFbBaFbBNDbBGBbBLXbBTBbBWDbGJYbIJHbFQqbFpQlDgQlOrFlVJRjGEBjZJRnXvJnXbBnEfHnOPDngJRnxfXnUJWwXEJwNpJwDpBwEfXwrEBMDCJMDGHMDIJMLJDcQGDcQpHcqXccqNFcqCXcFCJRBSBRBGBRBEJRBpQTBNFTBQJTBpBTBVXTFABTFSBTFCFTFGBTFMDrXCJrXLDrDNJrEfHrFQJrFitWNjdWNTR", + // 6-kana words + "AKLJMANOPFASNJIAEJWXAYJNRAIIbRAIcdaAeEfDAgidRAdjNYAMYEJAMIbRAFNJBAFpJFBBIJYBDZJFBSiJhBGdEBBEJfXBEJqXBEJWRBpaUJBLXrXBIYJMBOcfXBeEfFBestXBjNJRBcDJOBFEqXXNvJRXDMBhXCJNYXOAWpXONJWXHDEBXeIaRXhYJDXZJSJXMDJOXcASJXFVJXaBQqXaBZJFasXdQaFSJQaFEfXaFpJHaFOqXKBNSRKXvJBKQJhXKEJQJKEJGFKINJBKIJjNKgJNSKVElmKVhEBKiJGFKlBgJKjnUJKwsJYKMFIJKFNJDKFIJFKFOfXNJBSFNJBCXNBpJFNJBvQNJBMBNJLJXNJOqXNJeCXNJeGFNdsJCNbTKFNwXUJQNFEPQDiJcQDMSJQSFpBQGMQJQJeOcQyCJEQUJEBQJFBrQFEJqDXDJFDJXpBDJXIMDGiJhDIJGRDJeYcDHrDJDVXgFDkAWpDkIgRDjDEqDMvJRDJFNFDJFIBSKclmSJQOFSJQVHSJQjDSJGJBSJGJFSECJoSHEJqSJHTBSJVJDSViJYSZJNBSJsJDSFSJFSFEfXSJFLXCBUJVCJXSBCJXpBCXVJXCJXsXCJXdFCJNJHCLIJgCHiJFCVNJMChCJhCUHEJCsJTRCJdYcCoQJCCFEfXCFIJgCFUJxCFstFGJBaQGJBIDGQJqXGYJNRGJHKFGeQqDGHEJFGJeLXGHIiJGHdBlGUJEBGkIJTGFQPDGJFEqEAGegEJIJBEJVJXEhQJTEiJNcEJZJFEJoEqEjDEqEPDsXEPGJBEPOqXEPeQFEfDiDEJfEFEfepQEfMiJEqXNBEqDIDEqeSFEqVJXEMvJRYXNJDYXEJHYKVJcYYJEBYJeEcYJUqXYFpJFYFstXpAZJMpBSJFpNBNFpeQPDpHLJDpHIJFpHgJFpeitFpHZJFpJFADpFSJFpJFCJpFOqXpFitBpJFZJLXIJFLIJgRLVNJWLVHJMLwNpJLFGJBLFLJDLFOqXLJFUJIBDJXIBGJBIJBYQIJBIBIBOqXIBcqDIEGJFILNJTIIJEBIOiJhIJeNBIJeIBIhiJIIWoTRIJFAHIJFpBIJFuHIFUtFIJFTHOSBYJOEcqXOHEJqOvBpFOkVJrObBVJOncqDOcNJkHhNJRHuHJuHdMhBgBUqXgBsJXgONJBgHNJDgHHJQgJeitgHsJXgJyNagyDJBgZJDrgsVJQgkEJNgkjSJgJFAHgFCJDgFZtMVJXNFVXQfXVJXDJVXoQJVQVJQVDEfXVDvJHVEqNFVeQfXVHpJFVHxfXVVJSRVVmaRVlIJOhCXVJhHjYkhxCJVhWVUJhWiJcxBNJIxeEqDxfXBFxcFEPxFSJFxFYJXyBDQJydaUJyFOPDuYCJYuLvJRuHLJXuZJLDuFOPDuFZJHuFcqXmKHJdmCQJcmOsVJiJAGFitLCFieOfXiestXiZJMEikNJQirXzFiFQqXiFIJFiFZJFiFvtFUHpJFUteIcUteOcUVCJkUhdHcUbEJEUJqXQUMNJhURjYkUFitFZDGJHZJIxDZJVJXZJFDJZJFpQvBNJBvBSJFvJxBrseQqDsVFVJdFLJDkEJNBkmNJYkFLJDoQJOPoGsJRoEAHBoEJfFbBQqDbBZJHbFVJXlFIJBjYIrXjeitcjjCEBjWMNBwXQfXwXOaFwDsJXwCJTRwrCZJMDNJQcDDJFcqDOPRYiJFTBsJXTQIJBTFEfXTFLJDrXEJFrEJXMrFZJFWEJdEWYTlm", + // 7-kana words + "ABCDEFACNJTRAMBDJdAcNJVXBLNJEBXSIdWRXErNJkXYDJMBXZJCJaXMNJaYKKVJKcKDEJqXKDcNJhKVJrNYKbgJVXKFVJSBNBYBwDNJeQfXNJeEqXNhGJWENJFiJRQlIJbEQJfXxDQqXcfXQFNDEJQFwXUJDYcnUJDJIBgQDIUJTRDJFEqDSJQSJFSJQIJFSOPeZtSJFZJHCJXQfXCTDEqFGJBSJFGJBOfXGJBcqXGJHNJDGJRLiJEJfXEqEJFEJPEFpBEJYJBZJFYBwXUJYiJMEBYJZJyTYTONJXpQMFXFpeGIDdpJFstXpJFcPDLBVSJRLHQJqXLJFZJFIJBNJDIJBUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", + // 8-kana words + "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", + // 9-kana words + "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", + // 10-kana words + "IJBEJqXZJ" + ]; + var mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; + var wordlist = null; + function hex(word) { + return (0, bytes_1.hexlify)((0, strings_1.toUtf8Bytes)(word)); + } + var KiYoKu = "0xe3818de38284e3818f"; + var KyoKu = "0xe3818de38283e3818f"; + function loadWords(lang) { + if (wordlist !== null) { + return; + } + wordlist = []; + var transform = {}; + transform[(0, strings_1.toUtf8String)([227, 130, 154])] = false; + transform[(0, strings_1.toUtf8String)([227, 130, 153])] = false; + transform[(0, strings_1.toUtf8String)([227, 130, 133])] = (0, strings_1.toUtf8String)([227, 130, 134]); + transform[(0, strings_1.toUtf8String)([227, 129, 163])] = (0, strings_1.toUtf8String)([227, 129, 164]); + transform[(0, strings_1.toUtf8String)([227, 130, 131])] = (0, strings_1.toUtf8String)([227, 130, 132]); + transform[(0, strings_1.toUtf8String)([227, 130, 135])] = (0, strings_1.toUtf8String)([227, 130, 136]); + function normalize(word2) { + var result = ""; + for (var i2 = 0; i2 < word2.length; i2++) { + var kana = word2[i2]; + var target = transform[kana]; + if (target === false) { + continue; + } + if (target) { + kana = target; + } + result += kana; + } + return result; + } + function sortJapanese(a, b) { + a = normalize(a); + b = normalize(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + for (var length_1 = 3; length_1 <= 9; length_1++) { + var d = data[length_1 - 3]; + for (var offset = 0; offset < d.length; offset += length_1) { + var word = []; + for (var i = 0; i < length_1; i++) { + var k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push(k & 64 ? 130 : 129); + word.push((k & 63) + 128); + } + wordlist.push((0, strings_1.toUtf8String)(word)); + } + } + wordlist.sort(sortJapanese); + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + var tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + if (wordlist_1.Wordlist.check(lang) !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + wordlist = null; + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + } + var LangJa = ( + /** @class */ + function(_super) { + __extends(LangJa2, _super); + function LangJa2() { + return _super.call(this, "ja") || this; + } + LangJa2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangJa2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + LangJa2.prototype.split = function(mnemonic) { + wordlist_1.logger.checkNormalize(); + return mnemonic.split(/(?:\u3000| )+/g); + }; + LangJa2.prototype.join = function(words) { + return words.join("\u3000"); + }; + return LangJa2; + }(wordlist_1.Wordlist) + ); + var langJa = new LangJa(); + exports2.langJa = langJa; + wordlist_1.Wordlist.register(langJa); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-ko.js +var require_lang_ko = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-ko.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langKo = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrAbMT8AbMXrAbMn4AbQb8AbSV8AbvRlAb8AUAb8AnAb8HgAb8JTAb8NTAb8RbAcGboAcLnvAcMT8AcMX8AcSToAcrAaAcrFnAc8AbAc8MgAfGgrAfHboAfJnvAfLV8AfLkoAfMT8AfMnoAfQb8AfScrAfSgrAgAZ8AgFl3AgGX8AgHZvAgHgrAgJXoAgJX8AgJboAgLZoAgLn4AgOX8AgoATAgoAnAgoCUAgoJgAgoLXAgoMYAgoSeAgrDUAgrJTAhrFnAhrLjAhrQgAjAgoAjJnrAkMX8AkOnoAlCTvAlCV8AlClvAlFg4AlFl6AlFn3AloSnAlrAXAlrAfAlrFUAlrFbAlrGgAlrOXAlvKnAlvMTAl3AbAl3MnAnATrAnAcrAnCZ3AnCl8AnDg8AnFboAnFl3AnHX4AnHbrAnHgrAnIl3AnJgvAnLXoAnLX4AnLbrAnLgrAnLhrAnMXoAnMgrAnOn3AnSbrAnSeoAnvLnAn3OnCTGgvCTSlvCTvAUCTvKnCTvNTCT3CZCT3GUCT3MTCT8HnCUCZrCULf8CULnvCU3HnCU3JUCY6NUCbDb8CbFZoCbLnrCboOTCboScCbrFnCbvLnCb8AgCb8HgCb$LnCkLfoClBn3CloDUDTHT8DTLl3DTSU8DTrAaDTrLXDTrLjDTrOYDTrOgDTvFXDTvFnDT3HUDT3LfDUCT9DUDT4DUFVoDUFV8DUFkoDUGgrDUJnrDULl8DUMT8DUMXrDUMX4DUMg8DUOUoDUOgvDUOg8DUSToDUSZ8DbDXoDbDgoDbGT8DbJn3DbLg3DbLn4DbMXrDbMg8DbOToDboJXGTClvGTDT8GTFZrGTLVoGTLlvGTLl3GTMg8GTOTvGTSlrGToCUGTrDgGTrJYGTrScGTtLnGTvAnGTvQgGUCZrGUDTvGUFZoGUHXrGULnvGUMT8GUoMgGXoLnGXrMXGXrMnGXvFnGYLnvGZOnvGZvOnGZ8LaGZ8LmGbAl3GbDYvGbDlrGbHX3GbJl4GbLV8GbLn3GbMn4GboJTGboRfGbvFUGb3GUGb4JnGgDX3GgFl$GgJlrGgLX6GgLZoGgLf8GgOXoGgrAgGgrJXGgrMYGgrScGgvATGgvOYGnAgoGnJgvGnLZoGnLg3GnLnrGnQn8GnSbrGnrMgHTClvHTDToHTFT3HTQT8HToJTHToJgHTrDUHTrMnHTvFYHTvRfHT8MnHT8SUHUAZ8HUBb4HUDTvHUoMYHXFl6HXJX6HXQlrHXrAUHXrMnHXrSbHXvFYHXvKXHX3LjHX3MeHYvQlHZrScHZvDbHbAcrHbFT3HbFl3HbJT8HbLTrHbMT8HbMXrHbMbrHbQb8HbSX3HboDbHboJTHbrFUHbrHgHbrJTHb8JTHb8MnHb8QgHgAlrHgDT3HgGgrHgHgrHgJTrHgJT8HgLX@HgLnrHgMT8HgMX8HgMboHgOnrHgQToHgRg3HgoHgHgrCbHgrFnHgrLVHgvAcHgvAfHnAloHnCTrHnCnvHnGTrHnGZ8HnGnvHnJT8HnLf8HnLkvHnMg8HnRTrITvFUITvFnJTAXrJTCV8JTFT3JTFT8JTFn4JTGgvJTHT8JTJT8JTJXvJTJl3JTJnvJTLX4JTLf8JTLhvJTMT8JTMXrJTMnrJTObrJTQT8JTSlvJT8DUJT8FkJT8MTJT8OXJT8OgJT8QUJT8RfJUHZoJXFT4JXFlrJXGZ8JXGnrJXLV8JXLgvJXMXoJXMX3JXNboJXPlvJXoJTJXoLkJXrAXJXrHUJXrJgJXvJTJXvOnJX4KnJYAl3JYJT8JYLhvJYQToJYrQXJY6NUJbAl3JbCZrJbDloJbGT8JbGgrJbJXvJbJboJbLf8JbLhrJbLl3JbMnvJbRg8JbSZ8JboDbJbrCZJbrSUJb3KnJb8LnJfRn8JgAXrJgCZrJgDTrJgGZrJgGZ8JgHToJgJT8JgJXoJgJgvJgLX4JgLZ3JgLZ8JgLn4JgMgrJgMn4JgOgvJgPX6JgRnvJgSToJgoCZJgoJbJgoMYJgrJXJgrJgJgrLjJg6MTJlCn3JlGgvJlJl8Jl4AnJl8FnJl8HgJnAToJnATrJnAbvJnDUoJnGnrJnJXrJnJXvJnLhvJnLnrJnLnvJnMToJnMT8JnMXvJnMX3JnMg8JnMlrJnMn4JnOX8JnST4JnSX3JnoAgJnoAnJnoJTJnoObJnrAbJnrAkJnrHnJnrJTJnrJYJnrOYJnrScJnvCUJnvFaJnvJgJnvJnJnvOYJnvQUJnvRUJn3FnJn3JTKnFl3KnLT6LTDlvLTMnoLTOn3LTRl3LTSb4LTSlrLToAnLToJgLTrAULTrAcLTrCULTrHgLTrMgLT3JnLULnrLUMX8LUoJgLVATrLVDTrLVLb8LVoJgLV8MgLV8RTLXDg3LXFlrLXrCnLXrLXLX3GTLX4GgLX4OYLZAXrLZAcrLZAgrLZAhrLZDXyLZDlrLZFbrLZFl3LZJX6LZJX8LZLc8LZLnrLZSU8LZoJTLZoJnLZrAgLZrAnLZrJYLZrLULZrMgLZrSkLZvAnLZvGULZvJeLZvOTLZ3FZLZ4JXLZ8STLZ8ScLaAT3LaAl3LaHT8LaJTrLaJT8LaJXrLaJgvLaJl4LaLVoLaMXrLaMXvLaMX8LbClvLbFToLbHlrLbJn4LbLZ3LbLhvLbMXrLbMnoLbvSULcLnrLc8HnLc8MTLdrMnLeAgoLeOgvLeOn3LfAl3LfLnvLfMl3LfOX8Lf8AnLf8JXLf8LXLgJTrLgJXrLgJl8LgMX8LgRZrLhCToLhrAbLhrFULhrJXLhvJYLjHTrLjHX4LjJX8LjLhrLjSX3LjSZ4LkFX4LkGZ8LkGgvLkJTrLkMXoLkSToLkSU8LkSZ8LkoOYLl3FfLl3MgLmAZrLmCbrLmGgrLmHboLmJnoLmJn3LmLfoLmLhrLmSToLnAX6LnAb6LnCZ3LnCb3LnDTvLnDb8LnFl3LnGnrLnHZvLnHgvLnITvLnJT8LnJX8LnJlvLnLf8LnLg6LnLhvLnLnoLnMXrLnMg8LnQlvLnSbrLnrAgLnrAnLnrDbLnrFkLnrJdLnrMULnrOYLnrSTLnvAnLnvDULnvHgLnvOYLnvOnLn3GgLn4DULn4JTLn4JnMTAZoMTAloMTDb8MTFT8MTJnoMTJnrMTLZrMTLhrMTLkvMTMX8MTRTrMToATMTrDnMTrOnMT3JnMT4MnMT8FUMT8FaMT8FlMT8GTMT8GbMT8GnMT8HnMT8JTMT8JbMT8OTMUCl8MUJTrMUJU8MUMX8MURTrMUSToMXAX6MXAb6MXCZoMXFXrMXHXrMXLgvMXOgoMXrAUMXrAnMXrHgMXrJYMXrJnMXrMTMXrMgMXrOYMXrSZMXrSgMXvDUMXvOTMX3JgMX3OTMX4JnMX8DbMX8FnMX8HbMX8HgMX8HnMX8LbMX8MnMX8OnMYAb8MYGboMYHTvMYHX4MYLTrMYLnvMYMToMYOgvMYRg3MYSTrMbAToMbAXrMbAl3MbAn8MbGZ8MbJT8MbJXrMbMXvMbMX8MbMnoMbrMUMb8AfMb8FbMb8FkMcJXoMeLnrMgFl3MgGTvMgGXoMgGgrMgGnrMgHT8MgHZrMgJnoMgLnrMgLnvMgMT8MgQUoMgrHnMgvAnMg8HgMg8JYMg8LfMloJnMl8ATMl8AXMl8JYMnAToMnAT4MnAZ8MnAl3MnAl4MnCl8MnHT8MnHg8MnJnoMnLZoMnLhrMnMXoMnMX3MnMnrMnOgvMnrFbMnrFfMnrFnMnrNTMnvJXNTMl8OTCT3OTFV8OTFn3OTHZvOTJXrOTOl3OT3ATOT3JUOT3LZOT3LeOT3MbOT8ATOT8AbOT8AgOT8MbOUCXvOUMX3OXHXvOXLl3OXrMUOXvDbOX6NUOX8JbOYFZoOYLbrOYLkoOYMg8OYSX3ObHTrObHT4ObJgrObLhrObMX3ObOX8Ob8FnOeAlrOeJT8OeJXrOeJnrOeLToOeMb8OgJXoOgLXoOgMnrOgOXrOgOloOgoAgOgoJbOgoMYOgoSTOg8AbOjLX4OjMnoOjSV8OnLVoOnrAgOn3DUPXQlrPXvFXPbvFTPdAT3PlFn3PnvFbQTLn4QToAgQToMTQULV8QURg8QUoJnQXCXvQbFbrQb8AaQb8AcQb8FbQb8MYQb8ScQeAlrQeLhrQjAn3QlFXoQloJgQloSnRTLnvRTrGURTrJTRUJZrRUoJlRUrQnRZrLmRZrMnRZrSnRZ8ATRZ8JbRZ8ScRbMT8RbST3RfGZrRfMX8RfMgrRfSZrRnAbrRnGT8RnvJgRnvLfRnvMTRn8AaSTClvSTJgrSTOXrSTRg3STRnvSToAcSToAfSToAnSToHnSToLjSToMTSTrAaSTrEUST3BYST8AgST8LmSUAZvSUAgrSUDT4SUDT8SUGgvSUJXoSUJXvSULTrSU8JTSU8LjSV8AnSV8JgSXFToSXLf8SYvAnSZrDUSZrMUSZrMnSZ8HgSZ8JTSZ8JgSZ8MYSZ8QUSaQUoSbCT3SbHToSbQYvSbSl4SboJnSbvFbSb8HbSb8JgSb8OTScGZrScHgrScJTvScMT8ScSToScoHbScrMTScvAnSeAZrSeAcrSeHboSeJUoSeLhrSeMT8SeMXrSe6JgSgHTrSkJnoSkLnvSk8CUSlFl3SlrSnSl8GnSmAboSmGT8SmJU8", + "ATLnDlATrAZoATrJX4ATrMT8ATrMX4ATrRTrATvDl8ATvJUoATvMl8AT3AToAT3MX8AT8CT3AT8DT8AT8HZrAT8HgoAUAgFnAUCTFnAXoMX8AXrAT8AXrGgvAXrJXvAXrOgoAXvLl3AZvAgoAZvFbrAZvJXoAZvJl8AZvJn3AZvMX8AZvSbrAZ8FZoAZ8LZ8AZ8MU8AZ8OTvAZ8SV8AZ8SX3AbAgFZAboJnoAbvGboAb8ATrAb8AZoAb8AgrAb8Al4Ab8Db8Ab8JnoAb8LX4Ab8LZrAb8LhrAb8MT8Ab8OUoAb8Qb8Ab8ST8AcrAUoAcrAc8AcrCZ3AcrFT3AcrFZrAcrJl4AcrJn3AcrMX3AcrOTvAc8AZ8Ac8MT8AfAcJXAgoFn4AgoGgvAgoGnrAgoLc8AgoMXoAgrLnrAkrSZ8AlFXCTAloHboAlrHbrAlrLhrAlrLkoAl3CZrAl3LUoAl3LZrAnrAl4AnrMT8An3HT4BT3IToBX4MnvBb!Ln$CTGXMnCToLZ4CTrHT8CT3JTrCT3RZrCT#GTvCU6GgvCU8Db8CU8GZrCU8HT8CboLl3CbrGgrCbrMU8Cb8DT3Cb8GnrCb8LX4Cb8MT8Cb8ObrCgrGgvCgrKX4Cl8FZoDTrAbvDTrDboDTrGT6DTrJgrDTrMX3DTrRZrDTrRg8DTvAVvDTvFZoDT3DT8DT3Ln3DT4HZrDT4MT8DT8AlrDT8MT8DUAkGbDUDbJnDYLnQlDbDUOYDbMTAnDbMXSnDboAT3DboFn4DboLnvDj6JTrGTCgFTGTGgFnGTJTMnGTLnPlGToJT8GTrCT3GTrLVoGTrLnvGTrMX3GTrMboGTvKl3GZClFnGZrDT3GZ8DTrGZ8FZ8GZ8MXvGZ8On8GZ8ST3GbCnQXGbMbFnGboFboGboJg3GboMXoGb3JTvGb3JboGb3Mn6Gb3Qb8GgDXLjGgMnAUGgrDloGgrHX4GgrSToGgvAXrGgvAZvGgvFbrGgvLl3GgvMnvGnDnLXGnrATrGnrMboGnuLl3HTATMnHTAgCnHTCTCTHTrGTvHTrHTvHTrJX8HTrLl8HTrMT8HTrMgoHTrOTrHTuOn3HTvAZrHTvDTvHTvGboHTvJU8HTvLl3HTvMXrHTvQb4HT4GT6HT4JT8HT4Jb#HT8Al3HT8GZrHT8GgrHT8HX4HT8Jb8HT8JnoHT8LTrHT8LgvHT8SToHT8SV8HUoJUoHUoJX8HUoLnrHXrLZoHXvAl3HX3LnrHX4FkvHX4LhrHX4MXoHX4OnoHZrAZ8HZrDb8HZrGZ8HZrJnrHZvGZ8HZvLnvHZ8JnvHZ8LhrHbCXJlHbMTAnHboJl4HbpLl3HbrJX8HbrLnrHbrMnvHbvRYrHgoSTrHgrFV8HgrGZ8HgrJXoHgrRnvHgvBb!HgvGTrHgvHX4HgvHn!HgvLTrHgvSU8HnDnLbHnFbJbHnvDn8Hn6GgvHn!BTvJTCTLnJTQgFnJTrAnvJTrLX4JTrOUoJTvFn3JTvLnrJTvNToJT3AgoJT3Jn4JT3LhvJT3ObrJT8AcrJT8Al3JT8JT8JT8JnoJT8LX4JT8LnrJT8MX3JT8Rg3JT8Sc8JUoBTvJU8AToJU8GZ8JU8GgvJU8JTrJU8JXrJU8JnrJU8LnvJU8ScvJXHnJlJXrGgvJXrJU8JXrLhrJXrMT8JXrMXrJXrQUoJXvCTvJXvGZ8JXvGgrJXvQT8JX8Ab8JX8DT8JX8GZ8JX8HZvJX8LnrJX8MT8JX8MXoJX8MnvJX8ST3JYGnCTJbAkGbJbCTAnJbLTAcJboDT3JboLb6JbrAnvJbrCn3JbrDl8JbrGboJbrIZoJbrJnvJbrMnvJbrQb4Jb8RZrJeAbAnJgJnFbJgScAnJgrATrJgvHZ8JgvMn4JlJlFbJlLiQXJlLjOnJlRbOlJlvNXoJlvRl3Jl4AcrJl8AUoJl8MnrJnFnMlJnHgGbJnoDT8JnoFV8JnoGgvJnoIT8JnoQToJnoRg3JnrCZ3JnrGgrJnrHTvJnrLf8JnrOX8JnvAT3JnvFZoJnvGT8JnvJl4JnvMT8JnvMX8JnvOXrJnvPX6JnvSX3JnvSZrJn3MT8Jn3MX8Jn3RTrLTATKnLTJnLTLTMXKnLTRTQlLToGb8LTrAZ8LTrCZ8LTrDb8LTrHT8LT3PX6LT4FZoLT$CTvLT$GgrLUvHX3LVoATrLVoAgoLVoJboLVoMX3LVoRg3LV8CZ3LV8FZoLV8GTvLXrDXoLXrFbrLXvAgvLXvFlrLXvLl3LXvRn6LX4Mb8LX8GT8LYCXMnLYrMnrLZoSTvLZrAZvLZrAloLZrFToLZrJXvLZrJboLZrJl4LZrLnrLZrMT8LZrOgvLZrRnvLZrST4LZvMX8LZvSlvLZ8AgoLZ8CT3LZ8JT8LZ8LV8LZ8LZoLZ8Lg8LZ8SV8LZ8SbrLZ$HT8LZ$Mn4La6CTvLbFbMnLbRYFTLbSnFZLboJT8LbrAT9LbrGb3LbrQb8LcrJX8LcrMXrLerHTvLerJbrLerNboLgrDb8LgrGZ8LgrHTrLgrMXrLgrSU8LgvJTrLgvLl3Lg6Ll3LhrLnrLhrMT8LhvAl4LiLnQXLkoAgrLkoJT8LkoJn4LlrSU8Ll3FZoLl3HTrLl3JX8Ll3JnoLl3LToLmLeFbLnDUFbLnLVAnLnrATrLnrAZoLnrAb8LnrAlrLnrGgvLnrJU8LnrLZrLnrLhrLnrMb8LnrOXrLnrSZ8LnvAb4LnvDTrLnvDl8LnvHTrLnvHbrLnvJT8LnvJU8LnvJbrLnvLhvLnvMX8LnvMb8LnvNnoLnvSU8Ln3Al3Ln4FZoLn4GT6Ln4JgvLn4LhrLn4MT8Ln4SToMToCZrMToJX8MToLX4MToLf8MToRg3MTrEloMTvGb6MT3BTrMT3Lb6MT8AcrMT8AgrMT8GZrMT8JnoMT8LnrMT8MX3MUOUAnMXAbFnMXoAloMXoJX8MXoLf8MXoLl8MXrAb8MXrDTvMXrGT8MXrGgrMXrHTrMXrLf8MXrMU8MXrOXvMXrQb8MXvGT8MXvHTrMXvLVoMX3AX3MX3Jn3MX3LhrMX3MX3MX4AlrMX4OboMX8GTvMX8GZrMX8GgrMX8JT8MX8JX8MX8LhrMX8MT8MYDUFbMYMgDbMbGnFfMbvLX4MbvLl3Mb8Mb8Mb8ST4MgGXCnMg8ATrMg8AgoMg8CZrMg8DTrMg8DboMg8HTrMg8JgrMg8LT8MloJXoMl8AhrMl8JT8MnLgAUMnoJXrMnoLX4MnoLhrMnoMT8MnrAl4MnrDb8MnrOTvMnrOgvMnrQb8MnrSU8MnvGgrMnvHZ8Mn3MToMn4DTrMn4LTrMn4Mg8NnBXAnOTFTFnOToAToOTrGgvOTrJX8OT3JXoOT6MTrOT8GgrOT8HTpOT8MToOUoHT8OUoJT8OUoLn3OXrAgoOXrDg8OXrMT8OXvSToOX6CTvOX8CZrOX8OgrOb6HgvOb8AToOb8MT8OcvLZ8OgvAlrOgvHTvOgvJTrOgvJnrOgvLZrOgvLn4OgvMT8OgvRTrOg8AZoOg8DbvOnrOXoOnvJn4OnvLhvOnvRTrOn3GgoOn3JnvOn6JbvOn8OTrPTGYFTPbBnFnPbGnDnPgDYQTPlrAnvPlrETvPlrLnvPlrMXvPlvFX4QTMTAnQTrJU8QYCnJlQYJlQlQbGTQbQb8JnrQb8LZoQb8LnvQb8MT8Qb8Ml8Qb8ST4QloAl4QloHZvQloJX8QloMn8QnJZOlRTrAZvRTrDTrRTvJn4RTvLhvRT4Jb8RZrAZrRZ8AkrRZ8JU8RZ8LV8RZ8LnvRbJlQXRg3GboRg3MnvRg8AZ8Rg8JboRg8Jl4RnLTCbRnvFl3RnvQb8SToAl4SToCZrSToFZoSToHXrSToJU8SToJgvSToJl4SToLhrSToMX3STrAlvSTrCT9STrCgrSTrGgrSTrHXrSTrHboSTrJnoSTrNboSTvLnrST4AZoST8Ab8ST8JT8SUoJn3SU6HZ#SU6JTvSU8Db8SU8HboSU8LgrSV8JT8SZrAcrSZrAl3SZrJT8SZrJnvSZrMT8SZvLUoSZ4FZoSZ8JnoSZ8RZrScoLnrScoMT8ScoMX8ScrAT4ScrAZ8ScrLZ8ScrLkvScvDb8ScvLf8ScvNToSgrFZrShvKnrSloHUoSloLnrSlrMXoSl8HgrSmrJUoSn3BX6", + "ATFlOn3ATLgrDYAT4MTAnAT8LTMnAYJnRTrAbGgJnrAbLV8LnAbvNTAnAeFbLg3AgOYMXoAlQbFboAnDboAfAnJgoJTBToDgAnBUJbAl3BboDUAnCTDlvLnCTFTrSnCYoQTLnDTwAbAnDUDTrSnDUHgHgrDX8LXFnDbJXAcrETvLTLnGTFTQbrGTMnGToGT3DUFbGUJlPX3GbQg8LnGboJbFnGb3GgAYGgAg8ScGgMbAXrGgvAbAnGnJTLnvGnvATFgHTDT6ATHTrDlJnHYLnMn8HZrSbJTHZ8LTFnHbFTJUoHgSeMT8HgrLjAnHgvAbAnHlFUrDlHnDgvAnHnHTFT3HnQTGnrJTAaMXvJTGbCn3JTOgrAnJXvAXMnJbMg8SnJbMnRg3Jb8LTMnJnAl3OnJnGYrQlJnJlQY3LTDlCn3LTJjLg3LTLgvFXLTMg3GTLV8HUOgLXFZLg3LXNXrMnLX8QXFnLX9AlMYLYLXPXrLZAbJU8LZDUJU8LZMXrSnLZ$AgFnLaPXrDULbFYrMnLbMn8LXLboJgJgLeFbLg3LgLZrSnLgOYAgoLhrRnJlLkCTrSnLkOnLhrLnFX%AYLnFZoJXLnHTvJbLnLloAbMTATLf8MTHgJn3MTMXrAXMT3MTFnMUITvFnMXFX%AYMXMXvFbMXrFTDbMYAcMX3MbLf8SnMb8JbFnMgMXrMTMgvAXFnMgvGgCmMnAloSnMnFnJTrOXvMXSnOX8HTMnObJT8ScObLZFl3ObMXCZoPTLgrQXPUFnoQXPU3RXJlPX3RkQXPbrJXQlPlrJbFnQUAhrDbQXGnCXvQYLnHlvQbLfLnvRTOgvJbRXJYrQlRYLnrQlRbLnrQlRlFT8JlRlFnrQXSTClCn3STHTrAnSTLZQlrSTMnGTrSToHgGbSTrGTDnSTvGXCnST3HgFbSU3HXAXSbAnJn3SbFT8LnScLfLnv", + "AT3JgJX8AT8FZoSnAT8JgFV8AT8LhrDbAZ8JT8DbAb8GgLhrAb8SkLnvAe8MT8SnAlMYJXLVAl3GYDTvAl3LfLnvBUDTvLl3CTOn3HTrCT3DUGgrCU8MT8AbCbFTrJUoCgrDb8MTDTLV8JX8DTLnLXQlDT8LZrSnDUQb8FZ8DUST4JnvDb8ScOUoDj6GbJl4GTLfCYMlGToAXvFnGboAXvLnGgAcrJn3GgvFnSToGnLf8JnvGn#HTDToHTLnFXJlHTvATFToHTvHTDToHTvMTAgoHT3STClvHT4AlFl6HT8HTDToHUoDgJTrHUoScMX3HbRZrMXoHboJg8LTHgDb8JTrHgMToLf8HgvLnLnoHnHn3HT4Hn6MgvAnJTJU8ScvJT3AaQT8JT8HTrAnJXrRg8AnJbAloMXoJbrATFToJbvMnoSnJgDb6GgvJgDb8MXoJgSX3JU8JguATFToJlPYLnQlJlQkDnLbJlQlFYJlJl8Lf8OTJnCTFnLbJnLTHXMnJnLXGXCnJnoFfRg3JnrMYRg3Jn3HgFl3KT8Dg8LnLTRlFnPTLTvPbLbvLVoSbrCZLXMY6HT3LXNU7DlrLXNXDTATLX8DX8LnLZDb8JU8LZMnoLhrLZSToJU8LZrLaLnrLZvJn3SnLZ8LhrSnLaJnoMT8LbFlrHTvLbrFTLnrLbvATLlvLb6OTFn3LcLnJZOlLeAT6Mn4LeJT3ObrLg6LXFlrLhrJg8LnLhvDlPX4LhvLfLnvLj6JTFT3LnFbrMXoLnQluCTvLnrQXCY6LnvLfLnvLnvMgLnvLnvSeLf8MTMbrJn3MT3JgST3MT8AnATrMT8LULnrMUMToCZrMUScvLf8MXoDT8SnMX6ATFToMX8AXMT8MX8FkMT8MX8HTrDUMX8ScoSnMYJT6CTvMgAcrMXoMg8SToAfMlvAXLg3MnFl3AnvOT3AnFl3OUoATHT8OU3RnLXrOXrOXrSnObPbvFn6Og8HgrSnOg8OX8DbPTvAgoJgPU3RYLnrPXrDnJZrPb8CTGgvPlrLTDlvPlvFUJnoQUvFXrQlQeMnoAl3QlrQlrSnRTFTrJUoSTDlLiLXSTFg6HT3STJgoMn4STrFTJTrSTrLZFl3ST4FnMXoSUrDlHUoScvHTvSnSfLkvMXo", + "AUoAcrMXoAZ8HboAg8AbOg6ATFgAg8AloMXoAl3AT8JTrAl8MX8MXoCT3SToJU8Cl8Db8MXoDT8HgrATrDboOT8MXoGTOTrATMnGT8LhrAZ8GnvFnGnQXHToGgvAcrHTvAXvLl3HbrAZoMXoHgBlFXLg3HgMnFXrSnHgrSb8JUoHn6HT8LgvITvATrJUoJUoLZrRnvJU8HT8Jb8JXvFX8QT8JXvLToJTrJYrQnGnQXJgrJnoATrJnoJU8ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg", + "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl" + ]; + var codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; + function getHangul(code) { + if (code >= 40) { + code = code + 168 - 40; + } else if (code >= 19) { + code = code + 97 - 19; + } + return (0, strings_1.toUtf8String)([225, (code >> 6) + 132, (code & 63) + 128]); + } + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = []; + data.forEach(function(data2, length) { + length += 4; + for (var i = 0; i < data2.length; i += length) { + var word = ""; + for (var j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data2[i + j])); + } + wordlist.push(word); + } + }); + wordlist.sort(); + if (wordlist_1.Wordlist.check(lang) !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + wordlist = null; + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + } + var LangKo = ( + /** @class */ + function(_super) { + __extends(LangKo2, _super); + function LangKo2() { + return _super.call(this, "ko") || this; + } + LangKo2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangKo2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangKo2; + }(wordlist_1.Wordlist) + ); + var langKo = new LangKo(); + exports2.langKo = langKo; + wordlist_1.Wordlist.register(langKo); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-it.js +var require_lang_it = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-it.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langIt = void 0; + var wordlist_1 = require_wordlist(); + var words = "AbacoAbbaglioAbbinatoAbeteAbissoAbolireAbrasivoAbrogatoAccadereAccennoAccusatoAcetoneAchilleAcidoAcquaAcreAcrilicoAcrobataAcutoAdagioAddebitoAddomeAdeguatoAderireAdipeAdottareAdulareAffabileAffettoAffissoAffrantoAforismaAfosoAfricanoAgaveAgenteAgevoleAggancioAgireAgitareAgonismoAgricoloAgrumetoAguzzoAlabardaAlatoAlbatroAlberatoAlboAlbumeAlceAlcolicoAlettoneAlfaAlgebraAlianteAlibiAlimentoAllagatoAllegroAllievoAllodolaAllusivoAlmenoAlogenoAlpacaAlpestreAltalenaAlternoAlticcioAltroveAlunnoAlveoloAlzareAmalgamaAmanitaAmarenaAmbitoAmbratoAmebaAmericaAmetistaAmicoAmmassoAmmendaAmmirareAmmonitoAmoreAmpioAmpliareAmuletoAnacardoAnagrafeAnalistaAnarchiaAnatraAncaAncellaAncoraAndareAndreaAnelloAngeloAngolareAngustoAnimaAnnegareAnnidatoAnnoAnnuncioAnonimoAnticipoAnziApaticoAperturaApodeApparireAppetitoAppoggioApprodoAppuntoAprileArabicaArachideAragostaAraldicaArancioAraturaArazzoArbitroArchivioArditoArenileArgentoArgineArgutoAriaArmoniaArneseArredatoArringaArrostoArsenicoArsoArteficeArzilloAsciuttoAscoltoAsepsiAsetticoAsfaltoAsinoAsolaAspiratoAsproAssaggioAsseAssolutoAssurdoAstaAstenutoAsticeAstrattoAtavicoAteismoAtomicoAtonoAttesaAttivareAttornoAttritoAttualeAusilioAustriaAutistaAutonomoAutunnoAvanzatoAvereAvvenireAvvisoAvvolgereAzioneAzotoAzzimoAzzurroBabeleBaccanoBacinoBacoBadessaBadilataBagnatoBaitaBalconeBaldoBalenaBallataBalzanoBambinoBandireBaraondaBarbaroBarcaBaritonoBarlumeBaroccoBasilicoBassoBatostaBattutoBauleBavaBavosaBeccoBeffaBelgioBelvaBendaBenevoleBenignoBenzinaBereBerlinaBetaBibitaBiciBidoneBifidoBigaBilanciaBimboBinocoloBiologoBipedeBipolareBirbanteBirraBiscottoBisestoBisnonnoBisonteBisturiBizzarroBlandoBlattaBollitoBonificoBordoBoscoBotanicoBottinoBozzoloBraccioBradipoBramaBrancaBravuraBretellaBrevettoBrezzaBrigliaBrillanteBrindareBroccoloBrodoBronzinaBrulloBrunoBubboneBucaBudinoBuffoneBuioBulboBuonoBurloneBurrascaBussolaBustaCadettoCaducoCalamaroCalcoloCalesseCalibroCalmoCaloriaCambusaCamerataCamiciaCamminoCamolaCampaleCanapaCandelaCaneCaninoCanottoCantinaCapaceCapelloCapitoloCapogiroCapperoCapraCapsulaCarapaceCarcassaCardoCarismaCarovanaCarrettoCartolinaCasaccioCascataCasermaCasoCassoneCastelloCasualeCatastaCatenaCatrameCautoCavilloCedibileCedrataCefaloCelebreCellulareCenaCenoneCentesimoCeramicaCercareCertoCerumeCervelloCesoiaCespoCetoChelaChiaroChiccaChiedereChimeraChinaChirurgoChitarraCiaoCiclismoCifrareCignoCilindroCiottoloCircaCirrosiCitricoCittadinoCiuffoCivettaCivileClassicoClinicaCloroCoccoCodardoCodiceCoerenteCognomeCollareColmatoColoreColposoColtivatoColzaComaCometaCommandoComodoComputerComuneConcisoCondurreConfermaCongelareConiugeConnessoConoscereConsumoContinuoConvegnoCopertoCopioneCoppiaCopricapoCorazzaCordataCoricatoCorniceCorollaCorpoCorredoCorsiaCorteseCosmicoCostanteCotturaCovatoCratereCravattaCreatoCredereCremosoCrescitaCretaCricetoCrinaleCrisiCriticoCroceCronacaCrostataCrucialeCruscaCucireCuculoCuginoCullatoCupolaCuratoreCursoreCurvoCuscinoCustodeDadoDainoDalmataDamerinoDanielaDannosoDanzareDatatoDavantiDavveroDebuttoDecennioDecisoDeclinoDecolloDecretoDedicatoDefinitoDeformeDegnoDelegareDelfinoDelirioDeltaDemenzaDenotatoDentroDepositoDerapataDerivareDerogaDescrittoDesertoDesiderioDesumereDetersivoDevotoDiametroDicembreDiedroDifesoDiffusoDigerireDigitaleDiluvioDinamicoDinnanziDipintoDiplomaDipoloDiradareDireDirottoDirupoDisagioDiscretoDisfareDisgeloDispostoDistanzaDisumanoDitoDivanoDiveltoDividereDivoratoDobloneDocenteDoganaleDogmaDolceDomatoDomenicaDominareDondoloDonoDormireDoteDottoreDovutoDozzinaDragoDruidoDubbioDubitareDucaleDunaDuomoDupliceDuraturoEbanoEccessoEccoEclissiEconomiaEderaEdicolaEdileEditoriaEducareEgemoniaEgliEgoismoEgregioElaboratoElargireEleganteElencatoElettoElevareElficoElicaElmoElsaElusoEmanatoEmblemaEmessoEmiroEmotivoEmozioneEmpiricoEmuloEndemicoEnduroEnergiaEnfasiEnotecaEntrareEnzimaEpatiteEpilogoEpisodioEpocaleEppureEquatoreErarioErbaErbosoEredeEremitaErigereErmeticoEroeErosivoErranteEsagonoEsameEsanimeEsaudireEscaEsempioEsercitoEsibitoEsigenteEsistereEsitoEsofagoEsortatoEsosoEspansoEspressoEssenzaEssoEstesoEstimareEstoniaEstrosoEsultareEtilicoEtnicoEtruscoEttoEuclideoEuropaEvasoEvidenzaEvitatoEvolutoEvvivaFabbricaFaccendaFachiroFalcoFamigliaFanaleFanfaraFangoFantasmaFareFarfallaFarinosoFarmacoFasciaFastosoFasulloFaticareFatoFavolosoFebbreFecolaFedeFegatoFelpaFeltroFemminaFendereFenomenoFermentoFerroFertileFessuraFestivoFettaFeudoFiabaFiduciaFifaFiguratoFiloFinanzaFinestraFinireFioreFiscaleFisicoFiumeFlaconeFlamencoFleboFlemmaFloridoFluenteFluoroFobicoFocacciaFocosoFoderatoFoglioFolataFolcloreFolgoreFondenteFoneticoFoniaFontanaForbitoForchettaForestaFormicaFornaioForoFortezzaForzareFosfatoFossoFracassoFranaFrassinoFratelloFreccettaFrenataFrescoFrigoFrollinoFrondeFrugaleFruttaFucilataFucsiaFuggenteFulmineFulvoFumanteFumettoFumosoFuneFunzioneFuocoFurboFurgoneFuroreFusoFutileGabbianoGaffeGalateoGallinaGaloppoGamberoGammaGaranziaGarboGarofanoGarzoneGasdottoGasolioGastricoGattoGaudioGazeboGazzellaGecoGelatinaGelsoGemelloGemmatoGeneGenitoreGennaioGenotipoGergoGhepardoGhiaccioGhisaGialloGildaGineproGiocareGioielloGiornoGioveGiratoGironeGittataGiudizioGiuratoGiustoGlobuloGlutineGnomoGobbaGolfGomitoGommoneGonfioGonnaGovernoGracileGradoGraficoGrammoGrandeGrattareGravosoGraziaGrecaGreggeGrifoneGrigioGrinzaGrottaGruppoGuadagnoGuaioGuantoGuardareGufoGuidareIbernatoIconaIdenticoIdillioIdoloIdraIdricoIdrogenoIgieneIgnaroIgnoratoIlareIllesoIllogicoIlludereImballoImbevutoImboccoImbutoImmaneImmersoImmolatoImpaccoImpetoImpiegoImportoImprontaInalareInarcareInattivoIncantoIncendioInchinoIncisivoInclusoIncontroIncrocioIncuboIndagineIndiaIndoleIneditoInfattiInfilareInflittoIngaggioIngegnoIngleseIngordoIngrossoInnescoInodoreInoltrareInondatoInsanoInsettoInsiemeInsonniaInsulinaIntasatoInteroIntonacoIntuitoInumidireInvalidoInveceInvitoIperboleIpnoticoIpotesiIppicaIrideIrlandaIronicoIrrigatoIrrorareIsolatoIsotopoIstericoIstitutoIstriceItaliaIterareLabbroLabirintoLaccaLaceratoLacrimaLacunaLaddoveLagoLampoLancettaLanternaLardosoLargaLaringeLastraLatenzaLatinoLattugaLavagnaLavoroLegaleLeggeroLemboLentezzaLenzaLeoneLepreLesivoLessatoLestoLetteraleLevaLevigatoLiberoLidoLievitoLillaLimaturaLimitareLimpidoLineareLinguaLiquidoLiraLiricaLiscaLiteLitigioLivreaLocandaLodeLogicaLombareLondraLongevoLoquaceLorenzoLotoLotteriaLuceLucidatoLumacaLuminosoLungoLupoLuppoloLusingaLussoLuttoMacabroMacchinaMaceroMacinatoMadamaMagicoMagliaMagneteMagroMaiolicaMalafedeMalgradoMalintesoMalsanoMaltoMalumoreManaManciaMandorlaMangiareManifestoMannaroManovraMansardaMantideManubrioMappaMaratonaMarcireMarettaMarmoMarsupioMascheraMassaiaMastinoMaterassoMatricolaMattoneMaturoMazurcaMeandroMeccanicoMecenateMedesimoMeditareMegaMelassaMelisMelodiaMeningeMenoMensolaMercurioMerendaMerloMeschinoMeseMessereMestoloMetalloMetodoMettereMiagolareMicaMicelioMicheleMicroboMidolloMieleMiglioreMilanoMiliteMimosaMineraleMiniMinoreMirinoMirtilloMiscelaMissivaMistoMisurareMitezzaMitigareMitraMittenteMnemonicoModelloModificaModuloMoganoMogioMoleMolossoMonasteroMoncoMondinaMonetarioMonileMonotonoMonsoneMontatoMonvisoMoraMordereMorsicatoMostroMotivatoMotosegaMottoMovenzaMovimentoMozzoMuccaMucosaMuffaMughettoMugnaioMulattoMulinelloMultiploMummiaMuntoMuovereMuraleMusaMuscoloMusicaMutevoleMutoNababboNaftaNanometroNarcisoNariceNarratoNascereNastrareNaturaleNauticaNaviglioNebulosaNecrosiNegativoNegozioNemmenoNeofitaNerettoNervoNessunoNettunoNeutraleNeveNevroticoNicchiaNinfaNitidoNobileNocivoNodoNomeNominaNordicoNormaleNorvegeseNostranoNotareNotiziaNotturnoNovellaNucleoNullaNumeroNuovoNutrireNuvolaNuzialeOasiObbedireObbligoObeliscoOblioOboloObsoletoOccasioneOcchioOccidenteOccorrereOccultareOcraOculatoOdiernoOdorareOffertaOffrireOffuscatoOggettoOggiOgnunoOlandeseOlfattoOliatoOlivaOlogrammaOltreOmaggioOmbelicoOmbraOmegaOmissioneOndosoOnereOniceOnnivoroOnorevoleOntaOperatoOpinioneOppostoOracoloOrafoOrdineOrecchinoOreficeOrfanoOrganicoOrigineOrizzonteOrmaOrmeggioOrnativoOrologioOrrendoOrribileOrtensiaOrticaOrzataOrzoOsareOscurareOsmosiOspedaleOspiteOssaOssidareOstacoloOsteOtiteOtreOttagonoOttimoOttobreOvaleOvestOvinoOviparoOvocitoOvunqueOvviareOzioPacchettoPacePacificoPadellaPadronePaesePagaPaginaPalazzinaPalesarePallidoPaloPaludePandoroPannelloPaoloPaonazzoPapricaParabolaParcellaParerePargoloPariParlatoParolaPartireParvenzaParzialePassivoPasticcaPataccaPatologiaPattumePavonePeccatoPedalarePedonalePeggioPelosoPenarePendicePenisolaPennutoPenombraPensarePentolaPepePepitaPerbenePercorsoPerdonatoPerforarePergamenaPeriodoPermessoPernoPerplessoPersuasoPertugioPervasoPesatorePesistaPesoPestiferoPetaloPettinePetulantePezzoPiacerePiantaPiattinoPiccinoPicozzaPiegaPietraPifferoPigiamaPigolioPigroPilaPiliferoPillolaPilotaPimpantePinetaPinnaPinoloPioggiaPiomboPiramidePireticoPiritePirolisiPitonePizzicoPlaceboPlanarePlasmaPlatanoPlenarioPochezzaPoderosoPodismoPoesiaPoggiarePolentaPoligonoPollicePolmonitePolpettaPolsoPoltronaPolverePomicePomodoroPontePopolosoPorfidoPorosoPorporaPorrePortataPosaPositivoPossessoPostulatoPotassioPoterePranzoPrassiPraticaPreclusoPredicaPrefissoPregiatoPrelievoPremerePrenotarePreparatoPresenzaPretestoPrevalsoPrimaPrincipePrivatoProblemaProcuraProdurreProfumoProgettoProlungaPromessaPronomePropostaProrogaProtesoProvaPrudentePrugnaPruritoPsichePubblicoPudicaPugilatoPugnoPulcePulitoPulsantePuntarePupazzoPupillaPuroQuadroQualcosaQuasiQuerelaQuotaRaccoltoRaddoppioRadicaleRadunatoRafficaRagazzoRagioneRagnoRamarroRamingoRamoRandagioRantolareRapatoRapinaRappresoRasaturaRaschiatoRasenteRassegnaRastrelloRataRavvedutoRealeRecepireRecintoReclutaReconditoRecuperoRedditoRedimereRegalatoRegistroRegolaRegressoRelazioneRemareRemotoRennaReplicaReprimereReputareResaResidenteResponsoRestauroReteRetinaRetoricaRettificaRevocatoRiassuntoRibadireRibelleRibrezzoRicaricaRiccoRicevereRiciclatoRicordoRicredutoRidicoloRidurreRifasareRiflessoRiformaRifugioRigareRigettatoRighelloRilassatoRilevatoRimanereRimbalzoRimedioRimorchioRinascitaRincaroRinforzoRinnovoRinomatoRinsavitoRintoccoRinunciaRinvenireRiparatoRipetutoRipienoRiportareRipresaRipulireRisataRischioRiservaRisibileRisoRispettoRistoroRisultatoRisvoltoRitardoRitegnoRitmicoRitrovoRiunioneRivaRiversoRivincitaRivoltoRizomaRobaRoboticoRobustoRocciaRocoRodaggioRodereRoditoreRogitoRollioRomanticoRompereRonzioRosolareRospoRotanteRotondoRotulaRovescioRubizzoRubricaRugaRullinoRumineRumorosoRuoloRupeRussareRusticoSabatoSabbiareSabotatoSagomaSalassoSaldaturaSalgemmaSalivareSalmoneSaloneSaltareSalutoSalvoSapereSapidoSaporitoSaracenoSarcasmoSartoSassosoSatelliteSatiraSatolloSaturnoSavanaSavioSaziatoSbadiglioSbalzoSbancatoSbarraSbattereSbavareSbendareSbirciareSbloccatoSbocciatoSbrinareSbruffoneSbuffareScabrosoScadenzaScalaScambiareScandaloScapolaScarsoScatenareScavatoSceltoScenicoScettroSchedaSchienaSciarpaScienzaScindereScippoSciroppoScivoloSclerareScodellaScolpitoScompartoSconfortoScoprireScortaScossoneScozzeseScribaScrollareScrutinioScuderiaScultoreScuolaScuroScusareSdebitareSdoganareSeccaturaSecondoSedanoSeggiolaSegnalatoSegregatoSeguitoSelciatoSelettivoSellaSelvaggioSemaforoSembrareSemeSeminatoSempreSensoSentireSepoltoSequenzaSerataSerbatoSerenoSerioSerpenteSerraglioServireSestinaSetolaSettimanaSfaceloSfaldareSfamatoSfarzosoSfaticatoSferaSfidaSfilatoSfingeSfocatoSfoderareSfogoSfoltireSforzatoSfrattoSfruttatoSfuggitoSfumareSfusoSgabelloSgarbatoSgonfiareSgorbioSgrassatoSguardoSibiloSiccomeSierraSiglaSignoreSilenzioSillabaSimboloSimpaticoSimulatoSinfoniaSingoloSinistroSinoSintesiSinusoideSiparioSismaSistoleSituatoSlittaSlogaturaSlovenoSmarritoSmemoratoSmentitoSmeraldoSmilzoSmontareSmottatoSmussatoSnellireSnervatoSnodoSobbalzoSobrioSoccorsoSocialeSodaleSoffittoSognoSoldatoSolenneSolidoSollazzoSoloSolubileSolventeSomaticoSommaSondaSonettoSonniferoSopireSoppesoSopraSorgereSorpassoSorrisoSorsoSorteggioSorvolatoSospiroSostaSottileSpadaSpallaSpargereSpatolaSpaventoSpazzolaSpecieSpedireSpegnereSpelaturaSperanzaSpessoreSpettraleSpezzatoSpiaSpigolosoSpillatoSpinosoSpiraleSplendidoSportivoSposoSprangaSprecareSpronatoSpruzzoSpuntinoSquilloSradicareSrotolatoStabileStaccoStaffaStagnareStampatoStantioStarnutoStaseraStatutoSteloSteppaSterzoStilettoStimaStirpeStivaleStizzosoStonatoStoricoStrappoStregatoStriduloStrozzareStruttoStuccareStufoStupendoSubentroSuccosoSudoreSuggeritoSugoSultanoSuonareSuperboSupportoSurgelatoSurrogatoSussurroSuturaSvagareSvedeseSveglioSvelareSvenutoSveziaSviluppoSvistaSvizzeraSvoltaSvuotareTabaccoTabulatoTacciareTaciturnoTaleTalismanoTamponeTanninoTaraTardivoTargatoTariffaTarpareTartarugaTastoTatticoTavernaTavolataTazzaTecaTecnicoTelefonoTemerarioTempoTemutoTendoneTeneroTensioneTentacoloTeoremaTermeTerrazzoTerzettoTesiTesseratoTestatoTetroTettoiaTifareTigellaTimbroTintoTipicoTipografoTiraggioTiroTitanioTitoloTitubanteTizioTizzoneToccareTollerareToltoTombolaTomoTonfoTonsillaTopazioTopologiaToppaTorbaTornareTorroneTortoraToscanoTossireTostaturaTotanoTraboccoTracheaTrafilaTragediaTralcioTramontoTransitoTrapanoTrarreTraslocoTrattatoTraveTrecciaTremolioTrespoloTributoTrichecoTrifoglioTrilloTrinceaTrioTristezzaTrituratoTrivellaTrombaTronoTroppoTrottolaTrovareTruccatoTubaturaTuffatoTulipanoTumultoTunisiaTurbareTurchinoTutaTutelaUbicatoUccelloUccisoreUdireUditivoUffaUfficioUgualeUlisseUltimatoUmanoUmileUmorismoUncinettoUngereUnghereseUnicornoUnificatoUnisonoUnitarioUnteUovoUpupaUraganoUrgenzaUrloUsanzaUsatoUscitoUsignoloUsuraioUtensileUtilizzoUtopiaVacanteVaccinatoVagabondoVagliatoValangaValgoValicoVallettaValorosoValutareValvolaVampataVangareVanitosoVanoVantaggioVanveraVaporeVaranoVarcatoVarianteVascaVedettaVedovaVedutoVegetaleVeicoloVelcroVelinaVellutoVeloceVenatoVendemmiaVentoVeraceVerbaleVergognaVerificaVeroVerrucaVerticaleVescicaVessilloVestaleVeteranoVetrinaVetustoViandanteVibranteVicendaVichingoVicinanzaVidimareVigiliaVignetoVigoreVileVillanoViminiVincitoreViolaViperaVirgolaVirologoVirulentoViscosoVisioneVispoVissutoVisuraVitaVitelloVittimaVivandaVividoViziareVoceVogaVolatileVolereVolpeVoragineVulcanoZampognaZannaZappatoZatteraZavorraZefiroZelanteZeloZenzeroZerbinoZibettoZincoZirconeZittoZollaZoticoZuccheroZufoloZuluZuppa"; + var wordlist = null; + function loadWords(lang) { + if (wordlist != null) { + return; + } + wordlist = words.replace(/([A-Z])/g, " $1").toLowerCase().substring(1).split(" "); + if (wordlist_1.Wordlist.check(lang) !== "0x5c1362d88fd4cf614a96f3234941d29f7d37c08c5292fde03bf62c2db6ff7620") { + wordlist = null; + throw new Error("BIP39 Wordlist for it (Italian) FAILED"); + } + } + var LangIt = ( + /** @class */ + function(_super) { + __extends(LangIt2, _super); + function LangIt2() { + return _super.call(this, "it") || this; + } + LangIt2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[index]; + }; + LangIt2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist.indexOf(word); + }; + return LangIt2; + }(wordlist_1.Wordlist) + ); + var langIt = new LangIt(); + exports2.langIt = langIt; + wordlist_1.Wordlist.register(langIt); + } +}); + +// node_modules/@ethersproject/wordlists/lib/lang-zh.js +var require_lang_zh = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/lang-zh.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.langZhTw = exports2.langZhCn = void 0; + var strings_1 = require_lib9(); + var wordlist_1 = require_wordlist(); + var data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]) + ]; + if (lang.locale === "zh_tw") { + var common = s % 4; + for (var i_1 = common; i_1 < 3; i_1++) { + bytes[i_1] = codes.indexOf(deltaData[deltaOffset++]) + (i_1 == 0 ? 228 : 128); + } + } + wordlist[lang.locale].push((0, strings_1.toUtf8String)(bytes)); + } + if (wordlist_1.Wordlist.check(lang) !== Checks[lang.locale]) { + wordlist[lang.locale] = null; + throw new Error("BIP39 Wordlist for " + lang.locale + " (Chinese) FAILED"); + } + } + var LangZh = ( + /** @class */ + function(_super) { + __extends(LangZh2, _super); + function LangZh2(country) { + return _super.call(this, "zh_" + country) || this; + } + LangZh2.prototype.getWord = function(index) { + loadWords(this); + return wordlist[this.locale][index]; + }; + LangZh2.prototype.getWordIndex = function(word) { + loadWords(this); + return wordlist[this.locale].indexOf(word); + }; + LangZh2.prototype.split = function(mnemonic) { + mnemonic = mnemonic.replace(/(?:\u3000| )+/g, ""); + return mnemonic.split(""); + }; + return LangZh2; + }(wordlist_1.Wordlist) + ); + var langZhCn = new LangZh("cn"); + exports2.langZhCn = langZhCn; + wordlist_1.Wordlist.register(langZhCn); + wordlist_1.Wordlist.register(langZhCn, "zh"); + var langZhTw = new LangZh("tw"); + exports2.langZhTw = langZhTw; + wordlist_1.Wordlist.register(langZhTw); + } +}); + +// node_modules/@ethersproject/wordlists/lib/wordlists.js +var require_wordlists = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/wordlists.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.wordlists = void 0; + var lang_cz_1 = require_lang_cz(); + var lang_en_1 = require_lang_en(); + var lang_es_1 = require_lang_es(); + var lang_fr_1 = require_lang_fr(); + var lang_ja_1 = require_lang_ja(); + var lang_ko_1 = require_lang_ko(); + var lang_it_1 = require_lang_it(); + var lang_zh_1 = require_lang_zh(); + exports2.wordlists = { + cz: lang_cz_1.langCz, + en: lang_en_1.langEn, + es: lang_es_1.langEs, + fr: lang_fr_1.langFr, + it: lang_it_1.langIt, + ja: lang_ja_1.langJa, + ko: lang_ko_1.langKo, + zh: lang_zh_1.langZhCn, + zh_cn: lang_zh_1.langZhCn, + zh_tw: lang_zh_1.langZhTw + }; + } +}); + +// node_modules/@ethersproject/wordlists/lib/index.js +var require_lib20 = __commonJS({ + "node_modules/@ethersproject/wordlists/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.wordlists = exports2.Wordlist = exports2.logger = void 0; + var wordlist_1 = require_wordlist(); + Object.defineProperty(exports2, "logger", { enumerable: true, get: function() { + return wordlist_1.logger; + } }); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return wordlist_1.Wordlist; + } }); + var wordlists_1 = require_wordlists(); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return wordlists_1.wordlists; + } }); + } +}); + +// node_modules/@ethersproject/hdnode/lib/_version.js +var require_version17 = __commonJS({ + "node_modules/@ethersproject/hdnode/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "hdnode/5.5.0"; + } +}); + +// node_modules/@ethersproject/hdnode/lib/index.js +var require_lib21 = __commonJS({ + "node_modules/@ethersproject/hdnode/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getAccountPath = exports2.isValidMnemonic = exports2.entropyToMnemonic = exports2.mnemonicToEntropy = exports2.mnemonicToSeed = exports2.HDNode = exports2.defaultPath = void 0; + var basex_1 = require_lib17(); + var bytes_1 = require_lib2(); + var bignumber_1 = require_lib3(); + var strings_1 = require_lib9(); + var pbkdf2_1 = require_lib18(); + var properties_1 = require_lib4(); + var signing_key_1 = require_lib14(); + var sha2_1 = require_lib19(); + var transactions_1 = require_lib15(); + var wordlists_1 = require_lib20(); + var logger_1 = require_lib(); + var _version_1 = require_version17(); + var logger = new logger_1.Logger(_version_1.version); + var N = bignumber_1.BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); + var MasterSecret = (0, strings_1.toUtf8Bytes)("Bitcoin seed"); + var HardenedBit = 2147483648; + function getUpperMask(bits) { + return (1 << bits) - 1 << 8 - bits; + } + function getLowerMask(bits) { + return (1 << bits) - 1; + } + function bytes32(value) { + return (0, bytes_1.hexZeroPad)((0, bytes_1.hexlify)(value), 32); + } + function base58check(data) { + return basex_1.Base58.encode((0, bytes_1.concat)([data, (0, bytes_1.hexDataSlice)((0, sha2_1.sha256)((0, sha2_1.sha256)(data)), 0, 4)])); + } + function getWordlist(wordlist) { + if (wordlist == null) { + return wordlists_1.wordlists["en"]; + } + if (typeof wordlist === "string") { + var words = wordlists_1.wordlists[wordlist]; + if (words == null) { + logger.throwArgumentError("unknown locale", "wordlist", wordlist); + } + return words; + } + return wordlist; + } + var _constructorGuard = {}; + exports2.defaultPath = "m/44'/60'/0'/0/0"; + var HDNode = ( + /** @class */ + function() { + function HDNode2(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonicOrPath) { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, HDNode2); + if (constructorGuard !== _constructorGuard) { + throw new Error("HDNode constructor cannot be called directly"); + } + if (privateKey) { + var signingKey = new signing_key_1.SigningKey(privateKey); + (0, properties_1.defineReadOnly)(this, "privateKey", signingKey.privateKey); + (0, properties_1.defineReadOnly)(this, "publicKey", signingKey.compressedPublicKey); + } else { + (0, properties_1.defineReadOnly)(this, "privateKey", null); + (0, properties_1.defineReadOnly)(this, "publicKey", (0, bytes_1.hexlify)(publicKey)); + } + (0, properties_1.defineReadOnly)(this, "parentFingerprint", parentFingerprint); + (0, properties_1.defineReadOnly)(this, "fingerprint", (0, bytes_1.hexDataSlice)((0, sha2_1.ripemd160)((0, sha2_1.sha256)(this.publicKey)), 0, 4)); + (0, properties_1.defineReadOnly)(this, "address", (0, transactions_1.computeAddress)(this.publicKey)); + (0, properties_1.defineReadOnly)(this, "chainCode", chainCode); + (0, properties_1.defineReadOnly)(this, "index", index); + (0, properties_1.defineReadOnly)(this, "depth", depth); + if (mnemonicOrPath == null) { + (0, properties_1.defineReadOnly)(this, "mnemonic", null); + (0, properties_1.defineReadOnly)(this, "path", null); + } else if (typeof mnemonicOrPath === "string") { + (0, properties_1.defineReadOnly)(this, "mnemonic", null); + (0, properties_1.defineReadOnly)(this, "path", mnemonicOrPath); + } else { + (0, properties_1.defineReadOnly)(this, "mnemonic", mnemonicOrPath); + (0, properties_1.defineReadOnly)(this, "path", mnemonicOrPath.path); + } + } + Object.defineProperty(HDNode2.prototype, "extendedKey", { + get: function() { + if (this.depth >= 256) { + throw new Error("Depth too large!"); + } + return base58check((0, bytes_1.concat)([ + this.privateKey != null ? "0x0488ADE4" : "0x0488B21E", + (0, bytes_1.hexlify)(this.depth), + this.parentFingerprint, + (0, bytes_1.hexZeroPad)((0, bytes_1.hexlify)(this.index), 4), + this.chainCode, + this.privateKey != null ? (0, bytes_1.concat)(["0x00", this.privateKey]) : this.publicKey + ])); + }, + enumerable: false, + configurable: true + }); + HDNode2.prototype.neuter = function() { + return new HDNode2(_constructorGuard, null, this.publicKey, this.parentFingerprint, this.chainCode, this.index, this.depth, this.path); + }; + HDNode2.prototype._derive = function(index) { + if (index > 4294967295) { + throw new Error("invalid index - " + String(index)); + } + 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.set((0, bytes_1.arrayify)(this.privateKey), 1); + if (path) { + path += "'"; + } + } else { + data.set((0, bytes_1.arrayify)(this.publicKey)); + } + for (var i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = index >> 24 - i & 255; + } + var I = (0, bytes_1.arrayify)((0, sha2_1.computeHmac)(sha2_1.SupportedAlgorithm.sha512, this.chainCode, data)); + var IL = I.slice(0, 32); + var IR = I.slice(32); + var ki = null; + var Ki = null; + if (this.privateKey) { + ki = bytes32(bignumber_1.BigNumber.from(IL).add(this.privateKey).mod(N)); + } else { + var ek = new signing_key_1.SigningKey((0, bytes_1.hexlify)(IL)); + Ki = ek._addPoint(this.publicKey); + } + var mnemonicOrPath = path; + var srcMnemonic = this.mnemonic; + if (srcMnemonic) { + mnemonicOrPath = Object.freeze({ + phrase: srcMnemonic.phrase, + path, + locale: srcMnemonic.locale || "en" + }); + } + return new HDNode2(_constructorGuard, ki, Ki, this.fingerprint, bytes32(IR), index, this.depth + 1, mnemonicOrPath); + }; + HDNode2.prototype.derivePath = function(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; + }; + HDNode2._fromSeed = function(seed, mnemonic) { + var seedArray = (0, bytes_1.arrayify)(seed); + if (seedArray.length < 16 || seedArray.length > 64) { + throw new Error("invalid seed"); + } + var I = (0, bytes_1.arrayify)((0, sha2_1.computeHmac)(sha2_1.SupportedAlgorithm.sha512, MasterSecret, seedArray)); + return new HDNode2(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic); + }; + HDNode2.fromMnemonic = function(mnemonic, password, wordlist) { + wordlist = getWordlist(wordlist); + mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist); + return HDNode2._fromSeed(mnemonicToSeed(mnemonic, password), { + phrase: mnemonic, + path: "m", + locale: wordlist.locale + }); + }; + HDNode2.fromSeed = function(seed) { + return HDNode2._fromSeed(seed, null); + }; + HDNode2.fromExtendedKey = function(extendedKey) { + var bytes = basex_1.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 = (0, bytes_1.hexlify)(bytes.slice(5, 9)); + var index = parseInt((0, bytes_1.hexlify)(bytes.slice(9, 13)).substring(2), 16); + var chainCode = (0, bytes_1.hexlify)(bytes.slice(13, 45)); + var key = bytes.slice(45, 78); + switch ((0, bytes_1.hexlify)(bytes.slice(0, 4))) { + case "0x0488b21e": + case "0x043587cf": + return new HDNode2(_constructorGuard, null, (0, bytes_1.hexlify)(key), parentFingerprint, chainCode, index, depth, null); + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNode2(_constructorGuard, (0, bytes_1.hexlify)(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null); + } + return logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]"); + }; + return HDNode2; + }() + ); + exports2.HDNode = HDNode; + function mnemonicToSeed(mnemonic, password) { + if (!password) { + password = ""; + } + var salt = (0, strings_1.toUtf8Bytes)("mnemonic" + password, strings_1.UnicodeNormalizationForm.NFKD); + return (0, pbkdf2_1.pbkdf2)((0, strings_1.toUtf8Bytes)(mnemonic, strings_1.UnicodeNormalizationForm.NFKD), salt, 2048, 64, "sha512"); + } + exports2.mnemonicToSeed = mnemonicToSeed; + 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 = (0, bytes_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 = (0, bytes_1.arrayify)((0, sha2_1.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + if (checksum !== (entropy[entropy.length - 1] & checksumMask)) { + throw new Error("invalid checksum"); + } + return (0, bytes_1.hexlify)(entropy.slice(0, entropyBits / 8)); + } + exports2.mnemonicToEntropy = mnemonicToEntropy; + function entropyToMnemonic(entropy, wordlist) { + wordlist = getWordlist(wordlist); + entropy = (0, bytes_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++) { + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + } else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> 8 - remainingBits; + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + var checksumBits = entropy.length / 4; + var checksum = (0, bytes_1.arrayify)((0, sha2_1.sha256)(entropy))[0] & getUpperMask(checksumBits); + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= checksum >> 8 - checksumBits; + return wordlist.join(indices.map(function(index) { + return wordlist.getWord(index); + })); + } + exports2.entropyToMnemonic = entropyToMnemonic; + function isValidMnemonic(mnemonic, wordlist) { + try { + mnemonicToEntropy(mnemonic, wordlist); + return true; + } catch (error) { + } + return false; + } + exports2.isValidMnemonic = isValidMnemonic; + function getAccountPath(index) { + if (typeof index !== "number" || index < 0 || index >= HardenedBit || index % 1) { + logger.throwArgumentError("invalid account index", "index", index); + } + return "m/44'/60'/" + index + "'/0/0"; + } + exports2.getAccountPath = getAccountPath; + } +}); + +// node_modules/@ethersproject/random/lib/random.js +var require_random = __commonJS({ + "node_modules/@ethersproject/random/lib/random.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.randomBytes = void 0; + var crypto_1 = require("crypto"); + var bytes_1 = require_lib2(); + function randomBytes(length) { + return (0, bytes_1.arrayify)((0, crypto_1.randomBytes)(length)); + } + exports2.randomBytes = randomBytes; + } +}); + +// node_modules/@ethersproject/random/lib/shuffle.js +var require_shuffle = __commonJS({ + "node_modules/@ethersproject/random/lib/shuffle.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.shuffled = void 0; + 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; + } + exports2.shuffled = shuffled; + } +}); + +// node_modules/@ethersproject/random/lib/index.js +var require_lib22 = __commonJS({ + "node_modules/@ethersproject/random/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.shuffled = exports2.randomBytes = void 0; + var random_1 = require_random(); + Object.defineProperty(exports2, "randomBytes", { enumerable: true, get: function() { + return random_1.randomBytes; + } }); + var shuffle_1 = require_shuffle(); + Object.defineProperty(exports2, "shuffled", { enumerable: true, get: function() { + return shuffle_1.shuffled; + } }); + } +}); + +// node_modules/aes-js/index.js +var require_aes_js = __commonJS({ + "node_modules/aes-js/index.js"(exports2, module2) { + "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) { + 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; + } + if (Array.isArray(arg)) { + if (!checkInts(arg)) { + throw new Error("Array contains invalid value: " + arg); + } + return new Uint8Array(arg); + } + 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 = /* @__PURE__ */ function() { + function toBytes(text) { + var result = [], i = 0; + text = encodeURI(text); + while (i < text.length) { + var c = text.charCodeAt(i++); + if (c === 37) { + result.push(parseInt(text.substr(i, 2), 16)); + i += 2; + } 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 & 31) << 6 | bytes[i + 1] & 63)); + i += 2; + } else { + result.push(String.fromCharCode((c & 15) << 12 | (bytes[i + 1] & 63) << 6 | bytes[i + 2] & 63)); + i += 3; + } + } + return result.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var convertHex = /* @__PURE__ */ 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; + } + var Hex = "0123456789abcdef"; + function fromBytes(bytes) { + var result = []; + for (var i = 0; i < bytes.length; i++) { + var v = bytes[i]; + result.push(Hex[(v & 240) >> 4] + Hex[v & 15]); + } + return result.join(""); + } + return { + toBytes, + fromBytes + }; + }(); + var numberOfRounds = { 16: 10, 24: 12, 32: 14 }; + var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145]; + var S = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22]; + var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125]; + var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986]; + var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766]; + var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126]; + var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436]; + var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890]; + var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935]; + var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600]; + var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480]; + var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795]; + var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855]; + var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150]; + var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925]; + 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(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)"); + } + this._Ke = []; + 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; + var tk = convertToInt32(this.key); + 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]; + } + var rconpointer = 0; + var t = KC, tt; + while (t < roundKeyCount) { + tt = tk[KC - 1]; + tk[0] ^= S[tt >> 16 & 255] << 24 ^ S[tt >> 8 & 255] << 16 ^ S[tt & 255] << 8 ^ S[tt >> 24 & 255] ^ rcon[rconpointer] << 24; + rconpointer += 1; + if (KC != 8) { + for (var i = 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } else { + for (var i = 1; i < KC / 2; i++) { + tk[i] ^= tk[i - 1]; + } + tt = tk[KC / 2 - 1]; + tk[KC / 2] ^= S[tt & 255] ^ S[tt >> 8 & 255] << 8 ^ S[tt >> 16 & 255] << 16 ^ S[tt >> 24 & 255] << 24; + for (var i = KC / 2 + 1; i < KC; i++) { + tk[i] ^= tk[i - 1]; + } + } + 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++; + } + } + 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 & 255] ^ U2[tt >> 16 & 255] ^ U3[tt >> 8 & 255] ^ U4[tt & 255]; + } + } + }; + 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]; + var t = convertToInt32(plaintext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Ke[0][i]; + } + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T1[t[i] >> 24 & 255] ^ T2[t[(i + 1) % 4] >> 16 & 255] ^ T3[t[(i + 2) % 4] >> 8 & 255] ^ T4[t[(i + 3) % 4] & 255] ^ this._Ke[r][i]; + } + t = a.slice(); + } + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Ke[rounds][i]; + result[4 * i] = (S[t[i] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i + 1] = (S[t[(i + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i + 2] = (S[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i + 3] = (S[t[(i + 3) % 4] & 255] ^ tt) & 255; + } + 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]; + var t = convertToInt32(ciphertext); + for (var i = 0; i < 4; i++) { + t[i] ^= this._Kd[0][i]; + } + for (var r = 1; r < rounds; r++) { + for (var i = 0; i < 4; i++) { + a[i] = T5[t[i] >> 24 & 255] ^ T6[t[(i + 3) % 4] >> 16 & 255] ^ T7[t[(i + 2) % 4] >> 8 & 255] ^ T8[t[(i + 1) % 4] & 255] ^ this._Kd[r][i]; + } + t = a.slice(); + } + var result = createArray(16), tt; + for (var i = 0; i < 4; i++) { + tt = this._Kd[rounds][i]; + result[4 * i] = (Si[t[i] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i + 1] = (Si[t[(i + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i + 2] = (Si[t[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i + 3] = (Si[t[(i + 1) % 4] & 255] ^ tt) & 255; + } + return result; + }; + var ModeOfOperationECB = function(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; + }; + var ModeOfOperationCBC = function(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; + }; + var ModeOfOperationCFB = function(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]; + } + 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]; + } + copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); + } + return plaintext; + }; + var ModeOfOperationOFB = function(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; + }; + ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt; + var Counter = function(initialValue) { + if (!(this instanceof Counter)) { + throw Error("Counter must be instanitated with `new`"); + } + 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; + } + } + }; + var ModeOfOperationCTR = function(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; + }; + ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt; + 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; + } + var aesjs = { + AES, + 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, + createArray, + copyArray + } + }; + if (typeof exports2 !== "undefined") { + module2.exports = aesjs; + } else if (typeof define === "function" && define.amd) { + define(aesjs); + } else { + if (root.aesjs) { + aesjs._aesjs = root.aesjs; + } + root.aesjs = aesjs; + } + })(exports2); + } +}); + +// node_modules/@ethersproject/json-wallets/lib/_version.js +var require_version18 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "json-wallets/5.5.0"; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/utils.js +var require_utils4 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/utils.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.uuidV4 = exports2.searchPath = exports2.getPassword = exports2.zpad = exports2.looseArrayify = void 0; + var bytes_1 = require_lib2(); + var strings_1 = require_lib9(); + function looseArrayify(hexString) { + if (typeof hexString === "string" && hexString.substring(0, 2) !== "0x") { + hexString = "0x" + hexString; + } + return (0, bytes_1.arrayify)(hexString); + } + exports2.looseArrayify = looseArrayify; + function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = "0" + value; + } + return value; + } + exports2.zpad = zpad; + function getPassword(password) { + if (typeof password === "string") { + return (0, strings_1.toUtf8Bytes)(password, strings_1.UnicodeNormalizationForm.NFKC); + } + return (0, bytes_1.arrayify)(password); + } + exports2.getPassword = getPassword; + function searchPath(object, path) { + var currentChild = object; + var comps = path.toLowerCase().split("/"); + for (var i = 0; i < comps.length; i++) { + var matchingChild = null; + for (var key in currentChild) { + if (key.toLowerCase() === comps[i]) { + matchingChild = currentChild[key]; + break; + } + } + if (matchingChild === null) { + return null; + } + currentChild = matchingChild; + } + return currentChild; + } + exports2.searchPath = searchPath; + function uuidV4(randomBytes) { + var bytes = (0, bytes_1.arrayify)(randomBytes); + bytes[6] = bytes[6] & 15 | 64; + bytes[8] = bytes[8] & 63 | 128; + var value = (0, bytes_1.hexlify)(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34) + ].join("-"); + } + exports2.uuidV4 = uuidV4; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/crowdsale.js +var require_crowdsale = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/crowdsale.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decrypt = exports2.CrowdsaleAccount = void 0; + var aes_js_1 = __importDefault(require_aes_js()); + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var pbkdf2_1 = require_lib18(); + var strings_1 = require_lib9(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version18(); + var logger = new logger_1.Logger(_version_1.version); + var utils_1 = require_utils4(); + var CrowdsaleAccount = ( + /** @class */ + function(_super) { + __extends(CrowdsaleAccount2, _super); + function CrowdsaleAccount2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CrowdsaleAccount2.prototype.isCrowdsaleAccount = function(value) { + return !!(value && value._isCrowdsaleAccount); + }; + return CrowdsaleAccount2; + }(properties_1.Description) + ); + exports2.CrowdsaleAccount = CrowdsaleAccount; + function decrypt(json, password) { + var data = JSON.parse(json); + password = (0, utils_1.getPassword)(password); + var ethaddr = (0, address_1.getAddress)((0, utils_1.searchPath)(data, "ethaddr")); + var encseed = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "encseed")); + if (!encseed || encseed.length % 16 !== 0) { + logger.throwArgumentError("invalid encseed", "json", json); + } + var key = (0, bytes_1.arrayify)((0, pbkdf2_1.pbkdf2)(password, password, 2e3, 32, "sha256")).slice(0, 16); + var iv = encseed.slice(0, 16); + var encryptedSeed = encseed.slice(16); + var aesCbc = new aes_js_1.default.ModeOfOperation.cbc(key, iv); + var seed = aes_js_1.default.padding.pkcs7.strip((0, bytes_1.arrayify)(aesCbc.decrypt(encryptedSeed))); + var seedHex = ""; + for (var i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + var seedHexBytes = (0, strings_1.toUtf8Bytes)(seedHex); + var privateKey = (0, keccak256_1.keccak256)(seedHexBytes); + return new CrowdsaleAccount({ + _isCrowdsaleAccount: true, + address: ethaddr, + privateKey + }); + } + exports2.decrypt = decrypt; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/inspect.js +var require_inspect = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/inspect.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getJsonWalletAddress = exports2.isKeystoreWallet = exports2.isCrowdsaleWallet = void 0; + var address_1 = require_lib7(); + function isCrowdsaleWallet(json) { + var data = null; + try { + data = JSON.parse(json); + } catch (error) { + return false; + } + return data.encseed && data.ethaddr; + } + exports2.isCrowdsaleWallet = isCrowdsaleWallet; + 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; + } + return true; + } + exports2.isKeystoreWallet = isKeystoreWallet; + function getJsonWalletAddress(json) { + if (isCrowdsaleWallet(json)) { + try { + return (0, address_1.getAddress)(JSON.parse(json).ethaddr); + } catch (error) { + return null; + } + } + if (isKeystoreWallet(json)) { + try { + return (0, address_1.getAddress)(JSON.parse(json).address); + } catch (error) { + return null; + } + } + return null; + } + exports2.getJsonWalletAddress = getJsonWalletAddress; + } +}); + +// node_modules/scrypt-js/scrypt.js +var require_scrypt = __commonJS({ + "node_modules/scrypt-js/scrypt.js"(exports2, module2) { + "use strict"; + (function(root) { + const MAX_VALUE = 2147483647; + function SHA256(m) { + const K = new Uint32Array([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]); + let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762; + let h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225; + const w = new Uint32Array(64); + function blocks(p2) { + let off = 0, len = p2.length; + while (len >= 64) { + let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7, u, i2, j, t1, t2; + for (i2 = 0; i2 < 16; i2++) { + j = off + i2 * 4; + w[i2] = (p2[j] & 255) << 24 | (p2[j + 1] & 255) << 16 | (p2[j + 2] & 255) << 8 | p2[j + 3] & 255; + } + for (i2 = 16; i2 < 64; i2++) { + u = w[i2 - 2]; + t1 = (u >>> 17 | u << 32 - 17) ^ (u >>> 19 | u << 32 - 19) ^ u >>> 10; + u = w[i2 - 15]; + t2 = (u >>> 7 | u << 32 - 7) ^ (u >>> 18 | u << 32 - 18) ^ u >>> 3; + w[i2] = (t1 + w[i2 - 7] | 0) + (t2 + w[i2 - 16] | 0) | 0; + } + for (i2 = 0; i2 < 64; i2++) { + t1 = (((e >>> 6 | e << 32 - 6) ^ (e >>> 11 | e << 32 - 11) ^ (e >>> 25 | e << 32 - 25)) + (e & f ^ ~e & g) | 0) + (h + (K[i2] + w[i2] | 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); + let i, bytesLeft = m.length % 64, bitLenHi = m.length / 536870912 | 0, bitLenLo = m.length << 3, numZeros = bytesLeft < 56 ? 56 : 120, p = m.slice(m.length - bytesLeft, m.length); + p.push(128); + for (i = bytesLeft + 1; i < numZeros; i++) { + p.push(0); + } + p.push(bitLenHi >>> 24 & 255); + p.push(bitLenHi >>> 16 & 255); + p.push(bitLenHi >>> 8 & 255); + p.push(bitLenHi >>> 0 & 255); + p.push(bitLenLo >>> 24 & 255); + p.push(bitLenLo >>> 16 & 255); + p.push(bitLenLo >>> 8 & 255); + p.push(bitLenLo >>> 0 & 255); + blocks(p); + return [ + h0 >>> 24 & 255, + h0 >>> 16 & 255, + h0 >>> 8 & 255, + h0 >>> 0 & 255, + h1 >>> 24 & 255, + h1 >>> 16 & 255, + h1 >>> 8 & 255, + h1 >>> 0 & 255, + h2 >>> 24 & 255, + h2 >>> 16 & 255, + h2 >>> 8 & 255, + h2 >>> 0 & 255, + h3 >>> 24 & 255, + h3 >>> 16 & 255, + h3 >>> 8 & 255, + h3 >>> 0 & 255, + h4 >>> 24 & 255, + h4 >>> 16 & 255, + h4 >>> 8 & 255, + h4 >>> 0 & 255, + h5 >>> 24 & 255, + h5 >>> 16 & 255, + h5 >>> 8 & 255, + h5 >>> 0 & 255, + h6 >>> 24 & 255, + h6 >>> 16 & 255, + h6 >>> 8 & 255, + h6 >>> 0 & 255, + h7 >>> 24 & 255, + h7 >>> 16 & 255, + h7 >>> 8 & 255, + h7 >>> 0 & 255 + ]; + } + function PBKDF2_HMAC_SHA256_OneIter(password, salt, dkLen) { + password = password.length <= 64 ? password : SHA256(password); + const innerLen = 64 + salt.length + 4; + const inner = new Array(innerLen); + const outerKey = new Array(64); + let i; + let dk = []; + for (i = 0; i < 64; i++) { + inner[i] = 54; + } + 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; + } + for (i = 0; i < 64; i++) outerKey[i] = 92; + for (i = 0; i < password.length; i++) outerKey[i] ^= password[i]; + function incrementCounter() { + for (let i2 = innerLen - 1; i2 >= innerLen - 4; i2--) { + inner[i2]++; + if (inner[i2] <= 255) return; + inner[i2] = 0; + } + } + 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; + } + function blockmix_salsa8(BY, Yi, r, x, _X) { + let 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 (let 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 (let i = 0; i < 16; ++i) { + B[i] += x[i]; + } + } + function blockxor(S, Si, D, len) { + for (let 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 (let i = 0; i < o.length; i++) { + const v = o[i]; + if (typeof v !== "number" || v % 1 || v < 0 || v >= 256) { + return false; + } + } + return true; + } + function ensureInteger(value, name2) { + if (typeof value !== "number" || value % 1) { + throw new Error("invalid " + name2); + } + return value; + } + 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); + let b = PBKDF2_HMAC_SHA256_OneIter(password, salt, p * 128 * r); + const B = new Uint32Array(p * 32 * r); + for (let i = 0; i < B.length; i++) { + const j = i * 4; + B[i] = (b[j + 3] & 255) << 24 | (b[j + 2] & 255) << 16 | (b[j + 1] & 255) << 8 | (b[j + 0] & 255) << 0; + } + const XY = new Uint32Array(64 * r); + const V = new Uint32Array(32 * r * N); + const Yi = 32 * r; + const x = new Uint32Array(16); + const _X = new Uint32Array(16); + const totalOps = p * N * 2; + let currentOp = 0; + let lastPercent10 = null; + let stop = false; + let state = 0; + let i0 = 0, i1; + let Bi; + const limit = callback ? parseInt(1e3 / r) : 4294967295; + const nextTick = typeof setImmediate !== "undefined" ? setImmediate : setTimeout; + const incrementalSMix = function() { + if (stop) { + return callback(new Error("cancelled"), currentOp / totalOps); + } + let steps; + switch (state) { + case 0: + Bi = i0 * 32 * r; + arraycopy(B, Bi, XY, 0, Yi); + state = 1; + i1 = 0; + case 1: + steps = N - i1; + if (steps > limit) { + steps = limit; + } + for (let i = 0; i < steps; i++) { + arraycopy(XY, 0, V, (i1 + i) * Yi, Yi); + blockmix_salsa8(XY, Yi, r, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N) { + break; + } + i1 = 0; + state = 2; + case 2: + steps = N - i1; + if (steps > limit) { + steps = limit; + } + for (let i = 0; i < steps; i++) { + const offset = (2 * r - 1) * 16; + const j = XY[offset] & N - 1; + blockxor(V, j * Yi, XY, Yi); + blockmix_salsa8(XY, Yi, r, x, _X); + } + i1 += steps; + currentOp += steps; + if (callback) { + const percent10 = parseInt(1e3 * currentOp / totalOps); + if (percent10 !== lastPercent10) { + stop = callback(null, currentOp / totalOps); + if (stop) { + break; + } + lastPercent10 = percent10; + } + } + if (i1 < N) { + break; + } + arraycopy(XY, 0, B, Bi, Yi); + i0++; + if (i0 < p) { + state = 0; + break; + } + b = []; + for (let i = 0; i < B.length; i++) { + b.push(B[i] >> 0 & 255); + b.push(B[i] >> 8 & 255); + b.push(B[i] >> 16 & 255); + b.push(B[i] >> 24 & 255); + } + const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b, dkLen); + if (callback) { + callback(null, 1, derivedKey); + } + return derivedKey; + } + if (callback) { + nextTick(incrementalSMix); + } + }; + if (!callback) { + while (true) { + const derivedKey = incrementalSMix(); + if (derivedKey != void 0) { + return derivedKey; + } + } + } + incrementalSMix(); + } + const lib = { + scrypt: function(password, salt, N, r, p, dkLen, progressCallback) { + return new Promise(function(resolve, reject) { + let 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(password, salt, N, r, p, dkLen) { + return new Uint8Array(_scrypt(password, salt, N, r, p, dkLen)); + } + }; + if (typeof exports2 !== "undefined") { + module2.exports = lib; + } else if (typeof define === "function" && define.amd) { + define(lib); + } else if (root) { + if (root.scrypt) { + root._scrypt = root.scrypt; + } + root.scrypt = lib; + } + })(exports2); + } +}); + +// node_modules/@ethersproject/json-wallets/lib/keystore.js +var require_keystore = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/keystore.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encrypt = exports2.decrypt = exports2.decryptSync = exports2.KeystoreAccount = void 0; + var aes_js_1 = __importDefault(require_aes_js()); + var scrypt_js_1 = __importDefault(require_scrypt()); + var address_1 = require_lib7(); + var bytes_1 = require_lib2(); + var hdnode_1 = require_lib21(); + var keccak256_1 = require_lib5(); + var pbkdf2_1 = require_lib18(); + var random_1 = require_lib22(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var utils_1 = require_utils4(); + var logger_1 = require_lib(); + var _version_1 = require_version18(); + var logger = new logger_1.Logger(_version_1.version); + function hasMnemonic(value) { + return value != null && value.mnemonic && value.mnemonic.phrase; + } + var KeystoreAccount = ( + /** @class */ + function(_super) { + __extends(KeystoreAccount2, _super); + function KeystoreAccount2() { + return _super !== null && _super.apply(this, arguments) || this; + } + KeystoreAccount2.prototype.isKeystoreAccount = function(value) { + return !!(value && value._isKeystoreAccount); + }; + return KeystoreAccount2; + }(properties_1.Description) + ); + exports2.KeystoreAccount = KeystoreAccount; + function _decrypt(data, key, ciphertext) { + var cipher = (0, utils_1.searchPath)(data, "crypto/cipher"); + if (cipher === "aes-128-ctr") { + var iv = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/cipherparams/iv")); + var counter = new aes_js_1.default.Counter(iv); + var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(key, counter); + return (0, bytes_1.arrayify)(aesCtr.decrypt(ciphertext)); + } + return null; + } + function _getAccount(data, key) { + var ciphertext = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/ciphertext")); + var computedMAC = (0, bytes_1.hexlify)((0, keccak256_1.keccak256)((0, bytes_1.concat)([key.slice(16, 32), ciphertext]))).substring(2); + if (computedMAC !== (0, utils_1.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", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "decrypt" + }); + } + var mnemonicKey = key.slice(32, 64); + var address = (0, transactions_1.computeAddress)(privateKey); + if (data.address) { + var check = data.address.toLowerCase(); + if (check.substring(0, 2) !== "0x") { + check = "0x" + check; + } + if ((0, address_1.getAddress)(check) !== address) { + throw new Error("address mismatch"); + } + } + var account = { + _isKeystoreAccount: true, + address, + privateKey: (0, bytes_1.hexlify)(privateKey) + }; + if ((0, utils_1.searchPath)(data, "x-ethers/version") === "0.1") { + var mnemonicCiphertext = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "x-ethers/mnemonicCiphertext")); + var mnemonicIv = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "x-ethers/mnemonicCounter")); + var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var path = (0, utils_1.searchPath)(data, "x-ethers/path") || hdnode_1.defaultPath; + var locale = (0, utils_1.searchPath)(data, "x-ethers/locale") || "en"; + var entropy = (0, bytes_1.arrayify)(mnemonicAesCtr.decrypt(mnemonicCiphertext)); + try { + var mnemonic = (0, hdnode_1.entropyToMnemonic)(entropy, locale); + var node = hdnode_1.HDNode.fromMnemonic(mnemonic, null, locale).derivePath(path); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + account.mnemonic = node.mnemonic; + } catch (error) { + if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { + throw error; + } + } + } + return new KeystoreAccount(account); + } + function pbkdf2Sync(passwordBytes, salt, count, dkLen, prfFunc) { + return (0, bytes_1.arrayify)((0, pbkdf2_1.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 = (0, utils_1.getPassword)(password); + var kdf = (0, utils_1.searchPath)(data, "crypto/kdf"); + if (kdf && typeof kdf === "string") { + var throwError = function(name2, value) { + return logger.throwArgumentError("invalid key-derivation function parameters", name2, value); + }; + if (kdf.toLowerCase() === "scrypt") { + var salt = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/kdfparams/salt")); + var N = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/n")); + var r = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/r")); + var p = parseInt((0, utils_1.searchPath)(data, "crypto/kdfparams/p")); + if (!N || !r || !p) { + throwError("kdf", kdf); + } + if ((N & N - 1) !== 0) { + throwError("N", N); + } + var dkLen = parseInt((0, utils_1.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 = (0, utils_1.looseArrayify)((0, utils_1.searchPath)(data, "crypto/kdfparams/salt")); + var prfFunc = null; + var prf = (0, utils_1.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((0, utils_1.searchPath)(data, "crypto/kdfparams/c")); + var dkLen = parseInt((0, utils_1.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_1.default.syncScrypt); + return _getAccount(data, key); + } + exports2.decryptSync = decryptSync; + function decrypt(json, password, progressCallback) { + return __awaiter(this, void 0, void 0, function() { + var data, key; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = JSON.parse(json); + return [4, _computeKdfKey(data, password, pbkdf2, scrypt_js_1.default.scrypt, progressCallback)]; + case 1: + key = _a.sent(); + return [2, _getAccount(data, key)]; + } + }); + }); + } + exports2.decrypt = decrypt; + function encrypt(account, password, options, progressCallback) { + try { + if ((0, address_1.getAddress)(account.address) !== (0, transactions_1.computeAddress)(account.privateKey)) { + throw new Error("address/privateKey mismatch"); + } + if (hasMnemonic(account)) { + var mnemonic = account.mnemonic; + var node = hdnode_1.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path || hdnode_1.defaultPath); + if (node.privateKey != account.privateKey) { + throw new Error("mnemonic mismatch"); + } + } + } catch (e) { + return Promise.reject(e); + } + if (typeof options === "function" && !progressCallback) { + progressCallback = options; + options = {}; + } + if (!options) { + options = {}; + } + var privateKey = (0, bytes_1.arrayify)(account.privateKey); + var passwordBytes = (0, utils_1.getPassword)(password); + var entropy = null; + var path = null; + var locale = null; + if (hasMnemonic(account)) { + var srcMnemonic = account.mnemonic; + entropy = (0, bytes_1.arrayify)((0, hdnode_1.mnemonicToEntropy)(srcMnemonic.phrase, srcMnemonic.locale || "en")); + path = srcMnemonic.path || hdnode_1.defaultPath; + locale = srcMnemonic.locale || "en"; + } + var client = options.client; + if (!client) { + client = "ethers.js"; + } + var salt = null; + if (options.salt) { + salt = (0, bytes_1.arrayify)(options.salt); + } else { + salt = (0, random_1.randomBytes)(32); + ; + } + var iv = null; + if (options.iv) { + iv = (0, bytes_1.arrayify)(options.iv); + if (iv.length !== 16) { + throw new Error("invalid iv"); + } + } else { + iv = (0, random_1.randomBytes)(16); + } + var uuidRandom = null; + if (options.uuid) { + uuidRandom = (0, bytes_1.arrayify)(options.uuid); + if (uuidRandom.length !== 16) { + throw new Error("invalid uuid"); + } + } else { + uuidRandom = (0, random_1.randomBytes)(16); + } + 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; + } + } + return scrypt_js_1.default.scrypt(passwordBytes, salt, N, r, p, 64, progressCallback).then(function(key) { + key = (0, bytes_1.arrayify)(key); + var derivedKey = key.slice(0, 16); + var macPrefix = key.slice(16, 32); + var mnemonicKey = key.slice(32, 64); + var counter = new aes_js_1.default.Counter(iv); + var aesCtr = new aes_js_1.default.ModeOfOperation.ctr(derivedKey, counter); + var ciphertext = (0, bytes_1.arrayify)(aesCtr.encrypt(privateKey)); + var mac = (0, keccak256_1.keccak256)((0, bytes_1.concat)([macPrefix, ciphertext])); + var data = { + address: account.address.substring(2).toLowerCase(), + id: (0, utils_1.uuidV4)(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: (0, bytes_1.hexlify)(iv).substring(2) + }, + ciphertext: (0, bytes_1.hexlify)(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: (0, bytes_1.hexlify)(salt).substring(2), + n: N, + dklen: 32, + p, + r + }, + mac: mac.substring(2) + } + }; + if (entropy) { + var mnemonicIv = (0, random_1.randomBytes)(16); + var mnemonicCounter = new aes_js_1.default.Counter(mnemonicIv); + var mnemonicAesCtr = new aes_js_1.default.ModeOfOperation.ctr(mnemonicKey, mnemonicCounter); + var mnemonicCiphertext = (0, bytes_1.arrayify)(mnemonicAesCtr.encrypt(entropy)); + var now = /* @__PURE__ */ new Date(); + var timestamp = now.getUTCFullYear() + "-" + (0, utils_1.zpad)(now.getUTCMonth() + 1, 2) + "-" + (0, utils_1.zpad)(now.getUTCDate(), 2) + "T" + (0, utils_1.zpad)(now.getUTCHours(), 2) + "-" + (0, utils_1.zpad)(now.getUTCMinutes(), 2) + "-" + (0, utils_1.zpad)(now.getUTCSeconds(), 2) + ".0Z"; + data["x-ethers"] = { + client, + gethFilename: "UTC--" + timestamp + "--" + data.address, + mnemonicCounter: (0, bytes_1.hexlify)(mnemonicIv).substring(2), + mnemonicCiphertext: (0, bytes_1.hexlify)(mnemonicCiphertext).substring(2), + path, + locale, + version: "0.1" + }; + } + return JSON.stringify(data); + }); + } + exports2.encrypt = encrypt; + } +}); + +// node_modules/@ethersproject/json-wallets/lib/index.js +var require_lib23 = __commonJS({ + "node_modules/@ethersproject/json-wallets/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.decryptJsonWalletSync = exports2.decryptJsonWallet = exports2.getJsonWalletAddress = exports2.isKeystoreWallet = exports2.isCrowdsaleWallet = exports2.encryptKeystore = exports2.decryptKeystoreSync = exports2.decryptKeystore = exports2.decryptCrowdsale = void 0; + var crowdsale_1 = require_crowdsale(); + Object.defineProperty(exports2, "decryptCrowdsale", { enumerable: true, get: function() { + return crowdsale_1.decrypt; + } }); + var inspect_1 = require_inspect(); + Object.defineProperty(exports2, "getJsonWalletAddress", { enumerable: true, get: function() { + return inspect_1.getJsonWalletAddress; + } }); + Object.defineProperty(exports2, "isCrowdsaleWallet", { enumerable: true, get: function() { + return inspect_1.isCrowdsaleWallet; + } }); + Object.defineProperty(exports2, "isKeystoreWallet", { enumerable: true, get: function() { + return inspect_1.isKeystoreWallet; + } }); + var keystore_1 = require_keystore(); + Object.defineProperty(exports2, "decryptKeystore", { enumerable: true, get: function() { + return keystore_1.decrypt; + } }); + Object.defineProperty(exports2, "decryptKeystoreSync", { enumerable: true, get: function() { + return keystore_1.decryptSync; + } }); + Object.defineProperty(exports2, "encryptKeystore", { enumerable: true, get: function() { + return keystore_1.encrypt; + } }); + function decryptJsonWallet(json, password, progressCallback) { + if ((0, inspect_1.isCrowdsaleWallet)(json)) { + if (progressCallback) { + progressCallback(0); + } + var account = (0, crowdsale_1.decrypt)(json, password); + if (progressCallback) { + progressCallback(1); + } + return Promise.resolve(account); + } + if ((0, inspect_1.isKeystoreWallet)(json)) { + return (0, keystore_1.decrypt)(json, password, progressCallback); + } + return Promise.reject(new Error("invalid JSON wallet")); + } + exports2.decryptJsonWallet = decryptJsonWallet; + function decryptJsonWalletSync(json, password) { + if ((0, inspect_1.isCrowdsaleWallet)(json)) { + return (0, crowdsale_1.decrypt)(json, password); + } + if ((0, inspect_1.isKeystoreWallet)(json)) { + return (0, keystore_1.decryptSync)(json, password); + } + throw new Error("invalid JSON wallet"); + } + exports2.decryptJsonWalletSync = decryptJsonWalletSync; + } +}); + +// node_modules/@ethersproject/wallet/lib/_version.js +var require_version19 = __commonJS({ + "node_modules/@ethersproject/wallet/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "wallet/5.5.0"; + } +}); + +// node_modules/@ethersproject/wallet/lib/index.js +var require_lib24 = __commonJS({ + "node_modules/@ethersproject/wallet/lib/index.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.verifyTypedData = exports2.verifyMessage = exports2.Wallet = void 0; + var address_1 = require_lib7(); + var abstract_provider_1 = require_lib12(); + var abstract_signer_1 = require_lib13(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var hdnode_1 = require_lib21(); + var keccak256_1 = require_lib5(); + var properties_1 = require_lib4(); + var random_1 = require_lib22(); + var signing_key_1 = require_lib14(); + var json_wallets_1 = require_lib23(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version19(); + var logger = new logger_1.Logger(_version_1.version); + function isAccount(value) { + return value != null && (0, bytes_1.isHexString)(value.privateKey, 32) && value.address != null; + } + function hasMnemonic(value) { + var mnemonic = value.mnemonic; + return mnemonic && mnemonic.phrase; + } + var Wallet = ( + /** @class */ + function(_super) { + __extends(Wallet2, _super); + function Wallet2(privateKey, provider) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Wallet2); + _this = _super.call(this) || this; + if (isAccount(privateKey)) { + var signingKey_1 = new signing_key_1.SigningKey(privateKey.privateKey); + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return signingKey_1; + }); + (0, properties_1.defineReadOnly)(_this, "address", (0, transactions_1.computeAddress)(_this.publicKey)); + if (_this.address !== (0, address_1.getAddress)(privateKey.address)) { + logger.throwArgumentError("privateKey/address mismatch", "privateKey", "[REDACTED]"); + } + if (hasMnemonic(privateKey)) { + var srcMnemonic_1 = privateKey.mnemonic; + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return { + phrase: srcMnemonic_1.phrase, + path: srcMnemonic_1.path || hdnode_1.defaultPath, + locale: srcMnemonic_1.locale || "en" + }; + }); + var mnemonic = _this.mnemonic; + var node = hdnode_1.HDNode.fromMnemonic(mnemonic.phrase, null, mnemonic.locale).derivePath(mnemonic.path); + if ((0, transactions_1.computeAddress)(node.privateKey) !== _this.address) { + logger.throwArgumentError("mnemonic/address mismatch", "privateKey", "[REDACTED]"); + } + } else { + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return null; + }); + } + } else { + if (signing_key_1.SigningKey.isSigningKey(privateKey)) { + if (privateKey.curve !== "secp256k1") { + logger.throwArgumentError("unsupported curve; must be secp256k1", "privateKey", "[REDACTED]"); + } + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return privateKey; + }); + } else { + if (typeof privateKey === "string") { + if (privateKey.match(/^[0-9a-f]*$/i) && privateKey.length === 64) { + privateKey = "0x" + privateKey; + } + } + var signingKey_2 = new signing_key_1.SigningKey(privateKey); + (0, properties_1.defineReadOnly)(_this, "_signingKey", function() { + return signingKey_2; + }); + } + (0, properties_1.defineReadOnly)(_this, "_mnemonic", function() { + return null; + }); + (0, properties_1.defineReadOnly)(_this, "address", (0, transactions_1.computeAddress)(_this.publicKey)); + } + if (provider && !abstract_provider_1.Provider.isProvider(provider)) { + logger.throwArgumentError("invalid provider", "provider", provider); + } + (0, properties_1.defineReadOnly)(_this, "provider", provider || null); + return _this; + } + Object.defineProperty(Wallet2.prototype, "mnemonic", { + get: function() { + return this._mnemonic(); + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Wallet2.prototype, "privateKey", { + get: function() { + return this._signingKey().privateKey; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Wallet2.prototype, "publicKey", { + get: function() { + return this._signingKey().publicKey; + }, + enumerable: false, + configurable: true + }); + Wallet2.prototype.getAddress = function() { + return Promise.resolve(this.address); + }; + Wallet2.prototype.connect = function(provider) { + return new Wallet2(this, provider); + }; + Wallet2.prototype.signTransaction = function(transaction) { + var _this = this; + return (0, properties_1.resolveProperties)(transaction).then(function(tx) { + if (tx.from != null) { + if ((0, address_1.getAddress)(tx.from) !== _this.address) { + logger.throwArgumentError("transaction from address mismatch", "transaction.from", transaction.from); + } + delete tx.from; + } + var signature = _this._signingKey().signDigest((0, keccak256_1.keccak256)((0, transactions_1.serialize)(tx))); + return (0, transactions_1.serialize)(tx, signature); + }); + }; + Wallet2.prototype.signMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, (0, bytes_1.joinSignature)(this._signingKey().signDigest((0, hash_1.hashMessage)(message)))]; + }); + }); + }; + Wallet2.prototype._signTypedData = function(domain, types, value) { + return __awaiter(this, void 0, void 0, function() { + var populated; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, hash_1._TypedDataEncoder.resolveNames(domain, types, value, function(name2) { + if (_this.provider == null) { + logger.throwError("cannot resolve ENS names without a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName", + value: name2 + }); + } + return _this.provider.resolveName(name2); + })]; + case 1: + populated = _a.sent(); + return [2, (0, bytes_1.joinSignature)(this._signingKey().signDigest(hash_1._TypedDataEncoder.hash(populated.domain, types, populated.value)))]; + } + }); + }); + }; + Wallet2.prototype.encrypt = function(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 (0, json_wallets_1.encryptKeystore)(this, password, options, progressCallback); + }; + Wallet2.createRandom = function(options) { + var entropy = (0, random_1.randomBytes)(16); + if (!options) { + options = {}; + } + if (options.extraEntropy) { + entropy = (0, bytes_1.arrayify)((0, bytes_1.hexDataSlice)((0, keccak256_1.keccak256)((0, bytes_1.concat)([entropy, options.extraEntropy])), 0, 16)); + } + var mnemonic = (0, hdnode_1.entropyToMnemonic)(entropy, options.locale); + return Wallet2.fromMnemonic(mnemonic, options.path, options.locale); + }; + Wallet2.fromEncryptedJson = function(json, password, progressCallback) { + return (0, json_wallets_1.decryptJsonWallet)(json, password, progressCallback).then(function(account) { + return new Wallet2(account); + }); + }; + Wallet2.fromEncryptedJsonSync = function(json, password) { + return new Wallet2((0, json_wallets_1.decryptJsonWalletSync)(json, password)); + }; + Wallet2.fromMnemonic = function(mnemonic, path, wordlist) { + if (!path) { + path = hdnode_1.defaultPath; + } + return new Wallet2(hdnode_1.HDNode.fromMnemonic(mnemonic, null, wordlist).derivePath(path)); + }; + return Wallet2; + }(abstract_signer_1.Signer) + ); + exports2.Wallet = Wallet; + function verifyMessage(message, signature) { + return (0, transactions_1.recoverAddress)((0, hash_1.hashMessage)(message), signature); + } + exports2.verifyMessage = verifyMessage; + function verifyTypedData(domain, types, value, signature) { + return (0, transactions_1.recoverAddress)(hash_1._TypedDataEncoder.hash(domain, types, value), signature); + } + exports2.verifyTypedData = verifyTypedData; + } +}); + +// node_modules/@ethersproject/networks/lib/_version.js +var require_version20 = __commonJS({ + "node_modules/@ethersproject/networks/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "networks/5.5.1"; + } +}); + +// node_modules/@ethersproject/networks/lib/index.js +var require_lib25 = __commonJS({ + "node_modules/@ethersproject/networks/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getNetwork = void 0; + var logger_1 = require_lib(); + var _version_1 = require_version20(); + var logger = new logger_1.Logger(_version_1.version); + function isRenetworkable(value) { + return value && typeof value.renetwork === "function"; + } + function ethDefaultProvider(network) { + var func = function(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) { + 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(network2) { + return ethDefaultProvider(network2); + }; + return func; + } + function etcDefaultProvider(url, network) { + var func = function(providers, options) { + if (providers.JsonRpcProvider) { + return new providers.JsonRpcProvider(url, network); + } + return null; + }; + func.renetwork = function(network2) { + return etcDefaultProvider(url, network2); + }; + 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") + }; + var networks = { + unspecified: { chainId: 0, name: "unspecified" }, + homestead, + mainnet: homestead, + morden: { chainId: 2, name: "morden" }, + 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") + }, + // ETC (See: #351) + classic: { + chainId: 61, + name: "classic", + _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/etc", "classic") + }, + classicMorden: { chainId: 62, name: "classicMorden" }, + 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" } + }; + function getNetwork(network) { + if (network == null) { + return null; + } + if (typeof network === "number") { + for (var name_1 in networks) { + var standard_1 = networks[name_1]; + if (standard_1.chainId === network) { + return { + name: standard_1.name, + chainId: standard_1.chainId, + ensAddress: standard_1.ensAddress || null, + _defaultProvider: standard_1._defaultProvider || null + }; + } + } + return { + chainId: network, + name: "unknown" + }; + } + if (typeof network === "string") { + var standard_2 = networks[network]; + if (standard_2 == null) { + return null; + } + return { + name: standard_2.name, + chainId: standard_2.chainId, + ensAddress: standard_2.ensAddress, + _defaultProvider: standard_2._defaultProvider || null + }; + } + var standard = networks[network.name]; + if (!standard) { + if (typeof network.chainId !== "number") { + logger.throwArgumentError("invalid network chainId", "network", network); + } + return network; + } + if (network.chainId !== 0 && network.chainId !== standard.chainId) { + logger.throwArgumentError("network chainId mismatch", "network", network); + } + var defaultProvider = network._defaultProvider || null; + if (defaultProvider == null && standard._defaultProvider) { + if (isRenetworkable(standard._defaultProvider)) { + defaultProvider = standard._defaultProvider.renetwork(network); + } else { + defaultProvider = standard._defaultProvider; + } + } + return { + name: network.name, + chainId: standard.chainId, + ensAddress: network.ensAddress || standard.ensAddress || null, + _defaultProvider: defaultProvider + }; + } + exports2.getNetwork = getNetwork; + } +}); + +// node_modules/@ethersproject/base64/lib/base64.js +var require_base64 = __commonJS({ + "node_modules/@ethersproject/base64/lib/base64.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encode = exports2.decode = void 0; + var bytes_1 = require_lib2(); + function decode(textData) { + return (0, bytes_1.arrayify)(new Uint8Array(Buffer.from(textData, "base64"))); + } + exports2.decode = decode; + function encode(data) { + return Buffer.from((0, bytes_1.arrayify)(data)).toString("base64"); + } + exports2.encode = encode; + } +}); + +// node_modules/@ethersproject/base64/lib/index.js +var require_lib26 = __commonJS({ + "node_modules/@ethersproject/base64/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.encode = exports2.decode = void 0; + var base64_1 = require_base64(); + Object.defineProperty(exports2, "decode", { enumerable: true, get: function() { + return base64_1.decode; + } }); + Object.defineProperty(exports2, "encode", { enumerable: true, get: function() { + return base64_1.encode; + } }); + } +}); + +// node_modules/@ethersproject/web/lib/_version.js +var require_version21 = __commonJS({ + "node_modules/@ethersproject/web/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "web/5.5.1"; + } +}); + +// node_modules/@ethersproject/web/lib/geturl.js +var require_geturl = __commonJS({ + "node_modules/@ethersproject/web/lib/geturl.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.getUrl = void 0; + var http_1 = __importDefault(require("http")); + var https_1 = __importDefault(require("https")); + var zlib_1 = require("zlib"); + var url_1 = require("url"); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version21(); + var logger = new logger_1.Logger(_version_1.version); + function getResponse(request) { + return new Promise(function(resolve, reject) { + request.once("response", function(resp) { + var response = { + statusCode: resp.statusCode, + statusMessage: resp.statusMessage, + headers: Object.keys(resp.headers).reduce(function(accum, name2) { + var value = resp.headers[name2]; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name2] = value; + return accum; + }, {}), + body: null + }; + resp.on("data", function(chunk) { + if (response.body == null) { + response.body = new Uint8Array(0); + } + response.body = (0, bytes_1.concat)([response.body, chunk]); + }); + resp.on("end", function() { + if (response.headers["content-encoding"] === "gzip") { + response.body = (0, bytes_1.arrayify)((0, zlib_1.gunzipSync)(response.body)); + } + resolve(response); + }); + resp.on("error", function(error) { + error.response = response; + reject(error); + }); + }); + request.on("error", function(error) { + reject(error); + }); + }); + } + function nonnull(value) { + if (value == null) { + return ""; + } + return value; + } + function getUrl(href, options) { + return __awaiter(this, void 0, void 0, function() { + var url, request, req, response; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (options == null) { + options = {}; + } + url = (0, url_1.parse)(href); + request = { + protocol: nonnull(url.protocol), + hostname: nonnull(url.hostname), + port: nonnull(url.port), + path: nonnull(url.pathname) + nonnull(url.search), + method: options.method || "GET", + headers: (0, properties_1.shallowCopy)(options.headers || {}) + }; + if (options.allowGzip) { + request.headers["accept-encoding"] = "gzip"; + } + req = null; + switch (nonnull(url.protocol)) { + case "http:": + req = http_1.default.request(request); + break; + case "https:": + req = https_1.default.request(request); + break; + default: + logger.throwError("unsupported protocol " + url.protocol, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + protocol: url.protocol, + operation: "request" + }); + } + if (options.body) { + req.write(Buffer.from(options.body)); + } + req.end(); + return [4, getResponse(req)]; + case 1: + response = _a.sent(); + return [2, response]; + } + }); + }); + } + exports2.getUrl = getUrl; + } +}); + +// node_modules/@ethersproject/web/lib/index.js +var require_lib27 = __commonJS({ + "node_modules/@ethersproject/web/lib/index.js"(exports2) { + "use strict"; + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.poll = exports2.fetchJson = exports2._fetchData = void 0; + var base64_1 = require_lib26(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var strings_1 = require_lib9(); + var logger_1 = require_lib(); + var _version_1 = require_version21(); + var logger = new logger_1.Logger(_version_1.version); + var geturl_1 = require_geturl(); + 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 ((0, bytes_1.isBytesLike)(value)) { + if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) { + try { + return (0, strings_1.toUtf8String)(value); + } catch (error) { + } + ; + } + return (0, bytes_1.hexlify)(value); + } + return value; + } + function _fetchData(connection, body, processFunc) { + 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; + var options = { + method: "GET" + }; + var allow304 = false; + var timeout = 2 * 60 * 1e3; + 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, 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", logger_1.Logger.errors.INVALID_ARGUMENT, { argument: "url", url, user: connection.user, password: "[REDACTED]" }); + } + var authorization = connection.user + ":" + connection.password; + headers["authorization"] = { + key: "Authorization", + value: "Basic " + (0, base64_1.encode)((0, strings_1.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: (0, base64_1.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", logger_1.Logger.errors.SERVER_ERROR, { + body: bodyify(dataMatch[1], dataMatch[2]), + error, + requestBody: null, + requestMethod: "GET", + 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(key2) { + var header = headers[key2]; + 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", logger_1.Logger.errors.TIMEOUT, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + timeout, + url + })); + }, timeout); + } + }); + var cancel = function() { + if (timer == null) { + return; + } + clearTimeout(timer); + timer = null; + }; + return { promise, cancel }; + }(); + var runningFetch = function() { + return __awaiter(this, void 0, void 0, function() { + var attempt, response2, location_1, tryAgain, stall, retryAfter, error_1, body_1, result2, error_2, tryAgain, timeout_1; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + attempt = 0; + _a.label = 1; + case 1: + if (!(attempt < attemptLimit)) return [3, 20]; + response2 = null; + _a.label = 2; + case 2: + _a.trys.push([2, 9, , 10]); + return [4, (0, geturl_1.getUrl)(url, options)]; + case 3: + response2 = _a.sent(); + if (!(attempt < attemptLimit)) return [3, 8]; + if (!(response2.statusCode === 301 || response2.statusCode === 302)) return [3, 4]; + location_1 = response2.headers.location || ""; + if (options.method === "GET" && location_1.match(/^https:/)) { + url = response2.headers.location; + return [3, 19]; + } + return [3, 8]; + case 4: + if (!(response2.statusCode === 429)) return [3, 8]; + tryAgain = true; + if (!throttleCallback) return [3, 6]; + return [4, throttleCallback(attempt, url)]; + case 5: + tryAgain = _a.sent(); + _a.label = 6; + case 6: + if (!tryAgain) return [3, 8]; + stall = 0; + retryAfter = response2.headers["retry-after"]; + if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + stall = parseInt(retryAfter) * 1e3; + } else { + stall = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + } + return [4, staller(stall)]; + case 7: + _a.sent(); + return [3, 19]; + case 8: + return [3, 10]; + case 9: + error_1 = _a.sent(); + response2 = error_1.response; + if (response2 == null) { + runningTimeout.cancel(); + logger.throwError("missing response", logger_1.Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + serverError: error_1, + url + }); + } + return [3, 10]; + case 10: + body_1 = response2.body; + if (allow304 && response2.statusCode === 304) { + body_1 = null; + } else if (response2.statusCode < 200 || response2.statusCode >= 300) { + runningTimeout.cancel(); + logger.throwError("bad response", logger_1.Logger.errors.SERVER_ERROR, { + status: response2.statusCode, + headers: response2.headers, + body: bodyify(body_1, response2.headers ? response2.headers["content-type"] : null), + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + } + if (!processFunc) return [3, 18]; + _a.label = 11; + case 11: + _a.trys.push([11, 13, , 18]); + return [4, processFunc(body_1, response2)]; + case 12: + result2 = _a.sent(); + runningTimeout.cancel(); + return [2, result2]; + case 13: + error_2 = _a.sent(); + if (!(error_2.throttleRetry && attempt < attemptLimit)) return [3, 17]; + tryAgain = true; + if (!throttleCallback) return [3, 15]; + return [4, throttleCallback(attempt, url)]; + case 14: + tryAgain = _a.sent(); + _a.label = 15; + case 15: + if (!tryAgain) return [3, 17]; + timeout_1 = throttleSlotInterval * parseInt(String(Math.random() * Math.pow(2, attempt))); + return [4, staller(timeout_1)]; + case 16: + _a.sent(); + return [3, 19]; + case 17: + runningTimeout.cancel(); + logger.throwError("processing response error", logger_1.Logger.errors.SERVER_ERROR, { + body: bodyify(body_1, response2.headers ? response2.headers["content-type"] : null), + error: error_2, + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + }); + return [3, 18]; + case 18: + runningTimeout.cancel(); + return [2, body_1]; + case 19: + attempt++; + return [3, 1]; + case 20: + return [2, logger.throwError("failed response", logger_1.Logger.errors.SERVER_ERROR, { + requestBody: bodyify(options.body, flatHeaders["content-type"]), + requestMethod: options.method, + url + })]; + } + }); + }); + }(); + return Promise.race([runningTimeout.promise, runningFetch]); + } + exports2._fetchData = _fetchData; + function fetchJson(connection, json, processFunc) { + var processJsonFunc = function(value, response) { + var result = null; + if (value != null) { + try { + result = JSON.parse((0, strings_1.toUtf8String)(value)); + } catch (error) { + logger.throwError("invalid JSON", logger_1.Logger.errors.SERVER_ERROR, { + body: value, + error + }); + } + } + if (processFunc) { + result = processFunc(result, response); + } + return result; + }; + var body = null; + if (json != null) { + body = (0, strings_1.toUtf8Bytes)(json); + var updated = typeof connection === "string" ? { url: connection } : (0, properties_1.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 = (0, properties_1.shallowCopy)(updated.headers); + updated.headers["content-type"] = "application/json"; + } + } else { + updated.headers = { "content-type": "application/json" }; + } + connection = updated; + } + return _fetchData(connection, body, processJsonFunc); + } + exports2.fetchJson = fetchJson; + function poll(func, options) { + if (!options) { + options = {}; + } + options = (0, properties_1.shallowCopy)(options); + if (options.floor == null) { + options.floor = 0; + } + if (options.ceiling == null) { + options.ceiling = 1e4; + } + if (options.interval == null) { + options.interval = 250; + } + return new Promise(function(resolve, reject) { + var timer = null; + var done = false; + var cancel = function() { + 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 (result !== void 0) { + if (cancel()) { + resolve(result); + } + } else if (options.oncePoll) { + options.oncePoll.once("poll", check); + } else if (options.onceBlock) { + options.onceBlock.once("block", check); + } 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(); + }); + } + exports2.poll = poll; + } +}); + +// node_modules/bech32/index.js +var require_bech32 = __commonJS({ + "node_modules/bech32/index.js"(exports2, module2) { + "use strict"; + var ALPHABET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"; + var ALPHABET_MAP = {}; + for (z = 0; z < ALPHABET.length; z++) { + x = ALPHABET.charAt(z); + if (ALPHABET_MAP[x] !== void 0) throw new TypeError(x + " is ambiguous"); + ALPHABET_MAP[x] = z; + } + var x; + var z; + function polymodStep(pre) { + var b = pre >> 25; + return (pre & 33554431) << 5 ^ -(b >> 0 & 1) & 996825010 ^ -(b >> 1 & 1) & 642813549 ^ -(b >> 2 & 1) & 513874426 ^ -(b >> 3 & 1) & 1027748829 ^ -(b >> 4 & 1) & 705979059; + } + 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 & 31; + } + 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(); + 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 x2 = words[i]; + if (x2 >> 5 !== 0) throw new Error("Non 5-bit word"); + chk = polymodStep(chk) ^ x2; + result += ALPHABET.charAt(x2); + } + for (i = 0; i < 6; ++i) { + chk = polymodStep(chk); + } + chk ^= 1; + for (i = 0; i < 6; ++i) { + var v = chk >> (5 - i) * 5 & 31; + 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"; + 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 === void 0) return "Unknown character " + c; + chk = polymodStep(chk) ^ v; + if (i + 6 >= wordChars.length) continue; + words.push(v); + } + if (chk !== 1) return "Invalid checksum for " + str; + return { prefix, 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); + } + module2.exports = { + decodeUnsafe, + decode, + encode, + toWordsUnsafe, + toWords, + fromWordsUnsafe, + fromWords + }; + } +}); + +// node_modules/@ethersproject/providers/lib/_version.js +var require_version22 = __commonJS({ + "node_modules/@ethersproject/providers/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "providers/5.5.1"; + } +}); + +// node_modules/@ethersproject/providers/lib/formatter.js +var require_formatter = __commonJS({ + "node_modules/@ethersproject/providers/lib/formatter.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.showThrottleMessage = exports2.isCommunityResource = exports2.isCommunityResourcable = exports2.Formatter = void 0; + var address_1 = require_lib7(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var Formatter = ( + /** @class */ + function() { + function Formatter2() { + var _newTarget = this.constructor; + logger.checkNew(_newTarget, Formatter2); + this.formats = this.getDefaultFormats(); + } + Formatter2.prototype.getDefaultFormats = function() { + 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(v) { + return _this.data(v, true); + }; + formats.transaction = { + hash, + type, + accessList: Formatter2.allowNull(this.accessList.bind(this), null), + blockHash: Formatter2.allowNull(hash, null), + blockNumber: Formatter2.allowNull(number, null), + transactionIndex: Formatter2.allowNull(number, null), + confirmations: Formatter2.allowNull(number, null), + from: address, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) + // must be set + gasPrice: Formatter2.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter2.allowNull(bigNumber), + maxFeePerGas: Formatter2.allowNull(bigNumber), + gasLimit: bigNumber, + to: Formatter2.allowNull(address, null), + value: bigNumber, + nonce: number, + data, + r: Formatter2.allowNull(this.uint256), + s: Formatter2.allowNull(this.uint256), + v: Formatter2.allowNull(number), + creates: Formatter2.allowNull(address, null), + raw: Formatter2.allowNull(data) + }; + formats.transactionRequest = { + from: Formatter2.allowNull(address), + nonce: Formatter2.allowNull(number), + gasLimit: Formatter2.allowNull(bigNumber), + gasPrice: Formatter2.allowNull(bigNumber), + maxPriorityFeePerGas: Formatter2.allowNull(bigNumber), + maxFeePerGas: Formatter2.allowNull(bigNumber), + to: Formatter2.allowNull(address), + value: Formatter2.allowNull(bigNumber), + data: Formatter2.allowNull(strictData), + type: Formatter2.allowNull(number), + accessList: Formatter2.allowNull(this.accessList.bind(this), null) + }; + formats.receiptLog = { + transactionIndex: number, + blockNumber: number, + transactionHash: hash, + address, + topics: Formatter2.arrayOf(hash), + data, + logIndex: number, + blockHash: hash + }; + formats.receipt = { + to: Formatter2.allowNull(this.address, null), + from: Formatter2.allowNull(this.address, null), + contractAddress: Formatter2.allowNull(address, null), + transactionIndex: number, + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + root: Formatter2.allowNull(hex), + gasUsed: bigNumber, + logsBloom: Formatter2.allowNull(data), + blockHash: hash, + transactionHash: hash, + logs: Formatter2.arrayOf(this.receiptLog.bind(this)), + blockNumber: number, + confirmations: Formatter2.allowNull(number, null), + cumulativeGasUsed: bigNumber, + effectiveGasPrice: Formatter2.allowNull(bigNumber), + status: Formatter2.allowNull(number), + type + }; + formats.block = { + hash, + parentHash: hash, + number, + timestamp: number, + nonce: Formatter2.allowNull(hex), + difficulty: this.difficulty.bind(this), + gasLimit: bigNumber, + gasUsed: bigNumber, + miner: address, + extraData: data, + transactions: Formatter2.allowNull(Formatter2.arrayOf(hash)), + baseFeePerGas: Formatter2.allowNull(bigNumber) + }; + formats.blockWithTransactions = (0, properties_1.shallowCopy)(formats.block); + formats.blockWithTransactions.transactions = Formatter2.allowNull(Formatter2.arrayOf(this.transactionResponse.bind(this))); + formats.filter = { + fromBlock: Formatter2.allowNull(blockTag, void 0), + toBlock: Formatter2.allowNull(blockTag, void 0), + blockHash: Formatter2.allowNull(hash, void 0), + address: Formatter2.allowNull(address, void 0), + topics: Formatter2.allowNull(this.topics.bind(this), void 0) + }; + formats.filterLog = { + blockNumber: Formatter2.allowNull(number), + blockHash: Formatter2.allowNull(hash), + transactionIndex: number, + removed: Formatter2.allowNull(this.boolean.bind(this)), + address, + data: Formatter2.allowFalsish(data, "0x"), + topics: Formatter2.arrayOf(hash), + transactionHash: hash, + logIndex: number + }; + return formats; + }; + Formatter2.prototype.accessList = function(accessList) { + return (0, transactions_1.accessListify)(accessList || []); + }; + Formatter2.prototype.number = function(number) { + if (number === "0x") { + return 0; + } + return bignumber_1.BigNumber.from(number).toNumber(); + }; + Formatter2.prototype.type = function(number) { + if (number === "0x" || number == null) { + return 0; + } + return bignumber_1.BigNumber.from(number).toNumber(); + }; + Formatter2.prototype.bigNumber = function(value) { + return bignumber_1.BigNumber.from(value); + }; + Formatter2.prototype.boolean = function(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); + }; + Formatter2.prototype.hex = function(value, strict) { + if (typeof value === "string") { + if (!strict && value.substring(0, 2) !== "0x") { + value = "0x" + value; + } + if ((0, bytes_1.isHexString)(value)) { + return value.toLowerCase(); + } + } + return logger.throwArgumentError("invalid hash", "value", value); + }; + Formatter2.prototype.data = function(value, strict) { + var result = this.hex(value, strict); + if (result.length % 2 !== 0) { + throw new Error("invalid data; odd-length - " + value); + } + return result; + }; + Formatter2.prototype.address = function(value) { + return (0, address_1.getAddress)(value); + }; + Formatter2.prototype.callAddress = function(value) { + if (!(0, bytes_1.isHexString)(value, 32)) { + return null; + } + var address = (0, address_1.getAddress)((0, bytes_1.hexDataSlice)(value, 12)); + return address === constants_1.AddressZero ? null : address; + }; + Formatter2.prototype.contractAddress = function(value) { + return (0, address_1.getContractAddress)(value); + }; + Formatter2.prototype.blockTag = function(blockTag) { + if (blockTag == null) { + return "latest"; + } + if (blockTag === "earliest") { + return "0x0"; + } + if (blockTag === "latest" || blockTag === "pending") { + return blockTag; + } + if (typeof blockTag === "number" || (0, bytes_1.isHexString)(blockTag)) { + return (0, bytes_1.hexValue)(blockTag); + } + throw new Error("invalid blockTag"); + }; + Formatter2.prototype.hash = function(value, strict) { + var result = this.hex(value, strict); + if ((0, bytes_1.hexDataLength)(result) !== 32) { + return logger.throwArgumentError("invalid hash", "value", value); + } + return result; + }; + Formatter2.prototype.difficulty = function(value) { + if (value == null) { + return null; + } + var v = bignumber_1.BigNumber.from(value); + try { + return v.toNumber(); + } catch (error) { + } + return null; + }; + Formatter2.prototype.uint256 = function(value) { + if (!(0, bytes_1.isHexString)(value)) { + throw new Error("invalid uint256"); + } + return (0, bytes_1.hexZeroPad)(value, 32); + }; + Formatter2.prototype._block = function(value, format) { + if (value.author != null && value.miner == null) { + value.miner = value.author; + } + var difficulty = value._difficulty != null ? value._difficulty : value.difficulty; + var result = Formatter2.check(format, value); + result._difficulty = difficulty == null ? null : bignumber_1.BigNumber.from(difficulty); + return result; + }; + Formatter2.prototype.block = function(value) { + return this._block(value, this.formats.block); + }; + Formatter2.prototype.blockWithTransactions = function(value) { + return this._block(value, this.formats.blockWithTransactions); + }; + Formatter2.prototype.transactionRequest = function(value) { + return Formatter2.check(this.formats.transactionRequest, value); + }; + Formatter2.prototype.transactionResponse = function(transaction) { + if (transaction.gas != null && transaction.gasLimit == null) { + transaction.gasLimit = transaction.gas; + } + if (transaction.to && bignumber_1.BigNumber.from(transaction.to).isZero()) { + transaction.to = "0x0000000000000000000000000000000000000000"; + } + if (transaction.input != null && transaction.data == null) { + transaction.data = transaction.input; + } + 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 = Formatter2.check(this.formats.transaction, transaction); + if (transaction.chainId != null) { + var chainId = transaction.chainId; + if ((0, bytes_1.isHexString)(chainId)) { + chainId = bignumber_1.BigNumber.from(chainId).toNumber(); + } + result.chainId = chainId; + } else { + var chainId = transaction.networkId; + if (chainId == null && result.v == null) { + chainId = transaction.chainId; + } + if ((0, bytes_1.isHexString)(chainId)) { + chainId = bignumber_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; + } + if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") { + result.blockHash = null; + } + return result; + }; + Formatter2.prototype.transaction = function(value) { + return (0, transactions_1.parse)(value); + }; + Formatter2.prototype.receiptLog = function(value) { + return Formatter2.check(this.formats.receiptLog, value); + }; + Formatter2.prototype.receipt = function(value) { + var result = Formatter2.check(this.formats.receipt, value); + if (result.root != null) { + if (result.root.length <= 4) { + var value_1 = bignumber_1.BigNumber.from(result.root).toNumber(); + if (value_1 === 0 || value_1 === 1) { + if (result.status != null && result.status !== value_1) { + logger.throwArgumentError("alt-root-status/status mismatch", "value", { root: result.root, status: result.status }); + } + result.status = value_1; + delete result.root; + } else { + logger.throwArgumentError("invalid alt-root-status", "value.root", result.root); + } + } else if (result.root.length !== 66) { + logger.throwArgumentError("invalid root hash", "value.root", result.root); + } + } + if (result.status != null) { + result.byzantium = true; + } + return result; + }; + Formatter2.prototype.topics = function(value) { + var _this = this; + if (Array.isArray(value)) { + return value.map(function(v) { + return _this.topics(v); + }); + } else if (value != null) { + return this.hash(value, true); + } + return null; + }; + Formatter2.prototype.filter = function(value) { + return Formatter2.check(this.formats.filter, value); + }; + Formatter2.prototype.filterLog = function(value) { + return Formatter2.check(this.formats.filterLog, value); + }; + Formatter2.check = function(format, object) { + var result = {}; + for (var key in format) { + try { + var value = format[key](object[key]); + if (value !== void 0) { + result[key] = value; + } + } catch (error) { + error.checkKey = key; + error.checkValue = object[key]; + throw error; + } + } + return result; + }; + Formatter2.allowNull = function(format, nullValue) { + return function(value) { + if (value == null) { + return nullValue; + } + return format(value); + }; + }; + Formatter2.allowFalsish = function(format, replaceValue) { + return function(value) { + if (!value) { + return replaceValue; + } + return format(value); + }; + }; + Formatter2.arrayOf = function(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 Formatter2; + }() + ); + exports2.Formatter = Formatter; + function isCommunityResourcable(value) { + return value && typeof value.isCommunityResource === "function"; + } + exports2.isCommunityResourcable = isCommunityResourcable; + function isCommunityResource(value) { + return isCommunityResourcable(value) && value.isCommunityResource(); + } + exports2.isCommunityResource = isCommunityResource; + 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("=========================="); + } + exports2.showThrottleMessage = showThrottleMessage; + } +}); + +// node_modules/@ethersproject/providers/lib/base-provider.js +var require_base_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/base-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.BaseProvider = exports2.Resolver = exports2.Event = void 0; + var abstract_provider_1 = require_lib12(); + var basex_1 = require_lib17(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var constants_1 = require_lib8(); + var hash_1 = require_lib10(); + var networks_1 = require_lib25(); + var properties_1 = require_lib4(); + var sha2_1 = require_lib19(); + var strings_1 = require_lib9(); + var web_1 = require_lib27(); + var bech32_1 = __importDefault(require_bech32()); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var formatter_1 = require_formatter(); + function checkTopic(topic) { + if (topic == null) { + return "null"; + } + if ((0, bytes_1.hexDataLength)(topic) !== 32) { + logger.throwArgumentError("invalid topic", "topic", topic); + } + return topic.toLowerCase(); + } + function serializeTopics(topics) { + topics = topics.slice(); + while (topics.length > 0 && topics[topics.length - 1] == null) { + topics.pop(); + } + return topics.map(function(topic) { + if (Array.isArray(topic)) { + var unique_1 = {}; + topic.forEach(function(topic2) { + unique_1[checkTopic(topic2)] = true; + }); + var sorted = Object.keys(unique_1); + 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(topic2) { + return topic2 === "null" ? null : topic2; + }); + return comps.length === 1 ? comps[0] : comps; + }); + } + function getEventTag(eventName) { + if (typeof eventName === "string") { + eventName = eventName.toLowerCase(); + if ((0, bytes_1.hexDataLength)(eventName) === 32) { + return "tx:" + eventName; + } + if (eventName.indexOf(":") === -1) { + return eventName; + } + } else if (Array.isArray(eventName)) { + return "filter:*:" + serializeTopics(eventName); + } else if (abstract_provider_1.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); + } + function getTime() { + return (/* @__PURE__ */ new Date()).getTime(); + } + function stall(duration) { + return new Promise(function(resolve) { + setTimeout(resolve, duration); + }); + } + var PollableEvents = ["block", "network", "pending", "poll"]; + var Event = ( + /** @class */ + function() { + function Event2(tag, listener, once) { + (0, properties_1.defineReadOnly)(this, "tag", tag); + (0, properties_1.defineReadOnly)(this, "listener", listener); + (0, properties_1.defineReadOnly)(this, "once", once); + } + Object.defineProperty(Event2.prototype, "event", { + get: function() { + switch (this.type) { + case "tx": + return this.hash; + case "filter": + return this.filter; + } + return this.tag; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "type", { + get: function() { + return this.tag.split(":")[0]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "hash", { + get: function() { + var comps = this.tag.split(":"); + if (comps[0] !== "tx") { + return null; + } + return comps[1]; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(Event2.prototype, "filter", { + get: function() { + 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; + }, + enumerable: false, + configurable: true + }); + Event2.prototype.pollable = function() { + return this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0; + }; + return Event2; + }() + ); + exports2.Event = Event; + var coinInfos = { + "0": { symbol: "btc", p2pkh: 0, p2sh: 5, prefix: "bc" }, + "2": { symbol: "ltc", p2pkh: 48, p2sh: 50, prefix: "ltc" }, + "3": { symbol: "doge", p2pkh: 30, p2sh: 22 }, + "60": { symbol: "eth", ilk: "eth" }, + "61": { symbol: "etc", ilk: "eth" }, + "700": { symbol: "xdai", ilk: "eth" } + }; + function bytes32ify(value) { + return (0, bytes_1.hexZeroPad)(bignumber_1.BigNumber.from(value).toHexString(), 32); + } + function base58Encode(data) { + return basex_1.Base58.encode((0, bytes_1.concat)([data, (0, bytes_1.hexDataSlice)((0, sha2_1.sha256)((0, sha2_1.sha256)(data)), 0, 4)])); + } + var matchers = [ + new RegExp("^(https)://(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + new RegExp("^(ipfs)://(.*)$", "i"), + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i") + ]; + function _parseString(result) { + try { + return (0, strings_1.toUtf8String)(_parseBytes(result)); + } catch (error) { + } + return null; + } + function _parseBytes(result) { + if (result === "0x") { + return null; + } + var offset = bignumber_1.BigNumber.from((0, bytes_1.hexDataSlice)(result, 0, 32)).toNumber(); + var length = bignumber_1.BigNumber.from((0, bytes_1.hexDataSlice)(result, offset, offset + 32)).toNumber(); + return (0, bytes_1.hexDataSlice)(result, offset + 32, offset + 32 + length); + } + var Resolver = ( + /** @class */ + function() { + function Resolver2(provider, address, name2, resolvedAddress) { + (0, properties_1.defineReadOnly)(this, "provider", provider); + (0, properties_1.defineReadOnly)(this, "name", name2); + (0, properties_1.defineReadOnly)(this, "address", provider.formatter.address(address)); + (0, properties_1.defineReadOnly)(this, "_resolvedAddress", resolvedAddress); + } + Resolver2.prototype._fetchBytes = function(selector, parameters) { + return __awaiter(this, void 0, void 0, function() { + var tx, _a, error_1; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + tx = { + to: this.address, + data: (0, bytes_1.hexConcat)([selector, (0, hash_1.namehash)(this.name), parameters || "0x"]) + }; + _b.label = 1; + case 1: + _b.trys.push([1, 3, , 4]); + _a = _parseBytes; + return [4, this.provider.call(tx)]; + case 2: + return [2, _a.apply(void 0, [_b.sent()])]; + case 3: + error_1 = _b.sent(); + if (error_1.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + return [2, null]; + case 4: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + Resolver2.prototype._getAddress = function(coinType, hexBytes) { + var coinInfo = coinInfos[String(coinType)]; + if (coinInfo == null) { + logger.throwError("unsupported coin type: " + coinType, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(" + coinType + ")" + }); + } + if (coinInfo.ilk === "eth") { + return this.provider.formatter.address(hexBytes); + } + var bytes = (0, bytes_1.arrayify)(hexBytes); + if (coinInfo.p2pkh != null) { + var p2pkh = hexBytes.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/); + if (p2pkh) { + var length_1 = parseInt(p2pkh[1], 16); + if (p2pkh[2].length === length_1 * 2 && length_1 >= 1 && length_1 <= 75) { + return base58Encode((0, bytes_1.concat)([[coinInfo.p2pkh], "0x" + p2pkh[2]])); + } + } + } + if (coinInfo.p2sh != null) { + var p2sh = hexBytes.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/); + if (p2sh) { + var length_2 = parseInt(p2sh[1], 16); + if (p2sh[2].length === length_2 * 2 && length_2 >= 1 && length_2 <= 75) { + return base58Encode((0, bytes_1.concat)([[coinInfo.p2sh], "0x" + p2sh[2]])); + } + } + } + if (coinInfo.prefix != null) { + var length_3 = bytes[1]; + var version_1 = bytes[0]; + if (version_1 === 0) { + if (length_3 !== 20 && length_3 !== 32) { + version_1 = -1; + } + } else { + version_1 = -1; + } + if (version_1 >= 0 && bytes.length === 2 + length_3 && length_3 >= 1 && length_3 <= 75) { + var words = bech32_1.default.toWords(bytes.slice(2)); + words.unshift(version_1); + return bech32_1.default.encode(coinInfo.prefix, words); + } + } + return null; + }; + Resolver2.prototype.getAddress = function(coinType) { + return __awaiter(this, void 0, void 0, function() { + var transaction, hexBytes_1, error_2, hexBytes, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (coinType == null) { + coinType = 60; + } + if (!(coinType === 60)) return [3, 4]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + transaction = { + to: this.address, + data: "0x3b3b57de" + (0, hash_1.namehash)(this.name).substring(2) + }; + return [4, this.provider.call(transaction)]; + case 2: + hexBytes_1 = _a.sent(); + if (hexBytes_1 === "0x" || hexBytes_1 === constants_1.HashZero) { + return [2, null]; + } + return [2, this.provider.formatter.callAddress(hexBytes_1)]; + case 3: + error_2 = _a.sent(); + if (error_2.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + throw error_2; + case 4: + return [4, this._fetchBytes("0xf1cb7e06", bytes32ify(coinType))]; + case 5: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + address = this._getAddress(coinType, hexBytes); + if (address == null) { + logger.throwError("invalid or unsupported coin data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress(" + coinType + ")", + coinType, + data: hexBytes + }); + } + return [2, address]; + } + }); + }); + }; + Resolver2.prototype.getAvatar = function() { + return __awaiter(this, void 0, void 0, function() { + var linkage, avatar, i, match, _a, selector, owner, _b, comps, addr, tokenId, tokenOwner, _c, _d, balance, _e, _f, tx, metadataUrl, _g, metadata, error_3; + return __generator(this, function(_h) { + switch (_h.label) { + case 0: + linkage = []; + _h.label = 1; + case 1: + _h.trys.push([1, 19, , 20]); + return [4, this.getText("avatar")]; + case 2: + avatar = _h.sent(); + if (avatar == null) { + return [2, null]; + } + i = 0; + _h.label = 3; + case 3: + if (!(i < matchers.length)) return [3, 18]; + match = avatar.match(matchers[i]); + if (match == null) { + return [3, 17]; + } + _a = match[1]; + switch (_a) { + case "https": + return [3, 4]; + case "data": + return [3, 5]; + case "ipfs": + return [3, 6]; + case "erc721": + return [3, 7]; + case "erc1155": + return [3, 7]; + } + return [3, 17]; + case 4: + linkage.push({ type: "url", content: avatar }); + return [2, { linkage, url: avatar }]; + case 5: + linkage.push({ type: "data", content: avatar }); + return [2, { linkage, url: avatar }]; + case 6: + linkage.push({ type: "ipfs", content: avatar }); + return [2, { linkage, url: "https://gateway.ipfs.io/ipfs/" + avatar.substring(7) }]; + case 7: + selector = match[1] === "erc721" ? "0xc87b56dd" : "0x0e89341c"; + linkage.push({ type: match[1], content: avatar }); + _b = this._resolvedAddress; + if (_b) return [3, 9]; + return [4, this.getAddress()]; + case 8: + _b = _h.sent(); + _h.label = 9; + case 9: + owner = _b; + comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + return [2, null]; + } + return [4, this.provider.formatter.address(comps[0])]; + case 10: + addr = _h.sent(); + tokenId = (0, bytes_1.hexZeroPad)(bignumber_1.BigNumber.from(comps[1]).toHexString(), 32); + if (!(match[1] === "erc721")) return [3, 12]; + _d = (_c = this.provider.formatter).callAddress; + return [4, this.provider.call({ + to: addr, + data: (0, bytes_1.hexConcat)(["0x6352211e", tokenId]) + })]; + case 11: + tokenOwner = _d.apply(_c, [_h.sent()]); + if (owner !== tokenOwner) { + return [2, null]; + } + linkage.push({ type: "owner", content: tokenOwner }); + return [3, 14]; + case 12: + if (!(match[1] === "erc1155")) return [3, 14]; + _f = (_e = bignumber_1.BigNumber).from; + return [4, this.provider.call({ + to: addr, + data: (0, bytes_1.hexConcat)(["0x00fdd58e", (0, bytes_1.hexZeroPad)(owner, 32), tokenId]) + })]; + case 13: + balance = _f.apply(_e, [_h.sent()]); + if (balance.isZero()) { + return [2, null]; + } + linkage.push({ type: "balance", content: balance.toString() }); + _h.label = 14; + case 14: + tx = { + to: this.provider.formatter.address(comps[0]), + data: (0, bytes_1.hexConcat)([selector, tokenId]) + }; + _g = _parseString; + return [4, this.provider.call(tx)]; + case 15: + metadataUrl = _g.apply(void 0, [_h.sent()]); + if (metadataUrl == null) { + return [2, null]; + } + linkage.push({ type: "metadata-url", content: metadataUrl }); + if (match[1] === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", tokenId.substring(2)); + } + return [4, (0, web_1.fetchJson)(metadataUrl)]; + case 16: + metadata = _h.sent(); + if (!metadata || typeof metadata.image !== "string" || !metadata.image.match(/^(https:\/\/|data:)/i)) { + return [2, null]; + } + linkage.push({ type: "metadata", content: JSON.stringify(metadata) }); + linkage.push({ type: "url", content: metadata.image }); + return [2, { linkage, url: metadata.image }]; + case 17: + i++; + return [3, 3]; + case 18: + return [3, 20]; + case 19: + error_3 = _h.sent(); + return [3, 20]; + case 20: + return [2, null]; + } + }); + }); + }; + Resolver2.prototype.getContentHash = function() { + return __awaiter(this, void 0, void 0, function() { + var hexBytes, ipfs, length_4, swarm; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._fetchBytes("0xbc1c58d1")]; + case 1: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + ipfs = hexBytes.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + length_4 = parseInt(ipfs[3], 16); + if (ipfs[4].length === length_4 * 2) { + return [2, "ipfs://" + basex_1.Base58.encode("0x" + ipfs[1])]; + } + } + swarm = hexBytes.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm) { + if (swarm[1].length === 32 * 2) { + return [2, "bzz://" + swarm[1]]; + } + } + return [2, logger.throwError("invalid or unsupported content hash data", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getContentHash()", + data: hexBytes + })]; + } + }); + }); + }; + Resolver2.prototype.getText = function(key) { + return __awaiter(this, void 0, void 0, function() { + var keyBytes, hexBytes; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + keyBytes = (0, strings_1.toUtf8Bytes)(key); + keyBytes = (0, bytes_1.concat)([bytes32ify(64), bytes32ify(keyBytes.length), keyBytes]); + if (keyBytes.length % 32 !== 0) { + keyBytes = (0, bytes_1.concat)([keyBytes, (0, bytes_1.hexZeroPad)("0x", 32 - key.length % 32)]); + } + return [4, this._fetchBytes("0x59d1d43c", (0, bytes_1.hexlify)(keyBytes))]; + case 1: + hexBytes = _a.sent(); + if (hexBytes == null || hexBytes === "0x") { + return [2, null]; + } + return [2, (0, strings_1.toUtf8String)(hexBytes)]; + } + }); + }); + }; + return Resolver2; + }() + ); + exports2.Resolver = Resolver; + var defaultFormatter = null; + var nextPollId = 1; + var BaseProvider = ( + /** @class */ + function(_super) { + __extends(BaseProvider2, _super); + function BaseProvider2(network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, abstract_provider_1.Provider); + _this = _super.call(this) || this; + _this._events = []; + _this._emitted = { block: -2 }; + _this.formatter = _newTarget.getFormatter(); + (0, properties_1.defineReadOnly)(_this, "anyNetwork", network === "any"); + if (_this.anyNetwork) { + network = _this.detectNetwork(); + } + if (network instanceof Promise) { + _this._networkPromise = network; + network.catch(function(error) { + }); + _this._ready().catch(function(error) { + }); + } else { + var knownNetwork = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + if (knownNetwork) { + (0, properties_1.defineReadOnly)(_this, "_network", knownNetwork); + _this.emit("network", knownNetwork, null); + } else { + logger.throwArgumentError("invalid network", "network", network); + } + } + _this._maxInternalBlockNumber = -1024; + _this._lastBlockNumber = -2; + _this._pollingInterval = 4e3; + _this._fastQueryDate = 0; + return _this; + } + BaseProvider2.prototype._ready = function() { + return __awaiter(this, void 0, void 0, function() { + var network, error_4; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(this._network == null)) return [3, 7]; + network = null; + if (!this._networkPromise) return [3, 4]; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, this._networkPromise]; + case 2: + network = _a.sent(); + return [3, 4]; + case 3: + error_4 = _a.sent(); + return [3, 4]; + case 4: + if (!(network == null)) return [3, 6]; + return [4, this.detectNetwork()]; + case 5: + network = _a.sent(); + _a.label = 6; + case 6: + if (!network) { + logger.throwError("no network detected", logger_1.Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + if (this.anyNetwork) { + this._network = network; + } else { + (0, properties_1.defineReadOnly)(this, "_network", network); + } + this.emit("network", network, null); + } + _a.label = 7; + case 7: + return [2, this._network]; + } + }); + }); + }; + Object.defineProperty(BaseProvider2.prototype, "ready", { + // 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 + get: function() { + var _this = this; + return (0, web_1.poll)(function() { + return _this._ready().then(function(network) { + return network; + }, function(error) { + if (error.code === logger_1.Logger.errors.NETWORK_ERROR && error.event === "noNetwork") { + return void 0; + } + throw error; + }); + }); + }, + enumerable: false, + configurable: true + }); + BaseProvider2.getFormatter = function() { + if (defaultFormatter == null) { + defaultFormatter = new formatter_1.Formatter(); + } + return defaultFormatter; + }; + BaseProvider2.getNetwork = function(network) { + return (0, networks_1.getNetwork)(network == null ? "homestead" : network); + }; + BaseProvider2.prototype._getInternalBlockNumber = function(maxAge) { + return __awaiter(this, void 0, void 0, function() { + var internalBlockNumber, result, error_5, reqTime, checkInternalBlockNumber; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._ready()]; + case 1: + _a.sent(); + if (!(maxAge > 0)) return [3, 7]; + _a.label = 2; + case 2: + if (!this._internalBlockNumber) return [3, 7]; + internalBlockNumber = this._internalBlockNumber; + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, internalBlockNumber]; + case 4: + result = _a.sent(); + if (getTime() - result.respTime <= maxAge) { + return [2, result.blockNumber]; + } + return [3, 7]; + case 5: + error_5 = _a.sent(); + if (this._internalBlockNumber === internalBlockNumber) { + return [3, 7]; + } + return [3, 6]; + case 6: + return [3, 2]; + case 7: + reqTime = getTime(); + checkInternalBlockNumber = (0, properties_1.resolveProperties)({ + blockNumber: this.perform("getBlockNumber", {}), + networkError: this.getNetwork().then(function(network) { + return null; + }, function(error) { + return error; + }) + }).then(function(_a2) { + var blockNumber = _a2.blockNumber, networkError = _a2.networkError; + if (networkError) { + if (_this._internalBlockNumber === checkInternalBlockNumber) { + _this._internalBlockNumber = null; + } + throw networkError; + } + var respTime = getTime(); + blockNumber = bignumber_1.BigNumber.from(blockNumber).toNumber(); + if (blockNumber < _this._maxInternalBlockNumber) { + blockNumber = _this._maxInternalBlockNumber; + } + _this._maxInternalBlockNumber = blockNumber; + _this._setFastBlockNumber(blockNumber); + return { blockNumber, reqTime, respTime }; + }); + this._internalBlockNumber = checkInternalBlockNumber; + checkInternalBlockNumber.catch(function(error) { + if (_this._internalBlockNumber === checkInternalBlockNumber) { + _this._internalBlockNumber = null; + } + }); + return [4, checkInternalBlockNumber]; + case 8: + return [2, _a.sent().blockNumber]; + } + }); + }); + }; + BaseProvider2.prototype.poll = function() { + return __awaiter(this, void 0, void 0, function() { + var pollId, runners, blockNumber, error_6, i; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + pollId = nextPollId++; + runners = []; + blockNumber = null; + _a.label = 1; + case 1: + _a.trys.push([1, 3, , 4]); + return [4, this._getInternalBlockNumber(100 + this.pollingInterval / 2)]; + case 2: + blockNumber = _a.sent(); + return [3, 4]; + case 3: + error_6 = _a.sent(); + this.emit("error", error_6); + return [ + 2 + /*return*/ + ]; + case 4: + this._setFastBlockNumber(blockNumber); + this.emit("poll", pollId, blockNumber); + if (blockNumber === this._lastBlockNumber) { + this.emit("didPoll", pollId); + return [ + 2 + /*return*/ + ]; + } + if (this._emitted.block === -2) { + this._emitted.block = blockNumber - 1; + } + if (Math.abs(this._emitted.block - blockNumber) > 1e3) { + logger.warn("network block skew detected; skipping block events (emitted=" + this._emitted.block + " blockNumber" + blockNumber + ")"); + this.emit("error", logger.makeError("network block skew detected", logger_1.Logger.errors.NETWORK_ERROR, { + blockNumber, + event: "blockSkew", + previousBlockNumber: this._emitted.block + })); + this.emit("block", blockNumber); + } else { + for (i = this._emitted.block + 1; i <= blockNumber; i++) { + this.emit("block", i); + } + } + if (this._emitted.block !== blockNumber) { + this._emitted.block = blockNumber; + Object.keys(this._emitted).forEach(function(key) { + if (key === "block") { + return; + } + var eventBlockNumber = _this._emitted[key]; + if (eventBlockNumber === "pending") { + return; + } + if (blockNumber - eventBlockNumber > 12) { + delete _this._emitted[key]; + } + }); + } + if (this._lastBlockNumber === -2) { + this._lastBlockNumber = blockNumber - 1; + } + this._events.forEach(function(event) { + switch (event.type) { + case "tx": { + var hash_2 = event.hash; + var runner = _this.getTransactionReceipt(hash_2).then(function(receipt) { + if (!receipt || receipt.blockNumber == null) { + return null; + } + _this._emitted["t:" + hash_2] = receipt.blockNumber; + _this.emit(hash_2, receipt); + return null; + }).catch(function(error) { + _this.emit("error", error); + }); + runners.push(runner); + break; + } + case "filter": { + var filter_1 = event.filter; + filter_1.fromBlock = _this._lastBlockNumber + 1; + filter_1.toBlock = blockNumber; + var runner = _this.getLogs(filter_1).then(function(logs) { + if (logs.length === 0) { + return; + } + logs.forEach(function(log) { + _this._emitted["b:" + log.blockHash] = log.blockNumber; + _this._emitted["t:" + log.transactionHash] = log.blockNumber; + _this.emit(filter_1, log); + }); + }).catch(function(error) { + _this.emit("error", error); + }); + runners.push(runner); + break; + } + } + }); + this._lastBlockNumber = blockNumber; + Promise.all(runners).then(function() { + _this.emit("didPoll", pollId); + }).catch(function(error) { + _this.emit("error", error); + }); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.resetEventsBlock = function(blockNumber) { + this._lastBlockNumber = blockNumber - 1; + if (this.polling) { + this.poll(); + } + }; + Object.defineProperty(BaseProvider2.prototype, "network", { + get: function() { + return this._network; + }, + enumerable: false, + configurable: true + }); + BaseProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, logger.throwError("provider does not support network detection", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "provider.detectNetwork" + })]; + }); + }); + }; + BaseProvider2.prototype.getNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var network, currentNetwork, error; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this._ready()]; + case 1: + network = _a.sent(); + return [4, this.detectNetwork()]; + case 2: + currentNetwork = _a.sent(); + if (!(network.chainId !== currentNetwork.chainId)) return [3, 5]; + if (!this.anyNetwork) return [3, 4]; + this._network = currentNetwork; + this._lastBlockNumber = -2; + this._fastBlockNumber = null; + this._fastBlockNumberPromise = null; + this._fastQueryDate = 0; + this._emitted.block = -2; + this._maxInternalBlockNumber = -1024; + this._internalBlockNumber = null; + this.emit("network", currentNetwork, network); + return [4, stall(0)]; + case 3: + _a.sent(); + return [2, this._network]; + case 4: + error = logger.makeError("underlying network changed", logger_1.Logger.errors.NETWORK_ERROR, { + event: "changed", + network, + detectedNetwork: currentNetwork + }); + this.emit("error", error); + throw error; + case 5: + return [2, network]; + } + }); + }); + }; + Object.defineProperty(BaseProvider2.prototype, "blockNumber", { + get: function() { + var _this = this; + this._getInternalBlockNumber(100 + this.pollingInterval / 2).then(function(blockNumber) { + _this._setFastBlockNumber(blockNumber); + }, function(error) { + }); + return this._fastBlockNumber != null ? this._fastBlockNumber : -1; + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseProvider2.prototype, "polling", { + get: function() { + return this._poller != null; + }, + set: function(value) { + var _this = this; + if (value && !this._poller) { + this._poller = setInterval(function() { + _this.poll(); + }, this.pollingInterval); + if (!this._bootstrapPoll) { + this._bootstrapPoll = setTimeout(function() { + _this.poll(); + _this._bootstrapPoll = setTimeout(function() { + if (!_this._poller) { + _this.poll(); + } + _this._bootstrapPoll = null; + }, _this.pollingInterval); + }, 0); + } + } else if (!value && this._poller) { + clearInterval(this._poller); + this._poller = null; + } + }, + enumerable: false, + configurable: true + }); + Object.defineProperty(BaseProvider2.prototype, "pollingInterval", { + get: function() { + return this._pollingInterval; + }, + set: function(value) { + var _this = 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() { + _this.poll(); + }, this._pollingInterval); + } + }, + enumerable: false, + configurable: true + }); + BaseProvider2.prototype._getFastBlockNumber = function() { + var _this = this; + var now = getTime(); + if (now - this._fastQueryDate > 2 * this._pollingInterval) { + this._fastQueryDate = now; + this._fastBlockNumberPromise = this.getBlockNumber().then(function(blockNumber) { + if (_this._fastBlockNumber == null || blockNumber > _this._fastBlockNumber) { + _this._fastBlockNumber = blockNumber; + } + return _this._fastBlockNumber; + }); + } + return this._fastBlockNumberPromise; + }; + BaseProvider2.prototype._setFastBlockNumber = function(blockNumber) { + if (this._fastBlockNumber != null && blockNumber < this._fastBlockNumber) { + return; + } + this._fastQueryDate = getTime(); + if (this._fastBlockNumber == null || blockNumber > this._fastBlockNumber) { + this._fastBlockNumber = blockNumber; + this._fastBlockNumberPromise = Promise.resolve(blockNumber); + } + }; + BaseProvider2.prototype.waitForTransaction = function(transactionHash, confirmations, timeout) { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this._waitForTransaction(transactionHash, confirmations == null ? 1 : confirmations, timeout || 0, null)]; + }); + }); + }; + BaseProvider2.prototype._waitForTransaction = function(transactionHash, confirmations, timeout, replaceable) { + return __awaiter(this, void 0, void 0, function() { + var receipt; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getTransactionReceipt(transactionHash)]; + case 1: + receipt = _a.sent(); + if ((receipt ? receipt.confirmations : 0) >= confirmations) { + return [2, receipt]; + } + return [2, new Promise(function(resolve, reject) { + var cancelFuncs = []; + var done = false; + var alreadyDone = function() { + if (done) { + return true; + } + done = true; + cancelFuncs.forEach(function(func) { + func(); + }); + return false; + }; + var minedHandler = function(receipt2) { + if (receipt2.confirmations < confirmations) { + return; + } + if (alreadyDone()) { + return; + } + resolve(receipt2); + }; + _this.on(transactionHash, minedHandler); + cancelFuncs.push(function() { + _this.removeListener(transactionHash, minedHandler); + }); + if (replaceable) { + var lastBlockNumber_1 = replaceable.startBlock; + var scannedBlock_1 = null; + var replaceHandler_1 = function(blockNumber) { + return __awaiter(_this, void 0, void 0, function() { + var _this2 = this; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, stall(1e3)]; + case 1: + _a2.sent(); + this.getTransactionCount(replaceable.from).then(function(nonce) { + return __awaiter(_this2, void 0, void 0, function() { + var mined, block, ti, tx, receipt_1, reason; + return __generator(this, function(_a3) { + switch (_a3.label) { + case 0: + if (done) { + return [ + 2 + /*return*/ + ]; + } + if (!(nonce <= replaceable.nonce)) return [3, 1]; + lastBlockNumber_1 = blockNumber; + return [3, 9]; + case 1: + return [4, this.getTransaction(transactionHash)]; + case 2: + mined = _a3.sent(); + if (mined && mined.blockNumber != null) { + return [ + 2 + /*return*/ + ]; + } + if (scannedBlock_1 == null) { + scannedBlock_1 = lastBlockNumber_1 - 3; + if (scannedBlock_1 < replaceable.startBlock) { + scannedBlock_1 = replaceable.startBlock; + } + } + _a3.label = 3; + case 3: + if (!(scannedBlock_1 <= blockNumber)) return [3, 9]; + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, this.getBlockWithTransactions(scannedBlock_1)]; + case 4: + block = _a3.sent(); + ti = 0; + _a3.label = 5; + case 5: + if (!(ti < block.transactions.length)) return [3, 8]; + tx = block.transactions[ti]; + if (tx.hash === transactionHash) { + return [ + 2 + /*return*/ + ]; + } + if (!(tx.from === replaceable.from && tx.nonce === replaceable.nonce)) return [3, 7]; + if (done) { + return [ + 2 + /*return*/ + ]; + } + return [4, this.waitForTransaction(tx.hash, confirmations)]; + case 6: + receipt_1 = _a3.sent(); + if (alreadyDone()) { + return [ + 2 + /*return*/ + ]; + } + 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"; + } + reject(logger.makeError("transaction was replaced", logger_1.Logger.errors.TRANSACTION_REPLACED, { + cancelled: reason === "replaced" || reason === "cancelled", + reason, + replacement: this._wrapTransaction(tx), + hash: transactionHash, + receipt: receipt_1 + })); + return [ + 2 + /*return*/ + ]; + case 7: + ti++; + return [3, 5]; + case 8: + scannedBlock_1++; + return [3, 3]; + case 9: + if (done) { + return [ + 2 + /*return*/ + ]; + } + this.once("block", replaceHandler_1); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }, function(error) { + if (done) { + return; + } + _this2.once("block", replaceHandler_1); + }); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + if (done) { + return; + } + _this.once("block", replaceHandler_1); + cancelFuncs.push(function() { + _this.removeListener("block", replaceHandler_1); + }); + } + if (typeof timeout === "number" && timeout > 0) { + var timer_1 = setTimeout(function() { + if (alreadyDone()) { + return; + } + reject(logger.makeError("timeout exceeded", logger_1.Logger.errors.TIMEOUT, { timeout })); + }, timeout); + if (timer_1.unref) { + timer_1.unref(); + } + cancelFuncs.push(function() { + clearTimeout(timer_1); + }); + } + })]; + } + }); + }); + }; + BaseProvider2.prototype.getBlockNumber = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this._getInternalBlockNumber(0)]; + }); + }); + }; + BaseProvider2.prototype.getGasPrice = function() { + return __awaiter(this, void 0, void 0, function() { + var result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, this.perform("getGasPrice", {})]; + case 2: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getGasPrice", + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getBalance = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getBalance", params)]; + case 3: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getBalance", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getTransactionCount = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getTransactionCount", params)]; + case 3: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result).toNumber()]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getTransactionCount", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getCode = function(addressOrName, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getCode", params)]; + case 3: + result = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getCode", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.getStorageAt = function(addressOrName, position, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + address: this._getAddress(addressOrName), + blockTag: this._getBlockTag(blockTag), + position: Promise.resolve(position).then(function(p) { + return (0, bytes_1.hexValue)(p); + }) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("getStorageAt", params)]; + case 3: + result = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "getStorageAt", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._wrapTransaction = function(tx, hash, startBlock) { + var _this = this; + if (hash != null && (0, bytes_1.hexDataLength)(hash) !== 32) { + throw new Error("invalid response - sendTransaction"); + } + var result = tx; + if (hash != null && tx.hash !== hash) { + logger.throwError("Transaction hash mismatch from Provider.sendTransaction.", logger_1.Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash }); + } + result.wait = function(confirms, timeout) { + return __awaiter(_this, void 0, void 0, function() { + var replacement, receipt; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (confirms == null) { + confirms = 1; + } + if (timeout == null) { + timeout = 0; + } + replacement = void 0; + if (confirms !== 0 && startBlock != null) { + replacement = { + data: tx.data, + from: tx.from, + nonce: tx.nonce, + to: tx.to, + value: tx.value, + startBlock + }; + } + return [4, this._waitForTransaction(tx.hash, confirms, timeout, replacement)]; + case 1: + receipt = _a.sent(); + if (receipt == null && confirms === 0) { + return [2, null]; + } + this._emitted["t:" + tx.hash] = receipt.blockNumber; + if (receipt.status === 0) { + logger.throwError("transaction failed", logger_1.Logger.errors.CALL_EXCEPTION, { + transactionHash: tx.hash, + transaction: tx, + receipt + }); + } + return [2, receipt]; + } + }); + }); + }; + return result; + }; + BaseProvider2.prototype.sendTransaction = function(signedTransaction) { + return __awaiter(this, void 0, void 0, function() { + var hexTx, tx, blockNumber, hash, error_7; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, Promise.resolve(signedTransaction).then(function(t) { + return (0, bytes_1.hexlify)(t); + })]; + case 2: + hexTx = _a.sent(); + tx = this.formatter.transaction(signedTransaction); + if (tx.confirmations == null) { + tx.confirmations = 0; + } + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a.sent(); + _a.label = 4; + case 4: + _a.trys.push([4, 6, , 7]); + return [4, this.perform("sendTransaction", { signedTransaction: hexTx })]; + case 5: + hash = _a.sent(); + return [2, this._wrapTransaction(tx, hash, blockNumber)]; + case 6: + error_7 = _a.sent(); + error_7.transaction = tx; + error_7.transactionHash = tx.hash; + throw error_7; + case 7: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getTransactionRequest = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var values, tx, _a, _b; + var _this = this; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, transaction]; + case 1: + values = _c.sent(); + tx = {}; + ["from", "to"].forEach(function(key) { + if (values[key] == null) { + return; + } + tx[key] = Promise.resolve(values[key]).then(function(v) { + return v ? _this._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 ? bignumber_1.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 ? (0, bytes_1.hexlify)(v) : null; + }); + }); + _b = (_a = this.formatter).transactionRequest; + return [4, (0, properties_1.resolveProperties)(tx)]; + case 2: + return [2, _b.apply(_a, [_c.sent()])]; + } + }); + }); + }; + BaseProvider2.prototype._getFilter = function(filter) { + return __awaiter(this, void 0, void 0, function() { + var result, _a, _b; + var _this = this; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, filter]; + case 1: + filter = _c.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] = _this._getBlockTag(filter[key]); + }); + _b = (_a = this.formatter).filter; + return [4, (0, properties_1.resolveProperties)(result)]; + case 2: + return [2, _b.apply(_a, [_c.sent()])]; + } + }); + }); + }; + BaseProvider2.prototype.call = function(transaction, blockTag) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + transaction: this._getTransactionRequest(transaction), + blockTag: this._getBlockTag(blockTag) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("call", params)]; + case 3: + result = _a.sent(); + try { + return [2, (0, bytes_1.hexlify)(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "call", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.estimateGas = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ + transaction: this._getTransactionRequest(transaction) + })]; + case 2: + params = _a.sent(); + return [4, this.perform("estimateGas", params)]; + case 3: + result = _a.sent(); + try { + return [2, bignumber_1.BigNumber.from(result)]; + } catch (error) { + return [2, logger.throwError("bad result from backend", logger_1.Logger.errors.SERVER_ERROR, { + method: "estimateGas", + params, + result, + error + })]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getAddress = function(addressOrName) { + return __awaiter(this, void 0, void 0, function() { + var address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, addressOrName]; + case 1: + addressOrName = _a.sent(); + if (typeof addressOrName !== "string") { + logger.throwArgumentError("invalid address or ENS name", "name", addressOrName); + } + return [4, this.resolveName(addressOrName)]; + case 2: + address = _a.sent(); + if (address == null) { + logger.throwError("ENS name not configured", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resolveName(" + JSON.stringify(addressOrName) + ")" + }); + } + return [2, address]; + } + }); + }); + }; + BaseProvider2.prototype._getBlock = function(blockHashOrBlockTag, includeTransactions) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber, params, _a, error_8; + var _this = this; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _b.sent(); + return [4, blockHashOrBlockTag]; + case 2: + blockHashOrBlockTag = _b.sent(); + blockNumber = -128; + params = { + includeTransactions: !!includeTransactions + }; + if (!(0, bytes_1.isHexString)(blockHashOrBlockTag, 32)) return [3, 3]; + params.blockHash = blockHashOrBlockTag; + return [3, 6]; + case 3: + _b.trys.push([3, 5, , 6]); + _a = params; + return [4, this._getBlockTag(blockHashOrBlockTag)]; + case 4: + _a.blockTag = _b.sent(); + if ((0, bytes_1.isHexString)(params.blockTag)) { + blockNumber = parseInt(params.blockTag.substring(2), 16); + } + return [3, 6]; + case 5: + error_8 = _b.sent(); + logger.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag); + return [3, 6]; + case 6: + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var block, blockNumber_1, i, tx, confirmations, blockWithTxs; + var _this2 = this; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getBlock", params)]; + case 1: + block = _a2.sent(); + if (block == null) { + if (params.blockHash != null) { + if (this._emitted["b:" + params.blockHash] == null) { + return [2, null]; + } + } + if (params.blockTag != null) { + if (blockNumber > this._emitted.block) { + return [2, null]; + } + } + return [2, void 0]; + } + if (!includeTransactions) return [3, 8]; + blockNumber_1 = null; + i = 0; + _a2.label = 2; + case 2: + if (!(i < block.transactions.length)) return [3, 7]; + tx = block.transactions[i]; + if (!(tx.blockNumber == null)) return [3, 3]; + tx.confirmations = 0; + return [3, 6]; + case 3: + if (!(tx.confirmations == null)) return [3, 6]; + if (!(blockNumber_1 == null)) return [3, 5]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 4: + blockNumber_1 = _a2.sent(); + _a2.label = 5; + case 5: + confirmations = blockNumber_1 - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + _a2.label = 6; + case 6: + i++; + return [3, 2]; + case 7: + blockWithTxs = this.formatter.blockWithTransactions(block); + blockWithTxs.transactions = blockWithTxs.transactions.map(function(tx2) { + return _this2._wrapTransaction(tx2); + }); + return [2, blockWithTxs]; + case 8: + return [2, this.formatter.block(block)]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getBlock = function(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, false); + }; + BaseProvider2.prototype.getBlockWithTransactions = function(blockHashOrBlockTag) { + return this._getBlock(blockHashOrBlockTag, true); + }; + BaseProvider2.prototype.getTransaction = function(transactionHash) { + return __awaiter(this, void 0, void 0, function() { + var params; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, transactionHash]; + case 2: + transactionHash = _a.sent(); + params = { transactionHash: this.formatter.hash(transactionHash, true) }; + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var result, tx, blockNumber, confirmations; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getTransaction", params)]; + case 1: + result = _a2.sent(); + if (result == null) { + if (this._emitted["t:" + transactionHash] == null) { + return [2, null]; + } + return [2, void 0]; + } + tx = this.formatter.transactionResponse(result); + if (!(tx.blockNumber == null)) return [3, 2]; + tx.confirmations = 0; + return [3, 4]; + case 2: + if (!(tx.confirmations == null)) return [3, 4]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a2.sent(); + confirmations = blockNumber - tx.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + tx.confirmations = confirmations; + _a2.label = 4; + case 4: + return [2, this._wrapTransaction(tx)]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getTransactionReceipt = function(transactionHash) { + return __awaiter(this, void 0, void 0, function() { + var params; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, transactionHash]; + case 2: + transactionHash = _a.sent(); + params = { transactionHash: this.formatter.hash(transactionHash, true) }; + return [2, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var result, receipt, blockNumber, confirmations; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.perform("getTransactionReceipt", params)]; + case 1: + result = _a2.sent(); + if (result == null) { + if (this._emitted["t:" + transactionHash] == null) { + return [2, null]; + } + return [2, void 0]; + } + if (result.blockHash == null) { + return [2, void 0]; + } + receipt = this.formatter.receipt(result); + if (!(receipt.blockNumber == null)) return [3, 2]; + receipt.confirmations = 0; + return [3, 4]; + case 2: + if (!(receipt.confirmations == null)) return [3, 4]; + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 3: + blockNumber = _a2.sent(); + confirmations = blockNumber - receipt.blockNumber + 1; + if (confirmations <= 0) { + confirmations = 1; + } + receipt.confirmations = confirmations; + _a2.label = 4; + case 4: + return [2, receipt]; + } + }); + }); + }, { oncePoll: this })]; + } + }); + }); + }; + BaseProvider2.prototype.getLogs = function(filter) { + return __awaiter(this, void 0, void 0, function() { + var params, logs; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [4, (0, properties_1.resolveProperties)({ filter: this._getFilter(filter) })]; + case 2: + params = _a.sent(); + return [4, this.perform("getLogs", params)]; + case 3: + logs = _a.sent(); + logs.forEach(function(log) { + if (log.removed == null) { + log.removed = false; + } + }); + return [2, formatter_1.Formatter.arrayOf(this.formatter.filterLog.bind(this.formatter))(logs)]; + } + }); + }); + }; + BaseProvider2.prototype.getEtherPrice = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + _a.sent(); + return [2, this.perform("getEtherPrice", {})]; + } + }); + }); + }; + BaseProvider2.prototype._getBlockTag = function(blockTag) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, blockTag]; + case 1: + blockTag = _a.sent(); + if (!(typeof blockTag === "number" && blockTag < 0)) return [3, 3]; + if (blockTag % 1) { + logger.throwArgumentError("invalid BlockTag", "blockTag", blockTag); + } + return [4, this._getInternalBlockNumber(100 + 2 * this.pollingInterval)]; + case 2: + blockNumber = _a.sent(); + blockNumber += blockTag; + if (blockNumber < 0) { + blockNumber = 0; + } + return [2, this.formatter.blockTag(blockNumber)]; + case 3: + return [2, this.formatter.blockTag(blockTag)]; + } + }); + }); + }; + BaseProvider2.prototype.getResolver = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var address, error_9; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + return [4, this._getResolver(name2)]; + case 1: + address = _a.sent(); + if (address == null) { + return [2, null]; + } + return [2, new Resolver(this, address, name2)]; + case 2: + error_9 = _a.sent(); + if (error_9.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + return [2, null]; + case 3: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype._getResolver = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var network, transaction, _a, _b, error_10; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + return [4, this.getNetwork()]; + case 1: + network = _c.sent(); + if (!network.ensAddress) { + logger.throwError("network does not support ENS", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name }); + } + transaction = { + to: network.ensAddress, + data: "0x0178b8bf" + (0, hash_1.namehash)(name2).substring(2) + }; + _c.label = 2; + case 2: + _c.trys.push([2, 4, , 5]); + _b = (_a = this.formatter).callAddress; + return [4, this.call(transaction)]; + case 3: + return [2, _b.apply(_a, [_c.sent()])]; + case 4: + error_10 = _c.sent(); + if (error_10.code === logger_1.Logger.errors.CALL_EXCEPTION) { + return [2, null]; + } + throw error_10; + case 5: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + BaseProvider2.prototype.resolveName = function(name2) { + return __awaiter(this, void 0, void 0, function() { + var resolver; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, name2]; + case 1: + name2 = _a.sent(); + try { + return [2, Promise.resolve(this.formatter.address(name2))]; + } catch (error) { + if ((0, bytes_1.isHexString)(name2)) { + throw error; + } + } + if (typeof name2 !== "string") { + logger.throwArgumentError("invalid ENS name", "name", name2); + } + return [4, this.getResolver(name2)]; + case 2: + resolver = _a.sent(); + if (!resolver) { + return [2, null]; + } + return [4, resolver.getAddress()]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + BaseProvider2.prototype.lookupAddress = function(address) { + return __awaiter(this, void 0, void 0, function() { + var reverseName, resolverAddress, bytes, _a, length, name2, addr; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + return [4, address]; + case 1: + address = _b.sent(); + address = this.formatter.address(address); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + return [4, this._getResolver(reverseName)]; + case 2: + resolverAddress = _b.sent(); + if (!resolverAddress) { + return [2, null]; + } + _a = bytes_1.arrayify; + return [4, this.call({ + to: resolverAddress, + data: "0x691f3431" + (0, hash_1.namehash)(reverseName).substring(2) + })]; + case 3: + bytes = _a.apply(void 0, [_b.sent()]); + if (bytes.length < 32 || !bignumber_1.BigNumber.from(bytes.slice(0, 32)).eq(32)) { + return [2, null]; + } + bytes = bytes.slice(32); + if (bytes.length < 32) { + return [2, null]; + } + length = bignumber_1.BigNumber.from(bytes.slice(0, 32)).toNumber(); + bytes = bytes.slice(32); + if (length > bytes.length) { + return [2, null]; + } + name2 = (0, strings_1.toUtf8String)(bytes.slice(0, length)); + return [4, this.resolveName(name2)]; + case 4: + addr = _b.sent(); + if (addr != address) { + return [2, null]; + } + return [2, name2]; + } + }); + }); + }; + BaseProvider2.prototype.getAvatar = function(nameOrAddress) { + return __awaiter(this, void 0, void 0, function() { + var resolver, address, reverseName, resolverAddress, avatar; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + resolver = null; + if (!(0, bytes_1.isHexString)(nameOrAddress)) return [3, 2]; + address = this.formatter.address(nameOrAddress); + reverseName = address.substring(2).toLowerCase() + ".addr.reverse"; + return [4, this._getResolver(reverseName)]; + case 1: + resolverAddress = _a.sent(); + if (!resolverAddress) { + return [2, null]; + } + resolver = new Resolver(this, resolverAddress, "_", address); + return [3, 4]; + case 2: + return [4, this.getResolver(nameOrAddress)]; + case 3: + resolver = _a.sent(); + if (!resolver) { + return [2, null]; + } + _a.label = 4; + case 4: + return [4, resolver.getAvatar()]; + case 5: + avatar = _a.sent(); + if (avatar == null) { + return [2, null]; + } + return [2, avatar.url]; + } + }); + }); + }; + BaseProvider2.prototype.perform = function(method, params) { + return logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method }); + }; + BaseProvider2.prototype._startEvent = function(event) { + this.polling = this._events.filter(function(e) { + return e.pollable(); + }).length > 0; + }; + BaseProvider2.prototype._stopEvent = function(event) { + this.polling = this._events.filter(function(e) { + return e.pollable(); + }).length > 0; + }; + BaseProvider2.prototype._addEventListener = function(eventName, listener, once) { + var event = new Event(getEventTag(eventName), listener, once); + this._events.push(event); + this._startEvent(event); + return this; + }; + BaseProvider2.prototype.on = function(eventName, listener) { + return this._addEventListener(eventName, listener, false); + }; + BaseProvider2.prototype.once = function(eventName, listener) { + return this._addEventListener(eventName, listener, true); + }; + BaseProvider2.prototype.emit = function(eventName) { + var _this = this; + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + 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(_this, args); + }, 0); + result = true; + if (event.once) { + stopped.push(event); + return false; + } + return true; + }); + stopped.forEach(function(event) { + _this._stopEvent(event); + }); + return result; + }; + BaseProvider2.prototype.listenerCount = function(eventName) { + if (!eventName) { + return this._events.length; + } + var eventTag = getEventTag(eventName); + return this._events.filter(function(event) { + return event.tag === eventTag; + }).length; + }; + BaseProvider2.prototype.listeners = function(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; + }); + }; + BaseProvider2.prototype.off = function(eventName, listener) { + var _this = 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) { + _this._stopEvent(event); + }); + return this; + }; + BaseProvider2.prototype.removeAllListeners = function(eventName) { + var _this = this; + var stopped = []; + if (eventName == null) { + stopped = this._events; + this._events = []; + } else { + var eventTag_1 = getEventTag(eventName); + this._events = this._events.filter(function(event) { + if (event.tag !== eventTag_1) { + return true; + } + stopped.push(event); + return false; + }); + } + stopped.forEach(function(event) { + _this._stopEvent(event); + }); + return this; + }; + return BaseProvider2; + }(abstract_provider_1.Provider) + ); + exports2.BaseProvider = BaseProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/json-rpc-provider.js +var require_json_rpc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/json-rpc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.JsonRpcProvider = exports2.JsonRpcSigner = void 0; + var abstract_signer_1 = require_lib13(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var hash_1 = require_lib10(); + var properties_1 = require_lib4(); + var strings_1 = require_lib9(); + var transactions_1 = require_lib15(); + var web_1 = require_lib27(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var base_provider_1 = require_base_provider(); + var errorGas = ["call", "estimateGas"]; + function checkError(method, error, params) { + if (method === "call" && error.code === logger_1.Logger.errors.SERVER_ERROR) { + var e = error.error; + if (e && e.message.match("reverted") && (0, bytes_1.isHexString)(e.data)) { + return e.data; + } + logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { + error, + data: "0x" + }); + } + var message = error.message; + if (error.code === logger_1.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; + if (message.match(/insufficient funds|base fee exceeds gas limit/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/nonce too low/)) { + logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/replacement transaction underpriced/)) { + logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + transaction + }); + } + if (message.match(/only replay-protected/)) { + logger.throwError("legacy pre-eip-155 transactions not supported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + error, + method, + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; + } + function timer(timeout) { + return new Promise(function(resolve) { + setTimeout(resolve, timeout); + }); + } + function getResult(payload) { + if (payload.error) { + 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 = ( + /** @class */ + function(_super) { + __extends(JsonRpcSigner2, _super); + function JsonRpcSigner2(constructorGuard, provider, addressOrIndex) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, JsonRpcSigner2); + _this = _super.call(this) || this; + if (constructorGuard !== _constructorGuard) { + throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner"); + } + (0, properties_1.defineReadOnly)(_this, "provider", provider); + if (addressOrIndex == null) { + addressOrIndex = 0; + } + if (typeof addressOrIndex === "string") { + (0, properties_1.defineReadOnly)(_this, "_address", _this.provider.formatter.address(addressOrIndex)); + (0, properties_1.defineReadOnly)(_this, "_index", null); + } else if (typeof addressOrIndex === "number") { + (0, properties_1.defineReadOnly)(_this, "_index", addressOrIndex); + (0, properties_1.defineReadOnly)(_this, "_address", null); + } else { + logger.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex); + } + return _this; + } + JsonRpcSigner2.prototype.connect = function(provider) { + return logger.throwError("cannot alter JSON-RPC Signer connection", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "connect" + }); + }; + JsonRpcSigner2.prototype.connectUnchecked = function() { + return new UncheckedJsonRpcSigner(_constructorGuard, this.provider, this._address || this._index); + }; + JsonRpcSigner2.prototype.getAddress = function() { + var _this = this; + if (this._address) { + return Promise.resolve(this._address); + } + return this.provider.send("eth_accounts", []).then(function(accounts) { + if (accounts.length <= _this._index) { + logger.throwError("unknown account #" + _this._index, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "getAddress" + }); + } + return _this.provider.formatter.address(accounts[_this._index]); + }); + }; + JsonRpcSigner2.prototype.sendUncheckedTransaction = function(transaction) { + var _this = this; + transaction = (0, properties_1.shallowCopy)(transaction); + var fromAddress = this.getAddress().then(function(address) { + if (address) { + address = address.toLowerCase(); + } + return address; + }); + if (transaction.gasLimit == null) { + var estimate = (0, properties_1.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(_this, void 0, void 0, function() { + var address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (to == null) { + return [2, null]; + } + return [4, this.provider.resolveName(to)]; + case 1: + address = _a.sent(); + if (address == null) { + logger.throwArgumentError("provided ENS name resolves to null", "tx.to", to); + } + return [2, address]; + } + }); + }); + }); + } + return (0, properties_1.resolveProperties)({ + tx: (0, properties_1.resolveProperties)(transaction), + sender: fromAddress + }).then(function(_a) { + var tx = _a.tx, sender = _a.sender; + if (tx.from != null) { + if (tx.from.toLowerCase() !== sender) { + logger.throwArgumentError("from address mismatch", "transaction", transaction); + } + } else { + tx.from = sender; + } + var hexTx = _this.provider.constructor.hexlifyTransaction(tx, { from: true }); + return _this.provider.send("eth_sendTransaction", [hexTx]).then(function(hash) { + return hash; + }, function(error) { + return checkError("sendTransaction", error, hexTx); + }); + }); + }; + JsonRpcSigner2.prototype.signTransaction = function(transaction) { + return logger.throwError("signing transactions is unsupported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "signTransaction" + }); + }; + JsonRpcSigner2.prototype.sendTransaction = function(transaction) { + return __awaiter(this, void 0, void 0, function() { + var blockNumber, hash, error_1; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, this.provider._getInternalBlockNumber(100 + 2 * this.provider.pollingInterval)]; + case 1: + blockNumber = _a.sent(); + return [4, this.sendUncheckedTransaction(transaction)]; + case 2: + hash = _a.sent(); + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, (0, web_1.poll)(function() { + return __awaiter(_this, void 0, void 0, function() { + var tx; + return __generator(this, function(_a2) { + switch (_a2.label) { + case 0: + return [4, this.provider.getTransaction(hash)]; + case 1: + tx = _a2.sent(); + if (tx === null) { + return [2, void 0]; + } + return [2, this.provider._wrapTransaction(tx, hash, blockNumber)]; + } + }); + }); + }, { oncePoll: this.provider })]; + case 4: + return [2, _a.sent()]; + case 5: + error_1 = _a.sent(); + error_1.transactionHash = hash; + throw error_1; + case 6: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + JsonRpcSigner2.prototype.signMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + var data, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = typeof message === "string" ? (0, strings_1.toUtf8Bytes)(message) : message; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [4, this.provider.send("personal_sign", [(0, bytes_1.hexlify)(data), address.toLowerCase()])]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype._legacySignMessage = function(message) { + return __awaiter(this, void 0, void 0, function() { + var data, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + data = typeof message === "string" ? (0, strings_1.toUtf8Bytes)(message) : message; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [4, this.provider.send("eth_sign", [address.toLowerCase(), (0, bytes_1.hexlify)(data)])]; + case 2: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype._signTypedData = function(domain, types, value) { + return __awaiter(this, void 0, void 0, function() { + var populated, address; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, hash_1._TypedDataEncoder.resolveNames(domain, types, value, function(name2) { + return _this.provider.resolveName(name2); + })]; + case 1: + populated = _a.sent(); + return [4, this.getAddress()]; + case 2: + address = _a.sent(); + return [4, this.provider.send("eth_signTypedData_v4", [ + address.toLowerCase(), + JSON.stringify(hash_1._TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ])]; + case 3: + return [2, _a.sent()]; + } + }); + }); + }; + JsonRpcSigner2.prototype.unlock = function(password) { + return __awaiter(this, void 0, void 0, function() { + var provider, address; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + provider = this.provider; + return [4, this.getAddress()]; + case 1: + address = _a.sent(); + return [2, provider.send("personal_unlockAccount", [address.toLowerCase(), password, null])]; + } + }); + }); + }; + return JsonRpcSigner2; + }(abstract_signer_1.Signer) + ); + exports2.JsonRpcSigner = JsonRpcSigner; + var UncheckedJsonRpcSigner = ( + /** @class */ + function(_super) { + __extends(UncheckedJsonRpcSigner2, _super); + function UncheckedJsonRpcSigner2() { + return _super !== null && _super.apply(this, arguments) || this; + } + UncheckedJsonRpcSigner2.prototype.sendTransaction = function(transaction) { + var _this = this; + return this.sendUncheckedTransaction(transaction).then(function(hash) { + return { + hash, + nonce: null, + gasLimit: null, + gasPrice: null, + data: null, + value: null, + chainId: null, + confirmations: 0, + from: null, + wait: function(confirmations) { + return _this.provider.waitForTransaction(hash, confirmations); + } + }; + }); + }; + return UncheckedJsonRpcSigner2; + }(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 = ( + /** @class */ + function(_super) { + __extends(JsonRpcProvider2, _super); + function JsonRpcProvider2(url, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, JsonRpcProvider2); + var networkOrReady = network; + if (networkOrReady == null) { + networkOrReady = new Promise(function(resolve, reject) { + setTimeout(function() { + _this.detectNetwork().then(function(network2) { + resolve(network2); + }, function(error) { + reject(error); + }); + }, 0); + }); + } + _this = _super.call(this, networkOrReady) || this; + if (!url) { + url = (0, properties_1.getStatic)(_this.constructor, "defaultUrl")(); + } + if (typeof url === "string") { + (0, properties_1.defineReadOnly)(_this, "connection", Object.freeze({ + url + })); + } else { + (0, properties_1.defineReadOnly)(_this, "connection", Object.freeze((0, properties_1.shallowCopy)(url))); + } + _this._nextId = 42; + return _this; + } + Object.defineProperty(JsonRpcProvider2.prototype, "_cache", { + get: function() { + if (this._eventLoopCache == null) { + this._eventLoopCache = {}; + } + return this._eventLoopCache; + }, + enumerable: false, + configurable: true + }); + JsonRpcProvider2.defaultUrl = function() { + return "http://localhost:8545"; + }; + JsonRpcProvider2.prototype.detectNetwork = function() { + var _this = this; + if (!this._cache["detectNetwork"]) { + this._cache["detectNetwork"] = this._uncachedDetectNetwork(); + setTimeout(function() { + _this._cache["detectNetwork"] = null; + }, 0); + } + return this._cache["detectNetwork"]; + }; + JsonRpcProvider2.prototype._uncachedDetectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var chainId, error_2, error_3, getNetwork; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, timer(0)]; + case 1: + _a.sent(); + chainId = null; + _a.label = 2; + case 2: + _a.trys.push([2, 4, , 9]); + return [4, this.send("eth_chainId", [])]; + case 3: + chainId = _a.sent(); + return [3, 9]; + case 4: + error_2 = _a.sent(); + _a.label = 5; + case 5: + _a.trys.push([5, 7, , 8]); + return [4, this.send("net_version", [])]; + case 6: + chainId = _a.sent(); + return [3, 8]; + case 7: + error_3 = _a.sent(); + return [3, 8]; + case 8: + return [3, 9]; + case 9: + if (chainId != null) { + getNetwork = (0, properties_1.getStatic)(this.constructor, "getNetwork"); + try { + return [2, getNetwork(bignumber_1.BigNumber.from(chainId).toNumber())]; + } catch (error) { + return [2, logger.throwError("could not detect network", logger_1.Logger.errors.NETWORK_ERROR, { + chainId, + event: "invalidNetwork", + serverError: error + })]; + } + } + return [2, logger.throwError("could not detect network", logger_1.Logger.errors.NETWORK_ERROR, { + event: "noNetwork" + })]; + } + }); + }); + }; + JsonRpcProvider2.prototype.getSigner = function(addressOrIndex) { + return new JsonRpcSigner(_constructorGuard, this, addressOrIndex); + }; + JsonRpcProvider2.prototype.getUncheckedSigner = function(addressOrIndex) { + return this.getSigner(addressOrIndex).connectUnchecked(); + }; + JsonRpcProvider2.prototype.listAccounts = function() { + var _this = this; + return this.send("eth_accounts", []).then(function(accounts) { + return accounts.map(function(a) { + return _this.formatter.address(a); + }); + }); + }; + JsonRpcProvider2.prototype.send = function(method, params) { + var _this = this; + var request = { + method, + params, + id: this._nextId++, + jsonrpc: "2.0" + }; + this.emit("debug", { + action: "request", + request: (0, properties_1.deepCopy)(request), + provider: this + }); + var cache = ["eth_chainId", "eth_blockNumber"].indexOf(method) >= 0; + if (cache && this._cache[method]) { + return this._cache[method]; + } + var result = (0, web_1.fetchJson)(this.connection, JSON.stringify(request), getResult).then(function(result2) { + _this.emit("debug", { + action: "response", + request, + response: result2, + provider: _this + }); + return result2; + }, function(error) { + _this.emit("debug", { + action: "response", + error, + request, + provider: _this + }); + throw error; + }); + if (cache) { + this._cache[method] = result; + setTimeout(function() { + _this._cache[method] = null; + }, 0); + } + return result; + }; + JsonRpcProvider2.prototype.prepareRequest = function(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 = (0, properties_1.getStatic)(this.constructor, "hexlifyTransaction"); + return ["eth_call", [hexlifyTransaction(params.transaction, { from: true }), params.blockTag]]; + } + case "estimateGas": { + var hexlifyTransaction = (0, properties_1.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; + }; + JsonRpcProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var tx, feeData, args, error_4; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "call" || method === "estimateGas")) return [3, 2]; + tx = params.transaction; + if (!(tx && tx.type != null && bignumber_1.BigNumber.from(tx.type).isZero())) return [3, 2]; + if (!(tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null)) return [3, 2]; + return [4, this.getFeeData()]; + case 1: + feeData = _a.sent(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + params = (0, properties_1.shallowCopy)(params); + params.transaction = (0, properties_1.shallowCopy)(tx); + delete params.transaction.type; + } + _a.label = 2; + case 2: + args = this.prepareRequest(method, params); + if (args == null) { + logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method }); + } + _a.label = 3; + case 3: + _a.trys.push([3, 5, , 6]); + return [4, this.send(args[0], args[1])]; + case 4: + return [2, _a.sent()]; + case 5: + error_4 = _a.sent(); + return [2, checkError(method, error_4, params)]; + case 6: + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + JsonRpcProvider2.prototype._startEvent = function(event) { + if (event.tag === "pending") { + this._startPending(); + } + _super.prototype._startEvent.call(this, event); + }; + JsonRpcProvider2.prototype._startPending = function() { + if (this._pendingFilter != null) { + return; + } + var self2 = this; + var pendingFilter = this.send("eth_newPendingTransactionFilter", []); + this._pendingFilter = pendingFilter; + pendingFilter.then(function(filterId) { + function poll() { + self2.send("eth_getFilterChanges", [filterId]).then(function(hashes) { + if (self2._pendingFilter != pendingFilter) { + return null; + } + var seq = Promise.resolve(); + hashes.forEach(function(hash) { + self2._emitted["t:" + hash.toLowerCase()] = "pending"; + seq = seq.then(function() { + return self2.getTransaction(hash).then(function(tx) { + self2.emit("pending", tx); + return null; + }); + }); + }); + return seq.then(function() { + return timer(1e3); + }); + }).then(function() { + if (self2._pendingFilter != pendingFilter) { + self2.send("eth_uninstallFilter", [filterId]); + return; + } + setTimeout(function() { + poll(); + }, 0); + return null; + }).catch(function(error) { + }); + } + poll(); + return filterId; + }).catch(function(error) { + }); + }; + JsonRpcProvider2.prototype._stopEvent = function(event) { + if (event.tag === "pending" && this.listenerCount("pending") === 0) { + this._pendingFilter = null; + } + _super.prototype._stopEvent.call(this, event); + }; + JsonRpcProvider2.hexlifyTransaction = function(transaction, allowExtra) { + var allowed = (0, properties_1.shallowCopy)(allowedTransactionKeys); + if (allowExtra) { + for (var key in allowExtra) { + if (allowExtra[key]) { + allowed[key] = true; + } + } + } + (0, properties_1.checkProperties)(transaction, allowed); + var result = {}; + ["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + var value = (0, bytes_1.hexValue)(transaction[key2]); + if (key2 === "gasLimit") { + key2 = "gas"; + } + result[key2] = value; + }); + ["from", "to", "data"].forEach(function(key2) { + if (transaction[key2] == null) { + return; + } + result[key2] = (0, bytes_1.hexlify)(transaction[key2]); + }); + if (transaction.accessList) { + result["accessList"] = (0, transactions_1.accessListify)(transaction.accessList); + } + return result; + }; + return JsonRpcProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.JsonRpcProvider = JsonRpcProvider; + } +}); + +// node_modules/ws/lib/constants.js +var require_constants = __commonJS({ + "node_modules/ws/lib/constants.js"(exports2, module2) { + "use strict"; + module2.exports = { + BINARY_TYPES: ["nodebuffer", "arraybuffer", "fragments"], + GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11", + kStatusCode: Symbol("status-code"), + kWebSocket: Symbol("websocket"), + EMPTY_BUFFER: Buffer.alloc(0), + NOOP: () => { + } + }; + } +}); + +// node_modules/ws/lib/buffer-util.js +var require_buffer_util = __commonJS({ + "node_modules/ws/lib/buffer-util.js"(exports2, module2) { + "use strict"; + var { EMPTY_BUFFER } = require_constants(); + function concat(list, totalLength) { + if (list.length === 0) return EMPTY_BUFFER; + if (list.length === 1) return list[0]; + const target = Buffer.allocUnsafe(totalLength); + let offset = 0; + for (let i = 0; i < list.length; i++) { + const buf = list[i]; + target.set(buf, offset); + offset += buf.length; + } + if (offset < totalLength) return target.slice(0, offset); + return target; + } + function _mask(source, mask, output, offset, length) { + for (let i = 0; i < length; i++) { + output[offset + i] = source[i] ^ mask[i & 3]; + } + } + function _unmask(buffer, mask) { + const length = buffer.length; + for (let i = 0; i < length; i++) { + buffer[i] ^= mask[i & 3]; + } + } + function toArrayBuffer(buf) { + if (buf.byteLength === buf.buffer.byteLength) { + return buf.buffer; + } + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + } + function toBuffer(data) { + toBuffer.readOnly = true; + if (Buffer.isBuffer(data)) return data; + let buf; + if (data instanceof ArrayBuffer) { + buf = Buffer.from(data); + } else if (ArrayBuffer.isView(data)) { + buf = Buffer.from(data.buffer, data.byteOffset, data.byteLength); + } else { + buf = Buffer.from(data); + toBuffer.readOnly = false; + } + return buf; + } + try { + const bufferUtil = require("bufferutil"); + const bu = bufferUtil.BufferUtil || bufferUtil; + module2.exports = { + concat, + mask(source, mask, output, offset, length) { + if (length < 48) _mask(source, mask, output, offset, length); + else bu.mask(source, mask, output, offset, length); + }, + toArrayBuffer, + toBuffer, + unmask(buffer, mask) { + if (buffer.length < 32) _unmask(buffer, mask); + else bu.unmask(buffer, mask); + } + }; + } catch (e) { + module2.exports = { + concat, + mask: _mask, + toArrayBuffer, + toBuffer, + unmask: _unmask + }; + } + } +}); + +// node_modules/ws/lib/limiter.js +var require_limiter = __commonJS({ + "node_modules/ws/lib/limiter.js"(exports2, module2) { + "use strict"; + var kDone = Symbol("kDone"); + var kRun = Symbol("kRun"); + var Limiter = class { + /** + * Creates a new `Limiter`. + * + * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed + * to run concurrently + */ + constructor(concurrency) { + this[kDone] = () => { + this.pending--; + this[kRun](); + }; + this.concurrency = concurrency || Infinity; + this.jobs = []; + this.pending = 0; + } + /** + * Adds a job to the queue. + * + * @param {Function} job The job to run + * @public + */ + add(job) { + this.jobs.push(job); + this[kRun](); + } + /** + * Removes a job from the queue and runs it if possible. + * + * @private + */ + [kRun]() { + if (this.pending === this.concurrency) return; + if (this.jobs.length) { + const job = this.jobs.shift(); + this.pending++; + job(this[kDone]); + } + } + }; + module2.exports = Limiter; + } +}); + +// node_modules/ws/lib/permessage-deflate.js +var require_permessage_deflate = __commonJS({ + "node_modules/ws/lib/permessage-deflate.js"(exports2, module2) { + "use strict"; + var zlib = require("zlib"); + var bufferUtil = require_buffer_util(); + var Limiter = require_limiter(); + var { kStatusCode, NOOP } = require_constants(); + var TRAILER = Buffer.from([0, 0, 255, 255]); + var kPerMessageDeflate = Symbol("permessage-deflate"); + var kTotalLength = Symbol("total-length"); + var kCallback = Symbol("callback"); + var kBuffers = Symbol("buffers"); + var kError = Symbol("error"); + var zlibLimiter; + var PerMessageDeflate = class { + /** + * Creates a PerMessageDeflate instance. + * + * @param {Object} [options] Configuration options + * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept + * disabling of server context takeover + * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/ + * acknowledge disabling of client context takeover + * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the + * use of a custom server window size + * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support + * for, or request, a custom client window size + * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on + * deflate + * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on + * inflate + * @param {Number} [options.threshold=1024] Size (in bytes) below which + * messages should not be compressed + * @param {Number} [options.concurrencyLimit=10] The number of concurrent + * calls to zlib + * @param {Boolean} [isServer=false] Create the instance in either server or + * client mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(options, isServer, maxPayload) { + this._maxPayload = maxPayload | 0; + this._options = options || {}; + this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024; + this._isServer = !!isServer; + this._deflate = null; + this._inflate = null; + this.params = null; + if (!zlibLimiter) { + const concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10; + zlibLimiter = new Limiter(concurrency); + } + } + /** + * @type {String} + */ + static get extensionName() { + return "permessage-deflate"; + } + /** + * Create an extension negotiation offer. + * + * @return {Object} Extension parameters + * @public + */ + offer() { + const params = {}; + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + return params; + } + /** + * Accept an extension negotiation offer/response. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Object} Accepted configuration + * @public + */ + accept(configurations) { + configurations = this.normalizeParams(configurations); + this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations); + return this.params; + } + /** + * Releases all resources used by the extension. + * + * @public + */ + cleanup() { + if (this._inflate) { + this._inflate.close(); + this._inflate = null; + } + if (this._deflate) { + const callback = this._deflate[kCallback]; + this._deflate.close(); + this._deflate = null; + if (callback) { + callback( + new Error( + "The deflate stream was closed while data was being processed" + ) + ); + } + } + } + /** + * Accept an extension negotiation offer. + * + * @param {Array} offers The extension negotiation offers + * @return {Object} Accepted configuration + * @private + */ + acceptAsServer(offers) { + const opts = this._options; + const accepted = offers.find((params) => { + if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) { + return false; + } + return true; + }); + if (!accepted) { + throw new Error("None of the extension offers can be accepted"); + } + if (opts.serverNoContextTakeover) { + accepted.server_no_context_takeover = true; + } + if (opts.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (typeof opts.serverMaxWindowBits === "number") { + accepted.server_max_window_bits = opts.serverMaxWindowBits; + } + if (typeof opts.clientMaxWindowBits === "number") { + accepted.client_max_window_bits = opts.clientMaxWindowBits; + } else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) { + delete accepted.client_max_window_bits; + } + return accepted; + } + /** + * Accept the extension negotiation response. + * + * @param {Array} response The extension negotiation response + * @return {Object} Accepted configuration + * @private + */ + acceptAsClient(response) { + const params = response[0]; + if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) { + throw new Error('Unexpected parameter "client_no_context_takeover"'); + } + if (!params.client_max_window_bits) { + if (typeof this._options.clientMaxWindowBits === "number") { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } + } else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params.client_max_window_bits > this._options.clientMaxWindowBits) { + throw new Error( + 'Unexpected or invalid parameter "client_max_window_bits"' + ); + } + return params; + } + /** + * Normalize parameters. + * + * @param {Array} configurations The extension negotiation offers/reponse + * @return {Array} The offers/response with normalized parameters + * @private + */ + normalizeParams(configurations) { + configurations.forEach((params) => { + Object.keys(params).forEach((key) => { + let value = params[key]; + if (value.length > 1) { + throw new Error(`Parameter "${key}" must have only a single value`); + } + value = value[0]; + if (key === "client_max_window_bits") { + if (value !== true) { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (!this._isServer) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else if (key === "server_max_window_bits") { + const num = +value; + if (!Number.isInteger(num) || num < 8 || num > 15) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + value = num; + } else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") { + if (value !== true) { + throw new TypeError( + `Invalid value for parameter "${key}": ${value}` + ); + } + } else { + throw new Error(`Unknown parameter "${key}"`); + } + params[key] = value; + }); + }); + return configurations; + } + /** + * Decompress data. Concurrency limited. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + decompress(data, fin, callback) { + zlibLimiter.add((done) => { + this._decompress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + /** + * Compress data. Concurrency limited. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @public + */ + compress(data, fin, callback) { + zlibLimiter.add((done) => { + this._compress(data, fin, (err, result) => { + done(); + callback(err, result); + }); + }); + } + /** + * Decompress data. + * + * @param {Buffer} data Compressed data + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _decompress(data, fin, callback) { + const endpoint = this._isServer ? "client" : "server"; + if (!this._inflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key]; + this._inflate = zlib.createInflateRaw({ + ...this._options.zlibInflateOptions, + windowBits + }); + this._inflate[kPerMessageDeflate] = this; + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + this._inflate.on("error", inflateOnError); + this._inflate.on("data", inflateOnData); + } + this._inflate[kCallback] = callback; + this._inflate.write(data); + if (fin) this._inflate.write(TRAILER); + this._inflate.flush(() => { + const err = this._inflate[kError]; + if (err) { + this._inflate.close(); + this._inflate = null; + callback(err); + return; + } + const data2 = bufferUtil.concat( + this._inflate[kBuffers], + this._inflate[kTotalLength] + ); + if (this._inflate._readableState.endEmitted) { + this._inflate.close(); + this._inflate = null; + } else { + this._inflate[kTotalLength] = 0; + this._inflate[kBuffers] = []; + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._inflate.reset(); + } + } + callback(null, data2); + }); + } + /** + * Compress data. + * + * @param {Buffer} data Data to compress + * @param {Boolean} fin Specifies whether or not this is the last fragment + * @param {Function} callback Callback + * @private + */ + _compress(data, fin, callback) { + const endpoint = this._isServer ? "server" : "client"; + if (!this._deflate) { + const key = `${endpoint}_max_window_bits`; + const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key]; + this._deflate = zlib.createDeflateRaw({ + ...this._options.zlibDeflateOptions, + windowBits + }); + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + this._deflate.on("error", NOOP); + this._deflate.on("data", deflateOnData); + } + this._deflate[kCallback] = callback; + this._deflate.write(data); + this._deflate.flush(zlib.Z_SYNC_FLUSH, () => { + if (!this._deflate) { + return; + } + let data2 = bufferUtil.concat( + this._deflate[kBuffers], + this._deflate[kTotalLength] + ); + if (fin) data2 = data2.slice(0, data2.length - 4); + this._deflate[kCallback] = null; + this._deflate[kTotalLength] = 0; + this._deflate[kBuffers] = []; + if (fin && this.params[`${endpoint}_no_context_takeover`]) { + this._deflate.reset(); + } + callback(null, data2); + }); + } + }; + module2.exports = PerMessageDeflate; + function deflateOnData(chunk) { + this[kBuffers].push(chunk); + this[kTotalLength] += chunk.length; + } + function inflateOnData(chunk) { + this[kTotalLength] += chunk.length; + if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) { + this[kBuffers].push(chunk); + return; + } + this[kError] = new RangeError("Max payload size exceeded"); + this[kError][kStatusCode] = 1009; + this.removeListener("data", inflateOnData); + this.reset(); + } + function inflateOnError(err) { + this[kPerMessageDeflate]._inflate = null; + err[kStatusCode] = 1007; + this[kCallback](err); + } + } +}); + +// node_modules/ws/lib/validation.js +var require_validation = __commonJS({ + "node_modules/ws/lib/validation.js"(exports2, module2) { + "use strict"; + function isValidStatusCode(code) { + return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999; + } + function _isValidUTF8(buf) { + const len = buf.length; + let i = 0; + while (i < len) { + if ((buf[i] & 128) === 0) { + i++; + } else if ((buf[i] & 224) === 192) { + if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) { + return false; + } + i += 2; + } else if ((buf[i] & 240) === 224) { + if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || // Overlong + buf[i] === 237 && (buf[i + 1] & 224) === 160) { + return false; + } + i += 3; + } else if ((buf[i] & 248) === 240) { + if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || // Overlong + buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) { + return false; + } + i += 4; + } else { + return false; + } + } + return true; + } + try { + let isValidUTF8 = require("utf-8-validate"); + if (typeof isValidUTF8 === "object") { + isValidUTF8 = isValidUTF8.Validation.isValidUTF8; + } + module2.exports = { + isValidStatusCode, + isValidUTF8(buf) { + return buf.length < 150 ? _isValidUTF8(buf) : isValidUTF8(buf); + } + }; + } catch (e) { + module2.exports = { + isValidStatusCode, + isValidUTF8: _isValidUTF8 + }; + } + } +}); + +// node_modules/ws/lib/receiver.js +var require_receiver = __commonJS({ + "node_modules/ws/lib/receiver.js"(exports2, module2) { + "use strict"; + var { Writable } = require("stream"); + var PerMessageDeflate = require_permessage_deflate(); + var { + BINARY_TYPES, + EMPTY_BUFFER, + kStatusCode, + kWebSocket + } = require_constants(); + var { concat, toArrayBuffer, unmask } = require_buffer_util(); + var { isValidStatusCode, isValidUTF8 } = require_validation(); + var GET_INFO = 0; + var GET_PAYLOAD_LENGTH_16 = 1; + var GET_PAYLOAD_LENGTH_64 = 2; + var GET_MASK = 3; + var GET_DATA = 4; + var INFLATING = 5; + var Receiver = class extends Writable { + /** + * Creates a Receiver instance. + * + * @param {String} [binaryType=nodebuffer] The type for binary data + * @param {Object} [extensions] An object containing the negotiated extensions + * @param {Boolean} [isServer=false] Specifies whether to operate in client or + * server mode + * @param {Number} [maxPayload=0] The maximum allowed message length + */ + constructor(binaryType, extensions, isServer, maxPayload) { + super(); + this._binaryType = binaryType || BINARY_TYPES[0]; + this[kWebSocket] = void 0; + this._extensions = extensions || {}; + this._isServer = !!isServer; + this._maxPayload = maxPayload | 0; + this._bufferedBytes = 0; + this._buffers = []; + this._compressed = false; + this._payloadLength = 0; + this._mask = void 0; + this._fragmented = 0; + this._masked = false; + this._fin = false; + this._opcode = 0; + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragments = []; + this._state = GET_INFO; + this._loop = false; + } + /** + * Implements `Writable.prototype._write()`. + * + * @param {Buffer} chunk The chunk of data to write + * @param {String} encoding The character encoding of `chunk` + * @param {Function} cb Callback + * @private + */ + _write(chunk, encoding, cb) { + if (this._opcode === 8 && this._state == GET_INFO) return cb(); + this._bufferedBytes += chunk.length; + this._buffers.push(chunk); + this.startLoop(cb); + } + /** + * Consumes `n` bytes from the buffered data. + * + * @param {Number} n The number of bytes to consume + * @return {Buffer} The consumed bytes + * @private + */ + consume(n) { + this._bufferedBytes -= n; + if (n === this._buffers[0].length) return this._buffers.shift(); + if (n < this._buffers[0].length) { + const buf = this._buffers[0]; + this._buffers[0] = buf.slice(n); + return buf.slice(0, n); + } + const dst = Buffer.allocUnsafe(n); + do { + const buf = this._buffers[0]; + const offset = dst.length - n; + if (n >= buf.length) { + dst.set(this._buffers.shift(), offset); + } else { + dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset); + this._buffers[0] = buf.slice(n); + } + n -= buf.length; + } while (n > 0); + return dst; + } + /** + * Starts the parsing loop. + * + * @param {Function} cb Callback + * @private + */ + startLoop(cb) { + let err; + this._loop = true; + do { + switch (this._state) { + case GET_INFO: + err = this.getInfo(); + break; + case GET_PAYLOAD_LENGTH_16: + err = this.getPayloadLength16(); + break; + case GET_PAYLOAD_LENGTH_64: + err = this.getPayloadLength64(); + break; + case GET_MASK: + this.getMask(); + break; + case GET_DATA: + err = this.getData(cb); + break; + default: + this._loop = false; + return; + } + } while (this._loop); + cb(err); + } + /** + * Reads the first two bytes of a frame. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getInfo() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + const buf = this.consume(2); + if ((buf[0] & 48) !== 0) { + this._loop = false; + return error(RangeError, "RSV2 and RSV3 must be clear", true, 1002); + } + const compressed = (buf[0] & 64) === 64; + if (compressed && !this._extensions[PerMessageDeflate.extensionName]) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + this._fin = (buf[0] & 128) === 128; + this._opcode = buf[0] & 15; + this._payloadLength = buf[1] & 127; + if (this._opcode === 0) { + if (compressed) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + if (!this._fragmented) { + this._loop = false; + return error(RangeError, "invalid opcode 0", true, 1002); + } + this._opcode = this._fragmented; + } else if (this._opcode === 1 || this._opcode === 2) { + if (this._fragmented) { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + this._compressed = compressed; + } else if (this._opcode > 7 && this._opcode < 11) { + if (!this._fin) { + this._loop = false; + return error(RangeError, "FIN must be set", true, 1002); + } + if (compressed) { + this._loop = false; + return error(RangeError, "RSV1 must be clear", true, 1002); + } + if (this._payloadLength > 125) { + this._loop = false; + return error( + RangeError, + `invalid payload length ${this._payloadLength}`, + true, + 1002 + ); + } + } else { + this._loop = false; + return error(RangeError, `invalid opcode ${this._opcode}`, true, 1002); + } + if (!this._fin && !this._fragmented) this._fragmented = this._opcode; + this._masked = (buf[1] & 128) === 128; + if (this._isServer) { + if (!this._masked) { + this._loop = false; + return error(RangeError, "MASK must be set", true, 1002); + } + } else if (this._masked) { + this._loop = false; + return error(RangeError, "MASK must be clear", true, 1002); + } + if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16; + else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64; + else return this.haveLength(); + } + /** + * Gets extended payload length (7+16). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength16() { + if (this._bufferedBytes < 2) { + this._loop = false; + return; + } + this._payloadLength = this.consume(2).readUInt16BE(0); + return this.haveLength(); + } + /** + * Gets extended payload length (7+64). + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + getPayloadLength64() { + if (this._bufferedBytes < 8) { + this._loop = false; + return; + } + const buf = this.consume(8); + const num = buf.readUInt32BE(0); + if (num > Math.pow(2, 53 - 32) - 1) { + this._loop = false; + return error( + RangeError, + "Unsupported WebSocket frame: payload length > 2^53 - 1", + false, + 1009 + ); + } + this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4); + return this.haveLength(); + } + /** + * Payload length has been read. + * + * @return {(RangeError|undefined)} A possible error + * @private + */ + haveLength() { + if (this._payloadLength && this._opcode < 8) { + this._totalPayloadLength += this._payloadLength; + if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) { + this._loop = false; + return error(RangeError, "Max payload size exceeded", false, 1009); + } + } + if (this._masked) this._state = GET_MASK; + else this._state = GET_DATA; + } + /** + * Reads mask bytes. + * + * @private + */ + getMask() { + if (this._bufferedBytes < 4) { + this._loop = false; + return; + } + this._mask = this.consume(4); + this._state = GET_DATA; + } + /** + * Reads data bytes. + * + * @param {Function} cb Callback + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + getData(cb) { + let data = EMPTY_BUFFER; + if (this._payloadLength) { + if (this._bufferedBytes < this._payloadLength) { + this._loop = false; + return; + } + data = this.consume(this._payloadLength); + if (this._masked) unmask(data, this._mask); + } + if (this._opcode > 7) return this.controlMessage(data); + if (this._compressed) { + this._state = INFLATING; + this.decompress(data, cb); + return; + } + if (data.length) { + this._messageLength = this._totalPayloadLength; + this._fragments.push(data); + } + return this.dataMessage(); + } + /** + * Decompresses data. + * + * @param {Buffer} data Compressed data + * @param {Function} cb Callback + * @private + */ + decompress(data, cb) { + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + perMessageDeflate.decompress(data, this._fin, (err, buf) => { + if (err) return cb(err); + if (buf.length) { + this._messageLength += buf.length; + if (this._messageLength > this._maxPayload && this._maxPayload > 0) { + return cb( + error(RangeError, "Max payload size exceeded", false, 1009) + ); + } + this._fragments.push(buf); + } + const er = this.dataMessage(); + if (er) return cb(er); + this.startLoop(cb); + }); + } + /** + * Handles a data message. + * + * @return {(Error|undefined)} A possible error + * @private + */ + dataMessage() { + if (this._fin) { + const messageLength = this._messageLength; + const fragments = this._fragments; + this._totalPayloadLength = 0; + this._messageLength = 0; + this._fragmented = 0; + this._fragments = []; + if (this._opcode === 2) { + let data; + if (this._binaryType === "nodebuffer") { + data = concat(fragments, messageLength); + } else if (this._binaryType === "arraybuffer") { + data = toArrayBuffer(concat(fragments, messageLength)); + } else { + data = fragments; + } + this.emit("message", data); + } else { + const buf = concat(fragments, messageLength); + if (!isValidUTF8(buf)) { + this._loop = false; + return error(Error, "invalid UTF-8 sequence", true, 1007); + } + this.emit("message", buf.toString()); + } + } + this._state = GET_INFO; + } + /** + * Handles a control message. + * + * @param {Buffer} data Data to handle + * @return {(Error|RangeError|undefined)} A possible error + * @private + */ + controlMessage(data) { + if (this._opcode === 8) { + this._loop = false; + if (data.length === 0) { + this.emit("conclude", 1005, ""); + this.end(); + } else if (data.length === 1) { + return error(RangeError, "invalid payload length 1", true, 1002); + } else { + const code = data.readUInt16BE(0); + if (!isValidStatusCode(code)) { + return error(RangeError, `invalid status code ${code}`, true, 1002); + } + const buf = data.slice(2); + if (!isValidUTF8(buf)) { + return error(Error, "invalid UTF-8 sequence", true, 1007); + } + this.emit("conclude", code, buf.toString()); + this.end(); + } + } else if (this._opcode === 9) { + this.emit("ping", data); + } else { + this.emit("pong", data); + } + this._state = GET_INFO; + } + }; + module2.exports = Receiver; + function error(ErrorCtor, message, prefix, statusCode) { + const err = new ErrorCtor( + prefix ? `Invalid WebSocket frame: ${message}` : message + ); + Error.captureStackTrace(err, error); + err[kStatusCode] = statusCode; + return err; + } + } +}); + +// node_modules/ws/lib/sender.js +var require_sender = __commonJS({ + "node_modules/ws/lib/sender.js"(exports2, module2) { + "use strict"; + var { randomFillSync } = require("crypto"); + var PerMessageDeflate = require_permessage_deflate(); + var { EMPTY_BUFFER } = require_constants(); + var { isValidStatusCode } = require_validation(); + var { mask: applyMask, toBuffer } = require_buffer_util(); + var mask = Buffer.alloc(4); + var Sender = class _Sender { + /** + * Creates a Sender instance. + * + * @param {net.Socket} socket The connection socket + * @param {Object} [extensions] An object containing the negotiated extensions + */ + constructor(socket, extensions) { + this._extensions = extensions || {}; + this._socket = socket; + this._firstFragment = true; + this._compress = false; + this._bufferedBytes = 0; + this._deflating = false; + this._queue = []; + } + /** + * Frames a piece of data according to the HyBi WebSocket protocol. + * + * @param {Buffer} data The data to frame + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @return {Buffer[]} The framed data as a list of `Buffer` instances + * @public + */ + static frame(data, options) { + const merge = options.mask && options.readOnly; + let offset = options.mask ? 6 : 2; + let payloadLength = data.length; + if (data.length >= 65536) { + offset += 8; + payloadLength = 127; + } else if (data.length > 125) { + offset += 2; + payloadLength = 126; + } + const target = Buffer.allocUnsafe(merge ? data.length + offset : offset); + target[0] = options.fin ? options.opcode | 128 : options.opcode; + if (options.rsv1) target[0] |= 64; + target[1] = payloadLength; + if (payloadLength === 126) { + target.writeUInt16BE(data.length, 2); + } else if (payloadLength === 127) { + target.writeUInt32BE(0, 2); + target.writeUInt32BE(data.length, 6); + } + if (!options.mask) return [target, data]; + randomFillSync(mask, 0, 4); + target[1] |= 128; + target[offset - 4] = mask[0]; + target[offset - 3] = mask[1]; + target[offset - 2] = mask[2]; + target[offset - 1] = mask[3]; + if (merge) { + applyMask(data, mask, target, offset, data.length); + return [target]; + } + applyMask(data, mask, data, 0, data.length); + return [target, data]; + } + /** + * Sends a close message to the other peer. + * + * @param {Number} [code] The status code component of the body + * @param {String} [data] The message component of the body + * @param {Boolean} [mask=false] Specifies whether or not to mask the message + * @param {Function} [cb] Callback + * @public + */ + close(code, data, mask2, cb) { + let buf; + if (code === void 0) { + buf = EMPTY_BUFFER; + } else if (typeof code !== "number" || !isValidStatusCode(code)) { + throw new TypeError("First argument must be a valid error code number"); + } else if (data === void 0 || data === "") { + buf = Buffer.allocUnsafe(2); + buf.writeUInt16BE(code, 0); + } else { + const length = Buffer.byteLength(data); + if (length > 123) { + throw new RangeError("The message must not be greater than 123 bytes"); + } + buf = Buffer.allocUnsafe(2 + length); + buf.writeUInt16BE(code, 0); + buf.write(data, 2); + } + if (this._deflating) { + this.enqueue([this.doClose, buf, mask2, cb]); + } else { + this.doClose(buf, mask2, cb); + } + } + /** + * Frames and sends a close message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @private + */ + doClose(data, mask2, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 8, + mask: mask2, + readOnly: false + }), + cb + ); + } + /** + * Sends a ping message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + ping(data, mask2, cb) { + const buf = toBuffer(data); + if (buf.length > 125) { + throw new RangeError("The data size must not be greater than 125 bytes"); + } + if (this._deflating) { + this.enqueue([this.doPing, buf, mask2, toBuffer.readOnly, cb]); + } else { + this.doPing(buf, mask2, toBuffer.readOnly, cb); + } + } + /** + * Frames and sends a ping message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified + * @param {Function} [cb] Callback + * @private + */ + doPing(data, mask2, readOnly, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 9, + mask: mask2, + readOnly + }), + cb + ); + } + /** + * Sends a pong message to the other peer. + * + * @param {*} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback + * @public + */ + pong(data, mask2, cb) { + const buf = toBuffer(data); + if (buf.length > 125) { + throw new RangeError("The data size must not be greater than 125 bytes"); + } + if (this._deflating) { + this.enqueue([this.doPong, buf, mask2, toBuffer.readOnly, cb]); + } else { + this.doPong(buf, mask2, toBuffer.readOnly, cb); + } + } + /** + * Frames and sends a pong message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [mask=false] Specifies whether or not to mask `data` + * @param {Boolean} [readOnly=false] Specifies whether `data` can be modified + * @param {Function} [cb] Callback + * @private + */ + doPong(data, mask2, readOnly, cb) { + this.sendFrame( + _Sender.frame(data, { + fin: true, + rsv1: false, + opcode: 10, + mask: mask2, + readOnly + }), + cb + ); + } + /** + * Sends a data message to the other peer. + * + * @param {*} data The message to send + * @param {Object} options Options object + * @param {Boolean} [options.compress=false] Specifies whether or not to + * compress `data` + * @param {Boolean} [options.binary=false] Specifies whether `data` is binary + * or text + * @param {Boolean} [options.fin=false] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Function} [cb] Callback + * @public + */ + send(data, options, cb) { + const buf = toBuffer(data); + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + let opcode = options.binary ? 2 : 1; + let rsv1 = options.compress; + if (this._firstFragment) { + this._firstFragment = false; + if (rsv1 && perMessageDeflate) { + rsv1 = buf.length >= perMessageDeflate._threshold; + } + this._compress = rsv1; + } else { + rsv1 = false; + opcode = 0; + } + if (options.fin) this._firstFragment = true; + if (perMessageDeflate) { + const opts = { + fin: options.fin, + rsv1, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }; + if (this._deflating) { + this.enqueue([this.dispatch, buf, this._compress, opts, cb]); + } else { + this.dispatch(buf, this._compress, opts, cb); + } + } else { + this.sendFrame( + _Sender.frame(buf, { + fin: options.fin, + rsv1: false, + opcode, + mask: options.mask, + readOnly: toBuffer.readOnly + }), + cb + ); + } + } + /** + * Dispatches a data message. + * + * @param {Buffer} data The message to send + * @param {Boolean} [compress=false] Specifies whether or not to compress + * `data` + * @param {Object} options Options object + * @param {Number} options.opcode The opcode + * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be + * modified + * @param {Boolean} [options.fin=false] Specifies whether or not to set the + * FIN bit + * @param {Boolean} [options.mask=false] Specifies whether or not to mask + * `data` + * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the + * RSV1 bit + * @param {Function} [cb] Callback + * @private + */ + dispatch(data, compress, options, cb) { + if (!compress) { + this.sendFrame(_Sender.frame(data, options), cb); + return; + } + const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName]; + this._bufferedBytes += data.length; + this._deflating = true; + perMessageDeflate.compress(data, options.fin, (_, buf) => { + if (this._socket.destroyed) { + const err = new Error( + "The socket was closed while data was being compressed" + ); + if (typeof cb === "function") cb(err); + for (let i = 0; i < this._queue.length; i++) { + const callback = this._queue[i][4]; + if (typeof callback === "function") callback(err); + } + return; + } + this._bufferedBytes -= data.length; + this._deflating = false; + options.readOnly = false; + this.sendFrame(_Sender.frame(buf, options), cb); + this.dequeue(); + }); + } + /** + * Executes queued send operations. + * + * @private + */ + dequeue() { + while (!this._deflating && this._queue.length) { + const params = this._queue.shift(); + this._bufferedBytes -= params[1].length; + Reflect.apply(params[0], this, params.slice(1)); + } + } + /** + * Enqueues a send operation. + * + * @param {Array} params Send operation parameters. + * @private + */ + enqueue(params) { + this._bufferedBytes += params[1].length; + this._queue.push(params); + } + /** + * Sends a frame. + * + * @param {Buffer[]} list The frame to send + * @param {Function} [cb] Callback + * @private + */ + sendFrame(list, cb) { + if (list.length === 2) { + this._socket.cork(); + this._socket.write(list[0]); + this._socket.write(list[1], cb); + this._socket.uncork(); + } else { + this._socket.write(list[0], cb); + } + } + }; + module2.exports = Sender; + } +}); + +// node_modules/ws/lib/event-target.js +var require_event_target = __commonJS({ + "node_modules/ws/lib/event-target.js"(exports2, module2) { + "use strict"; + var Event = class { + /** + * Create a new `Event`. + * + * @param {String} type The name of the event + * @param {Object} target A reference to the target to which the event was + * dispatched + */ + constructor(type, target) { + this.target = target; + this.type = type; + } + }; + var MessageEvent = class extends Event { + /** + * Create a new `MessageEvent`. + * + * @param {(String|Buffer|ArrayBuffer|Buffer[])} data The received data + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(data, target) { + super("message", target); + this.data = data; + } + }; + var CloseEvent = class extends Event { + /** + * Create a new `CloseEvent`. + * + * @param {Number} code The status code explaining why the connection is being + * closed + * @param {String} reason A human-readable string explaining why the + * connection is closing + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(code, reason, target) { + super("close", target); + this.wasClean = target._closeFrameReceived && target._closeFrameSent; + this.reason = reason; + this.code = code; + } + }; + var OpenEvent = class extends Event { + /** + * Create a new `OpenEvent`. + * + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(target) { + super("open", target); + } + }; + var ErrorEvent = class extends Event { + /** + * Create a new `ErrorEvent`. + * + * @param {Object} error The error that generated this event + * @param {WebSocket} target A reference to the target to which the event was + * dispatched + */ + constructor(error, target) { + super("error", target); + this.message = error.message; + this.error = error; + } + }; + var EventTarget = { + /** + * Register an event listener. + * + * @param {String} type A string representing the event type to listen for + * @param {Function} listener The listener to add + * @param {Object} [options] An options object specifies characteristics about + * the event listener + * @param {Boolean} [options.once=false] A `Boolean`` indicating that the + * listener should be invoked at most once after being added. If `true`, + * the listener would be automatically removed when invoked. + * @public + */ + addEventListener(type, listener, options) { + if (typeof listener !== "function") return; + function onMessage(data) { + listener.call(this, new MessageEvent(data, this)); + } + function onClose(code, message) { + listener.call(this, new CloseEvent(code, message, this)); + } + function onError(error) { + listener.call(this, new ErrorEvent(error, this)); + } + function onOpen() { + listener.call(this, new OpenEvent(this)); + } + const method = options && options.once ? "once" : "on"; + if (type === "message") { + onMessage._listener = listener; + this[method](type, onMessage); + } else if (type === "close") { + onClose._listener = listener; + this[method](type, onClose); + } else if (type === "error") { + onError._listener = listener; + this[method](type, onError); + } else if (type === "open") { + onOpen._listener = listener; + this[method](type, onOpen); + } else { + this[method](type, listener); + } + }, + /** + * Remove an event listener. + * + * @param {String} type A string representing the event type to remove + * @param {Function} listener The listener to remove + * @public + */ + removeEventListener(type, listener) { + const listeners = this.listeners(type); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i] === listener || listeners[i]._listener === listener) { + this.removeListener(type, listeners[i]); + } + } + } + }; + module2.exports = EventTarget; + } +}); + +// node_modules/ws/lib/extension.js +var require_extension = __commonJS({ + "node_modules/ws/lib/extension.js"(exports2, module2) { + "use strict"; + var tokenChars = [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 0 - 15 + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + // 16 - 31 + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + // 32 - 47 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + // 48 - 63 + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 64 - 79 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + // 80 - 95 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + // 96 - 111 + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0 + // 112 - 127 + ]; + function push(dest, name2, elem) { + if (dest[name2] === void 0) dest[name2] = [elem]; + else dest[name2].push(elem); + } + function parse(header) { + const offers = /* @__PURE__ */ Object.create(null); + if (header === void 0 || header === "") return offers; + let params = /* @__PURE__ */ Object.create(null); + let mustUnescape = false; + let isEscaping = false; + let inQuotes = false; + let extensionName; + let paramName; + let start = -1; + let end = -1; + let i = 0; + for (; i < header.length; i++) { + const code = header.charCodeAt(i); + if (extensionName === void 0) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 32 || code === 9) { + if (end === -1 && start !== -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + const name2 = header.slice(start, end); + if (code === 44) { + push(offers, name2, params); + params = /* @__PURE__ */ Object.create(null); + } else { + extensionName = name2; + } + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (paramName === void 0) { + if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 32 || code === 9) { + if (end === -1 && start !== -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + push(params, header.slice(start, end), true); + if (code === 44) { + push(offers, extensionName, params); + params = /* @__PURE__ */ Object.create(null); + extensionName = void 0; + } + start = end = -1; + } else if (code === 61 && start !== -1 && end === -1) { + paramName = header.slice(start, i); + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else { + if (isEscaping) { + if (tokenChars[code] !== 1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (start === -1) start = i; + else if (!mustUnescape) mustUnescape = true; + isEscaping = false; + } else if (inQuotes) { + if (tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (code === 34 && start !== -1) { + inQuotes = false; + end = i; + } else if (code === 92) { + isEscaping = true; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } else if (code === 34 && header.charCodeAt(i - 1) === 61) { + inQuotes = true; + } else if (end === -1 && tokenChars[code] === 1) { + if (start === -1) start = i; + } else if (start !== -1 && (code === 32 || code === 9)) { + if (end === -1) end = i; + } else if (code === 59 || code === 44) { + if (start === -1) { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + if (end === -1) end = i; + let value = header.slice(start, end); + if (mustUnescape) { + value = value.replace(/\\/g, ""); + mustUnescape = false; + } + push(params, paramName, value); + if (code === 44) { + push(offers, extensionName, params); + params = /* @__PURE__ */ Object.create(null); + extensionName = void 0; + } + paramName = void 0; + start = end = -1; + } else { + throw new SyntaxError(`Unexpected character at index ${i}`); + } + } + } + if (start === -1 || inQuotes) { + throw new SyntaxError("Unexpected end of input"); + } + if (end === -1) end = i; + const token = header.slice(start, end); + if (extensionName === void 0) { + push(offers, token, params); + } else { + if (paramName === void 0) { + push(params, token, true); + } else if (mustUnescape) { + push(params, paramName, token.replace(/\\/g, "")); + } else { + push(params, paramName, token); + } + push(offers, extensionName, params); + } + return offers; + } + function format(extensions) { + return Object.keys(extensions).map((extension) => { + let configurations = extensions[extension]; + if (!Array.isArray(configurations)) configurations = [configurations]; + return configurations.map((params) => { + return [extension].concat( + Object.keys(params).map((k) => { + let values = params[k]; + if (!Array.isArray(values)) values = [values]; + return values.map((v) => v === true ? k : `${k}=${v}`).join("; "); + }) + ).join("; "); + }).join(", "); + }).join(", "); + } + module2.exports = { format, parse }; + } +}); + +// node_modules/ws/lib/websocket.js +var require_websocket = __commonJS({ + "node_modules/ws/lib/websocket.js"(exports2, module2) { + "use strict"; + var EventEmitter = require("events"); + var https = require("https"); + var http = require("http"); + var net = require("net"); + var tls = require("tls"); + var { randomBytes, createHash } = require("crypto"); + var { URL } = require("url"); + var PerMessageDeflate = require_permessage_deflate(); + var Receiver = require_receiver(); + var Sender = require_sender(); + var { + BINARY_TYPES, + EMPTY_BUFFER, + GUID, + kStatusCode, + kWebSocket, + NOOP + } = require_constants(); + var { addEventListener, removeEventListener } = require_event_target(); + var { format, parse } = require_extension(); + var { toBuffer } = require_buffer_util(); + var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"]; + var protocolVersions = [8, 13]; + var closeTimeout = 30 * 1e3; + var WebSocket = class _WebSocket extends EventEmitter { + /** + * Create a new `WebSocket`. + * + * @param {(String|url.URL)} address The URL to which to connect + * @param {(String|String[])} [protocols] The subprotocols + * @param {Object} [options] Connection options + */ + constructor(address, protocols, options) { + super(); + this._binaryType = BINARY_TYPES[0]; + this._closeCode = 1006; + this._closeFrameReceived = false; + this._closeFrameSent = false; + this._closeMessage = ""; + this._closeTimer = null; + this._extensions = {}; + this._protocol = ""; + this._readyState = _WebSocket.CONNECTING; + this._receiver = null; + this._sender = null; + this._socket = null; + if (address !== null) { + this._bufferedAmount = 0; + this._isServer = false; + this._redirects = 0; + if (Array.isArray(protocols)) { + protocols = protocols.join(", "); + } else if (typeof protocols === "object" && protocols !== null) { + options = protocols; + protocols = void 0; + } + initAsClient(this, address, protocols, options); + } else { + this._isServer = true; + } + } + /** + * This deviates from the WHATWG interface since ws doesn't support the + * required default "blob" type (instead we define a custom "nodebuffer" + * type). + * + * @type {String} + */ + get binaryType() { + return this._binaryType; + } + set binaryType(type) { + if (!BINARY_TYPES.includes(type)) return; + this._binaryType = type; + if (this._receiver) this._receiver._binaryType = type; + } + /** + * @type {Number} + */ + get bufferedAmount() { + if (!this._socket) return this._bufferedAmount; + return this._socket._writableState.length + this._sender._bufferedBytes; + } + /** + * @type {String} + */ + get extensions() { + return Object.keys(this._extensions).join(); + } + /** + * @type {String} + */ + get protocol() { + return this._protocol; + } + /** + * @type {Number} + */ + get readyState() { + return this._readyState; + } + /** + * @type {String} + */ + get url() { + return this._url; + } + /** + * Set up the socket and the internal resources. + * + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Number} [maxPayload=0] The maximum allowed message size + * @private + */ + setSocket(socket, head, maxPayload) { + const receiver = new Receiver( + this.binaryType, + this._extensions, + this._isServer, + maxPayload + ); + this._sender = new Sender(socket, this._extensions); + this._receiver = receiver; + this._socket = socket; + receiver[kWebSocket] = this; + socket[kWebSocket] = this; + receiver.on("conclude", receiverOnConclude); + receiver.on("drain", receiverOnDrain); + receiver.on("error", receiverOnError); + receiver.on("message", receiverOnMessage); + receiver.on("ping", receiverOnPing); + receiver.on("pong", receiverOnPong); + socket.setTimeout(0); + socket.setNoDelay(); + if (head.length > 0) socket.unshift(head); + socket.on("close", socketOnClose); + socket.on("data", socketOnData); + socket.on("end", socketOnEnd); + socket.on("error", socketOnError); + this._readyState = _WebSocket.OPEN; + this.emit("open"); + } + /** + * Emit the `'close'` event. + * + * @private + */ + emitClose() { + if (!this._socket) { + this._readyState = _WebSocket.CLOSED; + this.emit("close", this._closeCode, this._closeMessage); + return; + } + if (this._extensions[PerMessageDeflate.extensionName]) { + this._extensions[PerMessageDeflate.extensionName].cleanup(); + } + this._receiver.removeAllListeners(); + this._readyState = _WebSocket.CLOSED; + this.emit("close", this._closeCode, this._closeMessage); + } + /** + * Start a closing handshake. + * + * +----------+ +-----------+ +----------+ + * - - -|ws.close()|-->|close frame|-->|ws.close()|- - - + * | +----------+ +-----------+ +----------+ | + * +----------+ +-----------+ | + * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING + * +----------+ +-----------+ | + * | | | +---+ | + * +------------------------+-->|fin| - - - - + * | +---+ | +---+ + * - - - - -|fin|<---------------------+ + * +---+ + * + * @param {Number} [code] Status code explaining why the connection is closing + * @param {String} [data] A string explaining why the connection is closing + * @public + */ + close(code, data) { + if (this.readyState === _WebSocket.CLOSED) return; + if (this.readyState === _WebSocket.CONNECTING) { + const msg = "WebSocket was closed before the connection was established"; + return abortHandshake(this, this._req, msg); + } + if (this.readyState === _WebSocket.CLOSING) { + if (this._closeFrameSent && this._closeFrameReceived) this._socket.end(); + return; + } + this._readyState = _WebSocket.CLOSING; + this._sender.close(code, data, !this._isServer, (err) => { + if (err) return; + this._closeFrameSent = true; + if (this._closeFrameReceived) this._socket.end(); + }); + this._closeTimer = setTimeout( + this._socket.destroy.bind(this._socket), + closeTimeout + ); + } + /** + * Send a ping. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the ping is sent + * @public + */ + ping(data, mask, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof data === "function") { + cb = data; + data = mask = void 0; + } else if (typeof mask === "function") { + cb = mask; + mask = void 0; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + if (mask === void 0) mask = !this._isServer; + this._sender.ping(data || EMPTY_BUFFER, mask, cb); + } + /** + * Send a pong. + * + * @param {*} [data] The data to send + * @param {Boolean} [mask] Indicates whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when the pong is sent + * @public + */ + pong(data, mask, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof data === "function") { + cb = data; + data = mask = void 0; + } else if (typeof mask === "function") { + cb = mask; + mask = void 0; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + if (mask === void 0) mask = !this._isServer; + this._sender.pong(data || EMPTY_BUFFER, mask, cb); + } + /** + * Send a data message. + * + * @param {*} data The message to send + * @param {Object} [options] Options object + * @param {Boolean} [options.compress] Specifies whether or not to compress + * `data` + * @param {Boolean} [options.binary] Specifies whether `data` is binary or + * text + * @param {Boolean} [options.fin=true] Specifies whether the fragment is the + * last one + * @param {Boolean} [options.mask] Specifies whether or not to mask `data` + * @param {Function} [cb] Callback which is executed when data is written out + * @public + */ + send(data, options, cb) { + if (this.readyState === _WebSocket.CONNECTING) { + throw new Error("WebSocket is not open: readyState 0 (CONNECTING)"); + } + if (typeof options === "function") { + cb = options; + options = {}; + } + if (typeof data === "number") data = data.toString(); + if (this.readyState !== _WebSocket.OPEN) { + sendAfterClose(this, data, cb); + return; + } + const opts = { + binary: typeof data !== "string", + mask: !this._isServer, + compress: true, + fin: true, + ...options + }; + if (!this._extensions[PerMessageDeflate.extensionName]) { + opts.compress = false; + } + this._sender.send(data || EMPTY_BUFFER, opts, cb); + } + /** + * Forcibly close the connection. + * + * @public + */ + terminate() { + if (this.readyState === _WebSocket.CLOSED) return; + if (this.readyState === _WebSocket.CONNECTING) { + const msg = "WebSocket was closed before the connection was established"; + return abortHandshake(this, this._req, msg); + } + if (this._socket) { + this._readyState = _WebSocket.CLOSING; + this._socket.destroy(); + } + } + }; + readyStates.forEach((readyState, i) => { + const descriptor = { enumerable: true, value: i }; + Object.defineProperty(WebSocket.prototype, readyState, descriptor); + Object.defineProperty(WebSocket, readyState, descriptor); + }); + [ + "binaryType", + "bufferedAmount", + "extensions", + "protocol", + "readyState", + "url" + ].forEach((property) => { + Object.defineProperty(WebSocket.prototype, property, { enumerable: true }); + }); + ["open", "error", "close", "message"].forEach((method) => { + Object.defineProperty(WebSocket.prototype, `on${method}`, { + configurable: true, + enumerable: true, + /** + * Return the listener of the event. + * + * @return {(Function|undefined)} The event listener or `undefined` + * @public + */ + get() { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) return listeners[i]._listener; + } + return void 0; + }, + /** + * Add a listener for the event. + * + * @param {Function} listener The listener to add + * @public + */ + set(listener) { + const listeners = this.listeners(method); + for (let i = 0; i < listeners.length; i++) { + if (listeners[i]._listener) this.removeListener(method, listeners[i]); + } + this.addEventListener(method, listener); + } + }); + }); + WebSocket.prototype.addEventListener = addEventListener; + WebSocket.prototype.removeEventListener = removeEventListener; + module2.exports = WebSocket; + function initAsClient(websocket, address, protocols, options) { + const opts = { + protocolVersion: protocolVersions[1], + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: true, + followRedirects: false, + maxRedirects: 10, + ...options, + createConnection: void 0, + socketPath: void 0, + hostname: void 0, + protocol: void 0, + timeout: void 0, + method: void 0, + host: void 0, + path: void 0, + port: void 0 + }; + if (!protocolVersions.includes(opts.protocolVersion)) { + throw new RangeError( + `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})` + ); + } + let parsedUrl; + if (address instanceof URL) { + parsedUrl = address; + websocket._url = address.href; + } else { + parsedUrl = new URL(address); + websocket._url = address; + } + const isUnixSocket = parsedUrl.protocol === "ws+unix:"; + if (!parsedUrl.host && (!isUnixSocket || !parsedUrl.pathname)) { + throw new Error(`Invalid URL: ${websocket.url}`); + } + const isSecure = parsedUrl.protocol === "wss:" || parsedUrl.protocol === "https:"; + const defaultPort = isSecure ? 443 : 80; + const key = randomBytes(16).toString("base64"); + const get = isSecure ? https.get : http.get; + let perMessageDeflate; + opts.createConnection = isSecure ? tlsConnect : netConnect; + opts.defaultPort = opts.defaultPort || defaultPort; + opts.port = parsedUrl.port || defaultPort; + opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname; + opts.headers = { + "Sec-WebSocket-Version": opts.protocolVersion, + "Sec-WebSocket-Key": key, + Connection: "Upgrade", + Upgrade: "websocket", + ...opts.headers + }; + opts.path = parsedUrl.pathname + parsedUrl.search; + opts.timeout = opts.handshakeTimeout; + if (opts.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate( + opts.perMessageDeflate !== true ? opts.perMessageDeflate : {}, + false, + opts.maxPayload + ); + opts.headers["Sec-WebSocket-Extensions"] = format({ + [PerMessageDeflate.extensionName]: perMessageDeflate.offer() + }); + } + if (protocols) { + opts.headers["Sec-WebSocket-Protocol"] = protocols; + } + if (opts.origin) { + if (opts.protocolVersion < 13) { + opts.headers["Sec-WebSocket-Origin"] = opts.origin; + } else { + opts.headers.Origin = opts.origin; + } + } + if (parsedUrl.username || parsedUrl.password) { + opts.auth = `${parsedUrl.username}:${parsedUrl.password}`; + } + if (isUnixSocket) { + const parts = opts.path.split(":"); + opts.socketPath = parts[0]; + opts.path = parts[1]; + } + let req = websocket._req = get(opts); + if (opts.timeout) { + req.on("timeout", () => { + abortHandshake(websocket, req, "Opening handshake has timed out"); + }); + } + req.on("error", (err) => { + if (req === null || req.aborted) return; + req = websocket._req = null; + websocket._readyState = WebSocket.CLOSING; + websocket.emit("error", err); + websocket.emitClose(); + }); + req.on("response", (res) => { + const location = res.headers.location; + const statusCode = res.statusCode; + if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) { + if (++websocket._redirects > opts.maxRedirects) { + abortHandshake(websocket, req, "Maximum redirects exceeded"); + return; + } + req.abort(); + const addr = new URL(location, address); + initAsClient(websocket, addr, protocols, options); + } else if (!websocket.emit("unexpected-response", req, res)) { + abortHandshake( + websocket, + req, + `Unexpected server response: ${res.statusCode}` + ); + } + }); + req.on("upgrade", (res, socket, head) => { + websocket.emit("upgrade", res); + if (websocket.readyState !== WebSocket.CONNECTING) return; + req = websocket._req = null; + const digest = createHash("sha1").update(key + GUID).digest("base64"); + if (res.headers["sec-websocket-accept"] !== digest) { + abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header"); + return; + } + const serverProt = res.headers["sec-websocket-protocol"]; + const protList = (protocols || "").split(/, */); + let protError; + if (!protocols && serverProt) { + protError = "Server sent a subprotocol but none was requested"; + } else if (protocols && !serverProt) { + protError = "Server sent no subprotocol"; + } else if (serverProt && !protList.includes(serverProt)) { + protError = "Server sent an invalid subprotocol"; + } + if (protError) { + abortHandshake(websocket, socket, protError); + return; + } + if (serverProt) websocket._protocol = serverProt; + if (perMessageDeflate) { + try { + const extensions = parse(res.headers["sec-websocket-extensions"]); + if (extensions[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]); + websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + abortHandshake( + websocket, + socket, + "Invalid Sec-WebSocket-Extensions header" + ); + return; + } + } + websocket.setSocket(socket, head, opts.maxPayload); + }); + } + function netConnect(options) { + options.path = options.socketPath; + return net.connect(options); + } + function tlsConnect(options) { + options.path = void 0; + if (!options.servername && options.servername !== "") { + options.servername = net.isIP(options.host) ? "" : options.host; + } + return tls.connect(options); + } + function abortHandshake(websocket, stream, message) { + websocket._readyState = WebSocket.CLOSING; + const err = new Error(message); + Error.captureStackTrace(err, abortHandshake); + if (stream.setHeader) { + stream.abort(); + if (stream.socket && !stream.socket.destroyed) { + stream.socket.destroy(); + } + stream.once("abort", websocket.emitClose.bind(websocket)); + websocket.emit("error", err); + } else { + stream.destroy(err); + stream.once("error", websocket.emit.bind(websocket, "error")); + stream.once("close", websocket.emitClose.bind(websocket)); + } + } + function sendAfterClose(websocket, data, cb) { + if (data) { + const length = toBuffer(data).length; + if (websocket._socket) websocket._sender._bufferedBytes += length; + else websocket._bufferedAmount += length; + } + if (cb) { + const err = new Error( + `WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})` + ); + cb(err); + } + } + function receiverOnConclude(code, reason) { + const websocket = this[kWebSocket]; + websocket._socket.removeListener("data", socketOnData); + websocket._socket.resume(); + websocket._closeFrameReceived = true; + websocket._closeMessage = reason; + websocket._closeCode = code; + if (code === 1005) websocket.close(); + else websocket.close(code, reason); + } + function receiverOnDrain() { + this[kWebSocket]._socket.resume(); + } + function receiverOnError(err) { + const websocket = this[kWebSocket]; + websocket._socket.removeListener("data", socketOnData); + websocket._readyState = WebSocket.CLOSING; + websocket._closeCode = err[kStatusCode]; + websocket.emit("error", err); + websocket._socket.destroy(); + } + function receiverOnFinish() { + this[kWebSocket].emitClose(); + } + function receiverOnMessage(data) { + this[kWebSocket].emit("message", data); + } + function receiverOnPing(data) { + const websocket = this[kWebSocket]; + websocket.pong(data, !websocket._isServer, NOOP); + websocket.emit("ping", data); + } + function receiverOnPong(data) { + this[kWebSocket].emit("pong", data); + } + function socketOnClose() { + const websocket = this[kWebSocket]; + this.removeListener("close", socketOnClose); + this.removeListener("end", socketOnEnd); + websocket._readyState = WebSocket.CLOSING; + websocket._socket.read(); + websocket._receiver.end(); + this.removeListener("data", socketOnData); + this[kWebSocket] = void 0; + clearTimeout(websocket._closeTimer); + if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) { + websocket.emitClose(); + } else { + websocket._receiver.on("error", receiverOnFinish); + websocket._receiver.on("finish", receiverOnFinish); + } + } + function socketOnData(chunk) { + if (!this[kWebSocket]._receiver.write(chunk)) { + this.pause(); + } + } + function socketOnEnd() { + const websocket = this[kWebSocket]; + websocket._readyState = WebSocket.CLOSING; + websocket._receiver.end(); + this.end(); + } + function socketOnError() { + const websocket = this[kWebSocket]; + this.removeListener("error", socketOnError); + this.on("error", NOOP); + if (websocket) { + websocket._readyState = WebSocket.CLOSING; + this.destroy(); + } + } + } +}); + +// node_modules/ws/lib/stream.js +var require_stream = __commonJS({ + "node_modules/ws/lib/stream.js"(exports2, module2) { + "use strict"; + var { Duplex } = require("stream"); + function emitClose(stream) { + stream.emit("close"); + } + function duplexOnEnd() { + if (!this.destroyed && this._writableState.finished) { + this.destroy(); + } + } + function duplexOnError(err) { + this.removeListener("error", duplexOnError); + this.destroy(); + if (this.listenerCount("error") === 0) { + this.emit("error", err); + } + } + function createWebSocketStream(ws, options) { + let resumeOnReceiverDrain = true; + function receiverOnDrain() { + if (resumeOnReceiverDrain) ws._socket.resume(); + } + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + ws._receiver.removeAllListeners("drain"); + ws._receiver.on("drain", receiverOnDrain); + }); + } else { + ws._receiver.removeAllListeners("drain"); + ws._receiver.on("drain", receiverOnDrain); + } + const duplex = new Duplex({ + ...options, + autoDestroy: false, + emitClose: false, + objectMode: false, + writableObjectMode: false + }); + ws.on("message", function message(msg) { + if (!duplex.push(msg)) { + resumeOnReceiverDrain = false; + ws._socket.pause(); + } + }); + ws.once("error", function error(err) { + if (duplex.destroyed) return; + duplex.destroy(err); + }); + ws.once("close", function close() { + if (duplex.destroyed) return; + duplex.push(null); + }); + duplex._destroy = function(err, callback) { + if (ws.readyState === ws.CLOSED) { + callback(err); + process.nextTick(emitClose, duplex); + return; + } + let called = false; + ws.once("error", function error(err2) { + called = true; + callback(err2); + }); + ws.once("close", function close() { + if (!called) callback(err); + process.nextTick(emitClose, duplex); + }); + ws.terminate(); + }; + duplex._final = function(callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + duplex._final(callback); + }); + return; + } + if (ws._socket === null) return; + if (ws._socket._writableState.finished) { + callback(); + if (duplex._readableState.endEmitted) duplex.destroy(); + } else { + ws._socket.once("finish", function finish() { + callback(); + }); + ws.close(); + } + }; + duplex._read = function() { + if (ws.readyState === ws.OPEN && !resumeOnReceiverDrain) { + resumeOnReceiverDrain = true; + if (!ws._receiver._writableState.needDrain) ws._socket.resume(); + } + }; + duplex._write = function(chunk, encoding, callback) { + if (ws.readyState === ws.CONNECTING) { + ws.once("open", function open() { + duplex._write(chunk, encoding, callback); + }); + return; + } + ws.send(chunk, callback); + }; + duplex.on("end", duplexOnEnd); + duplex.on("error", duplexOnError); + return duplex; + } + module2.exports = createWebSocketStream; + } +}); + +// node_modules/ws/lib/websocket-server.js +var require_websocket_server = __commonJS({ + "node_modules/ws/lib/websocket-server.js"(exports2, module2) { + "use strict"; + var EventEmitter = require("events"); + var { createHash } = require("crypto"); + var { createServer, STATUS_CODES } = require("http"); + var PerMessageDeflate = require_permessage_deflate(); + var WebSocket = require_websocket(); + var { format, parse } = require_extension(); + var { GUID, kWebSocket } = require_constants(); + var keyRegex = /^[+/0-9A-Za-z]{22}==$/; + var WebSocketServer = class extends EventEmitter { + /** + * Create a `WebSocketServer` instance. + * + * @param {Object} options Configuration options + * @param {Number} [options.backlog=511] The maximum length of the queue of + * pending connections + * @param {Boolean} [options.clientTracking=true] Specifies whether or not to + * track clients + * @param {Function} [options.handleProtocols] A hook to handle protocols + * @param {String} [options.host] The hostname where to bind the server + * @param {Number} [options.maxPayload=104857600] The maximum allowed message + * size + * @param {Boolean} [options.noServer=false] Enable no server mode + * @param {String} [options.path] Accept only connections matching this path + * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable + * permessage-deflate + * @param {Number} [options.port] The port where to bind the server + * @param {http.Server} [options.server] A pre-created HTTP/S server to use + * @param {Function} [options.verifyClient] A hook to reject connections + * @param {Function} [callback] A listener for the `listening` event + */ + constructor(options, callback) { + super(); + options = { + maxPayload: 100 * 1024 * 1024, + perMessageDeflate: false, + handleProtocols: null, + clientTracking: true, + verifyClient: null, + noServer: false, + backlog: null, + // use default (511 as implemented in net.js) + server: null, + host: null, + path: null, + port: null, + ...options + }; + if (options.port == null && !options.server && !options.noServer) { + throw new TypeError( + 'One of the "port", "server", or "noServer" options must be specified' + ); + } + if (options.port != null) { + this._server = createServer((req, res) => { + const body = STATUS_CODES[426]; + res.writeHead(426, { + "Content-Length": body.length, + "Content-Type": "text/plain" + }); + res.end(body); + }); + this._server.listen( + options.port, + options.host, + options.backlog, + callback + ); + } else if (options.server) { + this._server = options.server; + } + if (this._server) { + const emitConnection = this.emit.bind(this, "connection"); + this._removeListeners = addListeners(this._server, { + listening: this.emit.bind(this, "listening"), + error: this.emit.bind(this, "error"), + upgrade: (req, socket, head) => { + this.handleUpgrade(req, socket, head, emitConnection); + } + }); + } + if (options.perMessageDeflate === true) options.perMessageDeflate = {}; + if (options.clientTracking) this.clients = /* @__PURE__ */ new Set(); + this.options = options; + } + /** + * Returns the bound address, the address family name, and port of the server + * as reported by the operating system if listening on an IP socket. + * If the server is listening on a pipe or UNIX domain socket, the name is + * returned as a string. + * + * @return {(Object|String|null)} The address of the server + * @public + */ + address() { + if (this.options.noServer) { + throw new Error('The server is operating in "noServer" mode'); + } + if (!this._server) return null; + return this._server.address(); + } + /** + * Close the server. + * + * @param {Function} [cb] Callback + * @public + */ + close(cb) { + if (cb) this.once("close", cb); + if (this.clients) { + for (const client of this.clients) client.terminate(); + } + const server = this._server; + if (server) { + this._removeListeners(); + this._removeListeners = this._server = null; + if (this.options.port != null) { + server.close(() => this.emit("close")); + return; + } + } + process.nextTick(emitClose, this); + } + /** + * See if a given request should be handled by this server instance. + * + * @param {http.IncomingMessage} req Request object to inspect + * @return {Boolean} `true` if the request is valid, else `false` + * @public + */ + shouldHandle(req) { + if (this.options.path) { + const index = req.url.indexOf("?"); + const pathname = index !== -1 ? req.url.slice(0, index) : req.url; + if (pathname !== this.options.path) return false; + } + return true; + } + /** + * Handle a HTTP Upgrade request. + * + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @public + */ + handleUpgrade(req, socket, head, cb) { + socket.on("error", socketOnError); + const key = req.headers["sec-websocket-key"] !== void 0 ? req.headers["sec-websocket-key"].trim() : false; + const version = +req.headers["sec-websocket-version"]; + const extensions = {}; + if (req.method !== "GET" || req.headers.upgrade.toLowerCase() !== "websocket" || !key || !keyRegex.test(key) || version !== 8 && version !== 13 || !this.shouldHandle(req)) { + return abortHandshake(socket, 400); + } + if (this.options.perMessageDeflate) { + const perMessageDeflate = new PerMessageDeflate( + this.options.perMessageDeflate, + true, + this.options.maxPayload + ); + try { + const offers = parse(req.headers["sec-websocket-extensions"]); + if (offers[PerMessageDeflate.extensionName]) { + perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + } catch (err) { + return abortHandshake(socket, 400); + } + } + if (this.options.verifyClient) { + const info = { + origin: req.headers[`${version === 8 ? "sec-websocket-origin" : "origin"}`], + secure: !!(req.socket.authorized || req.socket.encrypted), + req + }; + if (this.options.verifyClient.length === 2) { + this.options.verifyClient(info, (verified, code, message, headers) => { + if (!verified) { + return abortHandshake(socket, code || 401, message, headers); + } + this.completeUpgrade(key, extensions, req, socket, head, cb); + }); + return; + } + if (!this.options.verifyClient(info)) return abortHandshake(socket, 401); + } + this.completeUpgrade(key, extensions, req, socket, head, cb); + } + /** + * Upgrade the connection to WebSocket. + * + * @param {String} key The value of the `Sec-WebSocket-Key` header + * @param {Object} extensions The accepted extensions + * @param {http.IncomingMessage} req The request object + * @param {net.Socket} socket The network socket between the server and client + * @param {Buffer} head The first packet of the upgraded stream + * @param {Function} cb Callback + * @throws {Error} If called more than once with the same socket + * @private + */ + completeUpgrade(key, extensions, req, socket, head, cb) { + if (!socket.readable || !socket.writable) return socket.destroy(); + if (socket[kWebSocket]) { + throw new Error( + "server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration" + ); + } + const digest = createHash("sha1").update(key + GUID).digest("base64"); + const headers = [ + "HTTP/1.1 101 Switching Protocols", + "Upgrade: websocket", + "Connection: Upgrade", + `Sec-WebSocket-Accept: ${digest}` + ]; + const ws = new WebSocket(null); + let protocol = req.headers["sec-websocket-protocol"]; + if (protocol) { + protocol = protocol.split(",").map(trim); + if (this.options.handleProtocols) { + protocol = this.options.handleProtocols(protocol, req); + } else { + protocol = protocol[0]; + } + if (protocol) { + headers.push(`Sec-WebSocket-Protocol: ${protocol}`); + ws._protocol = protocol; + } + } + if (extensions[PerMessageDeflate.extensionName]) { + const params = extensions[PerMessageDeflate.extensionName].params; + const value = format({ + [PerMessageDeflate.extensionName]: [params] + }); + headers.push(`Sec-WebSocket-Extensions: ${value}`); + ws._extensions = extensions; + } + this.emit("headers", headers, req); + socket.write(headers.concat("\r\n").join("\r\n")); + socket.removeListener("error", socketOnError); + ws.setSocket(socket, head, this.options.maxPayload); + if (this.clients) { + this.clients.add(ws); + ws.on("close", () => this.clients.delete(ws)); + } + cb(ws, req); + } + }; + module2.exports = WebSocketServer; + function addListeners(server, map) { + for (const event of Object.keys(map)) server.on(event, map[event]); + return function removeListeners() { + for (const event of Object.keys(map)) { + server.removeListener(event, map[event]); + } + }; + } + function emitClose(server) { + server.emit("close"); + } + function socketOnError() { + this.destroy(); + } + function abortHandshake(socket, code, message, headers) { + if (socket.writable) { + message = message || STATUS_CODES[code]; + headers = { + Connection: "close", + "Content-Type": "text/html", + "Content-Length": Buffer.byteLength(message), + ...headers + }; + socket.write( + `HTTP/1.1 ${code} ${STATUS_CODES[code]}\r +` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message + ); + } + socket.removeListener("error", socketOnError); + socket.destroy(); + } + function trim(str) { + return str.trim(); + } + } +}); + +// node_modules/ws/index.js +var require_ws = __commonJS({ + "node_modules/ws/index.js"(exports2, module2) { + "use strict"; + var WebSocket = require_websocket(); + WebSocket.createWebSocketStream = require_stream(); + WebSocket.Server = require_websocket_server(); + WebSocket.Receiver = require_receiver(); + WebSocket.Sender = require_sender(); + module2.exports = WebSocket; + } +}); + +// node_modules/@ethersproject/providers/lib/ws.js +var require_ws2 = __commonJS({ + "node_modules/@ethersproject/providers/lib/ws.js"(exports2) { + "use strict"; + var __importDefault = exports2 && exports2.__importDefault || function(mod) { + return mod && mod.__esModule ? mod : { "default": mod }; + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WebSocket = void 0; + var ws_1 = __importDefault(require_ws()); + exports2.WebSocket = ws_1.default; + } +}); + +// node_modules/@ethersproject/providers/lib/websocket-provider.js +var require_websocket_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/websocket-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.WebSocketProvider = void 0; + var bignumber_1 = require_lib3(); + var properties_1 = require_lib4(); + var json_rpc_provider_1 = require_json_rpc_provider(); + var ws_1 = require_ws2(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var NextId = 1; + var WebSocketProvider = ( + /** @class */ + function(_super) { + __extends(WebSocketProvider2, _super); + function WebSocketProvider2(url, network) { + var _this = this; + if (network === "any") { + logger.throwError("WebSocketProvider does not support 'any' network yet", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "network:any" + }); + } + _this = _super.call(this, url, network) || this; + _this._pollingInterval = -1; + _this._wsReady = false; + (0, properties_1.defineReadOnly)(_this, "_websocket", new ws_1.WebSocket(_this.connection.url)); + (0, properties_1.defineReadOnly)(_this, "_requests", {}); + (0, properties_1.defineReadOnly)(_this, "_subs", {}); + (0, properties_1.defineReadOnly)(_this, "_subIds", {}); + (0, properties_1.defineReadOnly)(_this, "_detectNetwork", _super.prototype.detectNetwork.call(_this)); + _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 !== void 0) { + request.callback(null, result.result); + _this.emit("debug", { + action: "response", + request: JSON.parse(request.payload), + response: result.result, + provider: _this + }); + } else { + var error = null; + if (result.error) { + error = new Error(result.error.message || "unknown error"); + (0, properties_1.defineReadOnly)(error, "code", result.error.code || null); + (0, properties_1.defineReadOnly)(error, "response", data); + } else { + error = new Error("unknown error"); + } + request.callback(error, void 0); + _this.emit("debug", { + action: "response", + error, + request: JSON.parse(request.payload), + provider: _this + }); + } + } else if (result.method === "eth_subscription") { + var sub = _this._subs[result.params.subscription]; + if (sub) { + sub.processFunc(result.params.result); + } + } else { + console.warn("this should not happen"); + } + }; + var fauxPoll = setInterval(function() { + _this.emit("poll"); + }, 1e3); + if (fauxPoll.unref) { + fauxPoll.unref(); + } + return _this; + } + WebSocketProvider2.prototype.detectNetwork = function() { + return this._detectNetwork; + }; + Object.defineProperty(WebSocketProvider2.prototype, "pollingInterval", { + get: function() { + return 0; + }, + set: function(value) { + logger.throwError("cannot set polling interval on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPollingInterval" + }); + }, + enumerable: false, + configurable: true + }); + WebSocketProvider2.prototype.resetEventsBlock = function(blockNumber) { + logger.throwError("cannot reset events block on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "resetEventBlock" + }); + }; + WebSocketProvider2.prototype.poll = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, null]; + }); + }); + }; + Object.defineProperty(WebSocketProvider2.prototype, "polling", { + set: function(value) { + if (!value) { + return; + } + logger.throwError("cannot set polling on WebSocketProvider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { + operation: "setPolling" + }); + }, + enumerable: false, + configurable: true + }); + WebSocketProvider2.prototype.send = function(method, params) { + var _this = 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, + params, + id: rid, + jsonrpc: "2.0" + }); + _this.emit("debug", { + action: "request", + request: JSON.parse(payload), + provider: _this + }); + _this._requests[String(rid)] = { callback, payload }; + if (_this._wsReady) { + _this._websocket.send(payload); + } + }); + }; + WebSocketProvider2.defaultUrl = function() { + return "ws://localhost:8546"; + }; + WebSocketProvider2.prototype._subscribe = function(tag, param, processFunc) { + return __awaiter(this, void 0, void 0, function() { + var subIdPromise, subId; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + subIdPromise = this._subIds[tag]; + if (subIdPromise == null) { + subIdPromise = Promise.all(param).then(function(param2) { + return _this.send("eth_subscribe", param2); + }); + this._subIds[tag] = subIdPromise; + } + return [4, subIdPromise]; + case 1: + subId = _a.sent(); + this._subs[subId] = { tag, processFunc }; + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + WebSocketProvider2.prototype._startEvent = function(event) { + var _this = this; + switch (event.type) { + case "block": + this._subscribe("block", ["newHeads"], function(result) { + var blockNumber = bignumber_1.BigNumber.from(result.number).toNumber(); + _this._emitted.block = blockNumber; + _this.emit("block", blockNumber); + }); + break; + case "pending": + this._subscribe("pending", ["newPendingTransactions"], function(result) { + _this.emit("pending", result); + }); + break; + case "filter": + this._subscribe(event.tag, ["logs", this._getFilter(event.filter)], function(result) { + if (result.removed == null) { + result.removed = false; + } + _this.emit(event.filter, _this.formatter.filterLog(result)); + }); + break; + case "tx": { + var emitReceipt_1 = function(event2) { + var hash = event2.hash; + _this.getTransactionReceipt(hash).then(function(receipt) { + if (!receipt) { + return; + } + _this.emit(hash, receipt); + }); + }; + emitReceipt_1(event); + this._subscribe("tx", ["newHeads"], function(result) { + _this._events.filter(function(e) { + return e.type === "tx"; + }).forEach(emitReceipt_1); + }); + break; + } + case "debug": + case "poll": + case "willPoll": + case "didPoll": + case "error": + break; + default: + console.log("unhandled:", event); + break; + } + }; + WebSocketProvider2.prototype._stopEvent = function(event) { + var _this = this; + var tag = event.tag; + if (event.type === "tx") { + if (this._events.filter(function(e) { + return e.type === "tx"; + }).length) { + return; + } + tag = "tx"; + } else if (this.listenerCount(event.event)) { + return; + } + var subId = this._subIds[tag]; + if (!subId) { + return; + } + delete this._subIds[tag]; + subId.then(function(subId2) { + if (!_this._subs[subId2]) { + return; + } + delete _this._subs[subId2]; + _this.send("eth_unsubscribe", [subId2]); + }); + }; + WebSocketProvider2.prototype.destroy = function() { + return __awaiter(this, void 0, void 0, function() { + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(this._websocket.readyState === ws_1.WebSocket.CONNECTING)) return [3, 2]; + return [4, new Promise(function(resolve) { + _this._websocket.onopen = function() { + resolve(true); + }; + _this._websocket.onerror = function() { + resolve(false); + }; + })]; + case 1: + _a.sent(); + _a.label = 2; + case 2: + this._websocket.close(1e3); + return [ + 2 + /*return*/ + ]; + } + }); + }); + }; + return WebSocketProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.WebSocketProvider = WebSocketProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/url-json-rpc-provider.js +var require_url_json_rpc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/url-json-rpc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.UrlJsonRpcProvider = exports2.StaticJsonRpcProvider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var StaticJsonRpcProvider = ( + /** @class */ + function(_super) { + __extends(StaticJsonRpcProvider2, _super); + function StaticJsonRpcProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + StaticJsonRpcProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var network; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + network = this.network; + if (!(network == null)) return [3, 2]; + return [4, _super.prototype.detectNetwork.call(this)]; + case 1: + network = _a.sent(); + if (!network) { + logger.throwError("no network detected", logger_1.Logger.errors.UNKNOWN_ERROR, {}); + } + if (this._network == null) { + (0, properties_1.defineReadOnly)(this, "_network", network); + this.emit("network", network, null); + } + _a.label = 2; + case 2: + return [2, network]; + } + }); + }); + }; + return StaticJsonRpcProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.StaticJsonRpcProvider = StaticJsonRpcProvider; + var UrlJsonRpcProvider = ( + /** @class */ + function(_super) { + __extends(UrlJsonRpcProvider2, _super); + function UrlJsonRpcProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + logger.checkAbstract(_newTarget, UrlJsonRpcProvider2); + network = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + apiKey = (0, properties_1.getStatic)(_newTarget, "getApiKey")(apiKey); + var connection = (0, properties_1.getStatic)(_newTarget, "getUrl")(network, apiKey); + _this = _super.call(this, connection, network) || this; + if (typeof apiKey === "string") { + (0, properties_1.defineReadOnly)(_this, "apiKey", apiKey); + } else if (apiKey != null) { + Object.keys(apiKey).forEach(function(key) { + (0, properties_1.defineReadOnly)(_this, key, apiKey[key]); + }); + } + return _this; + } + UrlJsonRpcProvider2.prototype._startPending = function() { + logger.warn("WARNING: API provider does not support pending filters"); + }; + UrlJsonRpcProvider2.prototype.isCommunityResource = function() { + return false; + }; + UrlJsonRpcProvider2.prototype.getSigner = function(address) { + return logger.throwError("API provider does not support signing", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" }); + }; + UrlJsonRpcProvider2.prototype.listAccounts = function() { + return Promise.resolve([]); + }; + UrlJsonRpcProvider2.getApiKey = function(apiKey) { + return apiKey; + }; + UrlJsonRpcProvider2.getUrl = function(network, apiKey) { + return logger.throwError("not implemented; sub-classes must override getUrl", logger_1.Logger.errors.NOT_IMPLEMENTED, { + operation: "getUrl" + }); + }; + return UrlJsonRpcProvider2; + }(StaticJsonRpcProvider) + ); + exports2.UrlJsonRpcProvider = UrlJsonRpcProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/alchemy-provider.js +var require_alchemy_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/alchemy-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.AlchemyProvider = exports2.AlchemyWebSocketProvider = void 0; + var properties_1 = require_lib4(); + var formatter_1 = require_formatter(); + var websocket_provider_1 = require_websocket_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; + var AlchemyWebSocketProvider = ( + /** @class */ + function(_super) { + __extends(AlchemyWebSocketProvider2, _super); + function AlchemyWebSocketProvider2(network, apiKey) { + var _this = this; + 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) || this; + (0, properties_1.defineReadOnly)(_this, "apiKey", provider.apiKey); + return _this; + } + AlchemyWebSocketProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return AlchemyWebSocketProvider2; + }(websocket_provider_1.WebSocketProvider) + ); + exports2.AlchemyWebSocketProvider = AlchemyWebSocketProvider; + var AlchemyProvider = ( + /** @class */ + function(_super) { + __extends(AlchemyProvider2, _super); + function AlchemyProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + AlchemyProvider2.getWebSocketProvider = function(network, apiKey) { + return new AlchemyWebSocketProvider(network, apiKey); + }; + AlchemyProvider2.getApiKey = function(apiKey) { + if (apiKey == null) { + return defaultApiKey; + } + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey; + }; + AlchemyProvider2.getUrl = function(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(attempt, url) { + if (apiKey === defaultApiKey) { + (0, formatter_1.showThrottleMessage)(); + } + return Promise.resolve(true); + } + }; + }; + AlchemyProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return AlchemyProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.AlchemyProvider = AlchemyProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/cloudflare-provider.js +var require_cloudflare_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/cloudflare-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.CloudflareProvider = void 0; + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var CloudflareProvider = ( + /** @class */ + function(_super) { + __extends(CloudflareProvider2, _super); + function CloudflareProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + CloudflareProvider2.getApiKey = function(apiKey) { + if (apiKey != null) { + logger.throwArgumentError("apiKey not supported for cloudflare", "apiKey", apiKey); + } + return null; + }; + CloudflareProvider2.getUrl = function(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; + }; + CloudflareProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var block; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "getBlockNumber")) return [3, 2]; + return [4, _super.prototype.perform.call(this, "getBlock", { blockTag: "latest" })]; + case 1: + block = _a.sent(); + return [2, block.number]; + case 2: + return [2, _super.prototype.perform.call(this, method, params)]; + } + }); + }); + }; + return CloudflareProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.CloudflareProvider = CloudflareProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/etherscan-provider.js +var require_etherscan_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/etherscan-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.EtherscanProvider = void 0; + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var transactions_1 = require_lib15(); + var web_1 = require_lib27(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var base_provider_1 = require_base_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; + } + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = (0, bytes_1.hexValue)((0, bytes_1.hexlify)(value)); + } else if (key === "accessList") { + value = "[" + (0, transactions_1.accessListify)(value).map(function(set) { + return '{address:"' + set.address + '",storageKeys:["' + set.storageKeys.join('","') + '"]}'; + }).join(",") + "]"; + } else { + value = (0, bytes_1.hexlify)(value); + } + result[key] = value; + } + return result; + } + function getResult(result) { + 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) { + 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") { + var error = new Error("invalid response"); + error.result = JSON.stringify(result); + throw error; + } + if (result.error) { + var error = new Error(result.error.message || "unknown error"); + if (result.error.code) { + error.code = result.error.code; + } + if (result.error.data) { + error.data = result.error.data; + } + throw error; + } + return result.result; + } + 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) { + if (method === "call" && error.code === logger_1.Logger.errors.SERVER_ERROR) { + var e = error.error; + if (e && (e.message.match(/reverted/i) || e.message.match(/VM execution error/i))) { + var data = e.data; + if (data) { + data = "0x" + data.replace(/^.*0x/i, ""); + } + if ((0, bytes_1.isHexString)(data)) { + return data; + } + logger.throwError("missing revert data in call exception", logger_1.Logger.errors.CALL_EXCEPTION, { + error, + data: "0x" + }); + } + } + var message = error.message; + if (error.code === logger_1.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(); + if (message.match(/insufficient funds/)) { + logger.throwError("insufficient funds for intrinsic transaction cost", logger_1.Logger.errors.INSUFFICIENT_FUNDS, { + error, + method, + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, { + error, + method, + transaction + }); + } + if (message.match(/another transaction with same nonce/)) { + logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, { + error, + method, + 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", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, { + error, + method, + transaction + }); + } + throw error; + } + var EtherscanProvider = ( + /** @class */ + function(_super) { + __extends(EtherscanProvider2, _super); + function EtherscanProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, EtherscanProvider2); + _this = _super.call(this, network) || this; + (0, properties_1.defineReadOnly)(_this, "baseUrl", _this.getBaseUrl()); + (0, properties_1.defineReadOnly)(_this, "apiKey", apiKey || defaultApiKey); + return _this; + } + EtherscanProvider2.prototype.getBaseUrl = function() { + 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); + }; + EtherscanProvider2.prototype.getUrl = function(module3, params) { + var query = Object.keys(params).reduce(function(accum, key) { + var value = params[key]; + if (value != null) { + accum += "&" + key + "=" + value; + } + return accum; + }, ""); + var apiKey = this.apiKey ? "&apikey=" + this.apiKey : ""; + return this.baseUrl + "/api?module=" + module3 + query + apiKey; + }; + EtherscanProvider2.prototype.getPostUrl = function() { + return this.baseUrl + "/api"; + }; + EtherscanProvider2.prototype.getPostData = function(module3, params) { + params.module = module3; + params.apikey = this.apiKey; + return params; + }; + EtherscanProvider2.prototype.fetch = function(module3, params, post) { + return __awaiter(this, void 0, void 0, function() { + var url, payload, procFunc, connection, payloadStr, result; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + url = post ? this.getPostUrl() : this.getUrl(module3, params); + payload = post ? this.getPostData(module3, params) : null; + procFunc = module3 === "proxy" ? getJsonResult : getResult; + this.emit("debug", { + action: "request", + request: url, + provider: this + }); + connection = { + url, + throttleSlotInterval: 1e3, + throttleCallback: function(attempt, url2) { + if (_this.isCommunityResource()) { + (0, formatter_1.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 key + "=" + payload[key]; + }).join("&"); + } + return [4, (0, web_1.fetchJson)(connection, payloadStr, procFunc || getJsonResult)]; + case 1: + result = _a.sent(); + this.emit("debug", { + action: "response", + request: url, + response: (0, properties_1.deepCopy)(result), + provider: this + }); + return [2, result]; + } + }); + }); + }; + EtherscanProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + return __generator(this, function(_a) { + return [2, this.network]; + }); + }); + }; + EtherscanProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var _a, postData, error_1, postData, error_2, args, topic0, logs, blocks, i, log, block, _b; + return __generator(this, function(_c) { + switch (_c.label) { + case 0: + _a = method; + switch (_a) { + case "getBlockNumber": + return [3, 1]; + case "getGasPrice": + return [3, 2]; + case "getBalance": + return [3, 3]; + case "getTransactionCount": + return [3, 4]; + case "getCode": + return [3, 5]; + case "getStorageAt": + return [3, 6]; + case "sendTransaction": + return [3, 7]; + case "getBlock": + return [3, 8]; + case "getTransaction": + return [3, 9]; + case "getTransactionReceipt": + return [3, 10]; + case "call": + return [3, 11]; + case "estimateGas": + return [3, 15]; + case "getLogs": + return [3, 19]; + case "getEtherPrice": + return [3, 26]; + } + return [3, 28]; + case 1: + return [2, this.fetch("proxy", { action: "eth_blockNumber" })]; + case 2: + return [2, this.fetch("proxy", { action: "eth_gasPrice" })]; + case 3: + return [2, this.fetch("account", { + action: "balance", + address: params.address, + tag: params.blockTag + })]; + case 4: + return [2, this.fetch("proxy", { + action: "eth_getTransactionCount", + address: params.address, + tag: params.blockTag + })]; + case 5: + return [2, this.fetch("proxy", { + action: "eth_getCode", + address: params.address, + tag: params.blockTag + })]; + case 6: + return [2, this.fetch("proxy", { + action: "eth_getStorageAt", + address: params.address, + position: params.position, + tag: params.blockTag + })]; + case 7: + return [2, this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: params.signedTransaction + }, true).catch(function(error) { + return checkError("sendTransaction", error, params.signedTransaction); + })]; + case 8: + if (params.blockTag) { + return [2, this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: params.blockTag, + boolean: params.includeTransactions ? "true" : "false" + })]; + } + throw new Error("getBlock by blockHash not implemented"); + case 9: + return [2, this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: params.transactionHash + })]; + case 10: + return [2, this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: params.transactionHash + })]; + case 11: + if (params.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + postData = getTransactionPostData(params.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + _c.label = 12; + case 12: + _c.trys.push([12, 14, , 15]); + return [4, this.fetch("proxy", postData, true)]; + case 13: + return [2, _c.sent()]; + case 14: + error_1 = _c.sent(); + return [2, checkError("call", error_1, params.transaction)]; + case 15: + postData = getTransactionPostData(params.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + _c.label = 16; + case 16: + _c.trys.push([16, 18, , 19]); + return [4, this.fetch("proxy", postData, true)]; + case 17: + return [2, _c.sent()]; + case 18: + error_2 = _c.sent(); + return [2, checkError("estimateGas", error_2, params.transaction)]; + case 19: + 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; + } + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger.throwError("unsupported topic count", logger_1.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", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { topic0 }); + } + args.topic0 = topic0; + } + } + return [4, this.fetch("logs", args)]; + case 20: + logs = _c.sent(); + blocks = {}; + i = 0; + _c.label = 21; + case 21: + if (!(i < logs.length)) return [3, 25]; + log = logs[i]; + if (log.blockHash != null) { + return [3, 24]; + } + if (!(blocks[log.blockNumber] == null)) return [3, 23]; + return [4, this.getBlock(log.blockNumber)]; + case 22: + block = _c.sent(); + if (block) { + blocks[log.blockNumber] = block.hash; + } + _c.label = 23; + case 23: + log.blockHash = blocks[log.blockNumber]; + _c.label = 24; + case 24: + i++; + return [3, 21]; + case 25: + return [2, logs]; + case 26: + if (this.network.name !== "homestead") { + return [2, 0]; + } + _b = parseFloat; + return [4, this.fetch("stats", { action: "ethprice" })]; + case 27: + return [2, _b.apply(void 0, [_c.sent().ethusd])]; + case 28: + return [3, 29]; + case 29: + return [2, _super.prototype.perform.call(this, method, params)]; + } + }); + }); + }; + EtherscanProvider2.prototype.getHistory = function(addressOrName, startBlock, endBlock) { + return __awaiter(this, void 0, void 0, function() { + var params, result; + var _a; + var _this = this; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + _a = { + action: "txlist" + }; + return [4, this.resolveName(addressOrName)]; + case 1: + params = (_a.address = _b.sent(), _a.startblock = startBlock == null ? 0 : startBlock, _a.endblock = endBlock == null ? 99999999 : endBlock, _a.sort = "asc", _a); + return [4, this.fetch("account", params)]; + case 2: + result = _b.sent(); + return [2, 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 = _this.formatter.transactionResponse(tx); + if (tx.timeStamp) { + item.timestamp = parseInt(tx.timeStamp); + } + return item; + })]; + } + }); + }); + }; + EtherscanProvider2.prototype.isCommunityResource = function() { + return this.apiKey === defaultApiKey; + }; + return EtherscanProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.EtherscanProvider = EtherscanProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/fallback-provider.js +var require_fallback_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/fallback-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + var __awaiter = exports2 && exports2.__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 __generator = exports2 && exports2.__generator || function(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t[0] & 1) throw t[1]; + return t[1]; + }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { + return this; + }), g; + function verb(n) { + return function(v) { + return step([n, v]); + }; + } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e) { + op = [6, e]; + y = 0; + } finally { + f = t = 0; + } + if (op[0] & 5) throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.FallbackProvider = void 0; + var abstract_provider_1 = require_lib12(); + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var properties_1 = require_lib4(); + var random_1 = require_lib22(); + var web_1 = require_lib27(); + var base_provider_1 = require_base_provider(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + function now() { + return (/* @__PURE__ */ new Date()).getTime(); + } + function checkNetworks(networks) { + var result = null; + for (var i = 0; i < networks.length; i++) { + var network = networks[i]; + if (network == null) { + return null; + } + if (result) { + 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); + if (values.length % 2) { + return values[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 (bignumber_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); + } + var nextRid = 1; + function stall(duration) { + var cancel = null; + var timer = null; + var promise = new Promise(function(resolve) { + cancel = function() { + if (timer) { + clearTimeout(timer); + timer = null; + } + resolve(); + }; + timer = setTimeout(cancel, duration); + }); + var wait = function(func) { + promise = promise.then(func); + return promise; + }; + function getPromise() { + return promise; + } + return { cancel, getPromise, wait }; + } + var ForwardErrors = [ + logger_1.Logger.errors.CALL_EXCEPTION, + logger_1.Logger.errors.INSUFFICIENT_FUNDS, + logger_1.Logger.errors.NONCE_EXPIRED, + logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, + logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT + ]; + var ForwardProperties = [ + "address", + "args", + "errorArgs", + "errorSignature", + "method", + "transaction" + ]; + function exposeDebugConfig(config, now2) { + var result = { + weight: config.weight + }; + Object.defineProperty(result, "provider", { get: function() { + return config.provider; + } }); + if (config.start) { + result.start = config.start; + } + if (now2) { + result.duration = now2 - 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) { + var tally = {}; + configs.forEach(function(c) { + var value = normalize(c.result); + if (!tally[value]) { + tally[value] = { count: 0, result: c.result }; + } + tally[value].count++; + }); + 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; + } + } + return void 0; + }; + } + function getProcessFunc(provider, method, params) { + var normalize = serialize; + switch (method) { + case "getBlockNumber": + return function(configs) { + var values = configs.map(function(c) { + return c.result; + }); + var blockNumber = median(configs.map(function(c) { + return c.result; + }), 2); + if (blockNumber == null) { + return void 0; + } + blockNumber = Math.ceil(blockNumber); + if (values.indexOf(blockNumber + 1) >= 0) { + blockNumber++; + } + if (blockNumber >= provider._highestBlockNumber) { + provider._highestBlockNumber = blockNumber; + } + return provider._highestBlockNumber; + }; + case "getGasPrice": + return function(configs) { + var values = configs.map(function(c) { + return c.result; + }); + values.sort(); + return values[Math.floor(values.length / 2)]; + }; + case "getEtherPrice": + return function(configs) { + return median(configs.map(function(c) { + return c.result; + })); + }; + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorageAt": + case "call": + case "estimateGas": + case "getLogs": + break; + case "getTransaction": + case "getTransactionReceipt": + normalize = function(tx) { + if (tx == null) { + return null; + } + tx = (0, properties_1.shallowCopy)(tx); + tx.confirmations = -1; + return serialize(tx); + }; + break; + case "getBlock": + if (params.includeTransactions) { + normalize = function(block) { + if (block == null) { + return null; + } + block = (0, properties_1.shallowCopy)(block); + block.transactions = block.transactions.map(function(tx) { + tx = (0, properties_1.shallowCopy)(tx); + tx.confirmations = -1; + return tx; + }); + return serialize(block); + }; + } else { + normalize = function(block) { + if (block == null) { + return null; + } + return serialize(block); + }; + } + break; + default: + throw new Error("unknown method: " + method); + } + return normalizedTally(normalize, provider.quorum); + } + function waitForSync(config, blockNumber) { + return __awaiter(this, void 0, void 0, function() { + var provider; + return __generator(this, function(_a) { + provider = config.provider; + if (provider.blockNumber != null && provider.blockNumber >= blockNumber || blockNumber === -1) { + return [2, provider]; + } + return [2, (0, web_1.poll)(function() { + return new Promise(function(resolve, reject) { + setTimeout(function() { + if (provider.blockNumber >= blockNumber) { + return resolve(provider); + } + if (config.cancelled) { + return resolve(null); + } + return resolve(void 0); + }, 0); + }); + }, { oncePoll: provider })]; + }); + }); + } + function getRunner(config, currentBlockNumber, method, params) { + return __awaiter(this, void 0, void 0, function() { + var provider, _a, filter; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + provider = config.provider; + _a = method; + switch (_a) { + case "getBlockNumber": + return [3, 1]; + case "getGasPrice": + return [3, 1]; + case "getEtherPrice": + return [3, 2]; + case "getBalance": + return [3, 3]; + case "getTransactionCount": + return [3, 3]; + case "getCode": + return [3, 3]; + case "getStorageAt": + return [3, 6]; + case "getBlock": + return [3, 9]; + case "call": + return [3, 12]; + case "estimateGas": + return [3, 12]; + case "getTransaction": + return [3, 15]; + case "getTransactionReceipt": + return [3, 15]; + case "getLogs": + return [3, 16]; + } + return [3, 19]; + case 1: + return [2, provider[method]()]; + case 2: + if (provider.getEtherPrice) { + return [2, provider.getEtherPrice()]; + } + return [3, 19]; + case 3: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 5]; + return [4, waitForSync(config, currentBlockNumber)]; + case 4: + provider = _b.sent(); + _b.label = 5; + case 5: + return [2, provider[method](params.address, params.blockTag || "latest")]; + case 6: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 8]; + return [4, waitForSync(config, currentBlockNumber)]; + case 7: + provider = _b.sent(); + _b.label = 8; + case 8: + return [2, provider.getStorageAt(params.address, params.position, params.blockTag || "latest")]; + case 9: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 11]; + return [4, waitForSync(config, currentBlockNumber)]; + case 10: + provider = _b.sent(); + _b.label = 11; + case 11: + return [2, provider[params.includeTransactions ? "getBlockWithTransactions" : "getBlock"](params.blockTag || params.blockHash)]; + case 12: + if (!(params.blockTag && (0, bytes_1.isHexString)(params.blockTag))) return [3, 14]; + return [4, waitForSync(config, currentBlockNumber)]; + case 13: + provider = _b.sent(); + _b.label = 14; + case 14: + return [2, provider[method](params.transaction)]; + case 15: + return [2, provider[method](params.transactionHash)]; + case 16: + filter = params.filter; + if (!(filter.fromBlock && (0, bytes_1.isHexString)(filter.fromBlock) || filter.toBlock && (0, bytes_1.isHexString)(filter.toBlock))) return [3, 18]; + return [4, waitForSync(config, currentBlockNumber)]; + case 17: + provider = _b.sent(); + _b.label = 18; + case 18: + return [2, provider.getLogs(filter)]; + case 19: + return [2, logger.throwError("unknown method error", logger_1.Logger.errors.UNKNOWN_ERROR, { + method, + params + })]; + } + }); + }); + } + var FallbackProvider = ( + /** @class */ + function(_super) { + __extends(FallbackProvider2, _super); + function FallbackProvider2(providers, quorum) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, FallbackProvider2); + if (providers.length === 0) { + logger.throwArgumentError("missing providers", "providers", providers); + } + var providerConfigs = providers.map(function(configOrProvider, index) { + if (abstract_provider_1.Provider.isProvider(configOrProvider)) { + var stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2e3 : 750; + var priority = 1; + return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority }); + } + var config = (0, properties_1.shallowCopy)(configOrProvider); + if (config.priority == null) { + config.priority = 1; + } + if (config.stallTimeout == null) { + config.stallTimeout = (0, formatter_1.isCommunityResource)(configOrProvider) ? 2e3 : 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[" + 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); + } + var networkOrReady = checkNetworks(providerConfigs.map(function(c) { + return c.provider.network; + })); + if (networkOrReady == null) { + networkOrReady = new Promise(function(resolve, reject) { + setTimeout(function() { + _this.detectNetwork().then(resolve, reject); + }, 0); + }); + } + _this = _super.call(this, networkOrReady) || this; + (0, properties_1.defineReadOnly)(_this, "providerConfigs", Object.freeze(providerConfigs)); + (0, properties_1.defineReadOnly)(_this, "quorum", quorum); + _this._highestBlockNumber = -1; + return _this; + } + FallbackProvider2.prototype.detectNetwork = function() { + return __awaiter(this, void 0, void 0, function() { + var networks; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + return [4, Promise.all(this.providerConfigs.map(function(c) { + return c.provider.getNetwork(); + }))]; + case 1: + networks = _a.sent(); + return [2, checkNetworks(networks)]; + } + }); + }); + }; + FallbackProvider2.prototype.perform = function(method, params) { + return __awaiter(this, void 0, void 0, function() { + var results, i_1, result, processFunc, configs, currentBlockNumber, i, first, _loop_1, this_1, state_1; + var _this = this; + return __generator(this, function(_a) { + switch (_a.label) { + case 0: + if (!(method === "sendTransaction")) return [3, 2]; + return [4, Promise.all(this.providerConfigs.map(function(c) { + return c.provider.sendTransaction(params.signedTransaction).then(function(result2) { + return result2.hash; + }, function(error) { + return error; + }); + }))]; + case 1: + results = _a.sent(); + for (i_1 = 0; i_1 < results.length; i_1++) { + result = results[i_1]; + if (typeof result === "string") { + return [2, result]; + } + } + throw results[0]; + case 2: + if (!(this._highestBlockNumber === -1 && method !== "getBlockNumber")) return [3, 4]; + return [4, this.getBlockNumber()]; + case 3: + _a.sent(); + _a.label = 4; + case 4: + processFunc = getProcessFunc(this, method, params); + configs = (0, random_1.shuffled)(this.providerConfigs.map(properties_1.shallowCopy)); + configs.sort(function(a, b) { + return a.priority - b.priority; + }); + currentBlockNumber = this._highestBlockNumber; + i = 0; + first = true; + _loop_1 = function() { + var t0, inflightWeight, _loop_2, waiting, results2, result2, errors; + return __generator(this, function(_b) { + switch (_b.label) { + case 0: + t0 = now(); + inflightWeight = configs.filter(function(c) { + return c.runner && t0 - c.start < c.stallTimeout; + }).reduce(function(accum, c) { + return accum + c.weight; + }, 0); + _loop_2 = function() { + 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(result3) { + config.done = true; + config.result = result3; + if (_this.listenerCount("debug")) { + _this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, now()), + request: { method, params: (0, properties_1.deepCopy)(params) }, + provider: _this + }); + } + }, function(error) { + config.done = true; + config.error = error; + if (_this.listenerCount("debug")) { + _this.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, now()), + request: { method, params: (0, properties_1.deepCopy)(params) }, + provider: _this + }); + } + }); + if (this_1.listenerCount("debug")) { + this_1.emit("debug", { + action: "request", + rid, + backend: exposeDebugConfig(config, null), + request: { method, params: (0, properties_1.deepCopy)(params) }, + provider: this_1 + }); + } + inflightWeight += config.weight; + }; + while (inflightWeight < this_1.quorum && i < configs.length) { + _loop_2(); + } + 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) return [3, 2]; + return [4, Promise.race(waiting)]; + case 1: + _b.sent(); + _b.label = 2; + case 2: + results2 = configs.filter(function(c) { + return c.done && c.error == null; + }); + if (!(results2.length >= this_1.quorum)) return [3, 5]; + result2 = processFunc(results2); + if (result2 !== void 0) { + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return [2, { value: result2 }]; + } + if (!!first) return [3, 4]; + return [4, stall(100).getPromise()]; + case 3: + _b.sent(); + _b.label = 4; + case 4: + first = false; + _b.label = 5; + case 5: + 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 < _this.quorum) { + return; + } + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + var e = tally.error; + var props = {}; + ForwardProperties.forEach(function(name2) { + if (e[name2] == null) { + return; + } + props[name2] = e[name2]; + }); + logger.throwError(e.reason || e.message, errorCode, props); + }); + if (configs.filter(function(c) { + return !c.done; + }).length === 0) { + return [2, "break"]; + } + return [ + 2 + /*return*/ + ]; + } + }); + }; + this_1 = this; + _a.label = 5; + case 5: + if (false) return [3, 7]; + return [5, _loop_1()]; + case 6: + state_1 = _a.sent(); + if (typeof state_1 === "object") + return [2, state_1.value]; + if (state_1 === "break") + return [3, 7]; + return [3, 5]; + case 7: + configs.forEach(function(c) { + if (c.staller) { + c.staller.cancel(); + } + c.cancelled = true; + }); + return [2, logger.throwError("failed to meet quorum", logger_1.Logger.errors.SERVER_ERROR, { + method, + params, + //results: configs.map((c) => c.result), + //errors: configs.map((c) => c.error), + results: configs.map(function(c) { + return exposeDebugConfig(c); + }), + provider: this + })]; + } + }); + }); + }; + return FallbackProvider2; + }(base_provider_1.BaseProvider) + ); + exports2.FallbackProvider = FallbackProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/ipc-provider.js +var require_ipc_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/ipc-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.IpcProvider = void 0; + var net_1 = require("net"); + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var IpcProvider = ( + /** @class */ + function(_super) { + __extends(IpcProvider2, _super); + function IpcProvider2(path, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, IpcProvider2); + if (path == null) { + logger.throwError("missing path", logger_1.Logger.errors.MISSING_ARGUMENT, { arg: "path" }); + } + _this = _super.call(this, "ipc://" + path, network) || this; + (0, properties_1.defineReadOnly)(_this, "path", path); + return _this; + } + IpcProvider2.prototype.send = function(method, params) { + var _this = this; + var payload = JSON.stringify({ + method, + params, + id: 42, + jsonrpc: "2.0" + }); + return new Promise(function(resolve, reject) { + var response = Buffer.alloc(0); + var stream = (0, net_1.connect)(_this.path); + stream.on("data", function(data) { + response = Buffer.concat([response, data]); + }); + stream.on("end", function() { + try { + resolve(JSON.parse(response.toString()).result); + stream.destroy(); + } catch (error) { + reject(error); + stream.destroy(); + } + }); + stream.on("error", function(error) { + reject(error); + stream.destroy(); + }); + stream.write(payload); + stream.end(); + }); + }; + return IpcProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.IpcProvider = IpcProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/infura-provider.js +var require_infura_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/infura-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.InfuraProvider = exports2.InfuraWebSocketProvider = void 0; + var properties_1 = require_lib4(); + var websocket_provider_1 = require_websocket_provider(); + var formatter_1 = require_formatter(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultProjectId = "84842078b09946638c03157f83405213"; + var InfuraWebSocketProvider = ( + /** @class */ + function(_super) { + __extends(InfuraWebSocketProvider2, _super); + function InfuraWebSocketProvider2(network, apiKey) { + var _this = this; + var provider = new InfuraProvider(network, apiKey); + var connection = provider.connection; + if (connection.password) { + logger.throwError("INFURA WebSocket project secrets unsupported", logger_1.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) || this; + (0, properties_1.defineReadOnly)(_this, "apiKey", provider.projectId); + (0, properties_1.defineReadOnly)(_this, "projectId", provider.projectId); + (0, properties_1.defineReadOnly)(_this, "projectSecret", provider.projectSecret); + return _this; + } + InfuraWebSocketProvider2.prototype.isCommunityResource = function() { + return this.projectId === defaultProjectId; + }; + return InfuraWebSocketProvider2; + }(websocket_provider_1.WebSocketProvider) + ); + exports2.InfuraWebSocketProvider = InfuraWebSocketProvider; + var InfuraProvider = ( + /** @class */ + function(_super) { + __extends(InfuraProvider2, _super); + function InfuraProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + InfuraProvider2.getWebSocketProvider = function(network, apiKey) { + return new InfuraWebSocketProvider(network, apiKey); + }; + InfuraProvider2.getApiKey = function(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; + }; + InfuraProvider2.getUrl = function(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", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + var connection = { + allowGzip: true, + url: "https://" + host + "/v3/" + apiKey.projectId, + throttleCallback: function(attempt, url) { + if (apiKey.projectId === defaultProjectId) { + (0, formatter_1.showThrottleMessage)(); + } + return Promise.resolve(true); + } + }; + if (apiKey.projectSecret != null) { + connection.user = ""; + connection.password = apiKey.projectSecret; + } + return connection; + }; + InfuraProvider2.prototype.isCommunityResource = function() { + return this.projectId === defaultProjectId; + }; + return InfuraProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.InfuraProvider = InfuraProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/json-rpc-batch-provider.js +var require_json_rpc_batch_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/json-rpc-batch-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.JsonRpcBatchProvider = void 0; + var properties_1 = require_lib4(); + var web_1 = require_lib27(); + var json_rpc_provider_1 = require_json_rpc_provider(); + var JsonRpcBatchProvider = ( + /** @class */ + function(_super) { + __extends(JsonRpcBatchProvider2, _super); + function JsonRpcBatchProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + JsonRpcBatchProvider2.prototype.send = function(method, params) { + var _this = this; + var request = { + method, + params, + id: this._nextId++, + jsonrpc: "2.0" + }; + if (this._pendingBatch == null) { + this._pendingBatch = []; + } + var inflightRequest = { 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) { + this._pendingBatchAggregator = setTimeout(function() { + var batch = _this._pendingBatch; + _this._pendingBatch = null; + _this._pendingBatchAggregator = null; + var request2 = batch.map(function(inflight) { + return inflight.request; + }); + _this.emit("debug", { + action: "requestBatch", + request: (0, properties_1.deepCopy)(request2), + provider: _this + }); + return (0, web_1.fetchJson)(_this.connection, JSON.stringify(request2)).then(function(result) { + _this.emit("debug", { + action: "response", + request: request2, + response: result, + provider: _this + }); + batch.forEach(function(inflightRequest2, 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; + inflightRequest2.reject(error); + } else { + inflightRequest2.resolve(payload.result); + } + }); + }, function(error) { + _this.emit("debug", { + action: "response", + error, + request: request2, + provider: _this + }); + batch.forEach(function(inflightRequest2) { + inflightRequest2.reject(error); + }); + }); + }, 10); + } + return promise; + }; + return JsonRpcBatchProvider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.JsonRpcBatchProvider = JsonRpcBatchProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/nodesmith-provider.js +var require_nodesmith_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/nodesmith-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.NodesmithProvider = void 0; + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var defaultApiKey = "ETHERS_JS_SHARED"; + var NodesmithProvider = ( + /** @class */ + function(_super) { + __extends(NodesmithProvider2, _super); + function NodesmithProvider2() { + return _super !== null && _super.apply(this, arguments) || this; + } + NodesmithProvider2.getApiKey = function(apiKey) { + if (apiKey && typeof apiKey !== "string") { + logger.throwArgumentError("invalid apiKey", "apiKey", apiKey); + } + return apiKey || defaultApiKey; + }; + NodesmithProvider2.getUrl = function(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 NodesmithProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.NodesmithProvider = NodesmithProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/pocket-provider.js +var require_pocket_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/pocket-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.PocketProvider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + var defaultApplicationIds = { + homestead: "6004bcd10040261633ade990", + ropsten: "6004bd4d0040261633ade991", + rinkeby: "6004bda20040261633ade994", + goerli: "6004bd860040261633ade992" + }; + var PocketProvider = ( + /** @class */ + function(_super) { + __extends(PocketProvider2, _super); + function PocketProvider2(network, apiKey) { + var _newTarget = this.constructor; + var _this = this; + if (apiKey == null) { + var n = (0, properties_1.getStatic)(_newTarget, "getNetwork")(network); + if (n) { + var applicationId = defaultApplicationIds[n.name]; + if (applicationId) { + apiKey = { + applicationId, + loadBalancer: true + }; + } + } + if (apiKey == null) { + logger.throwError("unsupported network", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + } + _this = _super.call(this, network, apiKey) || this; + return _this; + } + PocketProvider2.getApiKey = function(apiKey) { + if (apiKey == null) { + logger.throwArgumentError("PocketProvider.getApiKey does not support null apiKey", "apiKey", apiKey); + } + var apiKeyObj = { + applicationId: null, + loadBalancer: false, + applicationSecretKey: null + }; + 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; + }; + PocketProvider2.getUrl = function(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", logger_1.Logger.errors.INVALID_ARGUMENT, { + argument: "network", + value: network + }); + } + var url = null; + if (apiKey.loadBalancer) { + url = "https://" + host + "/v1/lb/" + apiKey.applicationId; + } else { + url = "https://" + host + "/v1/" + apiKey.applicationId; + } + var connection = { url }; + connection.headers = {}; + if (apiKey.applicationSecretKey != null) { + connection.user = ""; + connection.password = apiKey.applicationSecretKey; + } + return connection; + }; + PocketProvider2.prototype.isCommunityResource = function() { + return this.applicationId === defaultApplicationIds[this.network.name]; + }; + return PocketProvider2; + }(url_json_rpc_provider_1.UrlJsonRpcProvider) + ); + exports2.PocketProvider = PocketProvider; + } +}); + +// node_modules/@ethersproject/providers/lib/web3-provider.js +var require_web3_provider = __commonJS({ + "node_modules/@ethersproject/providers/lib/web3-provider.js"(exports2) { + "use strict"; + var __extends = exports2 && exports2.__extends || /* @__PURE__ */ function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) { + d2.__proto__ = b2; + } || function(d2, b2) { + for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + }(); + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Web3Provider = void 0; + var properties_1 = require_lib4(); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + var json_rpc_provider_1 = require_json_rpc_provider(); + var _nextId = 1; + function buildWeb3LegacyFetcher(provider, sendFunc) { + var fetcher = "Web3LegacyFetcher"; + return function(method, params) { + var _this = this; + var request = { + method, + params, + id: _nextId++, + jsonrpc: "2.0" + }; + return new Promise(function(resolve, reject) { + _this.emit("debug", { + action: "request", + fetcher, + request: (0, properties_1.deepCopy)(request), + provider: _this + }); + sendFunc(request, function(error, response) { + if (error) { + _this.emit("debug", { + action: "response", + fetcher, + error, + request, + provider: _this + }); + return reject(error); + } + _this.emit("debug", { + action: "response", + fetcher, + request, + response, + provider: _this + }); + if (response.error) { + var error_1 = new Error(response.error.message); + error_1.code = response.error.code; + error_1.data = response.error.data; + return reject(error_1); + } + resolve(response.result); + }); + }); + }; + } + function buildEip1193Fetcher(provider) { + return function(method, params) { + var _this = this; + if (params == null) { + params = []; + } + var request = { method, params }; + this.emit("debug", { + action: "request", + fetcher: "Eip1193Fetcher", + request: (0, properties_1.deepCopy)(request), + provider: this + }); + return provider.request(request).then(function(response) { + _this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + response, + provider: _this + }); + return response; + }, function(error) { + _this.emit("debug", { + action: "response", + fetcher: "Eip1193Fetcher", + request, + error, + provider: _this + }); + throw error; + }); + }; + } + var Web3Provider = ( + /** @class */ + function(_super) { + __extends(Web3Provider2, _super); + function Web3Provider2(provider, network) { + var _newTarget = this.constructor; + var _this = this; + logger.checkNew(_newTarget, Web3Provider2); + 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:"; + } + } + _this = _super.call(this, path, network) || this; + (0, properties_1.defineReadOnly)(_this, "jsonRpcFetchFunc", jsonRpcFetchFunc); + (0, properties_1.defineReadOnly)(_this, "provider", subprovider); + return _this; + } + Web3Provider2.prototype.send = function(method, params) { + return this.jsonRpcFetchFunc(method, params); + }; + return Web3Provider2; + }(json_rpc_provider_1.JsonRpcProvider) + ); + exports2.Web3Provider = Web3Provider; + } +}); + +// node_modules/@ethersproject/providers/lib/index.js +var require_lib28 = __commonJS({ + "node_modules/@ethersproject/providers/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.Formatter = exports2.showThrottleMessage = exports2.isCommunityResourcable = exports2.isCommunityResource = exports2.getNetwork = exports2.getDefaultProvider = exports2.JsonRpcSigner = exports2.IpcProvider = exports2.WebSocketProvider = exports2.Web3Provider = exports2.StaticJsonRpcProvider = exports2.PocketProvider = exports2.NodesmithProvider = exports2.JsonRpcBatchProvider = exports2.JsonRpcProvider = exports2.InfuraWebSocketProvider = exports2.InfuraProvider = exports2.EtherscanProvider = exports2.CloudflareProvider = exports2.AlchemyWebSocketProvider = exports2.AlchemyProvider = exports2.FallbackProvider = exports2.UrlJsonRpcProvider = exports2.Resolver = exports2.BaseProvider = exports2.Provider = void 0; + var abstract_provider_1 = require_lib12(); + Object.defineProperty(exports2, "Provider", { enumerable: true, get: function() { + return abstract_provider_1.Provider; + } }); + var networks_1 = require_lib25(); + Object.defineProperty(exports2, "getNetwork", { enumerable: true, get: function() { + return networks_1.getNetwork; + } }); + var base_provider_1 = require_base_provider(); + Object.defineProperty(exports2, "BaseProvider", { enumerable: true, get: function() { + return base_provider_1.BaseProvider; + } }); + Object.defineProperty(exports2, "Resolver", { enumerable: true, get: function() { + return base_provider_1.Resolver; + } }); + var alchemy_provider_1 = require_alchemy_provider(); + Object.defineProperty(exports2, "AlchemyProvider", { enumerable: true, get: function() { + return alchemy_provider_1.AlchemyProvider; + } }); + Object.defineProperty(exports2, "AlchemyWebSocketProvider", { enumerable: true, get: function() { + return alchemy_provider_1.AlchemyWebSocketProvider; + } }); + var cloudflare_provider_1 = require_cloudflare_provider(); + Object.defineProperty(exports2, "CloudflareProvider", { enumerable: true, get: function() { + return cloudflare_provider_1.CloudflareProvider; + } }); + var etherscan_provider_1 = require_etherscan_provider(); + Object.defineProperty(exports2, "EtherscanProvider", { enumerable: true, get: function() { + return etherscan_provider_1.EtherscanProvider; + } }); + var fallback_provider_1 = require_fallback_provider(); + Object.defineProperty(exports2, "FallbackProvider", { enumerable: true, get: function() { + return fallback_provider_1.FallbackProvider; + } }); + var ipc_provider_1 = require_ipc_provider(); + Object.defineProperty(exports2, "IpcProvider", { enumerable: true, get: function() { + return ipc_provider_1.IpcProvider; + } }); + var infura_provider_1 = require_infura_provider(); + Object.defineProperty(exports2, "InfuraProvider", { enumerable: true, get: function() { + return infura_provider_1.InfuraProvider; + } }); + Object.defineProperty(exports2, "InfuraWebSocketProvider", { enumerable: true, get: function() { + return infura_provider_1.InfuraWebSocketProvider; + } }); + var json_rpc_provider_1 = require_json_rpc_provider(); + Object.defineProperty(exports2, "JsonRpcProvider", { enumerable: true, get: function() { + return json_rpc_provider_1.JsonRpcProvider; + } }); + Object.defineProperty(exports2, "JsonRpcSigner", { enumerable: true, get: function() { + return json_rpc_provider_1.JsonRpcSigner; + } }); + var json_rpc_batch_provider_1 = require_json_rpc_batch_provider(); + Object.defineProperty(exports2, "JsonRpcBatchProvider", { enumerable: true, get: function() { + return json_rpc_batch_provider_1.JsonRpcBatchProvider; + } }); + var nodesmith_provider_1 = require_nodesmith_provider(); + Object.defineProperty(exports2, "NodesmithProvider", { enumerable: true, get: function() { + return nodesmith_provider_1.NodesmithProvider; + } }); + var pocket_provider_1 = require_pocket_provider(); + Object.defineProperty(exports2, "PocketProvider", { enumerable: true, get: function() { + return pocket_provider_1.PocketProvider; + } }); + var url_json_rpc_provider_1 = require_url_json_rpc_provider(); + Object.defineProperty(exports2, "StaticJsonRpcProvider", { enumerable: true, get: function() { + return url_json_rpc_provider_1.StaticJsonRpcProvider; + } }); + Object.defineProperty(exports2, "UrlJsonRpcProvider", { enumerable: true, get: function() { + return url_json_rpc_provider_1.UrlJsonRpcProvider; + } }); + var web3_provider_1 = require_web3_provider(); + Object.defineProperty(exports2, "Web3Provider", { enumerable: true, get: function() { + return web3_provider_1.Web3Provider; + } }); + var websocket_provider_1 = require_websocket_provider(); + Object.defineProperty(exports2, "WebSocketProvider", { enumerable: true, get: function() { + return websocket_provider_1.WebSocketProvider; + } }); + var formatter_1 = require_formatter(); + Object.defineProperty(exports2, "Formatter", { enumerable: true, get: function() { + return formatter_1.Formatter; + } }); + Object.defineProperty(exports2, "isCommunityResourcable", { enumerable: true, get: function() { + return formatter_1.isCommunityResourcable; + } }); + Object.defineProperty(exports2, "isCommunityResource", { enumerable: true, get: function() { + return formatter_1.isCommunityResource; + } }); + Object.defineProperty(exports2, "showThrottleMessage", { enumerable: true, get: function() { + return formatter_1.showThrottleMessage; + } }); + var logger_1 = require_lib(); + var _version_1 = require_version22(); + var logger = new logger_1.Logger(_version_1.version); + function getDefaultProvider(network, options) { + if (network == null) { + network = "homestead"; + } + if (typeof network === "string") { + var match = network.match(/^(ws|http)s?:/i); + if (match) { + switch (match[1]) { + case "http": + return new json_rpc_provider_1.JsonRpcProvider(network); + case "ws": + return new websocket_provider_1.WebSocketProvider(network); + default: + logger.throwArgumentError("unsupported URL scheme", "network", network); + } + } + } + var n = (0, networks_1.getNetwork)(network); + if (!n || !n._defaultProvider) { + logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, { + operation: "getDefaultProvider", + network + }); + } + return n._defaultProvider({ + FallbackProvider: fallback_provider_1.FallbackProvider, + AlchemyProvider: alchemy_provider_1.AlchemyProvider, + CloudflareProvider: cloudflare_provider_1.CloudflareProvider, + EtherscanProvider: etherscan_provider_1.EtherscanProvider, + InfuraProvider: infura_provider_1.InfuraProvider, + JsonRpcProvider: json_rpc_provider_1.JsonRpcProvider, + NodesmithProvider: nodesmith_provider_1.NodesmithProvider, + PocketProvider: pocket_provider_1.PocketProvider, + Web3Provider: web3_provider_1.Web3Provider, + IpcProvider: ipc_provider_1.IpcProvider + }, options); + } + exports2.getDefaultProvider = getDefaultProvider; + } +}); + +// node_modules/@ethersproject/solidity/lib/_version.js +var require_version23 = __commonJS({ + "node_modules/@ethersproject/solidity/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "solidity/5.5.0"; + } +}); + +// node_modules/@ethersproject/solidity/lib/index.js +var require_lib29 = __commonJS({ + "node_modules/@ethersproject/solidity/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.sha256 = exports2.keccak256 = exports2.pack = void 0; + var bignumber_1 = require_lib3(); + var bytes_1 = require_lib2(); + var keccak256_1 = require_lib5(); + var sha2_1 = require_lib19(); + var strings_1 = require_lib9(); + 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_1 = require_lib(); + var _version_1 = require_version23(); + var logger = new logger_1.Logger(_version_1.version); + function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return (0, bytes_1.zeroPad)(value, 32); + } + return (0, bytes_1.arrayify)(value); + case "string": + return (0, strings_1.toUtf8Bytes)(value); + case "bytes": + return (0, bytes_1.arrayify)(value); + case "bool": + value = value ? "0x01" : "0x00"; + if (isArray) { + return (0, bytes_1.zeroPad)(value, 32); + } + return (0, bytes_1.arrayify)(value); + } + var match = type.match(regexNumber); + if (match) { + 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 = bignumber_1.BigNumber.from(value).toTwos(size); + return (0, bytes_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 ((0, bytes_1.arrayify)(value).byteLength !== size) { + logger.throwArgumentError("invalid value for " + type, "value", value); + } + if (isArray) { + return (0, bytes_1.arrayify)((value + Zeros).substring(0, 66)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + var baseType_1 = match[1]; + var count = parseInt(match[2] || String(value.length)); + if (count != value.length) { + logger.throwArgumentError("invalid array length for " + type, "value", value); + } + var result_1 = []; + value.forEach(function(value2) { + result_1.push(_pack(baseType_1, value2, true)); + }); + return (0, bytes_1.concat)(result_1); + } + return logger.throwArgumentError("invalid type", "type", type); + } + 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 (0, bytes_1.hexlify)((0, bytes_1.concat)(tight)); + } + exports2.pack = pack; + function keccak256(types, values) { + return (0, keccak256_1.keccak256)(pack(types, values)); + } + exports2.keccak256 = keccak256; + function sha256(types, values) { + return (0, sha2_1.sha256)(pack(types, values)); + } + exports2.sha256 = sha256; + } +}); + +// node_modules/@ethersproject/units/lib/_version.js +var require_version24 = __commonJS({ + "node_modules/@ethersproject/units/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "units/5.5.0"; + } +}); + +// node_modules/@ethersproject/units/lib/index.js +var require_lib30 = __commonJS({ + "node_modules/@ethersproject/units/lib/index.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.parseEther = exports2.formatEther = exports2.parseUnits = exports2.formatUnits = exports2.commify = void 0; + var bignumber_1 = require_lib3(); + var logger_1 = require_lib(); + var _version_1 = require_version24(); + var logger = new logger_1.Logger(_version_1.version); + var names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether" + ]; + 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); + } + var whole = comps[0]; + var negative = ""; + if (whole.substring(0, 1) === "-") { + negative = "-"; + whole = whole.substring(1); + } + 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; + } + exports2.commify = commify; + function formatUnits(value, unitName) { + if (typeof unitName === "string") { + var index = names.indexOf(unitName); + if (index !== -1) { + unitName = 3 * index; + } + } + return (0, bignumber_1.formatFixed)(value, unitName != null ? unitName : 18); + } + exports2.formatUnits = formatUnits; + 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 (0, bignumber_1.parseFixed)(value, unitName != null ? unitName : 18); + } + exports2.parseUnits = parseUnits; + function formatEther(wei) { + return formatUnits(wei, 18); + } + exports2.formatEther = formatEther; + function parseEther(ether) { + return parseUnits(ether, 18); + } + exports2.parseEther = parseEther; + } +}); + +// node_modules/ethers/lib/utils.js +var require_utils5 = __commonJS({ + "node_modules/ethers/lib/utils.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.formatBytes32String = exports2.Utf8ErrorFuncs = exports2.toUtf8String = exports2.toUtf8CodePoints = exports2.toUtf8Bytes = exports2._toEscapedUtf8String = exports2.nameprep = exports2.hexDataSlice = exports2.hexDataLength = exports2.hexZeroPad = exports2.hexValue = exports2.hexStripZeros = exports2.hexConcat = exports2.isHexString = exports2.hexlify = exports2.base64 = exports2.base58 = exports2.TransactionDescription = exports2.LogDescription = exports2.Interface = exports2.SigningKey = exports2.HDNode = exports2.defaultPath = exports2.isBytesLike = exports2.isBytes = exports2.zeroPad = exports2.stripZeros = exports2.concat = exports2.arrayify = exports2.shallowCopy = exports2.resolveProperties = exports2.getStatic = exports2.defineReadOnly = exports2.deepCopy = exports2.checkProperties = exports2.poll = exports2.fetchJson = exports2._fetchData = exports2.RLP = exports2.Logger = exports2.checkResultErrors = exports2.FormatTypes = exports2.ParamType = exports2.FunctionFragment = exports2.EventFragment = exports2.ErrorFragment = exports2.ConstructorFragment = exports2.Fragment = exports2.defaultAbiCoder = exports2.AbiCoder = void 0; + exports2.Indexed = exports2.Utf8ErrorReason = exports2.UnicodeNormalizationForm = exports2.SupportedAlgorithm = exports2.mnemonicToSeed = exports2.isValidMnemonic = exports2.entropyToMnemonic = exports2.mnemonicToEntropy = exports2.getAccountPath = exports2.verifyTypedData = exports2.verifyMessage = exports2.recoverPublicKey = exports2.computePublicKey = exports2.recoverAddress = exports2.computeAddress = exports2.getJsonWalletAddress = exports2.TransactionTypes = exports2.serializeTransaction = exports2.parseTransaction = exports2.accessListify = exports2.joinSignature = exports2.splitSignature = exports2.soliditySha256 = exports2.solidityKeccak256 = exports2.solidityPack = exports2.shuffled = exports2.randomBytes = exports2.sha512 = exports2.sha256 = exports2.ripemd160 = exports2.keccak256 = exports2.computeHmac = exports2.commify = exports2.parseUnits = exports2.formatUnits = exports2.parseEther = exports2.formatEther = exports2.isAddress = exports2.getCreate2Address = exports2.getContractAddress = exports2.getIcapAddress = exports2.getAddress = exports2._TypedDataEncoder = exports2.id = exports2.isValidName = exports2.namehash = exports2.hashMessage = exports2.parseBytes32String = void 0; + var abi_1 = require_lib11(); + Object.defineProperty(exports2, "AbiCoder", { enumerable: true, get: function() { + return abi_1.AbiCoder; + } }); + Object.defineProperty(exports2, "checkResultErrors", { enumerable: true, get: function() { + return abi_1.checkResultErrors; + } }); + Object.defineProperty(exports2, "ConstructorFragment", { enumerable: true, get: function() { + return abi_1.ConstructorFragment; + } }); + Object.defineProperty(exports2, "defaultAbiCoder", { enumerable: true, get: function() { + return abi_1.defaultAbiCoder; + } }); + Object.defineProperty(exports2, "ErrorFragment", { enumerable: true, get: function() { + return abi_1.ErrorFragment; + } }); + Object.defineProperty(exports2, "EventFragment", { enumerable: true, get: function() { + return abi_1.EventFragment; + } }); + Object.defineProperty(exports2, "FormatTypes", { enumerable: true, get: function() { + return abi_1.FormatTypes; + } }); + Object.defineProperty(exports2, "Fragment", { enumerable: true, get: function() { + return abi_1.Fragment; + } }); + Object.defineProperty(exports2, "FunctionFragment", { enumerable: true, get: function() { + return abi_1.FunctionFragment; + } }); + Object.defineProperty(exports2, "Indexed", { enumerable: true, get: function() { + return abi_1.Indexed; + } }); + Object.defineProperty(exports2, "Interface", { enumerable: true, get: function() { + return abi_1.Interface; + } }); + Object.defineProperty(exports2, "LogDescription", { enumerable: true, get: function() { + return abi_1.LogDescription; + } }); + Object.defineProperty(exports2, "ParamType", { enumerable: true, get: function() { + return abi_1.ParamType; + } }); + Object.defineProperty(exports2, "TransactionDescription", { enumerable: true, get: function() { + return abi_1.TransactionDescription; + } }); + var address_1 = require_lib7(); + Object.defineProperty(exports2, "getAddress", { enumerable: true, get: function() { + return address_1.getAddress; + } }); + Object.defineProperty(exports2, "getCreate2Address", { enumerable: true, get: function() { + return address_1.getCreate2Address; + } }); + Object.defineProperty(exports2, "getContractAddress", { enumerable: true, get: function() { + return address_1.getContractAddress; + } }); + Object.defineProperty(exports2, "getIcapAddress", { enumerable: true, get: function() { + return address_1.getIcapAddress; + } }); + Object.defineProperty(exports2, "isAddress", { enumerable: true, get: function() { + return address_1.isAddress; + } }); + var base64 = __importStar(require_lib26()); + exports2.base64 = base64; + var basex_1 = require_lib17(); + Object.defineProperty(exports2, "base58", { enumerable: true, get: function() { + return basex_1.Base58; + } }); + var bytes_1 = require_lib2(); + Object.defineProperty(exports2, "arrayify", { enumerable: true, get: function() { + return bytes_1.arrayify; + } }); + Object.defineProperty(exports2, "concat", { enumerable: true, get: function() { + return bytes_1.concat; + } }); + Object.defineProperty(exports2, "hexConcat", { enumerable: true, get: function() { + return bytes_1.hexConcat; + } }); + Object.defineProperty(exports2, "hexDataSlice", { enumerable: true, get: function() { + return bytes_1.hexDataSlice; + } }); + Object.defineProperty(exports2, "hexDataLength", { enumerable: true, get: function() { + return bytes_1.hexDataLength; + } }); + Object.defineProperty(exports2, "hexlify", { enumerable: true, get: function() { + return bytes_1.hexlify; + } }); + Object.defineProperty(exports2, "hexStripZeros", { enumerable: true, get: function() { + return bytes_1.hexStripZeros; + } }); + Object.defineProperty(exports2, "hexValue", { enumerable: true, get: function() { + return bytes_1.hexValue; + } }); + Object.defineProperty(exports2, "hexZeroPad", { enumerable: true, get: function() { + return bytes_1.hexZeroPad; + } }); + Object.defineProperty(exports2, "isBytes", { enumerable: true, get: function() { + return bytes_1.isBytes; + } }); + Object.defineProperty(exports2, "isBytesLike", { enumerable: true, get: function() { + return bytes_1.isBytesLike; + } }); + Object.defineProperty(exports2, "isHexString", { enumerable: true, get: function() { + return bytes_1.isHexString; + } }); + Object.defineProperty(exports2, "joinSignature", { enumerable: true, get: function() { + return bytes_1.joinSignature; + } }); + Object.defineProperty(exports2, "zeroPad", { enumerable: true, get: function() { + return bytes_1.zeroPad; + } }); + Object.defineProperty(exports2, "splitSignature", { enumerable: true, get: function() { + return bytes_1.splitSignature; + } }); + Object.defineProperty(exports2, "stripZeros", { enumerable: true, get: function() { + return bytes_1.stripZeros; + } }); + var hash_1 = require_lib10(); + Object.defineProperty(exports2, "_TypedDataEncoder", { enumerable: true, get: function() { + return hash_1._TypedDataEncoder; + } }); + Object.defineProperty(exports2, "hashMessage", { enumerable: true, get: function() { + return hash_1.hashMessage; + } }); + Object.defineProperty(exports2, "id", { enumerable: true, get: function() { + return hash_1.id; + } }); + Object.defineProperty(exports2, "isValidName", { enumerable: true, get: function() { + return hash_1.isValidName; + } }); + Object.defineProperty(exports2, "namehash", { enumerable: true, get: function() { + return hash_1.namehash; + } }); + var hdnode_1 = require_lib21(); + Object.defineProperty(exports2, "defaultPath", { enumerable: true, get: function() { + return hdnode_1.defaultPath; + } }); + Object.defineProperty(exports2, "entropyToMnemonic", { enumerable: true, get: function() { + return hdnode_1.entropyToMnemonic; + } }); + Object.defineProperty(exports2, "getAccountPath", { enumerable: true, get: function() { + return hdnode_1.getAccountPath; + } }); + Object.defineProperty(exports2, "HDNode", { enumerable: true, get: function() { + return hdnode_1.HDNode; + } }); + Object.defineProperty(exports2, "isValidMnemonic", { enumerable: true, get: function() { + return hdnode_1.isValidMnemonic; + } }); + Object.defineProperty(exports2, "mnemonicToEntropy", { enumerable: true, get: function() { + return hdnode_1.mnemonicToEntropy; + } }); + Object.defineProperty(exports2, "mnemonicToSeed", { enumerable: true, get: function() { + return hdnode_1.mnemonicToSeed; + } }); + var json_wallets_1 = require_lib23(); + Object.defineProperty(exports2, "getJsonWalletAddress", { enumerable: true, get: function() { + return json_wallets_1.getJsonWalletAddress; + } }); + var keccak256_1 = require_lib5(); + Object.defineProperty(exports2, "keccak256", { enumerable: true, get: function() { + return keccak256_1.keccak256; + } }); + var logger_1 = require_lib(); + Object.defineProperty(exports2, "Logger", { enumerable: true, get: function() { + return logger_1.Logger; + } }); + var sha2_1 = require_lib19(); + Object.defineProperty(exports2, "computeHmac", { enumerable: true, get: function() { + return sha2_1.computeHmac; + } }); + Object.defineProperty(exports2, "ripemd160", { enumerable: true, get: function() { + return sha2_1.ripemd160; + } }); + Object.defineProperty(exports2, "sha256", { enumerable: true, get: function() { + return sha2_1.sha256; + } }); + Object.defineProperty(exports2, "sha512", { enumerable: true, get: function() { + return sha2_1.sha512; + } }); + var solidity_1 = require_lib29(); + Object.defineProperty(exports2, "solidityKeccak256", { enumerable: true, get: function() { + return solidity_1.keccak256; + } }); + Object.defineProperty(exports2, "solidityPack", { enumerable: true, get: function() { + return solidity_1.pack; + } }); + Object.defineProperty(exports2, "soliditySha256", { enumerable: true, get: function() { + return solidity_1.sha256; + } }); + var random_1 = require_lib22(); + Object.defineProperty(exports2, "randomBytes", { enumerable: true, get: function() { + return random_1.randomBytes; + } }); + Object.defineProperty(exports2, "shuffled", { enumerable: true, get: function() { + return random_1.shuffled; + } }); + var properties_1 = require_lib4(); + Object.defineProperty(exports2, "checkProperties", { enumerable: true, get: function() { + return properties_1.checkProperties; + } }); + Object.defineProperty(exports2, "deepCopy", { enumerable: true, get: function() { + return properties_1.deepCopy; + } }); + Object.defineProperty(exports2, "defineReadOnly", { enumerable: true, get: function() { + return properties_1.defineReadOnly; + } }); + Object.defineProperty(exports2, "getStatic", { enumerable: true, get: function() { + return properties_1.getStatic; + } }); + Object.defineProperty(exports2, "resolveProperties", { enumerable: true, get: function() { + return properties_1.resolveProperties; + } }); + Object.defineProperty(exports2, "shallowCopy", { enumerable: true, get: function() { + return properties_1.shallowCopy; + } }); + var RLP = __importStar(require_lib6()); + exports2.RLP = RLP; + var signing_key_1 = require_lib14(); + Object.defineProperty(exports2, "computePublicKey", { enumerable: true, get: function() { + return signing_key_1.computePublicKey; + } }); + Object.defineProperty(exports2, "recoverPublicKey", { enumerable: true, get: function() { + return signing_key_1.recoverPublicKey; + } }); + Object.defineProperty(exports2, "SigningKey", { enumerable: true, get: function() { + return signing_key_1.SigningKey; + } }); + var strings_1 = require_lib9(); + Object.defineProperty(exports2, "formatBytes32String", { enumerable: true, get: function() { + return strings_1.formatBytes32String; + } }); + Object.defineProperty(exports2, "nameprep", { enumerable: true, get: function() { + return strings_1.nameprep; + } }); + Object.defineProperty(exports2, "parseBytes32String", { enumerable: true, get: function() { + return strings_1.parseBytes32String; + } }); + Object.defineProperty(exports2, "_toEscapedUtf8String", { enumerable: true, get: function() { + return strings_1._toEscapedUtf8String; + } }); + Object.defineProperty(exports2, "toUtf8Bytes", { enumerable: true, get: function() { + return strings_1.toUtf8Bytes; + } }); + Object.defineProperty(exports2, "toUtf8CodePoints", { enumerable: true, get: function() { + return strings_1.toUtf8CodePoints; + } }); + Object.defineProperty(exports2, "toUtf8String", { enumerable: true, get: function() { + return strings_1.toUtf8String; + } }); + Object.defineProperty(exports2, "Utf8ErrorFuncs", { enumerable: true, get: function() { + return strings_1.Utf8ErrorFuncs; + } }); + var transactions_1 = require_lib15(); + Object.defineProperty(exports2, "accessListify", { enumerable: true, get: function() { + return transactions_1.accessListify; + } }); + Object.defineProperty(exports2, "computeAddress", { enumerable: true, get: function() { + return transactions_1.computeAddress; + } }); + Object.defineProperty(exports2, "parseTransaction", { enumerable: true, get: function() { + return transactions_1.parse; + } }); + Object.defineProperty(exports2, "recoverAddress", { enumerable: true, get: function() { + return transactions_1.recoverAddress; + } }); + Object.defineProperty(exports2, "serializeTransaction", { enumerable: true, get: function() { + return transactions_1.serialize; + } }); + Object.defineProperty(exports2, "TransactionTypes", { enumerable: true, get: function() { + return transactions_1.TransactionTypes; + } }); + var units_1 = require_lib30(); + Object.defineProperty(exports2, "commify", { enumerable: true, get: function() { + return units_1.commify; + } }); + Object.defineProperty(exports2, "formatEther", { enumerable: true, get: function() { + return units_1.formatEther; + } }); + Object.defineProperty(exports2, "parseEther", { enumerable: true, get: function() { + return units_1.parseEther; + } }); + Object.defineProperty(exports2, "formatUnits", { enumerable: true, get: function() { + return units_1.formatUnits; + } }); + Object.defineProperty(exports2, "parseUnits", { enumerable: true, get: function() { + return units_1.parseUnits; + } }); + var wallet_1 = require_lib24(); + Object.defineProperty(exports2, "verifyMessage", { enumerable: true, get: function() { + return wallet_1.verifyMessage; + } }); + Object.defineProperty(exports2, "verifyTypedData", { enumerable: true, get: function() { + return wallet_1.verifyTypedData; + } }); + var web_1 = require_lib27(); + Object.defineProperty(exports2, "_fetchData", { enumerable: true, get: function() { + return web_1._fetchData; + } }); + Object.defineProperty(exports2, "fetchJson", { enumerable: true, get: function() { + return web_1.fetchJson; + } }); + Object.defineProperty(exports2, "poll", { enumerable: true, get: function() { + return web_1.poll; + } }); + var sha2_2 = require_lib19(); + Object.defineProperty(exports2, "SupportedAlgorithm", { enumerable: true, get: function() { + return sha2_2.SupportedAlgorithm; + } }); + var strings_2 = require_lib9(); + Object.defineProperty(exports2, "UnicodeNormalizationForm", { enumerable: true, get: function() { + return strings_2.UnicodeNormalizationForm; + } }); + Object.defineProperty(exports2, "Utf8ErrorReason", { enumerable: true, get: function() { + return strings_2.Utf8ErrorReason; + } }); + } +}); + +// node_modules/ethers/lib/_version.js +var require_version25 = __commonJS({ + "node_modules/ethers/lib/_version.js"(exports2) { + "use strict"; + Object.defineProperty(exports2, "__esModule", { value: true }); + exports2.version = void 0; + exports2.version = "ethers/5.5.2"; + } +}); + +// node_modules/ethers/lib/ethers.js +var require_ethers = __commonJS({ + "node_modules/ethers/lib/ethers.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.version = exports2.wordlists = exports2.utils = exports2.logger = exports2.errors = exports2.constants = exports2.FixedNumber = exports2.BigNumber = exports2.ContractFactory = exports2.Contract = exports2.BaseContract = exports2.providers = exports2.getDefaultProvider = exports2.VoidSigner = exports2.Wallet = exports2.Signer = void 0; + var contracts_1 = require_lib16(); + Object.defineProperty(exports2, "BaseContract", { enumerable: true, get: function() { + return contracts_1.BaseContract; + } }); + Object.defineProperty(exports2, "Contract", { enumerable: true, get: function() { + return contracts_1.Contract; + } }); + Object.defineProperty(exports2, "ContractFactory", { enumerable: true, get: function() { + return contracts_1.ContractFactory; + } }); + var bignumber_1 = require_lib3(); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return bignumber_1.BigNumber; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return bignumber_1.FixedNumber; + } }); + var abstract_signer_1 = require_lib13(); + Object.defineProperty(exports2, "Signer", { enumerable: true, get: function() { + return abstract_signer_1.Signer; + } }); + Object.defineProperty(exports2, "VoidSigner", { enumerable: true, get: function() { + return abstract_signer_1.VoidSigner; + } }); + var wallet_1 = require_lib24(); + Object.defineProperty(exports2, "Wallet", { enumerable: true, get: function() { + return wallet_1.Wallet; + } }); + var constants = __importStar(require_lib8()); + exports2.constants = constants; + var providers = __importStar(require_lib28()); + exports2.providers = providers; + var providers_1 = require_lib28(); + Object.defineProperty(exports2, "getDefaultProvider", { enumerable: true, get: function() { + return providers_1.getDefaultProvider; + } }); + var wordlists_1 = require_lib20(); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return wordlists_1.Wordlist; + } }); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return wordlists_1.wordlists; + } }); + var utils = __importStar(require_utils5()); + exports2.utils = utils; + var logger_1 = require_lib(); + Object.defineProperty(exports2, "errors", { enumerable: true, get: function() { + return logger_1.ErrorCode; + } }); + var _version_1 = require_version25(); + Object.defineProperty(exports2, "version", { enumerable: true, get: function() { + return _version_1.version; + } }); + var logger = new logger_1.Logger(_version_1.version); + exports2.logger = logger; + } +}); + +// node_modules/ethers/lib/index.js +var require_lib31 = __commonJS({ + "node_modules/ethers/lib/index.js"(exports2) { + "use strict"; + var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { + return m[k]; + } }); + } : function(o, m, k, k2) { + if (k2 === void 0) k2 = k; + o[k2] = m[k]; + }); + var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + } : function(o, v) { + o["default"] = v; + }); + var __importStar = exports2 && exports2.__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(exports2, "__esModule", { value: true }); + exports2.Wordlist = exports2.version = exports2.wordlists = exports2.utils = exports2.logger = exports2.errors = exports2.constants = exports2.FixedNumber = exports2.BigNumber = exports2.ContractFactory = exports2.Contract = exports2.BaseContract = exports2.providers = exports2.getDefaultProvider = exports2.VoidSigner = exports2.Wallet = exports2.Signer = exports2.ethers = void 0; + var ethers2 = __importStar(require_ethers()); + exports2.ethers = ethers2; + try { + anyGlobal = window; + if (anyGlobal._ethers == null) { + anyGlobal._ethers = ethers2; + } + } catch (error) { + } + var anyGlobal; + var ethers_1 = require_ethers(); + Object.defineProperty(exports2, "Signer", { enumerable: true, get: function() { + return ethers_1.Signer; + } }); + Object.defineProperty(exports2, "Wallet", { enumerable: true, get: function() { + return ethers_1.Wallet; + } }); + Object.defineProperty(exports2, "VoidSigner", { enumerable: true, get: function() { + return ethers_1.VoidSigner; + } }); + Object.defineProperty(exports2, "getDefaultProvider", { enumerable: true, get: function() { + return ethers_1.getDefaultProvider; + } }); + Object.defineProperty(exports2, "providers", { enumerable: true, get: function() { + return ethers_1.providers; + } }); + Object.defineProperty(exports2, "BaseContract", { enumerable: true, get: function() { + return ethers_1.BaseContract; + } }); + Object.defineProperty(exports2, "Contract", { enumerable: true, get: function() { + return ethers_1.Contract; + } }); + Object.defineProperty(exports2, "ContractFactory", { enumerable: true, get: function() { + return ethers_1.ContractFactory; + } }); + Object.defineProperty(exports2, "BigNumber", { enumerable: true, get: function() { + return ethers_1.BigNumber; + } }); + Object.defineProperty(exports2, "FixedNumber", { enumerable: true, get: function() { + return ethers_1.FixedNumber; + } }); + Object.defineProperty(exports2, "constants", { enumerable: true, get: function() { + return ethers_1.constants; + } }); + Object.defineProperty(exports2, "errors", { enumerable: true, get: function() { + return ethers_1.errors; + } }); + Object.defineProperty(exports2, "logger", { enumerable: true, get: function() { + return ethers_1.logger; + } }); + Object.defineProperty(exports2, "utils", { enumerable: true, get: function() { + return ethers_1.utils; + } }); + Object.defineProperty(exports2, "wordlists", { enumerable: true, get: function() { + return ethers_1.wordlists; + } }); + Object.defineProperty(exports2, "version", { enumerable: true, get: function() { + return ethers_1.version; + } }); + Object.defineProperty(exports2, "Wordlist", { enumerable: true, get: function() { + return ethers_1.Wordlist; + } }); + } +}); + +// src/getTickAtSqrtPrice.ts +var import_decimal = __toESM(require_decimal()); +var import_ethers = __toESM(require_lib31()); +var sqrtPriceArray = process.argv[2].split(","); +var resultsArray = []; +for (let sqrtPrice of sqrtPriceArray) { + const jsResult = new import_decimal.default(sqrtPrice).div(new import_decimal.default(2).pow(96)).pow(2).log(1.0001).floor().toFixed(0); + resultsArray.push(jsResult); +} +process.stdout.write(import_ethers.ethers.utils.defaultAbiCoder.encode(["int256[]"], [resultsArray])); +/*! Bundled license information: + +js-sha3/src/sha3.js: + (** + * [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 + *) +*/ diff --git a/test/js-scripts/package-lock.json b/test/js-scripts/package-lock.json new file mode 100644 index 000000000..19b53b593 --- /dev/null +++ b/test/js-scripts/package-lock.json @@ -0,0 +1,4484 @@ +{ + "name": "v4-js-scripts", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "v4-js-scripts", + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "@uniswap/v3-sdk": "^3.11.2" + }, + "devDependencies": { + "decimal.js": "^10.2.1", + "esbuild": "^0.21.3", + "ethers": "^5.0.8", + "ts-generator": "^0.1.1", + "ts-node": "^8.5.4", + "typescript": "^3.7.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.3.tgz", + "integrity": "sha512-yTgnwQpFVYfvvo4SvRFB0SwrW8YjOxEoT7wfMT7Ol5v7v5LDNvSGo67aExmxOb87nQNeWPVvaGBNfQ7BXcrZ9w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.3.tgz", + "integrity": "sha512-bviJOLMgurLJtF1/mAoJLxDZDL6oU5/ztMHnJQRejbJrSc9FFu0QoUoFhvi6qSKJEw9y5oGyvr9fuDtzJ30rNQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.3.tgz", + "integrity": "sha512-c+ty9necz3zB1Y+d/N+mC6KVVkGUUOcm4ZmT5i/Fk5arOaY3i6CA3P5wo/7+XzV8cb4GrI/Zjp8NuOQ9Lfsosw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.3.tgz", + "integrity": "sha512-JReHfYCRK3FVX4Ra+y5EBH1b9e16TV2OxrPAvzMsGeES0X2Ndm9ImQRI4Ket757vhc5XBOuGperw63upesclRw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.3.tgz", + "integrity": "sha512-U3fuQ0xNiAkXOmQ6w5dKpEvXQRSpHOnbw7gEfHCRXPeTKW9sBzVck6C5Yneb8LfJm0l6le4NQfkNPnWMSlTFUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.3.tgz", + "integrity": "sha512-3m1CEB7F07s19wmaMNI2KANLcnaqryJxO1fXHUV5j1rWn+wMxdUYoPyO2TnAbfRZdi7ADRwJClmOwgT13qlP3Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.3.tgz", + "integrity": "sha512-fsNAAl5pU6wmKHq91cHWQT0Fz0vtyE1JauMzKotrwqIKAswwP5cpHUCxZNSTuA/JlqtScq20/5KZ+TxQdovU/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.3.tgz", + "integrity": "sha512-tci+UJ4zP5EGF4rp8XlZIdq1q1a/1h9XuronfxTMCNBslpCtmk97Q/5qqy1Mu4zIc0yswN/yP/BLX+NTUC1bXA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.3.tgz", + "integrity": "sha512-f6kz2QpSuyHHg01cDawj0vkyMwuIvN62UAguQfnNVzbge2uWLhA7TCXOn83DT0ZvyJmBI943MItgTovUob36SQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.3.tgz", + "integrity": "sha512-vvG6R5g5ieB4eCJBQevyDMb31LMHthLpXTc2IGkFnPWS/GzIFDnaYFp558O+XybTmYrVjxnryru7QRleJvmZ6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.3.tgz", + "integrity": "sha512-HjCWhH7K96Na+66TacDLJmOI9R8iDWDDiqe17C7znGvvE4sW1ECt9ly0AJ3dJH62jHyVqW9xpxZEU1jKdt+29A==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.3.tgz", + "integrity": "sha512-BGpimEccmHBZRcAhdlRIxMp7x9PyJxUtj7apL2IuoG9VxvU/l/v1z015nFs7Si7tXUwEsvjc1rOJdZCn4QTU+Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.3.tgz", + "integrity": "sha512-5rMOWkp7FQGtAH3QJddP4w3s47iT20hwftqdm7b+loe95o8JU8ro3qZbhgMRy0VuFU0DizymF1pBKkn3YHWtsw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.3.tgz", + "integrity": "sha512-h0zj1ldel89V5sjPLo5H1SyMzp4VrgN1tPkN29TmjvO1/r0MuMRwJxL8QY05SmfsZRs6TF0c/IDH3u7XYYmbAg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.3.tgz", + "integrity": "sha512-dkAKcTsTJ+CRX6bnO17qDJbLoW37npd5gSNtSzjYQr0svghLJYGYB0NF1SNcU1vDcjXLYS5pO4qOW4YbFama4A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.3.tgz", + "integrity": "sha512-vnD1YUkovEdnZWEuMmy2X2JmzsHQqPpZElXx6dxENcIwTu+Cu5ERax6+Ke1QsE814Zf3c6rxCfwQdCTQ7tPuXA==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.3.tgz", + "integrity": "sha512-IOXOIm9WaK7plL2gMhsWJd+l2bfrhfilv0uPTptoRoSb2p09RghhQQp9YY6ZJhk/kqmeRt6siRdMSLLwzuT0KQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.3.tgz", + "integrity": "sha512-uTgCwsvQ5+vCQnqM//EfDSuomo2LhdWhFPS8VL8xKf+PKTCrcT/2kPPoWMTs22aB63MLdGMJiE3f1PHvCDmUOw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.3.tgz", + "integrity": "sha512-vNAkR17Ub2MgEud2Wag/OE4HTSI6zlb291UYzHez/psiKarp0J8PKGDnAhMBcHFoOHMXHfExzmjMojJNbAStrQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.3.tgz", + "integrity": "sha512-W8H9jlGiSBomkgmouaRoTXo49j4w4Kfbl6I1bIdO/vT0+0u4f20ko3ELzV3hPI6XV6JNBVX+8BC+ajHkvffIJA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.3.tgz", + "integrity": "sha512-EjEomwyLSCg8Ag3LDILIqYCZAq/y3diJ04PnqGRgq8/4O3VNlXyMd54j/saShaN4h5o5mivOjAzmU6C3X4v0xw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.3.tgz", + "integrity": "sha512-WGiE/GgbsEwR33++5rzjiYsKyHywE8QSZPF7Rfx9EBfK3Qn3xyR6IjyCr5Uk38Kg8fG4/2phN7sXp4NPWd3fcw==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.3.tgz", + "integrity": "sha512-xRxC0jaJWDLYvcUvjQmHCJSfMrgmUuvsoXgDeU/wTorQ1ngDdUBuFtgY3W1Pc5sprGAvZBtWdJX7RPg/iZZUqA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@ethersproject/abi": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", + "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.5.0.tgz", + "integrity": "sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "node_modules/@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.5.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "node_modules/@ethersproject/contracts": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.5.0.tgz", + "integrity": "sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "^5.5.0", + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", + "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "node_modules/@ethersproject/hdnode": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.5.0.tgz", + "integrity": "sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/basex": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/pbkdf2": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/sha2": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0", + "@ethersproject/strings": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/wordlists": "^5.5.0" + } + }, + "node_modules/@ethersproject/json-wallets": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz", + "integrity": "sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/hdnode": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/pbkdf2": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/random": "^5.5.0", + "@ethersproject/strings": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ] + }, + "node_modules/@ethersproject/networks": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.1.tgz", + "integrity": "sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.5.0" + } + }, + "node_modules/@ethersproject/pbkdf2": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz", + "integrity": "sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/sha2": "^5.5.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.5.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.1.tgz", + "integrity": "sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/basex": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/random": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/sha2": "^5.5.0", + "@ethersproject/strings": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0", + "bech32": "1.1.4", + "ws": "7.4.6" + } + }, + "node_modules/@ethersproject/random": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.0.tgz", + "integrity": "sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.5.0.tgz", + "integrity": "sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/solidity": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.5.0.tgz", + "integrity": "sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/sha2": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "node_modules/@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "node_modules/@ethersproject/units": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.5.0.tgz", + "integrity": "sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "node_modules/@ethersproject/wallet": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.5.0.tgz", + "integrity": "sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/hdnode": "^5.5.0", + "@ethersproject/json-wallets": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/random": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/wordlists": "^5.5.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "node_modules/@ethersproject/wordlists": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.5.0.tgz", + "integrity": "sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "node_modules/@fastify/busboy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz", + "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==", + "peer": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@metamask/eth-sig-util": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@metamask/eth-sig-util/-/eth-sig-util-4.0.1.tgz", + "integrity": "sha512-tghyZKLHZjcdlDqCA3gNZmLeR0XvOE9U1qoQO9ohyAZT6Pya+H9vkBPcsyXytmYLNgVoin7CKCmweo/R43V+tQ==", + "peer": true, + "dependencies": { + "ethereumjs-abi": "^0.6.8", + "ethereumjs-util": "^6.2.1", + "ethjs-util": "^0.1.6", + "tweetnacl": "^1.0.3", + "tweetnacl-util": "^0.15.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@noble/hashes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", + "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "peer": true + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", + "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "peer": true + }, + "node_modules/@nomicfoundation/edr": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.3.8.tgz", + "integrity": "sha512-u2UJ5QpznSHVkZRh6ePWoeVb6kmPrrqh08gCnZ9FHlJV9CITqlrTQHJkacd+INH31jx88pTAJnxePE4XAiH5qg==", + "peer": true, + "dependencies": { + "@nomicfoundation/edr-darwin-arm64": "0.3.8", + "@nomicfoundation/edr-darwin-x64": "0.3.8", + "@nomicfoundation/edr-linux-arm64-gnu": "0.3.8", + "@nomicfoundation/edr-linux-arm64-musl": "0.3.8", + "@nomicfoundation/edr-linux-x64-gnu": "0.3.8", + "@nomicfoundation/edr-linux-x64-musl": "0.3.8", + "@nomicfoundation/edr-win32-x64-msvc": "0.3.8" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-darwin-arm64": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.3.8.tgz", + "integrity": "sha512-eB0leCexS8sQEmfyD72cdvLj9djkBzQGP4wSQw6SNf2I4Sw4Cnzb3d45caG2FqFFjbvfqL0t+badUUIceqQuMw==", + "peer": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-darwin-x64": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.3.8.tgz", + "integrity": "sha512-JksVCS1N5ClwVF14EvO25HCQ+Laljh/KRfHERMVAC9ZwPbTuAd/9BtKvToCBi29uCHWqsXMI4lxCApYQv2nznw==", + "peer": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.3.8.tgz", + "integrity": "sha512-raCE+fOeNXhVBLUo87cgsHSGvYYRB6arih4eG6B9KGACWK5Veebtm9xtKeiD8YCsdUlUfat6F7ibpeNm91fpsA==", + "peer": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-arm64-musl": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.3.8.tgz", + "integrity": "sha512-PwiDp4wBZWMCIy29eKkv8moTKRrpiSDlrc+GQMSZLhOAm8T33JKKXPwD/2EbplbhCygJDGXZdtEKl9x9PaH66A==", + "peer": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-x64-gnu": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.3.8.tgz", + "integrity": "sha512-6AcvA/XKoipGap5jJmQ9Y6yT7Uf39D9lu2hBcDCXnXbMcXaDGw4mn1/L4R63D+9VGZyu1PqlcJixCUZlGGIWlg==", + "peer": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-linux-x64-musl": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.3.8.tgz", + "integrity": "sha512-cxb0sEmZjlwhYWO28sPsV64VDx31ekskhC1IsDXU1p9ntjHSJRmW4KEIqJ2O3QwJap/kLKfMS6TckvY10gjc6w==", + "peer": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/edr-win32-x64-msvc": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.3.8.tgz", + "integrity": "sha512-yVuVPqRRNLZk7TbBMkKw7lzCvI8XO8fNTPTYxymGadjr9rEGRuNTU1yBXjfJ59I1jJU/X2TSkRk1OFX0P5tpZQ==", + "peer": true, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@nomicfoundation/ethereumjs-common": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz", + "integrity": "sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg==", + "peer": true, + "dependencies": { + "@nomicfoundation/ethereumjs-util": "9.0.4" + } + }, + "node_modules/@nomicfoundation/ethereumjs-rlp": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.4.tgz", + "integrity": "sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw==", + "peer": true, + "bin": { + "rlp": "bin/rlp.cjs" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@nomicfoundation/ethereumjs-tx": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz", + "integrity": "sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw==", + "peer": true, + "dependencies": { + "@nomicfoundation/ethereumjs-common": "4.0.4", + "@nomicfoundation/ethereumjs-rlp": "5.0.4", + "@nomicfoundation/ethereumjs-util": "9.0.4", + "ethereum-cryptography": "0.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "c-kzg": "^2.1.2" + }, + "peerDependenciesMeta": { + "c-kzg": { + "optional": true + } + } + }, + "node_modules/@nomicfoundation/ethereumjs-tx/node_modules/ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "peer": true, + "dependencies": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "node_modules/@nomicfoundation/ethereumjs-util": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.4.tgz", + "integrity": "sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q==", + "peer": true, + "dependencies": { + "@nomicfoundation/ethereumjs-rlp": "5.0.4", + "ethereum-cryptography": "0.1.3" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "c-kzg": "^2.1.2" + }, + "peerDependenciesMeta": { + "c-kzg": { + "optional": true + } + } + }, + "node_modules/@nomicfoundation/ethereumjs-util/node_modules/ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "peer": true, + "dependencies": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz", + "integrity": "sha512-1LMtXj1puAxyFusBgUIy5pZk3073cNXYnXUpuNKFghHbIit/xZgbk0AokpUADbNm3gyD6bFWl3LRFh3dhVdREg==", + "peer": true, + "engines": { + "node": ">= 12" + }, + "optionalDependencies": { + "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.1", + "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.1", + "@nomicfoundation/solidity-analyzer-freebsd-x64": "0.1.1", + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.1", + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.1", + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.1", + "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.1", + "@nomicfoundation/solidity-analyzer-win32-arm64-msvc": "0.1.1", + "@nomicfoundation/solidity-analyzer-win32-ia32-msvc": "0.1.1", + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.1" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-darwin-arm64": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.1.tgz", + "integrity": "sha512-KcTodaQw8ivDZyF+D76FokN/HdpgGpfjc/gFCImdLUyqB6eSWVaZPazMbeAjmfhx3R0zm/NYVzxwAokFKgrc0w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-darwin-x64": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.1.tgz", + "integrity": "sha512-XhQG4BaJE6cIbjAVtzGOGbK3sn1BO9W29uhk9J8y8fZF1DYz0Doj8QDMfpMu+A6TjPDs61lbsmeYodIDnfveSA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-freebsd-x64": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-freebsd-x64/-/solidity-analyzer-freebsd-x64-0.1.1.tgz", + "integrity": "sha512-GHF1VKRdHW3G8CndkwdaeLkVBi5A9u2jwtlS7SLhBc8b5U/GcoL39Q+1CSO3hYqePNP+eV5YI7Zgm0ea6kMHoA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-gnu": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.1.tgz", + "integrity": "sha512-g4Cv2fO37ZsUENQ2vwPnZc2zRenHyAxHcyBjKcjaSmmkKrFr64yvzeNO8S3GBFCo90rfochLs99wFVGT/0owpg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-arm64-musl": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.1.tgz", + "integrity": "sha512-WJ3CE5Oek25OGE3WwzK7oaopY8xMw9Lhb0mlYuJl/maZVo+WtP36XoQTb7bW/i8aAdHW5Z+BqrHMux23pvxG3w==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-gnu": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.1.tgz", + "integrity": "sha512-5WN7leSr5fkUBBjE4f3wKENUy9HQStu7HmWqbtknfXkkil+eNWiBV275IOlpXku7v3uLsXTOKpnnGHJYI2qsdA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-linux-x64-musl": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.1.tgz", + "integrity": "sha512-KdYMkJOq0SYPQMmErv/63CwGwMm5XHenEna9X9aB8mQmhDBrYrlAOSsIPgFCUSL0hjxE3xHP65/EPXR/InD2+w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-win32-arm64-msvc": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-arm64-msvc/-/solidity-analyzer-win32-arm64-msvc-0.1.1.tgz", + "integrity": "sha512-VFZASBfl4qiBYwW5xeY20exWhmv6ww9sWu/krWSesv3q5hA0o1JuzmPHR4LPN6SUZj5vcqci0O6JOL8BPw+APg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-win32-ia32-msvc": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-ia32-msvc/-/solidity-analyzer-win32-ia32-msvc-0.1.1.tgz", + "integrity": "sha512-JnFkYuyCSA70j6Si6cS1A9Gh1aHTEb8kOTBApp/c7NRTFGNMH8eaInKlyuuiIbvYFhlXW4LicqyYuWNNq9hkpQ==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nomicfoundation/solidity-analyzer-win32-x64-msvc": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.1.tgz", + "integrity": "sha512-HrVJr6+WjIXGnw3Q9u6KQcbZCtk0caVWhCdFADySvRyUxJ8PnzlaP+MhwNE8oyT8OZ6ejHBRrrgjSqDCFXGirw==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@openzeppelin/contracts": { + "version": "3.4.2-solc-0.7", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.2-solc-0.7.tgz", + "integrity": "sha512-W6QmqgkADuFcTLzHL8vVoNBtkwjvQRpYIAom7KiUNoLKghyx3FgH0GBjt8NRvigV1ZmMOBllvE1By1C+bi8WpA==" + }, + "node_modules/@scure/base": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.6.tgz", + "integrity": "sha512-ok9AWwhcgYuGG3Zfhyqg+zwl+Wn5uE+dwC0NV/2qQkx4dABbb/bx96vWu8NSj+BNjjSjno+JRYRjle1jV08k3g==", + "peer": true, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", + "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "peer": true, + "dependencies": { + "@noble/hashes": "~1.2.0", + "@noble/secp256k1": "~1.7.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@scure/bip39": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", + "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "peer": true, + "dependencies": { + "@noble/hashes": "~1.2.0", + "@scure/base": "~1.1.0" + } + }, + "node_modules/@sentry/core": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-5.30.0.tgz", + "integrity": "sha512-TmfrII8w1PQZSZgPpUESqjB+jC6MvZJZdLtE/0hZ+SrnKhW3x5WlYLvTXZpcWePYBku7rl2wn1RZu6uT0qCTeg==", + "peer": true, + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/hub": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-5.30.0.tgz", + "integrity": "sha512-2tYrGnzb1gKz2EkMDQcfLrDTvmGcQPuWxLnJKXJvYTQDGLlEvi2tWz1VIHjunmOvJrB5aIQLhm+dcMRwFZDCqQ==", + "peer": true, + "dependencies": { + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/minimal": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-5.30.0.tgz", + "integrity": "sha512-BwWb/owZKtkDX+Sc4zCSTNcvZUq7YcH3uAVlmh/gtR9rmUvbzAA3ewLuB3myi4wWRAMEtny6+J/FN/x+2wn9Xw==", + "peer": true, + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/node": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-5.30.0.tgz", + "integrity": "sha512-Br5oyVBF0fZo6ZS9bxbJZG4ApAjRqAnqFFurMVJJdunNb80brh7a5Qva2kjhm+U6r9NJAB5OmDyPkA1Qnt+QVg==", + "peer": true, + "dependencies": { + "@sentry/core": "5.30.0", + "@sentry/hub": "5.30.0", + "@sentry/tracing": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/tracing": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-5.30.0.tgz", + "integrity": "sha512-dUFowCr0AIMwiLD7Fs314Mdzcug+gBVo/+NCMyDw8tFxJkwWAKl7Qa2OZxLQ0ZHjakcj1hNKfCQJ9rhyfOl4Aw==", + "peer": true, + "dependencies": { + "@sentry/hub": "5.30.0", + "@sentry/minimal": "5.30.0", + "@sentry/types": "5.30.0", + "@sentry/utils": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/types": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-5.30.0.tgz", + "integrity": "sha512-R8xOqlSTZ+htqrfteCWU5Nk0CDN5ApUTvrlvBuiH1DyP6czDZ4ktbZB0hAgBlVcK0U+qpD3ag3Tqqpa5Q67rPw==", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/utils": { + "version": "5.30.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-5.30.0.tgz", + "integrity": "sha512-zaYmoH0NWWtvnJjC9/CBseXMtKHm/tm40sz3YfJRxeQjyzRqNQPgivpd9R/oDJCYj999mzdW382p/qi2ypjLww==", + "peer": true, + "dependencies": { + "@sentry/types": "5.30.0", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@types/bn.js": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.5.tgz", + "integrity": "sha512-V46N0zwKRF5Q00AZ6hWtN0T8gGmDUaUzLWQvHFo5yThtVwK/VCenFY3wXVbOvNfajEpsTfQM4IN9k/d6gUVX3A==", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@types/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-ssE3Vlrys7sdIzs5LOxCzTVMsU7i9oa/IaW92wF32JFb3CVczqOkru2xspuKczHEbG3nvmPY7IFqVmGGHdNbYw==", + "peer": true + }, + "node_modules/@types/mkdirp": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-0.5.2.tgz", + "integrity": "sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "20.4.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.0.tgz", + "integrity": "sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g==" + }, + "node_modules/@types/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew==", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/prettier": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.1.5.tgz", + "integrity": "sha512-UEyp8LwZ4Dg30kVU2Q3amHHyTn1jEdhCIE59ANed76GaT1Vp76DD3ZWSAxgCrw6wJ0TqeoBpqmfUHiUDPs//HQ==", + "dev": true + }, + "node_modules/@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/secp256k1": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.6.tgz", + "integrity": "sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ==", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@uniswap/lib": { + "version": "4.0.1-alpha", + "resolved": "https://registry.npmjs.org/@uniswap/lib/-/lib-4.0.1-alpha.tgz", + "integrity": "sha512-f6UIliwBbRsgVLxIaBANF6w09tYqc6Y/qXdsrbEmXHyFA7ILiKrIwRFXe1yOg8M3cksgVsO9N7yuL2DdCGQKBA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/sdk-core": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/sdk-core/-/sdk-core-5.0.0.tgz", + "integrity": "sha512-m5KmkqvvEz5rurRHdG3zGJappi1Crxet3B2dpgDFgq5MKoKd6qCbeChRkoQjTTJpY1MLGCsXj8ZtZ0/arisvLQ==", + "dependencies": { + "@ethersproject/address": "^5.0.2", + "big.js": "^5.2.2", + "decimal.js-light": "^2.5.0", + "jsbi": "^3.1.4", + "tiny-invariant": "^1.1.0", + "toformat": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/swap-router-contracts": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@uniswap/swap-router-contracts/-/swap-router-contracts-1.3.1.tgz", + "integrity": "sha512-mh/YNbwKb7Mut96VuEtL+Z5bRe0xVIbjjiryn+iMMrK2sFKhR4duk/86mEz0UO5gSx4pQIw9G5276P5heY/7Rg==", + "dependencies": { + "@openzeppelin/contracts": "3.4.2-solc-0.7", + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "@uniswap/v3-periphery": "^1.4.4", + "dotenv": "^14.2.0", + "hardhat-watcher": "^2.1.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v2-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v2-core/-/v2-core-1.0.1.tgz", + "integrity": "sha512-MtybtkUPSyysqLY2U210NBDeCHX+ltHt3oADGdjqoThZaFRDKwM6k1Nb3F0A3hk5hwuQvytFWhrWHOEq6nVJ8Q==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-core": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.1.tgz", + "integrity": "sha512-7pVk4hEm00j9tc71Y9+ssYpO6ytkeI0y7WE9P6UcmNzhxPePwyAxImuhVsTqWK9YFvzgtvzJHi64pBl4jUzKMQ==", + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-periphery": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/@uniswap/v3-periphery/-/v3-periphery-1.4.4.tgz", + "integrity": "sha512-S4+m+wh8HbWSO3DKk4LwUCPZJTpCugIsHrWR86m/OrUyvSqGDTXKFfc2sMuGXCZrD1ZqO3rhQsKgdWg3Hbb2Kw==", + "dependencies": { + "@openzeppelin/contracts": "3.4.2-solc-0.7", + "@uniswap/lib": "^4.0.1-alpha", + "@uniswap/v2-core": "^1.0.1", + "@uniswap/v3-core": "^1.0.0", + "base64-sol": "1.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-sdk": { + "version": "3.11.2", + "resolved": "https://registry.npmjs.org/@uniswap/v3-sdk/-/v3-sdk-3.11.2.tgz", + "integrity": "sha512-TktyuMHVqlhtUxXK3cUaijlvlqiyWfpEYgzd2JD1EcvsVB55zLmtRKb/1fbtLbjRqOapcFsVihD5pVW9nyFlTg==", + "dependencies": { + "@ethersproject/abi": "^5.5.0", + "@ethersproject/solidity": "^5.0.9", + "@uniswap/sdk-core": "^5.0.0", + "@uniswap/swap-router-contracts": "^1.3.0", + "@uniswap/v3-periphery": "^1.1.1", + "@uniswap/v3-staker": "1.0.0", + "tiny-invariant": "^1.1.0", + "tiny-warning": "^1.0.3" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-staker": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-staker/-/v3-staker-1.0.0.tgz", + "integrity": "sha512-JV0Qc46Px5alvg6YWd+UIaGH9lDuYG/Js7ngxPit1SPaIP30AlVer1UYB7BRYeUVVxE+byUyIeN5jeQ7LLDjIw==", + "deprecated": "Please upgrade to 1.0.1", + "dependencies": { + "@openzeppelin/contracts": "3.4.1-solc-0.7-2", + "@uniswap/v3-core": "1.0.0", + "@uniswap/v3-periphery": "^1.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@uniswap/v3-staker/node_modules/@openzeppelin/contracts": { + "version": "3.4.1-solc-0.7-2", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-3.4.1-solc-0.7-2.tgz", + "integrity": "sha512-tAG9LWg8+M2CMu7hIsqHPaTyG4uDzjr6mhvH96LvOpLZZj6tgzTluBt+LsCf1/QaYrlis6pITvpIaIhE+iZB+Q==" + }, + "node_modules/@uniswap/v3-staker/node_modules/@uniswap/v3-core": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@uniswap/v3-core/-/v3-core-1.0.0.tgz", + "integrity": "sha512-kSC4djMGKMHj7sLMYVnn61k9nu+lHjMIxgg9CDQT+s2QYLoA56GbSK9Oxr+qJXzzygbkrmuY6cwgP6cW2JXPFA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/adm-zip": { + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.16.tgz", + "integrity": "sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg==", + "peer": true, + "engines": { + "node": ">=0.3.0" + } + }, + "node_modules/aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==", + "dev": true + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "peer": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/aggregate-error": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", + "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", + "peer": true, + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "peer": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "peer": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "devOptional": true + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "peer": true + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/base-x": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz", + "integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==", + "peer": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-sol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/base64-sol/-/base64-sol-1.0.1.tgz", + "integrity": "sha512-ld3cCNMeXt4uJXmLZBHFGMvVpK9KsLVEhPpFRXnvSVAqABKbuNZg/+dsq3NuM+wxFLb/UrVkz7m1ciWmkMfTbg==" + }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==", + "dev": true + }, + "node_modules/big.js": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", + "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==", + "peer": true + }, + "node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "peer": true, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "peer": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/boxen/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "peer": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/boxen/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "peer": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/boxen/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "peer": true + }, + "node_modules/boxen/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "peer": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "peer": true + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "peer": true, + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "peer": true, + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "peer": true, + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==", + "peer": true + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "peer": true + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "peer": true, + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/clean-stack": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", + "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "peer": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "peer": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "node_modules/command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "peer": true + }, + "node_modules/commander": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/commander/-/commander-3.0.2.tgz", + "integrity": "sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow==", + "peer": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "peer": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "peer": true, + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "peer": true, + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "peer": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/decimal.js": { + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.3.1.tgz", + "integrity": "sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ==", + "dev": true + }, + "node_modules/decimal.js-light": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", + "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==" + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "devOptional": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dotenv": { + "version": "14.3.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-14.3.2.tgz", + "integrity": "sha512-vwEppIphpFdvaMCaHfCEv9IgwcxMljMw2TnAQBB4VWPvzXQLTb82jwmdOKzlEVUL3gNFT4l4TPKO+Bn+sqcrVQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "peer": true + }, + "node_modules/enquirer": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", + "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", + "peer": true, + "dependencies": { + "ansi-colors": "^4.1.1", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/env-paths": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", + "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/esbuild": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.3.tgz", + "integrity": "sha512-Kgq0/ZsAPzKrbOjCQcjoSmPoWhlcVnGAUo7jvaLHoxW1Drto0KGkR1xBNg2Cp43b9ImvxmPEJZ9xkfcnqPsfBw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.3", + "@esbuild/android-arm": "0.21.3", + "@esbuild/android-arm64": "0.21.3", + "@esbuild/android-x64": "0.21.3", + "@esbuild/darwin-arm64": "0.21.3", + "@esbuild/darwin-x64": "0.21.3", + "@esbuild/freebsd-arm64": "0.21.3", + "@esbuild/freebsd-x64": "0.21.3", + "@esbuild/linux-arm": "0.21.3", + "@esbuild/linux-arm64": "0.21.3", + "@esbuild/linux-ia32": "0.21.3", + "@esbuild/linux-loong64": "0.21.3", + "@esbuild/linux-mips64el": "0.21.3", + "@esbuild/linux-ppc64": "0.21.3", + "@esbuild/linux-riscv64": "0.21.3", + "@esbuild/linux-s390x": "0.21.3", + "@esbuild/linux-x64": "0.21.3", + "@esbuild/netbsd-x64": "0.21.3", + "@esbuild/openbsd-x64": "0.21.3", + "@esbuild/sunos-x64": "0.21.3", + "@esbuild/win32-arm64": "0.21.3", + "@esbuild/win32-ia32": "0.21.3", + "@esbuild/win32-x64": "0.21.3" + } + }, + "node_modules/escalade": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", + "integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/ethereum-cryptography": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", + "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", + "peer": true, + "dependencies": { + "@noble/hashes": "1.2.0", + "@noble/secp256k1": "1.7.1", + "@scure/bip32": "1.1.5", + "@scure/bip39": "1.1.1" + } + }, + "node_modules/ethereumjs-abi": { + "version": "0.6.8", + "resolved": "https://registry.npmjs.org/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz", + "integrity": "sha512-Tx0r/iXI6r+lRsdvkFDlut0N08jWMnKRZ6Gkq+Nmw75lZe4e6o3EkSnkaBP5NF6+m5PTGAr9JP43N3LyeoglsA==", + "peer": true, + "dependencies": { + "bn.js": "^4.11.8", + "ethereumjs-util": "^6.0.0" + } + }, + "node_modules/ethereumjs-util": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz", + "integrity": "sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw==", + "peer": true, + "dependencies": { + "@types/bn.js": "^4.11.3", + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "elliptic": "^6.5.2", + "ethereum-cryptography": "^0.1.3", + "ethjs-util": "0.1.6", + "rlp": "^2.2.3" + } + }, + "node_modules/ethereumjs-util/node_modules/@types/bn.js": { + "version": "4.11.6", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz", + "integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==", + "peer": true, + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/ethereumjs-util/node_modules/ethereum-cryptography": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", + "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", + "peer": true, + "dependencies": { + "@types/pbkdf2": "^3.0.0", + "@types/secp256k1": "^4.0.1", + "blakejs": "^1.1.0", + "browserify-aes": "^1.2.0", + "bs58check": "^2.1.2", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "hash.js": "^1.1.7", + "keccak": "^3.0.0", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", + "safe-buffer": "^5.1.2", + "scrypt-js": "^3.0.0", + "secp256k1": "^4.0.1", + "setimmediate": "^1.0.5" + } + }, + "node_modules/ethers": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.2.tgz", + "integrity": "sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.5.0", + "@ethersproject/abstract-provider": "5.5.1", + "@ethersproject/abstract-signer": "5.5.0", + "@ethersproject/address": "5.5.0", + "@ethersproject/base64": "5.5.0", + "@ethersproject/basex": "5.5.0", + "@ethersproject/bignumber": "5.5.0", + "@ethersproject/bytes": "5.5.0", + "@ethersproject/constants": "5.5.0", + "@ethersproject/contracts": "5.5.0", + "@ethersproject/hash": "5.5.0", + "@ethersproject/hdnode": "5.5.0", + "@ethersproject/json-wallets": "5.5.0", + "@ethersproject/keccak256": "5.5.0", + "@ethersproject/logger": "5.5.0", + "@ethersproject/networks": "5.5.1", + "@ethersproject/pbkdf2": "5.5.0", + "@ethersproject/properties": "5.5.0", + "@ethersproject/providers": "5.5.1", + "@ethersproject/random": "5.5.0", + "@ethersproject/rlp": "5.5.0", + "@ethersproject/sha2": "5.5.0", + "@ethersproject/signing-key": "5.5.0", + "@ethersproject/solidity": "5.5.0", + "@ethersproject/strings": "5.5.0", + "@ethersproject/transactions": "5.5.0", + "@ethersproject/units": "5.5.0", + "@ethersproject/wallet": "5.5.0", + "@ethersproject/web": "5.5.1", + "@ethersproject/wordlists": "5.5.0" + } + }, + "node_modules/ethjs-util": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "peer": true, + "dependencies": { + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "peer": true, + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "peer": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "peer": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/follow-redirects": { + "version": "1.15.6", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", + "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "peer": true, + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fp-ts": { + "version": "1.19.3", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-1.19.3.tgz", + "integrity": "sha512-H5KQDspykdHuztLTg+ajGN0Z2qUjcEf3Ybxc6hLt0k7/zPkn29XnKnxlBPyW2XIddWrGaJBzBl4VLYOtk39yZg==", + "peer": true + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "peer": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "peer": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "peer": true + }, + "node_modules/hardhat": { + "version": "2.22.4", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.22.4.tgz", + "integrity": "sha512-09qcXJFBHQUaraJkYNr7XlmwjOj27xBB0SL2rYS024hTj9tPMbp26AFjlf5quBMO9SR4AJFg+4qWahcYcvXBuQ==", + "peer": true, + "dependencies": { + "@ethersproject/abi": "^5.1.2", + "@metamask/eth-sig-util": "^4.0.0", + "@nomicfoundation/edr": "^0.3.7", + "@nomicfoundation/ethereumjs-common": "4.0.4", + "@nomicfoundation/ethereumjs-tx": "5.0.4", + "@nomicfoundation/ethereumjs-util": "9.0.4", + "@nomicfoundation/solidity-analyzer": "^0.1.0", + "@sentry/node": "^5.18.1", + "@types/bn.js": "^5.1.0", + "@types/lru-cache": "^5.1.0", + "adm-zip": "^0.4.16", + "aggregate-error": "^3.0.0", + "ansi-escapes": "^4.3.0", + "boxen": "^5.1.2", + "chalk": "^2.4.2", + "chokidar": "^3.4.0", + "ci-info": "^2.0.0", + "debug": "^4.1.1", + "enquirer": "^2.3.0", + "env-paths": "^2.2.0", + "ethereum-cryptography": "^1.0.3", + "ethereumjs-abi": "^0.6.8", + "find-up": "^2.1.0", + "fp-ts": "1.19.3", + "fs-extra": "^7.0.1", + "glob": "7.2.0", + "immutable": "^4.0.0-rc.12", + "io-ts": "1.10.4", + "keccak": "^3.0.2", + "lodash": "^4.17.11", + "mnemonist": "^0.38.0", + "mocha": "^10.0.0", + "p-map": "^4.0.0", + "raw-body": "^2.4.1", + "resolve": "1.17.0", + "semver": "^6.3.0", + "solc": "0.7.3", + "source-map-support": "^0.5.13", + "stacktrace-parser": "^0.1.10", + "tsort": "0.0.1", + "undici": "^5.14.0", + "uuid": "^8.3.2", + "ws": "^7.4.6" + }, + "bin": { + "hardhat": "internal/cli/bootstrap.js" + }, + "peerDependencies": { + "ts-node": "*", + "typescript": "*" + }, + "peerDependenciesMeta": { + "ts-node": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/hardhat-watcher": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hardhat-watcher/-/hardhat-watcher-2.5.0.tgz", + "integrity": "sha512-Su2qcSMIo2YO2PrmJ0/tdkf+6pSt8zf9+4URR5edMVti6+ShI8T3xhPrwugdyTOFuyj8lKHrcTZNKUFYowYiyA==", + "dependencies": { + "chokidar": "^3.5.3" + }, + "peerDependencies": { + "hardhat": "^2.0.0" + } + }, + "node_modules/hardhat/node_modules/resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "peer": true, + "dependencies": { + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "engines": { + "node": ">=4" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "peer": true, + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "peer": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "peer": true, + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "peer": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "peer": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/immutable": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.6.tgz", + "integrity": "sha512-Ju0+lEMyzMVZarkTn/gqRpdqd5dOPaz1mCZ0SH3JV6iFw81PldE/PEB1hWVEA288HPt4WXW8O7AWxB10M+03QQ==", + "peer": true + }, + "node_modules/indent-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", + "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/io-ts": { + "version": "1.10.4", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-1.10.4.tgz", + "integrity": "sha512-b23PteSnYXSONJ6JQXRAlvJhuw8KOtkqa87W4wDtvMrud/DTJd5X+NpOOI+O/zZwVq6v0VLAaJ+1EDViKEuN9g==", + "peer": true, + "dependencies": { + "fp-ts": "^1.0.0" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hex-prefixed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", + "integrity": "sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA==", + "peer": true, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "peer": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsbi": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/jsbi/-/jsbi-3.2.5.tgz", + "integrity": "sha512-aBE4n43IPvjaddScbvWRA2YlTzKEynHzu7MqOyTipdHucf/VxS63ViCjxYRg86M8Rxwbt/GfzHl1kKERkt45fQ==" + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", + "peer": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/keccak": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.4.tgz", + "integrity": "sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q==", + "hasInstallScript": true, + "peer": true, + "dependencies": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/klaw": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz", + "integrity": "sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw==", + "peer": true, + "optionalDependencies": { + "graceful-fs": "^4.1.9" + } + }, + "node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "peer": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "peer": true + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "peer": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "peer": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "peer": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "peer": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "peer": true + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "peer": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru_map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", + "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", + "peer": true + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "devOptional": true + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "peer": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/memorystream": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", + "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==", + "peer": true, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/mnemonist": { + "version": "0.38.5", + "resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.38.5.tgz", + "integrity": "sha512-bZTFT5rrPKtPJxj8KSV0WkPyNxl72vQepqqVUAW2ARUpUSF2qXMB6jZj7hW5/k7C1rtpzqbD/IIbJwLXUjCHeg==", + "peer": true, + "dependencies": { + "obliterator": "^2.0.0" + } + }, + "node_modules/mocha": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.4.0.tgz", + "integrity": "sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==", + "peer": true, + "dependencies": { + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.3", + "debug": "4.3.4", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "8.1.0", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "5.0.1", + "ms": "2.1.3", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "workerpool": "6.2.1", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha.js" + }, + "engines": { + "node": ">= 14.0.0" + } + }, + "node_modules/mocha/node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "peer": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/mocha/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "peer": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/mocha/node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "peer": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/mocha/node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "peer": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "peer": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "peer": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "peer": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", + "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", + "peer": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "peer": true + }, + "node_modules/mocha/node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "peer": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "peer": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "peer": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "peer": true + }, + "node_modules/node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==", + "peer": true + }, + "node_modules/node-gyp-build": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.1.tgz", + "integrity": "sha512-OSs33Z9yWr148JZcbZd5WiAXhh/n9z8TxQcdMhIOlpN9AhWpLfvVFO73+m77bBABQMaY9XSvIa+qk0jlI7Gcaw==", + "peer": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/obliterator": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/obliterator/-/obliterator-2.0.4.tgz", + "integrity": "sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==", + "peer": true + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E= sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "peer": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "peer": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/p-map": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", + "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==", + "peer": true, + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "peer": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18= sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "peer": true, + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prettier": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", + "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "peer": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/raw-body": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", + "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", + "peer": true, + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "peer": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", + "peer": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "peer": true, + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/rlp": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", + "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", + "peer": true, + "dependencies": { + "bn.js": "^5.2.0" + }, + "bin": { + "rlp": "bin/rlp" + } + }, + "node_modules/rlp/node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==", + "peer": true + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "peer": true + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "peer": true + }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, + "node_modules/secp256k1": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", + "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", + "hasInstallScript": true, + "peer": true, + "dependencies": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "peer": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "peer": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "peer": true + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "peer": true + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "peer": true, + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/solc": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.7.3.tgz", + "integrity": "sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA==", + "peer": true, + "dependencies": { + "command-exists": "^1.2.8", + "commander": "3.0.2", + "follow-redirects": "^1.12.1", + "fs-extra": "^0.30.0", + "js-sha3": "0.8.0", + "memorystream": "^0.3.1", + "require-from-string": "^2.0.0", + "semver": "^5.5.0", + "tmp": "0.0.33" + }, + "bin": { + "solcjs": "solcjs" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/solc/node_modules/fs-extra": { + "version": "0.30.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "integrity": "sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA==", + "peer": true, + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^2.1.0", + "klaw": "^1.0.0", + "path-is-absolute": "^1.0.0", + "rimraf": "^2.2.8" + } + }, + "node_modules/solc/node_modules/jsonfile": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", + "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", + "peer": true, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/solc/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "peer": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/stacktrace-parser": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.10.tgz", + "integrity": "sha512-KJP1OCML99+8fhOHxwwzyWrlUuVX5GQ0ZpJTd1DFXhdkrvg1szxfHhawXUZ3g9TkXORQd4/WG68jMlQZ2p8wlg==", + "peer": true, + "dependencies": { + "type-fest": "^0.7.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/stacktrace-parser/node_modules/type-fest": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", + "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", + "peer": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "peer": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "peer": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "peer": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-hex-prefix": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", + "integrity": "sha512-q8d4ue7JGEiVcypji1bALTos+0pWtyGlivAWyPuTkHzuTCJqrK9sWxYQZUq6Nq3cuyv3bm734IhHvHtGGURU6A==", + "peer": true, + "dependencies": { + "is-hex-prefixed": "1.0.0" + }, + "engines": { + "node": ">=6.5.0", + "npm": ">=3" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==" + }, + "node_modules/tiny-warning": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-warning/-/tiny-warning-1.0.3.tgz", + "integrity": "sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==" + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "peer": true, + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toformat": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/toformat/-/toformat-2.0.0.tgz", + "integrity": "sha512-03SWBVop6nU8bpyZCx7SodpYznbZF5R4ljwNLBcTQzKOD9xuihRo/psX58llS1BMFhhAI08H3luot5GoXJz2pQ==" + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "peer": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/ts-essentials": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-1.0.4.tgz", + "integrity": "sha512-q3N1xS4vZpRouhYHDPwO0bDW3EZ6SK9CrrDHxi/D6BPReSjpVgWIOpLS2o0gSBZm+7q/wyKp6RVM1AeeW7uyfQ==", + "dev": true + }, + "node_modules/ts-generator": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ts-generator/-/ts-generator-0.1.1.tgz", + "integrity": "sha512-N+ahhZxTLYu1HNTQetwWcx3so8hcYbkKBHTr4b4/YgObFTIKkOSSsaa+nal12w8mfrJAyzJfETXawbNjSfP2gQ==", + "dev": true, + "dependencies": { + "@types/mkdirp": "^0.5.2", + "@types/prettier": "^2.1.1", + "@types/resolve": "^0.0.8", + "chalk": "^2.4.1", + "glob": "^7.1.2", + "mkdirp": "^0.5.1", + "prettier": "^2.1.2", + "resolve": "^1.8.1", + "ts-essentials": "^1.0.0" + }, + "bin": { + "ts-generator": "dist/cli/run.js" + } + }, + "node_modules/ts-node": { + "version": "8.10.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", + "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "devOptional": true, + "dependencies": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.17", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "engines": { + "node": ">=6.0.0" + }, + "peerDependencies": { + "typescript": ">=2.7" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "peer": true + }, + "node_modules/tsort": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", + "integrity": "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==", + "peer": true + }, + "node_modules/tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==", + "peer": true + }, + "node_modules/tweetnacl-util": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz", + "integrity": "sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw==", + "peer": true + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", + "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "devOptional": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undici": { + "version": "5.28.4", + "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz", + "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==", + "peer": true, + "dependencies": { + "@fastify/busboy": "^2.0.0" + }, + "engines": { + "node": ">=14.0" + } + }, + "node_modules/universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "peer": true, + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "peer": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "peer": true + }, + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "peer": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "peer": true, + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/workerpool": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", + "peer": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "peer": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "peer": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "peer": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "peer": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "peer": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "peer": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "peer": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "devOptional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "peer": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/test/js-scripts/package.json b/test/js-scripts/package.json index fd5acbaf8..0787c10df 100644 --- a/test/js-scripts/package.json +++ b/test/js-scripts/package.json @@ -1,7 +1,7 @@ { "name": "v4-js-scripts", "description": "Scripts for v4 tests", - "license": "BUSL-1.1", + "license": "MIT", "publishConfig": { "access": "restricted" }, @@ -21,13 +21,19 @@ }, "devDependencies": { "decimal.js": "^10.2.1", + "esbuild": "^0.21.3", "ethers": "^5.0.8", "ts-generator": "^0.1.1", "ts-node": "^8.5.4", "typescript": "^3.7.3" }, "scripts": { - "forge-test-getSqrtPriceAtTick": "npx ts-node src/getSqrtPriceAtTick.ts", - "forge-test-getTickAtSqrtPrice": "npx ts-node src/getTickAtSqrtPrice.ts" + "build": "npm i && node build.js && rm -rf node_modules", + "forge-test-getSqrtPriceAtTick": "node dist/getSqrtPriceAtTick.js", + "forge-test-getTickAtSqrtPrice": "node dist/getTickAtSqrtPrice.js", + "forge-test-getModifyLiquidityResult": "node dist/getModifyLiquidityResult.js" + }, + "dependencies": { + "@uniswap/v3-sdk": "^3.11.2" } } diff --git a/test/js-scripts/src/getModifyLiquidityResult.ts b/test/js-scripts/src/getModifyLiquidityResult.ts new file mode 100644 index 000000000..ea522069c --- /dev/null +++ b/test/js-scripts/src/getModifyLiquidityResult.ts @@ -0,0 +1,81 @@ +import { BigNumber, ethers } from "ethers"; +import JSBI from "jsbi"; +import Decimal from "decimal.js"; + +import { getSqrtPriceAtTick, getAmount0Delta, getAmount1Delta, JSBI_ZERO } from "./utils/shared"; + +const params = process.argv[2].split(","); + +const tickLower = params[0]; +const tickUpper = params[1]; +const liquidity = params[2]; +const slot0Tick = params[3]; +const slot0Price = params[4]; + +const result = modifyLiquidity(tickLower, tickUpper, liquidity, slot0Tick, slot0Price); +process.stdout.write(ethers.utils.defaultAbiCoder.encode(["int128[]"], [result])); + +function modifyLiquidity( + _tickLower: string, + _tickUpper: string, + _liquidity: string, + slot0Tick: string, + slot0Price: string, +): string[] { + // TODO: Implement fee delta calculations. + + const liquidity = JSBI.BigInt(_liquidity); + + if (JSBI.EQ(liquidity, 0)) { + return [JSBI_ZERO.toString(), JSBI_ZERO.toString()]; + } + + // State values in slot0. + const tick = JSBI.BigInt(slot0Tick); + const sqrtPriceX96 = JSBI.BigInt(slot0Price); + + // Position lower and upper ticks. + const tickLower = JSBI.BigInt(_tickLower); + const tickUpper = JSBI.BigInt(_tickUpper); + + let delta: string[] = []; + + if (JSBI.LT(tick, tickLower)) { + // The current tick is less than the lowest tick of the position, so the position is entirely in token0. + let priceLower = JSBI.BigInt(getSqrtPriceAtTick(_tickLower)); + let priceUpper = JSBI.BigInt(getSqrtPriceAtTick(_tickUpper)); + let amount0 = getAmount0Delta(priceLower, priceUpper, liquidity); + delta.push(amount0.toString()); + delta.push(JSBI_ZERO.toString()); + } else if (JSBI.LT(tick, tickUpper)) { + // In-range liquidity. As we are just calculating the values of the delta. + // We do not update any global state variable for state.liquidity, but note that the protocol increments state liquidity in this case. + + let priceUpper = JSBI.BigInt(getSqrtPriceAtTick(_tickUpper)); + let priceLower = JSBI.BigInt(getSqrtPriceAtTick(_tickLower)); + + // When tickLower == the current tick, the price returned from getSqrtPriceATick has a slight error in JS. + // In solidity because the calculations for getSqrtRatioAtTick(tickLower) == currentSqrtPriceX96, the + // numerator becomes 0, and the amount becomes 0. + // So instead of using the price from getSqrtRatioAtTick, we set the priceLower to the current price. + if (JSBI.EQ(tickLower, tick)) { + priceLower = sqrtPriceX96; + } + + let amount0 = getAmount0Delta(sqrtPriceX96, priceUpper, liquidity); + let amount1 = getAmount1Delta(priceLower, sqrtPriceX96, liquidity); + + delta.push(amount0.toString()); + delta.push(amount1.toString()); + } else { + // The current tick is greater than the highest tick of the position, meaning the position is entirely in token1. + let priceLower = JSBI.BigInt(getSqrtPriceAtTick(_tickLower)); + let priceUpper = JSBI.BigInt(getSqrtPriceAtTick(_tickUpper)); + + let amount1 = getAmount1Delta(priceLower, priceUpper, liquidity); + delta.push(JSBI_ZERO.toString()); + delta.push(amount1.toString()); + } + + return delta; +} diff --git a/test/js-scripts/src/getSqrtPriceAtTick.ts b/test/js-scripts/src/getSqrtPriceAtTick.ts index 021d41bb4..e69d4c89a 100644 --- a/test/js-scripts/src/getSqrtPriceAtTick.ts +++ b/test/js-scripts/src/getSqrtPriceAtTick.ts @@ -1,10 +1,10 @@ -import Decimal from 'decimal.js' -import { ethers } from 'ethers' +import Decimal from "decimal.js"; +import { ethers } from "ethers"; -const tickArray = process.argv[2].split(',') -const resultsArray = [] +const tickArray = process.argv[2].split(","); +const resultsArray = []; for (let tick of tickArray) { - const jsResult = new Decimal(1.0001).pow(tick).sqrt().mul(new Decimal(2).pow(96)).toFixed(0) - resultsArray.push(jsResult) + const jsResult = new Decimal(1.0001).pow(tick).sqrt().mul(new Decimal(2).pow(96)).toFixed(0); + resultsArray.push(jsResult); } -process.stdout.write(ethers.utils.defaultAbiCoder.encode(['uint160[]'], [resultsArray])) +process.stdout.write(ethers.utils.defaultAbiCoder.encode(["uint160[]"], [resultsArray])); diff --git a/test/js-scripts/src/getTickAtSqrtPrice.ts b/test/js-scripts/src/getTickAtSqrtPrice.ts index e829bdd06..8107f3a98 100644 --- a/test/js-scripts/src/getTickAtSqrtPrice.ts +++ b/test/js-scripts/src/getTickAtSqrtPrice.ts @@ -1,10 +1,10 @@ -import Decimal from 'decimal.js' -import { ethers } from 'ethers' +import Decimal from "decimal.js"; +import { ethers } from "ethers"; -const sqrtPriceArray = process.argv[2].split(',') -const resultsArray = [] +const sqrtPriceArray = process.argv[2].split(","); +const resultsArray = []; for (let sqrtPrice of sqrtPriceArray) { - const jsResult = new Decimal(sqrtPrice).div(new Decimal(2).pow(96)).pow(2).log(1.0001).floor().toFixed(0) - resultsArray.push(jsResult) + const jsResult = new Decimal(sqrtPrice).div(new Decimal(2).pow(96)).pow(2).log(1.0001).floor().toFixed(0); + resultsArray.push(jsResult); } -process.stdout.write(ethers.utils.defaultAbiCoder.encode(['int256[]'], [resultsArray])) +process.stdout.write(ethers.utils.defaultAbiCoder.encode(["int256[]"], [resultsArray])); diff --git a/test/js-scripts/src/utils/shared.ts b/test/js-scripts/src/utils/shared.ts new file mode 100644 index 000000000..96f5eaaea --- /dev/null +++ b/test/js-scripts/src/utils/shared.ts @@ -0,0 +1,25 @@ +import Decimal from "decimal.js"; +import JSBI from "jsbi"; +import { SqrtPriceMath } from "@uniswap/v3-sdk"; + +export const JSBI_ZERO = JSBI.BigInt(0); + +export function getSqrtPriceAtTick(tick: string): string { + return new Decimal(1.0001).pow(tick).sqrt().mul(new Decimal(2).pow(96)).toFixed(0); +} + +export function getAmount0Delta(sqrtPriceAX96: JSBI, sqrtPriceBX96: JSBI, liquidity: JSBI): JSBI { + if (JSBI.lessThan(liquidity, JSBI_ZERO)) { + return SqrtPriceMath.getAmount0Delta(sqrtPriceAX96, sqrtPriceBX96, JSBI.unaryMinus(liquidity), false); + } else { + return JSBI.unaryMinus(SqrtPriceMath.getAmount0Delta(sqrtPriceAX96, sqrtPriceBX96, liquidity, true)); + } +} + +export function getAmount1Delta(sqrtPriceAX96: JSBI, sqrtPriceBX96: JSBI, liquidity: JSBI): JSBI { + if (JSBI.lessThan(liquidity, JSBI_ZERO)) { + return SqrtPriceMath.getAmount1Delta(sqrtPriceAX96, sqrtPriceBX96, JSBI.unaryMinus(liquidity), false); + } else { + return JSBI.unaryMinus(SqrtPriceMath.getAmount1Delta(sqrtPriceAX96, sqrtPriceBX96, liquidity, true)); + } +} diff --git a/test/js-scripts/tsconfig.json b/test/js-scripts/tsconfig.json index cb80d17d0..7358864ba 100644 --- a/test/js-scripts/tsconfig.json +++ b/test/js-scripts/tsconfig.json @@ -8,5 +8,5 @@ "typeRoots": ["./typechain", "./node_modules/@types"], "types": ["@nomiclabs/hardhat-ethers"] }, - "include": ["./test"], + "include": ["./test"] } diff --git a/test/js-scripts/yarn.lock b/test/js-scripts/yarn.lock deleted file mode 100644 index a651b9f1d..000000000 --- a/test/js-scripts/yarn.lock +++ /dev/null @@ -1,1036 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@ethersproject/abi@5.5.0", "@ethersproject/abi@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.5.0.tgz#fb52820e22e50b854ff15ce1647cc508d6660613" - integrity sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w== - dependencies: - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/abstract-provider@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz#2f1f6e8a3ab7d378d8ad0b5718460f85649710c5" - integrity sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/networks" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/web" "^5.5.0" - -"@ethersproject/abstract-provider@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz#0c4ac7054650dbd9c476cf5907f588bbb6ef3061" - integrity sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw== - dependencies: - "@ethersproject/bignumber" "^5.6.0" - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/networks" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/transactions" "^5.6.0" - "@ethersproject/web" "^5.6.0" - -"@ethersproject/abstract-provider@^5.6.0", "@ethersproject/abstract-provider@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz#b0a8550f88b6bf9d51f90e4795d48294630cb9ef" - integrity sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/networks" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/transactions" "^5.7.0" - "@ethersproject/web" "^5.7.0" - -"@ethersproject/abstract-signer@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz#590ff6693370c60ae376bf1c7ada59eb2a8dd08d" - integrity sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA== - dependencies: - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - -"@ethersproject/abstract-signer@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.6.0.tgz#9cd7ae9211c2b123a3b29bf47aab17d4d016e3e7" - integrity sha512-WOqnG0NJKtI8n0wWZPReHtaLkDByPL67tn4nBaDAhmVq8sjHTPbCdz4DRhVu/cfTOvfy9w3iq5QZ7BX7zw56BQ== - dependencies: - "@ethersproject/abstract-provider" "^5.6.0" - "@ethersproject/bignumber" "^5.6.0" - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - -"@ethersproject/abstract-signer@^5.6.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz#13f4f32117868452191a4649723cb086d2b596b2" - integrity sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ== - dependencies: - "@ethersproject/abstract-provider" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - -"@ethersproject/address@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.5.0.tgz#bcc6f576a553f21f3dd7ba17248f81b473c9c78f" - integrity sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/rlp" "^5.5.0" - -"@ethersproject/address@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.0.tgz#13c49836d73e7885fc148ad633afad729da25012" - integrity sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ== - dependencies: - "@ethersproject/bignumber" "^5.6.0" - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/keccak256" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/rlp" "^5.6.0" - -"@ethersproject/address@^5.6.0", "@ethersproject/address@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.7.0.tgz#19b56c4d74a3b0a46bfdbb6cfcc0a153fc697f37" - integrity sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - -"@ethersproject/base64@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.5.0.tgz#881e8544e47ed976930836986e5eb8fab259c090" - integrity sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA== - dependencies: - "@ethersproject/bytes" "^5.5.0" - -"@ethersproject/base64@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.6.0.tgz#a12c4da2a6fb86d88563216b0282308fc15907c9" - integrity sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw== - dependencies: - "@ethersproject/bytes" "^5.6.0" - -"@ethersproject/base64@^5.6.0", "@ethersproject/base64@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.7.0.tgz#ac4ee92aa36c1628173e221d0d01f53692059e1c" - integrity sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ== - dependencies: - "@ethersproject/bytes" "^5.7.0" - -"@ethersproject/basex@5.5.0", "@ethersproject/basex@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.5.0.tgz#e40a53ae6d6b09ab4d977bd037010d4bed21b4d3" - integrity sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - -"@ethersproject/bignumber@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.5.0.tgz#875b143f04a216f4f8b96245bde942d42d279527" - integrity sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - bn.js "^4.11.9" - -"@ethersproject/bignumber@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.6.0.tgz#116c81b075c57fa765a8f3822648cf718a8a0e26" - integrity sha512-VziMaXIUHQlHJmkv1dlcd6GY2PmT0khtAqaMctCIDogxkrarMzA9L94KN1NeXqqOfFD6r0sJT3vCTOFSmZ07DA== - dependencies: - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - bn.js "^4.11.9" - -"@ethersproject/bignumber@^5.6.0", "@ethersproject/bignumber@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.7.0.tgz#e2f03837f268ba655ffba03a57853e18a18dc9c2" - integrity sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - bn.js "^5.2.1" - -"@ethersproject/bytes@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.5.0.tgz#cb11c526de657e7b45d2e0f0246fb3b9d29a601c" - integrity sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog== - dependencies: - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/bytes@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.0.tgz#81652f2a0e04533575befadce555213c11d8aa20" - integrity sha512-3hJPlYemb9V4VLfJF5BfN0+55vltPZSHU3QKUyP9M3Y2TcajbiRrz65UG+xVHOzBereB1b9mn7r12o177xgN7w== - dependencies: - "@ethersproject/logger" "^5.6.0" - -"@ethersproject/bytes@^5.6.0", "@ethersproject/bytes@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.7.0.tgz#a00f6ea8d7e7534d6d87f47188af1148d71f155d" - integrity sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/constants@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.5.0.tgz#d2a2cd7d94bd1d58377d1d66c4f53c9be4d0a45e" - integrity sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - -"@ethersproject/constants@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.6.0.tgz#55e3eb0918584d3acc0688e9958b0cedef297088" - integrity sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA== - dependencies: - "@ethersproject/bignumber" "^5.6.0" - -"@ethersproject/constants@^5.6.0", "@ethersproject/constants@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.7.0.tgz#df80a9705a7e08984161f09014ea012d1c75295e" - integrity sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA== - dependencies: - "@ethersproject/bignumber" "^5.7.0" - -"@ethersproject/contracts@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.5.0.tgz#b735260d4bd61283a670a82d5275e2a38892c197" - integrity sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg== - dependencies: - "@ethersproject/abi" "^5.5.0" - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - -"@ethersproject/hash@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.5.0.tgz#7cee76d08f88d1873574c849e0207dcb32380cc9" - integrity sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/hash@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.6.0.tgz#d24446a5263e02492f9808baa99b6e2b4c3429a2" - integrity sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA== - dependencies: - "@ethersproject/abstract-signer" "^5.6.0" - "@ethersproject/address" "^5.6.0" - "@ethersproject/bignumber" "^5.6.0" - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/keccak256" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/strings" "^5.6.0" - -"@ethersproject/hdnode@5.5.0", "@ethersproject/hdnode@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.5.0.tgz#4a04e28f41c546f7c978528ea1575206a200ddf6" - integrity sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/basex" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/pbkdf2" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/wordlists" "^5.5.0" - -"@ethersproject/json-wallets@5.5.0", "@ethersproject/json-wallets@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz#dd522d4297e15bccc8e1427d247ec8376b60e325" - integrity sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ== - dependencies: - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hdnode" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/pbkdf2" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.5.0.tgz#e4b1f9d7701da87c564ffe336f86dcee82983492" - integrity sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg== - dependencies: - "@ethersproject/bytes" "^5.5.0" - js-sha3 "0.8.0" - -"@ethersproject/keccak256@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.6.0.tgz#fea4bb47dbf8f131c2e1774a1cecbfeb9d606459" - integrity sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w== - dependencies: - "@ethersproject/bytes" "^5.6.0" - js-sha3 "0.8.0" - -"@ethersproject/keccak256@^5.6.0", "@ethersproject/keccak256@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.7.0.tgz#3186350c6e1cd6aba7940384ec7d6d9db01f335a" - integrity sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - js-sha3 "0.8.0" - -"@ethersproject/logger@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.5.0.tgz#0c2caebeff98e10aefa5aef27d7441c7fd18cf5d" - integrity sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg== - -"@ethersproject/logger@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a" - integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== - -"@ethersproject/logger@^5.6.0", "@ethersproject/logger@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.7.0.tgz#6ce9ae168e74fecf287be17062b590852c311892" - integrity sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig== - -"@ethersproject/networks@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.5.1.tgz#b7f7b9fb88dec1ea48f739b7fb9621311aa8ce6c" - integrity sha512-tYRDM4zZtSUcKnD4UMuAlj7SeXH/k5WC4SP2u1Pn57++JdXHkRu2zwNkgNogZoxHzhm9Q6qqurDBVptHOsW49Q== - dependencies: - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/networks@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.0.tgz#486d03fff29b4b6b5414d47a232ded09fe10de5e" - integrity sha512-DaVzgyThzHgSDLuURhvkp4oviGoGe9iTZW4jMEORHDRCgSZ9K9THGFKqL+qGXqPAYLEgZTf5z2w56mRrPR1MjQ== - dependencies: - "@ethersproject/logger" "^5.6.0" - -"@ethersproject/networks@^5.6.0", "@ethersproject/networks@^5.7.0": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.7.1.tgz#118e1a981d757d45ccea6bb58d9fd3d9db14ead6" - integrity sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/pbkdf2@5.5.0", "@ethersproject/pbkdf2@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz#e25032cdf02f31505d47afbf9c3e000d95c4a050" - integrity sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - -"@ethersproject/properties@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.5.0.tgz#61f00f2bb83376d2071baab02245f92070c59995" - integrity sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA== - dependencies: - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/properties@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.6.0.tgz#38904651713bc6bdd5bdd1b0a4287ecda920fa04" - integrity sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg== - dependencies: - "@ethersproject/logger" "^5.6.0" - -"@ethersproject/properties@^5.6.0", "@ethersproject/properties@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.7.0.tgz#a6e12cb0439b878aaf470f1902a176033067ed30" - integrity sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw== - dependencies: - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/providers@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.5.1.tgz#ba87e3c93219bbd2e2edf8b369873aee774abf04" - integrity sha512-2zdD5sltACDWhjUE12Kucg2PcgM6V2q9JMyVvObtVGnzJu+QSmibbP+BHQyLWZUBfLApx2942+7DC5D+n4wBQQ== - dependencies: - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/basex" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/networks" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/rlp" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/web" "^5.5.0" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/random@5.5.0", "@ethersproject/random@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.5.0.tgz#305ed9e033ca537735365ac12eed88580b0f81f9" - integrity sha512-egGYZwZ/YIFKMHcoBUo8t3a8Hb/TKYX8BCBoLjudVCZh892welR3jOxgOmb48xznc9bTcMm7Tpwc1gHC1PFNFQ== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/rlp@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.5.0.tgz#530f4f608f9ca9d4f89c24ab95db58ab56ab99a0" - integrity sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/rlp@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.6.0.tgz#55a7be01c6f5e64d6e6e7edb6061aa120962a717" - integrity sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g== - dependencies: - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - -"@ethersproject/rlp@^5.6.0", "@ethersproject/rlp@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.7.0.tgz#de39e4d5918b9d74d46de93af80b7685a9c21304" - integrity sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/sha2@5.5.0", "@ethersproject/sha2@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.5.0.tgz#a40a054c61f98fd9eee99af2c3cc6ff57ec24db7" - integrity sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.5.0.tgz#2aa37169ce7e01e3e80f2c14325f624c29cedbe0" - integrity sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - bn.js "^4.11.9" - elliptic "6.5.4" - hash.js "1.1.7" - -"@ethersproject/signing-key@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.6.0.tgz#4f02e3fb09e22b71e2e1d6dc4bcb5dafa69ce042" - integrity sha512-S+njkhowmLeUu/r7ir8n78OUKx63kBdMCPssePS89So1TH4hZqnWFsThEd/GiXYp9qMxVrydf7KdM9MTGPFukA== - dependencies: - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - bn.js "^4.11.9" - elliptic "6.5.4" - hash.js "1.1.7" - -"@ethersproject/signing-key@^5.6.0", "@ethersproject/signing-key@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.7.0.tgz#06b2df39411b00bc57c7c09b01d1e41cf1b16ab3" - integrity sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - bn.js "^5.2.1" - elliptic "6.5.4" - hash.js "1.1.7" - -"@ethersproject/solidity@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.5.0.tgz#2662eb3e5da471b85a20531e420054278362f93f" - integrity sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/sha2" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/strings@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.5.0.tgz#e6784d00ec6c57710755699003bc747e98c5d549" - integrity sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/strings@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.6.0.tgz#9891b26709153d996bf1303d39a7f4bc047878fd" - integrity sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg== - dependencies: - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/constants" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - -"@ethersproject/strings@^5.6.0", "@ethersproject/strings@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.7.0.tgz#54c9d2a7c57ae8f1205c88a9d3a56471e14d5ed2" - integrity sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg== - dependencies: - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - -"@ethersproject/transactions@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.5.0.tgz#7e9bf72e97bcdf69db34fe0d59e2f4203c7a2908" - integrity sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA== - dependencies: - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/rlp" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - -"@ethersproject/transactions@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.6.0.tgz#4b594d73a868ef6e1529a2f8f94a785e6791ae4e" - integrity sha512-4HX+VOhNjXHZyGzER6E/LVI2i6lf9ejYeWD6l4g50AdmimyuStKc39kvKf1bXWQMg7QNVh+uC7dYwtaZ02IXeg== - dependencies: - "@ethersproject/address" "^5.6.0" - "@ethersproject/bignumber" "^5.6.0" - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/constants" "^5.6.0" - "@ethersproject/keccak256" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/rlp" "^5.6.0" - "@ethersproject/signing-key" "^5.6.0" - -"@ethersproject/transactions@^5.6.0", "@ethersproject/transactions@^5.7.0": - version "5.7.0" - resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.7.0.tgz#91318fc24063e057885a6af13fdb703e1f993d3b" - integrity sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ== - dependencies: - "@ethersproject/address" "^5.7.0" - "@ethersproject/bignumber" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/constants" "^5.7.0" - "@ethersproject/keccak256" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/rlp" "^5.7.0" - "@ethersproject/signing-key" "^5.7.0" - -"@ethersproject/units@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.5.0.tgz#104d02db5b5dc42cc672cc4587bafb87a95ee45e" - integrity sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag== - dependencies: - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/constants" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - -"@ethersproject/wallet@5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.5.0.tgz#322a10527a440ece593980dca6182f17d54eae75" - integrity sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q== - dependencies: - "@ethersproject/abstract-provider" "^5.5.0" - "@ethersproject/abstract-signer" "^5.5.0" - "@ethersproject/address" "^5.5.0" - "@ethersproject/bignumber" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/hdnode" "^5.5.0" - "@ethersproject/json-wallets" "^5.5.0" - "@ethersproject/keccak256" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/random" "^5.5.0" - "@ethersproject/signing-key" "^5.5.0" - "@ethersproject/transactions" "^5.5.0" - "@ethersproject/wordlists" "^5.5.0" - -"@ethersproject/web@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.5.1.tgz#cfcc4a074a6936c657878ac58917a61341681316" - integrity sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg== - dependencies: - "@ethersproject/base64" "^5.5.0" - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@ethersproject/web@^5.5.0": - version "5.6.0" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.6.0.tgz#4bf8b3cbc17055027e1a5dd3c357e37474eaaeb8" - integrity sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg== - dependencies: - "@ethersproject/base64" "^5.6.0" - "@ethersproject/bytes" "^5.6.0" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/strings" "^5.6.0" - -"@ethersproject/web@^5.6.0", "@ethersproject/web@^5.7.0": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.7.1.tgz#de1f285b373149bee5928f4eb7bcb87ee5fbb4ae" - integrity sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w== - dependencies: - "@ethersproject/base64" "^5.7.0" - "@ethersproject/bytes" "^5.7.0" - "@ethersproject/logger" "^5.7.0" - "@ethersproject/properties" "^5.7.0" - "@ethersproject/strings" "^5.7.0" - -"@ethersproject/wordlists@5.5.0", "@ethersproject/wordlists@^5.5.0": - version "5.5.0" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.5.0.tgz#aac74963aa43e643638e5172353d931b347d584f" - integrity sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q== - dependencies: - "@ethersproject/bytes" "^5.5.0" - "@ethersproject/hash" "^5.5.0" - "@ethersproject/logger" "^5.5.0" - "@ethersproject/properties" "^5.5.0" - "@ethersproject/strings" "^5.5.0" - -"@types/mkdirp@^0.5.2": - version "0.5.2" - resolved "https://registry.yarnpkg.com/@types/mkdirp/-/mkdirp-0.5.2.tgz#503aacfe5cc2703d5484326b1b27efa67a339c1f" - integrity sha512-U5icWpv7YnZYGsN4/cmh3WD2onMY0aJIiTE6+51TwJCttdHvtCYmkBNOobHlXwrJRL0nkH9jH4kD+1FAdMN4Tg== - dependencies: - "@types/node" "*" - -"@types/node@*": - version "20.4.0" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.4.0.tgz#01d637d1891e419bc85763b46f42809cd2d5addb" - integrity sha512-jfT7iTf/4kOQ9S7CHV9BIyRaQqHu67mOjsIQBC3BKZvzvUB6zLxEwJ6sBE3ozcvP8kF6Uk5PXN0Q+c0dfhGX0g== - -"@types/prettier@^2.1.1": - version "2.1.5" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.1.5.tgz#b6ab3bba29e16b821d84e09ecfaded462b816b00" - integrity sha512-UEyp8LwZ4Dg30kVU2Q3amHHyTn1jEdhCIE59ANed76GaT1Vp76DD3ZWSAxgCrw6wJ0TqeoBpqmfUHiUDPs//HQ== - -"@types/resolve@^0.0.8": - version "0.0.8" - resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" - integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== - dependencies: - "@types/node" "*" - -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0= - -ansi-styles@^3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" - integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== - dependencies: - color-convert "^1.9.0" - -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - -bn.js@^4.11.9: - version "4.12.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" - integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== - -bn.js@^5.2.1: - version "5.2.1" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" - integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== - -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - -brorand@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" - integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== - -buffer-from@^1.0.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" - integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== - -chalk@^2.4.1: - version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" - integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== - dependencies: - ansi-styles "^3.2.1" - escape-string-regexp "^1.0.5" - supports-color "^5.3.0" - -color-convert@^1.9.0: - version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" - integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== - dependencies: - color-name "1.1.3" - -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -decimal.js@^10.2.1: - version "10.3.1" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.3.1.tgz#d8c3a444a9c6774ba60ca6ad7261c3a94fd5e783" - integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ== - -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== - -elliptic@6.5.4: - version "6.5.4" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" - integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== - dependencies: - bn.js "^4.11.9" - brorand "^1.1.0" - hash.js "^1.0.0" - hmac-drbg "^1.0.1" - inherits "^2.0.4" - minimalistic-assert "^1.0.1" - minimalistic-crypto-utils "^1.0.1" - -escape-string-regexp@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" - integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= - -ethers@^5.0.8: - version "5.5.2" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.5.2.tgz#cd2e508c7342c44fa70392f722e8de8f2416489f" - integrity sha512-EF5W+6Wwcu6BqVwpgmyR5U2+L4c1FQzlM/02dkZOugN3KF0cG9bzHZP+TDJglmPm2/IzCEJDT7KBxzayk7SAHw== - dependencies: - "@ethersproject/abi" "5.5.0" - "@ethersproject/abstract-provider" "5.5.1" - "@ethersproject/abstract-signer" "5.5.0" - "@ethersproject/address" "5.5.0" - "@ethersproject/base64" "5.5.0" - "@ethersproject/basex" "5.5.0" - "@ethersproject/bignumber" "5.5.0" - "@ethersproject/bytes" "5.5.0" - "@ethersproject/constants" "5.5.0" - "@ethersproject/contracts" "5.5.0" - "@ethersproject/hash" "5.5.0" - "@ethersproject/hdnode" "5.5.0" - "@ethersproject/json-wallets" "5.5.0" - "@ethersproject/keccak256" "5.5.0" - "@ethersproject/logger" "5.5.0" - "@ethersproject/networks" "5.5.1" - "@ethersproject/pbkdf2" "5.5.0" - "@ethersproject/properties" "5.5.0" - "@ethersproject/providers" "5.5.1" - "@ethersproject/random" "5.5.0" - "@ethersproject/rlp" "5.5.0" - "@ethersproject/sha2" "5.5.0" - "@ethersproject/signing-key" "5.5.0" - "@ethersproject/solidity" "5.5.0" - "@ethersproject/strings" "5.5.0" - "@ethersproject/transactions" "5.5.0" - "@ethersproject/units" "5.5.0" - "@ethersproject/wallet" "5.5.0" - "@ethersproject/web" "5.5.1" - "@ethersproject/wordlists" "5.5.0" - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== - -glob@^7.1.2: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - -has-flag@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" - integrity sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw== - -has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== - dependencies: - function-bind "^1.1.1" - -hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3: - version "1.1.7" - resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" - integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== - dependencies: - inherits "^2.0.3" - minimalistic-assert "^1.0.1" - -hmac-drbg@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" - integrity sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg== - dependencies: - hash.js "^1.0.3" - minimalistic-assert "^1.0.0" - minimalistic-crypto-utils "^1.0.1" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2, inherits@^2.0.3, inherits@^2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -is-core-module@^2.1.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" - integrity sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw== - dependencies: - has "^1.0.3" - -js-sha3@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" - integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== - -make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - -minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" - integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== - -minimalistic-crypto-utils@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" - integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== - -minimatch@^3.0.4: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - -minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== - -mkdirp@^0.5.1: - version "0.5.5" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.5.tgz#d91cefd62d1436ca0f41620e251288d420099def" - integrity sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ== - dependencies: - minimist "^1.2.5" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= - dependencies: - wrappy "1" - -path-is-absolute@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" - integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= - -path-parse@^1.0.6: - version "1.0.7" - resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" - integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== - -prettier@^2.1.2: - version "2.2.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5" - integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q== - -resolve@^1.8.1: - version "1.19.0" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" - integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== - dependencies: - is-core-module "^2.1.0" - path-parse "^1.0.6" - -scrypt-js@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" - integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== - -source-map-support@^0.5.17: - version "0.5.19" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" - integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - -source-map@^0.6.0: - version "0.6.1" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" - integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== - -supports-color@^5.3.0: - version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" - integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== - dependencies: - has-flag "^3.0.0" - -ts-essentials@^1.0.0: - version "1.0.4" - resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-1.0.4.tgz#ce3b5dade5f5d97cf69889c11bf7d2da8555b15a" - integrity sha512-q3N1xS4vZpRouhYHDPwO0bDW3EZ6SK9CrrDHxi/D6BPReSjpVgWIOpLS2o0gSBZm+7q/wyKp6RVM1AeeW7uyfQ== - -ts-generator@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/ts-generator/-/ts-generator-0.1.1.tgz#af46f2fb88a6db1f9785977e9590e7bcd79220ab" - integrity sha512-N+ahhZxTLYu1HNTQetwWcx3so8hcYbkKBHTr4b4/YgObFTIKkOSSsaa+nal12w8mfrJAyzJfETXawbNjSfP2gQ== - dependencies: - "@types/mkdirp" "^0.5.2" - "@types/prettier" "^2.1.1" - "@types/resolve" "^0.0.8" - chalk "^2.4.1" - glob "^7.1.2" - mkdirp "^0.5.1" - prettier "^2.1.2" - resolve "^1.8.1" - ts-essentials "^1.0.0" - -ts-node@^8.5.4: - version "8.10.2" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d" - integrity sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA== - dependencies: - arg "^4.1.0" - diff "^4.0.1" - make-error "^1.1.1" - source-map-support "^0.5.17" - yn "3.1.1" - -typescript@^3.7.3: - version "3.9.10" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.10.tgz#70f3910ac7a51ed6bef79da7800690b19bf778b8" - integrity sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q== - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== - -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== diff --git a/test/utils/Deployers.sol b/test/utils/Deployers.sol index 6eeaeba24..e3e3dea00 100644 --- a/test/utils/Deployers.sol +++ b/test/utils/Deployers.sol @@ -173,6 +173,20 @@ contract Deployers { manager.initialize(_key, sqrtPriceX96, initData); } + function initPool( + Currency _currency0, + Currency _currency1, + IHooks hooks, + uint24 fee, + int24 tickSpacing, + uint160 sqrtPriceX96, + bytes memory initData + ) internal returns (PoolKey memory _key, PoolId id) { + _key = PoolKey(_currency0, _currency1, fee, tickSpacing, hooks); + id = _key.toId(); + manager.initialize(_key, sqrtPriceX96, initData); + } + function initPoolAndAddLiquidity( Currency _currency0, Currency _currency1, diff --git a/test/utils/Logger.sol b/test/utils/Logger.sol new file mode 100644 index 000000000..7a24ac30c --- /dev/null +++ b/test/utils/Logger.sol @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity ^0.8.20; + +import {IPoolManager} from "../../src/interfaces/IPoolManager.sol"; + +import "forge-std/console2.sol"; + +// Useful for printing out the true values in a fuzz. For failing fuzzes, foundry logs the unsanitized params. +contract Logger { + function logParams(IPoolManager.ModifyLiquidityParams memory params) public { + console2.log("ModifyLiquidity.tickLower", params.tickLower); + console2.log("ModifyLiquidity.tickUpper", params.tickUpper); + console2.log("ModifyLiquidity.liquidityDelta", params.liquidityDelta); + console2.log("ModifyLiquidity.salt"); + console2.logBytes32(params.salt); + } +}